diff --git a/packages/api/.gitignore b/packages/api/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..f9f389e152042570ea69e1de23e999f442beec02 --- /dev/null +++ b/packages/api/.gitignore @@ -0,0 +1 @@ +app/bundle.api.js* diff --git a/packages/api/app/bundle.api.js b/packages/api/app/bundle.api.js deleted file mode 100644 index c77f4610f8f7edcc2a2ff6a9373a1108582a5370..0000000000000000000000000000000000000000 --- a/packages/api/app/bundle.api.js +++ /dev/null @@ -1,66420 +0,0 @@ -module.exports = -/******/ (function(modules) { // webpackBootstrap -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // object to store loaded chunks -/******/ // "0" means "already loaded" -/******/ var installedChunks = { -/******/ "main": 0 -/******/ }; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) { -/******/ return installedModules[moduleId].exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ i: moduleId, -/******/ l: false, -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.l = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = modules; -/******/ -/******/ // expose the module cache -/******/ __webpack_require__.c = installedModules; -/******/ -/******/ // define getter function for harmony exports -/******/ __webpack_require__.d = function(exports, name, getter) { -/******/ if(!__webpack_require__.o(exports, name)) { -/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); -/******/ } -/******/ }; -/******/ -/******/ // define __esModule on exports -/******/ __webpack_require__.r = function(exports) { -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { -/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); -/******/ } -/******/ Object.defineProperty(exports, '__esModule', { value: true }); -/******/ }; -/******/ -/******/ // create a fake namespace object -/******/ // mode & 1: value is a module id, require it -/******/ // mode & 2: merge all properties of value into the ns -/******/ // mode & 4: return value when already ns object -/******/ // mode & 8|1: behave like require -/******/ __webpack_require__.t = function(value, mode) { -/******/ if(mode & 1) value = __webpack_require__(value); -/******/ if(mode & 8) return value; -/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; -/******/ var ns = Object.create(null); -/******/ __webpack_require__.r(ns); -/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); -/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); -/******/ return ns; -/******/ }; -/******/ -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = function(module) { -/******/ var getter = module && module.__esModule ? -/******/ function getDefault() { return module['default']; } : -/******/ function getModuleExports() { return module; }; -/******/ __webpack_require__.d(getter, 'a', getter); -/******/ return getter; -/******/ }; -/******/ -/******/ // Object.prototype.hasOwnProperty.call -/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; -/******/ -/******/ // __webpack_public_path__ -/******/ __webpack_require__.p = ""; -/******/ -/******/ // uncaught error handler for webpack runtime -/******/ __webpack_require__.oe = function(err) { -/******/ process.nextTick(function() { -/******/ throw err; // catch this error by using import().catch() -/******/ }); -/******/ }; -/******/ -/******/ -/******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = "./packages/loot-core/src/server/main.js"); -/******/ }) -/************************************************************************/ -/******/ ({ - -/***/ "./node_modules/@rschedule/core/es2015/generators.js": -/*!***********************************************************!*\ - !*** ./node_modules/@rschedule/core/es2015/generators.js ***! - \***********************************************************/ -/*! exports provided: AddOperator, Calendar, Collection, CollectionIterator, Dates, IntersectionOperator, MergeDurationOperator, MergeDurationOperatorError, OccurrenceGenerator, OccurrenceIterator, Operator, Rule, RuleBase, Schedule, ScheduleBase, SplitDurationOperator, SplitDurationOperatorError, SubtractOperator, UniqueOperator, add, intersection, mergeDuration, splitDuration, subtract, unique */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AddOperator", function() { return AddOperator; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Calendar", function() { return Calendar; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Collection", function() { return Collection; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CollectionIterator", function() { return CollectionIterator; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Dates", function() { return Dates; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "IntersectionOperator", function() { return IntersectionOperator; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MergeDurationOperator", function() { return MergeDurationOperator; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MergeDurationOperatorError", function() { return MergeDurationOperatorError; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "OccurrenceGenerator", function() { return OccurrenceGenerator; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "OccurrenceIterator", function() { return OccurrenceIterator; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Operator", function() { return Operator; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Rule", function() { return Rule; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RuleBase", function() { return RuleBase; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Schedule", function() { return Schedule; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ScheduleBase", function() { return ScheduleBase; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SplitDurationOperator", function() { return SplitDurationOperator; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SplitDurationOperatorError", function() { return SplitDurationOperatorError; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SubtractOperator", function() { return SubtractOperator; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "UniqueOperator", function() { return UniqueOperator; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "add", function() { return add; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "intersection", function() { return intersection; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "mergeDuration", function() { return mergeDuration; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "splitDuration", function() { return splitDuration; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "subtract", function() { return subtract; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "unique", function() { return unique; }); -/* harmony import */ var _rschedule_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @rschedule/core */ "./node_modules/@rschedule/core/es2015/main.js"); - - -class OccurrenceGenerator { - constructor(args = {}) { - this.timezone = args.timezone !== undefined ? args.timezone : null; - this.maxDuration = args.maxDuration || 0; - } - /** Returns the first occurrence or, if there are no occurrences, null. */ - - - get firstDate() { - if (this._firstDate !== undefined) return this._firstDate; - - const start = this._run().next().value; - - this._firstDate = start ? this.dateAdapter.fromDateTime(start) : null; - return this._firstDate; - } - /** If generator is infinite, returns `null`. Otherwise returns the end date */ - - - get lastDate() { - if (this._lastDate !== undefined) return this._lastDate; - - if (this.isInfinite) { - this._lastDate = null; - return null; - } - - const end = this._run({ - reverse: true - }).next().value; - - this._lastDate = end ? this.dateAdapter.fromDateTime(end) : null; - return this._lastDate; - } - - pipe(...operators) { - return operators.reduce((prev, curr) => curr({ - base: prev, - timezone: this.timezone - }), this); - } - /** - * Processes the object's rules/dates and returns an iterable for the occurrences. - * - * Options object: - * - `start` the date to begin iteration on - * - `end` the date to end iteration on - * - `take` the max number of dates to take before ending iteration - * - `reverse` whether to iterate in reverse or not - * - * Examples: - * - * ``` - * const iterator = schedule.occurrences({ start: new Date(), take: 5 }); - - * for (const date of iterator) { - * // do stuff - * } - - * iterator.toArray() // returns Date array - * iterator.next().value // returns next Date - * ``` - * - */ - - - occurrences(args = {}) { - return new OccurrenceIterator(this, this.normalizeOccurrencesArgs(args)); - } - /** - * Iterates over the object's occurrences and bundles them into collections - * with a specified granularity (default is `"YEARLY"`). Make sure to - * read about each option & combination of options below. - * - * Options object: - * - start?: DateAdapter - * - end?: DateAdapter - * - take?: number - * - reverse?: NOT SUPPORTED - * - granularity?: CollectionsGranularity - * - weekStart?: DateAdapter.Weekday - * - skipEmptyPeriods?: boolean - * - * Returned `Collection` object: - * - * - `dates` property containing an array of DateAdapter objects. - * - `granularity` property containing the granularity. - * - `CollectionsGranularity` === `RuleOptions.Frequency`. - * - default is `"YEARLY"` - * - `periodStart` property containing a DateAdapter equal to the period's - * start time. - * - `periodEnd` property containing a DateAdapter equal to the period's - * end time. - * - * #### Details: - * - * `collections()` always returns full periods. This means that the `start` argument is - * transformed to be the start of whatever period the `start` argument is in, and the - * `end` argument is transformed to be the end of whatever period the `end` argument is - * in. - * - * - Example: with granularity `"YEARLY"`, the `start` argument will be transformed to be the - * start of the year passed in the `start` argument, and the `end` argument will be transformed - * to be the end of the year passed in the `end` argument. - * - * By default, the `periodStart` value of `Collection` objects produced by this method increments linearly. - * This means the returned `Collection#dates` property may have length 0. This can be changed by - * passing the `skipEmptyPeriods: true` option, in which case the `periodStart` from one collection to the - * next can "jump". - * - * - Example 1: if your object's first occurrence is 2019/2/1 (February 1st) and you call - * `collection({skipEmptyPeriods: true, granularity: 'DAILY', start: new Date(2019,0,1)})` - * (so starting on January 1st), the first Collection produced will have a `periodStart` in February. - * - * - Example 2: if your object's first occurrence is 2019/2/1 (February 1st) and you call - * `collection({granularity: 'DAILY', start: new Date(2019,0,1)})` - * (so starting on January 1st), the first collection produced will have a `Collection#periodStart` - * of January 1st and have `Collection#dates === []`. Similarly, the next 30 collections produced - * (Jan 2nd - 31st) will all contain an empty array for the `dates` property. Then the February 1st - * `Collection` will contain dates. - * - * When giving a `take` argument to `collections()`, you are specifying - * the number of `Collection` objects to return (rather than occurrences). - * - * When choosing a granularity of `"WEEKLY"`, the `weekStart` option is required. - * - * When choosing a granularity of `"MONTHLY"`: - * - * - If the `weekStart` option *is not* present, will generate collections with - * the `periodStart` and `periodEnd` at the beginning and end of each month. - * - * - If the `weekStart` option *is* present, will generate collections with the - * `periodStart` equal to the start of the first week of the month, and the - * `periodEnd` equal to the end of the last week of the month. This behavior could be - * desired when rendering opportunities in a calendar view, where the calendar renders - * full weeks (which may result in the calendar displaying dates in the - * previous or next months). - * - */ - - - collections(args = {}) { - return new CollectionIterator(this, this.normalizeCollectionsArgs(args)); - } - /** - * Returns true if an occurrence starts on or between the provided start/end - * datetimes. If the `excludeEnds` option is provided, then occurrences - * equal to the start/end times are ignored. - * - * If the occurrence generator has a duration, and `excludeEnds !== true`, - * and a `maxDuration` argument is supplied (either in the constructor or - * here), then any occurrence that's time overlaps with the start/end times - * return true. - */ - - - occursBetween(startInput, endInput, options = {}) { - const start = this.normalizeDateInput(startInput); - const end = this.normalizeDateInput(endInput); - - if (this.hasDuration && !options.excludeEnds) { - const maxDuration = this.getMaxDuration('occursBetween', options); - - const iterator = this._run({ - start: start.subtract(maxDuration, 'millisecond'), - end, - reverse: true - }); - - for (const day of iterator) { - if (day.end.isBefore(start)) continue; - return true; - } - - return false; - } - - for (const day of this._run({ - start, - end - })) { - if (options.excludeEnds) { - if (day.isEqual(start)) { - continue; - } - - if (day.isEqual(end)) { - break; - } - } - - return true; - } - - return false; - } - - occursOn(rawArgs) { - const args = this.normalizeOccursOnArgs(rawArgs); - - if (args.weekday) { - if (this.isInfinite && !args.before) { - throw new _rschedule_core__WEBPACK_IMPORTED_MODULE_0__["ArgumentError"]('When calling `occursOn()` with a `weekday` argument ' + 'and an occurrence object that has infinite occurrences, ' + 'you must include a `before` argument as well.'); - } - - const start = args.after && (args.excludeEnds ? args.after.add(1, 'day') : args.after); - const end = args.before && (args.excludeEnds ? args.before.subtract(1, 'day') : args.before); - - const iterator = this._run({ - start, - end - }); - - let date = iterator.next().value; - if (!date) return false; - - while (date) { - if (date.get('weekday') === args.weekday) { - return true; - } - - date = iterator.next({ - skipToDate: date.add(Object(_rschedule_core__WEBPACK_IMPORTED_MODULE_0__["getDifferenceBetweenWeekdays"])(date.get('weekday'), args.weekday), 'day').granularity('day') - }).value; - } - - return false; - } - - if (!args.date) { - throw new _rschedule_core__WEBPACK_IMPORTED_MODULE_0__["ArgumentError"](`"occursOn()" must be called with either a "date" or "weekday" argument`); - } - - if (this.hasDuration) { - const maxDuration = this.getMaxDuration('occursOn', args); - - const iterator = this._run({ - start: args.date.subtract(maxDuration, 'millisecond'), - end: args.date - }); - - for (const date of iterator) { - if (date.end.isBefore(args.date)) continue; - if (date.isAfter(args.date)) return false; - return true; - } - - return false; - } - - for (const day of this._run({ - start: args.date, - end: args.date - })) { - return !!day; - } - - return false; - } - /** - * Returns true if an occurrence starts after the provided datetime. - * If the `excludeStart` option is provided, then occurrences - * equal to the provided datetime are ignored. - * - * If the occurrence generator has a duration, and `excludeStart !== true`, - * and a `maxDuration` argument is supplied (either in the constructor or - * here), then any occurrence that's end time is after/equal to the provided - * datetime return true. - */ - - - occursAfter(date, options = {}) { - const adapter = this.normalizeDateInput(date); - - if (this.hasDuration && !options.excludeStart) { - const maxDuration = this.getMaxDuration('occursAfter', options); - - const iterator = this._run({ - start: adapter.subtract(maxDuration, 'millisecond') - }); - - for (const date of iterator) { - if (date.end.isBefore(adapter)) continue; - return true; - } - - return false; - } - - for (const day of this._run({ - start: adapter - })) { - if (options.excludeStart && day.isEqual(adapter)) { - continue; - } - - return true; - } - - return false; - } - /** - * Returns true if an occurrence starts before the provided datetime. - * If the `excludeStart` option is provided, then occurrences - * equal to the provided datetime are ignored. - * - * If the occurrence generator has a duration, and `excludeStart` is - * also provided, then this will only return true if an occurrence - * both starts and ends before the provided datetime. - */ - - - occursBefore(date, options = {}) { - const adapter = this.normalizeDateInput(date); - - if (this.hasDuration && options.excludeStart) { - for (const day of this._run({ - end: adapter, - reverse: true - })) { - if (day.end.isAfterOrEqual(adapter)) continue; - return true; - } - - return false; - } - - for (const day of this._run({ - end: adapter, - reverse: true - })) { - if (options.excludeStart && day.isEqual(adapter)) { - continue; - } - - return true; - } - - return false; - } - - get dateAdapter() { - return _rschedule_core__WEBPACK_IMPORTED_MODULE_0__["DateAdapterBase"].adapter; - } - - normalizeOccurrencesArgs(rawArgs) { - return Object.assign(Object.assign({}, rawArgs), { - start: this.normalizeDateInput(rawArgs.start), - end: this.normalizeDateInput(rawArgs.end) - }); - } - - normalizeCollectionsArgs(rawArgs) { - if (rawArgs.reverse !== undefined) { - throw new _rschedule_core__WEBPACK_IMPORTED_MODULE_0__["ArgumentError"]('`collections()` does not support the `reverse` option at this time.'); - } - - return Object.assign(Object.assign({}, rawArgs), { - start: this.normalizeDateInput(rawArgs.start), - end: this.normalizeDateInput(rawArgs.end) - }); - } - - normalizeOccursOnArgs(rawArgs = {}) { - return Object.assign(Object.assign({}, rawArgs), { - date: this.normalizeDateInput(rawArgs.date), - after: this.normalizeDateInput(rawArgs.after), - before: this.normalizeDateInput(rawArgs.before), - excludeDates: rawArgs.excludeDates && rawArgs.excludeDates.map(date => this.normalizeDateInput(date)) - }); - } - - normalizeRunArgs(args) { - return Object.assign(Object.assign({}, args), { - start: this.normalizeDateInput(args.start), - end: this.normalizeDateInput(args.end) - }); - } - - normalizeDateInput(date) { - return date ? Object(_rschedule_core__WEBPACK_IMPORTED_MODULE_0__["dateInputToDateTime"])(date, this.timezone) : undefined; - } - - normalizeDateInputToAdapter(date) { - if (!date) return; - return Object(_rschedule_core__WEBPACK_IMPORTED_MODULE_0__["dateInputToDateAdapter"])(date); - } - - normalizeRunOutput(date) { - return Object(_rschedule_core__WEBPACK_IMPORTED_MODULE_0__["normalizeDateTimeTimezone"])(date, this.timezone); - } - - getMaxDuration(method, options) { - const maxDuration = options.maxDuration || this.maxDuration; - - if (!Number.isInteger(maxDuration)) { - throw new _rschedule_core__WEBPACK_IMPORTED_MODULE_0__["ArgumentError"](`When an occurrence generator ` + `has a duration, a 'maxDuration' argument must be supplied ` + `to ${method}().`); - } - - return maxDuration; - } - -} - -class OccurrenceIterator { - constructor(iterable, args) { - this.iterable = iterable; - this.args = args; // Need to assert the return type of these methods to prevent typescript from - // incorrectly reducing them to `DateAdapterBase & { generators: G }`. - - this[Symbol.iterator] = () => this.occurrenceIterator(); - - this.iterator = iterable._run(args); - this.isInfinite = iterable.isInfinite; - } - - next(args) { - return this.occurrenceIterator(args).next(); - } - - toArray() { - if (this.args.end || this.args.take || !this.isInfinite) { - return Array.from(this.occurrenceIterator()); - } - - throw new _rschedule_core__WEBPACK_IMPORTED_MODULE_0__["InfiniteLoopError"]('OccurrenceIterator#toArray() can only be called if the iterator ' + 'is not infinite, or you provide and `end` argument, or you provide ' + 'a `take` argument.'); - } - - *occurrenceIterator(rawArgs) { - let args = this.normalizeRunArgs(rawArgs); - let date = this.iterator.next(args).value; - - while (date) { - const yieldArgs = yield this.normalizeDateOutput(date); - args = this.normalizeRunArgs(yieldArgs); - date = this.iterator.next(args).value; - } - - return undefined; - } - - normalizeRunArgs(args) { - return { - skipToDate: this.normalizeDateInput(args && args.skipToDate) - }; - } - - normalizeDateInput(date) { - return date ? Object(_rschedule_core__WEBPACK_IMPORTED_MODULE_0__["dateInputToDateTime"])(date, this.iterable.timezone) : undefined; - } - - normalizeDateOutput(date) { - if (!date) return; - return date ? _rschedule_core__WEBPACK_IMPORTED_MODULE_0__["DateAdapterBase"].adapter.fromDateTime(date) : undefined; - } - -} - -class Collection { - constructor(dates = [], granularity, periodStart, periodEnd) { - this.dates = dates; - this.granularity = granularity; - this.periodStart = periodStart; - this.periodEnd = periodEnd; - } - -} - -class CollectionIterator { - constructor(iterable, args) { - this.iterable = iterable; - this.args = args; - this.granularity = 'year'; - - this[Symbol.iterator] = () => this.iterator; - - if (args.granularity) { - this.granularity = args.granularity; - - if (this.granularity === 'week' && !args.weekStart) { - throw new Error('"week" granularity requires `weekStart` arg'); - } - } - - if (args.weekStart) { - this.weekStart = args.weekStart; - } - - if (args.reverse) { - throw new Error('`OccurrenceGenerator#collections()` does not support iterating in reverse. ' + 'Though `OccurrenceGenerator#occurrences()` does support iterating in reverse.'); - } // Set the end arg, if present, to the end of the period. - - - this.args = Object.assign(Object.assign({}, args), { - start: args.start || iterable._run().next().value, - end: args.end && this.getPeriod(args.end).end - }); - this.startDate = this.args.start && this.normalizeDateOutput(this.getPeriod(this.args.start).start) || null; - this.iterator = this.collectionIterator(); - } - - next() { - return this.iterator.next(); - } - /** - * While `next()` and `[Symbol.iterator]` both share state, - * `toArray()` does not share state and always returns the whole - * collections array. - */ - - - toArray() { - if (this.args.end || this.args.take || !this.iterable.isInfinite) { - const collections = []; - - for (const collection of this.collectionIterator()) { - collections.push(collection); - } - - return collections; - } - - throw new _rschedule_core__WEBPACK_IMPORTED_MODULE_0__["InfiniteLoopError"]('CollectionIterator#toArray() can only be called if the iterator ' + 'is not infinite, or you provide and `end` argument, or you provide ' + 'a `take` argument.'); - } - - normalizeDateOutput(date) { - if (!date) return; - return _rschedule_core__WEBPACK_IMPORTED_MODULE_0__["DateAdapterBase"].adapter.fromDateTime(date); - } - - *collectionIterator() { - if (!this.startDate) return; - let iterator = this.occurrenceIterator(); - let date = iterator.next().value; - if (!date) return; // `period` === `periodStart` unless the granularity - // is `MONTHLY` and a `weekStart` param was provided. In this case, - // period holds a date === the first of the current month while - // periodStart holds a date === the beginning of the first week of the month - // (which might be in the the previous month). Read the - // `OccurrenceGenerator#collections()` description for more info. - - let period = this.getPeriod(this.args.start); - let dates = []; - let index = 0; - - while (date && (this.args.take === undefined || this.args.take > index)) { - while (date && date.isBeforeOrEqual(period.end)) { - dates.push(date); - date = iterator.next().value; - } - - yield new Collection(dates.map(date => this.normalizeDateOutput(date)), this.granularity, this.normalizeDateOutput(period.start), this.normalizeDateOutput(period.end)); - if (!date) return; - dates = []; - period = !this.args.skipEmptyPeriods ? this.getPeriod(this.incrementPeriod(period.period)) : this.getPeriod(date); // With these args, periods may overlap and the same date may show up - // in two periods. Because of this, we need to reset the iterator - // (otherwise it won't return a date it has already returned). - - if (this.granularity === 'month' && this.weekStart) { - iterator = this.iterable._run({ - start: period.start, - end: this.args.end - }); - date = iterator.next().value; - } - - index++; - } - } - - getPeriod(date) { - let start; - let end; - let period; - - if (this.granularity === 'month' && this.weekStart) { - start = date.granularity('month').granularity('week', { - weekStart: this.weekStart - }); - end = date.endGranularity('month').endGranularity('week', { - weekStart: this.weekStart - }); - period = date.granularity('month'); - } else { - start = date.granularity(this.granularity, { - weekStart: this.weekStart - }); - end = date.endGranularity(this.granularity, { - weekStart: this.weekStart - }); - period = start; - } - - return { - start, - end, - period - }; - } - - incrementPeriod(date) { - return date.add(1, this.granularity); - } - - occurrenceIterator() { - let start = this.args.start || this.iterable._run().next().value; - - if (!start) return this.iterable._run(this.args); - start = this.getPeriod(start).start; - return this.iterable._run({ - start, - end: this.args.end - }); - } - -} - -class Operator extends OccurrenceGenerator { - constructor(streams, config) { - super(config); - this.streams = streams; - this.config = config; - this.timezone = config.timezone; - this.streams = streams.map(stream => stream instanceof Operator ? stream : stream.set('timezone', this.timezone)); - this.isInfinite = this.calculateIsInfinite(); - this.hasDuration = this.calculateHasDuration(); - } - - normalizeDateInput(date) { - if (!date) return; - return Object(_rschedule_core__WEBPACK_IMPORTED_MODULE_0__["dateInputToDateTime"])(date, this.timezone); - } - - normalizeRunOutput(date) { - return Object(_rschedule_core__WEBPACK_IMPORTED_MODULE_0__["normalizeDateTimeTimezone"])(date, this.timezone); - } - -} -/** - * Simple class that lets us access the `value`, `runArgs`, and `done` - * status of an OccurrenceGenerator iterator - */ - - -class IterableWrapper { - constructor(generator, runArgs) { - this.runArgs = runArgs; - this.stream = generator._run(this.runArgs); - this.next(); - } - - next(args) { - const _this$stream$next = this.stream.next(args), - done = _this$stream$next.done, - value = _this$stream$next.value; - - this.done = typeof done === 'boolean' ? done : true; - this.value = value; - return { - done, - value - }; - } - -} - -function processYieldArgs(streams, options = {}, yieldArgs = {}) { - if (!yieldArgs.skipToDate || streams.length === 0) return; // check for invalid `skipToDate` option - - if (options.reverse ? streams.every(s => s.value.isBeforeOrEqual(yieldArgs.skipToDate)) : streams.every(s => s.value.isAfterOrEqual(yieldArgs.skipToDate))) { - throw new Error('A provided `skipToDate` option must be greater than the last yielded date ' + '(or smaller, in the case of reverse iteration)'); - } - - for (const stream of streams) { - if (stream.done) continue; // no point in calling `next()` - - if (options.reverse ? stream.value.isBeforeOrEqual(yieldArgs.skipToDate) : stream.value.isAfterOrEqual(yieldArgs.skipToDate)) { - // This can happen there are two streams and one stream starts after the other finishes. - // Or, when iterating in reverse, when one stream ends before the other starts. - // In this case we don't want to call `next()` because it will throw an error. - // In both of these cases, calling `next()` won't do anything anyway. - continue; - } - - stream.next(yieldArgs); - } -} -/** sorts ascending with completed iterables at the end */ - - -function streamsComparer(a, b) { - if (a.done && b.done) return 0; - if (a.done) return 1; - if (b.done) return -1; - if (a.value.isAfter(b.value)) return 1; - return -1; -} -/** sorts descending with completed iterables at the start */ - - -function streamsReverseComparer(a, b) { - if (a.done && b.done) return 0; - if (a.done) return -1; - if (b.done) return 1; - if (a.value.isAfter(b.value)) return -1; - return 1; -} - -function selectNextIterable(streams, options = {}, yieldArgs = {}) { - processYieldArgs(streams, options, yieldArgs); - return streams.sort(options.reverse ? streamsReverseComparer : streamsComparer).filter(s => !s.done).shift(); -} - -function selectLastIterable(streams, options = {}, yieldArgs = {}) { - processYieldArgs(streams, options, yieldArgs); - return streams.sort(options.reverse ? streamsReverseComparer : streamsComparer).filter(s => !s.done).pop(); -} -/** - * An operator function which accepts a spread of occurrence generators - * and adds their occurrences to the output. - * - * @param streams a spread of occurrence generators - */ - - -function add(...streams) { - return options => new AddOperator(streams, options); -} - -class AddOperator extends Operator { - set(_, value) { - return new AddOperator(this.streams.map(stream => stream.set('timezone', value)), Object.assign(Object.assign({}, this.config), { - base: this.config.base && this.config.base.set('timezone', value), - timezone: value - })); - } - - *_run(args = {}) { - const wrappedStreams = this.streams.map(input => new IterableWrapper(input, args)); - - if (this.config.base) { - wrappedStreams.push(new IterableWrapper(this.config.base, args)); - } - - if (wrappedStreams.length === 0) return; - let stream = selectNextIterable(wrappedStreams, args); - - while (stream && !stream.done) { - // yield the current stream's value - const yieldArgs = yield this.normalizeRunOutput(stream.value); - - if (!(yieldArgs && yieldArgs.skipToDate)) { - // iterate the current stream - stream.next(); - } // select the next stream - - - stream = selectNextIterable(wrappedStreams, args, yieldArgs); - } - } - - calculateIsInfinite() { - return this.config.base && this.config.base.isInfinite || this.streams.some(stream => stream.isInfinite); - } - - calculateHasDuration() { - const streamsDuration = this.streams.every(stream => stream.hasDuration); - if (!this.config.base) return streamsDuration; - return this.config.base.hasDuration && streamsDuration; - } - -} - -class Calendar extends OccurrenceGenerator { - /** - * - * Create a new Calendar object with the specified options. - * - * ### Options - * - * - **timezone**: The timezone that yielded occurrences should be *displayed* in. - * Note, this one affects the *displayed* timezone of yielded occurrences. - * For rules, occurrences are first found using the unmodified rule - * config (including whatever timezone the `start` datetime is defined - * in), and then converted to the timezone specified here before being - * yielded. By default, the timezone is *local* time (`null`). So if you don't - * want your rules to be displayed in local time, you must supply a - * timezone argument. - * - **data**: arbitrary data you can associate with this Calendar. This - * is the only mutable property of `Calendar` objects. - * - **maxDuration**: currently unused. - * - **schedules**: either an occurrence generator, or an array of occurrence generators, which should - * be used to build up this Calendar's occurrences. The Calendar will display the union of occurrences - * its schedules produce. - * - */ - constructor(args = {}) { - super(args); - this.schedules = []; - this.data = args.data; - - if (args.schedules) { - this.schedules = Array.isArray(args.schedules) ? args.schedules : [args.schedules]; - this.schedules = this.schedules.map(schedule => schedule.set('timezone', this.timezone)); - } - - this.isInfinite = this.schedules.some(schedule => schedule.isInfinite); - this.hasDuration = this.schedules.every(schedule => schedule.hasDuration); - } - - occurrences(args = {}) { - return new OccurrenceIterator(this, this.normalizeOccurrencesArgs(args)); - } - - collections(args = {}) { - return new CollectionIterator(this, this.normalizeCollectionsArgs(args)); - } - - set(prop, value, options) { - if (prop === 'timezone') { - return new Calendar({ - schedules: this.schedules.map(schedule => schedule.set(prop, value, options)), - data: this.data, - timezone: value, - maxDuration: this.maxDuration - }); - } else if (prop === 'schedules') { - return new Calendar({ - schedules: Array.isArray(value) ? value : [value], - data: this.data, - timezone: this.timezone, - maxDuration: this.maxDuration - }); - } - - throw new _rschedule_core__WEBPACK_IMPORTED_MODULE_0__["ArgumentError"]('Unknown value for `prop`: ' + `"${prop}"`); - } - - *_run(args = {}) { - if (this.schedules.length === 0) return; - const count = args.take; - delete args.take; - let iterator; - - if (this.schedules.length === 1) { - iterator = this.schedules[0]._run(args); - } else { - iterator = new AddOperator(this.schedules, { - timezone: this.timezone - })._run(args); - } - - let date = iterator.next().value; - let index = 0; - - while (date && (count === undefined || count > index)) { - date = date.add(this, 'generator'); - const yieldArgs = yield this.normalizeRunOutput(date); - date = iterator.next(yieldArgs).value; - index++; - } - - return undefined; - } - -} - -class Dates extends OccurrenceGenerator { - constructor(args = {}) { - super(args); - this.adapters = []; - this.isInfinite = false; - this.maxDuration = 0; - this.datetimes = []; - this.data = args.data; - - if (args.dates) { - this.adapters = args.dates.map(date => { - let adapter = this.normalizeDateInputToAdapter(date); - - if (args.duration && !adapter.duration) { - adapter = adapter.set('duration', args.duration); - } - - return adapter.set('timezone', this.timezone); - }); - this.datetimes = this.adapters.map(adapter => adapter.toDateTime()); - } - - this.hasDuration = this.datetimes.every(date => !!date.duration); - - if (this.hasDuration) { - this.maxDuration = this.adapters.reduce((prev, curr) => curr.duration > prev ? curr.duration : prev, 0); - } - } - - get length() { - return this.adapters.length; - } - /** Returns the first occurrence or, if there are no occurrences, null. */ - - - get firstDate() { - return this.adapters[0] || null; - } - /** Returns the last occurrence or, if there are no occurrences, null. */ - - - get lastDate() { - return this.adapters[this.length - 1] || null; - } - - occurrences(args = {}) { - return new OccurrenceIterator(this, this.normalizeOccurrencesArgs(args)); - } - - collections(args = {}) { - return new CollectionIterator(this, this.normalizeCollectionsArgs(args)); - } - - add(value) { - return new Dates({ - dates: [...this.adapters, value], - timezone: this.timezone, - data: this.data - }); - } - - remove(value) { - const dates = this.adapters.slice(); - const input = this.normalizeDateInputToAdapter(value); - const index = dates.findIndex(date => date.valueOf() === input.valueOf()); - - if (index >= 0) { - dates.splice(index, 1); - } - - return new Dates({ - dates, - timezone: this.timezone, - data: this.data - }); - } - - set(prop, value, options = {}) { - let timezone = this.timezone; - let dates = this.adapters.slice(); - - if (prop === 'timezone') { - if (value === this.timezone) return this;else if (options.keepLocalTime) { - dates = this.adapters.map(adapter => { - const json = adapter.toJSON(); - json.timezone = value; - return this.dateAdapter.fromJSON(json); - }); - } - timezone = value; - } else if (prop === 'dates') { - dates = value; - } else if (prop === 'duration') { - dates = dates.map(date => date.set('duration', value || 0)); - } else { - throw new _rschedule_core__WEBPACK_IMPORTED_MODULE_0__["ArgumentError"](`Unexpected prop argument "${prop}". Accepted values are "timezone" or "dates"`); - } - - return new Dates({ - dates, - data: this.data, - timezone - }); - } - - filter(fn) { - return new Dates({ - dates: this.adapters.filter(fn), - data: this.data, - timezone: this.timezone - }); - } - - *_run(args = {}) { - let dates = this.datetimes.sort(_rschedule_core__WEBPACK_IMPORTED_MODULE_0__["dateTimeSortComparer"]); - - if (args.start) { - dates = dates.filter(date => date.isAfterOrEqual(args.start)); - } - - if (args.end) { - dates = dates.filter(date => date.isBeforeOrEqual(args.end)); - } - - if (args.reverse) { - dates = dates.slice().reverse(); - } - - if (args.take) { - dates = dates.slice(0, args.take); - } - - const dateCache = dates.slice(); - let date = dateCache.shift(); - let yieldArgs; - - while (date) { - if (yieldArgs && yieldArgs.skipToDate && (args.reverse ? yieldArgs.skipToDate.isBefore(date) : yieldArgs.skipToDate.isAfter(date))) { - date = dateCache.shift(); - continue; - } - - date = date.add(this, 'generator'); - yieldArgs = yield this.normalizeRunOutput(date); // Here, we are matching the behavior of the RecurrenceRulesIterator - - if (yieldArgs && yieldArgs.skipToDate && (args.reverse ? yieldArgs.skipToDate.isAfterOrEqual(date) : yieldArgs.skipToDate.isBeforeOrEqual(date))) { - throw new Error('A provided `skipToDate` option must be greater than the last yielded date ' + '(or smaller, in the case of reverse iteration)'); - } - - date = dateCache.shift(); - } - - return undefined; - } - -} - -class InvalidDateAdapterError extends Error {} - -let dateAdapterConfig; - -class DateAdapterBase { - constructor(_date, options) { - this.duration = options && options.duration || 0; - this.generators = options && options.generators && options.generators.slice() || []; - - if (!Number.isInteger(this.duration) || this.duration < 0) { - throw new InvalidDateAdapterError('duration must be a non-negative integer'); - } - } - - static set adapter(value) { - if (dateAdapterConfig) { - throw new Error(`"${dateAdapterConfig.name}" has already been configured.`); - } - - dateAdapterConfig = value; - } - - static get adapter() { - if (!dateAdapterConfig) { - throw new Error('No date adapter has been configured. See rSchedule docs.'); - } - - return dateAdapterConfig; - } - - static isDate(_object) { - throw unimplementedError('isDate()'); - } - - static fromDate(_date, _options) { - throw unimplementedError('fromDate()'); - } - - static fromJSON(_json) { - throw unimplementedError('fromJSON()'); - } - - static fromDateTime(_datetime) { - throw unimplementedError('fromDateTime()'); - } - /** - * Returns a string in simplified extended ISO format (ISO 8601). - * - * _Note: this method is intended for testing and its - * implementation isn't particularly performant._ - */ - - - toISOString() { - return this.set('timezone', 'UTC').toDateTime().toISOString(); - } - - toDateTime() { - const date = DateTime.fromJSON(Object.assign(Object.assign({}, this.toJSON()), { - generators: this.generators - })); - return date; - } - -} - -DateAdapterBase.hasTimezoneSupport = false; - -function unimplementedError(name) { - return new Error(`You must implement the "${name}" method for this DateAdapter class`); -} - -var DateAdapter; - -(function (DateAdapter) { - DateAdapter.WEEKDAYS = ['SU', 'MO', 'TU', 'WE', 'TH', 'FR', 'SA']; - DateAdapter.MILLISECONDS_IN_SECOND = 1000; - DateAdapter.MILLISECONDS_IN_MINUTE = DateAdapter.MILLISECONDS_IN_SECOND * 60; - DateAdapter.MILLISECONDS_IN_HOUR = DateAdapter.MILLISECONDS_IN_MINUTE * 60; - DateAdapter.MILLISECONDS_IN_DAY = DateAdapter.MILLISECONDS_IN_HOUR * 24; - DateAdapter.MILLISECONDS_IN_WEEK = DateAdapter.MILLISECONDS_IN_DAY * 7; -})(DateAdapter || (DateAdapter = {})); - -class InvalidDateTimeError extends Error {} - -class DateTime { - constructor(date, timezone, duration, generators) { - this.date = new Date(date); - this.timezone = timezone || null; - this.duration = duration || 0; - this.generators = generators && generators.slice() || []; - - if (!Number.isInteger(this.duration) || this.duration < 0) { - throw new InvalidDateTimeError('duration must be a non-negative integer'); - } - - this.assertIsValid(); - } // /** - // * Similar to `Array.isArray()`, `isInstance()` provides a surefire method - // * of determining if an object is a `DateTime` by checking against the - // * global symbol registry. - // */ - // static isInstance(object: any): object is DateTime { - // return !!(object && object[DATETIME_ID]); - // } - - - static fromJSON(json) { - const date = new Date(Date.UTC(json.year, json.month - 1, json.day, json.hour, json.minute, json.second, json.millisecond)); - return new DateTime(date, json.timezone, json.duration, json.generators); - } - - static fromDateAdapter(adapter) { - return DateTime.fromJSON(Object.assign(Object.assign({}, adapter.toJSON()), { - generators: adapter.generators - })); - } - /** - * Returns `undefined` if `duration` is `0`. Else returns - * the `end` date. - */ - - - get end() { - if (!this.duration) return; - if (this._end) return this._end; - this._end = this.add(this.duration, 'millisecond'); - return this._end; - } // While we constrain the argument to be another DateAdapter in typescript - // we handle the case of someone passing in another type of object in javascript - - - isEqual(object) { - if (!object) { - return false; - } - - assertSameTimeZone(this, object); - return this.valueOf() === object.valueOf(); - } - - isBefore(object) { - assertSameTimeZone(this, object); - return this.valueOf() < object.valueOf(); - } - - isBeforeOrEqual(object) { - assertSameTimeZone(this, object); - return this.valueOf() <= object.valueOf(); - } - - isAfter(object) { - assertSameTimeZone(this, object); - return this.valueOf() > object.valueOf(); - } - - isAfterOrEqual(object) { - assertSameTimeZone(this, object); - return this.valueOf() >= object.valueOf(); - } - - isOccurring(object) { - if (!this.duration) { - throw new Error('DateTime#isOccurring() is only applicable to DateTimes with durations'); - } - - assertSameTimeZone(this, object); - return object.isAfterOrEqual(this) && object.isBeforeOrEqual(this.add(this.duration, 'millisecond')); - } - - add(amount, unit) { - switch (unit) { - case 'generator': - { - const generators = this.generators.slice(); - generators.unshift(amount); - return new DateTime(this.date, this.timezone, this.duration, generators); - } - - case 'year': - return this.forkDateTime(addUTCYears(this.date, amount)); - - case 'month': - return this.forkDateTime(addUTCMonths(this.date, amount)); - - case 'week': - return this.forkDateTime(addUTCWeeks(this.date, amount)); - - case 'day': - return this.forkDateTime(addUTCDays(this.date, amount)); - - case 'hour': - return this.forkDateTime(addUTCHours(this.date, amount)); - - case 'minute': - return this.forkDateTime(addUTCMinutes(this.date, amount)); - - case 'second': - return this.forkDateTime(addUTCSeconds(this.date, amount)); - - case 'millisecond': - return this.forkDateTime(addUTCMilliseconds(this.date, amount)); - - default: - throw new Error('Invalid unit provided to `DateTime#add`'); - } - } - - subtract(amount, unit) { - switch (unit) { - case 'year': - return this.forkDateTime(subUTCYears(this.date, amount)); - - case 'month': - return this.forkDateTime(subUTCMonths(this.date, amount)); - - case 'week': - return this.forkDateTime(subUTCWeeks(this.date, amount)); - - case 'day': - return this.forkDateTime(subUTCDays(this.date, amount)); - - case 'hour': - return this.forkDateTime(subUTCHours(this.date, amount)); - - case 'minute': - return this.forkDateTime(subUTCMinutes(this.date, amount)); - - case 'second': - return this.forkDateTime(subUTCSeconds(this.date, amount)); - - case 'millisecond': - return this.forkDateTime(subUTCMilliseconds(this.date, amount)); - - default: - throw new Error('Invalid unit provided to `DateTime#subtract`'); - } - } - - get(unit) { - switch (unit) { - case 'year': - return this.date.getUTCFullYear(); - - case 'month': - return this.date.getUTCMonth() + 1; - - case 'yearday': - return getUTCYearDay(this.date); - - case 'weekday': - return DateAdapter.WEEKDAYS[this.date.getUTCDay()]; - - case 'day': - return this.date.getUTCDate(); - - case 'hour': - return this.date.getUTCHours(); - - case 'minute': - return this.date.getUTCMinutes(); - - case 'second': - return this.date.getUTCSeconds(); - - case 'millisecond': - return this.date.getUTCMilliseconds(); - - default: - throw new Error('Invalid unit provided to `DateTime#set`'); - } - } - - set(unit, value) { - if (unit === 'duration') { - return new DateTime(this.date, this.timezone, value, this.generators); - } - - if (unit === 'generators') { - return new DateTime(this.date, this.timezone, this.duration, value); - } - - let date = new Date(this.date); - - switch (unit) { - case 'year': - date.setUTCFullYear(value); - break; - - case 'month': - { - // If the current day of the month - // is greater than days in the month we are moving to, we need to also - // set the day to the end of that month. - const length = monthLength(value, date.getUTCFullYear()); - const day = date.getUTCDate(); - - if (day > length) { - date.setUTCDate(1); - date.setUTCMonth(value); - date = subUTCDays(date, 1); - } else { - date.setUTCMonth(value - 1); - } - - break; - } - - case 'day': - date.setUTCDate(value); - break; - - case 'hour': - date.setUTCHours(value); - break; - - case 'minute': - date.setUTCMinutes(value); - break; - - case 'second': - date.setUTCSeconds(value); - break; - - case 'millisecond': - date.setUTCMilliseconds(value); - break; - - default: - throw new Error('Invalid unit provided to `DateTime#set`'); - } - - return this.forkDateTime(date); - } - - granularity(granularity, opt = {}) { - let date = this.forkDateTime(this.date); - - switch (granularity) { - case 'year': - date = date.set('month', 1); - - case 'month': - date = date.set('day', 1); - break; - - case 'week': - date = setDateToStartOfWeek(date, opt.weekStart); - } - - switch (granularity) { - case 'year': - case 'month': - case 'week': - case 'day': - date = date.set('hour', 0); - - case 'hour': - date = date.set('minute', 0); - - case 'minute': - date = date.set('second', 0); - - case 'second': - date = date.set('millisecond', 0); - - case 'millisecond': - return date; - - default: - throw new Error('Invalid granularity provided to `DateTime#granularity`: ' + granularity); - } - } - - endGranularity(granularity, opt = {}) { - let date = this.forkDateTime(this.date); - - switch (granularity) { - case 'year': - date = date.set('month', 12); - - case 'month': - date = date.set('day', monthLength(date.get('month'), date.get('year'))); - break; - - case 'week': - date = setDateToEndOfWeek(date, opt.weekStart); - } - - switch (granularity) { - case 'year': - case 'month': - case 'week': - case 'day': - date = date.set('hour', 23); - - case 'hour': - date = date.set('minute', 59); - - case 'minute': - date = date.set('second', 59); - - case 'second': - date = date.set('millisecond', 999); - - case 'millisecond': - return date; - - default: - throw new Error('Invalid granularity provided to `DateTime#granularity`: ' + granularity); - } - } - - toISOString() { - return this.date.toISOString(); - } - - toDateTime() { - return this; - } - - toJSON() { - const json = { - timezone: this.timezone, - year: this.get('year'), - month: this.get('month'), - day: this.get('day'), - hour: this.get('hour'), - minute: this.get('minute'), - second: this.get('second'), - millisecond: this.get('millisecond') - }; - - if (this.duration) { - json.duration = this.duration; - } - - return json; - } - - valueOf() { - return this.date.valueOf(); - } - - assertIsValid() { - if (isNaN(this.valueOf())) { - throw new InvalidDateTimeError('DateTime has invalid date.'); - } - - return true; - } - - forkDateTime(date) { - return new DateTime(date, this.timezone, this.duration, this.generators); - } - -} - -function assertSameTimeZone(x, y) { - if (x.timezone !== y.timezone) { - throw new InvalidDateTimeError('Attempted to compare a datetime to another date in a different timezone: ' + JSON.stringify(x) + ' and ' + JSON.stringify(y)); - } - - return true; -} - -function setDateToStartOfWeek(date, wkst) { - const index = orderedWeekdays(wkst).indexOf(date.get('weekday')); - return date.subtract(index, 'day'); -} - -function setDateToEndOfWeek(date, wkst) { - const index = orderedWeekdays(wkst).indexOf(date.get('weekday')); - return date.add(6 - index, 'day'); -} - -function orderedWeekdays(wkst = 'SU') { - const wkdays = DateAdapter.WEEKDAYS.slice(); - let index = wkdays.indexOf(wkst); - - while (index !== 0) { - shiftArray(wkdays); - index--; - } - - return wkdays; -} - -function shiftArray(array, from = 'first') { - if (array.length === 0) { - return array; - } else if (from === 'first') { - array.push(array.shift()); - } else { - array.unshift(array.pop()); - } - - return array; -} -/** - * Returns the days in the given month. - * - * @param month base-1 - * @param year - */ - - -function monthLength(month, year) { - const block = { - 1: 31, - 2: getDaysInFebruary(year), - 3: 31, - 4: 30, - 5: 31, - 6: 30, - 7: 31, - 8: 31, - 9: 30, - 10: 31, - 11: 30, - 12: 31 - }; - return block[month]; -} - -function getDaysInFebruary(year) { - return isLeapYear(year) ? 29 : 28; -} // taken from date-fn - - -function isLeapYear(year) { - return year % 400 === 0 || year % 4 === 0 && year % 100 !== 0; -} - -function getUTCYearDay(now) { - const start = new Date(Date.UTC(now.getUTCFullYear(), 0, 1)); - const diff = now.valueOf() - start.valueOf(); - return 1 + Math.floor(diff / DateAdapter.MILLISECONDS_IN_DAY); -} -/** - * These functions are basically lifted from `date-fns`, but changed - * to use the UTC date methods, which `date-fns` doesn't support. - */ - - -function toInteger(input) { - if (input === null || input === true || input === false) { - return NaN; - } - - const int = Number(input); - - if (isNaN(int)) { - return int; - } - - return int < 0 ? Math.ceil(int) : Math.floor(int); -} - -function addMilliseconds(dirtyDate, dirtyAmount) { - if (arguments.length < 2) { - throw new TypeError('2 arguments required, but only ' + arguments.length + ' present'); - } - - const timestamp = dirtyDate.valueOf(); - const amount = toInteger(dirtyAmount); - return new Date(timestamp + amount); -} - -function addUTCYears(date, input) { - const amount = toInteger(input); - return addUTCMonths(date, amount * 12); -} - -function addUTCMonths(date, input) { - const amount = toInteger(input); - date = new Date(date); - const desiredMonth = date.getUTCMonth() + amount; - const dateWithDesiredMonth = new Date(0); - dateWithDesiredMonth.setUTCFullYear(date.getUTCFullYear(), desiredMonth, 1); - dateWithDesiredMonth.setUTCHours(0, 0, 0, 0); - const daysInMonth = monthLength(dateWithDesiredMonth.getUTCMonth() + 1, dateWithDesiredMonth.getUTCFullYear()); // Set the last day of the new month - // if the original date was the last day of the longer month - - date.setUTCMonth(desiredMonth, Math.min(daysInMonth, date.getUTCDate())); - return date; -} - -function addUTCWeeks(date, input) { - const amount = toInteger(input); - const days = amount * 7; - return addUTCDays(date, days); -} - -function addUTCDays(date, input) { - // by adding milliseconds rather than days, we supress the native Date object's automatic - // daylight savings time conversions which we don't want in UTC mode - return addUTCMilliseconds(date, toInteger(input) * DateAdapter.MILLISECONDS_IN_DAY); -} - -function addUTCHours(date, input) { - const amount = toInteger(input); - return addMilliseconds(date, amount * DateAdapter.MILLISECONDS_IN_HOUR); -} - -function addUTCMinutes(date, input) { - const amount = toInteger(input); - return addMilliseconds(date, amount * DateAdapter.MILLISECONDS_IN_MINUTE); -} - -function addUTCSeconds(date, input) { - const amount = toInteger(input); - return addMilliseconds(date, amount * DateAdapter.MILLISECONDS_IN_SECOND); -} - -function addUTCMilliseconds(date, input) { - const amount = toInteger(input); - const timestamp = date.getTime(); - return new Date(timestamp + amount); -} - -function subUTCYears(date, amount) { - return addUTCYears(date, -amount); -} - -function subUTCMonths(date, amount) { - return addUTCMonths(date, -amount); -} - -function subUTCWeeks(date, amount) { - return addUTCWeeks(date, -amount); -} - -function subUTCDays(date, amount) { - return addUTCDays(date, -amount); -} - -function subUTCHours(date, amount) { - return addUTCHours(date, -amount); -} - -function subUTCMinutes(date, amount) { - return addUTCMinutes(date, -amount); -} - -function subUTCSeconds(date, amount) { - return addUTCSeconds(date, -amount); -} - -function subUTCMilliseconds(date, amount) { - return addUTCMilliseconds(date, -amount); -} // export function normalizeDateInput<T extends DateAdapter>( -// dateAdapter: DateAdapterConstructor<T>, -// input: DateInput<T>, -// timezone: string | null, -// ): DateTime { -// if (input instanceof DateTime) { -// if (input.timezone !== timezone) { -// return dateAdapter -// .fromDateTime(input) -// .set('timezone', timezone) -// .toDateTime(); -// } -// return input; -// } -// return input instanceof DateAdapter -// ? input.set('timezone', timezone).toDateTime() -// : new dateAdapter(input).toDateTime(); -// } - - -function normalizeDateTimeTimezone(date, timezone) { - if (date.timezone !== timezone) { - return DateAdapterBase.adapter.fromDateTime(date).set('timezone', timezone).toDateTime(); - } - - return date; -} - -class RuleBase extends OccurrenceGenerator { - constructor(recurrenceRules, config, options = {}) { - super(options); - this.recurrenceRules = recurrenceRules; - this.options = Object(_rschedule_core__WEBPACK_IMPORTED_MODULE_0__["cloneRuleOptions"])(config); - this.normOptions = Object(_rschedule_core__WEBPACK_IMPORTED_MODULE_0__["normalizeRuleOptions"])(this.recurrenceRules, this.options); - this.timezone = options.timezone !== undefined ? options.timezone : this.normOptions.start.timezone; - this.data = options.data; - this.hasDuration = !!config.duration; - if (this.hasDuration) this.duration = config.duration; - this.isInfinite = this.normOptions.end === undefined && this.normOptions.count === undefined; - } - - occurrences(args = {}) { - return new OccurrenceIterator(this, this.normalizeOccurrencesArgs(args)); - } - - collections(args = {}) { - return new CollectionIterator(this, this.normalizeCollectionsArgs(args)); - } - - *_run(rawArgs = {}) { - const args = this.normalizeRunArgs(rawArgs); - const iterator = new _rschedule_core__WEBPACK_IMPORTED_MODULE_0__["RecurrenceRulesIterator"](Object(_rschedule_core__WEBPACK_IMPORTED_MODULE_0__["recurrenceRulesReducer"])(this.recurrenceRules), this.normOptions, args); - let date = iterator.next().value; - let index = 0; - - while (date && (args.take === undefined || index < args.take)) { - index++; - date = date.add(this, 'generator'); - const yieldArgs = yield this.normalizeRunOutput(date); - - if (yieldArgs === null || yieldArgs === void 0 ? void 0 : yieldArgs.skipToDate) { - // The RecurrenceRuleIterator might have a different timezone from the rule. - // Because of this, the yieldArgs will not properly be normalized by the - // OccurrenceIterator, so we need to do it here - date = iterator.next(Object.assign(Object.assign({}, yieldArgs), { - skipToDate: normalizeDateTimeTimezone(yieldArgs.skipToDate, iterator.start.timezone) - })).value; - } else { - // theoretically, the yieldArgs are undefined here - // maybe in the future there will be other yieldArg options though - date = iterator.next(yieldArgs).value; - } - } - - return undefined; - } - -} - -class Rule extends RuleBase { - /** - * Create a new Rule object with the specified rule config and options. - * - * ### Options - * - * - **timezone**: the timezone that yielded occurrences should be in. Note, - * this does not change the rule config. Occurrences are first found using - * the unmodified rule config, and then converted to the timezone specified - * here before being yielded. - * - **data**: arbitrary data you can associate with this rule. This - * is the only mutable property of `Rule` objects. - * - * ### Rule Config - * - * - #### frequency - * - * The frequency rule part identifies the type of recurrence rule. Valid values - * include `"SECONDLY"`, `"MINUTELY"`, `"HOURLY"`, `"DAILY"`, `"WEEKLY"`, - * `"MONTHLY"`, or `"YEARLY"`. - * - * - #### start - * - * The start of the rule (not necessarily the first occurrence). - * Either a `DateAdapter` instance, date object, or `DateTime` object. - * The type of date object depends on the `DateAdapter` class used for this - * `Rule`. - * - * - #### end? - * - * The end of the rule (not necessarily the last occurrence). - * Either a `DateAdapter` instance, date object, or `DateTime` object. - * The type of date object depends on the `DateAdapter` class used for this - * `Rule`. - * - * - #### duration? - * - * A length of time expressed in milliseconds. - * - * - #### interval? - * - * The interval rule part contains a positive integer representing at - * which intervals the recurrence rule repeats. The default value is - * `1`, meaning every second for a SECONDLY rule, every minute for a - * MINUTELY rule, every hour for an HOURLY rule, every day for a - * DAILY rule, every week for a WEEKLY rule, every month for a - * MONTHLY rule, and every year for a YEARLY rule. For example, - * within a DAILY rule, a value of `8` means every eight days. - * - * - #### count? - * - * The count rule part defines the number of occurrences at which to - * range-bound the recurrence. `count` and `end` are both two different - * ways of specifying how a recurrence completes. - * - * - #### weekStart? - * - * The weekStart rule part specifies the day on which the workweek starts. - * Valid values are `"MO"`, `"TU"`, `"WE"`, `"TH"`, `"FR"`, `"SA"`, and `"SU"`. - * This is significant when a WEEKLY rule has an interval greater than 1, - * and a `byDayOfWeek` rule part is specified. The - * default value is `"MO"`. - * - * - #### bySecondOfMinute? - * - * The bySecondOfMinute rule part expects an array of seconds - * within a minute. Valid values are 0 to 60. - * - * - #### byMinuteOfHour? - * - * The byMinuteOfHour rule part expects an array of minutes within an hour. - * Valid values are 0 to 59. - * - * - #### byHourOfDay? - * - * The byHourOfDay rule part expects an array of hours of the day. - * Valid values are 0 to 23. - * - * - #### byDayOfWeek? - * - * *note: the byDayOfWeek rule part is kinda complex. Blame the ICAL spec.* - * - * The byDayOfWeek rule part expects an array. Each array entry can - * be a day of the week (`"SU"`, `"MO"` , `"TU"`, `"WE"`, `"TH"`, - * `"FR"`, `"SA"`). If the rule's `frequency` is either MONTHLY or YEARLY, - * Any entry can also be a tuple where the first value of the tuple is a - * day of the week and the second value is an positive/negative integer - * (e.g. `["SU", 1]`). In this case, the number indicates the nth occurrence of - * the specified day within the MONTHLY or YEARLY rule. - * - * The behavior of byDayOfWeek changes depending on the `frequency` - * of the rule. - * - * Within a MONTHLY rule, `["MO", 1]` represents the first Monday - * within the month, whereas `["MO", -1]` represents the last Monday - * of the month. - * - * Within a YEARLY rule, the numeric value in a byDayOfWeek tuple entry - * corresponds to an offset within the month when the byMonthOfYear rule part is - * present, and corresponds to an offset within the year otherwise. - * - * Regardless of rule `frequency`, if a byDayOfWeek entry is a string - * (rather than a tuple), it means "all of these days" within the specified - * frequency (e.g. within a MONTHLY rule, `"MO"` represents all Mondays within - * the month). - * - * - #### byDayOfMonth? - * - * The byDayOfMonth rule part expects an array of days - * of the month. Valid values are 1 to 31 or -31 to -1. - * - * For example, -10 represents the tenth to the last day of the month. - * The byDayOfMonth rule part *must not* be specified when the rule's - * `frequency` is set to WEEKLY. - * - * - #### byMonthOfYear? - * - * The byMonthOfYear rule part expects an array of months - * of the year. Valid values are 1 to 12. - * - */ - constructor(config, options = {}) { - super(Rule.recurrenceRules, config, options); - } - - set(prop, value, tzoptions = {}) { - let options = Object(_rschedule_core__WEBPACK_IMPORTED_MODULE_0__["cloneRuleOptions"])(this.options); - let timezone = this.timezone; - - if (prop === 'timezone') { - if (value === this.timezone && !tzoptions.keepLocalTime) return this;else if (tzoptions.keepLocalTime) { - const json = this.normalizeDateInput(options.start).toJSON(); - json.timezone = value; - const adapter = this.dateAdapter.fromJSON(json); // prettier-ignore - - options.start = options.start instanceof this.dateAdapter ? adapter : options.start instanceof _rschedule_core__WEBPACK_IMPORTED_MODULE_0__["DateTime"] ? adapter.toDateTime() : adapter.date; - } - timezone = value; - } else if (prop === 'options') { - options = value; - } else { - options[prop] = value; - } - - return new Rule(options, { - data: this.data, - maxDuration: this.maxDuration, - timezone - }); - } - -} - -Rule.recurrenceRules = []; - -class ScheduleBase extends OccurrenceGenerator { - /** - * Create a new Schedule object with the specified options. - * - * The order of precidence for rrules, rdates, exrules, and exdates is: - * - * 1. rrules are included - * 2. exrules are excluded - * 3. rdates are included - * 4. exdates are excluded - * - */ - constructor(options) { - super(options); - this.data = options.data; - } - - occurrences(args = {}) { - return new OccurrenceIterator(this, this.normalizeOccurrencesArgs(args)); - } - - collections(args = {}) { - return new CollectionIterator(this, this.normalizeCollectionsArgs(args)); - } - - *_run(args = {}) { - const count = args.take; - delete args.take; - - const iterator = this.occurrenceStream._run(args); - - let date = iterator.next().value; - let index = 0; - - while (date && (count === undefined || count > index)) { - date = date.add(this, 'generator'); - const yieldArgs = yield this.normalizeRunOutput(date); - date = iterator.next(yieldArgs).value; - index++; - } - - return undefined; - } - -} -/** - * An operator function which accepts a spread of occurrence generators - * and removes their occurrences from the output. - * - * @param streams a spread of occurrence generators - */ - - -function subtract(...streams) { - return options => new SubtractOperator(streams, options); -} - -class SubtractOperator extends Operator { - /** Not actually used but necessary for IRunnable interface */ - set(_, value) { - return new SubtractOperator(this.streams.map(stream => stream.set('timezone', value)), Object.assign(Object.assign({}, this.config), { - base: this.config.base && this.config.base.set('timezone', value), - timezone: value - })); - } - - *_run(args = {}) { - if (!this.config.base) return; - const inclusion = new IterableWrapper(this.config.base, args); - const exclusion = new IterableWrapper(new AddOperator(this.streams, { - timezone: this.config.timezone - }), args); - cycleStreams(inclusion, exclusion, args); - - while (!inclusion.done) { - const yieldArgs = yield this.normalizeRunOutput(inclusion.value); - - if (!(yieldArgs && yieldArgs.skipToDate)) { - inclusion.next(); - } - - cycleStreams(inclusion, exclusion, args, yieldArgs); - } - } - - calculateIsInfinite() { - return !!(this.config.base && this.config.base.isInfinite); - } - - calculateHasDuration() { - return !!(this.config.base && this.config.base.hasDuration); - } - -} - -function cycleStreams(inclusion, exclusion, options = {}, yieldArgs = {}) { - processYieldArgs([inclusion, exclusion], options, yieldArgs); - iterateExclusion(inclusion, exclusion, options); - - while (!inclusion.done && !exclusion.done && inclusion.value.isEqual(exclusion.value)) { - inclusion.next(); - iterateExclusion(inclusion, exclusion, options); - } -} - -function iterateExclusion(inclusion, exclusion, options = {}) { - if (options.reverse) { - while (!exclusion.done && !inclusion.done && exclusion.value.isAfter(inclusion.value)) { - exclusion.next(); - } - - return; - } - - while (!exclusion.done && !inclusion.done && exclusion.value.isBefore(inclusion.value)) { - exclusion.next(); - } -} -/** - * An operator function which deduplicates an occurrence stream. Occurrence - * `duration` is currently ignored. - */ - - -function unique() { - return options => new UniqueOperator([], options); -} - -class UniqueOperator extends Operator { - /** Not actually used but necessary for IRunnable interface */ - set(_, value) { - return new UniqueOperator([], Object.assign(Object.assign({}, this.config), { - base: this.config.base && this.config.base.set('timezone', value), - timezone: value - })); - } - - *_run(args = {}) { - if (!this.config.base) return; - const stream = new IterableWrapper(this.config.base, args); - - while (!stream.done) { - const yieldArgs = yield this.normalizeRunOutput(stream.value); - const lastValue = stream.value; // iterate the current stream - - stream.next(yieldArgs); - - while (!(yieldArgs && yieldArgs.skipToDate) && !stream.done && stream.value.isEqual(lastValue)) { - stream.next(); - } - } - } - - calculateIsInfinite() { - return !!(this.config.base && this.config.base.isInfinite); - } - - calculateHasDuration() { - return !!(this.config.base && this.config.base.hasDuration); - } - -} - -class Schedule extends ScheduleBase { - /** - * Create a new Schedule object with the specified options. - * - * The order of precidence for rrules, rdates, exrules, and exdates is: - * - * 1. rrules are included - * 2. exrules are excluded - * 3. rdates are included - * 4. exdates are excluded - * - * ### Options - * - * - **timezone**: The timezone that yielded occurrences should be *displayed* in. - * Note, this one affects the *displayed* timezone of yielded occurrences. - * For rules, occurrences are first found using the unmodified rule - * config (including whatever timezone the `start` datetime is defined - * in), and then converted to the timezone specified here before being - * yielded. By default, the timezone is *local* time (`null`). So if you don't - * want your rules to be displayed in local time, you must supply a - * timezone argument. - * - **data**: arbitrary data you can associate with this Schedule. This - * is the only mutable property of `Schedule` objects. - * - **maxDuration**: currently unused. - * - **rrules**: rules specifying when occurrences happen. See the "Rule Config" - * section below. - * - **rdates**: individual dates that should be _included_ in the schedule. - * - **exdates**: individual dates that should be _excluded_ from the schedule. - * - **exrules**: rules specifying when occurrences shouldn't happen. See the - * "Rule Config" section below. - * - * ### Rule Config - * - * - #### frequency - * - * The frequency rule part identifies the type of recurrence rule. Valid values - * include `"SECONDLY"`, `"MINUTELY"`, `"HOURLY"`, `"DAILY"`, `"WEEKLY"`, - * `"MONTHLY"`, or `"YEARLY"`. - * - * - #### start - * - * The start of the rule (not necessarily the first occurrence). - * Either a `DateAdapter` instance, date object, or `DateTime` object. - * The type of date object depends on the `DateAdapter` class used for this - * `Rule`. - * - * - #### end? - * - * The end of the rule (not necessarily the last occurrence). - * Either a `DateAdapter` instance, date object, or `DateTime` object. - * The type of date object depends on the `DateAdapter` class used for this - * `Rule`. - * - * - #### duration? - * - * A length of time expressed in milliseconds. - * - * - #### interval? - * - * The interval rule part contains a positive integer representing at - * which intervals the recurrence rule repeats. The default value is - * `1`, meaning every second for a SECONDLY rule, every minute for a - * MINUTELY rule, every hour for an HOURLY rule, every day for a - * DAILY rule, every week for a WEEKLY rule, every month for a - * MONTHLY rule, and every year for a YEARLY rule. For example, - * within a DAILY rule, a value of `8` means every eight days. - * - * - #### count? - * - * The count rule part defines the number of occurrences at which to - * range-bound the recurrence. `count` and `end` are both two different - * ways of specifying how a recurrence completes. - * - * - #### weekStart? - * - * The weekStart rule part specifies the day on which the workweek starts. - * Valid values are `"MO"`, `"TU"`, `"WE"`, `"TH"`, `"FR"`, `"SA"`, and `"SU"`. - * This is significant when a WEEKLY rule has an interval greater than 1, - * and a `byDayOfWeek` rule part is specified. The - * default value is `"MO"`. - * - * - #### bySecondOfMinute? - * - * The bySecondOfMinute rule part expects an array of seconds - * within a minute. Valid values are 0 to 60. - * - * - #### byMinuteOfHour? - * - * The byMinuteOfHour rule part expects an array of minutes within an hour. - * Valid values are 0 to 59. - * - * - #### byHourOfDay? - * - * The byHourOfDay rule part expects an array of hours of the day. - * Valid values are 0 to 23. - * - * - #### byDayOfWeek? - * - * *note: the byDayOfWeek rule part is kinda complex. Blame the ICAL spec.* - * - * The byDayOfWeek rule part expects an array. Each array entry can - * be a day of the week (`"SU"`, `"MO"` , `"TU"`, `"WE"`, `"TH"`, - * `"FR"`, `"SA"`). If the rule's `frequency` is either MONTHLY or YEARLY, - * Any entry can also be a tuple where the first value of the tuple is a - * day of the week and the second value is an positive/negative integer - * (e.g. `["SU", 1]`). In this case, the number indicates the nth occurrence of - * the specified day within the MONTHLY or YEARLY rule. - * - * The behavior of byDayOfWeek changes depending on the `frequency` - * of the rule. - * - * Within a MONTHLY rule, `["MO", 1]` represents the first Monday - * within the month, whereas `["MO", -1]` represents the last Monday - * of the month. - * - * Within a YEARLY rule, the numeric value in a byDayOfWeek tuple entry - * corresponds to an offset within the month when the byMonthOfYear rule part is - * present, and corresponds to an offset within the year otherwise. - * - * Regardless of rule `frequency`, if a byDayOfWeek entry is a string - * (rather than a tuple), it means "all of these days" within the specified - * frequency (e.g. within a MONTHLY rule, `"MO"` represents all Mondays within - * the month). - * - * - #### byDayOfMonth? - * - * The byDayOfMonth rule part expects an array of days - * of the month. Valid values are 1 to 31 or -31 to -1. - * - * For example, -10 represents the tenth to the last day of the month. - * The byDayOfMonth rule part *must not* be specified when the rule's - * `frequency` is set to WEEKLY. - * - * - #### byMonthOfYear? - * - * The byMonthOfYear rule part expects an array of months - * of the year. Valid values are 1 to 12. - * - */ - constructor(options = {}) { - super(options); - this.rrules = []; - this.exrules = []; - - for (const prop of ['rrules', 'exrules']) { - const arg = options[prop]; - - if (arg) { - this[prop] = arg.map(ruleArgs => { - if (ruleArgs instanceof Rule) { - return ruleArgs.set('timezone', this.timezone); - } else { - return new Rule(ruleArgs, { - timezone: this.timezone - }); - } - }); - } - } - - for (const prop of ['rdates', 'exdates']) { - const arg = options[prop]; - - if (arg) { - this[prop] = arg instanceof Dates ? arg.set('timezone', this.timezone) : new Dates({ - dates: arg, - timezone: this.timezone - }); - } else { - this[prop] = new Dates({ - timezone: this.timezone - }); - } - } - - this.hasDuration = this.rrules.every(rule => rule.hasDuration) && this.exrules.every(rule => rule.hasDuration) && this.rdates.hasDuration && this.exdates.hasDuration; - this.isInfinite = this.rrules.some(rule => rule.isInfinite); - this.occurrenceStream = [add(...this.rrules), subtract(...this.exrules), add(this.rdates), subtract(this.exdates), unique()].reduce((prev, curr) => curr({ - base: prev, - timezone: this.timezone - }), undefined); - } - - add(prop, value) { - const rrules = this.rrules.slice(); - const exrules = this.exrules.slice(); - let rdates = this.rdates; - let exdates = this.exdates; - - switch (prop) { - case 'rrule': - rrules.push(value); - break; - - case 'exrule': - exrules.push(value); - break; - - case 'rdate': - rdates = this.rdates.add(value); - break; - - case 'exdate': - exdates = this.exdates.add(value); - break; - } - - return new Schedule({ - timezone: this.timezone, - data: this.data, - rrules, - exrules, - rdates, - exdates - }); - } - - remove(prop, value) { - let rrules = this.rrules; - let exrules = this.exrules; - let rdates = this.rdates; - let exdates = this.exdates; - - switch (prop) { - case 'rrule': - rrules = rrules.filter(rule => rule !== value); - break; - - case 'exrule': - exrules = exrules.filter(rule => rule !== value); - break; - - case 'rdate': - rdates = this.rdates.remove(value); - break; - - case 'exdate': - exdates = this.exdates.remove(value); - break; - } - - return new Schedule({ - timezone: this.timezone, - data: this.data, - rrules, - exrules, - rdates, - exdates - }); - } - - set(prop, value, options = {}) { - let timezone = this.timezone; - let rrules = this.rrules; - let exrules = this.exrules; - let rdates = this.rdates; - let exdates = this.exdates; - - switch (prop) { - case 'timezone': - if (value === this.timezone && !options.keepLocalTime) return this;else if (options.keepLocalTime) { - rrules = rrules.map(rule => rule.set('timezone', value, options)); - exrules = exrules.map(rule => rule.set('timezone', value, options)); - rdates = rdates.set('timezone', value, options); - exdates = exdates.set('timezone', value, options); - } - timezone = value; - break; - - case 'rrules': - rrules = value; - break; - - case 'exrules': - exrules = value; - break; - - case 'rdates': - rdates = value; - break; - - case 'exdates': - exdates = value; - break; - } - - return new Schedule({ - timezone, - data: this.data, - rrules, - exrules, - rdates, - exdates - }); - } - -} -/** - * An operator function, which takes a spread of occurrence generators and only - * returns the dates which intersect every occurrence generator. - * - * Because it's possible for all the generators to never intersect, - * and because the intersection operator can't detect this lack of intersection, - * you must call `intersection()` with a `{maxFailedIterations: number}` argument. - * For convenience, you can globally set `RScheduleConfig.defaultMaxFailedIterations`. - * Without further information, I'd probably set `defaultMaxFailedIterations = 50`. - * - * The `maxFailedIterations` argument caps the number of iterations the operator will - * run through without finding a single valid occurrence. If this number is reached, the operator will - * stop iterating (preventing a possible infinite loop). - * - * - Note: `maxFailedIterations` caps the number of iterations which - * *fail to turn up a single valid occurrence*. Every time a valid occurrence is returned, - * the current iteration count is reset to 0. - * - */ - - -function intersection(args) { - return options => new IntersectionOperator(args, options); -} - -class IntersectionOperator extends Operator { - constructor(args, config) { - super(args.streams, config); - - if (this.isInfinite) { - this.maxFailedIterations = args.maxFailedIterations || IntersectionOperator.defaultMaxFailedIterations; - - if (!this.maxFailedIterations) { - throw new _rschedule_core__WEBPACK_IMPORTED_MODULE_0__["ArgumentError"]('The IntersectionOperator must be provided ' + 'a `maxFailedIterations` argument when it is built from schedules of infinite length. ' + 'This argument is used to ensure that the IntersectionOperator does not enter ' + 'an infinite loop because the underlying schedules never intersect. ' + 'If the `maxFailedIterations` count is reached it will be assumed that ' + 'all valid occurrences have been found and iteration will end without error.' + 'Without additional information, "50" is probably a good ' + '`maxFailedIterations` value. ' + 'If the schedules are not of infinite length, `maxFailedIterations` is ignored. ' + 'Note also that you can provide a `defaultMaxFailedIterations` number via ' + 'IntersectionOperator.defaultMaxFailedIterations.'); - } - } - } - - set(_, value) { - return new IntersectionOperator({ - maxFailedIterations: this.maxFailedIterations, - streams: this.streams.map(stream => stream.set('timezone', value)) - }, Object.assign(Object.assign({}, this.config), { - base: this.config.base && this.config.base.set('timezone', value), - timezone: value - })); - } - - *_run(args = {}) { - const streams = this.streams.map(stream => new IterableWrapper(stream, args)); - - if (this.config.base) { - streams.push(new IterableWrapper(this.config.base, args)); - } - - if (streams.length === 0) return; - const hasEndDate = !!(!this.isInfinite || args.reverse || args.end); - - if (!cycleStreams$1(streams, undefined, Object.assign(Object.assign({}, args), { - hasEndDate, - iteration: 0, - maxIterations: this.maxFailedIterations - }))) { - return; - } - - let stream = selectNextIterable(streams, args); - - while (stream) { - const yieldArgs = yield this.normalizeRunOutput(stream.value); - const lastValidDate = stream.value; - - if (!(yieldArgs === null || yieldArgs === void 0 ? void 0 : yieldArgs.skipToDate)) { - // iterate the current stream - stream.next(); - } - - if (!cycleStreams$1(streams, lastValidDate, Object.assign(Object.assign({}, args), { - hasEndDate, - iteration: 0, - maxIterations: this.maxFailedIterations - }), yieldArgs)) { - return; - } // The call to `cycleStreams()`, above, has already called - // selectNextIterable with the `yieldArgs` - - - stream = selectNextIterable(streams, args); - } - } - - calculateIsInfinite() { - // Note: Array#every() === true when length === 0 - if (!this.config.base) { - if (this.streams.length === 0) return false; - return this.streams.every(stream => stream.isInfinite); - } else if (this.streams.length === 0) return this.config.base.isInfinite; - - return this.config.base.isInfinite && this.streams.every(stream => stream.isInfinite); - } - - calculateHasDuration() { - const streamsDuration = this.streams.every(stream => stream.hasDuration); - if (!this.config.base) return streamsDuration; - return this.config.base.hasDuration && streamsDuration; - } - -} - -function cycleStreams$1(streams, lastValidDate, options, yieldArgs) { - const next = selectNextIterable(streams, options, yieldArgs); - if (!next) return false; - if (lastValidDate && next.value.isEqual(lastValidDate)) return true; - if (streams.some(stream => stream.done)) return false; - if (streams.every(stream => stream.value.isEqual(next.value))) return true; - options.iteration++; - - if (options.maxIterations && !options.hasEndDate && options.iteration > options.maxIterations) { - return false; - } // Since not all of the streams are equal, we grab the last stream... - - - const last = selectLastIterable(streams, options); // ...and skip all the other streams so they are equal or past the last one - - streams.forEach(stream => { - // Because streams can have multiple, identical dates in a row, - // we don't want to `skipToDate` if the provided date is equal to the current date. - if (last.value.isEqual(stream.value)) return; - stream.next({ - skipToDate: last.value - }); - }); // then we repeat - - return cycleStreams$1(streams, lastValidDate, options); -} - -class DurationIterableWrapper extends IterableWrapper { - constructor(generator, runArgs) { - super(generator, runArgs); - this.workingValue = this.value; - this.next(); - } - -} - -class MergeDurationOperatorError extends Error {} -/** - * An operator function which takes an occurrence stream with - * `hasDuration === true` and merges occurrences which have overlapping - * start and end times. - * - * Because it's possible for all the occurrences in the stream to have - * overlapping start and end times, you must provide a `maxDuration` - * argument that represents the maximum possible duration for a single - * occurrence. If this duration is exceeded, a `MergeDurationOperatorError` - * will be thrown. - * - * - For your convenience, you can globally set a default - * `MergeDurationOperator#maxDuration` via - * `RScheduleConfig.MergeDurationOperator.defaultMaxDuration`. - * - * Usage example: - * - * ```typescript - * const MILLISECONDS_IN_HOUR = 1000 * 60 * 60; - * - * const dates = new Dates({ - * dates: [ - * new StandardDateAdapter(new Date(2010, 10, 10, 13), { duration: MILLISECONDS_IN_HOUR * 1 }), - * new StandardDateAdapter(new Date(2010, 10, 11, 13), { duration: MILLISECONDS_IN_HOUR * 2 }), - * new StandardDateAdapter(new Date(2010, 10, 11, 14), { duration: MILLISECONDS_IN_HOUR * 2 }), - * new StandardDateAdapter(new Date(2010, 10, 12, 13), { duration: MILLISECONDS_IN_HOUR * 1 }), - * ], - * dateAdpter: StandardDateAdapter, - * }).pipe( - * mergeDuration({ - * maxDuration: MILLISECONDS_IN_HOUR * 24 - * }) - * ) - * - * dates.occurrences().toArray() === [ - * new StandardDateAdapter(new Date(2010, 10, 10, 13), { duration: MILLISECONDS_IN_HOUR * 1 }), - * new StandardDateAdapter(new Date(2010, 10, 11, 13), { duration: MILLISECONDS_IN_HOUR * 3 }), - * new StandardDateAdapter(new Date(2010, 10, 12, 13), { duration: MILLISECONDS_IN_HOUR * 1 }), - * ] - * ``` - */ - - -function mergeDuration(args) { - return options => new MergeDurationOperator(args, options); -} - -class MergeDurationOperator extends Operator { - constructor(args, config) { - super([], config); - this.maxDuration = args.maxDuration; - - if (config.base && !config.base.hasDuration) { - throw new _rschedule_core__WEBPACK_IMPORTED_MODULE_0__["ArgumentError"]('Base stream provided to MergeDurationOperator does not have an associated duration. ' + 'The MergeDurationOperator can only be used with streams which have a duration. '); - } - } - /** Not actually used but necessary for IRunnable interface */ - - - set(_, value) { - return new MergeDurationOperator({ - maxDuration: this.maxDuration - }, Object.assign(Object.assign({}, this.config), { - base: this.config.base && this.config.base.set('timezone', value), - timezone: value - })); - } - - _run(args = {}) { - return args.reverse ? this.reverseRun(args) : this.forwardRun(args); - } - - calculateIsInfinite() { - return !!(this.config.base && this.config.base.isInfinite); - } - - calculateHasDuration() { - return true; - } - - *forwardRun(args = {}) { - if (!this.config.base) return; // We want to find occurrences that end after the provided - // `start` time even if they begin before the provided `start` - // time. Because of this, we must begin iterating `maxDuration` - // before the provided start time. - - let checkFromStart = args.start; - - if (args.start) { - checkFromStart = args.start.subtract(this.maxDuration, 'millisecond'); - } - - let checkFromEnd = args.end; - - if (args.end) { - checkFromEnd = args.end.add(this.maxDuration, 'millisecond'); - } - - const stream = new DurationIterableWrapper(this.config.base, Object.assign(Object.assign({}, args), { - start: checkFromStart, - end: checkFromEnd - })); - let yieldArgs; // checking `stream.workingValue` because when `stream.done === true` - // `stream.workingValue` will not have been yielded yet - - while (stream.workingValue) { - // TODO(@john.carroll.p): figure out how to handle `DateTime#generators` for merged `DateTimes` - while (!stream.done && stream.workingValue.end.isAfterOrEqual(stream.value)) { - if (stream.workingValue.duration > this.maxDuration) { - throw new MergeDurationOperatorError(`MergeDurationOperatorError: Occurrence duration exceeded maxDuration of ` + this.maxDuration); - } - - if (stream.value.end.isAfter(stream.workingValue.end)) { - const diff = stream.value.end.valueOf() - stream.workingValue.end.valueOf(); - stream.workingValue = stream.workingValue.set('duration', stream.workingValue.duration + diff); - } - - stream.next(); - } // check to make sure the occurrence we are about to yield ends after the - // provided start time. - - - if (args.start && stream.workingValue.end.isBefore(args.start)) { - stream.workingValue = stream.value; - stream.next(); - continue; - } // make sure the occurrence we are about to yield ends after the - // provided skipToDate - - - if ((yieldArgs === null || yieldArgs === void 0 ? void 0 : yieldArgs.skipToDate) && stream.workingValue.end.isBefore(yieldArgs.skipToDate)) { - stream.workingValue = stream.value; - stream.next(); - continue; - } // make sure we are not after the user requested `end` time. - - - if (args.end && stream.workingValue && stream.workingValue.isAfter(args.end)) { - break; - } - - if (stream.workingValue.duration > this.maxDuration) { - throw new MergeDurationOperatorError(`MergeDurationOperatorError: Occurrence duration exceeded maxDuration of ` + this.maxDuration); - } - - yieldArgs = yield this.normalizeRunOutput(stream.workingValue); - - if ((yieldArgs === null || yieldArgs === void 0 ? void 0 : yieldArgs.skipToDate) && stream.workingValue.isAfterOrEqual(yieldArgs.skipToDate)) { - throw new Error('A provided `skipToDate` option must be greater than the last yielded date ' + '(or smaller, in the case of reverse iteration)'); - } - - stream.workingValue = stream.value; - stream.next(); - } - } - - *reverseRun(args = {}) { - if (!this.config.base) return; // We want to find occurrences that end after the provided - // `start` time even if they begin before the provided `start` - // time. Because of this, we must begin iterating `maxDuration` - // before the provided start time. - - let checkFromStart = args.start; - - if (args.start) { - checkFromStart = args.start.subtract(this.maxDuration, 'millisecond'); - } - - let checkFromEnd = args.end; - - if (args.end) { - checkFromEnd = args.end.add(this.maxDuration, 'millisecond'); - } - - const stream = new DurationIterableWrapper(this.config.base, Object.assign(Object.assign({}, args), { - start: checkFromStart, - end: checkFromEnd - })); - let yieldArgs; // checking `stream.workingValue` because when `stream.done === true` - // `stream.workingValue` will not have been yielded yet - - while (stream.workingValue) { - // TODO(@john.carroll.p): figure out how to handle `DateTime#generators` for merged `DateTimes` - while (!stream.done && stream.workingValue.isBeforeOrEqual(stream.value.end)) { - if (stream.workingValue.duration > this.maxDuration) { - throw new MergeDurationOperatorError(`MergeDurationOperatorError: Occurrence duration exceeded maxDuration of ` + this.maxDuration); - } - - if (stream.value.isBefore(stream.workingValue) || stream.value.end.isAfter(stream.workingValue.end)) { - if (stream.value.end.isAfter(stream.workingValue.end)) { - // `stream.workingValue` is a subset of `stream.value` - // so simply replace `stream.workingValue` with `stream.value` - stream.workingValue = stream.value; - } else { - const diff = stream.workingValue.valueOf() - stream.value.valueOf(); - stream.workingValue = stream.value.set('duration', stream.workingValue.duration + diff); - } - } - - stream.next(); - } // check to make sure the occurrence we are about to yield starts before the - // provided start time. - - - if (args.start && stream.workingValue.end.isBefore(args.start)) { - break; - } - - if (yieldArgs && yieldArgs.skipToDate && stream.workingValue.end.isBefore(yieldArgs.skipToDate)) { - stream.workingValue = stream.value; - stream.next(); - continue; - } // make sure we are not after the user requested `end` time. - - - if (args.end && stream.workingValue && stream.workingValue.isAfter(args.end)) { - stream.workingValue = stream.value; - stream.next(); - continue; - } - - if (stream.workingValue.duration > this.maxDuration) { - throw new MergeDurationOperatorError(`MergeDurationOperatorError: Occurrence duration exceeded maxDuration of ` + this.maxDuration); - } - - yieldArgs = yield this.normalizeRunOutput(stream.workingValue); - - if (yieldArgs && yieldArgs.skipToDate && stream.workingValue.end.isBeforeOrEqual(yieldArgs.skipToDate)) { - throw new Error('A provided `skipToDate` option must be greater than the last yielded date ' + '(or smaller, in the case of reverse iteration)'); - } - - stream.workingValue = stream.value; - stream.next(); - } - } - -} - -class SplitDurationOperatorError extends Error {} -/** - * An operator function which takes an occurrence stream with - * `hasDuration === true` and passes occurrences through a splitting - * function. One usecase for this operator is to dynamically break up - * occurrences with a large duration into several smaller occurrences. - * - * You must provide a `maxDuration` argument that represents the - * maximum possible duration for a single occurrence. If this - * duration is exceeded, a `SplitDurationOperatorError` will be - * thrown. - * - * - For your convenience, you can globally set a default - * `SplitDurationOperator#maxDuration` via - * `RScheduleConfig.SplitDurationOperator.defaultMaxDuration`. - * - * Usage example: - * - * ```typescript - * const MILLISECONDS_IN_HOUR = 1000 * 60 * 60; - * - * const splitFn = (date: DateTime) => { - * if (date.duration > MILLISECONDS_IN_HOUR) { - * const diff = date.duration! / 2; - * - * return [ - * date.set('duration', diff), - * date.add(diff, 'millisecond').set('duration', diff), - * ]; - * } - * - * return [date]; - * }; - * - * const dates = new Dates({ - * dates: [ - * new StandardDateAdapter(new Date(2010, 10, 10, 13), { duration: MILLISECONDS_IN_HOUR * 1 }), - * new StandardDateAdapter(new Date(2010, 10, 11, 13), { duration: MILLISECONDS_IN_HOUR * 2 }), - * ], - * dateAdpter: StandardDateAdapter, - * }).pipe( - * splitDuration({ - * splitFn, - * maxDuration: MILLISECONDS_IN_HOUR * 1 - * }) - * ) - * - * expect(dates.occurrences().toArray()).toEqual([ - * new StandardDateAdapter(new Date(2010, 10, 10, 13), { duration: MILLISECONDS_IN_HOUR * 1 }), - * new StandardDateAdapter(new Date(2010, 10, 11, 13), { duration: MILLISECONDS_IN_HOUR * 1 }), - * new StandardDateAdapter(new Date(2010, 10, 11, 14), { duration: MILLISECONDS_IN_HOUR * 1 }), - * ]) - * ``` - */ - - -function splitDuration(args) { - return options => new SplitDurationOperator(args, options); -} - -class SplitDurationOperator extends Operator { - constructor(args, config) { - super([], config); - this.splitFn = args.splitFn; - this.maxDuration = args.maxDuration; - - if (config.base && !config.base.hasDuration) { - throw new _rschedule_core__WEBPACK_IMPORTED_MODULE_0__["ArgumentError"]('Base stream provided to SplitDurationOperator does not have an associated duration. ' + 'The SplitDurationOperator can only be used with streams which have a duration.'); - } - } - /** Not actually used but necessary for IRunnable interface */ - - - set(_, value) { - return new SplitDurationOperator({ - maxDuration: this.maxDuration, - splitFn: this.splitFn - }, Object.assign(Object.assign({}, this.config), { - base: this.config.base && this.config.base.set('timezone', value), - timezone: value - })); - } - - *_run(args = {}) { - if (!this.config.base) return; - const reverse = args.reverse || false; // We want to find occurrences that end after the provided - // `start` time even if they begin before the provided `start` - // time. Because of this, we add `maxDuration` to - // the provided start time. - - let checkFromStart = args.start; - - if (args.start) { - checkFromStart = args.start.subtract(this.maxDuration, 'millisecond'); - } // same goes for `end` time as with `start` time. - - - let checkFromEnd = args.end; - - if (args.end) { - checkFromEnd = args.end.add(this.maxDuration, 'millisecond'); - } - - const stream = new IterableWrapper(this.config.base, Object.assign(Object.assign({}, args), { - start: checkFromStart, - end: checkFromEnd - })); - let yieldArgs; - const datesBucket = []; - - while (!stream.done || datesBucket[0] && datesBucket[0][0]) { - /** - * Example: - * 10am - 2pm -> 10am - 12pm, 12pm - 2pm - * 11am - 3pm -> 11am - 1pm, 1pm - 3pm - * 2pm - 4pm -> 2pm - 3pm, 3pm - 4pm - */ - if (!(datesBucket[0] && datesBucket[0][0])) { - // we're out of dates - datesBucket.push(this.splitDate(stream.value, reverse)); - stream.next(); - } - - while (!stream.done && (reverse ? datesBucket[0].some(date => date.isBeforeOrEqual(stream.value.end)) : datesBucket[0].some(date => date.isAfterOrEqual(stream.value)))) { - datesBucket.push(this.splitDate(stream.value, reverse)); - stream.next(); - } - - let selectedDate = datesBucket[0] && datesBucket[0][0]; - let bucketIndex = -1; - let selectedBucketIndex = 0; - let dateIndex = -1; - let selectedDateIndex = 0; // find the next date as well as its location in the datesBucket - - for (const bucket of datesBucket) { - bucketIndex++; - dateIndex = -1; - - for (const date of bucket) { - dateIndex++; - let dateShouldComeNext; - - if (reverse) { - dateShouldComeNext = date.isAfter(selectedDate) || date.isEqual(selectedDate) && date.duration > selectedDate.duration; - } else { - dateShouldComeNext = date.isBefore(selectedDate) || date.isEqual(selectedDate) && date.duration < selectedDate.duration; - } - - if (dateShouldComeNext) { - selectedDate = date; - selectedBucketIndex = bucketIndex; - selectedDateIndex = dateIndex; - break; - } - } - } - - datesBucket[selectedBucketIndex].splice(selectedDateIndex, 1); - - if (datesBucket[selectedBucketIndex].length === 0) { - datesBucket.splice(selectedBucketIndex, 1); - } // If we've been yieldedArgs from the last cycle, check to see - // that the selectedDate honors the `skipToDate` requirement - // if not, discard this selectedDate - - - if (yieldArgs && yieldArgs.skipToDate && selectedDate && !datePastEnd(selectedDate, args) && !datePastSkipToDate(selectedDate, yieldArgs.skipToDate, args)) { - continue; - } // because we subtracted `maxDuration` to the base iterator's start time, - // check to make sure the selectedDate we are about to yield should - // actually be yielded (it may be before the provided `start` time). - // If not, discard the selectedDate. - - - if (args.start && selectedDate.end.isBefore(args.start)) { - if (reverse) break; - continue; - } // because we added `maxDuration` to the base iterator's end time, - // check to make sure the selectedDate we are about to yield should - // actually be yielded (it may be after the provided `end` time). - // If not, end iteration. - - - if (args.end && selectedDate.isAfter(args.end)) { - if (reverse) continue; - break; - } - - if (selectedDate.duration > this.maxDuration) { - throw new SplitDurationOperatorError(`SplitDurationOperatorError: Occurrence duration exceeded maxDuration of ` + this.maxDuration); - } - - yieldArgs = yield this.normalizeRunOutput(selectedDate); - - if (yieldArgs && yieldArgs.skipToDate && (args.reverse ? selectedDate.isBeforeOrEqual(yieldArgs.skipToDate) : selectedDate.isAfterOrEqual(yieldArgs.skipToDate))) { - throw new Error('A provided `skipToDate` option must be greater than the last yielded date ' + '(or smaller, in the case of reverse iteration)'); - } - } - } - - calculateIsInfinite() { - return !!(this.config.base && this.config.base.isInfinite); - } - - calculateHasDuration() { - return true; - } - - splitDate(date, reverse) { - const dates = this.splitFn(date); - let valid; - - if (dates.length === 0) { - valid = false; - } else if (dates.length === 1) { - valid = date.duration === dates[0].duration; - } else { - valid = date.duration === dates.reduce((prev, curr) => prev + curr.duration, 0); - } - - if (!valid) { - throw new Error('The provided SplitDurationOperator split function ' + 'must return an array of DateTimes with length > 0 ' + 'where the total duration of the new dates equals the duration of ' + 'the original date.'); - } - - dates.sort(_rschedule_core__WEBPACK_IMPORTED_MODULE_0__["dateTimeSortComparer"]); - - if (reverse) { - dates.reverse(); - } - - return dates; - } - -} - -function datePastEnd(date, options) { - return !!(options.reverse ? options.start && date.isBefore(options.start) : options.end && date.isAfter(options.end)); -} - -function datePastSkipToDate(date, skipToDate, options) { - return !!(options.reverse ? skipToDate.isAfterOrEqual(date) : skipToDate.isBeforeOrEqual(date)); -} - - - -/***/ }), - -/***/ "./node_modules/@rschedule/core/es2015/main.js": -/*!*****************************************************!*\ - !*** ./node_modules/@rschedule/core/es2015/main.js ***! - \*****************************************************/ -/*! exports provided: ArgumentError, DateAdapter, DateAdapterBase, DateTime, InfiniteLoopError, InvalidDateAdapterError, InvalidDateTime, InvalidDateTimeError, RecurrenceRuleError, RecurrenceRulesIterator, RuleOptionError, ValidDateTime, cloneJSON, cloneRuleOptions, dateInputToDateAdapter, dateInputToDateTime, dateTimeSortComparer, freqToGranularity, getDaysInYear, getDifferenceBetweenWeekdays, isLeapYear, normalizeDateTimeTimezone, normalizeRuleOptions, numberSortComparer, orderedWeekdays, recurrenceRulesReducer, uniqDateTimes */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ArgumentError", function() { return ArgumentError; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DateAdapter", function() { return DateAdapter; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DateAdapterBase", function() { return DateAdapterBase; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DateTime", function() { return DateTime; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "InfiniteLoopError", function() { return InfiniteLoopError; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "InvalidDateAdapterError", function() { return InvalidDateAdapterError; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "InvalidDateTime", function() { return InvalidDateTime; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "InvalidDateTimeError", function() { return InvalidDateTimeError; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RecurrenceRuleError", function() { return RecurrenceRuleError; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RecurrenceRulesIterator", function() { return RecurrenceRulesIterator; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RuleOptionError", function() { return RuleOptionError; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ValidDateTime", function() { return ValidDateTime; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "cloneJSON", function() { return cloneJSON; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "cloneRuleOptions", function() { return cloneRuleOptions; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "dateInputToDateAdapter", function() { return dateInputToDateAdapter; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "dateInputToDateTime", function() { return dateInputToDateTime; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "dateTimeSortComparer", function() { return dateTimeSortComparer; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "freqToGranularity", function() { return freqToGranularity; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getDaysInYear", function() { return getDaysInYear; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getDifferenceBetweenWeekdays", function() { return getDifferenceBetweenWeekdays; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isLeapYear", function() { return isLeapYear; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "normalizeDateTimeTimezone", function() { return normalizeDateTimeTimezone; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "normalizeRuleOptions", function() { return normalizeRuleOptions; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "numberSortComparer", function() { return numberSortComparer; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "orderedWeekdays", function() { return orderedWeekdays; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "recurrenceRulesReducer", function() { return recurrenceRulesReducer; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "uniqDateTimes", function() { return uniqDateTimes; }); -class InvalidDateAdapterError extends Error {} - -let dateAdapterConfig; - -class DateAdapterBase { - constructor(_date, options) { - this.duration = options && options.duration || 0; - this.generators = options && options.generators && options.generators.slice() || []; - - if (!Number.isInteger(this.duration) || this.duration < 0) { - throw new InvalidDateAdapterError('duration must be a non-negative integer'); - } - } - - static set adapter(value) { - if (dateAdapterConfig) { - throw new Error(`"${dateAdapterConfig.name}" has already been configured.`); - } - - dateAdapterConfig = value; - } - - static get adapter() { - if (!dateAdapterConfig) { - throw new Error('No date adapter has been configured. See rSchedule docs.'); - } - - return dateAdapterConfig; - } - - static isDate(_object) { - throw unimplementedError('isDate()'); - } - - static fromDate(_date, _options) { - throw unimplementedError('fromDate()'); - } - - static fromJSON(_json) { - throw unimplementedError('fromJSON()'); - } - - static fromDateTime(_datetime) { - throw unimplementedError('fromDateTime()'); - } - /** - * Returns a string in simplified extended ISO format (ISO 8601). - * - * _Note: this method is intended for testing and its - * implementation isn't particularly performant._ - */ - - - toISOString() { - return this.set('timezone', 'UTC').toDateTime().toISOString(); - } - - toDateTime() { - const date = DateTime.fromJSON(Object.assign(Object.assign({}, this.toJSON()), { - generators: this.generators - })); - return date; - } - -} - -DateAdapterBase.hasTimezoneSupport = false; - -function unimplementedError(name) { - return new Error(`You must implement the "${name}" method for this DateAdapter class`); -} - -var DateAdapter; - -(function (DateAdapter) { - DateAdapter.WEEKDAYS = ['SU', 'MO', 'TU', 'WE', 'TH', 'FR', 'SA']; - DateAdapter.MILLISECONDS_IN_SECOND = 1000; - DateAdapter.MILLISECONDS_IN_MINUTE = DateAdapter.MILLISECONDS_IN_SECOND * 60; - DateAdapter.MILLISECONDS_IN_HOUR = DateAdapter.MILLISECONDS_IN_MINUTE * 60; - DateAdapter.MILLISECONDS_IN_DAY = DateAdapter.MILLISECONDS_IN_HOUR * 24; - DateAdapter.MILLISECONDS_IN_WEEK = DateAdapter.MILLISECONDS_IN_DAY * 7; -})(DateAdapter || (DateAdapter = {})); - -class InvalidDateTimeError extends Error {} - -class DateTime { - constructor(date, timezone, duration, generators) { - this.date = new Date(date); - this.timezone = timezone || null; - this.duration = duration || 0; - this.generators = generators && generators.slice() || []; - - if (!Number.isInteger(this.duration) || this.duration < 0) { - throw new InvalidDateTimeError('duration must be a non-negative integer'); - } - - this.assertIsValid(); - } // /** - // * Similar to `Array.isArray()`, `isInstance()` provides a surefire method - // * of determining if an object is a `DateTime` by checking against the - // * global symbol registry. - // */ - // static isInstance(object: any): object is DateTime { - // return !!(object && object[DATETIME_ID]); - // } - - - static fromJSON(json) { - const date = new Date(Date.UTC(json.year, json.month - 1, json.day, json.hour, json.minute, json.second, json.millisecond)); - return new DateTime(date, json.timezone, json.duration, json.generators); - } - - static fromDateAdapter(adapter) { - return DateTime.fromJSON(Object.assign(Object.assign({}, adapter.toJSON()), { - generators: adapter.generators - })); - } - /** - * Returns `undefined` if `duration` is `0`. Else returns - * the `end` date. - */ - - - get end() { - if (!this.duration) return; - if (this._end) return this._end; - this._end = this.add(this.duration, 'millisecond'); - return this._end; - } // While we constrain the argument to be another DateAdapter in typescript - // we handle the case of someone passing in another type of object in javascript - - - isEqual(object) { - if (!object) { - return false; - } - - assertSameTimeZone(this, object); - return this.valueOf() === object.valueOf(); - } - - isBefore(object) { - assertSameTimeZone(this, object); - return this.valueOf() < object.valueOf(); - } - - isBeforeOrEqual(object) { - assertSameTimeZone(this, object); - return this.valueOf() <= object.valueOf(); - } - - isAfter(object) { - assertSameTimeZone(this, object); - return this.valueOf() > object.valueOf(); - } - - isAfterOrEqual(object) { - assertSameTimeZone(this, object); - return this.valueOf() >= object.valueOf(); - } - - isOccurring(object) { - if (!this.duration) { - throw new Error('DateTime#isOccurring() is only applicable to DateTimes with durations'); - } - - assertSameTimeZone(this, object); - return object.isAfterOrEqual(this) && object.isBeforeOrEqual(this.add(this.duration, 'millisecond')); - } - - add(amount, unit) { - switch (unit) { - case 'generator': - { - const generators = this.generators.slice(); - generators.unshift(amount); - return new DateTime(this.date, this.timezone, this.duration, generators); - } - - case 'year': - return this.forkDateTime(addUTCYears(this.date, amount)); - - case 'month': - return this.forkDateTime(addUTCMonths(this.date, amount)); - - case 'week': - return this.forkDateTime(addUTCWeeks(this.date, amount)); - - case 'day': - return this.forkDateTime(addUTCDays(this.date, amount)); - - case 'hour': - return this.forkDateTime(addUTCHours(this.date, amount)); - - case 'minute': - return this.forkDateTime(addUTCMinutes(this.date, amount)); - - case 'second': - return this.forkDateTime(addUTCSeconds(this.date, amount)); - - case 'millisecond': - return this.forkDateTime(addUTCMilliseconds(this.date, amount)); - - default: - throw new Error('Invalid unit provided to `DateTime#add`'); - } - } - - subtract(amount, unit) { - switch (unit) { - case 'year': - return this.forkDateTime(subUTCYears(this.date, amount)); - - case 'month': - return this.forkDateTime(subUTCMonths(this.date, amount)); - - case 'week': - return this.forkDateTime(subUTCWeeks(this.date, amount)); - - case 'day': - return this.forkDateTime(subUTCDays(this.date, amount)); - - case 'hour': - return this.forkDateTime(subUTCHours(this.date, amount)); - - case 'minute': - return this.forkDateTime(subUTCMinutes(this.date, amount)); - - case 'second': - return this.forkDateTime(subUTCSeconds(this.date, amount)); - - case 'millisecond': - return this.forkDateTime(subUTCMilliseconds(this.date, amount)); - - default: - throw new Error('Invalid unit provided to `DateTime#subtract`'); - } - } - - get(unit) { - switch (unit) { - case 'year': - return this.date.getUTCFullYear(); - - case 'month': - return this.date.getUTCMonth() + 1; - - case 'yearday': - return getUTCYearDay(this.date); - - case 'weekday': - return DateAdapter.WEEKDAYS[this.date.getUTCDay()]; - - case 'day': - return this.date.getUTCDate(); - - case 'hour': - return this.date.getUTCHours(); - - case 'minute': - return this.date.getUTCMinutes(); - - case 'second': - return this.date.getUTCSeconds(); - - case 'millisecond': - return this.date.getUTCMilliseconds(); - - default: - throw new Error('Invalid unit provided to `DateTime#set`'); - } - } - - set(unit, value) { - if (unit === 'duration') { - return new DateTime(this.date, this.timezone, value, this.generators); - } - - if (unit === 'generators') { - return new DateTime(this.date, this.timezone, this.duration, value); - } - - let date = new Date(this.date); - - switch (unit) { - case 'year': - date.setUTCFullYear(value); - break; - - case 'month': - { - // If the current day of the month - // is greater than days in the month we are moving to, we need to also - // set the day to the end of that month. - const length = monthLength(value, date.getUTCFullYear()); - const day = date.getUTCDate(); - - if (day > length) { - date.setUTCDate(1); - date.setUTCMonth(value); - date = subUTCDays(date, 1); - } else { - date.setUTCMonth(value - 1); - } - - break; - } - - case 'day': - date.setUTCDate(value); - break; - - case 'hour': - date.setUTCHours(value); - break; - - case 'minute': - date.setUTCMinutes(value); - break; - - case 'second': - date.setUTCSeconds(value); - break; - - case 'millisecond': - date.setUTCMilliseconds(value); - break; - - default: - throw new Error('Invalid unit provided to `DateTime#set`'); - } - - return this.forkDateTime(date); - } - - granularity(granularity, opt = {}) { - let date = this.forkDateTime(this.date); - - switch (granularity) { - case 'year': - date = date.set('month', 1); - - case 'month': - date = date.set('day', 1); - break; - - case 'week': - date = setDateToStartOfWeek(date, opt.weekStart); - } - - switch (granularity) { - case 'year': - case 'month': - case 'week': - case 'day': - date = date.set('hour', 0); - - case 'hour': - date = date.set('minute', 0); - - case 'minute': - date = date.set('second', 0); - - case 'second': - date = date.set('millisecond', 0); - - case 'millisecond': - return date; - - default: - throw new Error('Invalid granularity provided to `DateTime#granularity`: ' + granularity); - } - } - - endGranularity(granularity, opt = {}) { - let date = this.forkDateTime(this.date); - - switch (granularity) { - case 'year': - date = date.set('month', 12); - - case 'month': - date = date.set('day', monthLength(date.get('month'), date.get('year'))); - break; - - case 'week': - date = setDateToEndOfWeek(date, opt.weekStart); - } - - switch (granularity) { - case 'year': - case 'month': - case 'week': - case 'day': - date = date.set('hour', 23); - - case 'hour': - date = date.set('minute', 59); - - case 'minute': - date = date.set('second', 59); - - case 'second': - date = date.set('millisecond', 999); - - case 'millisecond': - return date; - - default: - throw new Error('Invalid granularity provided to `DateTime#granularity`: ' + granularity); - } - } - - toISOString() { - return this.date.toISOString(); - } - - toDateTime() { - return this; - } - - toJSON() { - const json = { - timezone: this.timezone, - year: this.get('year'), - month: this.get('month'), - day: this.get('day'), - hour: this.get('hour'), - minute: this.get('minute'), - second: this.get('second'), - millisecond: this.get('millisecond') - }; - - if (this.duration) { - json.duration = this.duration; - } - - return json; - } - - valueOf() { - return this.date.valueOf(); - } - - assertIsValid() { - if (isNaN(this.valueOf())) { - throw new InvalidDateTimeError('DateTime has invalid date.'); - } - - return true; - } - - forkDateTime(date) { - return new DateTime(date, this.timezone, this.duration, this.generators); - } - -} - -function assertSameTimeZone(x, y) { - if (x.timezone !== y.timezone) { - throw new InvalidDateTimeError('Attempted to compare a datetime to another date in a different timezone: ' + JSON.stringify(x) + ' and ' + JSON.stringify(y)); - } - - return true; -} - -function setDateToStartOfWeek(date, wkst) { - const index = orderedWeekdays(wkst).indexOf(date.get('weekday')); - return date.subtract(index, 'day'); -} - -function setDateToEndOfWeek(date, wkst) { - const index = orderedWeekdays(wkst).indexOf(date.get('weekday')); - return date.add(6 - index, 'day'); -} - -function dateTimeSortComparer(a, b) { - if (a.isAfter(b)) return 1; - if (a.isBefore(b)) return -1; - - if (a.duration && b.duration) { - if (a.duration > b.duration) return 1; - if (a.duration < b.duration) return -1; - } - - return 0; -} - -function uniqDateTimes(dates) { - return Array.from(new Map(dates.map(date => [date.toISOString(), date])).values()); -} - -function orderedWeekdays(wkst = 'SU') { - const wkdays = DateAdapter.WEEKDAYS.slice(); - let index = wkdays.indexOf(wkst); - - while (index !== 0) { - shiftArray(wkdays); - index--; - } - - return wkdays; -} - -function shiftArray(array, from = 'first') { - if (array.length === 0) { - return array; - } else if (from === 'first') { - array.push(array.shift()); - } else { - array.unshift(array.pop()); - } - - return array; -} - -function getDifferenceBetweenWeekdays(x, y) { - if (x === y) return 0; - const result = DateAdapter.WEEKDAYS.indexOf(x) - DateAdapter.WEEKDAYS.indexOf(y); - return result > 0 ? 7 - result : Math.abs(result); -} -/** - * Returns the days in the given month. - * - * @param month base-1 - * @param year - */ - - -function monthLength(month, year) { - const block = { - 1: 31, - 2: getDaysInFebruary(year), - 3: 31, - 4: 30, - 5: 31, - 6: 30, - 7: 31, - 8: 31, - 9: 30, - 10: 31, - 11: 30, - 12: 31 - }; - return block[month]; -} - -function getDaysInFebruary(year) { - return isLeapYear(year) ? 29 : 28; -} // taken from date-fn - - -function isLeapYear(year) { - return year % 400 === 0 || year % 4 === 0 && year % 100 !== 0; -} - -function getDaysInYear(year) { - return isLeapYear(year) ? 366 : 365; -} - -function getUTCYearDay(now) { - const start = new Date(Date.UTC(now.getUTCFullYear(), 0, 1)); - const diff = now.valueOf() - start.valueOf(); - return 1 + Math.floor(diff / DateAdapter.MILLISECONDS_IN_DAY); -} -/** - * These functions are basically lifted from `date-fns`, but changed - * to use the UTC date methods, which `date-fns` doesn't support. - */ - - -function toInteger(input) { - if (input === null || input === true || input === false) { - return NaN; - } - - const int = Number(input); - - if (isNaN(int)) { - return int; - } - - return int < 0 ? Math.ceil(int) : Math.floor(int); -} - -function addMilliseconds(dirtyDate, dirtyAmount) { - if (arguments.length < 2) { - throw new TypeError('2 arguments required, but only ' + arguments.length + ' present'); - } - - const timestamp = dirtyDate.valueOf(); - const amount = toInteger(dirtyAmount); - return new Date(timestamp + amount); -} - -function addUTCYears(date, input) { - const amount = toInteger(input); - return addUTCMonths(date, amount * 12); -} - -function addUTCMonths(date, input) { - const amount = toInteger(input); - date = new Date(date); - const desiredMonth = date.getUTCMonth() + amount; - const dateWithDesiredMonth = new Date(0); - dateWithDesiredMonth.setUTCFullYear(date.getUTCFullYear(), desiredMonth, 1); - dateWithDesiredMonth.setUTCHours(0, 0, 0, 0); - const daysInMonth = monthLength(dateWithDesiredMonth.getUTCMonth() + 1, dateWithDesiredMonth.getUTCFullYear()); // Set the last day of the new month - // if the original date was the last day of the longer month - - date.setUTCMonth(desiredMonth, Math.min(daysInMonth, date.getUTCDate())); - return date; -} - -function addUTCWeeks(date, input) { - const amount = toInteger(input); - const days = amount * 7; - return addUTCDays(date, days); -} - -function addUTCDays(date, input) { - // by adding milliseconds rather than days, we supress the native Date object's automatic - // daylight savings time conversions which we don't want in UTC mode - return addUTCMilliseconds(date, toInteger(input) * DateAdapter.MILLISECONDS_IN_DAY); -} - -function addUTCHours(date, input) { - const amount = toInteger(input); - return addMilliseconds(date, amount * DateAdapter.MILLISECONDS_IN_HOUR); -} - -function addUTCMinutes(date, input) { - const amount = toInteger(input); - return addMilliseconds(date, amount * DateAdapter.MILLISECONDS_IN_MINUTE); -} - -function addUTCSeconds(date, input) { - const amount = toInteger(input); - return addMilliseconds(date, amount * DateAdapter.MILLISECONDS_IN_SECOND); -} - -function addUTCMilliseconds(date, input) { - const amount = toInteger(input); - const timestamp = date.getTime(); - return new Date(timestamp + amount); -} - -function subUTCYears(date, amount) { - return addUTCYears(date, -amount); -} - -function subUTCMonths(date, amount) { - return addUTCMonths(date, -amount); -} - -function subUTCWeeks(date, amount) { - return addUTCWeeks(date, -amount); -} - -function subUTCDays(date, amount) { - return addUTCDays(date, -amount); -} - -function subUTCHours(date, amount) { - return addUTCHours(date, -amount); -} - -function subUTCMinutes(date, amount) { - return addUTCMinutes(date, -amount); -} - -function subUTCSeconds(date, amount) { - return addUTCSeconds(date, -amount); -} - -function subUTCMilliseconds(date, amount) { - return addUTCMilliseconds(date, -amount); -} - -class ArgumentError extends Error {} - -class InfiniteLoopError extends Error {} - -function numberSortComparer(a, b) { - if (a > b) { - return 1; - } else if (b > a) { - return -1; - } else { - return 0; - } -} - -function freqToGranularity(freq) { - switch (freq) { - case 'YEARLY': - return 'year'; - - case 'MONTHLY': - return 'month'; - - case 'WEEKLY': - return 'week'; - - case 'DAILY': - return 'day'; - - case 'HOURLY': - return 'hour'; - - case 'MINUTELY': - return 'minute'; - - case 'SECONDLY': - return 'second'; - - case 'MILLISECONDLY': - return 'millisecond'; - - default: - throw new Error('unknown freq passed to freqToGranularity()'); - } -} - -function cloneJSON(json) { - return JSON.parse(JSON.stringify(json)); -} - -function dateInputToDateAdapter(date) { - // prettier-ignore - return date instanceof DateTime ? DateAdapterBase.adapter.fromDateTime(date) : date instanceof DateAdapterBase ? date : DateAdapterBase.adapter.fromDate(date); -} - -function dateInputToDateTime(date, timezone) { - if (date instanceof DateTime) { - if (date.timezone !== timezone) { - return DateAdapterBase.adapter.fromDateTime(date).set('timezone', timezone).toDateTime(); - } - - return date; - } - - return date instanceof DateAdapterBase ? date.set('timezone', timezone).toDateTime() : DateAdapterBase.adapter.fromDate(date).set('timezone', timezone).toDateTime(); -} // export function normalizeDateInput<T extends DateAdapter>( -// dateAdapter: DateAdapterConstructor<T>, -// input: DateInput<T>, -// timezone: string | null, -// ): DateTime { -// if (input instanceof DateTime) { -// if (input.timezone !== timezone) { -// return dateAdapter -// .fromDateTime(input) -// .set('timezone', timezone) -// .toDateTime(); -// } -// return input; -// } -// return input instanceof DateAdapter -// ? input.set('timezone', timezone).toDateTime() -// : new dateAdapter(input).toDateTime(); -// } - - -function normalizeDateTimeTimezone(date, timezone) { - if (date.timezone !== timezone) { - return DateAdapterBase.adapter.fromDateTime(date).set('timezone', timezone).toDateTime(); - } - - return date; -} - -class RuleOptionError extends Error {} - -function normalizeDefaultOptions(options) { - let start; - - if (options.start instanceof DateTime) { - start = options.start; - } else if (options.start instanceof DateAdapterBase) { - start = options.start.toDateTime(); - } else if (DateAdapterBase.adapter.isDate(options.start)) { - start = DateAdapterBase.adapter.fromDate(options.start).toDateTime(); - } else { - throw new RuleOptionError('"start" must be either a `DateAdapter` instance or an instance of the ' + 'date a DateAdapter is wrapping (e.g. `StandardDateAdapter` wraps a `Date`)'); - } - - let end; - - if (options.end) { - if (options.end instanceof DateTime) { - end = options.end; - } else if (options.end instanceof DateAdapterBase) { - end = options.end.toDateTime(); - } else if (DateAdapterBase.adapter.isDate(options.end)) { - end = DateAdapterBase.adapter.fromDate(options.end).toDateTime(); - } else { - throw new RuleOptionError('"end" must be either be `undefined`, a `DateAdapter` instance, or an instance of the ' + 'date a DateAdapter is wrapping (e.g. `StandardDateAdapter` wraps a `Date`)'); - } - } - - if (options.duration !== undefined) { - if (!Number.isInteger(options.duration)) { - throw new RuleOptionError('"duration" expects a whole number'); - } - - if (options.duration <= 0) { - throw new RuleOptionError('"duration" must be greater than 0'); - } - } - - if (options.count !== undefined) { - if (!Number.isInteger(options.count)) { - throw new RuleOptionError('"count" must be a whole number'); - } - - if (options.count < 0) { - throw new RuleOptionError('"count" must be greater than 0'); - } - } - - if (options.end !== undefined && options.count !== undefined) { - throw new RuleOptionError('"end" and "count" cannot both be present'); - } - - return { - start, - end, - count: options.count, - duration: options.duration - }; -} - -function normalizeRuleOptions(recurrenceModules, options) { - const normOptions = normalizeDefaultOptions(options); - const startOptions = cloneJSON(options); - recurrenceModules.forEach(mod => { - mod.normalizeOptions(startOptions, normOptions); - }); - Object.keys(normOptions).forEach(key => { - if (normOptions[key] === undefined) { - delete normOptions[key]; - } - }); - return normOptions; -} - -function cloneRuleOptions(options) { - const obj = cloneJSON(options); - obj.start = options.start; - if (options.end) obj.end = options.end; - return obj; -} - -class RecurrenceRuleError extends Error {} - -class ValidDateTime { - constructor(date) { - this.date = date; - } - -} - -class InvalidDateTime { - constructor(date) { - this.date = date; - } - -} - -function recurrenceRulesReducer(rules) { - return iterator => rules.reduce((prev, curr) => { - const rule = curr.get(iterator); - if (rule) prev.push(rule); - return prev; - }, []); -} - -class RecurrenceRulesIterator { - constructor(recurrenceRules, options, args) { - this.options = options; - this.args = args; - this.rules = []; - this.iterator = // prettier-ignore - this.options.count === undefined ? this.iterate() : this.args.reverse ? this.iterateWithReverseCount() : this.iterateWithCount(); - this.options = Object.assign(Object.assign({}, cloneJSON(options)), { - start: options.start, - end: options.end - }); - this.reverse = this.options.count === undefined && args.reverse || false; - - const _this$normalizeDateTi = this.normalizeDateTimeArgs(args), - start = _this$normalizeDateTi.start, - end = _this$normalizeDateTi.end; - - if (options.count !== undefined) { - this.start = options.start; - } else if (start && options.start) { - this.start = start.isAfterOrEqual(options.start) ? start : options.start; - } else { - this.start = start || options.start; - } - - if (end && options.end) { - this.end = end.isBeforeOrEqual(options.end) ? end : options.end; - } else { - this.end = end || options.end; - } - - if (this.args.reverse && !(options.count !== undefined || this.end)) { - throw new Error('When iterating in reverse, the rule must have an `end` or `count` ' + 'property or you must provide an `end` argument.'); - } - - this.isInfinite = !this.end && this.options.count === undefined; - this.hasDuration = !!this.options.duration; - this.rules = Array.isArray(recurrenceRules) ? recurrenceRules : recurrenceRules(this); - } - - [Symbol.iterator]() { - return this.iterator; - } - - next(args) { - return this.iterator.next(args); - } - /** - * In the pipe controller, we have an extra level of indirection with - * the `run()` and `iterate()` methods. The `iterate()` method is the - * method which actually runs the logic in the pipes. If we didn't - * need to account for the `count` property of a rule, we would *only* - * need the iterate method... so much simpler. But we do need to account - * for rules with a `count` property. - * - * Rules with a `count` property need to begin iteration at the beginning - * because the `count` is always from the rule's start time. So if someone - * passes in a new start time as an argument to a rule with `count`, we - * need to secretly iterate from the beginning, tracking the number of - * iterations, and then only start yielding dates when we reach the section - * the user cares about (or, if we hit our `count` quota, cancel iterating). - * - * Additionally, we need to handle iterating in reverse. In this case, we build - * up a cache of dates between the rule's start time and the reverse iteration - * start date. Once we hit the reverse iteration start date, we start - * yielding dates in the cache, in reverse order. - * - * In general, I imagine the count number, if used, will be small. But a large - * count will definitely have a negative performance affect. I don't think - * there's anything to be done about this. - */ - - - *iterateWithReverseCount() { - const dates = Array.from(this.iterateWithCount()).reverse(); - let yieldArgs; - const dateCache = dates.slice(); - let date = dateCache.shift(); - - while (date) { - if (yieldArgs && yieldArgs.skipToDate && date.isAfter(yieldArgs.skipToDate)) { - date = dateCache.shift(); - continue; - } - - yieldArgs = yield date; - - if (yieldArgs && yieldArgs.skipToDate && yieldArgs.skipToDate.isAfterOrEqual(date)) { - throw new Error('A provided `skipToDate` option must be greater than the last yielded date ' + '(or smaller, in the case of reverse iteration)'); - } - - date = dateCache.shift(); - } - - return undefined; - } - - *iterateWithCount() { - if (this.options.count === 0) return; - const iterable = this.iterate(); - const start = this.args.start || this.start; - let date = iterable.next().value; - let index = 1; - let yieldArgs; - - while (date && index <= this.options.count) { - index++; - - if (date.isBefore(start)) { - date = iterable.next().value; - continue; - } - - if (yieldArgs && yieldArgs.skipToDate && date.isBefore(yieldArgs.skipToDate)) { - date = iterable.next().value; - continue; - } - - yieldArgs = yield date; - - if (yieldArgs && yieldArgs.skipToDate && yieldArgs.skipToDate.isBeforeOrEqual(date)) { - throw new Error('A provided `skipToDate` option must be greater than the last yielded date ' + '(or smaller, in the case of reverse iteration)'); - } - - date = iterable.next().value; - } - - return undefined; - } - - *iterate() { - let startingDate = this.start; - if (this.reverse) startingDate = this.end; - let date = this.nextDate(startingDate); - - while (date) { - const args = yield this.normalizeRunOutput(date); - - if (args && args.skipToDate) { - if (this.reverse ? args.skipToDate.isAfterOrEqual(date) : args.skipToDate.isBeforeOrEqual(date)) { - // We cannot consistently skip backwards because after an iterator is "done" - // it always returns undefined and you cannot reset it. Theoretically, it would be - // fine to skip backwards if the iterator wasn't already "done", but this - // would be prone to user error so we simply disallow skipping backwards altogether. - throw new Error('A provided `skipToDate` option must be greater than the last yielded date ' + '(or smaller, in the case of reverse iteration)'); - } - - date = this.nextDate(args.skipToDate); - } else { - date = this.nextDate(this.reverse ? date.subtract(1, 'millisecond') : date.add(1, 'millisecond')); - } - } - - return undefined; - } - /** - * Loops through the recurrence rules until a valid date is found. - */ - - - nextDate(start) { - let result = this.runRules(start.set('generators', [])); - if (this.isDatePastEnd(result.date)) return null; - let index = 0; - - while (result instanceof InvalidDateTime && index < 50) { - result = this.runRules(result.date); - if (this.isDatePastEnd(result.date)) return null; - index++; - } - - if (result instanceof InvalidDateTime) { - throw new RecurrenceRuleError(`Failed to find a matching occurrence in ${index} iterations. ` + `Last iterated date: "${result.date.toISOString()}"`); - } - - if (this.reverse ? start.isBefore(result.date) : start.isAfter(result.date)) { - throw new RecurrenceRuleError('An error occurred in a recurrence rule. If this happened using ' + 'the rSchedule provided recurrence rules, you should ' + 'open an issue in the rSchedule repo. The maintainer is going to ' + 'want to know how to recreate the error.'); - } - - return result.date; - } - /** - * Performs one run of the recurrence rules and returns the result. - * It's a slightly optimized reducer function. - */ - - - runRules(start) { - let result = new ValidDateTime(start); - - for (const rule of this.rules) { - if (result instanceof InvalidDateTime) { - return result; - } - - result = rule.run(result.date); - } - - return result; - } - - isDatePastEnd(date) { - return this.reverse ? date.isBefore(this.start) : this.end && date.isAfter(this.end); - } - - normalizeRunOutput(date) { - return this.hasDuration ? date.set('duration', this.options.duration) : date; - } - - normalizeDateTimeArgs(args) { - return { - start: args.start && normalizeDateTimeTimezone(args.start, this.options.start.timezone), - end: args.end && normalizeDateTimeTimezone(args.end, this.options.start.timezone) - }; - } - -} - - - -/***/ }), - -/***/ "./node_modules/@rschedule/core/es2015/rules.js": -/*!******************************************************!*\ - !*** ./node_modules/@rschedule/core/es2015/rules.js ***! - \******************************************************/ -/*! exports provided: ByDayOfMonthRule, ByDayOfMonthRuleModule, ByDayOfWeekRule, ByDayOfWeekRuleModule, ByHourOfDayRule, ByHourOfDayRuleModule, ByMillisecondOfSecondRule, ByMillisecondOfSecondRuleModule, ByMinuteOfHourRule, ByMinuteOfHourRuleModule, ByMonthOfYearRule, ByMonthOfYearRuleModule, BySecondOfMinuteRule, BySecondOfMinuteRuleModule, FrequencyRule, FrequencyRuleModule, ICAL_RULES, RevByDayOfMonthRule, RevByDayOfWeekRule, RevByHourOfDayRule, RevByMillisecondOfSecondRule, RevByMinuteOfHourRule, RevByMonthOfYearRule, RevBySecondOfMinuteRule, RevFrequencyRule, getPrevWeekdaysOfMonth, getPrevWeekdaysOfYear */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ByDayOfMonthRule", function() { return ByDayOfMonthRule; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ByDayOfMonthRuleModule", function() { return ByDayOfMonthRuleModule; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ByDayOfWeekRule", function() { return ByDayOfWeekRule; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ByDayOfWeekRuleModule", function() { return ByDayOfWeekRuleModule; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ByHourOfDayRule", function() { return ByHourOfDayRule; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ByHourOfDayRuleModule", function() { return ByHourOfDayRuleModule; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ByMillisecondOfSecondRule", function() { return ByMillisecondOfSecondRule; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ByMillisecondOfSecondRuleModule", function() { return ByMillisecondOfSecondRuleModule; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ByMinuteOfHourRule", function() { return ByMinuteOfHourRule; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ByMinuteOfHourRuleModule", function() { return ByMinuteOfHourRuleModule; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ByMonthOfYearRule", function() { return ByMonthOfYearRule; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ByMonthOfYearRuleModule", function() { return ByMonthOfYearRuleModule; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "BySecondOfMinuteRule", function() { return BySecondOfMinuteRule; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "BySecondOfMinuteRuleModule", function() { return BySecondOfMinuteRuleModule; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FrequencyRule", function() { return FrequencyRule; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FrequencyRuleModule", function() { return FrequencyRuleModule; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ICAL_RULES", function() { return ICAL_RULES; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RevByDayOfMonthRule", function() { return RevByDayOfMonthRule; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RevByDayOfWeekRule", function() { return RevByDayOfWeekRule; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RevByHourOfDayRule", function() { return RevByHourOfDayRule; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RevByMillisecondOfSecondRule", function() { return RevByMillisecondOfSecondRule; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RevByMinuteOfHourRule", function() { return RevByMinuteOfHourRule; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RevByMonthOfYearRule", function() { return RevByMonthOfYearRule; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RevBySecondOfMinuteRule", function() { return RevBySecondOfMinuteRule; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RevFrequencyRule", function() { return RevFrequencyRule; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getPrevWeekdaysOfMonth", function() { return getPrevWeekdaysOfMonth; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getPrevWeekdaysOfYear", function() { return getPrevWeekdaysOfYear; }); -/* harmony import */ var _rschedule_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @rschedule/core */ "./node_modules/@rschedule/core/es2015/main.js"); - - -class RecurrenceRule { - constructor(processor) { - this.processor = processor; - this.start = processor.start; - this.end = processor.end; - this.options = processor.options; - } - -} - -class FrequencyRule extends RecurrenceRule { - constructor(processor, initDate) { - super(processor); - this.initDate = initDate; - this.intervalUnit = Object(_rschedule_core__WEBPACK_IMPORTED_MODULE_0__["freqToGranularity"])(this.options.frequency); - this.firstIntervalStartDate = this.normalizedStartDate(this.options.start); - this.intervalStartDate = this.firstIntervalStartDate; - this.intervalEndDate = this.normalizedEndDate(this.firstIntervalStartDate); - this.skipToInterval(this.initDate); - } - - run(date) { - return this.validateDate(new _rschedule_core__WEBPACK_IMPORTED_MODULE_0__["ValidDateTime"](date)); - } - - validateDate(arg) { - const date = arg.date; - - if (arg instanceof _rschedule_core__WEBPACK_IMPORTED_MODULE_0__["ValidDateTime"] && this.dateIsWithinInterval(date)) { - return arg; - } - - this.skipToInterval(date); - return new _rschedule_core__WEBPACK_IMPORTED_MODULE_0__["InvalidDateTime"]( // if the interval is 1, date will always be within the interval - this.dateIsWithinInterval(date) ? date : this.setToCurrentInterval()); - } - - setToCurrentInterval() { - return this.intervalStartDate; - } - - normalizedStartDate(date) { - if (this.options.frequency === 'WEEKLY') { - return date.granularity('week', { - weekStart: this.options.weekStart - }); - } - - return date.granularity(this.intervalUnit); - } - - normalizedEndDate(start) { - switch (this.options.frequency) { - case 'YEARLY': - return start.add(1, 'year'); - - case 'MONTHLY': - return start.add(1, 'month'); - - case 'WEEKLY': - return start.add(1, 'week'); - - case 'DAILY': - return start.add(1, 'day'); - - case 'HOURLY': - return start.add(1, 'hour'); - - case 'MINUTELY': - return start.add(1, 'minute'); - - case 'SECONDLY': - return start.add(1, 'second'); - - case 'MILLISECONDLY': - return start.add(1, 'millisecond'); - - default: - throw new Error(`Unknown frequency ${this.options.frequency}`); - } - } - - skipToInterval(date) { - const amount = this.intervalDifference(date); - this.intervalStartDate = this.firstIntervalStartDate.add(amount, this.intervalUnit); - this.intervalEndDate = this.normalizedEndDate(this.intervalStartDate); - } - - dateIsWithinInterval(date) { - return this.intervalStartDate.isBeforeOrEqual(date) && this.intervalEndDate.isAfter(date); - } - - intervalDifference(date) { - return intervalDifferenceBetweenDates({ - first: this.firstIntervalStartDate, - second: date, - unit: this.intervalUnit, - interval: this.options.interval, - weekStart: this.options.weekStart, - direction: 'after' - }); - } - -} -/** - * Given the frequency (unit) and interval, this function finds - * how many jumps forward the first date needs in order to equal - * or exceed the second date. - * - * For example: - * - * 1. Unit is daily and interval is 1. The second date is 3 days - * after the first. This will return 3. - * 2. Unit is yearly and interval is 1. The second date is 3 days - * after the first. This will return 0. - * 3. Unit is yearly and interval is 3. The second date is 4 years - * after the first. This will return 6. - */ - - -function intervalDifferenceBetweenDates({ - first, - second, - unit, - interval, - weekStart, - direction -}) { - let difference = (() => { - let intervalDuration; - let months; - - switch (unit) { - case 'year': - months = (second.get('year') - first.get('year')) * 12; - months = months + second.get('month') - first.get('month'); - return Math.floor(months / 12); - - case 'month': - months = (second.get('year') - first.get('year')) * 12; - months = months + second.get('month') - first.get('month'); - return months; - - case 'week': - first = first.granularity('week', { - weekStart - }); - intervalDuration = _rschedule_core__WEBPACK_IMPORTED_MODULE_0__["DateAdapter"].MILLISECONDS_IN_WEEK; - break; - - case 'day': - intervalDuration = _rschedule_core__WEBPACK_IMPORTED_MODULE_0__["DateAdapter"].MILLISECONDS_IN_DAY; - break; - - case 'hour': - intervalDuration = _rschedule_core__WEBPACK_IMPORTED_MODULE_0__["DateAdapter"].MILLISECONDS_IN_HOUR; - break; - - case 'minute': - intervalDuration = _rschedule_core__WEBPACK_IMPORTED_MODULE_0__["DateAdapter"].MILLISECONDS_IN_MINUTE; - break; - - case 'second': - intervalDuration = _rschedule_core__WEBPACK_IMPORTED_MODULE_0__["DateAdapter"].MILLISECONDS_IN_SECOND; - break; - - case 'millisecond': - intervalDuration = 1; - break; - - default: - throw new Error('Unexpected `unit` value'); - } - - const diff = second.valueOf() - first.valueOf(); - return Math.floor(diff / intervalDuration); - })(); - - const fn = direction === 'after' ? Math.ceil : Math.floor; - difference = fn(difference / interval) * interval; - return difference; -} - -class RevFrequencyRule extends FrequencyRule { - setToCurrentInterval() { - return this.intervalEndDate.subtract(1, 'millisecond'); - } - - intervalDifference(date) { - return intervalDifferenceBetweenDates({ - first: this.firstIntervalStartDate, - second: date, - unit: this.intervalUnit, - interval: this.options.interval, - weekStart: this.options.weekStart, - direction: 'before' - }); - } - -} - -const FREQUENCIES = ['MILLISECONDLY', 'SECONDLY', 'MINUTELY', 'HOURLY', 'DAILY', 'WEEKLY', 'MONTHLY', 'YEARLY']; -const FrequencyRuleModule = { - name: 'FrequencyRule', - get: processor => { - if (processor.options.byMillisecondOfSecond !== undefined || processor.options.frequency !== 'MILLISECONDLY') { - return null; - } - - if (processor.reverse) return new RevFrequencyRule(processor, processor.end); - return new FrequencyRule(processor, processor.start); - }, - normalizeOptions: (options, norm) => { - if (!FREQUENCIES.includes(options.frequency)) { - throw new _rschedule_core__WEBPACK_IMPORTED_MODULE_0__["RuleOptionError"](`"frequency" must be one of ${JSON.stringify(FREQUENCIES)}`); - } - - if (options.interval !== undefined) { - if (!Number.isInteger(options.interval)) { - throw new _rschedule_core__WEBPACK_IMPORTED_MODULE_0__["RuleOptionError"]('"interval" expects a whole number'); - } - - if (options.interval < 1) { - throw new _rschedule_core__WEBPACK_IMPORTED_MODULE_0__["RuleOptionError"]('"interval" cannot be less than 1'); - } - } - - if (options.weekStart !== undefined) { - if (!_rschedule_core__WEBPACK_IMPORTED_MODULE_0__["DateAdapter"].WEEKDAYS.includes(options.weekStart)) { - throw new _rschedule_core__WEBPACK_IMPORTED_MODULE_0__["RuleOptionError"](`"weekStart" must be one of ${JSON.stringify(_rschedule_core__WEBPACK_IMPORTED_MODULE_0__["DateAdapter"].WEEKDAYS)}`); - } - } - - norm.frequency = options.frequency; - norm.interval = options.interval || 1; - norm.weekStart = options.weekStart || 'MO'; - }, - deps: () => [FrequencyRuleModule] -}; - -function ruleOptionFilled(option) { - return Array.isArray(option) && option.length > 0; -} - -const freqCache = new WeakMap(); - -class RecurrenceRuleBase extends RecurrenceRule { - constructor(processor) { - super(processor); - - if (!freqCache.has(this.processor)) { - freqCache.set(this.processor, new FrequencyRule(processor, processor.start)); - } - - this.frequency = freqCache.get(this.processor); - } - - validateDate(arg) { - return this.frequency.validateDate(arg); - } - -} - -class RevRecurrenceRuleBase extends RecurrenceRule { - constructor(processor) { - super(processor); - - if (!freqCache.has(this.processor)) { - freqCache.set(this.processor, new RevFrequencyRule(processor, processor.end)); - } - - this.frequency = freqCache.get(this.processor); - } - - validateDate(arg) { - return this.frequency.validateDate(arg); - } - -} -/** - * Contains shared logic for ByHourOfDay, ByMinuteOfHour, - * BySecondOfMinute, and ByMillisecondOfSecond reverse rule pipes - */ - - -class RevByTimeOfUnitRule extends RevRecurrenceRuleBase { - run(date) { - // e.g. const currentTime = date.get('hour'); - const currentTime = date.get(this.granularity); // e.g. for (const time of this.options.byHourOfDay) { - - for (const time of this.option) { - if (currentTime < time) continue; - - if (currentTime === time) { - return this.validateDate(new _rschedule_core__WEBPACK_IMPORTED_MODULE_0__["ValidDateTime"](date)); - } // e.g. return this.nextValidDate(args, date.endGranularity('day').set('hour', time)); - - - return this.validateDate(new _rschedule_core__WEBPACK_IMPORTED_MODULE_0__["InvalidDateTime"](date.endGranularity(this.baseGranularity).set(this.granularity, time))); - } - - return this.validateDate(new _rschedule_core__WEBPACK_IMPORTED_MODULE_0__["InvalidDateTime"](date // e.g. .endGranularity('day') - .endGranularity(this.baseGranularity) // e.g. .subtract(1, 'day') - .subtract(1, this.baseGranularity) // e.g. .set('hour', this.options.byHourOfDay[0]); - .set(this.granularity, this.option[0]))); - } - -} - -class RevByMillisecondOfSecondRule extends RevByTimeOfUnitRule { - constructor() { - super(...arguments); - this.baseGranularity = 'second'; - this.granularity = 'millisecond'; - this.option = this.options.byMillisecondOfSecond.slice().reverse(); - } - -} -/** - * Contains shared logic for ByHourOfDay, ByMinuteOfHour, - * BySecondOfMinute, and ByMillisecondOfSecond rule pipes - */ - - -class ByTimeOfUnitRule extends RecurrenceRuleBase { - run(date) { - // e.g. const currentTime = date.get('hour'); - const currentTime = date.get(this.granularity); // e.g. for (const time of this.options.byHourOfDay) { - - for (const time of this.option) { - if (currentTime > time) continue; - - if (currentTime === time) { - return this.validateDate(new _rschedule_core__WEBPACK_IMPORTED_MODULE_0__["ValidDateTime"](date)); - } // e.g. return this.nextValidDate(args, date.granularity('day').set('hour', time)); - - - return this.validateDate(new _rschedule_core__WEBPACK_IMPORTED_MODULE_0__["InvalidDateTime"](date.granularity(this.baseGranularity).set(this.granularity, time))); - } - - return this.validateDate(new _rschedule_core__WEBPACK_IMPORTED_MODULE_0__["InvalidDateTime"](date // e.g. .granularity('day') - .granularity(this.baseGranularity) // e.g. .add(1, 'day') - .add(1, this.baseGranularity) // e.g. .set('hour', this.options.byHourOfDay[0]); - .set(this.granularity, this.option[0]))); - } - -} - -class ByMillisecondOfSecondRule extends ByTimeOfUnitRule { - constructor() { - super(...arguments); - this.baseGranularity = 'second'; - this.granularity = 'millisecond'; - this.option = this.options.byMillisecondOfSecond; - } - -} - -const ByMillisecondOfSecondRuleModule = { - name: 'ByMillisecondOfSecond', - get: processor => { - if (processor.options.byMillisecondOfSecond === undefined) return null; - if (processor.reverse) return new RevByMillisecondOfSecondRule(processor); - return new ByMillisecondOfSecondRule(processor); - }, - normalizeOptions: (options, norm) => { - if (options.byMillisecondOfSecond !== undefined) { - if (!ruleOptionFilled(options.byMillisecondOfSecond)) { - throw new _rschedule_core__WEBPACK_IMPORTED_MODULE_0__["RuleOptionError"]('"byMillisecondOfSecond" expects a non-empty array'); - } - - if (options.byMillisecondOfSecond.some(num => num < 0 || num > 999)) { - throw new _rschedule_core__WEBPACK_IMPORTED_MODULE_0__["RuleOptionError"]('"byMillisecondOfSecond" values must be >= 0 && <= 999'); - } - - norm.byMillisecondOfSecond = options.byMillisecondOfSecond; - norm.byMillisecondOfSecond.sort(_rschedule_core__WEBPACK_IMPORTED_MODULE_0__["numberSortComparer"]); - } else if (options.frequency !== 'MILLISECONDLY') { - norm.byMillisecondOfSecond = [norm.start.get('millisecond')]; - } - }, - deps: () => [FrequencyRuleModule, ByMillisecondOfSecondRuleModule] -}; - -class RevBySecondOfMinuteRule extends RevByTimeOfUnitRule { - constructor() { - super(...arguments); - this.baseGranularity = 'minute'; - this.granularity = 'second'; - this.option = this.options.bySecondOfMinute.slice().reverse(); - } - -} - -class BySecondOfMinuteRule extends ByTimeOfUnitRule { - constructor() { - super(...arguments); - this.baseGranularity = 'minute'; - this.granularity = 'second'; - this.option = this.options.bySecondOfMinute; - } - -} - -const BySecondOfMinuteRuleModule = { - name: 'BySecondOfMinute', - get: processor => { - if (processor.options.bySecondOfMinute === undefined) return null; - if (processor.reverse) return new RevBySecondOfMinuteRule(processor); - return new BySecondOfMinuteRule(processor); - }, - normalizeOptions: (options, norm) => { - if (options.bySecondOfMinute !== undefined) { - if (!ruleOptionFilled(options.bySecondOfMinute)) { - throw new _rschedule_core__WEBPACK_IMPORTED_MODULE_0__["RuleOptionError"]('"bySecondOfMinute" expects a non-empty array'); - } - - if (options.bySecondOfMinute.some(num => num < 0 || num > 60)) { - throw new _rschedule_core__WEBPACK_IMPORTED_MODULE_0__["RuleOptionError"]('"bySecondOfMinute" values must be >= 0 && <= 60'); - } - - norm.bySecondOfMinute = options.bySecondOfMinute; - norm.bySecondOfMinute.sort(_rschedule_core__WEBPACK_IMPORTED_MODULE_0__["numberSortComparer"]); - } else if (!['SECONDLY', 'MILLISECONDLY'].includes(options.frequency)) { - norm.bySecondOfMinute = [norm.start.get('second')]; - } - }, - deps: () => [FrequencyRuleModule, BySecondOfMinuteRuleModule, ByMillisecondOfSecondRuleModule] -}; - -class RevByMinuteOfHourRule extends RevByTimeOfUnitRule { - constructor() { - super(...arguments); - this.baseGranularity = 'hour'; - this.granularity = 'minute'; - this.option = this.options.byMinuteOfHour.slice().reverse(); - } - -} - -class ByMinuteOfHourRule extends ByTimeOfUnitRule { - constructor() { - super(...arguments); - this.baseGranularity = 'hour'; - this.granularity = 'minute'; - this.option = this.options.byMinuteOfHour; - } - -} - -const ByMinuteOfHourRuleModule = { - name: 'ByMinuteOfHour', - get: processor => { - if (processor.options.byMinuteOfHour === undefined) return null; - if (processor.reverse) return new RevByMinuteOfHourRule(processor); - return new ByMinuteOfHourRule(processor); - }, - normalizeOptions: (options, norm) => { - if (options.byMinuteOfHour !== undefined) { - if (!ruleOptionFilled(options.byMinuteOfHour)) { - throw new _rschedule_core__WEBPACK_IMPORTED_MODULE_0__["RuleOptionError"]('"byMinuteOfHour" expects a non-empty array'); - } - - if (options.byMinuteOfHour.some(num => num < 0 || num > 59)) { - throw new _rschedule_core__WEBPACK_IMPORTED_MODULE_0__["RuleOptionError"]('"byMinuteOfHour" values must be >= 0 && <= 59'); - } - - norm.byMinuteOfHour = options.byMinuteOfHour; - norm.byMinuteOfHour.sort(_rschedule_core__WEBPACK_IMPORTED_MODULE_0__["numberSortComparer"]); - } else if (!['MINUTELY', 'SECONDLY', 'MILLISECONDLY'].includes(options.frequency)) { - norm.byMinuteOfHour = [norm.start.get('minute')]; - } - }, - deps: () => [FrequencyRuleModule, ByMinuteOfHourRuleModule, BySecondOfMinuteRuleModule, ByMillisecondOfSecondRuleModule] -}; - -class RevByHourOfDayRule extends RevByTimeOfUnitRule { - constructor() { - super(...arguments); - this.baseGranularity = 'day'; - this.granularity = 'hour'; - this.option = this.options.byHourOfDay.slice().reverse(); - } - -} - -class ByHourOfDayRule extends ByTimeOfUnitRule { - constructor() { - super(...arguments); - this.baseGranularity = 'day'; - this.granularity = 'hour'; - this.option = this.options.byHourOfDay; - } - -} - -const ByHourOfDayRuleModule = { - name: 'ByHourOfDay', - get: processor => { - if (processor.options.byHourOfDay === undefined) return null; - if (processor.reverse) return new RevByHourOfDayRule(processor); - return new ByHourOfDayRule(processor); - }, - normalizeOptions: (options, norm) => { - if (options.byHourOfDay !== undefined) { - if (!ruleOptionFilled(options.byHourOfDay)) { - throw new _rschedule_core__WEBPACK_IMPORTED_MODULE_0__["RuleOptionError"]('"byHourOfDay" expects a non-empty array'); - } - - if (options.byHourOfDay.some(num => num < 0 || num > 23)) { - throw new _rschedule_core__WEBPACK_IMPORTED_MODULE_0__["RuleOptionError"]('"byHourOfDay" values must be >= 0 && <= 23'); - } - - norm.byHourOfDay = options.byHourOfDay; - norm.byHourOfDay.sort(_rschedule_core__WEBPACK_IMPORTED_MODULE_0__["numberSortComparer"]); - } else if (['YEARLY', 'MONTHLY', 'WEEKLY', 'DAILY'].includes(options.frequency)) { - norm.byHourOfDay = [norm.start.get('hour')]; - } - }, - deps: () => [FrequencyRuleModule, ByHourOfDayRuleModule, ByMinuteOfHourRuleModule, BySecondOfMinuteRuleModule, ByMillisecondOfSecondRuleModule] -}; - -function getNextWeekday(date, weekday) { - return date.add(Object(_rschedule_core__WEBPACK_IMPORTED_MODULE_0__["getDifferenceBetweenWeekdays"])(date.get('weekday'), weekday), 'day'); -} - -function getNthWeekdayOfMonth(date, weekday, nth) { - let base = date.set('day', 1); - - if (nth < 0) { - base = base.add(1, 'month'); - } - - base = getNextWeekday(base, weekday); // when nth is negative, adding it will act as subtraction - - return nth < 0 ? base.add(nth, 'week') : base.add(nth - 1, 'week'); -} - -class ByDayOfMonthRule extends RecurrenceRuleBase { - run(date) { - const normalizedByDayOfMonth = normalizeByDayOfMonth(date, this.options.byDayOfMonth, this.options.byDayOfWeek); - const currentDay = date.get('day'); - - for (const day of normalizedByDayOfMonth) { - if (currentDay > day) continue; - - if (currentDay === day) { - return this.validateDate(new _rschedule_core__WEBPACK_IMPORTED_MODULE_0__["ValidDateTime"](date)); - } - - return this.validateDate(new _rschedule_core__WEBPACK_IMPORTED_MODULE_0__["InvalidDateTime"](date.granularity('month').set('day', day))); - } - - let next; - let nextMonth = date; - let index = 0; - - while (!next && index < 30) { - nextMonth = nextMonth.granularity('month').add(1, 'month'); - next = normalizeByDayOfMonth(nextMonth, this.options.byDayOfMonth, this.options.byDayOfWeek)[0]; - index++; - } - - if (index >= 13) { - throw new _rschedule_core__WEBPACK_IMPORTED_MODULE_0__["RecurrenceRuleError"]('byDayOfMonth Infinite while loop'); - } - - return this.validateDate(new _rschedule_core__WEBPACK_IMPORTED_MODULE_0__["InvalidDateTime"](nextMonth.set('day', next))); - } - -} -/** - * Does a few things: - * - * 1. filters out byDayOfMonth entries which are not applicable - * to current month - * 2. negative entries to positive ones - * 3. if a byDayOfWeek option is given, removes days which are - * not on the correct day of the week - */ - - -function normalizeByDayOfMonth(date, byDayOfMonth, byDayOfWeek) { - const lengthOfMonth = date.endGranularity('month').get('day'); - let normalizedByDayOfMonth = byDayOfMonth.filter(day => lengthOfMonth >= Math.abs(day)).map(day => day > 0 ? day : lengthOfMonth + day + 1); - - if (byDayOfWeek) { - const base = date.granularity('month'); - const filteredByDayOfMonth = []; - byDayOfWeek.forEach(entry => { - if (typeof entry === 'string') { - filteredByDayOfMonth.push(...normalizedByDayOfMonth.filter(day => base.set('day', day).get('weekday') === entry)); - return; - } - - const nthWeekdayOfMonth = getNthWeekdayOfMonth(date, ...entry).get('day'); - - if (normalizedByDayOfMonth.includes(nthWeekdayOfMonth)) { - filteredByDayOfMonth.push(nthWeekdayOfMonth); - } - }); - normalizedByDayOfMonth = Array.from(new Set(filteredByDayOfMonth)); - } - - return normalizedByDayOfMonth.sort((a, b) => { - if (a > b) return 1; - if (a < b) return -1;else return 0; - }); -} - -class RevByDayOfMonthRule extends RevRecurrenceRuleBase { - run(date) { - const normalizedByDayOfMonth = normalizeByDayOfMonth(date, this.options.byDayOfMonth, this.options.byDayOfWeek).reverse(); - const currentDay = date.get('day'); - - for (const day of normalizedByDayOfMonth) { - if (currentDay < day) continue; - - if (currentDay === day) { - return this.validateDate(new _rschedule_core__WEBPACK_IMPORTED_MODULE_0__["ValidDateTime"](date)); - } - - return this.validateDate(new _rschedule_core__WEBPACK_IMPORTED_MODULE_0__["InvalidDateTime"](date.endGranularity('month').set('day', day))); - } - - let next; - let nextMonth = date; - let index = 0; - - while (!next && index < 30) { - nextMonth = nextMonth.endGranularity('month').subtract(1, 'month'); - next = normalizeByDayOfMonth(nextMonth, this.options.byDayOfMonth, this.options.byDayOfWeek).pop(); - index++; - } - - if (index >= 13) { - throw new _rschedule_core__WEBPACK_IMPORTED_MODULE_0__["RecurrenceRuleError"]('byDayOfMonth Infinite while loop'); - } - - return this.validateDate(new _rschedule_core__WEBPACK_IMPORTED_MODULE_0__["InvalidDateTime"](nextMonth.set('day', next))); - } - -} - -const ByDayOfMonthRuleModule = { - name: 'ByDayOfMonth', - get: processor => { - if (processor.options.byDayOfMonth === undefined) return null; - if (processor.reverse) return new RevByDayOfMonthRule(processor); - return new ByDayOfMonthRule(processor); - }, - normalizeOptions: (options, norm) => { - if (options.byDayOfMonth !== undefined) { - if (options.frequency === 'WEEKLY') { - throw new _rschedule_core__WEBPACK_IMPORTED_MODULE_0__["RuleOptionError"]('when "frequency" is "WEEKLY", "byDayOfMonth" cannot be present'); - } - - if (!ruleOptionFilled(options.byDayOfMonth)) { - throw new _rschedule_core__WEBPACK_IMPORTED_MODULE_0__["RuleOptionError"]('"byDayOfMonth" expects a non-empty array'); - } - - if (options.byDayOfMonth.some(num => num === 0 || num < -31 || num > 31)) { - throw new _rschedule_core__WEBPACK_IMPORTED_MODULE_0__["RuleOptionError"]('"byDayOfMonth" values must be `num !== 0 && num <= 31 && num >= -31`'); - } - - norm.byDayOfMonth = options.byDayOfMonth.slice(); - } else if (!(ruleOptionFilled(options.byDayOfWeek) || ruleOptionFilled(options.byDayOfYear)) && ['YEARLY', 'MONTHLY'].includes(options.frequency)) { - norm.byDayOfMonth = [norm.start.get('day')]; - } - }, - deps: () => [FrequencyRuleModule, ByDayOfMonthRuleModule, ByHourOfDayRuleModule, ByMinuteOfHourRuleModule, BySecondOfMinuteRuleModule, ByMillisecondOfSecondRuleModule] -}; - -function getNthWeekdayOfYear(date, weekday, nth) { - let base = date.set('month', 1).set('day', 1); - - if (nth < 0) { - base = base.add(1, 'year'); - } - - base = getNextWeekday(base, weekday); // when nth is negative, adding it will act as subtraction - - return nth < 0 ? base.add(nth, 'week') : base.add(nth - 1, 'week'); -} - -function getPreviousWeekday(date, weekday) { - const diff = Object(_rschedule_core__WEBPACK_IMPORTED_MODULE_0__["getDifferenceBetweenWeekdays"])(date.get('weekday'), weekday); - return date.subtract(diff === 0 ? 0 : 7 - diff, 'day'); -} - -class RevByDayOfWeekRule extends RevRecurrenceRuleBase { - run(date) { - if (this.options.frequency === 'YEARLY') { - return this.options.byMonthOfYear === undefined ? this.expandYearly(date) : this.expandMonthly(date); - } else if (this.options.frequency === 'MONTHLY') { - return this.expandMonthly(date); - } - - return this.expand(date); - } - - expandYearly(date) { - let next = getPrevWeekdaysOfYear(date, this.options.byDayOfWeek)[0]; - let index = 0; - let base = date; // If we can't find a valid date this year, - // search the previous year. Only search the past 28 years. - // (the calendar repeats on a 28 year cycle, according - // to the internet). - - while (!next && index < 28) { - index++; - base = base.granularity('year').subtract(1, 'millisecond'); - next = getPrevWeekdaysOfYear(base, this.options.byDayOfWeek)[0]; - } - - if (!next) { - throw new _rschedule_core__WEBPACK_IMPORTED_MODULE_0__["RecurrenceRuleError"]('The byDayOfWeek rule appears to contain an impossible combination'); - } - - return this.result(date, next); - } - - expandMonthly(date) { - let next = getPrevWeekdaysOfMonth(date, this.options.byDayOfWeek)[0]; - let index = 0; - let base = date; // TODO: performance improvment - // If, in the first year, a match isn't found, we should be able to - // jumpt to the previous leap year and check that. Or, if already on - // a leap year, we can just error immediately. - // If we can't find a valid date this month, - // search the previous month. Only search the past 4 years - // (to account for leap year). - - while (!next && index < 50) { - index++; - base = base.granularity('month').subtract(1, 'millisecond'); - next = getPrevWeekdaysOfMonth(base, this.options.byDayOfWeek)[0]; - } - - if (!next) { - throw new _rschedule_core__WEBPACK_IMPORTED_MODULE_0__["RecurrenceRuleError"]('The byDayOfWeek rule appears to contain an impossible combination'); - } - - return this.result(date, next); - } - - expand(date) { - const next = this.options.byDayOfWeek.map(weekday => getPreviousWeekday(date, weekday)).sort(_rschedule_core__WEBPACK_IMPORTED_MODULE_0__["dateTimeSortComparer"]).pop(); - return this.result(date, next); - } - - result(date, next) { - if (next.isEqual(date)) { - return this.validateDate(new _rschedule_core__WEBPACK_IMPORTED_MODULE_0__["ValidDateTime"](date)); - } - - return this.validateDate(new _rschedule_core__WEBPACK_IMPORTED_MODULE_0__["InvalidDateTime"](next.endGranularity('day'))); - } - -} -/** For each byDayOfWeek entry, find the previous DateTime */ - - -function getPrevWeekdaysOfYear(date, byDayOfWeek) { - const normalizedNthWeekdaysOfYear = byDayOfWeek.filter(entry => Array.isArray(entry)).map(entry => getNthWeekdayOfYear(date, ...entry)); - const normalizedNextWeekdays = byDayOfWeek.filter(entry => typeof entry === 'string').map(weekday => getPreviousWeekday(date, weekday)).filter(entry => entry.get('year') === date.get('year')); - return Object(_rschedule_core__WEBPACK_IMPORTED_MODULE_0__["uniqDateTimes"])([...normalizedNthWeekdaysOfYear, ...normalizedNextWeekdays]).filter(entry => entry.isBeforeOrEqual(date)).sort(_rschedule_core__WEBPACK_IMPORTED_MODULE_0__["dateTimeSortComparer"]).reverse(); -} -/** For each byDayOfWeek entry, find the previous DateTime */ - - -function getPrevWeekdaysOfMonth(date, byDayOfWeek) { - const normalizedNthWeekdaysOfMonth = byDayOfWeek.filter(entry => Array.isArray(entry)).map(entry => getNthWeekdayOfMonth(date, ...entry)); - const normalizedNextWeekdays = byDayOfWeek.filter(entry => typeof entry === 'string').map(weekday => getPreviousWeekday(date, weekday)).filter(entry => entry.get('year') === date.get('year') && entry.get('month') === date.get('month')); - return Object(_rschedule_core__WEBPACK_IMPORTED_MODULE_0__["uniqDateTimes"])([...normalizedNthWeekdaysOfMonth, ...normalizedNextWeekdays]).filter(entry => entry.isBeforeOrEqual(date)).sort(_rschedule_core__WEBPACK_IMPORTED_MODULE_0__["dateTimeSortComparer"]).reverse(); -} - -class ByDayOfWeekRule extends RecurrenceRuleBase { - run(date) { - if (this.options.frequency === 'YEARLY') { - return this.options.byMonthOfYear === undefined ? this.expandYearly(date) : this.expandMonthly(date); - } else if (this.options.frequency === 'MONTHLY') { - return this.expandMonthly(date); - } - - return this.expand(date); - } - - expandYearly(date) { - let next = getNextWeekdaysOfYear(date, this.options.byDayOfWeek)[0]; - let index = 0; - let base = date; // If we can't find a valid date this year, - // search next year. Only search the next 28 years. - // (the calendar repeats on a 28 year cycle, according - // to the internet). - - while (!next && index < 28) { - index++; - base = base.granularity('year').add(1, 'year'); - next = getNextWeekdaysOfYear(base, this.options.byDayOfWeek)[0]; - } - - if (!next) { - throw new _rschedule_core__WEBPACK_IMPORTED_MODULE_0__["RecurrenceRuleError"]('The byDayOfWeek rule appears to contain an impossible combination'); - } - - return this.result(date, next); - } - - expandMonthly(date) { - let next = getNextWeekdaysOfMonth(date, this.options.byDayOfWeek)[0]; - let index = 0; - let base = date; // TODO: performance improvment - // If, in the first year, a match isn't found, we should be able to - // jumpt to the next leap year and check that. Or, if already on - // a leap year, we can just error immediately. - // If we can't find a valid date this month, - // search the next month. Only search the next 4 years - // (to account for leap year). - - while (!next && index < 50) { - index++; - base = base.granularity('month').add(1, 'month'); - next = getNextWeekdaysOfMonth(base, this.options.byDayOfWeek)[0]; - } - - if (!next) { - throw new _rschedule_core__WEBPACK_IMPORTED_MODULE_0__["RecurrenceRuleError"]('The byDayOfWeek rule appears to contain an impossible combination'); - } - - return this.result(date, next); - } - - expand(date) { - const next = this.options.byDayOfWeek.map(weekday => getNextWeekday(date, weekday)).sort(_rschedule_core__WEBPACK_IMPORTED_MODULE_0__["dateTimeSortComparer"])[0]; - return this.result(date, next); - } - - result(date, next) { - if (next.isEqual(date)) { - return this.validateDate(new _rschedule_core__WEBPACK_IMPORTED_MODULE_0__["ValidDateTime"](date)); - } - - return this.validateDate(new _rschedule_core__WEBPACK_IMPORTED_MODULE_0__["InvalidDateTime"](next.granularity('day'))); - } - -} -/** For each byDayOfWeek entry, find the next DateTime */ - - -function getNextWeekdaysOfYear(date, byDayOfWeek) { - const normalizedNthWeekdaysOfYear = byDayOfWeek.filter(entry => Array.isArray(entry)).map(entry => getNthWeekdayOfYear(date, ...entry)); - const normalizedNextWeekdays = byDayOfWeek.filter(entry => typeof entry === 'string').map(weekday => getNextWeekday(date, weekday)).filter(entry => entry.get('year') === date.get('year')); - return Object(_rschedule_core__WEBPACK_IMPORTED_MODULE_0__["uniqDateTimes"])([...normalizedNthWeekdaysOfYear, ...normalizedNextWeekdays]).filter(entry => entry.isAfterOrEqual(date)).sort(_rschedule_core__WEBPACK_IMPORTED_MODULE_0__["dateTimeSortComparer"]); -} -/** For each byDayOfWeek entry, find the next DateTime */ - - -function getNextWeekdaysOfMonth(date, byDayOfWeek) { - const normalizedNthWeekdaysOfMonth = byDayOfWeek.filter(entry => Array.isArray(entry)).map(entry => getNthWeekdayOfMonth(date, ...entry)); - const normalizedNextWeekdays = byDayOfWeek.filter(entry => typeof entry === 'string').map(weekday => getNextWeekday(date, weekday)).filter(entry => entry.get('year') === date.get('year') && entry.get('month') === date.get('month')); - return Object(_rschedule_core__WEBPACK_IMPORTED_MODULE_0__["uniqDateTimes"])([...normalizedNthWeekdaysOfMonth, ...normalizedNextWeekdays]).filter(entry => entry.isAfterOrEqual(date)).sort(_rschedule_core__WEBPACK_IMPORTED_MODULE_0__["dateTimeSortComparer"]); -} - -const ByDayOfWeekRuleModule = { - name: 'ByDayOfWeek', - get: processor => { - if (processor.options.byDayOfWeek === undefined) return null; - if (processor.reverse) return new RevByDayOfWeekRule(processor); - return new ByDayOfWeekRule(processor); - }, - normalizeOptions: (options, norm) => { - if (options.byDayOfWeek !== undefined) { - if (!ruleOptionFilled(options.byDayOfWeek)) { - throw new _rschedule_core__WEBPACK_IMPORTED_MODULE_0__["RuleOptionError"]('"byDayOfWeek" expects a non-empty array'); - } - - const invalidWeeday = options.byDayOfWeek.find(day => Array.isArray(day) ? !_rschedule_core__WEBPACK_IMPORTED_MODULE_0__["DateAdapter"].WEEKDAYS.includes(day[0]) : !_rschedule_core__WEBPACK_IMPORTED_MODULE_0__["DateAdapter"].WEEKDAYS.includes(day)); - - if (invalidWeeday) { - throw new _rschedule_core__WEBPACK_IMPORTED_MODULE_0__["RuleOptionError"](`"byDayOfWeek" expects weedays in the form ` + `${JSON.stringify(_rschedule_core__WEBPACK_IMPORTED_MODULE_0__["DateAdapter"].WEEKDAYS)} but "${invalidWeeday}" was provided`); - } - - if (!['YEARLY', 'MONTHLY'].includes(options.frequency) && options.byDayOfWeek.some(weekday => Array.isArray(weekday))) { - throw new _rschedule_core__WEBPACK_IMPORTED_MODULE_0__["RuleOptionError"]('"byDayOfWeek" can only include a numeric value (i.e. `[string, number]`) when the "frequency" is ' + 'either "MONTHLY" or "YEARLY"'); - } - - if (options.frequency === 'MONTHLY' && options.byDayOfWeek.some(weekday => Array.isArray(weekday) && (weekday[1] < -31 || weekday[1] === 0 || weekday[1] > 31))) { - throw new _rschedule_core__WEBPACK_IMPORTED_MODULE_0__["RuleOptionError"]('when "frequency" is "MONTHLY", each "byDayOfWeek" can optionally only' + ' have a numeric value >= -31 and <= 31 and !== 0'); - } - - if (options.frequency === 'YEARLY' && options.byDayOfWeek.some(weekday => Array.isArray(weekday) && (weekday[1] < -366 || weekday[1] === 0 || weekday[1] > 366))) { - throw new _rschedule_core__WEBPACK_IMPORTED_MODULE_0__["RuleOptionError"]('when "frequency" is "YEARLY", each "byDayOfWeek" can optionally only' + ' have a numeric value >= -366 and <= 366 and !== 0'); - } - - norm.byDayOfWeek = options.byDayOfWeek; - } else if (!ruleOptionFilled(options.byDayOfMonth) && options.frequency === 'WEEKLY') { - norm.byDayOfWeek = [norm.start.get('weekday')]; - } - }, - deps: () => [FrequencyRuleModule, ByDayOfWeekRuleModule, ByHourOfDayRuleModule, ByMinuteOfHourRuleModule, BySecondOfMinuteRuleModule, ByMillisecondOfSecondRuleModule] -}; - -class RevByMonthOfYearRule extends RevRecurrenceRuleBase { - constructor() { - super(...arguments); - this.option = this.processor.options.byMonthOfYear.slice().reverse(); - } - - run(date) { - const currentMonth = date.get('month'); - - for (const month of this.option) { - if (currentMonth < month) continue; - - if (currentMonth === month) { - return this.validateDate(new _rschedule_core__WEBPACK_IMPORTED_MODULE_0__["ValidDateTime"](date)); - } - - return this.validateDate(new _rschedule_core__WEBPACK_IMPORTED_MODULE_0__["InvalidDateTime"](date.endGranularity('year').set('month', month))); - } - - return this.validateDate(new _rschedule_core__WEBPACK_IMPORTED_MODULE_0__["InvalidDateTime"](date.endGranularity('year').subtract(1, 'year').set('month', this.option[0]))); - } - -} - -class ByMonthOfYearRule extends RecurrenceRuleBase { - run(date) { - const currentMonth = date.get('month'); - - for (const month of this.options.byMonthOfYear) { - if (currentMonth > month) continue; - - if (currentMonth === month) { - return this.validateDate(new _rschedule_core__WEBPACK_IMPORTED_MODULE_0__["ValidDateTime"](date)); - } - - return this.validateDate(new _rschedule_core__WEBPACK_IMPORTED_MODULE_0__["InvalidDateTime"](date.granularity('year').set('month', month))); - } - - return this.validateDate(new _rschedule_core__WEBPACK_IMPORTED_MODULE_0__["InvalidDateTime"](date.granularity('year').add(1, 'year').set('month', this.options.byMonthOfYear[0]))); - } - -} - -const ByMonthOfYearRuleModule = { - name: 'ByMonthOfYear', - get: processor => { - if (processor.options.byMonthOfYear === undefined) return null; - - if (processor.reverse) { - return new RevByMonthOfYearRule(processor); - } - - return new ByMonthOfYearRule(processor); - }, - normalizeOptions: (options, norm) => { - if (options.byMonthOfYear !== undefined) { - if (!ruleOptionFilled(options.byMonthOfYear)) { - throw new _rschedule_core__WEBPACK_IMPORTED_MODULE_0__["RuleOptionError"]('"byMonthOfYear" expects a non-empty array'); - } - - if (options.byMonthOfYear.some(num => num < 1 || num > 12)) { - throw new _rschedule_core__WEBPACK_IMPORTED_MODULE_0__["RuleOptionError"]('"byMonthOfYear" values must be `num >= 1 && num >= 12`'); - } - - norm.byMonthOfYear = options.byMonthOfYear.slice(); - norm.byMonthOfYear.sort(_rschedule_core__WEBPACK_IMPORTED_MODULE_0__["numberSortComparer"]); - } else if (!(ruleOptionFilled(options.byDayOfMonth) || ruleOptionFilled(options.byDayOfWeek) || ruleOptionFilled(options.byDayOfYear)) && options.frequency === 'YEARLY') { - norm.byMonthOfYear = [norm.start.get('month')]; - } - }, - deps: () => [FrequencyRuleModule, ByMonthOfYearRuleModule, ByDayOfMonthRuleModule, ByHourOfDayRuleModule, ByMinuteOfHourRuleModule, BySecondOfMinuteRuleModule, ByMillisecondOfSecondRuleModule] -}; -const ICAL_RULES = [FrequencyRuleModule, ByMonthOfYearRuleModule, ByDayOfMonthRuleModule, ByDayOfWeekRuleModule, ByHourOfDayRuleModule, ByMinuteOfHourRuleModule, BySecondOfMinuteRuleModule, ByMillisecondOfSecondRuleModule]; - - -/***/ }), - -/***/ "./node_modules/@rschedule/json-tools/es2015/Schedule.js": -/*!***************************************************************!*\ - !*** ./node_modules/@rschedule/json-tools/es2015/Schedule.js ***! - \***************************************************************/ -/*! no exports provided */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var _rschedule_core_generators__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @rschedule/core/generators */ "./node_modules/@rschedule/core/es2015/generators.js"); -/* harmony import */ var _rschedule_json_tools__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @rschedule/json-tools */ "./node_modules/@rschedule/json-tools/es2015/main.js"); -/* harmony import */ var _rschedule_core__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @rschedule/core */ "./node_modules/@rschedule/core/es2015/main.js"); - - - - -_rschedule_core_generators__WEBPACK_IMPORTED_MODULE_0__["Dates"].prototype.toJSON = function serialize(opts = {}) { - const json = { - type: 'Dates', - dates: this.adapters.map(adapter => adapter.toJSON()) - }; - if (!opts.nested) json.timezone = this.timezone; - Object(_rschedule_json_tools__WEBPACK_IMPORTED_MODULE_1__["serializeDataToJSON"])(this, json, opts); - return json; -}; - -_rschedule_core_generators__WEBPACK_IMPORTED_MODULE_0__["Dates"].fromJSON = function parse(json, options = {}) { - if (json.type !== 'Dates') { - throw new _rschedule_json_tools__WEBPACK_IMPORTED_MODULE_1__["ParseJSONError"]('Invalid Dates JSON'); - } - - return new _rschedule_core_generators__WEBPACK_IMPORTED_MODULE_0__["Dates"]({ - dates: json.dates.map(date => _rschedule_core__WEBPACK_IMPORTED_MODULE_2__["DateAdapterBase"].adapter.fromJSON(date)), - data: typeof options.data === 'function' ? options.data(json) : json.data, - timezone: options.timezone || json.timezone - }); -}; - -Object(_rschedule_json_tools__WEBPACK_IMPORTED_MODULE_1__["registerJSONSerializerFn"])('Dates', _rschedule_core_generators__WEBPACK_IMPORTED_MODULE_0__["Dates"].fromJSON); - -_rschedule_core_generators__WEBPACK_IMPORTED_MODULE_0__["Rule"].prototype.toJSON = function serialize(opts = {}) { - const json = { - type: 'Rule', - config: Object.assign(Object.assign({}, Object(_rschedule_core__WEBPACK_IMPORTED_MODULE_2__["cloneJSON"])(this.options)), { - start: this.normalizeDateInput(this.options.start).toJSON() - }) - }; - - if (this.options.end) { - json.config.end = this.normalizeDateInput(this.options.end).toJSON(); - } - - if (!opts.nested) json.timezone = this.timezone; - Object(_rschedule_json_tools__WEBPACK_IMPORTED_MODULE_1__["serializeDataToJSON"])(this, json, opts); - return json; -}; - -_rschedule_core_generators__WEBPACK_IMPORTED_MODULE_0__["Rule"].fromJSON = function fromJSON(json, options = {}) { - const config = Object.assign(Object.assign({}, json.config), { - start: _rschedule_core__WEBPACK_IMPORTED_MODULE_2__["DateAdapterBase"].adapter.fromJSON(json.config.start), - end: json.config.end && _rschedule_core__WEBPACK_IMPORTED_MODULE_2__["DateAdapterBase"].adapter.fromJSON(json.config.end) - }); - return new _rschedule_core_generators__WEBPACK_IMPORTED_MODULE_0__["Rule"](config, { - data: typeof options.data === 'function' ? options.data(json) : json.data, - timezone: options.timezone || json.timezone - }); -}; - -Object(_rschedule_json_tools__WEBPACK_IMPORTED_MODULE_1__["registerJSONSerializerFn"])('Rule', _rschedule_core_generators__WEBPACK_IMPORTED_MODULE_0__["Rule"].fromJSON); - -_rschedule_core_generators__WEBPACK_IMPORTED_MODULE_0__["Schedule"].prototype.toJSON = function serialize(opts = {}) { - const json = { - type: 'Schedule', - rrules: this.rrules.map(rule => rule.toJSON(Object.assign(Object.assign({}, opts), { - nested: true - }))), - exrules: this.exrules.map(rule => rule.toJSON(Object.assign(Object.assign({}, opts), { - nested: true - }))), - rdates: this.rdates.toJSON(Object.assign(Object.assign({}, opts), { - nested: true - })), - exdates: this.exdates.toJSON(Object.assign(Object.assign({}, opts), { - nested: true - })) - }; - if (!opts.nested) json.timezone = this.timezone; - Object(_rschedule_json_tools__WEBPACK_IMPORTED_MODULE_1__["serializeDataToJSON"])(this, json, opts); - return json; -}; - -_rschedule_core_generators__WEBPACK_IMPORTED_MODULE_0__["Schedule"].fromJSON = function parse(json, options = {}) { - if (json.type !== 'Schedule') { - throw new _rschedule_json_tools__WEBPACK_IMPORTED_MODULE_1__["ParseJSONError"]('Invalid Schedule JSON'); - } - - return new _rschedule_core_generators__WEBPACK_IMPORTED_MODULE_0__["Schedule"]({ - rrules: json.rrules.map(rule => _rschedule_core_generators__WEBPACK_IMPORTED_MODULE_0__["Rule"].fromJSON(rule, Object.assign({ - timezone: json.timezone - }, options))), - exrules: json.exrules.map(rule => _rschedule_core_generators__WEBPACK_IMPORTED_MODULE_0__["Rule"].fromJSON(rule, Object.assign({ - timezone: json.timezone - }, options))), - rdates: _rschedule_core_generators__WEBPACK_IMPORTED_MODULE_0__["Dates"].fromJSON(json.rdates, Object.assign({ - timezone: json.timezone - }, options)), - exdates: _rschedule_core_generators__WEBPACK_IMPORTED_MODULE_0__["Dates"].fromJSON(json.exdates, Object.assign({ - timezone: json.timezone - }, options)), - data: typeof options.data === 'function' ? options.data(json) : json.data, - timezone: options.timezone || json.timezone - }); -}; - -Object(_rschedule_json_tools__WEBPACK_IMPORTED_MODULE_1__["registerJSONSerializerFn"])('Schedule', _rschedule_core_generators__WEBPACK_IMPORTED_MODULE_0__["Schedule"].fromJSON); - -/***/ }), - -/***/ "./node_modules/@rschedule/json-tools/es2015/main.js": -/*!***********************************************************!*\ - !*** ./node_modules/@rschedule/json-tools/es2015/main.js ***! - \***********************************************************/ -/*! exports provided: ParseJSONError, SerializeJSONError, registerJSONSerializerFn, serializeDataToJSON */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ParseJSONError", function() { return ParseJSONError; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SerializeJSONError", function() { return SerializeJSONError; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "registerJSONSerializerFn", function() { return registerJSONSerializerFn; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "serializeDataToJSON", function() { return serializeDataToJSON; }); -/* harmony import */ var _rschedule_core_generators__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @rschedule/core/generators */ "./node_modules/@rschedule/core/es2015/generators.js"); - - -class ParseJSONError extends Error {} - -class SerializeJSONError extends Error {} - -_rschedule_core_generators__WEBPACK_IMPORTED_MODULE_0__["OccurrenceGenerator"].JSON_FN_MAP = new Map(); - -_rschedule_core_generators__WEBPACK_IMPORTED_MODULE_0__["OccurrenceGenerator"].prototype.toJSON = function serialize(opts) { - throw new SerializeJSONError(`To support smaller bundles, ${this.constructor.name}#toJSON() ` + `must be manually added. See "@rschedule/json-tools" in the rSchedule docs.`); -}; - -_rschedule_core_generators__WEBPACK_IMPORTED_MODULE_0__["OccurrenceGenerator"].fromJSON = function parse(json, options) { - if (typeof json !== 'object' || json === null) { - throw new ParseJSONError(`Invalid json "${json}"`); - } - - const fn = _rschedule_core_generators__WEBPACK_IMPORTED_MODULE_0__["OccurrenceGenerator"].JSON_FN_MAP.get(json.type); - - if (!fn) { - throw new ParseJSONError(`Unknown rSchedule object type "${json.type}". Have you added a json serializer ` + `for "${json.type}"? ` + `See "@rschedule/json-tools" in the rSchedule docs.`); - } - - return fn(json, options); -}; - -function serializeDataToJSON(gen, json, opt) { - if (!opt.data) return; - - if (opt.data === true) { - json.data = gen.data; - } else { - json.data = opt.data(gen); - } - - if (json.data === undefined) delete json.data; -} - -function registerJSONSerializerFn(name, fn) { - _rschedule_core_generators__WEBPACK_IMPORTED_MODULE_0__["OccurrenceGenerator"].JSON_FN_MAP.set(name, fn); -} - - - -/***/ }), - -/***/ "./node_modules/@rschedule/standard-date-adapter/es2015/main.js": -/*!**********************************************************************!*\ - !*** ./node_modules/@rschedule/standard-date-adapter/es2015/main.js ***! - \**********************************************************************/ -/*! exports provided: StandardDateAdapter */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "StandardDateAdapter", function() { return StandardDateAdapter; }); -/* harmony import */ var _rschedule_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @rschedule/core */ "./node_modules/@rschedule/core/es2015/main.js"); - - -class StandardDateAdapter extends _rschedule_core__WEBPACK_IMPORTED_MODULE_0__["DateAdapterBase"] { - constructor(date, options = {}) { - super(undefined, options); - - if (!['UTC', null, undefined].includes(options.timezone)) { - throw new _rschedule_core__WEBPACK_IMPORTED_MODULE_0__["InvalidDateAdapterError"](`StandardDateAdapter only supports "UTC" and ` + `local time zones but "${options.timezone}" was provided.`); - } - - this._date = new Date(date); - this.timezone = options.timezone !== undefined ? options.timezone : null; - this.assertIsValid(); - } - - static isDate(object) { - return Object.prototype.toString.call(object) === '[object Date]'; - } - - static fromDate(date, options) { - return new StandardDateAdapter(date, options); - } - - static fromJSON(json) { - const args = [json.year, json.month - 1, json.day, json.hour, json.minute, json.second, json.millisecond]; - - switch (json.timezone) { - case 'UTC': - { - return new StandardDateAdapter(new Date(Date.UTC(...args)), { - timezone: 'UTC', - duration: json.duration - }); - } - - case null: - { - return new StandardDateAdapter(new Date(...args), { - timezone: null, - duration: json.duration - }); - } - - default: - throw new _rschedule_core__WEBPACK_IMPORTED_MODULE_0__["InvalidDateAdapterError"]('The `StandardDateAdapter` only supports datetimes in ' + `UTC or LOCAL (null) time. You provided a JSON object ` + `with timezone "${json.timezone}".`); - } - } - - static fromDateTime(datetime) { - const date = StandardDateAdapter.fromJSON(datetime.toJSON()); - date.generators.push(...datetime.generators); - return date; - } - - get date() { - return new Date(this._date); - } - - get end() { - if (!this.duration) return; - if (this._end) return this._end; - this._end = StandardDateAdapter.fromDateTime(this.toDateTime().add(this.duration, 'millisecond')).date; - return this._end; - } - - set(prop, value) { - if (prop === 'timezone') { - if (this.timezone === value) return this;else { - return new StandardDateAdapter(this._date, { - timezone: value, - duration: this.duration, - generators: this.generators - }); - } - } else if (prop === 'duration') { - if (this.duration === value) return this;else { - return new StandardDateAdapter(this._date, { - timezone: this.timezone, - duration: value, - generators: this.generators - }); - } - } - - throw new _rschedule_core__WEBPACK_IMPORTED_MODULE_0__["ArgumentError"](`Unknown prop "${prop}" for StandardDateAdapter#set()`); - } - - valueOf() { - return this._date.valueOf(); - } - - toJSON() { - let json; - - if (this.timezone === 'UTC') { - json = { - timezone: this.timezone, - year: this._date.getUTCFullYear(), - month: this._date.getUTCMonth() + 1, - day: this._date.getUTCDate(), - hour: this._date.getUTCHours(), - minute: this._date.getUTCMinutes(), - second: this._date.getUTCSeconds(), - millisecond: this._date.getUTCMilliseconds() - }; - } else { - json = { - timezone: this.timezone, - year: this._date.getFullYear(), - month: this._date.getMonth() + 1, - day: this._date.getDate(), - hour: this._date.getHours(), - minute: this._date.getMinutes(), - second: this._date.getSeconds(), - millisecond: this._date.getMilliseconds() - }; - } - - if (this.duration) { - json.duration = this.duration; - } - - return json; - } - - assertIsValid() { - if (!StandardDateAdapter.isDate(this._date) || isNaN(this._date.valueOf())) { - throw new _rschedule_core__WEBPACK_IMPORTED_MODULE_0__["InvalidDateAdapterError"]('StandardDateAdapter has invalid date.'); - } else if (![null, 'UTC'].includes(this.timezone)) { - throw new _rschedule_core__WEBPACK_IMPORTED_MODULE_0__["InvalidDateAdapterError"]('StandardDateAdapter only supports local (null) and UTC timezones but ' + `"${this.timezone}" was specified.`); - } else if (this.duration && this.duration <= 0) { - throw new _rschedule_core__WEBPACK_IMPORTED_MODULE_0__["InvalidDateAdapterError"]('If provided, duration must be greater than 0.'); - } - - return true; - } - -} - -StandardDateAdapter.hasTimezoneSupport = false; - - -/***/ }), - -/***/ "./node_modules/@rschedule/standard-date-adapter/es2015/setup.js": -/*!***********************************************************************!*\ - !*** ./node_modules/@rschedule/standard-date-adapter/es2015/setup.js ***! - \***********************************************************************/ -/*! no exports provided */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var _rschedule_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @rschedule/core */ "./node_modules/@rschedule/core/es2015/main.js"); -/* harmony import */ var _rschedule_core_generators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @rschedule/core/generators */ "./node_modules/@rschedule/core/es2015/generators.js"); -/* harmony import */ var _rschedule_core_rules_ICAL_RULES__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @rschedule/core/rules/ICAL_RULES */ "./node_modules/@rschedule/core/es2015/rules.js"); -/* harmony import */ var _rschedule_standard_date_adapter__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @rschedule/standard-date-adapter */ "./node_modules/@rschedule/standard-date-adapter/es2015/main.js"); - - - - -_rschedule_core__WEBPACK_IMPORTED_MODULE_0__["DateAdapterBase"].adapter = _rschedule_standard_date_adapter__WEBPACK_IMPORTED_MODULE_3__["StandardDateAdapter"]; -_rschedule_core_generators__WEBPACK_IMPORTED_MODULE_1__["Rule"].recurrenceRules = _rschedule_core_rules_ICAL_RULES__WEBPACK_IMPORTED_MODULE_2__["ICAL_RULES"]; - -/***/ }), - -/***/ "./node_modules/accounting/accounting.js": -/*!***********************************************!*\ - !*** ./node_modules/accounting/accounting.js ***! - \***********************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -/*! - * accounting.js v0.4.2 - * Copyright 2014 Open Exchange Rates - * - * Freely distributable under the MIT license. - * Portions of accounting.js are inspired or borrowed from underscore.js - * - * Full details and documentation: - * http://openexchangerates.github.io/accounting.js/ - */ -(function (root, undefined) { - /* --- Setup --- */ - // Create the local library object, to be exported or referenced globally later - var lib = {}; // Current version - - lib.version = '0.4.2'; - /* --- Exposed settings --- */ - // The library's settings configuration object. Contains default parameters for - // currency and number formatting - - lib.settings = { - currency: { - symbol: "$", - // default currency symbol is '$' - format: "%s%v", - // controls output: %s = symbol, %v = value (can be object, see docs) - decimal: ".", - // decimal point separator - thousand: ",", - // thousands separator - precision: 2, - // decimal places - grouping: 3 // digit grouping (not implemented yet) - - }, - number: { - precision: 0, - // default precision on numbers is 0 - grouping: 3, - // digit grouping (not implemented yet) - thousand: ",", - decimal: "." - } - }; - /* --- Internal Helper Methods --- */ - // Store reference to possibly-available ECMAScript 5 methods for later - - var nativeMap = Array.prototype.map, - nativeIsArray = Array.isArray, - toString = Object.prototype.toString; - /** - * Tests whether supplied parameter is a string - * from underscore.js - */ - - function isString(obj) { - return !!(obj === '' || obj && obj.charCodeAt && obj.substr); - } - /** - * Tests whether supplied parameter is an array - * from underscore.js, delegates to ECMA5's native Array.isArray - */ - - - function isArray(obj) { - return nativeIsArray ? nativeIsArray(obj) : toString.call(obj) === '[object Array]'; - } - /** - * Tests whether supplied parameter is a true object - */ - - - function isObject(obj) { - return obj && toString.call(obj) === '[object Object]'; - } - /** - * Extends an object with a defaults object, similar to underscore's _.defaults - * - * Used for abstracting parameter handling from API methods - */ - - - function defaults(object, defs) { - var key; - object = object || {}; - defs = defs || {}; // Iterate over object non-prototype properties: - - for (key in defs) { - if (defs.hasOwnProperty(key)) { - // Replace values with defaults only if undefined (allow empty/zero values): - if (object[key] == null) object[key] = defs[key]; - } - } - - return object; - } - /** - * Implementation of `Array.map()` for iteration loops - * - * Returns a new Array as a result of calling `iterator` on each array value. - * Defers to native Array.map if available - */ - - - function map(obj, iterator, context) { - var results = [], - i, - j; - if (!obj) return results; // Use native .map method if it exists: - - if (nativeMap && obj.map === nativeMap) return obj.map(iterator, context); // Fallback for native .map: - - for (i = 0, j = obj.length; i < j; i++) { - results[i] = iterator.call(context, obj[i], i, obj); - } - - return results; - } - /** - * Check and normalise the value of precision (must be positive integer) - */ - - - function checkPrecision(val, base) { - val = Math.round(Math.abs(val)); - return isNaN(val) ? base : val; - } - /** - * Parses a format string or object and returns format obj for use in rendering - * - * `format` is either a string with the default (positive) format, or object - * containing `pos` (required), `neg` and `zero` values (or a function returning - * either a string or object) - * - * Either string or format.pos must contain "%v" (value) to be valid - */ - - - function checkCurrencyFormat(format) { - var defaults = lib.settings.currency.format; // Allow function as format parameter (should return string or object): - - if (typeof format === "function") format = format(); // Format can be a string, in which case `value` ("%v") must be present: - - if (isString(format) && format.match("%v")) { - // Create and return positive, negative and zero formats: - return { - pos: format, - neg: format.replace("-", "").replace("%v", "-%v"), - zero: format - }; // If no format, or object is missing valid positive value, use defaults: - } else if (!format || !format.pos || !format.pos.match("%v")) { - // If defaults is a string, casts it to an object for faster checking next time: - return !isString(defaults) ? defaults : lib.settings.currency.format = { - pos: defaults, - neg: defaults.replace("%v", "-%v"), - zero: defaults - }; - } // Otherwise, assume format was fine: - - - return format; - } - /* --- API Methods --- */ - - /** - * Takes a string/array of strings, removes all formatting/cruft and returns the raw float value - * Alias: `accounting.parse(string)` - * - * Decimal must be included in the regular expression to match floats (defaults to - * accounting.settings.number.decimal), so if the number uses a non-standard decimal - * separator, provide it as the second argument. - * - * Also matches bracketed negatives (eg. "$ (1.99)" => -1.99) - * - * Doesn't throw any errors (`NaN`s become 0) but this may change in future - */ - - - var unformat = lib.unformat = lib.parse = function (value, decimal) { - // Recursively unformat arrays: - if (isArray(value)) { - return map(value, function (val) { - return unformat(val, decimal); - }); - } // Fails silently (need decent errors): - - - value = value || 0; // Return the value as-is if it's already a number: - - if (typeof value === "number") return value; // Default decimal point comes from settings, but could be set to eg. "," in opts: - - decimal = decimal || lib.settings.number.decimal; // Build regex to strip out everything except digits, decimal point and minus sign: - - var regex = new RegExp("[^0-9-" + decimal + "]", ["g"]), - unformatted = parseFloat(("" + value).replace(/\((?=\d+)(.*)\)/, "-$1") // replace bracketed values with negatives - .replace(regex, '') // strip out any cruft - .replace(decimal, '.') // make sure decimal point is standard - ); // This will fail silently which may cause trouble, let's wait and see: - - return !isNaN(unformatted) ? unformatted : 0; - }; - /** - * Implementation of toFixed() that treats floats more like decimals - * - * Fixes binary rounding issues (eg. (0.615).toFixed(2) === "0.61") that present - * problems for accounting- and finance-related software. - */ - - - var toFixed = lib.toFixed = function (value, precision) { - precision = checkPrecision(precision, lib.settings.number.precision); - var exponentialForm = Number(lib.unformat(value) + 'e' + precision); - var rounded = Math.round(exponentialForm); - var finalResult = Number(rounded + 'e-' + precision).toFixed(precision); - return finalResult; - }; - /** - * Format a number, with comma-separated thousands and custom precision/decimal places - * Alias: `accounting.format()` - * - * Localise by overriding the precision and thousand / decimal separators - * 2nd parameter `precision` can be an object matching `settings.number` - */ - - - var formatNumber = lib.formatNumber = lib.format = function (number, precision, thousand, decimal) { - // Resursively format arrays: - if (isArray(number)) { - return map(number, function (val) { - return formatNumber(val, precision, thousand, decimal); - }); - } // Clean up number: - - - number = unformat(number); // Build options object from second param (if object) or all params, extending defaults: - - var opts = defaults(isObject(precision) ? precision : { - precision: precision, - thousand: thousand, - decimal: decimal - }, lib.settings.number), - // Clean up precision - usePrecision = checkPrecision(opts.precision), - // Do some calc: - negative = number < 0 ? "-" : "", - base = parseInt(toFixed(Math.abs(number || 0), usePrecision), 10) + "", - mod = base.length > 3 ? base.length % 3 : 0; // Format the number: - - return negative + (mod ? base.substr(0, mod) + opts.thousand : "") + base.substr(mod).replace(/(\d{3})(?=\d)/g, "$1" + opts.thousand) + (usePrecision ? opts.decimal + toFixed(Math.abs(number), usePrecision).split('.')[1] : ""); - }; - /** - * Format a number into currency - * - * Usage: accounting.formatMoney(number, symbol, precision, thousandsSep, decimalSep, format) - * defaults: (0, "$", 2, ",", ".", "%s%v") - * - * Localise by overriding the symbol, precision, thousand / decimal separators and format - * Second param can be an object matching `settings.currency` which is the easiest way. - * - * To do: tidy up the parameters - */ - - - var formatMoney = lib.formatMoney = function (number, symbol, precision, thousand, decimal, format) { - // Resursively format arrays: - if (isArray(number)) { - return map(number, function (val) { - return formatMoney(val, symbol, precision, thousand, decimal, format); - }); - } // Clean up number: - - - number = unformat(number); // Build options object from second param (if object) or all params, extending defaults: - - var opts = defaults(isObject(symbol) ? symbol : { - symbol: symbol, - precision: precision, - thousand: thousand, - decimal: decimal, - format: format - }, lib.settings.currency), - // Check format (returns object with pos, neg and zero): - formats = checkCurrencyFormat(opts.format), - // Choose which format to use for this value: - useFormat = number > 0 ? formats.pos : number < 0 ? formats.neg : formats.zero; // Return with currency symbol added: - - return useFormat.replace('%s', opts.symbol).replace('%v', formatNumber(Math.abs(number), checkPrecision(opts.precision), opts.thousand, opts.decimal)); - }; - /** - * Format a list of numbers into an accounting column, padding with whitespace - * to line up currency symbols, thousand separators and decimals places - * - * List should be an array of numbers - * Second parameter can be an object containing keys that match the params - * - * Returns array of accouting-formatted number strings of same length - * - * NB: `white-space:pre` CSS rule is required on the list container to prevent - * browsers from collapsing the whitespace in the output strings. - */ - - - lib.formatColumn = function (list, symbol, precision, thousand, decimal, format) { - if (!list || !isArray(list)) return []; // Build options object from second param (if object) or all params, extending defaults: - - var opts = defaults(isObject(symbol) ? symbol : { - symbol: symbol, - precision: precision, - thousand: thousand, - decimal: decimal, - format: format - }, lib.settings.currency), - // Check format (returns object with pos, neg and zero), only need pos for now: - formats = checkCurrencyFormat(opts.format), - // Whether to pad at start of string or after currency symbol: - padAfterSymbol = formats.pos.indexOf("%s") < formats.pos.indexOf("%v") ? true : false, - // Store value for the length of the longest string in the column: - maxLength = 0, - // Format the list according to options, store the length of the longest string: - formatted = map(list, function (val, i) { - if (isArray(val)) { - // Recursively format columns if list is a multi-dimensional array: - return lib.formatColumn(val, opts); - } else { - // Clean up the value - val = unformat(val); // Choose which format to use for this value (pos, neg or zero): - - var useFormat = val > 0 ? formats.pos : val < 0 ? formats.neg : formats.zero, - // Format this value, push into formatted list and save the length: - fVal = useFormat.replace('%s', opts.symbol).replace('%v', formatNumber(Math.abs(val), checkPrecision(opts.precision), opts.thousand, opts.decimal)); - if (fVal.length > maxLength) maxLength = fVal.length; - return fVal; - } - }); // Pad each number in the list and send back the column of numbers: - - return map(formatted, function (val, i) { - // Only if this is a string (not a nested array, which would have already been padded): - if (isString(val) && val.length < maxLength) { - // Depending on symbol position, pad after symbol or at index 0: - return padAfterSymbol ? val.replace(opts.symbol, opts.symbol + new Array(maxLength - val.length + 1).join(" ")) : new Array(maxLength - val.length + 1).join(" ") + val; - } - - return val; - }); - }; - /* --- Module Definition --- */ - // Export accounting for CommonJS. If being loaded as an AMD module, define it as such. - // Otherwise, just add `accounting` to the global object - - - if (true) { - if ( true && module.exports) { - exports = module.exports = lib; - } - - exports.accounting = lib; - } else {} // Root will be `window` in browser or `global` on the server: - -})(this); - -/***/ }), - -/***/ "./node_modules/adm-zip/adm-zip.js": -/*!*****************************************!*\ - !*** ./node_modules/adm-zip/adm-zip.js ***! - \*****************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -const Utils = __webpack_require__(/*! ./util */ "./node_modules/adm-zip/util/index.js"); - -const pth = __webpack_require__(/*! path */ "path"); - -const ZipEntry = __webpack_require__(/*! ./zipEntry */ "./node_modules/adm-zip/zipEntry.js"); - -const ZipFile = __webpack_require__(/*! ./zipFile */ "./node_modules/adm-zip/zipFile.js"); - -const get_Bool = (val, def) => typeof val === "boolean" ? val : def; - -const get_Str = (val, def) => typeof val === "string" ? val : def; - -const defaultOptions = { - // option "noSort" : if true it disables files sorting - noSort: false, - // read entries during load (initial loading may be slower) - readEntries: false, - // default method is none - method: Utils.Constants.NONE, - // file system - fs: null -}; - -module.exports = function ( -/**String*/ -input, -/** object */ -options) { - let inBuffer = null; // create object based default options, allowing them to be overwritten - - const opts = Object.assign(Object.create(null), defaultOptions); // test input variable - - if (input && "object" === typeof input) { - // if value is not buffer we accept it to be object with options - if (!(input instanceof Uint8Array)) { - Object.assign(opts, input); - input = opts.input ? opts.input : undefined; - if (opts.input) delete opts.input; - } // if input is buffer - - - if (Buffer.isBuffer(input)) { - inBuffer = input; - opts.method = Utils.Constants.BUFFER; - input = undefined; - } - } // assign options - - - Object.assign(opts, options); // instanciate utils filesystem - - const filetools = new Utils(opts); // if input is file name we retrieve its content - - if (input && "string" === typeof input) { - // load zip file - if (filetools.fs.existsSync(input)) { - opts.method = Utils.Constants.FILE; - opts.filename = input; - inBuffer = filetools.fs.readFileSync(input); - } else { - throw new Error(Utils.Errors.INVALID_FILENAME); - } - } // create variable - - - const _zip = new ZipFile(inBuffer, opts); - - const canonical = Utils.canonical, - sanitize = Utils.sanitize; - - function getEntry( - /**Object*/ - entry) { - if (entry && _zip) { - var item; // If entry was given as a file name - - if (typeof entry === "string") item = _zip.getEntry(entry); // if entry was given as a ZipEntry object - - if (typeof entry === "object" && typeof entry.entryName !== "undefined" && typeof entry.header !== "undefined") item = _zip.getEntry(entry.entryName); - - if (item) { - return item; - } - } - - return null; - } - - function fixPath(zipPath) { - const _pth$posix = pth.posix, - join = _pth$posix.join, - normalize = _pth$posix.normalize, - sep = _pth$posix.sep; // convert windows file separators and normalize - - return join(".", normalize(sep + zipPath.split("\\").join(sep) + sep)); - } - - return { - /** - * Extracts the given entry from the archive and returns the content as a Buffer object - * @param entry ZipEntry object or String with the full path of the entry - * - * @return Buffer or Null in case of error - */ - readFile: function ( - /**Object*/ - entry, - /*String, Buffer*/ - pass) { - var item = getEntry(entry); - return item && item.getData(pass) || null; - }, - - /** - * Asynchronous readFile - * @param entry ZipEntry object or String with the full path of the entry - * @param callback - * - * @return Buffer or Null in case of error - */ - readFileAsync: function ( - /**Object*/ - entry, - /**Function*/ - callback) { - var item = getEntry(entry); - - if (item) { - item.getDataAsync(callback); - } else { - callback(null, "getEntry failed for:" + entry); - } - }, - - /** - * Extracts the given entry from the archive and returns the content as plain text in the given encoding - * @param entry ZipEntry object or String with the full path of the entry - * @param encoding Optional. If no encoding is specified utf8 is used - * - * @return String - */ - readAsText: function ( - /**Object*/ - entry, - /**String=*/ - encoding) { - var item = getEntry(entry); - - if (item) { - var data = item.getData(); - - if (data && data.length) { - return data.toString(encoding || "utf8"); - } - } - - return ""; - }, - - /** - * Asynchronous readAsText - * @param entry ZipEntry object or String with the full path of the entry - * @param callback - * @param encoding Optional. If no encoding is specified utf8 is used - * - * @return String - */ - readAsTextAsync: function ( - /**Object*/ - entry, - /**Function*/ - callback, - /**String=*/ - encoding) { - var item = getEntry(entry); - - if (item) { - item.getDataAsync(function (data, err) { - if (err) { - callback(data, err); - return; - } - - if (data && data.length) { - callback(data.toString(encoding || "utf8")); - } else { - callback(""); - } - }); - } else { - callback(""); - } - }, - - /** - * Remove the entry from the file or the entry and all it's nested directories and files if the given entry is a directory - * - * @param entry - */ - deleteFile: function ( - /**Object*/ - entry) { - // @TODO: test deleteFile - var item = getEntry(entry); - - if (item) { - _zip.deleteEntry(item.entryName); - } - }, - - /** - * Adds a comment to the zip. The zip must be rewritten after adding the comment. - * - * @param comment - */ - addZipComment: function ( - /**String*/ - comment) { - // @TODO: test addZipComment - _zip.comment = comment; - }, - - /** - * Returns the zip comment - * - * @return String - */ - getZipComment: function () { - return _zip.comment || ""; - }, - - /** - * Adds a comment to a specified zipEntry. The zip must be rewritten after adding the comment - * The comment cannot exceed 65535 characters in length - * - * @param entry - * @param comment - */ - addZipEntryComment: function ( - /**Object*/ - entry, - /**String*/ - comment) { - var item = getEntry(entry); - - if (item) { - item.comment = comment; - } - }, - - /** - * Returns the comment of the specified entry - * - * @param entry - * @return String - */ - getZipEntryComment: function ( - /**Object*/ - entry) { - var item = getEntry(entry); - - if (item) { - return item.comment || ""; - } - - return ""; - }, - - /** - * Updates the content of an existing entry inside the archive. The zip must be rewritten after updating the content - * - * @param entry - * @param content - */ - updateFile: function ( - /**Object*/ - entry, - /**Buffer*/ - content) { - var item = getEntry(entry); - - if (item) { - item.setData(content); - } - }, - - /** - * Adds a file from the disk to the archive - * - * @param localPath File to add to zip - * @param zipPath Optional path inside the zip - * @param zipName Optional name for the file - */ - addLocalFile: function ( - /**String*/ - localPath, - /**String=*/ - zipPath, - /**String=*/ - zipName, - /**String*/ - comment) { - if (filetools.fs.existsSync(localPath)) { - // fix ZipPath - zipPath = zipPath ? fixPath(zipPath) : ""; // p - local file name - - var p = localPath.split("\\").join("/").split("/").pop(); // add file name into zippath - - zipPath += zipName ? zipName : p; // read file attributes - - const _attr = filetools.fs.statSync(localPath); // add file into zip file - - - this.addFile(zipPath, filetools.fs.readFileSync(localPath), comment, _attr); - } else { - throw new Error(Utils.Errors.FILE_NOT_FOUND.replace("%s", localPath)); - } - }, - - /** - * Adds a local directory and all its nested files and directories to the archive - * - * @param localPath - * @param zipPath optional path inside zip - * @param filter optional RegExp or Function if files match will - * be included. - */ - addLocalFolder: function ( - /**String*/ - localPath, - /**String=*/ - zipPath, - /**=RegExp|Function*/ - filter) { - // Prepare filter - if (filter instanceof RegExp) { - // if filter is RegExp wrap it - filter = function (rx) { - return function (filename) { - return rx.test(filename); - }; - }(filter); - } else if ("function" !== typeof filter) { - // if filter is not function we will replace it - filter = function () { - return true; - }; - } // fix ZipPath - - - zipPath = zipPath ? fixPath(zipPath) : ""; // normalize the path first - - localPath = pth.normalize(localPath); - - if (filetools.fs.existsSync(localPath)) { - const items = filetools.findFiles(localPath); - const self = this; - - if (items.length) { - items.forEach(function (filepath) { - var p = pth.relative(localPath, filepath).split("\\").join("/"); //windows fix - - if (filter(p)) { - var stats = filetools.fs.statSync(filepath); - - if (stats.isFile()) { - self.addFile(zipPath + p, filetools.fs.readFileSync(filepath), "", stats); - } else { - self.addFile(zipPath + p + "/", Buffer.alloc(0), "", stats); - } - } - }); - } - } else { - throw new Error(Utils.Errors.FILE_NOT_FOUND.replace("%s", localPath)); - } - }, - - /** - * Asynchronous addLocalFile - * @param localPath - * @param callback - * @param zipPath optional path inside zip - * @param filter optional RegExp or Function if files match will - * be included. - */ - addLocalFolderAsync: function ( - /*String*/ - localPath, - /*Function*/ - callback, - /*String*/ - zipPath, - /*RegExp|Function*/ - filter) { - if (filter instanceof RegExp) { - filter = function (rx) { - return function (filename) { - return rx.test(filename); - }; - }(filter); - } else if ("function" !== typeof filter) { - filter = function () { - return true; - }; - } // fix ZipPath - - - zipPath = zipPath ? fixPath(zipPath) : ""; // normalize the path first - - localPath = pth.normalize(localPath); - var self = this; - filetools.fs.open(localPath, "r", function (err) { - if (err && err.code === "ENOENT") { - callback(undefined, Utils.Errors.FILE_NOT_FOUND.replace("%s", localPath)); - } else if (err) { - callback(undefined, err); - } else { - var items = filetools.findFiles(localPath); - var i = -1; - - var next = function () { - i += 1; - - if (i < items.length) { - var filepath = items[i]; - var p = pth.relative(localPath, filepath).split("\\").join("/"); //windows fix - - p = p.normalize("NFD").replace(/[\u0300-\u036f]/g, "").replace(/[^\x20-\x7E]/g, ""); // accent fix - - if (filter(p)) { - filetools.fs.stat(filepath, function (er0, stats) { - if (er0) callback(undefined, er0); - - if (stats.isFile()) { - filetools.fs.readFile(filepath, function (er1, data) { - if (er1) { - callback(undefined, er1); - } else { - self.addFile(zipPath + p, data, "", stats); - next(); - } - }); - } else { - self.addFile(zipPath + p + "/", Buffer.alloc(0), "", stats); - next(); - } - }); - } else { - next(); - } - } else { - callback(true, undefined); - } - }; - - next(); - } - }); - }, - - /** - * - * @param {string} localPath - path where files will be extracted - * @param {object} props - optional properties - * @param {string} props.zipPath - optional path inside zip - * @param {regexp, function} props.filter - RegExp or Function if files match will be included. - */ - addLocalFolderPromise: function ( - /*String*/ - localPath, - /* object */ - props) { - return new Promise((resolve, reject) => { - const _Object$assign = Object.assign({}, props), - filter = _Object$assign.filter, - zipPath = _Object$assign.zipPath; - - this.addLocalFolderAsync(localPath, (done, err) => { - if (err) reject(err); - if (done) resolve(this); - }, zipPath, filter); - }); - }, - - /** - * Allows you to create a entry (file or directory) in the zip file. - * If you want to create a directory the entryName must end in / and a null buffer should be provided. - * Comment and attributes are optional - * - * @param {string} entryName - * @param {Buffer | string} content - file content as buffer or utf8 coded string - * @param {string} comment - file comment - * @param {number | object} attr - number as unix file permissions, object as filesystem Stats object - */ - addFile: function ( - /**String*/ - entryName, - /**Buffer*/ - content, - /**String*/ - comment, - /**Number*/ - attr) { - let entry = getEntry(entryName); - const update = entry != null; // prepare new entry - - if (!update) { - entry = new ZipEntry(); - entry.entryName = entryName; - } - - entry.comment = comment || ""; - const isStat = "object" === typeof attr && attr instanceof filetools.fs.Stats; // last modification time from file stats - - if (isStat) { - entry.header.time = attr.mtime; - } // Set file attribute - - - var fileattr = entry.isDirectory ? 0x10 : 0; // (MS-DOS directory flag) - // extended attributes field for Unix - - if (!Utils.isWin) { - // set file type either S_IFDIR / S_IFREG - let unix = entry.isDirectory ? 0x4000 : 0x8000; - - if (isStat) { - // File attributes from file stats - unix |= 0xfff & attr.mode; - } else if ("number" === typeof attr) { - // attr from given attr values - unix |= 0xfff & attr; - } else { - // Default values: - unix |= entry.isDirectory ? 0o755 : 0o644; // permissions (drwxr-xr-x) or (-r-wr--r--) - } - - fileattr = (fileattr | unix << 16) >>> 0; // add attributes - } - - entry.attr = fileattr; - entry.setData(content); - if (!update) _zip.setEntry(entry); - }, - - /** - * Returns an array of ZipEntry objects representing the files and folders inside the archive - * - * @return Array - */ - getEntries: function () { - return _zip ? _zip.entries : []; - }, - - /** - * Returns a ZipEntry object representing the file or folder specified by ``name``. - * - * @param name - * @return ZipEntry - */ - getEntry: function ( - /**String*/ - name) { - return getEntry(name); - }, - getEntryCount: function () { - return _zip.getEntryCount(); - }, - forEach: function (callback) { - return _zip.forEach(callback); - }, - - /** - * Extracts the given entry to the given targetPath - * If the entry is a directory inside the archive, the entire directory and it's subdirectories will be extracted - * - * @param entry ZipEntry object or String with the full path of the entry - * @param targetPath Target folder where to write the file - * @param maintainEntryPath If maintainEntryPath is true and the entry is inside a folder, the entry folder - * will be created in targetPath as well. Default is TRUE - * @param overwrite If the file already exists at the target path, the file will be overwriten if this is true. - * Default is FALSE - * @param keepOriginalPermission The file will be set as the permission from the entry if this is true. - * Default is FALSE - * @param outFileName String If set will override the filename of the extracted file (Only works if the entry is a file) - * - * @return Boolean - */ - extractEntryTo: function ( - /**Object*/ - entry, - /**String*/ - targetPath, - /**Boolean*/ - maintainEntryPath, - /**Boolean*/ - overwrite, - /**Boolean*/ - keepOriginalPermission, - /**String**/ - outFileName) { - overwrite = get_Bool(overwrite, false); - keepOriginalPermission = get_Bool(keepOriginalPermission, false); - maintainEntryPath = get_Bool(maintainEntryPath, true); - outFileName = get_Str(outFileName, get_Str(keepOriginalPermission, undefined)); - var item = getEntry(entry); - - if (!item) { - throw new Error(Utils.Errors.NO_ENTRY); - } - - var entryName = canonical(item.entryName); - var target = sanitize(targetPath, outFileName && !item.isDirectory ? outFileName : maintainEntryPath ? entryName : pth.basename(entryName)); - - if (item.isDirectory) { - var children = _zip.getEntryChildren(item); - - children.forEach(function (child) { - if (child.isDirectory) return; - var content = child.getData(); - - if (!content) { - throw new Error(Utils.Errors.CANT_EXTRACT_FILE); - } - - var name = canonical(child.entryName); - var childName = sanitize(targetPath, maintainEntryPath ? name : pth.basename(name)); // The reverse operation for attr depend on method addFile() - - const fileAttr = keepOriginalPermission ? child.header.fileAttr : undefined; - filetools.writeFileTo(childName, content, overwrite, fileAttr); - }); - return true; - } - - var content = item.getData(); - if (!content) throw new Error(Utils.Errors.CANT_EXTRACT_FILE); - - if (filetools.fs.existsSync(target) && !overwrite) { - throw new Error(Utils.Errors.CANT_OVERRIDE); - } // The reverse operation for attr depend on method addFile() - - - const fileAttr = keepOriginalPermission ? entry.header.fileAttr : undefined; - filetools.writeFileTo(target, content, overwrite, fileAttr); - return true; - }, - - /** - * Test the archive - * - */ - test: function (pass) { - if (!_zip) { - return false; - } - - for (var entry in _zip.entries) { - try { - if (entry.isDirectory) { - continue; - } - - var content = _zip.entries[entry].getData(pass); - - if (!content) { - return false; - } - } catch (err) { - return false; - } - } - - return true; - }, - - /** - * Extracts the entire archive to the given location - * - * @param targetPath Target location - * @param overwrite If the file already exists at the target path, the file will be overwriten if this is true. - * Default is FALSE - * @param keepOriginalPermission The file will be set as the permission from the entry if this is true. - * Default is FALSE - */ - extractAllTo: function ( - /**String*/ - targetPath, - /**Boolean*/ - overwrite, - /**Boolean*/ - keepOriginalPermission, - /*String, Buffer*/ - pass) { - overwrite = get_Bool(overwrite, false); - pass = get_Str(keepOriginalPermission, pass); - keepOriginalPermission = get_Bool(keepOriginalPermission, false); - - if (!_zip) { - throw new Error(Utils.Errors.NO_ZIP); - } - - _zip.entries.forEach(function (entry) { - var entryName = sanitize(targetPath, canonical(entry.entryName.toString())); - - if (entry.isDirectory) { - filetools.makeDir(entryName); - return; - } - - var content = entry.getData(pass); - - if (!content) { - throw new Error(Utils.Errors.CANT_EXTRACT_FILE); - } // The reverse operation for attr depend on method addFile() - - - const fileAttr = keepOriginalPermission ? entry.header.fileAttr : undefined; - filetools.writeFileTo(entryName, content, overwrite, fileAttr); - - try { - filetools.fs.utimesSync(entryName, entry.header.time, entry.header.time); - } catch (err) { - throw new Error(Utils.Errors.CANT_EXTRACT_FILE); - } - }); - }, - - /** - * Asynchronous extractAllTo - * - * @param targetPath Target location - * @param overwrite If the file already exists at the target path, the file will be overwriten if this is true. - * Default is FALSE - * @param keepOriginalPermission The file will be set as the permission from the entry if this is true. - * Default is FALSE - * @param callback The callback will be executed when all entries are extracted successfully or any error is thrown. - */ - extractAllToAsync: function ( - /**String*/ - targetPath, - /**Boolean*/ - overwrite, - /**Boolean*/ - keepOriginalPermission, - /**Function*/ - callback) { - if (!callback) { - callback = function () {}; - } - - overwrite = get_Bool(overwrite, false); - if (typeof keepOriginalPermission === "function" && !callback) callback = keepOriginalPermission; - keepOriginalPermission = get_Bool(keepOriginalPermission, false); - - if (!_zip) { - callback(new Error(Utils.Errors.NO_ZIP)); - return; - } - - targetPath = pth.resolve(targetPath); // convert entryName to - - const getPath = entry => sanitize(targetPath, pth.normalize(canonical(entry.entryName.toString()))); - - const getError = (msg, file) => new Error(msg + ': "' + file + '"'); // separate directories from files - - - const dirEntries = []; - const fileEntries = new Set(); - - _zip.entries.forEach(e => { - if (e.isDirectory) { - dirEntries.push(e); - } else { - fileEntries.add(e); - } - }); // Create directory entries first synchronously - // this prevents race condition and assures folders are there before writing files - - - for (const entry of dirEntries) { - const dirPath = getPath(entry); // The reverse operation for attr depend on method addFile() - - const dirAttr = keepOriginalPermission ? entry.header.fileAttr : undefined; - - try { - filetools.makeDir(dirPath); - if (dirAttr) filetools.fs.chmodSync(dirPath, dirAttr); // in unix timestamp will change if files are later added to folder, but still - - filetools.fs.utimesSync(dirPath, entry.header.time, entry.header.time); - } catch (er) { - callback(getError("Unable to create folder", dirPath)); - } - } // callback wrapper, for some house keeping - - - const done = () => { - if (fileEntries.size === 0) { - callback(); - } - }; // Extract file entries asynchronously - - - for (const entry of fileEntries.values()) { - const entryName = pth.normalize(canonical(entry.entryName.toString())); - const filePath = sanitize(targetPath, entryName); - entry.getDataAsync(function (content, err_1) { - if (err_1) { - callback(new Error(err_1)); - return; - } - - if (!content) { - callback(new Error(Utils.Errors.CANT_EXTRACT_FILE)); - } else { - // The reverse operation for attr depend on method addFile() - const fileAttr = keepOriginalPermission ? entry.header.fileAttr : undefined; - filetools.writeFileToAsync(filePath, content, overwrite, fileAttr, function (succ) { - if (!succ) { - callback(getError("Unable to write file", filePath)); - return; - } - - filetools.fs.utimes(filePath, entry.header.time, entry.header.time, function (err_2) { - if (err_2) { - callback(getError("Unable to set times", filePath)); - return; - } - - fileEntries.delete(entry); // call the callback if it was last entry - - done(); - }); - }); - } - }); - } // call the callback if fileEntries was empty - - - done(); - }, - - /** - * Writes the newly created zip file to disk at the specified location or if a zip was opened and no ``targetFileName`` is provided, it will overwrite the opened zip - * - * @param targetFileName - * @param callback - */ - writeZip: function ( - /**String*/ - targetFileName, - /**Function*/ - callback) { - if (arguments.length === 1) { - if (typeof targetFileName === "function") { - callback = targetFileName; - targetFileName = ""; - } - } - - if (!targetFileName && opts.filename) { - targetFileName = opts.filename; - } - - if (!targetFileName) return; - - var zipData = _zip.compressToBuffer(); - - if (zipData) { - var ok = filetools.writeFileTo(targetFileName, zipData, true); - if (typeof callback === "function") callback(!ok ? new Error("failed") : null, ""); - } - }, - writeZipPromise: function ( - /**String*/ - targetFileName, - /* object */ - props) { - const _Object$assign2 = Object.assign({ - overwrite: true - }, props), - overwrite = _Object$assign2.overwrite, - perm = _Object$assign2.perm; - - return new Promise((resolve, reject) => { - // find file name - if (!targetFileName && opts.filename) targetFileName = opts.filename; - if (!targetFileName) reject("ADM-ZIP: ZIP File Name Missing"); - this.toBufferPromise().then(zipData => { - const ret = done => done ? resolve(done) : reject("ADM-ZIP: Wasn't able to write zip file"); - - filetools.writeFileToAsync(targetFileName, zipData, overwrite, perm, ret); - }, reject); - }); - }, - toBufferPromise: function () { - return new Promise((resolve, reject) => { - _zip.toAsyncBuffer(resolve, reject); - }); - }, - - /** - * Returns the content of the entire zip file as a Buffer object - * - * @return Buffer - */ - toBuffer: function ( - /**Function=*/ - onSuccess, - /**Function=*/ - onFail, - /**Function=*/ - onItemStart, - /**Function=*/ - onItemEnd) { - this.valueOf = 2; - - if (typeof onSuccess === "function") { - _zip.toAsyncBuffer(onSuccess, onFail, onItemStart, onItemEnd); - - return null; - } - - return _zip.compressToBuffer(); - } - }; -}; - -/***/ }), - -/***/ "./node_modules/adm-zip/headers/entryHeader.js": -/*!*****************************************************!*\ - !*** ./node_modules/adm-zip/headers/entryHeader.js ***! - \*****************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -var Utils = __webpack_require__(/*! ../util */ "./node_modules/adm-zip/util/index.js"), - Constants = Utils.Constants; -/* The central directory file header */ - - -module.exports = function () { - var _verMade = 20, - // v2.0 - _version = 10, - // v1.0 - _flags = 0, - _method = 0, - _time = 0, - _crc = 0, - _compressedSize = 0, - _size = 0, - _fnameLen = 0, - _extraLen = 0, - _comLen = 0, - _diskStart = 0, - _inattr = 0, - _attr = 0, - _offset = 0; - _verMade |= Utils.isWin ? 0x0a00 : 0x0300; // Set EFS flag since filename and comment fields are all by default encoded using UTF-8. - // Without it file names may be corrupted for other apps when file names use unicode chars - - _flags |= Constants.FLG_EFS; - var _dataHeader = {}; - - function setTime(val) { - val = new Date(val); - _time = (val.getFullYear() - 1980 & 0x7f) << 25 | // b09-16 years from 1980 - val.getMonth() + 1 << 21 | // b05-08 month - val.getDate() << 16 | // b00-04 hour - // 2 bytes time - val.getHours() << 11 | // b11-15 hour - val.getMinutes() << 5 | // b05-10 minute - val.getSeconds() >> 1; // b00-04 seconds divided by 2 - } - - setTime(+new Date()); - return { - get made() { - return _verMade; - }, - - set made(val) { - _verMade = val; - }, - - get version() { - return _version; - }, - - set version(val) { - _version = val; - }, - - get flags() { - return _flags; - }, - - set flags(val) { - _flags = val; - }, - - get method() { - return _method; - }, - - set method(val) { - switch (val) { - case Constants.STORED: - this.version = 10; - - case Constants.DEFLATED: - default: - this.version = 20; - } - - _method = val; - }, - - get time() { - return new Date((_time >> 25 & 0x7f) + 1980, (_time >> 21 & 0x0f) - 1, _time >> 16 & 0x1f, _time >> 11 & 0x1f, _time >> 5 & 0x3f, (_time & 0x1f) << 1); - }, - - set time(val) { - setTime(val); - }, - - get crc() { - return _crc; - }, - - set crc(val) { - _crc = Math.max(0, val) >>> 0; - }, - - get compressedSize() { - return _compressedSize; - }, - - set compressedSize(val) { - _compressedSize = Math.max(0, val) >>> 0; - }, - - get size() { - return _size; - }, - - set size(val) { - _size = Math.max(0, val) >>> 0; - }, - - get fileNameLength() { - return _fnameLen; - }, - - set fileNameLength(val) { - _fnameLen = val; - }, - - get extraLength() { - return _extraLen; - }, - - set extraLength(val) { - _extraLen = val; - }, - - get commentLength() { - return _comLen; - }, - - set commentLength(val) { - _comLen = val; - }, - - get diskNumStart() { - return _diskStart; - }, - - set diskNumStart(val) { - _diskStart = Math.max(0, val) >>> 0; - }, - - get inAttr() { - return _inattr; - }, - - set inAttr(val) { - _inattr = Math.max(0, val) >>> 0; - }, - - get attr() { - return _attr; - }, - - set attr(val) { - _attr = Math.max(0, val) >>> 0; - }, - - // get Unix file permissions - get fileAttr() { - return _attr ? (_attr >>> 0 | 0) >> 16 & 0xfff : 0; - }, - - get offset() { - return _offset; - }, - - set offset(val) { - _offset = Math.max(0, val) >>> 0; - }, - - get encripted() { - return (_flags & 1) === 1; - }, - - get entryHeaderSize() { - return Constants.CENHDR + _fnameLen + _extraLen + _comLen; - }, - - get realDataOffset() { - return _offset + Constants.LOCHDR + _dataHeader.fnameLen + _dataHeader.extraLen; - }, - - get dataHeader() { - return _dataHeader; - }, - - loadDataHeaderFromBinary: function ( - /*Buffer*/ - input) { - var data = input.slice(_offset, _offset + Constants.LOCHDR); // 30 bytes and should start with "PK\003\004" - - if (data.readUInt32LE(0) !== Constants.LOCSIG) { - throw new Error(Utils.Errors.INVALID_LOC); - } - - _dataHeader = { - // version needed to extract - version: data.readUInt16LE(Constants.LOCVER), - // general purpose bit flag - flags: data.readUInt16LE(Constants.LOCFLG), - // compression method - method: data.readUInt16LE(Constants.LOCHOW), - // modification time (2 bytes time, 2 bytes date) - time: data.readUInt32LE(Constants.LOCTIM), - // uncompressed file crc-32 value - crc: data.readUInt32LE(Constants.LOCCRC), - // compressed size - compressedSize: data.readUInt32LE(Constants.LOCSIZ), - // uncompressed size - size: data.readUInt32LE(Constants.LOCLEN), - // filename length - fnameLen: data.readUInt16LE(Constants.LOCNAM), - // extra field length - extraLen: data.readUInt16LE(Constants.LOCEXT) - }; - }, - loadFromBinary: function ( - /*Buffer*/ - data) { - // data should be 46 bytes and start with "PK 01 02" - if (data.length !== Constants.CENHDR || data.readUInt32LE(0) !== Constants.CENSIG) { - throw new Error(Utils.Errors.INVALID_CEN); - } // version made by - - - _verMade = data.readUInt16LE(Constants.CENVEM); // version needed to extract - - _version = data.readUInt16LE(Constants.CENVER); // encrypt, decrypt flags - - _flags = data.readUInt16LE(Constants.CENFLG); // compression method - - _method = data.readUInt16LE(Constants.CENHOW); // modification time (2 bytes time, 2 bytes date) - - _time = data.readUInt32LE(Constants.CENTIM); // uncompressed file crc-32 value - - _crc = data.readUInt32LE(Constants.CENCRC); // compressed size - - _compressedSize = data.readUInt32LE(Constants.CENSIZ); // uncompressed size - - _size = data.readUInt32LE(Constants.CENLEN); // filename length - - _fnameLen = data.readUInt16LE(Constants.CENNAM); // extra field length - - _extraLen = data.readUInt16LE(Constants.CENEXT); // file comment length - - _comLen = data.readUInt16LE(Constants.CENCOM); // volume number start - - _diskStart = data.readUInt16LE(Constants.CENDSK); // internal file attributes - - _inattr = data.readUInt16LE(Constants.CENATT); // external file attributes - - _attr = data.readUInt32LE(Constants.CENATX); // LOC header offset - - _offset = data.readUInt32LE(Constants.CENOFF); - }, - dataHeaderToBinary: function () { - // LOC header size (30 bytes) - var data = Buffer.alloc(Constants.LOCHDR); // "PK\003\004" - - data.writeUInt32LE(Constants.LOCSIG, 0); // version needed to extract - - data.writeUInt16LE(_version, Constants.LOCVER); // general purpose bit flag - - data.writeUInt16LE(_flags, Constants.LOCFLG); // compression method - - data.writeUInt16LE(_method, Constants.LOCHOW); // modification time (2 bytes time, 2 bytes date) - - data.writeUInt32LE(_time, Constants.LOCTIM); // uncompressed file crc-32 value - - data.writeUInt32LE(_crc, Constants.LOCCRC); // compressed size - - data.writeUInt32LE(_compressedSize, Constants.LOCSIZ); // uncompressed size - - data.writeUInt32LE(_size, Constants.LOCLEN); // filename length - - data.writeUInt16LE(_fnameLen, Constants.LOCNAM); // extra field length - - data.writeUInt16LE(_extraLen, Constants.LOCEXT); - return data; - }, - entryHeaderToBinary: function () { - // CEN header size (46 bytes) - var data = Buffer.alloc(Constants.CENHDR + _fnameLen + _extraLen + _comLen); // "PK\001\002" - - data.writeUInt32LE(Constants.CENSIG, 0); // version made by - - data.writeUInt16LE(_verMade, Constants.CENVEM); // version needed to extract - - data.writeUInt16LE(_version, Constants.CENVER); // encrypt, decrypt flags - - data.writeUInt16LE(_flags, Constants.CENFLG); // compression method - - data.writeUInt16LE(_method, Constants.CENHOW); // modification time (2 bytes time, 2 bytes date) - - data.writeUInt32LE(_time, Constants.CENTIM); // uncompressed file crc-32 value - - data.writeUInt32LE(_crc, Constants.CENCRC); // compressed size - - data.writeUInt32LE(_compressedSize, Constants.CENSIZ); // uncompressed size - - data.writeUInt32LE(_size, Constants.CENLEN); // filename length - - data.writeUInt16LE(_fnameLen, Constants.CENNAM); // extra field length - - data.writeUInt16LE(_extraLen, Constants.CENEXT); // file comment length - - data.writeUInt16LE(_comLen, Constants.CENCOM); // volume number start - - data.writeUInt16LE(_diskStart, Constants.CENDSK); // internal file attributes - - data.writeUInt16LE(_inattr, Constants.CENATT); // external file attributes - - data.writeUInt32LE(_attr, Constants.CENATX); // LOC header offset - - data.writeUInt32LE(_offset, Constants.CENOFF); // fill all with - - data.fill(0x00, Constants.CENHDR); - return data; - }, - toJSON: function () { - const bytes = function (nr) { - return nr + " bytes"; - }; - - return { - made: _verMade, - version: _version, - flags: _flags, - method: Utils.methodToString(_method), - time: this.time, - crc: "0x" + _crc.toString(16).toUpperCase(), - compressedSize: bytes(_compressedSize), - size: bytes(_size), - fileNameLength: bytes(_fnameLen), - extraLength: bytes(_extraLen), - commentLength: bytes(_comLen), - diskNumStart: _diskStart, - inAttr: _inattr, - attr: _attr, - offset: _offset, - entryHeaderSize: bytes(Constants.CENHDR + _fnameLen + _extraLen + _comLen) - }; - }, - toString: function () { - return JSON.stringify(this.toJSON(), null, "\t"); - } - }; -}; - -/***/ }), - -/***/ "./node_modules/adm-zip/headers/index.js": -/*!***********************************************!*\ - !*** ./node_modules/adm-zip/headers/index.js ***! - \***********************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -exports.EntryHeader = __webpack_require__(/*! ./entryHeader */ "./node_modules/adm-zip/headers/entryHeader.js"); -exports.MainHeader = __webpack_require__(/*! ./mainHeader */ "./node_modules/adm-zip/headers/mainHeader.js"); - -/***/ }), - -/***/ "./node_modules/adm-zip/headers/mainHeader.js": -/*!****************************************************!*\ - !*** ./node_modules/adm-zip/headers/mainHeader.js ***! - \****************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -var Utils = __webpack_require__(/*! ../util */ "./node_modules/adm-zip/util/index.js"), - Constants = Utils.Constants; -/* The entries in the end of central directory */ - - -module.exports = function () { - var _volumeEntries = 0, - _totalEntries = 0, - _size = 0, - _offset = 0, - _commentLength = 0; - return { - get diskEntries() { - return _volumeEntries; - }, - - set diskEntries( - /*Number*/ - val) { - _volumeEntries = _totalEntries = val; - }, - - get totalEntries() { - return _totalEntries; - }, - - set totalEntries( - /*Number*/ - val) { - _totalEntries = _volumeEntries = val; - }, - - get size() { - return _size; - }, - - set size( - /*Number*/ - val) { - _size = val; - }, - - get offset() { - return _offset; - }, - - set offset( - /*Number*/ - val) { - _offset = val; - }, - - get commentLength() { - return _commentLength; - }, - - set commentLength( - /*Number*/ - val) { - _commentLength = val; - }, - - get mainHeaderSize() { - return Constants.ENDHDR + _commentLength; - }, - - loadFromBinary: function ( - /*Buffer*/ - data) { - // data should be 22 bytes and start with "PK 05 06" - // or be 56+ bytes and start with "PK 06 06" for Zip64 - if ((data.length !== Constants.ENDHDR || data.readUInt32LE(0) !== Constants.ENDSIG) && (data.length < Constants.ZIP64HDR || data.readUInt32LE(0) !== Constants.ZIP64SIG)) { - throw new Error(Utils.Errors.INVALID_END); - } - - if (data.readUInt32LE(0) === Constants.ENDSIG) { - // number of entries on this volume - _volumeEntries = data.readUInt16LE(Constants.ENDSUB); // total number of entries - - _totalEntries = data.readUInt16LE(Constants.ENDTOT); // central directory size in bytes - - _size = data.readUInt32LE(Constants.ENDSIZ); // offset of first CEN header - - _offset = data.readUInt32LE(Constants.ENDOFF); // zip file comment length - - _commentLength = data.readUInt16LE(Constants.ENDCOM); - } else { - // number of entries on this volume - _volumeEntries = Utils.readBigUInt64LE(data, Constants.ZIP64SUB); // total number of entries - - _totalEntries = Utils.readBigUInt64LE(data, Constants.ZIP64TOT); // central directory size in bytes - - _size = Utils.readBigUInt64LE(data, Constants.ZIP64SIZ); // offset of first CEN header - - _offset = Utils.readBigUInt64LE(data, Constants.ZIP64OFF); - _commentLength = 0; - } - }, - toBinary: function () { - var b = Buffer.alloc(Constants.ENDHDR + _commentLength); // "PK 05 06" signature - - b.writeUInt32LE(Constants.ENDSIG, 0); - b.writeUInt32LE(0, 4); // number of entries on this volume - - b.writeUInt16LE(_volumeEntries, Constants.ENDSUB); // total number of entries - - b.writeUInt16LE(_totalEntries, Constants.ENDTOT); // central directory size in bytes - - b.writeUInt32LE(_size, Constants.ENDSIZ); // offset of first CEN header - - b.writeUInt32LE(_offset, Constants.ENDOFF); // zip file comment length - - b.writeUInt16LE(_commentLength, Constants.ENDCOM); // fill comment memory with spaces so no garbage is left there - - b.fill(" ", Constants.ENDHDR); - return b; - }, - toJSON: function () { - // creates 0x0000 style output - const offset = function (nr, len) { - let offs = nr.toString(16).toUpperCase(); - - while (offs.length < len) offs = "0" + offs; - - return "0x" + offs; - }; - - return { - diskEntries: _volumeEntries, - totalEntries: _totalEntries, - size: _size + " bytes", - offset: offset(_offset, 4), - commentLength: _commentLength - }; - }, - toString: function () { - return JSON.stringify(this.toJSON(), null, "\t"); - } - }; -}; - -/***/ }), - -/***/ "./node_modules/adm-zip/methods/deflater.js": -/*!**************************************************!*\ - !*** ./node_modules/adm-zip/methods/deflater.js ***! - \**************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -module.exports = function ( -/*Buffer*/ -inbuf) { - var zlib = __webpack_require__(/*! zlib */ "zlib"); - - var opts = { - chunkSize: (parseInt(inbuf.length / 1024) + 1) * 1024 - }; - return { - deflate: function () { - return zlib.deflateRawSync(inbuf, opts); - }, - deflateAsync: function ( - /*Function*/ - callback) { - var tmp = zlib.createDeflateRaw(opts), - parts = [], - total = 0; - tmp.on("data", function (data) { - parts.push(data); - total += data.length; - }); - tmp.on("end", function () { - var buf = Buffer.alloc(total), - written = 0; - buf.fill(0); - - for (var i = 0; i < parts.length; i++) { - var part = parts[i]; - part.copy(buf, written); - written += part.length; - } - - callback && callback(buf); - }); - tmp.end(inbuf); - } - }; -}; - -/***/ }), - -/***/ "./node_modules/adm-zip/methods/index.js": -/*!***********************************************!*\ - !*** ./node_modules/adm-zip/methods/index.js ***! - \***********************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -exports.Deflater = __webpack_require__(/*! ./deflater */ "./node_modules/adm-zip/methods/deflater.js"); -exports.Inflater = __webpack_require__(/*! ./inflater */ "./node_modules/adm-zip/methods/inflater.js"); -exports.ZipCrypto = __webpack_require__(/*! ./zipcrypto */ "./node_modules/adm-zip/methods/zipcrypto.js"); - -/***/ }), - -/***/ "./node_modules/adm-zip/methods/inflater.js": -/*!**************************************************!*\ - !*** ./node_modules/adm-zip/methods/inflater.js ***! - \**************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -module.exports = function ( -/*Buffer*/ -inbuf) { - var zlib = __webpack_require__(/*! zlib */ "zlib"); - - return { - inflate: function () { - return zlib.inflateRawSync(inbuf); - }, - inflateAsync: function ( - /*Function*/ - callback) { - var tmp = zlib.createInflateRaw(), - parts = [], - total = 0; - tmp.on("data", function (data) { - parts.push(data); - total += data.length; - }); - tmp.on("end", function () { - var buf = Buffer.alloc(total), - written = 0; - buf.fill(0); - - for (var i = 0; i < parts.length; i++) { - var part = parts[i]; - part.copy(buf, written); - written += part.length; - } - - callback && callback(buf); - }); - tmp.end(inbuf); - } - }; -}; - -/***/ }), - -/***/ "./node_modules/adm-zip/methods/zipcrypto.js": -/*!***************************************************!*\ - !*** ./node_modules/adm-zip/methods/zipcrypto.js ***! - \***************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - // node crypt, we use it for generate salt -// eslint-disable-next-line node/no-unsupported-features/node-builtins - -const _require = __webpack_require__(/*! crypto */ "crypto"), - randomFillSync = _require.randomFillSync; // generate CRC32 lookup table - - -const crctable = new Uint32Array(256).map((t, crc) => { - for (let j = 0; j < 8; j++) { - if (0 !== (crc & 1)) { - crc = crc >>> 1 ^ 0xedb88320; - } else { - crc >>>= 1; - } - } - - return crc >>> 0; -}); // C-style uInt32 Multiply (discards higher bits, when JS multiply discards lower bits) - -const uMul = (a, b) => Math.imul(a, b) >>> 0; // crc32 byte single update (actually same function is part of utils.crc32 function :) ) - - -const crc32update = (pCrc32, bval) => { - return crctable[(pCrc32 ^ bval) & 0xff] ^ pCrc32 >>> 8; -}; // function for generating salt for encrytion header - - -const genSalt = () => { - if ("function" === typeof randomFillSync) { - return randomFillSync(Buffer.alloc(12)); - } else { - // fallback if function is not defined - return genSalt.node(); - } -}; // salt generation with node random function (mainly as fallback) - - -genSalt.node = () => { - const salt = Buffer.alloc(12); - const len = salt.length; - - for (let i = 0; i < len; i++) salt[i] = Math.random() * 256 & 0xff; - - return salt; -}; // general config - - -const config = { - genSalt -}; // Class Initkeys handles same basic ops with keys - -function Initkeys(pw) { - const pass = Buffer.isBuffer(pw) ? pw : Buffer.from(pw); - this.keys = new Uint32Array([0x12345678, 0x23456789, 0x34567890]); - - for (let i = 0; i < pass.length; i++) { - this.updateKeys(pass[i]); - } -} - -Initkeys.prototype.updateKeys = function (byteValue) { - const keys = this.keys; - keys[0] = crc32update(keys[0], byteValue); - keys[1] += keys[0] & 0xff; - keys[1] = uMul(keys[1], 134775813) + 1; - keys[2] = crc32update(keys[2], keys[1] >>> 24); - return byteValue; -}; - -Initkeys.prototype.next = function () { - const k = (this.keys[2] | 2) >>> 0; // key - - return uMul(k, k ^ 1) >> 8 & 0xff; // decode -}; - -function make_decrypter( -/*Buffer*/ -pwd) { - // 1. Stage initialize key - const keys = new Initkeys(pwd); // return decrypter function - - return function ( - /*Buffer*/ - data) { - // result - we create new Buffer for results - const result = Buffer.alloc(data.length); - let pos = 0; // process input data - - for (let c of data) { - //c ^= keys.next(); - //result[pos++] = c; // decode & Save Value - result[pos++] = keys.updateKeys(c ^ keys.next()); // update keys with decoded byte - } - - return result; - }; -} - -function make_encrypter( -/*Buffer*/ -pwd) { - // 1. Stage initialize key - const keys = new Initkeys(pwd); // return encrypting function, result and pos is here so we dont have to merge buffers later - - return function ( - /*Buffer*/ - data, - /*Buffer*/ - result, - /* Number */ - pos = 0) { - // result - we create new Buffer for results - if (!result) result = Buffer.alloc(data.length); // process input data - - for (let c of data) { - const k = keys.next(); // save key byte - - result[pos++] = c ^ k; // save val - - keys.updateKeys(c); // update keys with decoded byte - } - - return result; - }; -} - -function decrypt( -/*Buffer*/ -data, -/*Object*/ -header, -/*String, Buffer*/ -pwd) { - if (!data || !Buffer.isBuffer(data) || data.length < 12) { - return Buffer.alloc(0); - } // 1. We Initialize and generate decrypting function - - - const decrypter = make_decrypter(pwd); // 2. decrypt salt what is always 12 bytes and is a part of file content - - const salt = decrypter(data.slice(0, 12)); // 3. does password meet expectations - - if (salt[11] !== header.crc >>> 24) { - throw "ADM-ZIP: Wrong Password"; - } // 4. decode content - - - return decrypter(data.slice(12)); -} // lets add way to populate salt, NOT RECOMMENDED for production but maybe useful for testing general functionality - - -function _salter(data) { - if (Buffer.isBuffer(data) && data.length >= 12) { - // be aware - currently salting buffer data is modified - config.genSalt = function () { - return data.slice(0, 12); - }; - } else if (data === "node") { - // test salt generation with node random function - config.genSalt = genSalt.node; - } else { - // if value is not acceptable config gets reset. - config.genSalt = genSalt; - } -} - -function encrypt( -/*Buffer*/ -data, -/*Object*/ -header, -/*String, Buffer*/ -pwd, -/*Boolean*/ -oldlike = false) { - // 1. test data if data is not Buffer we make buffer from it - if (data == null) data = Buffer.alloc(0); // if data is not buffer be make buffer from it - - if (!Buffer.isBuffer(data)) data = Buffer.from(data.toString()); // 2. We Initialize and generate encrypting function - - const encrypter = make_encrypter(pwd); // 3. generate salt (12-bytes of random data) - - const salt = config.genSalt(); - salt[11] = header.crc >>> 24 & 0xff; // old implementations (before PKZip 2.04g) used two byte check - - if (oldlike) salt[10] = header.crc >>> 16 & 0xff; // 4. create output - - const result = Buffer.alloc(data.length + 12); - encrypter(salt, result); // finally encode content - - return encrypter(data, result, 12); -} - -module.exports = { - decrypt, - encrypt, - _salter -}; - -/***/ }), - -/***/ "./node_modules/adm-zip/util/constants.js": -/*!************************************************!*\ - !*** ./node_modules/adm-zip/util/constants.js ***! - \************************************************/ -/*! no static exports found */ -/***/ (function(module, exports) { - -module.exports = { - /* The local file header */ - LOCHDR: 30, - // LOC header size - LOCSIG: 0x04034b50, - // "PK\003\004" - LOCVER: 4, - // version needed to extract - LOCFLG: 6, - // general purpose bit flag - LOCHOW: 8, - // compression method - LOCTIM: 10, - // modification time (2 bytes time, 2 bytes date) - LOCCRC: 14, - // uncompressed file crc-32 value - LOCSIZ: 18, - // compressed size - LOCLEN: 22, - // uncompressed size - LOCNAM: 26, - // filename length - LOCEXT: 28, - // extra field length - - /* The Data descriptor */ - EXTSIG: 0x08074b50, - // "PK\007\008" - EXTHDR: 16, - // EXT header size - EXTCRC: 4, - // uncompressed file crc-32 value - EXTSIZ: 8, - // compressed size - EXTLEN: 12, - // uncompressed size - - /* The central directory file header */ - CENHDR: 46, - // CEN header size - CENSIG: 0x02014b50, - // "PK\001\002" - CENVEM: 4, - // version made by - CENVER: 6, - // version needed to extract - CENFLG: 8, - // encrypt, decrypt flags - CENHOW: 10, - // compression method - CENTIM: 12, - // modification time (2 bytes time, 2 bytes date) - CENCRC: 16, - // uncompressed file crc-32 value - CENSIZ: 20, - // compressed size - CENLEN: 24, - // uncompressed size - CENNAM: 28, - // filename length - CENEXT: 30, - // extra field length - CENCOM: 32, - // file comment length - CENDSK: 34, - // volume number start - CENATT: 36, - // internal file attributes - CENATX: 38, - // external file attributes (host system dependent) - CENOFF: 42, - // LOC header offset - - /* The entries in the end of central directory */ - ENDHDR: 22, - // END header size - ENDSIG: 0x06054b50, - // "PK\005\006" - ENDSUB: 8, - // number of entries on this disk - ENDTOT: 10, - // total number of entries - ENDSIZ: 12, - // central directory size in bytes - ENDOFF: 16, - // offset of first CEN header - ENDCOM: 20, - // zip file comment length - END64HDR: 20, - // zip64 END header size - END64SIG: 0x07064b50, - // zip64 Locator signature, "PK\006\007" - END64START: 4, - // number of the disk with the start of the zip64 - END64OFF: 8, - // relative offset of the zip64 end of central directory - END64NUMDISKS: 16, - // total number of disks - ZIP64SIG: 0x06064b50, - // zip64 signature, "PK\006\006" - ZIP64HDR: 56, - // zip64 record minimum size - ZIP64LEAD: 12, - // leading bytes at the start of the record, not counted by the value stored in ZIP64SIZE - ZIP64SIZE: 4, - // zip64 size of the central directory record - ZIP64VEM: 12, - // zip64 version made by - ZIP64VER: 14, - // zip64 version needed to extract - ZIP64DSK: 16, - // zip64 number of this disk - ZIP64DSKDIR: 20, - // number of the disk with the start of the record directory - ZIP64SUB: 24, - // number of entries on this disk - ZIP64TOT: 32, - // total number of entries - ZIP64SIZB: 40, - // zip64 central directory size in bytes - ZIP64OFF: 48, - // offset of start of central directory with respect to the starting disk number - ZIP64EXTRA: 56, - // extensible data sector - - /* Compression methods */ - STORED: 0, - // no compression - SHRUNK: 1, - // shrunk - REDUCED1: 2, - // reduced with compression factor 1 - REDUCED2: 3, - // reduced with compression factor 2 - REDUCED3: 4, - // reduced with compression factor 3 - REDUCED4: 5, - // reduced with compression factor 4 - IMPLODED: 6, - // imploded - // 7 reserved for Tokenizing compression algorithm - DEFLATED: 8, - // deflated - ENHANCED_DEFLATED: 9, - // enhanced deflated - PKWARE: 10, - // PKWare DCL imploded - // 11 reserved by PKWARE - BZIP2: 12, - // compressed using BZIP2 - // 13 reserved by PKWARE - LZMA: 14, - // LZMA - // 15-17 reserved by PKWARE - IBM_TERSE: 18, - // compressed using IBM TERSE - IBM_LZ77: 19, - // IBM LZ77 z - AES_ENCRYPT: 99, - // WinZIP AES encryption method - - /* General purpose bit flag */ - // values can obtained with expression 2**bitnr - FLG_ENC: 1, - // Bit 0: encrypted file - FLG_COMP1: 2, - // Bit 1, compression option - FLG_COMP2: 4, - // Bit 2, compression option - FLG_DESC: 8, - // Bit 3, data descriptor - FLG_ENH: 16, - // Bit 4, enhanced deflating - FLG_PATCH: 32, - // Bit 5, indicates that the file is compressed patched data. - FLG_STR: 64, - // Bit 6, strong encryption (patented) - // Bits 7-10: Currently unused. - FLG_EFS: 2048, - // Bit 11: Language encoding flag (EFS) - // Bit 12: Reserved by PKWARE for enhanced compression. - // Bit 13: encrypted the Central Directory (patented). - // Bits 14-15: Reserved by PKWARE. - FLG_MSK: 4096, - // mask header values - - /* Load type */ - FILE: 2, - BUFFER: 1, - NONE: 0, - - /* 4.5 Extensible data fields */ - EF_ID: 0, - EF_SIZE: 2, - - /* Header IDs */ - ID_ZIP64: 0x0001, - ID_AVINFO: 0x0007, - ID_PFS: 0x0008, - ID_OS2: 0x0009, - ID_NTFS: 0x000a, - ID_OPENVMS: 0x000c, - ID_UNIX: 0x000d, - ID_FORK: 0x000e, - ID_PATCH: 0x000f, - ID_X509_PKCS7: 0x0014, - ID_X509_CERTID_F: 0x0015, - ID_X509_CERTID_C: 0x0016, - ID_STRONGENC: 0x0017, - ID_RECORD_MGT: 0x0018, - ID_X509_PKCS7_RL: 0x0019, - ID_IBM1: 0x0065, - ID_IBM2: 0x0066, - ID_POSZIP: 0x4690, - EF_ZIP64_OR_32: 0xffffffff, - EF_ZIP64_OR_16: 0xffff, - EF_ZIP64_SUNCOMP: 0, - EF_ZIP64_SCOMP: 8, - EF_ZIP64_RHO: 16, - EF_ZIP64_DSN: 24 -}; - -/***/ }), - -/***/ "./node_modules/adm-zip/util/errors.js": -/*!*********************************************!*\ - !*** ./node_modules/adm-zip/util/errors.js ***! - \*********************************************/ -/*! no static exports found */ -/***/ (function(module, exports) { - -module.exports = { - /* Header error messages */ - INVALID_LOC: "Invalid LOC header (bad signature)", - INVALID_CEN: "Invalid CEN header (bad signature)", - INVALID_END: "Invalid END header (bad signature)", - - /* ZipEntry error messages*/ - NO_DATA: "Nothing to decompress", - BAD_CRC: "CRC32 checksum failed", - FILE_IN_THE_WAY: "There is a file in the way: %s", - UNKNOWN_METHOD: "Invalid/unsupported compression method", - - /* Inflater error messages */ - AVAIL_DATA: "inflate::Available inflate data did not terminate", - INVALID_DISTANCE: "inflate::Invalid literal/length or distance code in fixed or dynamic block", - TO_MANY_CODES: "inflate::Dynamic block code description: too many length or distance codes", - INVALID_REPEAT_LEN: "inflate::Dynamic block code description: repeat more than specified lengths", - INVALID_REPEAT_FIRST: "inflate::Dynamic block code description: repeat lengths with no first length", - INCOMPLETE_CODES: "inflate::Dynamic block code description: code lengths codes incomplete", - INVALID_DYN_DISTANCE: "inflate::Dynamic block code description: invalid distance code lengths", - INVALID_CODES_LEN: "inflate::Dynamic block code description: invalid literal/length code lengths", - INVALID_STORE_BLOCK: "inflate::Stored block length did not match one's complement", - INVALID_BLOCK_TYPE: "inflate::Invalid block type (type == 3)", - - /* ADM-ZIP error messages */ - CANT_EXTRACT_FILE: "Could not extract the file", - CANT_OVERRIDE: "Target file already exists", - NO_ZIP: "No zip file was loaded", - NO_ENTRY: "Entry doesn't exist", - DIRECTORY_CONTENT_ERROR: "A directory cannot have content", - FILE_NOT_FOUND: "File not found: %s", - NOT_IMPLEMENTED: "Not implemented", - INVALID_FILENAME: "Invalid filename", - INVALID_FORMAT: "Invalid or unsupported zip format. No END header found" -}; - -/***/ }), - -/***/ "./node_modules/adm-zip/util/fattr.js": -/*!********************************************!*\ - !*** ./node_modules/adm-zip/util/fattr.js ***! - \********************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -const fs = __webpack_require__(/*! ./fileSystem */ "./node_modules/adm-zip/util/fileSystem.js").require(); - -const pth = __webpack_require__(/*! path */ "path"); - -fs.existsSync = fs.existsSync || pth.existsSync; - -module.exports = function ( -/*String*/ -path) { - var _path = path || "", - _obj = newAttr(), - _stat = null; - - function newAttr() { - return { - directory: false, - readonly: false, - hidden: false, - executable: false, - mtime: 0, - atime: 0 - }; - } - - if (_path && fs.existsSync(_path)) { - _stat = fs.statSync(_path); - _obj.directory = _stat.isDirectory(); - _obj.mtime = _stat.mtime; - _obj.atime = _stat.atime; - _obj.executable = (0o111 & _stat.mode) !== 0; // file is executable who ever har right not just owner - - _obj.readonly = (0o200 & _stat.mode) === 0; // readonly if owner has no write right - - _obj.hidden = pth.basename(_path)[0] === "."; - } else { - console.warn("Invalid path: " + _path); - } - - return { - get directory() { - return _obj.directory; - }, - - get readOnly() { - return _obj.readonly; - }, - - get hidden() { - return _obj.hidden; - }, - - get mtime() { - return _obj.mtime; - }, - - get atime() { - return _obj.atime; - }, - - get executable() { - return _obj.executable; - }, - - decodeAttributes: function () {}, - encodeAttributes: function () {}, - toJSON: function () { - return { - path: _path, - isDirectory: _obj.directory, - isReadOnly: _obj.readonly, - isHidden: _obj.hidden, - isExecutable: _obj.executable, - mTime: _obj.mtime, - aTime: _obj.atime - }; - }, - toString: function () { - return JSON.stringify(this.toJSON(), null, "\t"); - } - }; -}; - -/***/ }), - -/***/ "./node_modules/adm-zip/util/fileSystem.js": -/*!*************************************************!*\ - !*** ./node_modules/adm-zip/util/fileSystem.js ***! - \*************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -exports.require = function () { - if (typeof process === "object" && process.versions && process.versions["electron"]) { - try { - const originalFs = __webpack_require__(!(function webpackMissingModule() { var e = new Error("Cannot find module 'original-fs'"); e.code = 'MODULE_NOT_FOUND'; throw e; }())); - - if (Object.keys(originalFs).length > 0) { - return originalFs; - } - } catch (e) {} - } - - return __webpack_require__(/*! fs */ "fs"); -}; - -/***/ }), - -/***/ "./node_modules/adm-zip/util/index.js": -/*!********************************************!*\ - !*** ./node_modules/adm-zip/util/index.js ***! - \********************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -module.exports = __webpack_require__(/*! ./utils */ "./node_modules/adm-zip/util/utils.js"); -module.exports.Constants = __webpack_require__(/*! ./constants */ "./node_modules/adm-zip/util/constants.js"); -module.exports.Errors = __webpack_require__(/*! ./errors */ "./node_modules/adm-zip/util/errors.js"); -module.exports.FileAttr = __webpack_require__(/*! ./fattr */ "./node_modules/adm-zip/util/fattr.js"); - -/***/ }), - -/***/ "./node_modules/adm-zip/util/utils.js": -/*!********************************************!*\ - !*** ./node_modules/adm-zip/util/utils.js ***! - \********************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -const fsystem = __webpack_require__(/*! ./fileSystem */ "./node_modules/adm-zip/util/fileSystem.js").require(); - -const pth = __webpack_require__(/*! path */ "path"); - -const Constants = __webpack_require__(/*! ./constants */ "./node_modules/adm-zip/util/constants.js"); - -const isWin = typeof process === "object" && "win32" === process.platform; - -const is_Obj = obj => obj && typeof obj === "object"; // generate CRC32 lookup table - - -const crcTable = new Uint32Array(256).map((t, c) => { - for (let k = 0; k < 8; k++) { - if ((c & 1) !== 0) { - c = 0xedb88320 ^ c >>> 1; - } else { - c >>>= 1; - } - } - - return c >>> 0; -}); // UTILS functions - -function Utils(opts) { - this.sep = pth.sep; - this.fs = fsystem; - - if (is_Obj(opts)) { - // custom filesystem - if (is_Obj(opts.fs) && typeof opts.fs.statSync === "function") { - this.fs = opts.fs; - } - } -} - -module.exports = Utils; // INSTANCED functions - -Utils.prototype.makeDir = function ( -/*String*/ -folder) { - const self = this; // Sync - make directories tree - - function mkdirSync( - /*String*/ - fpath) { - let resolvedPath = fpath.split(self.sep)[0]; - fpath.split(self.sep).forEach(function (name) { - if (!name || name.substr(-1, 1) === ":") return; - resolvedPath += self.sep + name; - var stat; - - try { - stat = self.fs.statSync(resolvedPath); - } catch (e) { - self.fs.mkdirSync(resolvedPath); - } - - if (stat && stat.isFile()) throw Errors.FILE_IN_THE_WAY.replace("%s", resolvedPath); - }); - } - - mkdirSync(folder); -}; - -Utils.prototype.writeFileTo = function ( -/*String*/ -path, -/*Buffer*/ -content, -/*Boolean*/ -overwrite, -/*Number*/ -attr) { - const self = this; - - if (self.fs.existsSync(path)) { - if (!overwrite) return false; // cannot overwrite - - var stat = self.fs.statSync(path); - - if (stat.isDirectory()) { - return false; - } - } - - var folder = pth.dirname(path); - - if (!self.fs.existsSync(folder)) { - self.makeDir(folder); - } - - var fd; - - try { - fd = self.fs.openSync(path, "w", 438); // 0666 - } catch (e) { - self.fs.chmodSync(path, 438); - fd = self.fs.openSync(path, "w", 438); - } - - if (fd) { - try { - self.fs.writeSync(fd, content, 0, content.length, 0); - } finally { - self.fs.closeSync(fd); - } - } - - self.fs.chmodSync(path, attr || 438); - return true; -}; - -Utils.prototype.writeFileToAsync = function ( -/*String*/ -path, -/*Buffer*/ -content, -/*Boolean*/ -overwrite, -/*Number*/ -attr, -/*Function*/ -callback) { - if (typeof attr === "function") { - callback = attr; - attr = undefined; - } - - const self = this; - self.fs.exists(path, function (exist) { - if (exist && !overwrite) return callback(false); - self.fs.stat(path, function (err, stat) { - if (exist && stat.isDirectory()) { - return callback(false); - } - - var folder = pth.dirname(path); - self.fs.exists(folder, function (exists) { - if (!exists) self.makeDir(folder); - self.fs.open(path, "w", 438, function (err, fd) { - if (err) { - self.fs.chmod(path, 438, function () { - self.fs.open(path, "w", 438, function (err, fd) { - self.fs.write(fd, content, 0, content.length, 0, function () { - self.fs.close(fd, function () { - self.fs.chmod(path, attr || 438, function () { - callback(true); - }); - }); - }); - }); - }); - } else if (fd) { - self.fs.write(fd, content, 0, content.length, 0, function () { - self.fs.close(fd, function () { - self.fs.chmod(path, attr || 438, function () { - callback(true); - }); - }); - }); - } else { - self.fs.chmod(path, attr || 438, function () { - callback(true); - }); - } - }); - }); - }); - }); -}; - -Utils.prototype.findFiles = function ( -/*String*/ -path) { - const self = this; - - function findSync( - /*String*/ - dir, - /*RegExp*/ - pattern, - /*Boolean*/ - recursive) { - if (typeof pattern === "boolean") { - recursive = pattern; - pattern = undefined; - } - - let files = []; - self.fs.readdirSync(dir).forEach(function (file) { - var path = pth.join(dir, file); - if (self.fs.statSync(path).isDirectory() && recursive) files = files.concat(findSync(path, pattern, recursive)); - - if (!pattern || pattern.test(path)) { - files.push(pth.normalize(path) + (self.fs.statSync(path).isDirectory() ? self.sep : "")); - } - }); - return files; - } - - return findSync(path, undefined, true); -}; - -Utils.prototype.getAttributes = function () {}; - -Utils.prototype.setAttributes = function () {}; // STATIC functions -// crc32 single update (it is part of crc32) - - -Utils.crc32update = function (crc, byte) { - return crcTable[(crc ^ byte) & 0xff] ^ crc >>> 8; -}; - -Utils.crc32 = function (buf) { - if (typeof buf === "string") { - buf = Buffer.from(buf, "utf8"); - } // Generate crcTable - - - if (!crcTable.length) genCRCTable(); - let len = buf.length; - let crc = ~0; - - for (let off = 0; off < len;) crc = Utils.crc32update(crc, buf[off++]); // xor and cast as uint32 number - - - return ~crc >>> 0; -}; - -Utils.methodToString = function ( -/*Number*/ -method) { - switch (method) { - case Constants.STORED: - return "STORED (" + method + ")"; - - case Constants.DEFLATED: - return "DEFLATED (" + method + ")"; - - default: - return "UNSUPPORTED (" + method + ")"; - } -}; // removes ".." style path elements - - -Utils.canonical = function ( -/*string*/ -path) { - if (!path) return ""; // trick normalize think path is absolute - - var safeSuffix = pth.posix.normalize("/" + path.split("\\").join("/")); - return pth.join(".", safeSuffix); -}; // make abolute paths taking prefix as root folder - - -Utils.sanitize = function ( -/*string*/ -prefix, -/*string*/ -name) { - prefix = pth.resolve(pth.normalize(prefix)); - var parts = name.split("/"); - - for (var i = 0, l = parts.length; i < l; i++) { - var path = pth.normalize(pth.join(prefix, parts.slice(i, l).join(pth.sep))); - - if (path.indexOf(prefix) === 0) { - return path; - } - } - - return pth.normalize(pth.join(prefix, pth.basename(name))); -}; // converts buffer, Uint8Array, string types to buffer - - -Utils.toBuffer = function toBuffer( -/*buffer, Uint8Array, string*/ -input) { - if (Buffer.isBuffer(input)) { - return input; - } else if (input instanceof Uint8Array) { - return Buffer.from(input); - } else { - // expect string all other values are invalid and return empty buffer - return typeof input === "string" ? Buffer.from(input, "utf8") : Buffer.alloc(0); - } -}; - -Utils.readBigUInt64LE = function ( -/*Buffer*/ -buffer, -/*int*/ -index) { - var slice = Buffer.from(buffer.slice(index, index + 8)); - slice.swap64(); - return parseInt(`0x${slice.toString("hex")}`); -}; - -Utils.isWin = isWin; // Do we have windows system - -Utils.crcTable = crcTable; - -/***/ }), - -/***/ "./node_modules/adm-zip/zipEntry.js": -/*!******************************************!*\ - !*** ./node_modules/adm-zip/zipEntry.js ***! - \******************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -var Utils = __webpack_require__(/*! ./util */ "./node_modules/adm-zip/util/index.js"), - Headers = __webpack_require__(/*! ./headers */ "./node_modules/adm-zip/headers/index.js"), - Constants = Utils.Constants, - Methods = __webpack_require__(/*! ./methods */ "./node_modules/adm-zip/methods/index.js"); - -module.exports = function ( -/*Buffer*/ -input) { - var _entryHeader = new Headers.EntryHeader(), - _entryName = Buffer.alloc(0), - _comment = Buffer.alloc(0), - _isDirectory = false, - uncompressedData = null, - _extra = Buffer.alloc(0); - - function getCompressedDataFromZip() { - if (!input || !Buffer.isBuffer(input)) { - return Buffer.alloc(0); - } - - _entryHeader.loadDataHeaderFromBinary(input); - - return input.slice(_entryHeader.realDataOffset, _entryHeader.realDataOffset + _entryHeader.compressedSize); - } - - function crc32OK(data) { - // if bit 3 (0x08) of the general-purpose flags field is set, then the CRC-32 and file sizes are not known when the header is written - if ((_entryHeader.flags & 0x8) !== 0x8) { - if (Utils.crc32(data) !== _entryHeader.dataHeader.crc) { - return false; - } - } else {// @TODO: load and check data descriptor header - // The fields in the local header are filled with zero, and the CRC-32 and size are appended in a 12-byte structure - // (optionally preceded by a 4-byte signature) immediately after the compressed data: - } - - return true; - } - - function decompress( - /*Boolean*/ - async, - /*Function*/ - callback, - /*String, Buffer*/ - pass) { - if (typeof callback === "undefined" && typeof async === "string") { - pass = async; - async = void 0; - } - - if (_isDirectory) { - if (async && callback) { - callback(Buffer.alloc(0), Utils.Errors.DIRECTORY_CONTENT_ERROR); //si added error. - } - - return Buffer.alloc(0); - } - - var compressedData = getCompressedDataFromZip(); - - if (compressedData.length === 0) { - // File is empty, nothing to decompress. - if (async && callback) callback(compressedData); - return compressedData; - } - - if (_entryHeader.encripted) { - if ("string" !== typeof pass && !Buffer.isBuffer(pass)) { - throw new Error("ADM-ZIP: Incompatible password parameter"); - } - - compressedData = Methods.ZipCrypto.decrypt(compressedData, _entryHeader, pass); - } - - var data = Buffer.alloc(_entryHeader.size); - - switch (_entryHeader.method) { - case Utils.Constants.STORED: - compressedData.copy(data); - - if (!crc32OK(data)) { - if (async && callback) callback(data, Utils.Errors.BAD_CRC); //si added error - - throw new Error(Utils.Errors.BAD_CRC); - } else { - //si added otherwise did not seem to return data. - if (async && callback) callback(data); - return data; - } - - case Utils.Constants.DEFLATED: - var inflater = new Methods.Inflater(compressedData); - - if (!async) { - const result = inflater.inflate(data); - result.copy(data, 0); - - if (!crc32OK(data)) { - throw new Error(Utils.Errors.BAD_CRC + " " + _entryName.toString()); - } - - return data; - } else { - inflater.inflateAsync(function (result) { - result.copy(result, 0); - - if (callback) { - if (!crc32OK(result)) { - callback(result, Utils.Errors.BAD_CRC); //si added error - } else { - callback(result); - } - } - }); - } - - break; - - default: - if (async && callback) callback(Buffer.alloc(0), Utils.Errors.UNKNOWN_METHOD); - throw new Error(Utils.Errors.UNKNOWN_METHOD); - } - } - - function compress( - /*Boolean*/ - async, - /*Function*/ - callback) { - if ((!uncompressedData || !uncompressedData.length) && Buffer.isBuffer(input)) { - // no data set or the data wasn't changed to require recompression - if (async && callback) callback(getCompressedDataFromZip()); - return getCompressedDataFromZip(); - } - - if (uncompressedData.length && !_isDirectory) { - var compressedData; // Local file header - - switch (_entryHeader.method) { - case Utils.Constants.STORED: - _entryHeader.compressedSize = _entryHeader.size; - compressedData = Buffer.alloc(uncompressedData.length); - uncompressedData.copy(compressedData); - if (async && callback) callback(compressedData); - return compressedData; - - default: - case Utils.Constants.DEFLATED: - var deflater = new Methods.Deflater(uncompressedData); - - if (!async) { - var deflated = deflater.deflate(); - _entryHeader.compressedSize = deflated.length; - return deflated; - } else { - deflater.deflateAsync(function (data) { - compressedData = Buffer.alloc(data.length); - _entryHeader.compressedSize = data.length; - data.copy(compressedData); - callback && callback(compressedData); - }); - } - - deflater = null; - break; - } - } else if (async && callback) { - callback(Buffer.alloc(0)); - } else { - return Buffer.alloc(0); - } - } - - function readUInt64LE(buffer, offset) { - return (buffer.readUInt32LE(offset + 4) << 4) + buffer.readUInt32LE(offset); - } - - function parseExtra(data) { - var offset = 0; - var signature, size, part; - - while (offset < data.length) { - signature = data.readUInt16LE(offset); - offset += 2; - size = data.readUInt16LE(offset); - offset += 2; - part = data.slice(offset, offset + size); - offset += size; - - if (Constants.ID_ZIP64 === signature) { - parseZip64ExtendedInformation(part); - } - } - } //Override header field values with values from the ZIP64 extra field - - - function parseZip64ExtendedInformation(data) { - var size, compressedSize, offset, diskNumStart; - - if (data.length >= Constants.EF_ZIP64_SCOMP) { - size = readUInt64LE(data, Constants.EF_ZIP64_SUNCOMP); - - if (_entryHeader.size === Constants.EF_ZIP64_OR_32) { - _entryHeader.size = size; - } - } - - if (data.length >= Constants.EF_ZIP64_RHO) { - compressedSize = readUInt64LE(data, Constants.EF_ZIP64_SCOMP); - - if (_entryHeader.compressedSize === Constants.EF_ZIP64_OR_32) { - _entryHeader.compressedSize = compressedSize; - } - } - - if (data.length >= Constants.EF_ZIP64_DSN) { - offset = readUInt64LE(data, Constants.EF_ZIP64_RHO); - - if (_entryHeader.offset === Constants.EF_ZIP64_OR_32) { - _entryHeader.offset = offset; - } - } - - if (data.length >= Constants.EF_ZIP64_DSN + 4) { - diskNumStart = data.readUInt32LE(Constants.EF_ZIP64_DSN); - - if (_entryHeader.diskNumStart === Constants.EF_ZIP64_OR_16) { - _entryHeader.diskNumStart = diskNumStart; - } - } - } - - return { - get entryName() { - return _entryName.toString(); - }, - - get rawEntryName() { - return _entryName; - }, - - set entryName(val) { - _entryName = Utils.toBuffer(val); - var lastChar = _entryName[_entryName.length - 1]; - _isDirectory = lastChar === 47 || lastChar === 92; - _entryHeader.fileNameLength = _entryName.length; - }, - - get extra() { - return _extra; - }, - - set extra(val) { - _extra = val; - _entryHeader.extraLength = val.length; - parseExtra(val); - }, - - get comment() { - return _comment.toString(); - }, - - set comment(val) { - _comment = Utils.toBuffer(val); - _entryHeader.commentLength = _comment.length; - }, - - get name() { - var n = _entryName.toString(); - - return _isDirectory ? n.substr(n.length - 1).split("/").pop() : n.split("/").pop(); - }, - - get isDirectory() { - return _isDirectory; - }, - - getCompressedData: function () { - return compress(false, null); - }, - getCompressedDataAsync: function ( - /*Function*/ - callback) { - compress(true, callback); - }, - setData: function (value) { - uncompressedData = Utils.toBuffer(value); - - if (!_isDirectory && uncompressedData.length) { - _entryHeader.size = uncompressedData.length; - _entryHeader.method = Utils.Constants.DEFLATED; - _entryHeader.crc = Utils.crc32(value); - _entryHeader.changed = true; - } else { - // folders and blank files should be stored - _entryHeader.method = Utils.Constants.STORED; - } - }, - getData: function (pass) { - if (_entryHeader.changed) { - return uncompressedData; - } else { - return decompress(false, null, pass); - } - }, - getDataAsync: function ( - /*Function*/ - callback, pass) { - if (_entryHeader.changed) { - callback(uncompressedData); - } else { - decompress(true, callback, pass); - } - }, - - set attr(attr) { - _entryHeader.attr = attr; - }, - - get attr() { - return _entryHeader.attr; - }, - - set header( - /*Buffer*/ - data) { - _entryHeader.loadFromBinary(data); - }, - - get header() { - return _entryHeader; - }, - - packHeader: function () { - // 1. create header (buffer) - var header = _entryHeader.entryHeaderToBinary(); - - var addpos = Utils.Constants.CENHDR; // 2. add file name - - _entryName.copy(header, addpos); - - addpos += _entryName.length; // 3. add extra data - - if (_entryHeader.extraLength) { - _extra.copy(header, addpos); - - addpos += _entryHeader.extraLength; - } // 4. add file comment - - - if (_entryHeader.commentLength) { - _comment.copy(header, addpos); - } - - return header; - }, - toJSON: function () { - const bytes = function (nr) { - return "<" + (nr && nr.length + " bytes buffer" || "null") + ">"; - }; - - return { - entryName: this.entryName, - name: this.name, - comment: this.comment, - isDirectory: this.isDirectory, - header: _entryHeader.toJSON(), - compressedData: bytes(input), - data: bytes(uncompressedData) - }; - }, - toString: function () { - return JSON.stringify(this.toJSON(), null, "\t"); - } - }; -}; - -/***/ }), - -/***/ "./node_modules/adm-zip/zipFile.js": -/*!*****************************************!*\ - !*** ./node_modules/adm-zip/zipFile.js ***! - \*****************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -const ZipEntry = __webpack_require__(/*! ./zipEntry */ "./node_modules/adm-zip/zipEntry.js"); - -const Headers = __webpack_require__(/*! ./headers */ "./node_modules/adm-zip/headers/index.js"); - -const Utils = __webpack_require__(/*! ./util */ "./node_modules/adm-zip/util/index.js"); - -module.exports = function ( -/*Buffer|null*/ -inBuffer, -/** object */ -options) { - var entryList = [], - entryTable = {}, - _comment = Buffer.alloc(0), - mainHeader = new Headers.MainHeader(), - loadedEntries = false; // assign options - - - const opts = Object.assign(Object.create(null), options); - const noSort = opts.noSort; - - if (inBuffer) { - // is a memory buffer - readMainHeader(opts.readEntries); - } else { - // none. is a new file - loadedEntries = true; - } - - function iterateEntries(callback) { - const totalEntries = mainHeader.diskEntries; // total number of entries - - let index = mainHeader.offset; // offset of first CEN header - - for (let i = 0; i < totalEntries; i++) { - let tmp = index; - const entry = new ZipEntry(inBuffer); - entry.header = inBuffer.slice(tmp, tmp += Utils.Constants.CENHDR); - entry.entryName = inBuffer.slice(tmp, tmp += entry.header.fileNameLength); - index += entry.header.entryHeaderSize; - callback(entry); - } - } - - function readEntries() { - loadedEntries = true; - entryTable = {}; - entryList = new Array(mainHeader.diskEntries); // total number of entries - - var index = mainHeader.offset; // offset of first CEN header - - for (var i = 0; i < entryList.length; i++) { - var tmp = index, - entry = new ZipEntry(inBuffer); - entry.header = inBuffer.slice(tmp, tmp += Utils.Constants.CENHDR); - entry.entryName = inBuffer.slice(tmp, tmp += entry.header.fileNameLength); - - if (entry.header.extraLength) { - entry.extra = inBuffer.slice(tmp, tmp += entry.header.extraLength); - } - - if (entry.header.commentLength) entry.comment = inBuffer.slice(tmp, tmp + entry.header.commentLength); - index += entry.header.entryHeaderSize; - entryList[i] = entry; - entryTable[entry.entryName] = entry; - } - } - - function readMainHeader( - /*Boolean*/ - readNow) { - var i = inBuffer.length - Utils.Constants.ENDHDR, - // END header size - max = Math.max(0, i - 0xffff), - // 0xFFFF is the max zip file comment length - n = max, - endStart = inBuffer.length, - endOffset = -1, - // Start offset of the END header - commentEnd = 0; - - for (i; i >= n; i--) { - if (inBuffer[i] !== 0x50) continue; // quick check that the byte is 'P' - - if (inBuffer.readUInt32LE(i) === Utils.Constants.ENDSIG) { - // "PK\005\006" - endOffset = i; - commentEnd = i; - endStart = i + Utils.Constants.ENDHDR; // We already found a regular signature, let's look just a bit further to check if there's any zip64 signature - - n = i - Utils.Constants.END64HDR; - continue; - } - - if (inBuffer.readUInt32LE(i) === Utils.Constants.END64SIG) { - // Found a zip64 signature, let's continue reading the whole zip64 record - n = max; - continue; - } - - if (inBuffer.readUInt32LE(i) === Utils.Constants.ZIP64SIG) { - // Found the zip64 record, let's determine it's size - endOffset = i; - endStart = i + Utils.readBigUInt64LE(inBuffer, i + Utils.Constants.ZIP64SIZE) + Utils.Constants.ZIP64LEAD; - break; - } - } - - if (!~endOffset) throw new Error(Utils.Errors.INVALID_FORMAT); - mainHeader.loadFromBinary(inBuffer.slice(endOffset, endStart)); - - if (mainHeader.commentLength) { - _comment = inBuffer.slice(commentEnd + Utils.Constants.ENDHDR); - } - - if (readNow) readEntries(); - } - - function sortEntries() { - if (entryList.length > 1 && !noSort) { - entryList.sort((a, b) => a.entryName.toLowerCase().localeCompare(b.entryName.toLowerCase())); - } - } - - return { - /** - * Returns an array of ZipEntry objects existent in the current opened archive - * @return Array - */ - get entries() { - if (!loadedEntries) { - readEntries(); - } - - return entryList; - }, - - /** - * Archive comment - * @return {String} - */ - get comment() { - return _comment.toString(); - }, - - set comment(val) { - _comment = Utils.toBuffer(val); - mainHeader.commentLength = _comment.length; - }, - - getEntryCount: function () { - if (!loadedEntries) { - return mainHeader.diskEntries; - } - - return entryList.length; - }, - forEach: function (callback) { - if (!loadedEntries) { - iterateEntries(callback); - return; - } - - entryList.forEach(callback); - }, - - /** - * Returns a reference to the entry with the given name or null if entry is inexistent - * - * @param entryName - * @return ZipEntry - */ - getEntry: function ( - /*String*/ - entryName) { - if (!loadedEntries) { - readEntries(); - } - - return entryTable[entryName] || null; - }, - - /** - * Adds the given entry to the entry list - * - * @param entry - */ - setEntry: function ( - /*ZipEntry*/ - entry) { - if (!loadedEntries) { - readEntries(); - } - - entryList.push(entry); - entryTable[entry.entryName] = entry; - mainHeader.totalEntries = entryList.length; - }, - - /** - * Removes the entry with the given name from the entry list. - * - * If the entry is a directory, then all nested files and directories will be removed - * @param entryName - */ - deleteEntry: function ( - /*String*/ - entryName) { - if (!loadedEntries) { - readEntries(); - } - - var entry = entryTable[entryName]; - - if (entry && entry.isDirectory) { - var _self = this; - - this.getEntryChildren(entry).forEach(function (child) { - if (child.entryName !== entryName) { - _self.deleteEntry(child.entryName); - } - }); - } - - entryList.splice(entryList.indexOf(entry), 1); - delete entryTable[entryName]; - mainHeader.totalEntries = entryList.length; - }, - - /** - * Iterates and returns all nested files and directories of the given entry - * - * @param entry - * @return Array - */ - getEntryChildren: function ( - /*ZipEntry*/ - entry) { - if (!loadedEntries) { - readEntries(); - } - - if (entry && entry.isDirectory) { - const list = []; - const name = entry.entryName; - const len = name.length; - entryList.forEach(function (zipEntry) { - if (zipEntry.entryName.substr(0, len) === name) { - list.push(zipEntry); - } - }); - return list; - } - - return []; - }, - - /** - * Returns the zip file - * - * @return Buffer - */ - compressToBuffer: function () { - if (!loadedEntries) { - readEntries(); - } - - sortEntries(); - const dataBlock = []; - const entryHeaders = []; - let totalSize = 0; - let dindex = 0; - mainHeader.size = 0; - mainHeader.offset = 0; - - for (const entry of entryList) { - // compress data and set local and entry header accordingly. Reason why is called first - const compressedData = entry.getCompressedData(); // 1. construct data header - - entry.header.offset = dindex; - const dataHeader = entry.header.dataHeaderToBinary(); - const entryNameLen = entry.rawEntryName.length; // 1.2. postheader - data after data header - - const postHeader = Buffer.alloc(entryNameLen + entry.extra.length); - entry.rawEntryName.copy(postHeader, 0); - postHeader.copy(entry.extra, entryNameLen); // 2. offsets - - const dataLength = dataHeader.length + postHeader.length + compressedData.length; - dindex += dataLength; // 3. store values in sequence - - dataBlock.push(dataHeader); - dataBlock.push(postHeader); - dataBlock.push(compressedData); // 4. construct entry header - - const entryHeader = entry.packHeader(); - entryHeaders.push(entryHeader); // 5. update main header - - mainHeader.size += entryHeader.length; - totalSize += dataLength + entryHeader.length; - } - - totalSize += mainHeader.mainHeaderSize; // also includes zip file comment length - // point to end of data and beginning of central directory first record - - mainHeader.offset = dindex; - dindex = 0; - const outBuffer = Buffer.alloc(totalSize); // write data blocks - - for (const content of dataBlock) { - content.copy(outBuffer, dindex); - dindex += content.length; - } // write central directory entries - - - for (const content of entryHeaders) { - content.copy(outBuffer, dindex); - dindex += content.length; - } // write main header - - - const mh = mainHeader.toBinary(); - - if (_comment) { - _comment.copy(mh, Utils.Constants.ENDHDR); // add zip file comment - - } - - mh.copy(outBuffer, dindex); - return outBuffer; - }, - toAsyncBuffer: function ( - /*Function*/ - onSuccess, - /*Function*/ - onFail, - /*Function*/ - onItemStart, - /*Function*/ - onItemEnd) { - try { - if (!loadedEntries) { - readEntries(); - } - - sortEntries(); - const dataBlock = []; - const entryHeaders = []; - let totalSize = 0; - let dindex = 0; - mainHeader.size = 0; - mainHeader.offset = 0; - - const compress2Buffer = function (entryLists) { - if (entryLists.length) { - const entry = entryLists.pop(); - const name = entry.entryName + entry.extra.toString(); - if (onItemStart) onItemStart(name); - entry.getCompressedDataAsync(function (compressedData) { - if (onItemEnd) onItemEnd(name); - entry.header.offset = dindex; // data header - - const dataHeader = entry.header.dataHeaderToBinary(); - const postHeader = Buffer.alloc(name.length, name); - const dataLength = dataHeader.length + postHeader.length + compressedData.length; - dindex += dataLength; - dataBlock.push(dataHeader); - dataBlock.push(postHeader); - dataBlock.push(compressedData); - const entryHeader = entry.packHeader(); - entryHeaders.push(entryHeader); - mainHeader.size += entryHeader.length; - totalSize += dataLength + entryHeader.length; - compress2Buffer(entryLists); - }); - } else { - totalSize += mainHeader.mainHeaderSize; // also includes zip file comment length - // point to end of data and beginning of central directory first record - - mainHeader.offset = dindex; - dindex = 0; - const outBuffer = Buffer.alloc(totalSize); - dataBlock.forEach(function (content) { - content.copy(outBuffer, dindex); // write data blocks - - dindex += content.length; - }); - entryHeaders.forEach(function (content) { - content.copy(outBuffer, dindex); // write central directory entries - - dindex += content.length; - }); - const mh = mainHeader.toBinary(); - - if (_comment) { - _comment.copy(mh, Utils.Constants.ENDHDR); // add zip file comment - - } - - mh.copy(outBuffer, dindex); // write main header - - onSuccess(outBuffer); - } - }; - - compress2Buffer(entryList); - } catch (e) { - onFail(e); - } - } - }; -}; - -/***/ }), - -/***/ "./node_modules/available-typed-arrays/index.js": -/*!******************************************************!*\ - !*** ./node_modules/available-typed-arrays/index.js ***! - \******************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var possibleNames = ['BigInt64Array', 'BigUint64Array', 'Float32Array', 'Float64Array', 'Int16Array', 'Int32Array', 'Int8Array', 'Uint16Array', 'Uint32Array', 'Uint8Array', 'Uint8ClampedArray']; -var g = typeof globalThis === 'undefined' ? global : globalThis; - -module.exports = function availableTypedArrays() { - var out = []; - - for (var i = 0; i < possibleNames.length; i++) { - if (typeof g[possibleNames[i]] === 'function') { - out[out.length] = possibleNames[i]; - } - } - - return out; -}; - -/***/ }), - -/***/ "./node_modules/call-bind/callBound.js": -/*!*********************************************!*\ - !*** ./node_modules/call-bind/callBound.js ***! - \*********************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var GetIntrinsic = __webpack_require__(/*! get-intrinsic */ "./node_modules/get-intrinsic/index.js"); - -var callBind = __webpack_require__(/*! ./ */ "./node_modules/call-bind/index.js"); - -var $indexOf = callBind(GetIntrinsic('String.prototype.indexOf')); - -module.exports = function callBoundIntrinsic(name, allowMissing) { - var intrinsic = GetIntrinsic(name, !!allowMissing); - - if (typeof intrinsic === 'function' && $indexOf(name, '.prototype.') > -1) { - return callBind(intrinsic); - } - - return intrinsic; -}; - -/***/ }), - -/***/ "./node_modules/call-bind/index.js": -/*!*****************************************!*\ - !*** ./node_modules/call-bind/index.js ***! - \*****************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var bind = __webpack_require__(/*! function-bind */ "./node_modules/function-bind/index.js"); - -var GetIntrinsic = __webpack_require__(/*! get-intrinsic */ "./node_modules/get-intrinsic/index.js"); - -var $apply = GetIntrinsic('%Function.prototype.apply%'); -var $call = GetIntrinsic('%Function.prototype.call%'); -var $reflectApply = GetIntrinsic('%Reflect.apply%', true) || bind.call($call, $apply); -var $gOPD = GetIntrinsic('%Object.getOwnPropertyDescriptor%', true); -var $defineProperty = GetIntrinsic('%Object.defineProperty%', true); -var $max = GetIntrinsic('%Math.max%'); - -if ($defineProperty) { - try { - $defineProperty({}, 'a', { - value: 1 - }); - } catch (e) { - // IE 8 has a broken defineProperty - $defineProperty = null; - } -} - -module.exports = function callBind(originalFunction) { - var func = $reflectApply(bind, $call, arguments); - - if ($gOPD && $defineProperty) { - var desc = $gOPD(func, 'length'); - - if (desc.configurable) { - // original length, plus the receiver, minus any additional arguments (after the receiver) - $defineProperty(func, 'length', { - value: 1 + $max(0, originalFunction.length - (arguments.length - 1)) - }); - } - } - - return func; -}; - -var applyBind = function applyBind() { - return $reflectApply(bind, $apply, arguments); -}; - -if ($defineProperty) { - $defineProperty(module.exports, 'apply', { - value: applyBind - }); -} else { - module.exports.apply = applyBind; -} - -/***/ }), - -/***/ "./node_modules/charenc/charenc.js": -/*!*****************************************!*\ - !*** ./node_modules/charenc/charenc.js ***! - \*****************************************/ -/*! no static exports found */ -/***/ (function(module, exports) { - -var charenc = { - // UTF-8 encoding - utf8: { - // Convert a string to a byte array - stringToBytes: function (str) { - return charenc.bin.stringToBytes(unescape(encodeURIComponent(str))); - }, - // Convert a byte array to a string - bytesToString: function (bytes) { - return decodeURIComponent(escape(charenc.bin.bytesToString(bytes))); - } - }, - // Binary encoding - bin: { - // Convert a string to a byte array - stringToBytes: function (str) { - for (var bytes = [], i = 0; i < str.length; i++) bytes.push(str.charCodeAt(i) & 0xFF); - - return bytes; - }, - // Convert a byte array to a string - bytesToString: function (bytes) { - for (var str = [], i = 0; i < bytes.length; i++) str.push(String.fromCharCode(bytes[i])); - - return str.join(''); - } - } -}; -module.exports = charenc; - -/***/ }), - -/***/ "./node_modules/crypt/crypt.js": -/*!*************************************!*\ - !*** ./node_modules/crypt/crypt.js ***! - \*************************************/ -/*! no static exports found */ -/***/ (function(module, exports) { - -(function () { - var base64map = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/', - crypt = { - // Bit-wise rotation left - rotl: function (n, b) { - return n << b | n >>> 32 - b; - }, - // Bit-wise rotation right - rotr: function (n, b) { - return n << 32 - b | n >>> b; - }, - // Swap big-endian to little-endian and vice versa - endian: function (n) { - // If number given, swap endian - if (n.constructor == Number) { - return crypt.rotl(n, 8) & 0x00FF00FF | crypt.rotl(n, 24) & 0xFF00FF00; - } // Else, assume array and swap all items - - - for (var i = 0; i < n.length; i++) n[i] = crypt.endian(n[i]); - - return n; - }, - // Generate an array of any length of random bytes - randomBytes: function (n) { - for (var bytes = []; n > 0; n--) bytes.push(Math.floor(Math.random() * 256)); - - return bytes; - }, - // Convert a byte array to big-endian 32-bit words - bytesToWords: function (bytes) { - for (var words = [], i = 0, b = 0; i < bytes.length; i++, b += 8) words[b >>> 5] |= bytes[i] << 24 - b % 32; - - return words; - }, - // Convert big-endian 32-bit words to a byte array - wordsToBytes: function (words) { - for (var bytes = [], b = 0; b < words.length * 32; b += 8) bytes.push(words[b >>> 5] >>> 24 - b % 32 & 0xFF); - - return bytes; - }, - // Convert a byte array to a hex string - bytesToHex: function (bytes) { - for (var hex = [], i = 0; i < bytes.length; i++) { - hex.push((bytes[i] >>> 4).toString(16)); - hex.push((bytes[i] & 0xF).toString(16)); - } - - return hex.join(''); - }, - // Convert a hex string to a byte array - hexToBytes: function (hex) { - for (var bytes = [], c = 0; c < hex.length; c += 2) bytes.push(parseInt(hex.substr(c, 2), 16)); - - return bytes; - }, - // Convert a byte array to a base-64 string - bytesToBase64: function (bytes) { - for (var base64 = [], i = 0; i < bytes.length; i += 3) { - var triplet = bytes[i] << 16 | bytes[i + 1] << 8 | bytes[i + 2]; - - for (var j = 0; j < 4; j++) if (i * 8 + j * 6 <= bytes.length * 8) base64.push(base64map.charAt(triplet >>> 6 * (3 - j) & 0x3F));else base64.push('='); - } - - return base64.join(''); - }, - // Convert a base-64 string to a byte array - base64ToBytes: function (base64) { - // Remove non-base-64 characters - base64 = base64.replace(/[^A-Z0-9+\/]/ig, ''); - - for (var bytes = [], i = 0, imod4 = 0; i < base64.length; imod4 = ++i % 4) { - if (imod4 == 0) continue; - bytes.push((base64map.indexOf(base64.charAt(i - 1)) & Math.pow(2, -2 * imod4 + 8) - 1) << imod4 * 2 | base64map.indexOf(base64.charAt(i)) >>> 6 - imod4 * 2); - } - - return bytes; - } - }; - module.exports = crypt; -})(); - -/***/ }), - -/***/ "./node_modules/csv-parse/lib/ResizeableBuffer.js": -/*!********************************************************!*\ - !*** ./node_modules/csv-parse/lib/ResizeableBuffer.js ***! - \********************************************************/ -/*! no static exports found */ -/***/ (function(module, exports) { - -class ResizeableBuffer { - constructor(size = 100) { - this.size = size; - this.length = 0; - this.buf = Buffer.alloc(size); - } - - prepend(val) { - if (Buffer.isBuffer(val)) { - const length = this.length + val.length; - - if (length >= this.size) { - this.resize(); - - if (length >= this.size) { - throw Error('INVALID_BUFFER_STATE'); - } - } - - const buf = this.buf; - this.buf = Buffer.alloc(this.size); - val.copy(this.buf, 0); - buf.copy(this.buf, val.length); - this.length += val.length; - } else { - const length = this.length++; - - if (length === this.size) { - this.resize(); - } - - const buf = this.clone(); - this.buf[0] = val; - buf.copy(this.buf, 1, 0, length); - } - } - - append(val) { - const length = this.length++; - - if (length === this.size) { - this.resize(); - } - - this.buf[length] = val; - } - - clone() { - return Buffer.from(this.buf.slice(0, this.length)); - } - - resize() { - const length = this.length; - this.size = this.size * 2; - const buf = Buffer.alloc(this.size); - this.buf.copy(buf, 0, 0, length); - this.buf = buf; - } - - toString(encoding) { - if (encoding) { - return this.buf.slice(0, this.length).toString(encoding); - } else { - return Uint8Array.prototype.slice.call(this.buf.slice(0, this.length)); - } - } - - toJSON() { - return this.toString('utf8'); - } - - reset() { - this.length = 0; - } - -} - -module.exports = ResizeableBuffer; - -/***/ }), - -/***/ "./node_modules/csv-parse/lib/index.js": -/*!*********************************************!*\ - !*** ./node_modules/csv-parse/lib/index.js ***! - \*********************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } - -function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } - -function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } - -function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } - -function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_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 _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } - -function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } - -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } - -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; } - -/* -CSV Parse - -Please look at the [project documentation](https://csv.js.org/parse/) for -additional information. -*/ -const _require = __webpack_require__(/*! stream */ "stream"), - Transform = _require.Transform; - -const ResizeableBuffer = __webpack_require__(/*! ./ResizeableBuffer */ "./node_modules/csv-parse/lib/ResizeableBuffer.js"); // white space characters -// https://en.wikipedia.org/wiki/Whitespace_character -// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions/Character_Classes#Types -// \f\n\r\t\v\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff - - -const tab = 9; -const nl = 10; // \n, 0x0A in hexadecimal, 10 in decimal - -const np = 12; -const cr = 13; // \r, 0x0D in hexadécimal, 13 in decimal - -const space = 32; -const boms = { - // Note, the following are equals: - // Buffer.from("\ufeff") - // Buffer.from([239, 187, 191]) - // Buffer.from('EFBBBF', 'hex') - 'utf8': Buffer.from([239, 187, 191]), - // Note, the following are equals: - // Buffer.from "\ufeff", 'utf16le - // Buffer.from([255, 254]) - 'utf16le': Buffer.from([255, 254]) -}; - -class Parser extends Transform { - constructor(opts = {}) { - super(_objectSpread(_objectSpread(_objectSpread({}, { - readableObjectMode: true - }), opts), {}, { - encoding: null - })); - this.__originalOptions = opts; - - this.__normalizeOptions(opts); - } - - __normalizeOptions(opts) { - const options = {}; // Merge with user options - - for (let opt in opts) { - options[underscore(opt)] = opts[opt]; - } // Normalize option `encoding` - // Note: defined first because other options depends on it - // to convert chars/strings into buffers. - - - if (options.encoding === undefined || options.encoding === true) { - options.encoding = 'utf8'; - } else if (options.encoding === null || options.encoding === false) { - options.encoding = null; - } else if (typeof options.encoding !== 'string' && options.encoding !== null) { - throw new CsvError('CSV_INVALID_OPTION_ENCODING', ['Invalid option encoding:', 'encoding must be a string or null to return a buffer,', `got ${JSON.stringify(options.encoding)}`], options); - } // Normalize option `bom` - - - if (options.bom === undefined || options.bom === null || options.bom === false) { - options.bom = false; - } else if (options.bom !== true) { - throw new CsvError('CSV_INVALID_OPTION_BOM', ['Invalid option bom:', 'bom must be true,', `got ${JSON.stringify(options.bom)}`], options); - } // Normalize option `cast` - - - let fnCastField = null; - - if (options.cast === undefined || options.cast === null || options.cast === false || options.cast === '') { - options.cast = undefined; - } else if (typeof options.cast === 'function') { - fnCastField = options.cast; - options.cast = true; - } else if (options.cast !== true) { - throw new CsvError('CSV_INVALID_OPTION_CAST', ['Invalid option cast:', 'cast must be true or a function,', `got ${JSON.stringify(options.cast)}`], options); - } // Normalize option `cast_date` - - - if (options.cast_date === undefined || options.cast_date === null || options.cast_date === false || options.cast_date === '') { - options.cast_date = false; - } else if (options.cast_date === true) { - options.cast_date = function (value) { - const date = Date.parse(value); - return !isNaN(date) ? new Date(date) : value; - }; - } else { - throw new CsvError('CSV_INVALID_OPTION_CAST_DATE', ['Invalid option cast_date:', 'cast_date must be true or a function,', `got ${JSON.stringify(options.cast_date)}`], options); - } // Normalize option `columns` - - - let fnFirstLineToHeaders = null; - - if (options.columns === true) { - // Fields in the first line are converted as-is to columns - fnFirstLineToHeaders = undefined; - } else if (typeof options.columns === 'function') { - fnFirstLineToHeaders = options.columns; - options.columns = true; - } else if (Array.isArray(options.columns)) { - options.columns = normalizeColumnsArray(options.columns); - } else if (options.columns === undefined || options.columns === null || options.columns === false) { - options.columns = false; - } else { - throw new CsvError('CSV_INVALID_OPTION_COLUMNS', ['Invalid option columns:', 'expect an array, a function or true,', `got ${JSON.stringify(options.columns)}`], options); - } // Normalize option `columns_duplicates_to_array` - - - if (options.columns_duplicates_to_array === undefined || options.columns_duplicates_to_array === null || options.columns_duplicates_to_array === false) { - options.columns_duplicates_to_array = false; - } else if (options.columns_duplicates_to_array !== true) { - throw new CsvError('CSV_INVALID_OPTION_COLUMNS_DUPLICATES_TO_ARRAY', ['Invalid option columns_duplicates_to_array:', 'expect an boolean,', `got ${JSON.stringify(options.columns_duplicates_to_array)}`], options); - } else if (options.columns === false) { - throw new CsvError('CSV_INVALID_OPTION_COLUMNS_DUPLICATES_TO_ARRAY', ['Invalid option columns_duplicates_to_array:', 'the `columns` mode must be activated.'], options); - } // Normalize option `comment` - - - if (options.comment === undefined || options.comment === null || options.comment === false || options.comment === '') { - options.comment = null; - } else { - if (typeof options.comment === 'string') { - options.comment = Buffer.from(options.comment, options.encoding); - } - - if (!Buffer.isBuffer(options.comment)) { - throw new CsvError('CSV_INVALID_OPTION_COMMENT', ['Invalid option comment:', 'comment must be a buffer or a string,', `got ${JSON.stringify(options.comment)}`], options); - } - } // Normalize option `delimiter` - - - const delimiter_json = JSON.stringify(options.delimiter); - if (!Array.isArray(options.delimiter)) options.delimiter = [options.delimiter]; - - if (options.delimiter.length === 0) { - throw new CsvError('CSV_INVALID_OPTION_DELIMITER', ['Invalid option delimiter:', 'delimiter must be a non empty string or buffer or array of string|buffer,', `got ${delimiter_json}`], options); - } - - options.delimiter = options.delimiter.map(function (delimiter) { - if (delimiter === undefined || delimiter === null || delimiter === false) { - return Buffer.from(',', options.encoding); - } - - if (typeof delimiter === 'string') { - delimiter = Buffer.from(delimiter, options.encoding); - } - - if (!Buffer.isBuffer(delimiter) || delimiter.length === 0) { - throw new CsvError('CSV_INVALID_OPTION_DELIMITER', ['Invalid option delimiter:', 'delimiter must be a non empty string or buffer or array of string|buffer,', `got ${delimiter_json}`], options); - } - - return delimiter; - }); // Normalize option `escape` - - if (options.escape === undefined || options.escape === true) { - options.escape = Buffer.from('"', options.encoding); - } else if (typeof options.escape === 'string') { - options.escape = Buffer.from(options.escape, options.encoding); - } else if (options.escape === null || options.escape === false) { - options.escape = null; - } - - if (options.escape !== null) { - if (!Buffer.isBuffer(options.escape)) { - throw new Error(`Invalid Option: escape must be a buffer, a string or a boolean, got ${JSON.stringify(options.escape)}`); - } - } // Normalize option `from` - - - if (options.from === undefined || options.from === null) { - options.from = 1; - } else { - if (typeof options.from === 'string' && /\d+/.test(options.from)) { - options.from = parseInt(options.from); - } - - if (Number.isInteger(options.from)) { - if (options.from < 0) { - throw new Error(`Invalid Option: from must be a positive integer, got ${JSON.stringify(opts.from)}`); - } - } else { - throw new Error(`Invalid Option: from must be an integer, got ${JSON.stringify(options.from)}`); - } - } // Normalize option `from_line` - - - if (options.from_line === undefined || options.from_line === null) { - options.from_line = 1; - } else { - if (typeof options.from_line === 'string' && /\d+/.test(options.from_line)) { - options.from_line = parseInt(options.from_line); - } - - if (Number.isInteger(options.from_line)) { - if (options.from_line <= 0) { - throw new Error(`Invalid Option: from_line must be a positive integer greater than 0, got ${JSON.stringify(opts.from_line)}`); - } - } else { - throw new Error(`Invalid Option: from_line must be an integer, got ${JSON.stringify(opts.from_line)}`); - } - } // Normalize options `ignore_last_delimiters` - - - if (options.ignore_last_delimiters === undefined || options.ignore_last_delimiters === null) { - options.ignore_last_delimiters = false; - } else if (typeof options.ignore_last_delimiters === 'number') { - options.ignore_last_delimiters = Math.floor(options.ignore_last_delimiters); - - if (options.ignore_last_delimiters === 0) { - options.ignore_last_delimiters = false; - } - } else if (typeof options.ignore_last_delimiters !== 'boolean') { - throw new CsvError('CSV_INVALID_OPTION_IGNORE_LAST_DELIMITERS', ['Invalid option `ignore_last_delimiters`:', 'the value must be a boolean value or an integer,', `got ${JSON.stringify(options.ignore_last_delimiters)}`], options); - } - - if (options.ignore_last_delimiters === true && options.columns === false) { - throw new CsvError('CSV_IGNORE_LAST_DELIMITERS_REQUIRES_COLUMNS', ['The option `ignore_last_delimiters`', 'requires the activation of the `columns` option'], options); - } // Normalize option `info` - - - if (options.info === undefined || options.info === null || options.info === false) { - options.info = false; - } else if (options.info !== true) { - throw new Error(`Invalid Option: info must be true, got ${JSON.stringify(options.info)}`); - } // Normalize option `max_record_size` - - - if (options.max_record_size === undefined || options.max_record_size === null || options.max_record_size === false) { - options.max_record_size = 0; - } else if (Number.isInteger(options.max_record_size) && options.max_record_size >= 0) {// Great, nothing to do - } else if (typeof options.max_record_size === 'string' && /\d+/.test(options.max_record_size)) { - options.max_record_size = parseInt(options.max_record_size); - } else { - throw new Error(`Invalid Option: max_record_size must be a positive integer, got ${JSON.stringify(options.max_record_size)}`); - } // Normalize option `objname` - - - if (options.objname === undefined || options.objname === null || options.objname === false) { - options.objname = undefined; - } else if (Buffer.isBuffer(options.objname)) { - if (options.objname.length === 0) { - throw new Error(`Invalid Option: objname must be a non empty buffer`); - } - - if (options.encoding === null) {// Don't call `toString`, leave objname as a buffer - } else { - options.objname = options.objname.toString(options.encoding); - } - } else if (typeof options.objname === 'string') { - if (options.objname.length === 0) { - throw new Error(`Invalid Option: objname must be a non empty string`); - } // Great, nothing to do - - } else { - throw new Error(`Invalid Option: objname must be a string or a buffer, got ${options.objname}`); - } // Normalize option `on_record` - - - if (options.on_record === undefined || options.on_record === null) { - options.on_record = undefined; - } else if (typeof options.on_record !== 'function') { - throw new CsvError('CSV_INVALID_OPTION_ON_RECORD', ['Invalid option `on_record`:', 'expect a function,', `got ${JSON.stringify(options.on_record)}`], options); - } // Normalize option `quote` - - - if (options.quote === null || options.quote === false || options.quote === '') { - options.quote = null; - } else { - if (options.quote === undefined || options.quote === true) { - options.quote = Buffer.from('"', options.encoding); - } else if (typeof options.quote === 'string') { - options.quote = Buffer.from(options.quote, options.encoding); - } - - if (!Buffer.isBuffer(options.quote)) { - throw new Error(`Invalid Option: quote must be a buffer or a string, got ${JSON.stringify(options.quote)}`); - } - } // Normalize option `raw` - - - if (options.raw === undefined || options.raw === null || options.raw === false) { - options.raw = false; - } else if (options.raw !== true) { - throw new Error(`Invalid Option: raw must be true, got ${JSON.stringify(options.raw)}`); - } // Normalize option `record_delimiter` - - - if (!options.record_delimiter) { - options.record_delimiter = []; - } else if (!Array.isArray(options.record_delimiter)) { - options.record_delimiter = [options.record_delimiter]; - } - - options.record_delimiter = options.record_delimiter.map(function (rd) { - if (typeof rd === 'string') { - rd = Buffer.from(rd, options.encoding); - } - - return rd; - }); // Normalize option `relax` - - if (typeof options.relax === 'boolean') {// Great, nothing to do - } else if (options.relax === undefined || options.relax === null) { - options.relax = false; - } else { - throw new Error(`Invalid Option: relax must be a boolean, got ${JSON.stringify(options.relax)}`); - } // Normalize option `relax_column_count` - - - if (typeof options.relax_column_count === 'boolean') {// Great, nothing to do - } else if (options.relax_column_count === undefined || options.relax_column_count === null) { - options.relax_column_count = false; - } else { - throw new Error(`Invalid Option: relax_column_count must be a boolean, got ${JSON.stringify(options.relax_column_count)}`); - } - - if (typeof options.relax_column_count_less === 'boolean') {// Great, nothing to do - } else if (options.relax_column_count_less === undefined || options.relax_column_count_less === null) { - options.relax_column_count_less = false; - } else { - throw new Error(`Invalid Option: relax_column_count_less must be a boolean, got ${JSON.stringify(options.relax_column_count_less)}`); - } - - if (typeof options.relax_column_count_more === 'boolean') {// Great, nothing to do - } else if (options.relax_column_count_more === undefined || options.relax_column_count_more === null) { - options.relax_column_count_more = false; - } else { - throw new Error(`Invalid Option: relax_column_count_more must be a boolean, got ${JSON.stringify(options.relax_column_count_more)}`); - } // Normalize option `skip_empty_lines` - - - if (typeof options.skip_empty_lines === 'boolean') {// Great, nothing to do - } else if (options.skip_empty_lines === undefined || options.skip_empty_lines === null) { - options.skip_empty_lines = false; - } else { - throw new Error(`Invalid Option: skip_empty_lines must be a boolean, got ${JSON.stringify(options.skip_empty_lines)}`); - } // Normalize option `skip_lines_with_empty_values` - - - if (typeof options.skip_lines_with_empty_values === 'boolean') {// Great, nothing to do - } else if (options.skip_lines_with_empty_values === undefined || options.skip_lines_with_empty_values === null) { - options.skip_lines_with_empty_values = false; - } else { - throw new Error(`Invalid Option: skip_lines_with_empty_values must be a boolean, got ${JSON.stringify(options.skip_lines_with_empty_values)}`); - } // Normalize option `skip_lines_with_error` - - - if (typeof options.skip_lines_with_error === 'boolean') {// Great, nothing to do - } else if (options.skip_lines_with_error === undefined || options.skip_lines_with_error === null) { - options.skip_lines_with_error = false; - } else { - throw new Error(`Invalid Option: skip_lines_with_error must be a boolean, got ${JSON.stringify(options.skip_lines_with_error)}`); - } // Normalize option `rtrim` - - - if (options.rtrim === undefined || options.rtrim === null || options.rtrim === false) { - options.rtrim = false; - } else if (options.rtrim !== true) { - throw new Error(`Invalid Option: rtrim must be a boolean, got ${JSON.stringify(options.rtrim)}`); - } // Normalize option `ltrim` - - - if (options.ltrim === undefined || options.ltrim === null || options.ltrim === false) { - options.ltrim = false; - } else if (options.ltrim !== true) { - throw new Error(`Invalid Option: ltrim must be a boolean, got ${JSON.stringify(options.ltrim)}`); - } // Normalize option `trim` - - - if (options.trim === undefined || options.trim === null || options.trim === false) { - options.trim = false; - } else if (options.trim !== true) { - throw new Error(`Invalid Option: trim must be a boolean, got ${JSON.stringify(options.trim)}`); - } // Normalize options `trim`, `ltrim` and `rtrim` - - - if (options.trim === true && opts.ltrim !== false) { - options.ltrim = true; - } else if (options.ltrim !== true) { - options.ltrim = false; - } - - if (options.trim === true && opts.rtrim !== false) { - options.rtrim = true; - } else if (options.rtrim !== true) { - options.rtrim = false; - } // Normalize option `to` - - - if (options.to === undefined || options.to === null) { - options.to = -1; - } else { - if (typeof options.to === 'string' && /\d+/.test(options.to)) { - options.to = parseInt(options.to); - } - - if (Number.isInteger(options.to)) { - if (options.to <= 0) { - throw new Error(`Invalid Option: to must be a positive integer greater than 0, got ${JSON.stringify(opts.to)}`); - } - } else { - throw new Error(`Invalid Option: to must be an integer, got ${JSON.stringify(opts.to)}`); - } - } // Normalize option `to_line` - - - if (options.to_line === undefined || options.to_line === null) { - options.to_line = -1; - } else { - if (typeof options.to_line === 'string' && /\d+/.test(options.to_line)) { - options.to_line = parseInt(options.to_line); - } - - if (Number.isInteger(options.to_line)) { - if (options.to_line <= 0) { - throw new Error(`Invalid Option: to_line must be a positive integer greater than 0, got ${JSON.stringify(opts.to_line)}`); - } - } else { - throw new Error(`Invalid Option: to_line must be an integer, got ${JSON.stringify(opts.to_line)}`); - } - } - - this.info = { - bytes: 0, - comment_lines: 0, - empty_lines: 0, - invalid_field_length: 0, - lines: 1, - records: 0 - }; - this.options = options; - this.state = { - bomSkipped: false, - bufBytesStart: 0, - castField: fnCastField, - commenting: false, - // Current error encountered by a record - error: undefined, - enabled: options.from_line === 1, - escaping: false, - // escapeIsQuote: options.escape === options.quote, - escapeIsQuote: Buffer.isBuffer(options.escape) && Buffer.isBuffer(options.quote) && Buffer.compare(options.escape, options.quote) === 0, - // columns can be `false`, `true`, `Array` - expectedRecordLength: Array.isArray(options.columns) ? options.columns.length : undefined, - field: new ResizeableBuffer(20), - firstLineToHeaders: fnFirstLineToHeaders, - needMoreDataSize: Math.max( // Skip if the remaining buffer smaller than comment - options.comment !== null ? options.comment.length : 0, // Skip if the remaining buffer can be delimiter - ...options.delimiter.map(delimiter => delimiter.length), // Skip if the remaining buffer can be escape sequence - options.quote !== null ? options.quote.length : 0), - previousBuf: undefined, - quoting: false, - stop: false, - rawBuffer: new ResizeableBuffer(100), - record: [], - recordHasError: false, - record_length: 0, - recordDelimiterMaxLength: options.record_delimiter.length === 0 ? 2 : Math.max(...options.record_delimiter.map(v => v.length)), - trimChars: [Buffer.from(' ', options.encoding)[0], Buffer.from('\t', options.encoding)[0]], - wasQuoting: false, - wasRowDelimiter: false - }; - } // Implementation of `Transform._transform` - - - _transform(buf, encoding, callback) { - if (this.state.stop === true) { - return; - } - - const err = this.__parse(buf, false); - - if (err !== undefined) { - this.state.stop = true; - } - - callback(err); - } // Implementation of `Transform._flush` - - - _flush(callback) { - if (this.state.stop === true) { - return; - } - - const err = this.__parse(undefined, true); - - callback(err); - } // Central parser implementation - - - __parse(nextBuf, end) { - const _this$options = this.options, - bom = _this$options.bom, - comment = _this$options.comment, - escape = _this$options.escape, - from_line = _this$options.from_line, - ltrim = _this$options.ltrim, - max_record_size = _this$options.max_record_size, - quote = _this$options.quote, - raw = _this$options.raw, - relax = _this$options.relax, - rtrim = _this$options.rtrim, - skip_empty_lines = _this$options.skip_empty_lines, - to = _this$options.to, - to_line = _this$options.to_line; - let record_delimiter = this.options.record_delimiter; - const _this$state = this.state, - bomSkipped = _this$state.bomSkipped, - previousBuf = _this$state.previousBuf, - rawBuffer = _this$state.rawBuffer, - escapeIsQuote = _this$state.escapeIsQuote; - let buf; - - if (previousBuf === undefined) { - if (nextBuf === undefined) { - // Handle empty string - this.push(null); - return; - } else { - buf = nextBuf; - } - } else if (previousBuf !== undefined && nextBuf === undefined) { - buf = previousBuf; - } else { - buf = Buffer.concat([previousBuf, nextBuf]); - } // Handle UTF BOM - - - if (bomSkipped === false) { - if (bom === false) { - this.state.bomSkipped = true; - } else if (buf.length < 3) { - // No enough data - if (end === false) { - // Wait for more data - this.state.previousBuf = buf; - return; - } - } else { - for (let encoding in boms) { - if (boms[encoding].compare(buf, 0, boms[encoding].length) === 0) { - // Skip BOM - let bomLength = boms[encoding].length; - this.state.bufBytesStart += bomLength; - buf = buf.slice(bomLength); // Renormalize original options with the new encoding - - this.__normalizeOptions(_objectSpread(_objectSpread({}, this.__originalOptions), {}, { - encoding: encoding - })); - - break; - } - } - - this.state.bomSkipped = true; - } - } - - const bufLen = buf.length; - let pos; - - for (pos = 0; pos < bufLen; pos++) { - // Ensure we get enough space to look ahead - // There should be a way to move this out of the loop - if (this.__needMoreData(pos, bufLen, end)) { - break; - } - - if (this.state.wasRowDelimiter === true) { - this.info.lines++; - this.state.wasRowDelimiter = false; - } - - if (to_line !== -1 && this.info.lines > to_line) { - this.state.stop = true; - this.push(null); - return; - } // Auto discovery of record_delimiter, unix, mac and windows supported - - - if (this.state.quoting === false && record_delimiter.length === 0) { - const record_delimiterCount = this.__autoDiscoverRecordDelimiter(buf, pos); - - if (record_delimiterCount) { - record_delimiter = this.options.record_delimiter; - } - } - - const chr = buf[pos]; - - if (raw === true) { - rawBuffer.append(chr); - } - - if ((chr === cr || chr === nl) && this.state.wasRowDelimiter === false) { - this.state.wasRowDelimiter = true; - } // Previous char was a valid escape char - // treat the current char as a regular char - - - if (this.state.escaping === true) { - this.state.escaping = false; - } else { - // Escape is only active inside quoted fields - // We are quoting, the char is an escape chr and there is a chr to escape - // if(escape !== null && this.state.quoting === true && chr === escape && pos + 1 < bufLen){ - if (escape !== null && this.state.quoting === true && this.__isEscape(buf, pos, chr) && pos + escape.length < bufLen) { - if (escapeIsQuote) { - if (this.__isQuote(buf, pos + escape.length)) { - this.state.escaping = true; - pos += escape.length - 1; - continue; - } - } else { - this.state.escaping = true; - pos += escape.length - 1; - continue; - } - } // Not currently escaping and chr is a quote - // TODO: need to compare bytes instead of single char - - - if (this.state.commenting === false && this.__isQuote(buf, pos)) { - if (this.state.quoting === true) { - const nextChr = buf[pos + quote.length]; - - const isNextChrTrimable = rtrim && this.__isCharTrimable(nextChr); - - const isNextChrComment = comment !== null && this.__compareBytes(comment, buf, pos + quote.length, nextChr); - - const isNextChrDelimiter = this.__isDelimiter(buf, pos + quote.length, nextChr); - - const isNextChrRecordDelimiter = record_delimiter.length === 0 ? this.__autoDiscoverRecordDelimiter(buf, pos + quote.length) : this.__isRecordDelimiter(nextChr, buf, pos + quote.length); // Escape a quote - // Treat next char as a regular character - - if (escape !== null && this.__isEscape(buf, pos, chr) && this.__isQuote(buf, pos + escape.length)) { - pos += escape.length - 1; - } else if (!nextChr || isNextChrDelimiter || isNextChrRecordDelimiter || isNextChrComment || isNextChrTrimable) { - this.state.quoting = false; - this.state.wasQuoting = true; - pos += quote.length - 1; - continue; - } else if (relax === false) { - const err = this.__error(new CsvError('CSV_INVALID_CLOSING_QUOTE', ['Invalid Closing Quote:', `got "${String.fromCharCode(nextChr)}"`, `at line ${this.info.lines}`, 'instead of delimiter, record delimiter, trimable character', '(if activated) or comment'], this.options, this.__infoField())); - - if (err !== undefined) return err; - } else { - this.state.quoting = false; - this.state.wasQuoting = true; - this.state.field.prepend(quote); - pos += quote.length - 1; - } - } else { - if (this.state.field.length !== 0) { - // In relax mode, treat opening quote preceded by chrs as regular - if (relax === false) { - const err = this.__error(new CsvError('INVALID_OPENING_QUOTE', ['Invalid Opening Quote:', `a quote is found inside a field at line ${this.info.lines}`], this.options, this.__infoField(), { - field: this.state.field - })); - - if (err !== undefined) return err; - } - } else { - this.state.quoting = true; - pos += quote.length - 1; - continue; - } - } - } - - if (this.state.quoting === false) { - let recordDelimiterLength = this.__isRecordDelimiter(chr, buf, pos); - - if (recordDelimiterLength !== 0) { - // Do not emit comments which take a full line - const skipCommentLine = this.state.commenting && this.state.wasQuoting === false && this.state.record.length === 0 && this.state.field.length === 0; - - if (skipCommentLine) { - this.info.comment_lines++; // Skip full comment line - } else { - // Activate records emition if above from_line - if (this.state.enabled === false && this.info.lines + (this.state.wasRowDelimiter === true ? 1 : 0) >= from_line) { - this.state.enabled = true; - - this.__resetField(); - - this.__resetRecord(); - - pos += recordDelimiterLength - 1; - continue; - } // Skip if line is empty and skip_empty_lines activated - - - if (skip_empty_lines === true && this.state.wasQuoting === false && this.state.record.length === 0 && this.state.field.length === 0) { - this.info.empty_lines++; - pos += recordDelimiterLength - 1; - continue; - } - - this.info.bytes = this.state.bufBytesStart + pos; - - const errField = this.__onField(); - - if (errField !== undefined) return errField; - this.info.bytes = this.state.bufBytesStart + pos + recordDelimiterLength; - - const errRecord = this.__onRecord(); - - if (errRecord !== undefined) return errRecord; - - if (to !== -1 && this.info.records >= to) { - this.state.stop = true; - this.push(null); - return; - } - } - - this.state.commenting = false; - pos += recordDelimiterLength - 1; - continue; - } - - if (this.state.commenting) { - continue; - } - - const commentCount = comment === null ? 0 : this.__compareBytes(comment, buf, pos, chr); - - if (commentCount !== 0) { - this.state.commenting = true; - continue; - } - - let delimiterLength = this.__isDelimiter(buf, pos, chr); - - if (delimiterLength !== 0) { - this.info.bytes = this.state.bufBytesStart + pos; - - const errField = this.__onField(); - - if (errField !== undefined) return errField; - pos += delimiterLength - 1; - continue; - } - } - } - - if (this.state.commenting === false) { - if (max_record_size !== 0 && this.state.record_length + this.state.field.length > max_record_size) { - const err = this.__error(new CsvError('CSV_MAX_RECORD_SIZE', ['Max Record Size:', 'record exceed the maximum number of tolerated bytes', `of ${max_record_size}`, `at line ${this.info.lines}`], this.options, this.__infoField())); - - if (err !== undefined) return err; - } - } - - const lappend = ltrim === false || this.state.quoting === true || this.state.field.length !== 0 || !this.__isCharTrimable(chr); // rtrim in non quoting is handle in __onField - - const rappend = rtrim === false || this.state.wasQuoting === false; - - if (lappend === true && rappend === true) { - this.state.field.append(chr); - } else if (rtrim === true && !this.__isCharTrimable(chr)) { - const err = this.__error(new CsvError('CSV_NON_TRIMABLE_CHAR_AFTER_CLOSING_QUOTE', ['Invalid Closing Quote:', 'found non trimable byte after quote', `at line ${this.info.lines}`], this.options, this.__infoField())); - - if (err !== undefined) return err; - } - } - - if (end === true) { - // Ensure we are not ending in a quoting state - if (this.state.quoting === true) { - const err = this.__error(new CsvError('CSV_QUOTE_NOT_CLOSED', ['Quote Not Closed:', `the parsing is finished with an opening quote at line ${this.info.lines}`], this.options, this.__infoField())); - - if (err !== undefined) return err; - } else { - // Skip last line if it has no characters - if (this.state.wasQuoting === true || this.state.record.length !== 0 || this.state.field.length !== 0) { - this.info.bytes = this.state.bufBytesStart + pos; - - const errField = this.__onField(); - - if (errField !== undefined) return errField; - - const errRecord = this.__onRecord(); - - if (errRecord !== undefined) return errRecord; - } else if (this.state.wasRowDelimiter === true) { - this.info.empty_lines++; - } else if (this.state.commenting === true) { - this.info.comment_lines++; - } - } - } else { - this.state.bufBytesStart += pos; - this.state.previousBuf = buf.slice(pos); - } - - if (this.state.wasRowDelimiter === true) { - this.info.lines++; - this.state.wasRowDelimiter = false; - } - } - - __onRecord() { - const _this$options2 = this.options, - columns = _this$options2.columns, - columns_duplicates_to_array = _this$options2.columns_duplicates_to_array, - encoding = _this$options2.encoding, - info = _this$options2.info, - from = _this$options2.from, - relax_column_count = _this$options2.relax_column_count, - relax_column_count_less = _this$options2.relax_column_count_less, - relax_column_count_more = _this$options2.relax_column_count_more, - raw = _this$options2.raw, - skip_lines_with_empty_values = _this$options2.skip_lines_with_empty_values; - const _this$state2 = this.state, - enabled = _this$state2.enabled, - record = _this$state2.record; - - if (enabled === false) { - return this.__resetRecord(); - } // Convert the first line into column names - - - const recordLength = record.length; - - if (columns === true) { - if (skip_lines_with_empty_values === true && isRecordEmpty(record)) { - this.__resetRecord(); - - return; - } - - return this.__firstLineToColumns(record); - } - - if (columns === false && this.info.records === 0) { - this.state.expectedRecordLength = recordLength; - } - - if (recordLength !== this.state.expectedRecordLength) { - const err = columns === false ? // Todo: rename CSV_INCONSISTENT_RECORD_LENGTH to - // CSV_RECORD_INCONSISTENT_FIELDS_LENGTH - new CsvError('CSV_INCONSISTENT_RECORD_LENGTH', ['Invalid Record Length:', `expect ${this.state.expectedRecordLength},`, `got ${recordLength} on line ${this.info.lines}`], this.options, this.__infoField(), { - record: record - }) : // Todo: rename CSV_RECORD_DONT_MATCH_COLUMNS_LENGTH to - // CSV_RECORD_INCONSISTENT_COLUMNS - new CsvError('CSV_RECORD_DONT_MATCH_COLUMNS_LENGTH', ['Invalid Record Length:', `columns length is ${columns.length},`, // rename columns - `got ${recordLength} on line ${this.info.lines}`], this.options, this.__infoField(), { - record: record - }); - - if (relax_column_count === true || relax_column_count_less === true && recordLength < this.state.expectedRecordLength || relax_column_count_more === true && recordLength > this.state.expectedRecordLength) { - this.info.invalid_field_length++; - this.state.error = err; // Error is undefined with skip_lines_with_error - } else { - const finalErr = this.__error(err); - - if (finalErr) return finalErr; - } - } - - if (skip_lines_with_empty_values === true && isRecordEmpty(record)) { - this.__resetRecord(); - - return; - } - - if (this.state.recordHasError === true) { - this.__resetRecord(); - - this.state.recordHasError = false; - return; - } - - this.info.records++; - - if (from === 1 || this.info.records >= from) { - // With columns, records are object - if (columns !== false) { - const obj = {}; // Transform record array to an object - - for (let i = 0, l = record.length; i < l; i++) { - if (columns[i] === undefined || columns[i].disabled) continue; // Turn duplicate columns into an array - - if (columns_duplicates_to_array === true && obj[columns[i].name] !== undefined) { - if (Array.isArray(obj[columns[i].name])) { - obj[columns[i].name] = obj[columns[i].name].concat(record[i]); - } else { - obj[columns[i].name] = [obj[columns[i].name], record[i]]; - } - } else { - obj[columns[i].name] = record[i]; - } - } - - const objname = this.options.objname; // Without objname (default) - - if (objname === undefined) { - if (raw === true || info === true) { - const err = this.__push(Object.assign({ - record: obj - }, raw === true ? { - raw: this.state.rawBuffer.toString(encoding) - } : {}, info === true ? { - info: this.__infoRecord() - } : {})); - - if (err) { - return err; - } - } else { - const err = this.__push(obj); - - if (err) { - return err; - } - } // With objname (default) - - } else { - if (raw === true || info === true) { - const err = this.__push(Object.assign({ - record: [obj[objname], obj] - }, raw === true ? { - raw: this.state.rawBuffer.toString(encoding) - } : {}, info === true ? { - info: this.__infoRecord() - } : {})); - - if (err) { - return err; - } - } else { - const err = this.__push([obj[objname], obj]); - - if (err) { - return err; - } - } - } // Without columns, records are array - - } else { - if (raw === true || info === true) { - const err = this.__push(Object.assign({ - record: record - }, raw === true ? { - raw: this.state.rawBuffer.toString(encoding) - } : {}, info === true ? { - info: this.__infoRecord() - } : {})); - - if (err) { - return err; - } - } else { - const err = this.__push(record); - - if (err) { - return err; - } - } - } - } - - this.__resetRecord(); - } - - __firstLineToColumns(record) { - const firstLineToHeaders = this.state.firstLineToHeaders; - - try { - const headers = firstLineToHeaders === undefined ? record : firstLineToHeaders.call(null, record); - - if (!Array.isArray(headers)) { - return this.__error(new CsvError('CSV_INVALID_COLUMN_MAPPING', ['Invalid Column Mapping:', 'expect an array from column function,', `got ${JSON.stringify(headers)}`], this.options, this.__infoField(), { - headers: headers - })); - } - - const normalizedHeaders = normalizeColumnsArray(headers); - this.state.expectedRecordLength = normalizedHeaders.length; - this.options.columns = normalizedHeaders; - - this.__resetRecord(); - - return; - } catch (err) { - return err; - } - } - - __resetRecord() { - if (this.options.raw === true) { - this.state.rawBuffer.reset(); - } - - this.state.error = undefined; - this.state.record = []; - this.state.record_length = 0; - } - - __onField() { - const _this$options3 = this.options, - cast = _this$options3.cast, - encoding = _this$options3.encoding, - rtrim = _this$options3.rtrim, - max_record_size = _this$options3.max_record_size; - const _this$state3 = this.state, - enabled = _this$state3.enabled, - wasQuoting = _this$state3.wasQuoting; // Short circuit for the from_line options - - if (enabled === false) { - return this.__resetField(); - } - - let field = this.state.field.toString(encoding); - - if (rtrim === true && wasQuoting === false) { - field = field.trimRight(); - } - - if (cast === true) { - const _this$__cast = this.__cast(field), - _this$__cast2 = _slicedToArray(_this$__cast, 2), - err = _this$__cast2[0], - f = _this$__cast2[1]; - - if (err !== undefined) return err; - field = f; - } - - this.state.record.push(field); // Increment record length if record size must not exceed a limit - - if (max_record_size !== 0 && typeof field === 'string') { - this.state.record_length += field.length; - } - - this.__resetField(); - } - - __resetField() { - this.state.field.reset(); - this.state.wasQuoting = false; - } - - __push(record) { - const on_record = this.options.on_record; - - if (on_record !== undefined) { - const info = this.__infoRecord(); - - try { - record = on_record.call(null, record, info); - } catch (err) { - return err; - } - - if (record === undefined || record === null) { - return; - } - } - - this.push(record); - } // Return a tuple with the error and the casted value - - - __cast(field) { - const _this$options4 = this.options, - columns = _this$options4.columns, - relax_column_count = _this$options4.relax_column_count; - const isColumns = Array.isArray(columns); // Dont loose time calling cast - // because the final record is an object - // and this field can't be associated to a key present in columns - - if (isColumns === true && relax_column_count && this.options.columns.length <= this.state.record.length) { - return [undefined, undefined]; - } - - if (this.state.castField !== null) { - try { - const info = this.__infoField(); - - return [undefined, this.state.castField.call(null, field, info)]; - } catch (err) { - return [err]; - } - } - - if (this.__isFloat(field)) { - return [undefined, parseFloat(field)]; - } else if (this.options.cast_date !== false) { - const info = this.__infoField(); - - return [undefined, this.options.cast_date.call(null, field, info)]; - } - - return [undefined, field]; - } // Helper to test if a character is a space or a line delimiter - - - __isCharTrimable(chr) { - return chr === space || chr === tab || chr === cr || chr === nl || chr === np; - } // Keep it in case we implement the `cast_int` option - // __isInt(value){ - // // return Number.isInteger(parseInt(value)) - // // return !isNaN( parseInt( obj ) ); - // return /^(\-|\+)?[1-9][0-9]*$/.test(value) - // } - - - __isFloat(value) { - return value - parseFloat(value) + 1 >= 0; // Borrowed from jquery - } - - __compareBytes(sourceBuf, targetBuf, targetPos, firstByte) { - if (sourceBuf[0] !== firstByte) return 0; - const sourceLength = sourceBuf.length; - - for (let i = 1; i < sourceLength; i++) { - if (sourceBuf[i] !== targetBuf[targetPos + i]) return 0; - } - - return sourceLength; - } - - __needMoreData(i, bufLen, end) { - if (end) return false; - const quote = this.options.quote; - const _this$state4 = this.state, - quoting = _this$state4.quoting, - needMoreDataSize = _this$state4.needMoreDataSize, - recordDelimiterMaxLength = _this$state4.recordDelimiterMaxLength; - const numOfCharLeft = bufLen - i - 1; - const requiredLength = Math.max(needMoreDataSize, // Skip if the remaining buffer smaller than record delimiter - recordDelimiterMaxLength, // Skip if the remaining buffer can be record delimiter following the closing quote - // 1 is for quote.length - quoting ? quote.length + recordDelimiterMaxLength : 0); - return numOfCharLeft < requiredLength; - } - - __isDelimiter(buf, pos, chr) { - const _this$options5 = this.options, - delimiter = _this$options5.delimiter, - ignore_last_delimiters = _this$options5.ignore_last_delimiters; - - if (ignore_last_delimiters === true && this.state.record.length === this.options.columns.length - 1) { - return 0; - } else if (ignore_last_delimiters !== false && typeof ignore_last_delimiters === 'number' && this.state.record.length === ignore_last_delimiters - 1) { - return 0; - } - - loop1: for (let i = 0; i < delimiter.length; i++) { - const del = delimiter[i]; - - if (del[0] === chr) { - for (let j = 1; j < del.length; j++) { - if (del[j] !== buf[pos + j]) continue loop1; - } - - return del.length; - } - } - - return 0; - } - - __isRecordDelimiter(chr, buf, pos) { - const record_delimiter = this.options.record_delimiter; - const recordDelimiterLength = record_delimiter.length; - - loop1: for (let i = 0; i < recordDelimiterLength; i++) { - const rd = record_delimiter[i]; - const rdLength = rd.length; - - if (rd[0] !== chr) { - continue; - } - - for (let j = 1; j < rdLength; j++) { - if (rd[j] !== buf[pos + j]) { - continue loop1; - } - } - - return rd.length; - } - - return 0; - } - - __isEscape(buf, pos, chr) { - const escape = this.options.escape; - if (escape === null) return false; - const l = escape.length; - - if (escape[0] === chr) { - for (let i = 0; i < l; i++) { - if (escape[i] !== buf[pos + i]) { - return false; - } - } - - return true; - } - - return false; - } - - __isQuote(buf, pos) { - const quote = this.options.quote; - if (quote === null) return false; - const l = quote.length; - - for (let i = 0; i < l; i++) { - if (quote[i] !== buf[pos + i]) { - return false; - } - } - - return true; - } - - __autoDiscoverRecordDelimiter(buf, pos) { - const encoding = this.options.encoding; - const chr = buf[pos]; - - if (chr === cr) { - if (buf[pos + 1] === nl) { - this.options.record_delimiter.push(Buffer.from('\r\n', encoding)); - this.state.recordDelimiterMaxLength = 2; - return 2; - } else { - this.options.record_delimiter.push(Buffer.from('\r', encoding)); - this.state.recordDelimiterMaxLength = 1; - return 1; - } - } else if (chr === nl) { - this.options.record_delimiter.push(Buffer.from('\n', encoding)); - this.state.recordDelimiterMaxLength = 1; - return 1; - } - - return 0; - } - - __error(msg) { - const skip_lines_with_error = this.options.skip_lines_with_error; - const err = typeof msg === 'string' ? new Error(msg) : msg; - - if (skip_lines_with_error) { - this.state.recordHasError = true; - this.emit('skip', err); - return undefined; - } else { - return err; - } - } - - __infoDataSet() { - return _objectSpread(_objectSpread({}, this.info), {}, { - columns: this.options.columns - }); - } - - __infoRecord() { - const columns = this.options.columns; - return _objectSpread(_objectSpread({}, this.__infoDataSet()), {}, { - error: this.state.error, - header: columns === true, - index: this.state.record.length - }); - } - - __infoField() { - const columns = this.options.columns; - const isColumns = Array.isArray(columns); - return _objectSpread(_objectSpread({}, this.__infoRecord()), {}, { - column: isColumns === true ? columns.length > this.state.record.length ? columns[this.state.record.length].name : null : this.state.record.length, - quoting: this.state.wasQuoting - }); - } - -} - -const parse = function () { - let data, options, callback; - - for (let i in arguments) { - const argument = arguments[i]; - const type = typeof argument; - - if (data === undefined && (typeof argument === 'string' || Buffer.isBuffer(argument))) { - data = argument; - } else if (options === undefined && isObject(argument)) { - options = argument; - } else if (callback === undefined && type === 'function') { - callback = argument; - } else { - throw new CsvError('CSV_INVALID_ARGUMENT', ['Invalid argument:', `got ${JSON.stringify(argument)} at index ${i}`], options || {}); - } - } - - const parser = new Parser(options); - - if (callback) { - const records = options === undefined || options.objname === undefined ? [] : {}; - parser.on('readable', function () { - let record; - - while ((record = this.read()) !== null) { - if (options === undefined || options.objname === undefined) { - records.push(record); - } else { - records[record[0]] = record[1]; - } - } - }); - parser.on('error', function (err) { - callback(err, undefined, parser.__infoDataSet()); - }); - parser.on('end', function () { - callback(undefined, records, parser.__infoDataSet()); - }); - } - - if (data !== undefined) { - // Give a chance for events to be registered later - if (typeof setImmediate === 'function') { - setImmediate(function () { - parser.write(data); - parser.end(); - }); - } else { - parser.write(data); - parser.end(); - } - } - - return parser; -}; - -class CsvError extends Error { - constructor(code, message, options, ...contexts) { - if (Array.isArray(message)) message = message.join(' '); - super(message); - - if (Error.captureStackTrace !== undefined) { - Error.captureStackTrace(this, CsvError); - } - - this.code = code; - - for (const context of contexts) { - for (const key in context) { - const value = context[key]; - this[key] = Buffer.isBuffer(value) ? value.toString(options.encoding) : value == null ? value : JSON.parse(JSON.stringify(value)); - } - } - } - -} - -parse.Parser = Parser; -parse.CsvError = CsvError; -module.exports = parse; - -const underscore = function (str) { - return str.replace(/([A-Z])/g, function (_, match) { - return '_' + match.toLowerCase(); - }); -}; - -const isObject = function (obj) { - return typeof obj === 'object' && obj !== null && !Array.isArray(obj); -}; - -const isRecordEmpty = function (record) { - return record.every(field => field == null || field.toString && field.toString().trim() === ''); -}; - -const normalizeColumnsArray = function (columns) { - const normalizedColumns = []; - - for (let i = 0, l = columns.length; i < l; i++) { - const column = columns[i]; - - if (column === undefined || column === null || column === false) { - normalizedColumns[i] = { - disabled: true - }; - } else if (typeof column === 'string') { - normalizedColumns[i] = { - name: column - }; - } else if (isObject(column)) { - if (typeof column.name !== 'string') { - throw new CsvError('CSV_OPTION_COLUMNS_MISSING_NAME', ['Option columns missing name:', `property "name" is required at position ${i}`, 'when column is an object literal']); - } - - normalizedColumns[i] = column; - } else { - throw new CsvError('CSV_INVALID_COLUMN_DEFINITION', ['Invalid column definition:', 'expect a string or a literal object,', `got ${JSON.stringify(column)} at position ${i}`]); - } - } - - return normalizedColumns; -}; - -/***/ }), - -/***/ "./node_modules/csv-parse/lib/sync.js": -/*!********************************************!*\ - !*** ./node_modules/csv-parse/lib/sync.js ***! - \********************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -const parse = __webpack_require__(/*! . */ "./node_modules/csv-parse/lib/index.js"); - -module.exports = function (data, options = {}) { - if (typeof data === 'string') { - data = Buffer.from(data); - } - - const records = options && options.objname ? {} : []; - const parser = new parse.Parser(options); - - parser.push = function (record) { - if (record === null) { - return; - } - - if (options.objname === undefined) records.push(record);else { - records[record[0]] = record[1]; - } - }; - - const err1 = parser.__parse(data, false); - - if (err1 !== undefined) throw err1; - - const err2 = parser.__parse(undefined, true); - - if (err2 !== undefined) throw err2; - return records; -}; - -/***/ }), - -/***/ "./node_modules/csv-stringify/lib/index.js": -/*!*************************************************!*\ - !*** ./node_modules/csv-stringify/lib/index.js ***! - \*************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } - -function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } - -function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } - -function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } - -function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_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 _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } - -function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } - -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } - -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; } - -/* -CSV Stringify - -Please look at the [project documentation](https://csv.js.org/stringify/) for -additional information. -*/ -const _require = __webpack_require__(/*! stream */ "stream"), - Transform = _require.Transform; - -const bom_utf8 = Buffer.from([239, 187, 191]); - -class Stringifier extends Transform { - constructor(opts = {}) { - super(_objectSpread(_objectSpread({}, { - writableObjectMode: true - }), opts)); - const options = {}; - let err; // Merge with user options - - for (let opt in opts) { - options[underscore(opt)] = opts[opt]; - } - - if (err = this.normalize(options)) throw err; - - switch (options.record_delimiter) { - case 'auto': - options.record_delimiter = null; - break; - - case 'unix': - options.record_delimiter = "\n"; - break; - - case 'mac': - options.record_delimiter = "\r"; - break; - - case 'windows': - options.record_delimiter = "\r\n"; - break; - - case 'ascii': - options.record_delimiter = "\u001e"; - break; - - case 'unicode': - options.record_delimiter = "\u2028"; - break; - } // Expose options - - - this.options = options; // Internal state - - this.state = { - stop: false - }; // Information - - this.info = { - records: 0 - }; - } - - normalize(options) { - // Normalize option `bom` - if (options.bom === undefined || options.bom === null || options.bom === false) { - options.bom = false; - } else if (options.bom !== true) { - return new CsvError('CSV_OPTION_BOOLEAN_INVALID_TYPE', ['option `bom` is optional and must be a boolean value,', `got ${JSON.stringify(options.bom)}`]); - } // Normalize option `delimiter` - - - if (options.delimiter === undefined || options.delimiter === null) { - options.delimiter = ','; - } else if (Buffer.isBuffer(options.delimiter)) { - options.delimiter = options.delimiter.toString(); - } else if (typeof options.delimiter !== 'string') { - return new CsvError('CSV_OPTION_DELIMITER_INVALID_TYPE', ['option `delimiter` must be a buffer or a string,', `got ${JSON.stringify(options.delimiter)}`]); - } // Normalize option `quote` - - - if (options.quote === undefined || options.quote === null) { - options.quote = '"'; - } else if (options.quote === true) { - options.quote = '"'; - } else if (options.quote === false) { - options.quote = ''; - } else if (Buffer.isBuffer(options.quote)) { - options.quote = options.quote.toString(); - } else if (typeof options.quote !== 'string') { - return new CsvError('CSV_OPTION_QUOTE_INVALID_TYPE', ['option `quote` must be a boolean, a buffer or a string,', `got ${JSON.stringify(options.quote)}`]); - } // Normalize option `quoted` - - - if (options.quoted === undefined || options.quoted === null) { - options.quoted = false; - } else {// todo - } // Normalize option `quoted_empty` - - - if (options.quoted_empty === undefined || options.quoted_empty === null) { - options.quoted_empty = undefined; - } else {// todo - } // Normalize option `quoted_match` - - - if (options.quoted_match === undefined || options.quoted_match === null || options.quoted_match === false) { - options.quoted_match = null; - } else if (!Array.isArray(options.quoted_match)) { - options.quoted_match = [options.quoted_match]; - } - - if (options.quoted_match) { - for (let quoted_match of options.quoted_match) { - const isString = typeof quoted_match === 'string'; - const isRegExp = quoted_match instanceof RegExp; - - if (!isString && !isRegExp) { - return Error(`Invalid Option: quoted_match must be a string or a regex, got ${JSON.stringify(quoted_match)}`); - } - } - } // Normalize option `quoted_string` - - - if (options.quoted_string === undefined || options.quoted_string === null) { - options.quoted_string = false; - } else {// todo - } // Normalize option `eof` - - - if (options.eof === undefined || options.eof === null) { - options.eof = true; - } else {// todo - } // Normalize option `escape` - - - if (options.escape === undefined || options.escape === null) { - options.escape = '"'; - } else if (Buffer.isBuffer(options.escape)) { - options.escape = options.escape.toString(); - } else if (typeof options.escape !== 'string') { - return Error(`Invalid Option: escape must be a buffer or a string, got ${JSON.stringify(options.escape)}`); - } - - if (options.escape.length > 1) { - return Error(`Invalid Option: escape must be one character, got ${options.escape.length} characters`); - } // Normalize option `header` - - - if (options.header === undefined || options.header === null) { - options.header = false; - } else {// todo - } // Normalize option `columns` - - - options.columns = this.normalize_columns(options.columns); // Normalize option `quoted` - - if (options.quoted === undefined || options.quoted === null) { - options.quoted = false; - } else {// todo - } // Normalize option `cast` - - - if (options.cast === undefined || options.cast === null) { - options.cast = {}; - } else {// todo - } // Normalize option cast.bigint - - - if (options.cast.bigint === undefined || options.cast.bigint === null) { - // Cast boolean to string by default - options.cast.bigint = value => '' + value; - } // Normalize option cast.boolean - - - if (options.cast.boolean === undefined || options.cast.boolean === null) { - // Cast boolean to string by default - options.cast.boolean = value => value ? '1' : ''; - } // Normalize option cast.date - - - if (options.cast.date === undefined || options.cast.date === null) { - // Cast date to timestamp string by default - options.cast.date = value => '' + value.getTime(); - } // Normalize option cast.number - - - if (options.cast.number === undefined || options.cast.number === null) { - // Cast number to string using native casting by default - options.cast.number = value => '' + value; - } // Normalize option cast.object - - - if (options.cast.object === undefined || options.cast.object === null) { - // Stringify object as JSON by default - options.cast.object = value => JSON.stringify(value); - } // Normalize option cast.string - - - if (options.cast.string === undefined || options.cast.string === null) { - // Leave string untouched - options.cast.string = function (value) { - return value; - }; - } // Normalize option `record_delimiter` - - - if (options.record_delimiter === undefined || options.record_delimiter === null) { - options.record_delimiter = '\n'; - } else if (Buffer.isBuffer(options.record_delimiter)) { - options.record_delimiter = options.record_delimiter.toString(); - } else if (typeof options.record_delimiter !== 'string') { - return Error(`Invalid Option: record_delimiter must be a buffer or a string, got ${JSON.stringify(options.record_delimiter)}`); - } - } - - _transform(chunk, encoding, callback) { - if (this.state.stop === true) { - return; - } // Chunk validation - - - if (!Array.isArray(chunk) && typeof chunk !== 'object') { - this.state.stop = true; - return callback(Error(`Invalid Record: expect an array or an object, got ${JSON.stringify(chunk)}`)); - } // Detect columns from the first record - - - if (this.info.records === 0) { - if (Array.isArray(chunk)) { - if (this.options.header === true && !this.options.columns) { - this.state.stop = true; - return callback(Error('Undiscoverable Columns: header option requires column option or object records')); - } - } else if (this.options.columns === undefined || this.options.columns === null) { - this.options.columns = this.normalize_columns(Object.keys(chunk)); - } - } // Emit the header - - - if (this.info.records === 0) { - this.bom(); - this.headers(); - } // Emit and stringify the record if an object or an array - - - try { - this.emit('record', chunk, this.info.records); - } catch (err) { - this.state.stop = true; - return this.emit('error', err); - } // Convert the record into a string - - - let chunk_string; - - if (this.options.eof) { - chunk_string = this.stringify(chunk); - - if (chunk_string === undefined) { - return; - } else { - chunk_string = chunk_string + this.options.record_delimiter; - } - } else { - chunk_string = this.stringify(chunk); - - if (chunk_string === undefined) { - return; - } else { - if (this.options.header || this.info.records) { - chunk_string = this.options.record_delimiter + chunk_string; - } - } - } // Emit the csv - - - this.info.records++; - this.push(chunk_string); - callback(); - } - - _flush(callback) { - if (this.info.records === 0) { - this.bom(); - this.headers(); - } - - callback(); - } - - stringify(chunk, chunkIsHeader = false) { - if (typeof chunk !== 'object') { - return chunk; - } - - const _this$options = this.options, - columns = _this$options.columns, - header = _this$options.header; - const record = []; // Record is an array - - if (Array.isArray(chunk)) { - // We are getting an array but the user has specified output columns. In - // this case, we respect the columns indexes - if (columns) { - chunk.splice(columns.length); - } // Cast record elements - - - for (let i = 0; i < chunk.length; i++) { - const field = chunk[i]; - - const _this$__cast = this.__cast(field, { - index: i, - column: i, - records: this.info.records, - header: chunkIsHeader - }), - _this$__cast2 = _slicedToArray(_this$__cast, 2), - err = _this$__cast2[0], - value = _this$__cast2[1]; - - if (err) { - this.emit('error', err); - return; - } - - record[i] = [value, field]; - } // Record is a literal object - - } else { - if (columns) { - for (let i = 0; i < columns.length; i++) { - const field = get(chunk, columns[i].key); - - const _this$__cast3 = this.__cast(field, { - index: i, - column: columns[i].key, - records: this.info.records, - header: chunkIsHeader - }), - _this$__cast4 = _slicedToArray(_this$__cast3, 2), - err = _this$__cast4[0], - value = _this$__cast4[1]; - - if (err) { - this.emit('error', err); - return; - } - - record[i] = [value, field]; - } - } else { - for (let column of chunk) { - const field = chunk[column]; - - const _this$__cast5 = this.__cast(field, { - index: i, - column: columns[i].key, - records: this.info.records, - header: chunkIsHeader - }), - _this$__cast6 = _slicedToArray(_this$__cast5, 2), - err = _this$__cast6[0], - value = _this$__cast6[1]; - - if (err) { - this.emit('error', err); - return; - } - - record.push([value, field]); - } - } - } - - let csvrecord = ''; - - for (let i = 0; i < record.length; i++) { - let options, err; - - let _record$i = _slicedToArray(record[i], 2), - value = _record$i[0], - field = _record$i[1]; - - if (typeof value === "string") { - options = this.options; - } else if (isObject(value)) { - // let { value, ...options } = value - options = value; - value = options.value; - delete options.value; - - if (typeof value !== "string" && value !== undefined && value !== null) { - this.emit("error", Error(`Invalid Casting Value: returned value must return a string, null or undefined, got ${JSON.stringify(value)}`)); - return; - } - - options = _objectSpread(_objectSpread({}, this.options), options); - - if (err = this.normalize(options)) { - this.emit("error", err); - return; - } - } else if (value === undefined || value === null) { - options = this.options; - } else { - this.emit("error", Error(`Invalid Casting Value: returned value must return a string, an object, null or undefined, got ${JSON.stringify(value)}`)); - return; - } - - const _options = options, - delimiter = _options.delimiter, - escape = _options.escape, - quote = _options.quote, - quoted = _options.quoted, - quoted_empty = _options.quoted_empty, - quoted_string = _options.quoted_string, - quoted_match = _options.quoted_match, - record_delimiter = _options.record_delimiter; - - if (value) { - if (typeof value !== 'string') { - this.emit("error", Error(`Formatter must return a string, null or undefined, got ${JSON.stringify(value)}`)); - return null; - } - - const containsdelimiter = delimiter.length && value.indexOf(delimiter) >= 0; - const containsQuote = quote !== '' && value.indexOf(quote) >= 0; - const containsEscape = value.indexOf(escape) >= 0 && escape !== quote; - const containsRecordDelimiter = value.indexOf(record_delimiter) >= 0; - const quotedString = quoted_string && typeof field === 'string'; - let quotedMatch = quoted_match && quoted_match.filter(quoted_match => { - if (typeof quoted_match === 'string') { - return value.indexOf(quoted_match) !== -1; - } else { - return quoted_match.test(value); - } - }); - quotedMatch = quotedMatch && quotedMatch.length > 0; - const shouldQuote = containsQuote === true || containsdelimiter || containsRecordDelimiter || quoted || quotedString || quotedMatch; - - if (shouldQuote === true && containsEscape === true) { - const regexp = escape === '\\' ? new RegExp(escape + escape, 'g') : new RegExp(escape, 'g'); - value = value.replace(regexp, escape + escape); - } - - if (containsQuote === true) { - const regexp = new RegExp(quote, 'g'); - value = value.replace(regexp, escape + quote); - } - - if (shouldQuote === true) { - value = quote + value + quote; - } - - csvrecord += value; - } else if (quoted_empty === true || field === '' && quoted_string === true && quoted_empty !== false) { - csvrecord += quote + quote; - } - - if (i !== record.length - 1) { - csvrecord += delimiter; - } - } - - return csvrecord; - } - - bom() { - if (this.options.bom !== true) { - return; - } - - this.push(bom_utf8); - } - - headers() { - if (this.options.header === false) { - return; - } - - if (this.options.columns === undefined) { - return; - } - - let headers = this.options.columns.map(column => column.header); - - if (this.options.eof) { - headers = this.stringify(headers, true) + this.options.record_delimiter; - } else { - headers = this.stringify(headers); - } - - this.push(headers); - } - - __cast(value, context) { - const type = typeof value; - - try { - if (type === 'string') { - // Fine for 99% of the cases - return [undefined, this.options.cast.string(value, context)]; - } else if (type === 'bigint') { - return [undefined, this.options.cast.bigint(value, context)]; - } else if (type === 'number') { - return [undefined, this.options.cast.number(value, context)]; - } else if (type === 'boolean') { - return [undefined, this.options.cast.boolean(value, context)]; - } else if (value instanceof Date) { - return [undefined, this.options.cast.date(value, context)]; - } else if (type === 'object' && value !== null) { - return [undefined, this.options.cast.object(value, context)]; - } else { - return [undefined, value, value]; - } - } catch (err) { - return [err]; - } - } - - normalize_columns(columns) { - if (columns === undefined || columns === null) { - return undefined; - } - - if (typeof columns !== 'object') { - throw Error('Invalid option "columns": expect an array or an object'); - } - - if (!Array.isArray(columns)) { - const newcolumns = []; - - for (let k in columns) { - newcolumns.push({ - key: k, - header: columns[k] - }); - } - - columns = newcolumns; - } else { - const newcolumns = []; - - for (let column of columns) { - if (typeof column === 'string') { - newcolumns.push({ - key: column, - header: column - }); - } else if (typeof column === 'object' && column !== undefined && !Array.isArray(column)) { - if (!column.key) { - throw Error('Invalid column definition: property "key" is required'); - } - - if (column.header === undefined) { - column.header = column.key; - } - - newcolumns.push(column); - } else { - throw Error('Invalid column definition: expect a string or an object'); - } - } - - columns = newcolumns; - } - - return columns; - } - -} - -const stringify = function () { - let data, options, callback; - - for (let i in arguments) { - const argument = arguments[i]; - const type = typeof argument; - - if (data === undefined && Array.isArray(argument)) { - data = argument; - } else if (options === undefined && isObject(argument)) { - options = argument; - } else if (callback === undefined && type === 'function') { - callback = argument; - } else { - throw new CsvError('CSV_INVALID_ARGUMENT', ['Invalid argument:', `got ${JSON.stringify(argument)} at index ${i}`]); - } - } - - const stringifier = new Stringifier(options); - - if (callback) { - const chunks = []; - stringifier.on('readable', function () { - let chunk; - - while ((chunk = this.read()) !== null) { - chunks.push(chunk); - } - }); - stringifier.on('error', function (err) { - callback(err); - }); - stringifier.on('end', function () { - callback(undefined, chunks.join('')); - }); - } - - if (data !== undefined) { - // Give a chance for events to be registered later - if (typeof setImmediate === 'function') { - setImmediate(function () { - for (let record of data) { - stringifier.write(record); - } - - stringifier.end(); - }); - } else { - for (let record of data) { - stringifier.write(record); - } - - stringifier.end(); - } - } - - return stringifier; -}; - -class CsvError extends Error { - constructor(code, message, ...contexts) { - if (Array.isArray(message)) message = message.join(' '); - super(message); - - if (Error.captureStackTrace !== undefined) { - Error.captureStackTrace(this, CsvError); - } - - this.code = code; - - for (const context of contexts) { - for (const key in context) { - const value = context[key]; - this[key] = Buffer.isBuffer(value) ? value.toString() : value == null ? value : JSON.parse(JSON.stringify(value)); - } - } - } - -} - -stringify.Stringifier = Stringifier; -stringify.CsvError = CsvError; -module.exports = stringify; - -const isObject = function (obj) { - return typeof obj === 'object' && obj !== null && !Array.isArray(obj); -}; - -const underscore = function (str) { - return str.replace(/([A-Z])/g, function (_, match) { - return '_' + match.toLowerCase(); - }); -}; // Lodash implementation of `get` - - -const charCodeOfDot = '.'.charCodeAt(0); -const reEscapeChar = /\\(\\)?/g; -const rePropName = RegExp( // Match anything that isn't a dot or bracket. -'[^.[\\]]+' + '|' + // Or match property names within brackets. -'\\[(?:' + // Match a non-string expression. -'([^"\'][^[]*)' + '|' + // Or match strings (supports escaping characters). -'(["\'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2' + ')\\]' + '|' + // Or match "" as the space between consecutive dots or empty brackets. -'(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|$))', 'g'); -const reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/; -const reIsPlainProp = /^\w*$/; - -const getTag = function (value) { - if (!value) value === undefined ? '[object Undefined]' : '[object Null]'; - return Object.prototype.toString.call(value); -}; - -const isKey = function (value, object) { - if (Array.isArray(value)) { - return false; - } - - const type = typeof value; - - if (type === 'number' || type === 'symbol' || type === 'boolean' || !value || isSymbol(value)) { - return true; - } - - return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || object != null && value in Object(object); -}; - -const isSymbol = function (value) { - const type = typeof value; - return type === 'symbol' || type === 'object' && value && getTag(value) === '[object Symbol]'; -}; - -const stringToPath = function (string) { - const result = []; - - if (string.charCodeAt(0) === charCodeOfDot) { - result.push(''); - } - - string.replace(rePropName, function (match, expression, quote, subString) { - let key = match; - - if (quote) { - key = subString.replace(reEscapeChar, '$1'); - } else if (expression) { - key = expression.trim(); - } - - result.push(key); - }); - return result; -}; - -const castPath = function (value, object) { - if (Array.isArray(value)) { - return value; - } else { - return isKey(value, object) ? [value] : stringToPath(value); - } -}; - -const toKey = function (value) { - if (typeof value === 'string' || isSymbol(value)) return value; - const result = `${value}`; - return result == '0' && 1 / value == -INFINITY ? '-0' : result; -}; - -const get = function (object, path) { - path = castPath(path, object); - let index = 0; - const length = path.length; - - while (object != null && index < length) { - object = object[toKey(path[index++])]; - } - - return index && index === length ? object : undefined; -}; - -/***/ }), - -/***/ "./node_modules/csv-stringify/lib/sync.js": -/*!************************************************!*\ - !*** ./node_modules/csv-stringify/lib/sync.js ***! - \************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -const stringify = __webpack_require__(/*! . */ "./node_modules/csv-stringify/lib/index.js"); - -const _require = __webpack_require__(/*! string_decoder */ "string_decoder"), - StringDecoder = _require.StringDecoder; - -module.exports = function (records, options = {}) { - const data = []; - - if (Buffer.isBuffer(records)) { - const decoder = new StringDecoder(); - records = decoder.write(records); - } - - function onData(record) { - if (record) { - data.push(record.toString()); - } - } - - let stringifier = new stringify.Stringifier(options); - stringifier.on('data', onData); - - for (let record of records) { - stringifier.write(record); - } - - stringifier.end(); - stringifier.off('data', onData); - return data.join(''); -}; - -/***/ }), - -/***/ "./node_modules/currency-formatter/currencies.json": -/*!*********************************************************!*\ - !*** ./node_modules/currency-formatter/currencies.json ***! - \*********************************************************/ -/*! exports provided: AED, AFN, ALL, AMD, ANG, AOA, ARS, AUD, AWG, AZN, BAM, BBD, BDT, BGN, BHD, BIF, BMD, BND, BOB, BRL, BSD, BTC, BTN, BWP, BYR, BZD, CAD, CDF, CHF, CLP, CNY, COP, CRC, CUC, CUP, CVE, CZK, DJF, DKK, DOP, DZD, EGP, ERN, ETB, EUR, FJD, FKP, GBP, GEL, GHS, GIP, GMD, GNF, GTQ, GYD, HKD, HNL, HRK, HTG, HUF, IDR, ILS, INR, IQD, IRR, ISK, JMD, JOD, JPY, KES, KGS, KHR, KMF, KPW, KRW, KWD, KYD, KZT, LAK, LBP, LKR, LRD, LSL, LYD, MAD, MDL, MGA, MKD, MMK, MNT, MOP, MRO, MTL, MUR, MVR, MWK, MXN, MYR, MZN, NAD, NGN, NIO, NOK, NPR, NZD, OMR, PAB, PEN, PGK, PHP, PKR, PLN, PYG, QAR, RON, RSD, RUB, RWF, SAR, SBD, SCR, SDD, SDG, SEK, SGD, SHP, SLL, SOS, SRD, STD, SVC, SYP, SZL, THB, TJS, TMT, TND, TOP, TRY, TTD, TVD, TWD, TZS, UAH, UGX, USD, UYU, UZS, VEB, VEF, VND, VUV, WST, XAF, XCD, XBT, XOF, XPF, YER, ZAR, ZMW, WON, default */ -/***/ (function(module) { - -module.exports = JSON.parse("{\"AED\":{\"code\":\"AED\",\"symbol\":\"د.Ø¥.â€\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":true,\"decimalDigits\":2},\"AFN\":{\"code\":\"AFN\",\"symbol\":\"Ø‹\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":false,\"decimalDigits\":2},\"ALL\":{\"code\":\"ALL\",\"symbol\":\"Lek\",\"thousandsSeparator\":\".\",\"decimalSeparator\":\",\",\"symbolOnLeft\":false,\"spaceBetweenAmountAndSymbol\":false,\"decimalDigits\":2},\"AMD\":{\"code\":\"AMD\",\"symbol\":\"Ö\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":false,\"spaceBetweenAmountAndSymbol\":true,\"decimalDigits\":2},\"ANG\":{\"code\":\"ANG\",\"symbol\":\"Æ’\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":false,\"decimalDigits\":2},\"AOA\":{\"code\":\"AOA\",\"symbol\":\"Kz\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":false,\"decimalDigits\":2},\"ARS\":{\"code\":\"ARS\",\"symbol\":\"$\",\"thousandsSeparator\":\".\",\"decimalSeparator\":\",\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":true,\"decimalDigits\":2},\"AUD\":{\"code\":\"AUD\",\"symbol\":\"$\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":false,\"decimalDigits\":2},\"AWG\":{\"code\":\"AWG\",\"symbol\":\"Æ’\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":false,\"decimalDigits\":2},\"AZN\":{\"code\":\"AZN\",\"symbol\":\"₼\",\"thousandsSeparator\":\" \",\"decimalSeparator\":\",\",\"symbolOnLeft\":false,\"spaceBetweenAmountAndSymbol\":true,\"decimalDigits\":2},\"BAM\":{\"code\":\"BAM\",\"symbol\":\"КМ\",\"thousandsSeparator\":\".\",\"decimalSeparator\":\",\",\"symbolOnLeft\":false,\"spaceBetweenAmountAndSymbol\":true,\"decimalDigits\":2},\"BBD\":{\"code\":\"BBD\",\"symbol\":\"$\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":false,\"decimalDigits\":2},\"BDT\":{\"code\":\"BDT\",\"symbol\":\"৳\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":true,\"decimalDigits\":0},\"BGN\":{\"code\":\"BGN\",\"symbol\":\"лв.\",\"thousandsSeparator\":\" \",\"decimalSeparator\":\",\",\"symbolOnLeft\":false,\"spaceBetweenAmountAndSymbol\":true,\"decimalDigits\":2},\"BHD\":{\"code\":\"BHD\",\"symbol\":\"د.ب.â€\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":true,\"decimalDigits\":3},\"BIF\":{\"code\":\"BIF\",\"symbol\":\"FBu\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":false,\"spaceBetweenAmountAndSymbol\":false,\"decimalDigits\":0},\"BMD\":{\"code\":\"BMD\",\"symbol\":\"$\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":false,\"decimalDigits\":2},\"BND\":{\"code\":\"BND\",\"symbol\":\"$\",\"thousandsSeparator\":\".\",\"decimalSeparator\":\",\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":false,\"decimalDigits\":0},\"BOB\":{\"code\":\"BOB\",\"symbol\":\"Bs\",\"thousandsSeparator\":\".\",\"decimalSeparator\":\",\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":true,\"decimalDigits\":2},\"BRL\":{\"code\":\"BRL\",\"symbol\":\"R$\",\"thousandsSeparator\":\".\",\"decimalSeparator\":\",\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":true,\"decimalDigits\":2},\"BSD\":{\"code\":\"BSD\",\"symbol\":\"$\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":false,\"decimalDigits\":2},\"BTC\":{\"code\":\"BTC\",\"symbol\":\"Ƀ\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":false,\"spaceBetweenAmountAndSymbol\":false,\"decimalDigits\":8},\"BTN\":{\"code\":\"BTN\",\"symbol\":\"Nu.\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":true,\"decimalDigits\":1},\"BWP\":{\"code\":\"BWP\",\"symbol\":\"P\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":false,\"decimalDigits\":2},\"BYR\":{\"code\":\"BYR\",\"symbol\":\"Ñ€.\",\"thousandsSeparator\":\" \",\"decimalSeparator\":\",\",\"symbolOnLeft\":false,\"spaceBetweenAmountAndSymbol\":true,\"decimalDigits\":2},\"BZD\":{\"code\":\"BZD\",\"symbol\":\"BZ$\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":false,\"decimalDigits\":2},\"CAD\":{\"code\":\"CAD\",\"symbol\":\"$\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":false,\"decimalDigits\":2},\"CDF\":{\"code\":\"CDF\",\"symbol\":\"FC\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":false,\"spaceBetweenAmountAndSymbol\":false,\"decimalDigits\":2},\"CHF\":{\"code\":\"CHF\",\"symbol\":\"CHF\",\"thousandsSeparator\":\"'\",\"decimalSeparator\":\".\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":true,\"decimalDigits\":2},\"CLP\":{\"code\":\"CLP\",\"symbol\":\"$\",\"thousandsSeparator\":\".\",\"decimalSeparator\":\",\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":true,\"decimalDigits\":2},\"CNY\":{\"code\":\"CNY\",\"symbol\":\"Â¥\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":false,\"decimalDigits\":2},\"COP\":{\"code\":\"COP\",\"symbol\":\"$\",\"thousandsSeparator\":\".\",\"decimalSeparator\":\",\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":true,\"decimalDigits\":2},\"CRC\":{\"code\":\"CRC\",\"symbol\":\"â‚¡\",\"thousandsSeparator\":\".\",\"decimalSeparator\":\",\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":false,\"decimalDigits\":2},\"CUC\":{\"code\":\"CUC\",\"symbol\":\"CUC\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":false,\"decimalDigits\":2},\"CUP\":{\"code\":\"CUP\",\"symbol\":\"$MN\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":false,\"decimalDigits\":2},\"CVE\":{\"code\":\"CVE\",\"symbol\":\"$\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":false,\"decimalDigits\":2},\"CZK\":{\"code\":\"CZK\",\"symbol\":\"KÄ\",\"thousandsSeparator\":\" \",\"decimalSeparator\":\",\",\"symbolOnLeft\":false,\"spaceBetweenAmountAndSymbol\":true,\"decimalDigits\":2},\"DJF\":{\"code\":\"DJF\",\"symbol\":\"Fdj\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":false,\"spaceBetweenAmountAndSymbol\":false,\"decimalDigits\":0},\"DKK\":{\"code\":\"DKK\",\"symbol\":\"kr.\",\"thousandsSeparator\":\"\",\"decimalSeparator\":\",\",\"symbolOnLeft\":false,\"spaceBetweenAmountAndSymbol\":true,\"decimalDigits\":2},\"DOP\":{\"code\":\"DOP\",\"symbol\":\"RD$\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":false,\"decimalDigits\":2},\"DZD\":{\"code\":\"DZD\",\"symbol\":\"د.ج.â€\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":true,\"decimalDigits\":2},\"EGP\":{\"code\":\"EGP\",\"symbol\":\"ج.Ù….â€\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":true,\"decimalDigits\":2},\"ERN\":{\"code\":\"ERN\",\"symbol\":\"Nfk\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":false,\"spaceBetweenAmountAndSymbol\":false,\"decimalDigits\":2},\"ETB\":{\"code\":\"ETB\",\"symbol\":\"ETB\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":false,\"decimalDigits\":2},\"EUR\":{\"code\":\"EUR\",\"symbol\":\"€\",\"thousandsSeparator\":\" \",\"decimalSeparator\":\",\",\"symbolOnLeft\":false,\"spaceBetweenAmountAndSymbol\":true,\"decimalDigits\":2},\"FJD\":{\"code\":\"FJD\",\"symbol\":\"$\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":false,\"decimalDigits\":2},\"FKP\":{\"code\":\"FKP\",\"symbol\":\"£\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":false,\"decimalDigits\":2},\"GBP\":{\"code\":\"GBP\",\"symbol\":\"£\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":false,\"decimalDigits\":2},\"GEL\":{\"code\":\"GEL\",\"symbol\":\"Lari\",\"thousandsSeparator\":\" \",\"decimalSeparator\":\",\",\"symbolOnLeft\":false,\"spaceBetweenAmountAndSymbol\":true,\"decimalDigits\":2},\"GHS\":{\"code\":\"GHS\",\"symbol\":\"₵\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":false,\"decimalDigits\":2},\"GIP\":{\"code\":\"GIP\",\"symbol\":\"£\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":false,\"decimalDigits\":2},\"GMD\":{\"code\":\"GMD\",\"symbol\":\"D\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":false,\"spaceBetweenAmountAndSymbol\":false,\"decimalDigits\":2},\"GNF\":{\"code\":\"GNF\",\"symbol\":\"FG\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":false,\"spaceBetweenAmountAndSymbol\":false,\"decimalDigits\":0},\"GTQ\":{\"code\":\"GTQ\",\"symbol\":\"Q\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":false,\"decimalDigits\":2},\"GYD\":{\"code\":\"GYD\",\"symbol\":\"$\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":false,\"decimalDigits\":2},\"HKD\":{\"code\":\"HKD\",\"symbol\":\"HK$\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":false,\"decimalDigits\":2},\"HNL\":{\"code\":\"HNL\",\"symbol\":\"L.\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":true,\"decimalDigits\":2},\"HRK\":{\"code\":\"HRK\",\"symbol\":\"kn\",\"thousandsSeparator\":\".\",\"decimalSeparator\":\",\",\"symbolOnLeft\":false,\"spaceBetweenAmountAndSymbol\":true,\"decimalDigits\":2},\"HTG\":{\"code\":\"HTG\",\"symbol\":\"G\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":false,\"decimalDigits\":2},\"HUF\":{\"code\":\"HUF\",\"symbol\":\"Ft\",\"thousandsSeparator\":\" \",\"decimalSeparator\":\",\",\"symbolOnLeft\":false,\"spaceBetweenAmountAndSymbol\":true,\"decimalDigits\":2},\"IDR\":{\"code\":\"IDR\",\"symbol\":\"Rp\",\"thousandsSeparator\":\".\",\"decimalSeparator\":\",\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":false,\"decimalDigits\":0},\"ILS\":{\"code\":\"ILS\",\"symbol\":\"₪\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":true,\"decimalDigits\":2},\"INR\":{\"code\":\"INR\",\"symbol\":\"₹\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":false,\"decimalDigits\":2},\"IQD\":{\"code\":\"IQD\",\"symbol\":\"د.ع.â€\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":true,\"decimalDigits\":2},\"IRR\":{\"code\":\"IRR\",\"symbol\":\"ï·¼\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\"/\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":true,\"decimalDigits\":2},\"ISK\":{\"code\":\"ISK\",\"symbol\":\"kr.\",\"thousandsSeparator\":\".\",\"decimalSeparator\":\",\",\"symbolOnLeft\":false,\"spaceBetweenAmountAndSymbol\":true,\"decimalDigits\":0},\"JMD\":{\"code\":\"JMD\",\"symbol\":\"J$\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":false,\"decimalDigits\":2},\"JOD\":{\"code\":\"JOD\",\"symbol\":\"د.ا.â€\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":true,\"decimalDigits\":3},\"JPY\":{\"code\":\"JPY\",\"symbol\":\"Â¥\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":false,\"decimalDigits\":0},\"KES\":{\"code\":\"KES\",\"symbol\":\"KSh\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":false,\"decimalDigits\":2},\"KGS\":{\"code\":\"KGS\",\"symbol\":\"Ñом\",\"thousandsSeparator\":\" \",\"decimalSeparator\":\"-\",\"symbolOnLeft\":false,\"spaceBetweenAmountAndSymbol\":true,\"decimalDigits\":2},\"KHR\":{\"code\":\"KHR\",\"symbol\":\"៛\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":false,\"spaceBetweenAmountAndSymbol\":false,\"decimalDigits\":0},\"KMF\":{\"code\":\"KMF\",\"symbol\":\"CF\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":false,\"spaceBetweenAmountAndSymbol\":false,\"decimalDigits\":2},\"KPW\":{\"code\":\"KPW\",\"symbol\":\"â‚©\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":false,\"decimalDigits\":0},\"KRW\":{\"code\":\"KRW\",\"symbol\":\"â‚©\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":false,\"decimalDigits\":0},\"KWD\":{\"code\":\"KWD\",\"symbol\":\"د.Ùƒ.â€\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":true,\"decimalDigits\":3},\"KYD\":{\"code\":\"KYD\",\"symbol\":\"$\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":false,\"decimalDigits\":2},\"KZT\":{\"code\":\"KZT\",\"symbol\":\"₸\",\"thousandsSeparator\":\" \",\"decimalSeparator\":\"-\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":false,\"decimalDigits\":2},\"LAK\":{\"code\":\"LAK\",\"symbol\":\"â‚\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":false,\"spaceBetweenAmountAndSymbol\":false,\"decimalDigits\":0},\"LBP\":{\"code\":\"LBP\",\"symbol\":\"Ù„.Ù„.â€\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":true,\"decimalDigits\":2},\"LKR\":{\"code\":\"LKR\",\"symbol\":\"₨\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":true,\"decimalDigits\":0},\"LRD\":{\"code\":\"LRD\",\"symbol\":\"$\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":false,\"decimalDigits\":2},\"LSL\":{\"code\":\"LSL\",\"symbol\":\"M\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":false,\"spaceBetweenAmountAndSymbol\":false,\"decimalDigits\":2},\"LYD\":{\"code\":\"LYD\",\"symbol\":\"د.Ù„.â€\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":false,\"decimalDigits\":3},\"MAD\":{\"code\":\"MAD\",\"symbol\":\"د.Ù….â€\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":true,\"decimalDigits\":2},\"MDL\":{\"code\":\"MDL\",\"symbol\":\"lei\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":false,\"spaceBetweenAmountAndSymbol\":true,\"decimalDigits\":2},\"MGA\":{\"code\":\"MGA\",\"symbol\":\"Ar\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":false,\"decimalDigits\":0},\"MKD\":{\"code\":\"MKD\",\"symbol\":\"ден.\",\"thousandsSeparator\":\".\",\"decimalSeparator\":\",\",\"symbolOnLeft\":false,\"spaceBetweenAmountAndSymbol\":true,\"decimalDigits\":2},\"MMK\":{\"code\":\"MMK\",\"symbol\":\"K\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":false,\"decimalDigits\":2},\"MNT\":{\"code\":\"MNT\",\"symbol\":\"â‚®\",\"thousandsSeparator\":\" \",\"decimalSeparator\":\",\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":false,\"decimalDigits\":2},\"MOP\":{\"code\":\"MOP\",\"symbol\":\"MOP$\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":false,\"decimalDigits\":2},\"MRO\":{\"code\":\"MRO\",\"symbol\":\"UM\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":false,\"spaceBetweenAmountAndSymbol\":false,\"decimalDigits\":2},\"MTL\":{\"code\":\"MTL\",\"symbol\":\"₤\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":false,\"decimalDigits\":2},\"MUR\":{\"code\":\"MUR\",\"symbol\":\"₨\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":false,\"decimalDigits\":2},\"MVR\":{\"code\":\"MVR\",\"symbol\":\"MVR\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":false,\"spaceBetweenAmountAndSymbol\":true,\"decimalDigits\":1},\"MWK\":{\"code\":\"MWK\",\"symbol\":\"MK\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":false,\"decimalDigits\":2},\"MXN\":{\"code\":\"MXN\",\"symbol\":\"$\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":false,\"decimalDigits\":2},\"MYR\":{\"code\":\"MYR\",\"symbol\":\"RM\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":false,\"decimalDigits\":2},\"MZN\":{\"code\":\"MZN\",\"symbol\":\"MT\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":false,\"decimalDigits\":0},\"NAD\":{\"code\":\"NAD\",\"symbol\":\"$\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":false,\"decimalDigits\":2},\"NGN\":{\"code\":\"NGN\",\"symbol\":\"₦\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":false,\"decimalDigits\":2},\"NIO\":{\"code\":\"NIO\",\"symbol\":\"C$\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":true,\"decimalDigits\":2},\"NOK\":{\"code\":\"NOK\",\"symbol\":\"kr\",\"thousandsSeparator\":\" \",\"decimalSeparator\":\",\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":true,\"decimalDigits\":2},\"NPR\":{\"code\":\"NPR\",\"symbol\":\"₨\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":false,\"decimalDigits\":2},\"NZD\":{\"code\":\"NZD\",\"symbol\":\"$\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":false,\"decimalDigits\":2},\"OMR\":{\"code\":\"OMR\",\"symbol\":\"ï·¼\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":true,\"decimalDigits\":3},\"PAB\":{\"code\":\"PAB\",\"symbol\":\"B/.\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":true,\"decimalDigits\":2},\"PEN\":{\"code\":\"PEN\",\"symbol\":\"S/.\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":true,\"decimalDigits\":2},\"PGK\":{\"code\":\"PGK\",\"symbol\":\"K\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":false,\"decimalDigits\":2},\"PHP\":{\"code\":\"PHP\",\"symbol\":\"₱\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":false,\"decimalDigits\":2},\"PKR\":{\"code\":\"PKR\",\"symbol\":\"₨\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":false,\"decimalDigits\":2},\"PLN\":{\"code\":\"PLN\",\"symbol\":\"zÅ‚\",\"thousandsSeparator\":\" \",\"decimalSeparator\":\",\",\"symbolOnLeft\":false,\"spaceBetweenAmountAndSymbol\":true,\"decimalDigits\":2},\"PYG\":{\"code\":\"PYG\",\"symbol\":\"₲\",\"thousandsSeparator\":\".\",\"decimalSeparator\":\",\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":true,\"decimalDigits\":2},\"QAR\":{\"code\":\"QAR\",\"symbol\":\"ï·¼\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":true,\"decimalDigits\":2},\"RON\":{\"code\":\"RON\",\"symbol\":\"lei\",\"thousandsSeparator\":\".\",\"decimalSeparator\":\",\",\"symbolOnLeft\":false,\"spaceBetweenAmountAndSymbol\":true,\"decimalDigits\":2},\"RSD\":{\"code\":\"RSD\",\"symbol\":\"Дин.\",\"thousandsSeparator\":\".\",\"decimalSeparator\":\",\",\"symbolOnLeft\":false,\"spaceBetweenAmountAndSymbol\":true,\"decimalDigits\":2},\"RUB\":{\"code\":\"RUB\",\"symbol\":\"₽\",\"thousandsSeparator\":\" \",\"decimalSeparator\":\",\",\"symbolOnLeft\":false,\"spaceBetweenAmountAndSymbol\":true,\"decimalDigits\":2},\"RWF\":{\"code\":\"RWF\",\"symbol\":\"RWF\",\"thousandsSeparator\":\" \",\"decimalSeparator\":\",\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":true,\"decimalDigits\":2},\"SAR\":{\"code\":\"SAR\",\"symbol\":\"ï·¼\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":true,\"decimalDigits\":2},\"SBD\":{\"code\":\"SBD\",\"symbol\":\"$\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":false,\"decimalDigits\":2},\"SCR\":{\"code\":\"SCR\",\"symbol\":\"₨\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":false,\"decimalDigits\":2},\"SDD\":{\"code\":\"SDD\",\"symbol\":\"LSd\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":false,\"spaceBetweenAmountAndSymbol\":false,\"decimalDigits\":2},\"SDG\":{\"code\":\"SDG\",\"symbol\":\"£â€\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":false,\"decimalDigits\":2},\"SEK\":{\"code\":\"SEK\",\"symbol\":\"kr\",\"thousandsSeparator\":\".\",\"decimalSeparator\":\",\",\"symbolOnLeft\":false,\"spaceBetweenAmountAndSymbol\":true,\"decimalDigits\":2},\"SGD\":{\"code\":\"SGD\",\"symbol\":\"$\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":false,\"decimalDigits\":2},\"SHP\":{\"code\":\"SHP\",\"symbol\":\"£\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":false,\"decimalDigits\":2},\"SLL\":{\"code\":\"SLL\",\"symbol\":\"Le\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":false,\"decimalDigits\":2},\"SOS\":{\"code\":\"SOS\",\"symbol\":\"S\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":false,\"decimalDigits\":2},\"SRD\":{\"code\":\"SRD\",\"symbol\":\"$\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":false,\"decimalDigits\":2},\"STD\":{\"code\":\"STD\",\"symbol\":\"Db\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":false,\"decimalDigits\":2},\"SVC\":{\"code\":\"SVC\",\"symbol\":\"â‚¡\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":false,\"decimalDigits\":2},\"SYP\":{\"code\":\"SYP\",\"symbol\":\"£\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":true,\"decimalDigits\":2},\"SZL\":{\"code\":\"SZL\",\"symbol\":\"E\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":false,\"decimalDigits\":2},\"THB\":{\"code\":\"THB\",\"symbol\":\"฿\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":false,\"decimalDigits\":2},\"TJS\":{\"code\":\"TJS\",\"symbol\":\"TJS\",\"thousandsSeparator\":\" \",\"decimalSeparator\":\";\",\"symbolOnLeft\":false,\"spaceBetweenAmountAndSymbol\":true,\"decimalDigits\":2},\"TMT\":{\"code\":\"TMT\",\"symbol\":\"m\",\"thousandsSeparator\":\" \",\"decimalSeparator\":\",\",\"symbolOnLeft\":false,\"spaceBetweenAmountAndSymbol\":false,\"decimalDigits\":0},\"TND\":{\"code\":\"TND\",\"symbol\":\"د.ت.â€\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":true,\"decimalDigits\":3},\"TOP\":{\"code\":\"TOP\",\"symbol\":\"T$\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":false,\"decimalDigits\":2},\"TRY\":{\"code\":\"TRY\",\"symbol\":\"₺\",\"thousandsSeparator\":\".\",\"decimalSeparator\":\",\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":false,\"decimalDigits\":2},\"TTD\":{\"code\":\"TTD\",\"symbol\":\"TT$\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":false,\"decimalDigits\":2},\"TVD\":{\"code\":\"TVD\",\"symbol\":\"$\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":false,\"decimalDigits\":2},\"TWD\":{\"code\":\"TWD\",\"symbol\":\"NT$\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":false,\"decimalDigits\":2},\"TZS\":{\"code\":\"TZS\",\"symbol\":\"TSh\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":false,\"decimalDigits\":2},\"UAH\":{\"code\":\"UAH\",\"symbol\":\"â‚´\",\"thousandsSeparator\":\" \",\"decimalSeparator\":\",\",\"symbolOnLeft\":false,\"spaceBetweenAmountAndSymbol\":false,\"decimalDigits\":2},\"UGX\":{\"code\":\"UGX\",\"symbol\":\"USh\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":false,\"decimalDigits\":2},\"USD\":{\"code\":\"USD\",\"symbol\":\"$\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":false,\"decimalDigits\":2},\"UYU\":{\"code\":\"UYU\",\"symbol\":\"$U\",\"thousandsSeparator\":\".\",\"decimalSeparator\":\",\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":true,\"decimalDigits\":2},\"UZS\":{\"code\":\"UZS\",\"symbol\":\"Ñўм\",\"thousandsSeparator\":\" \",\"decimalSeparator\":\",\",\"symbolOnLeft\":false,\"spaceBetweenAmountAndSymbol\":true,\"decimalDigits\":2},\"VEB\":{\"code\":\"VEB\",\"symbol\":\"Bs.\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":false,\"decimalDigits\":2},\"VEF\":{\"code\":\"VEF\",\"symbol\":\"Bs. F.\",\"thousandsSeparator\":\".\",\"decimalSeparator\":\",\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":true,\"decimalDigits\":2},\"VND\":{\"code\":\"VND\",\"symbol\":\"â‚«\",\"thousandsSeparator\":\".\",\"decimalSeparator\":\".\",\"symbolOnLeft\":false,\"spaceBetweenAmountAndSymbol\":true,\"decimalDigits\":0},\"VUV\":{\"code\":\"VUV\",\"symbol\":\"VT\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":false,\"spaceBetweenAmountAndSymbol\":false,\"decimalDigits\":0},\"WST\":{\"code\":\"WST\",\"symbol\":\"WS$\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":false,\"decimalDigits\":2},\"XAF\":{\"code\":\"XAF\",\"symbol\":\"F\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":false,\"spaceBetweenAmountAndSymbol\":false,\"decimalDigits\":2},\"XCD\":{\"code\":\"XCD\",\"symbol\":\"$\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":false,\"decimalDigits\":2},\"XBT\":{\"code\":\"XBT\",\"symbol\":\"Ƀ\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":false,\"spaceBetweenAmountAndSymbol\":false,\"decimalDigits\":2},\"XOF\":{\"code\":\"XOF\",\"symbol\":\"F\",\"thousandsSeparator\":\" \",\"decimalSeparator\":\",\",\"symbolOnLeft\":false,\"spaceBetweenAmountAndSymbol\":false,\"decimalDigits\":2},\"XPF\":{\"code\":\"XPF\",\"symbol\":\"F\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":false,\"spaceBetweenAmountAndSymbol\":false,\"decimalDigits\":2},\"YER\":{\"code\":\"YER\",\"symbol\":\"ï·¼\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":true,\"decimalDigits\":2},\"ZAR\":{\"code\":\"ZAR\",\"symbol\":\"R\",\"thousandsSeparator\":\" \",\"decimalSeparator\":\",\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":false,\"decimalDigits\":2},\"ZMW\":{\"code\":\"ZMW\",\"symbol\":\"ZK\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":false,\"decimalDigits\":2},\"WON\":{\"code\":\"WON\",\"symbol\":\"â‚©\",\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":false,\"decimalDigits\":2}}"); - -/***/ }), - -/***/ "./node_modules/currency-formatter/index.js": -/*!**************************************************!*\ - !*** ./node_modules/currency-formatter/index.js ***! - \**************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -var accounting = __webpack_require__(/*! accounting */ "./node_modules/accounting/accounting.js"); - -var assign = __webpack_require__(/*! object-assign */ "./node_modules/object-assign/index.js"); - -var localeCurrency = __webpack_require__(/*! locale-currency */ "./node_modules/locale-currency/index.js"); - -var currencies = __webpack_require__(/*! ./currencies.json */ "./node_modules/currency-formatter/currencies.json"); - -var localeFormats = __webpack_require__(/*! ./localeFormats.json */ "./node_modules/currency-formatter/localeFormats.json"); - -var defaultCurrency = { - symbol: '', - thousandsSeparator: ',', - decimalSeparator: '.', - symbolOnLeft: true, - spaceBetweenAmountAndSymbol: false, - decimalDigits: 2 -}; -var defaultLocaleFormat = {}; -var formatMapping = [{ - symbolOnLeft: true, - spaceBetweenAmountAndSymbol: false, - format: { - pos: '%s%v', - neg: '-%s%v', - zero: '%s%v' - } -}, { - symbolOnLeft: true, - spaceBetweenAmountAndSymbol: true, - format: { - pos: '%s %v', - neg: '-%s %v', - zero: '%s %v' - } -}, { - symbolOnLeft: false, - spaceBetweenAmountAndSymbol: false, - format: { - pos: '%v%s', - neg: '-%v%s', - zero: '%v%s' - } -}, { - symbolOnLeft: false, - spaceBetweenAmountAndSymbol: true, - format: { - pos: '%v %s', - neg: '-%v %s', - zero: '%v %s' - } -}]; - -function format(value, options) { - var code = options.code || options.locale && localeCurrency.getCurrency(options.locale); - var localeMatch = /^([a-z]+)([_-]([a-z]+))?$/i.exec(options.locale) || []; - var language = localeMatch[1]; - var region = localeMatch[3]; - var localeFormat = assign({}, defaultLocaleFormat, localeFormats[language] || {}, localeFormats[language + '-' + region] || {}); - var currency = assign({}, defaultCurrency, findCurrency(code), localeFormat); - var symbolOnLeft = currency.symbolOnLeft; - var spaceBetweenAmountAndSymbol = currency.spaceBetweenAmountAndSymbol; - var format = formatMapping.filter(function (f) { - return f.symbolOnLeft == symbolOnLeft && f.spaceBetweenAmountAndSymbol == spaceBetweenAmountAndSymbol; - })[0].format; - return accounting.formatMoney(value, { - symbol: isUndefined(options.symbol) ? currency.symbol : options.symbol, - decimal: isUndefined(options.decimal) ? currency.decimalSeparator : options.decimal, - thousand: isUndefined(options.thousand) ? currency.thousandsSeparator : options.thousand, - precision: typeof options.precision === 'number' ? options.precision : currency.decimalDigits, - format: ['string', 'object'].indexOf(typeof options.format) > -1 ? options.format : format - }); -} - -function findCurrency(currencyCode) { - return currencies[currencyCode]; -} - -function isUndefined(val) { - return typeof val === 'undefined'; -} - -function unformat(value, options) { - var code = options.code || options.locale && localeCurrency.getCurrency(options.locale); - var localeFormat = localeFormats[options.locale] || defaultLocaleFormat; - var currency = assign({}, defaultCurrency, findCurrency(code), localeFormat); - var decimal = isUndefined(options.decimal) ? currency.decimalSeparator : options.decimal; - return accounting.unformat(value, decimal); -} - -module.exports = { - defaultCurrency: defaultCurrency, - - get currencies() { - // In favor of backwards compatibility, the currencies map is converted to an array here - return Object.keys(currencies).map(function (key) { - return currencies[key]; - }); - }, - - findCurrency: findCurrency, - format: format, - unformat: unformat -}; - -/***/ }), - -/***/ "./node_modules/currency-formatter/localeFormats.json": -/*!************************************************************!*\ - !*** ./node_modules/currency-formatter/localeFormats.json ***! - \************************************************************/ -/*! exports provided: de, el, en-US, en-IE, zh-CN, es, it, nl, default */ -/***/ (function(module) { - -module.exports = JSON.parse("{\"de\":{\"thousandsSeparator\":\".\",\"decimalSeparator\":\",\",\"symbolOnLeft\":false,\"spaceBetweenAmountAndSymbol\":true,\"decimalDigits\":2},\"el\":{\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":false,\"thousandsSeparator\":\".\",\"decimalSeparator\":\",\",\"decimalDigits\":2},\"en-US\":{\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":false,\"decimalDigits\":2},\"en-IE\":{\"symbolOnLeft\":true,\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"spaceBetweenAmountAndSymbol\":true,\"decimalDigits\":2},\"zh-CN\":{\"thousandsSeparator\":\",\",\"decimalSeparator\":\".\",\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":false,\"decimalDigits\":2},\"es\":{\"thousandsSeparator\":\".\",\"decimalSeparator\":\",\",\"symbolOnLeft\":false,\"spaceBetweenAmountAndSymbol\":true,\"decimalDigits\":2},\"it\":{\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":false,\"thousandsSeparator\":\".\",\"decimalSeparator\":\",\",\"decimalDigits\":2},\"nl\":{\"symbolOnLeft\":true,\"spaceBetweenAmountAndSymbol\":false,\"thousandsSeparator\":\".\",\"decimalSeparator\":\",\",\"decimalDigits\":2}}"); - -/***/ }), - -/***/ "./node_modules/damerau-levenshtein/index.js": -/*!***************************************************!*\ - !*** ./node_modules/damerau-levenshtein/index.js ***! - \***************************************************/ -/*! no static exports found */ -/***/ (function(module, exports) { - -// TheSpanishInquisition -// Cache the matrix. Note that if you not pass a limit this implementation will use a dynamically calculate one. -module.exports = function (__this, that, limit) { - var thisLength = __this.length, - thatLength = that.length, - matrix = []; // If the limit is not defined it will be calculate from this and that args. - - limit = (limit || (thatLength > thisLength ? thatLength : thisLength)) + 1; - - for (var i = 0; i < limit; i++) { - matrix[i] = [i]; - matrix[i].length = limit; - } - - for (i = 0; i < limit; i++) { - matrix[0][i] = i; - } - - if (Math.abs(thisLength - thatLength) > (limit || 100)) { - return prepare(limit || 100); - } - - if (thisLength === 0) { - return prepare(thatLength); - } - - if (thatLength === 0) { - return prepare(thisLength); - } // Calculate matrix. - - - var j, this_i, that_j, cost, min, t; - - for (i = 1; i <= thisLength; ++i) { - this_i = __this[i - 1]; // Step 4 - - for (j = 1; j <= thatLength; ++j) { - // Check the jagged ld total so far - if (i === j && matrix[i][j] > 4) return prepare(thisLength); - that_j = that[j - 1]; - cost = this_i === that_j ? 0 : 1; // Step 5 - // Calculate the minimum (much faster than Math.min(...)). - - min = matrix[i - 1][j] + 1; // Deletion. - - if ((t = matrix[i][j - 1] + 1) < min) min = t; // Insertion. - - if ((t = matrix[i - 1][j - 1] + cost) < min) min = t; // Substitution. - // Update matrix. - - matrix[i][j] = i > 1 && j > 1 && this_i === that[j - 2] && __this[i - 2] === that_j && (t = matrix[i - 2][j - 2] + cost) < min ? t : min; // Transposition. - } - } - - return prepare(matrix[thisLength][thatLength]); - /** - * - */ - - function prepare(steps) { - var length = Math.max(thisLength, thatLength); - var relative = length === 0 ? 0 : steps / length; - var similarity = 1 - relative; - return { - steps: steps, - relative: relative, - similarity: similarity - }; - } -}; - -/***/ }), - -/***/ "./node_modules/date-fns/esm/_lib/addLeadingZeros/index.js": -/*!*****************************************************************!*\ - !*** ./node_modules/date-fns/esm/_lib/addLeadingZeros/index.js ***! - \*****************************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return addLeadingZeros; }); -function addLeadingZeros(number, targetLength) { - var sign = number < 0 ? '-' : ''; - var output = Math.abs(number).toString(); - - while (output.length < targetLength) { - output = '0' + output; - } - - return sign + output; -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/_lib/assign/index.js": -/*!********************************************************!*\ - !*** ./node_modules/date-fns/esm/_lib/assign/index.js ***! - \********************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return assign; }); -function assign(target, dirtyObject) { - if (target == null) { - throw new TypeError('assign requires that input parameter not be null or undefined'); - } - - dirtyObject = dirtyObject || {}; - - for (var property in dirtyObject) { - if (dirtyObject.hasOwnProperty(property)) { - target[property] = dirtyObject[property]; - } - } - - return target; -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/_lib/cloneObject/index.js": -/*!*************************************************************!*\ - !*** ./node_modules/date-fns/esm/_lib/cloneObject/index.js ***! - \*************************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return cloneObject; }); -/* harmony import */ var _assign_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../assign/index.js */ "./node_modules/date-fns/esm/_lib/assign/index.js"); - -function cloneObject(dirtyObject) { - return Object(_assign_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])({}, dirtyObject); -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/_lib/format/formatters/index.js": -/*!*******************************************************************!*\ - !*** ./node_modules/date-fns/esm/_lib/format/formatters/index.js ***! - \*******************************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var _lightFormatters_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../lightFormatters/index.js */ "./node_modules/date-fns/esm/_lib/format/lightFormatters/index.js"); -/* harmony import */ var _lib_getUTCDayOfYear_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../../_lib/getUTCDayOfYear/index.js */ "./node_modules/date-fns/esm/_lib/getUTCDayOfYear/index.js"); -/* harmony import */ var _lib_getUTCISOWeek_index_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../_lib/getUTCISOWeek/index.js */ "./node_modules/date-fns/esm/_lib/getUTCISOWeek/index.js"); -/* harmony import */ var _lib_getUTCISOWeekYear_index_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../../_lib/getUTCISOWeekYear/index.js */ "./node_modules/date-fns/esm/_lib/getUTCISOWeekYear/index.js"); -/* harmony import */ var _lib_getUTCWeek_index_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../_lib/getUTCWeek/index.js */ "./node_modules/date-fns/esm/_lib/getUTCWeek/index.js"); -/* harmony import */ var _lib_getUTCWeekYear_index_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../../_lib/getUTCWeekYear/index.js */ "./node_modules/date-fns/esm/_lib/getUTCWeekYear/index.js"); -/* harmony import */ var _addLeadingZeros_index_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../addLeadingZeros/index.js */ "./node_modules/date-fns/esm/_lib/addLeadingZeros/index.js"); - - - - - - - -var dayPeriodEnum = { - am: 'am', - pm: 'pm', - midnight: 'midnight', - noon: 'noon', - morning: 'morning', - afternoon: 'afternoon', - evening: 'evening', - night: 'night' -}; -/* - * | | Unit | | Unit | - * |-----|--------------------------------|-----|--------------------------------| - * | a | AM, PM | A* | Milliseconds in day | - * | b | AM, PM, noon, midnight | B | Flexible day period | - * | c | Stand-alone local day of week | C* | Localized hour w/ day period | - * | d | Day of month | D | Day of year | - * | e | Local day of week | E | Day of week | - * | f | | F* | Day of week in month | - * | g* | Modified Julian day | G | Era | - * | h | Hour [1-12] | H | Hour [0-23] | - * | i! | ISO day of week | I! | ISO week of year | - * | j* | Localized hour w/ day period | J* | Localized hour w/o day period | - * | k | Hour [1-24] | K | Hour [0-11] | - * | l* | (deprecated) | L | Stand-alone month | - * | m | Minute | M | Month | - * | n | | N | | - * | o! | Ordinal number modifier | O | Timezone (GMT) | - * | p! | Long localized time | P! | Long localized date | - * | q | Stand-alone quarter | Q | Quarter | - * | r* | Related Gregorian year | R! | ISO week-numbering year | - * | s | Second | S | Fraction of second | - * | t! | Seconds timestamp | T! | Milliseconds timestamp | - * | u | Extended year | U* | Cyclic year | - * | v* | Timezone (generic non-locat.) | V* | Timezone (location) | - * | w | Local week of year | W* | Week of month | - * | x | Timezone (ISO-8601 w/o Z) | X | Timezone (ISO-8601) | - * | y | Year (abs) | Y | Local week-numbering year | - * | z | Timezone (specific non-locat.) | Z* | Timezone (aliases) | - * - * Letters marked by * are not implemented but reserved by Unicode standard. - * - * Letters marked by ! are non-standard, but implemented by date-fns: - * - `o` modifies the previous token to turn it into an ordinal (see `format` docs) - * - `i` is ISO day of week. For `i` and `ii` is returns numeric ISO week days, - * i.e. 7 for Sunday, 1 for Monday, etc. - * - `I` is ISO week of year, as opposed to `w` which is local week of year. - * - `R` is ISO week-numbering year, as opposed to `Y` which is local week-numbering year. - * `R` is supposed to be used in conjunction with `I` and `i` - * for universal ISO week-numbering date, whereas - * `Y` is supposed to be used in conjunction with `w` and `e` - * for week-numbering date specific to the locale. - * - `P` is long localized date format - * - `p` is long localized time format - */ - -var formatters = { - // Era - G: function (date, token, localize) { - var era = date.getUTCFullYear() > 0 ? 1 : 0; - - switch (token) { - // AD, BC - case 'G': - case 'GG': - case 'GGG': - return localize.era(era, { - width: 'abbreviated' - }); - // A, B - - case 'GGGGG': - return localize.era(era, { - width: 'narrow' - }); - // Anno Domini, Before Christ - - case 'GGGG': - default: - return localize.era(era, { - width: 'wide' - }); - } - }, - // Year - y: function (date, token, localize) { - // Ordinal number - if (token === 'yo') { - var signedYear = date.getUTCFullYear(); // Returns 1 for 1 BC (which is year 0 in JavaScript) - - var year = signedYear > 0 ? signedYear : 1 - signedYear; - return localize.ordinalNumber(year, { - unit: 'year' - }); - } - - return _lightFormatters_index_js__WEBPACK_IMPORTED_MODULE_0__["default"].y(date, token); - }, - // Local week-numbering year - Y: function (date, token, localize, options) { - var signedWeekYear = Object(_lib_getUTCWeekYear_index_js__WEBPACK_IMPORTED_MODULE_5__["default"])(date, options); // Returns 1 for 1 BC (which is year 0 in JavaScript) - - var weekYear = signedWeekYear > 0 ? signedWeekYear : 1 - signedWeekYear; // Two digit year - - if (token === 'YY') { - var twoDigitYear = weekYear % 100; - return Object(_addLeadingZeros_index_js__WEBPACK_IMPORTED_MODULE_6__["default"])(twoDigitYear, 2); - } // Ordinal number - - - if (token === 'Yo') { - return localize.ordinalNumber(weekYear, { - unit: 'year' - }); - } // Padding - - - return Object(_addLeadingZeros_index_js__WEBPACK_IMPORTED_MODULE_6__["default"])(weekYear, token.length); - }, - // ISO week-numbering year - R: function (date, token) { - var isoWeekYear = Object(_lib_getUTCISOWeekYear_index_js__WEBPACK_IMPORTED_MODULE_3__["default"])(date); // Padding - - return Object(_addLeadingZeros_index_js__WEBPACK_IMPORTED_MODULE_6__["default"])(isoWeekYear, token.length); - }, - // Extended year. This is a single number designating the year of this calendar system. - // The main difference between `y` and `u` localizers are B.C. years: - // | Year | `y` | `u` | - // |------|-----|-----| - // | AC 1 | 1 | 1 | - // | BC 1 | 1 | 0 | - // | BC 2 | 2 | -1 | - // Also `yy` always returns the last two digits of a year, - // while `uu` pads single digit years to 2 characters and returns other years unchanged. - u: function (date, token) { - var year = date.getUTCFullYear(); - return Object(_addLeadingZeros_index_js__WEBPACK_IMPORTED_MODULE_6__["default"])(year, token.length); - }, - // Quarter - Q: function (date, token, localize) { - var quarter = Math.ceil((date.getUTCMonth() + 1) / 3); - - switch (token) { - // 1, 2, 3, 4 - case 'Q': - return String(quarter); - // 01, 02, 03, 04 - - case 'QQ': - return Object(_addLeadingZeros_index_js__WEBPACK_IMPORTED_MODULE_6__["default"])(quarter, 2); - // 1st, 2nd, 3rd, 4th - - case 'Qo': - return localize.ordinalNumber(quarter, { - unit: 'quarter' - }); - // Q1, Q2, Q3, Q4 - - case 'QQQ': - return localize.quarter(quarter, { - width: 'abbreviated', - context: 'formatting' - }); - // 1, 2, 3, 4 (narrow quarter; could be not numerical) - - case 'QQQQQ': - return localize.quarter(quarter, { - width: 'narrow', - context: 'formatting' - }); - // 1st quarter, 2nd quarter, ... - - case 'QQQQ': - default: - return localize.quarter(quarter, { - width: 'wide', - context: 'formatting' - }); - } - }, - // Stand-alone quarter - q: function (date, token, localize) { - var quarter = Math.ceil((date.getUTCMonth() + 1) / 3); - - switch (token) { - // 1, 2, 3, 4 - case 'q': - return String(quarter); - // 01, 02, 03, 04 - - case 'qq': - return Object(_addLeadingZeros_index_js__WEBPACK_IMPORTED_MODULE_6__["default"])(quarter, 2); - // 1st, 2nd, 3rd, 4th - - case 'qo': - return localize.ordinalNumber(quarter, { - unit: 'quarter' - }); - // Q1, Q2, Q3, Q4 - - case 'qqq': - return localize.quarter(quarter, { - width: 'abbreviated', - context: 'standalone' - }); - // 1, 2, 3, 4 (narrow quarter; could be not numerical) - - case 'qqqqq': - return localize.quarter(quarter, { - width: 'narrow', - context: 'standalone' - }); - // 1st quarter, 2nd quarter, ... - - case 'qqqq': - default: - return localize.quarter(quarter, { - width: 'wide', - context: 'standalone' - }); - } - }, - // Month - M: function (date, token, localize) { - var month = date.getUTCMonth(); - - switch (token) { - case 'M': - case 'MM': - return _lightFormatters_index_js__WEBPACK_IMPORTED_MODULE_0__["default"].M(date, token); - // 1st, 2nd, ..., 12th - - case 'Mo': - return localize.ordinalNumber(month + 1, { - unit: 'month' - }); - // Jan, Feb, ..., Dec - - case 'MMM': - return localize.month(month, { - width: 'abbreviated', - context: 'formatting' - }); - // J, F, ..., D - - case 'MMMMM': - return localize.month(month, { - width: 'narrow', - context: 'formatting' - }); - // January, February, ..., December - - case 'MMMM': - default: - return localize.month(month, { - width: 'wide', - context: 'formatting' - }); - } - }, - // Stand-alone month - L: function (date, token, localize) { - var month = date.getUTCMonth(); - - switch (token) { - // 1, 2, ..., 12 - case 'L': - return String(month + 1); - // 01, 02, ..., 12 - - case 'LL': - return Object(_addLeadingZeros_index_js__WEBPACK_IMPORTED_MODULE_6__["default"])(month + 1, 2); - // 1st, 2nd, ..., 12th - - case 'Lo': - return localize.ordinalNumber(month + 1, { - unit: 'month' - }); - // Jan, Feb, ..., Dec - - case 'LLL': - return localize.month(month, { - width: 'abbreviated', - context: 'standalone' - }); - // J, F, ..., D - - case 'LLLLL': - return localize.month(month, { - width: 'narrow', - context: 'standalone' - }); - // January, February, ..., December - - case 'LLLL': - default: - return localize.month(month, { - width: 'wide', - context: 'standalone' - }); - } - }, - // Local week of year - w: function (date, token, localize, options) { - var week = Object(_lib_getUTCWeek_index_js__WEBPACK_IMPORTED_MODULE_4__["default"])(date, options); - - if (token === 'wo') { - return localize.ordinalNumber(week, { - unit: 'week' - }); - } - - return Object(_addLeadingZeros_index_js__WEBPACK_IMPORTED_MODULE_6__["default"])(week, token.length); - }, - // ISO week of year - I: function (date, token, localize) { - var isoWeek = Object(_lib_getUTCISOWeek_index_js__WEBPACK_IMPORTED_MODULE_2__["default"])(date); - - if (token === 'Io') { - return localize.ordinalNumber(isoWeek, { - unit: 'week' - }); - } - - return Object(_addLeadingZeros_index_js__WEBPACK_IMPORTED_MODULE_6__["default"])(isoWeek, token.length); - }, - // Day of the month - d: function (date, token, localize) { - if (token === 'do') { - return localize.ordinalNumber(date.getUTCDate(), { - unit: 'date' - }); - } - - return _lightFormatters_index_js__WEBPACK_IMPORTED_MODULE_0__["default"].d(date, token); - }, - // Day of year - D: function (date, token, localize) { - var dayOfYear = Object(_lib_getUTCDayOfYear_index_js__WEBPACK_IMPORTED_MODULE_1__["default"])(date); - - if (token === 'Do') { - return localize.ordinalNumber(dayOfYear, { - unit: 'dayOfYear' - }); - } - - return Object(_addLeadingZeros_index_js__WEBPACK_IMPORTED_MODULE_6__["default"])(dayOfYear, token.length); - }, - // Day of week - E: function (date, token, localize) { - var dayOfWeek = date.getUTCDay(); - - switch (token) { - // Tue - case 'E': - case 'EE': - case 'EEE': - return localize.day(dayOfWeek, { - width: 'abbreviated', - context: 'formatting' - }); - // T - - case 'EEEEE': - return localize.day(dayOfWeek, { - width: 'narrow', - context: 'formatting' - }); - // Tu - - case 'EEEEEE': - return localize.day(dayOfWeek, { - width: 'short', - context: 'formatting' - }); - // Tuesday - - case 'EEEE': - default: - return localize.day(dayOfWeek, { - width: 'wide', - context: 'formatting' - }); - } - }, - // Local day of week - e: function (date, token, localize, options) { - var dayOfWeek = date.getUTCDay(); - var localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7; - - switch (token) { - // Numerical value (Nth day of week with current locale or weekStartsOn) - case 'e': - return String(localDayOfWeek); - // Padded numerical value - - case 'ee': - return Object(_addLeadingZeros_index_js__WEBPACK_IMPORTED_MODULE_6__["default"])(localDayOfWeek, 2); - // 1st, 2nd, ..., 7th - - case 'eo': - return localize.ordinalNumber(localDayOfWeek, { - unit: 'day' - }); - - case 'eee': - return localize.day(dayOfWeek, { - width: 'abbreviated', - context: 'formatting' - }); - // T - - case 'eeeee': - return localize.day(dayOfWeek, { - width: 'narrow', - context: 'formatting' - }); - // Tu - - case 'eeeeee': - return localize.day(dayOfWeek, { - width: 'short', - context: 'formatting' - }); - // Tuesday - - case 'eeee': - default: - return localize.day(dayOfWeek, { - width: 'wide', - context: 'formatting' - }); - } - }, - // Stand-alone local day of week - c: function (date, token, localize, options) { - var dayOfWeek = date.getUTCDay(); - var localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7; - - switch (token) { - // Numerical value (same as in `e`) - case 'c': - return String(localDayOfWeek); - // Padded numerical value - - case 'cc': - return Object(_addLeadingZeros_index_js__WEBPACK_IMPORTED_MODULE_6__["default"])(localDayOfWeek, token.length); - // 1st, 2nd, ..., 7th - - case 'co': - return localize.ordinalNumber(localDayOfWeek, { - unit: 'day' - }); - - case 'ccc': - return localize.day(dayOfWeek, { - width: 'abbreviated', - context: 'standalone' - }); - // T - - case 'ccccc': - return localize.day(dayOfWeek, { - width: 'narrow', - context: 'standalone' - }); - // Tu - - case 'cccccc': - return localize.day(dayOfWeek, { - width: 'short', - context: 'standalone' - }); - // Tuesday - - case 'cccc': - default: - return localize.day(dayOfWeek, { - width: 'wide', - context: 'standalone' - }); - } - }, - // ISO day of week - i: function (date, token, localize) { - var dayOfWeek = date.getUTCDay(); - var isoDayOfWeek = dayOfWeek === 0 ? 7 : dayOfWeek; - - switch (token) { - // 2 - case 'i': - return String(isoDayOfWeek); - // 02 - - case 'ii': - return Object(_addLeadingZeros_index_js__WEBPACK_IMPORTED_MODULE_6__["default"])(isoDayOfWeek, token.length); - // 2nd - - case 'io': - return localize.ordinalNumber(isoDayOfWeek, { - unit: 'day' - }); - // Tue - - case 'iii': - return localize.day(dayOfWeek, { - width: 'abbreviated', - context: 'formatting' - }); - // T - - case 'iiiii': - return localize.day(dayOfWeek, { - width: 'narrow', - context: 'formatting' - }); - // Tu - - case 'iiiiii': - return localize.day(dayOfWeek, { - width: 'short', - context: 'formatting' - }); - // Tuesday - - case 'iiii': - default: - return localize.day(dayOfWeek, { - width: 'wide', - context: 'formatting' - }); - } - }, - // AM or PM - a: function (date, token, localize) { - var hours = date.getUTCHours(); - var dayPeriodEnumValue = hours / 12 >= 1 ? 'pm' : 'am'; - - switch (token) { - case 'a': - case 'aa': - case 'aaa': - return localize.dayPeriod(dayPeriodEnumValue, { - width: 'abbreviated', - context: 'formatting' - }); - - case 'aaaaa': - return localize.dayPeriod(dayPeriodEnumValue, { - width: 'narrow', - context: 'formatting' - }); - - case 'aaaa': - default: - return localize.dayPeriod(dayPeriodEnumValue, { - width: 'wide', - context: 'formatting' - }); - } - }, - // AM, PM, midnight, noon - b: function (date, token, localize) { - var hours = date.getUTCHours(); - var dayPeriodEnumValue; - - if (hours === 12) { - dayPeriodEnumValue = dayPeriodEnum.noon; - } else if (hours === 0) { - dayPeriodEnumValue = dayPeriodEnum.midnight; - } else { - dayPeriodEnumValue = hours / 12 >= 1 ? 'pm' : 'am'; - } - - switch (token) { - case 'b': - case 'bb': - case 'bbb': - return localize.dayPeriod(dayPeriodEnumValue, { - width: 'abbreviated', - context: 'formatting' - }); - - case 'bbbbb': - return localize.dayPeriod(dayPeriodEnumValue, { - width: 'narrow', - context: 'formatting' - }); - - case 'bbbb': - default: - return localize.dayPeriod(dayPeriodEnumValue, { - width: 'wide', - context: 'formatting' - }); - } - }, - // in the morning, in the afternoon, in the evening, at night - B: function (date, token, localize) { - var hours = date.getUTCHours(); - var dayPeriodEnumValue; - - if (hours >= 17) { - dayPeriodEnumValue = dayPeriodEnum.evening; - } else if (hours >= 12) { - dayPeriodEnumValue = dayPeriodEnum.afternoon; - } else if (hours >= 4) { - dayPeriodEnumValue = dayPeriodEnum.morning; - } else { - dayPeriodEnumValue = dayPeriodEnum.night; - } - - switch (token) { - case 'B': - case 'BB': - case 'BBB': - return localize.dayPeriod(dayPeriodEnumValue, { - width: 'abbreviated', - context: 'formatting' - }); - - case 'BBBBB': - return localize.dayPeriod(dayPeriodEnumValue, { - width: 'narrow', - context: 'formatting' - }); - - case 'BBBB': - default: - return localize.dayPeriod(dayPeriodEnumValue, { - width: 'wide', - context: 'formatting' - }); - } - }, - // Hour [1-12] - h: function (date, token, localize) { - if (token === 'ho') { - var hours = date.getUTCHours() % 12; - if (hours === 0) hours = 12; - return localize.ordinalNumber(hours, { - unit: 'hour' - }); - } - - return _lightFormatters_index_js__WEBPACK_IMPORTED_MODULE_0__["default"].h(date, token); - }, - // Hour [0-23] - H: function (date, token, localize) { - if (token === 'Ho') { - return localize.ordinalNumber(date.getUTCHours(), { - unit: 'hour' - }); - } - - return _lightFormatters_index_js__WEBPACK_IMPORTED_MODULE_0__["default"].H(date, token); - }, - // Hour [0-11] - K: function (date, token, localize) { - var hours = date.getUTCHours() % 12; - - if (token === 'Ko') { - return localize.ordinalNumber(hours, { - unit: 'hour' - }); - } - - return Object(_addLeadingZeros_index_js__WEBPACK_IMPORTED_MODULE_6__["default"])(hours, token.length); - }, - // Hour [1-24] - k: function (date, token, localize) { - var hours = date.getUTCHours(); - if (hours === 0) hours = 24; - - if (token === 'ko') { - return localize.ordinalNumber(hours, { - unit: 'hour' - }); - } - - return Object(_addLeadingZeros_index_js__WEBPACK_IMPORTED_MODULE_6__["default"])(hours, token.length); - }, - // Minute - m: function (date, token, localize) { - if (token === 'mo') { - return localize.ordinalNumber(date.getUTCMinutes(), { - unit: 'minute' - }); - } - - return _lightFormatters_index_js__WEBPACK_IMPORTED_MODULE_0__["default"].m(date, token); - }, - // Second - s: function (date, token, localize) { - if (token === 'so') { - return localize.ordinalNumber(date.getUTCSeconds(), { - unit: 'second' - }); - } - - return _lightFormatters_index_js__WEBPACK_IMPORTED_MODULE_0__["default"].s(date, token); - }, - // Fraction of second - S: function (date, token) { - var numberOfDigits = token.length; - var milliseconds = date.getUTCMilliseconds(); - var fractionalSeconds = Math.floor(milliseconds * Math.pow(10, numberOfDigits - 3)); - return Object(_addLeadingZeros_index_js__WEBPACK_IMPORTED_MODULE_6__["default"])(fractionalSeconds, numberOfDigits); - }, - // Timezone (ISO-8601. If offset is 0, output is always `'Z'`) - X: function (date, token, _localize, options) { - var originalDate = options._originalDate || date; - var timezoneOffset = originalDate.getTimezoneOffset(); - - if (timezoneOffset === 0) { - return 'Z'; - } - - switch (token) { - // Hours and optional minutes - case 'X': - return formatTimezoneWithOptionalMinutes(timezoneOffset); - // Hours, minutes and optional seconds without `:` delimiter - // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets - // so this token always has the same output as `XX` - - case 'XXXX': - case 'XX': - // Hours and minutes without `:` delimiter - return formatTimezone(timezoneOffset); - // Hours, minutes and optional seconds with `:` delimiter - // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets - // so this token always has the same output as `XXX` - - case 'XXXXX': - case 'XXX': // Hours and minutes with `:` delimiter - - default: - return formatTimezone(timezoneOffset, ':'); - } - }, - // Timezone (ISO-8601. If offset is 0, output is `'+00:00'` or equivalent) - x: function (date, token, _localize, options) { - var originalDate = options._originalDate || date; - var timezoneOffset = originalDate.getTimezoneOffset(); - - switch (token) { - // Hours and optional minutes - case 'x': - return formatTimezoneWithOptionalMinutes(timezoneOffset); - // Hours, minutes and optional seconds without `:` delimiter - // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets - // so this token always has the same output as `xx` - - case 'xxxx': - case 'xx': - // Hours and minutes without `:` delimiter - return formatTimezone(timezoneOffset); - // Hours, minutes and optional seconds with `:` delimiter - // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets - // so this token always has the same output as `xxx` - - case 'xxxxx': - case 'xxx': // Hours and minutes with `:` delimiter - - default: - return formatTimezone(timezoneOffset, ':'); - } - }, - // Timezone (GMT) - O: function (date, token, _localize, options) { - var originalDate = options._originalDate || date; - var timezoneOffset = originalDate.getTimezoneOffset(); - - switch (token) { - // Short - case 'O': - case 'OO': - case 'OOO': - return 'GMT' + formatTimezoneShort(timezoneOffset, ':'); - // Long - - case 'OOOO': - default: - return 'GMT' + formatTimezone(timezoneOffset, ':'); - } - }, - // Timezone (specific non-location) - z: function (date, token, _localize, options) { - var originalDate = options._originalDate || date; - var timezoneOffset = originalDate.getTimezoneOffset(); - - switch (token) { - // Short - case 'z': - case 'zz': - case 'zzz': - return 'GMT' + formatTimezoneShort(timezoneOffset, ':'); - // Long - - case 'zzzz': - default: - return 'GMT' + formatTimezone(timezoneOffset, ':'); - } - }, - // Seconds timestamp - t: function (date, token, _localize, options) { - var originalDate = options._originalDate || date; - var timestamp = Math.floor(originalDate.getTime() / 1000); - return Object(_addLeadingZeros_index_js__WEBPACK_IMPORTED_MODULE_6__["default"])(timestamp, token.length); - }, - // Milliseconds timestamp - T: function (date, token, _localize, options) { - var originalDate = options._originalDate || date; - var timestamp = originalDate.getTime(); - return Object(_addLeadingZeros_index_js__WEBPACK_IMPORTED_MODULE_6__["default"])(timestamp, token.length); - } -}; - -function formatTimezoneShort(offset, dirtyDelimiter) { - var sign = offset > 0 ? '-' : '+'; - var absOffset = Math.abs(offset); - var hours = Math.floor(absOffset / 60); - var minutes = absOffset % 60; - - if (minutes === 0) { - return sign + String(hours); - } - - var delimiter = dirtyDelimiter || ''; - return sign + String(hours) + delimiter + Object(_addLeadingZeros_index_js__WEBPACK_IMPORTED_MODULE_6__["default"])(minutes, 2); -} - -function formatTimezoneWithOptionalMinutes(offset, dirtyDelimiter) { - if (offset % 60 === 0) { - var sign = offset > 0 ? '-' : '+'; - return sign + Object(_addLeadingZeros_index_js__WEBPACK_IMPORTED_MODULE_6__["default"])(Math.abs(offset) / 60, 2); - } - - return formatTimezone(offset, dirtyDelimiter); -} - -function formatTimezone(offset, dirtyDelimiter) { - var delimiter = dirtyDelimiter || ''; - var sign = offset > 0 ? '-' : '+'; - var absOffset = Math.abs(offset); - var hours = Object(_addLeadingZeros_index_js__WEBPACK_IMPORTED_MODULE_6__["default"])(Math.floor(absOffset / 60), 2); - var minutes = Object(_addLeadingZeros_index_js__WEBPACK_IMPORTED_MODULE_6__["default"])(absOffset % 60, 2); - return sign + hours + delimiter + minutes; -} - -/* harmony default export */ __webpack_exports__["default"] = (formatters); - -/***/ }), - -/***/ "./node_modules/date-fns/esm/_lib/format/lightFormatters/index.js": -/*!************************************************************************!*\ - !*** ./node_modules/date-fns/esm/_lib/format/lightFormatters/index.js ***! - \************************************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var _addLeadingZeros_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../addLeadingZeros/index.js */ "./node_modules/date-fns/esm/_lib/addLeadingZeros/index.js"); - -/* - * | | Unit | | Unit | - * |-----|--------------------------------|-----|--------------------------------| - * | a | AM, PM | A* | Milliseconds in day | - * | c | Stand-alone local day of week | C* | Localized hour w/ day period | - * | d | Day of month | D | Day of year | - * | e | Local day of week | E | Day of week | - * | f | | F* | Day of week in month | - * | g* | Modified Julian day | G | Era | - * | h | Hour [1-12] | H | Hour [0-23] | - * | i! | ISO day of week | I! | ISO week of year | - * | j* | Localized hour w/ day period | J* | Localized hour w/o day period | - * | k | Hour [1-24] | K | Hour [0-11] | - * | l* | (deprecated) | L | Stand-alone month | - * | m | Minute | M | Month | - * | n | | N | | - * | o! | Ordinal number modifier | O | Timezone (GMT) | - * | p! | Long localized time | P! | Long localized date | - * | q | Stand-alone quarter | Q | Quarter | - * | r* | Related Gregorian year | R! | ISO week-numbering year | - * | s | Second | S | Fraction of second | - * | t! | Seconds timestamp | T! | Milliseconds timestamp | - * | u | Extended year | U* | Cyclic year | - * | v* | Timezone (generic non-locat.) | V* | Timezone (location) | - * | w | Local week of year | W* | Week of month | - * | x | Timezone (ISO-8601 w/o Z) | X | Timezone (ISO-8601) | - * | y | Year (abs) | Y | Local week-numbering year | - * | z | Timezone (specific non-locat.) | Z* | Timezone (aliases) | - * - * Letters marked by * are not implemented but reserved by Unicode standard. - * - * Letters marked by ! are non-standard, but implemented by date-fns: - * - `o` modifies the previous token to turn it into an ordinal (see `format` docs) - * - `i` is ISO day of week. For `i` and `ii` is returns numeric ISO week days, - * i.e. 7 for Sunday, 1 for Monday, etc. - * - `I` is ISO week of year, as opposed to `w` which is local week of year. - * - `R` is ISO week-numbering year, as opposed to `Y` which is local week-numbering year. - * `R` is supposed to be used in conjunction with `I` and `i` - * for universal ISO week-numbering date, whereas - * `Y` is supposed to be used in conjunction with `w` and `e` - * for week-numbering date specific to the locale. - * - `P` is long localized date format - * - `p` is long localized time format - */ - -var formatters = { - // Year - y: function (date, token) { - // From http://www.unicode.org/reports/tr35/tr35-31/tr35-dates.html#Date_Format_tokens - // | Year | y | yy | yyy | yyyy | yyyyy | - // |----------|-------|----|-------|-------|-------| - // | AD 1 | 1 | 01 | 001 | 0001 | 00001 | - // | AD 12 | 12 | 12 | 012 | 0012 | 00012 | - // | AD 123 | 123 | 23 | 123 | 0123 | 00123 | - // | AD 1234 | 1234 | 34 | 1234 | 1234 | 01234 | - // | AD 12345 | 12345 | 45 | 12345 | 12345 | 12345 | - var signedYear = date.getUTCFullYear(); // Returns 1 for 1 BC (which is year 0 in JavaScript) - - var year = signedYear > 0 ? signedYear : 1 - signedYear; - return Object(_addLeadingZeros_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(token === 'yy' ? year % 100 : year, token.length); - }, - // Month - M: function (date, token) { - var month = date.getUTCMonth(); - return token === 'M' ? String(month + 1) : Object(_addLeadingZeros_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(month + 1, 2); - }, - // Day of the month - d: function (date, token) { - return Object(_addLeadingZeros_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(date.getUTCDate(), token.length); - }, - // AM or PM - a: function (date, token) { - var dayPeriodEnumValue = date.getUTCHours() / 12 >= 1 ? 'pm' : 'am'; - - switch (token) { - case 'a': - case 'aa': - case 'aaa': - return dayPeriodEnumValue.toUpperCase(); - - case 'aaaaa': - return dayPeriodEnumValue[0]; - - case 'aaaa': - default: - return dayPeriodEnumValue === 'am' ? 'a.m.' : 'p.m.'; - } - }, - // Hour [1-12] - h: function (date, token) { - return Object(_addLeadingZeros_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(date.getUTCHours() % 12 || 12, token.length); - }, - // Hour [0-23] - H: function (date, token) { - return Object(_addLeadingZeros_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(date.getUTCHours(), token.length); - }, - // Minute - m: function (date, token) { - return Object(_addLeadingZeros_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(date.getUTCMinutes(), token.length); - }, - // Second - s: function (date, token) { - return Object(_addLeadingZeros_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(date.getUTCSeconds(), token.length); - } -}; -/* harmony default export */ __webpack_exports__["default"] = (formatters); - -/***/ }), - -/***/ "./node_modules/date-fns/esm/_lib/format/longFormatters/index.js": -/*!***********************************************************************!*\ - !*** ./node_modules/date-fns/esm/_lib/format/longFormatters/index.js ***! - \***********************************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -function dateLongFormatter(pattern, formatLong) { - switch (pattern) { - case 'P': - return formatLong.date({ - width: 'short' - }); - - case 'PP': - return formatLong.date({ - width: 'medium' - }); - - case 'PPP': - return formatLong.date({ - width: 'long' - }); - - case 'PPPP': - default: - return formatLong.date({ - width: 'full' - }); - } -} - -function timeLongFormatter(pattern, formatLong) { - switch (pattern) { - case 'p': - return formatLong.time({ - width: 'short' - }); - - case 'pp': - return formatLong.time({ - width: 'medium' - }); - - case 'ppp': - return formatLong.time({ - width: 'long' - }); - - case 'pppp': - default: - return formatLong.time({ - width: 'full' - }); - } -} - -function dateTimeLongFormatter(pattern, formatLong) { - var matchResult = pattern.match(/(P+)(p+)?/); - var datePattern = matchResult[1]; - var timePattern = matchResult[2]; - - if (!timePattern) { - return dateLongFormatter(pattern, formatLong); - } - - var dateTimeFormat; - - switch (datePattern) { - case 'P': - dateTimeFormat = formatLong.dateTime({ - width: 'short' - }); - break; - - case 'PP': - dateTimeFormat = formatLong.dateTime({ - width: 'medium' - }); - break; - - case 'PPP': - dateTimeFormat = formatLong.dateTime({ - width: 'long' - }); - break; - - case 'PPPP': - default: - dateTimeFormat = formatLong.dateTime({ - width: 'full' - }); - break; - } - - return dateTimeFormat.replace('{{date}}', dateLongFormatter(datePattern, formatLong)).replace('{{time}}', timeLongFormatter(timePattern, formatLong)); -} - -var longFormatters = { - p: timeLongFormatter, - P: dateTimeLongFormatter -}; -/* harmony default export */ __webpack_exports__["default"] = (longFormatters); - -/***/ }), - -/***/ "./node_modules/date-fns/esm/_lib/getTimezoneOffsetInMilliseconds/index.js": -/*!*********************************************************************************!*\ - !*** ./node_modules/date-fns/esm/_lib/getTimezoneOffsetInMilliseconds/index.js ***! - \*********************************************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return getTimezoneOffsetInMilliseconds; }); -var MILLISECONDS_IN_MINUTE = 60000; -/** - * Google Chrome as of 67.0.3396.87 introduced timezones with offset that includes seconds. - * They usually appear for dates that denote time before the timezones were introduced - * (e.g. for 'Europe/Prague' timezone the offset is GMT+00:57:44 before 1 October 1891 - * and GMT+01:00:00 after that date) - * - * Date#getTimezoneOffset returns the offset in minutes and would return 57 for the example above, - * which would lead to incorrect calculations. - * - * This function returns the timezone offset in milliseconds that takes seconds in account. - */ - -function getTimezoneOffsetInMilliseconds(dirtyDate) { - var date = new Date(dirtyDate.getTime()); - var baseTimezoneOffset = date.getTimezoneOffset(); - date.setSeconds(0, 0); - var millisecondsPartOfTimezoneOffset = date.getTime() % MILLISECONDS_IN_MINUTE; - return baseTimezoneOffset * MILLISECONDS_IN_MINUTE + millisecondsPartOfTimezoneOffset; -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/_lib/getUTCDayOfYear/index.js": -/*!*****************************************************************!*\ - !*** ./node_modules/date-fns/esm/_lib/getUTCDayOfYear/index.js ***! - \*****************************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return getUTCDayOfYear; }); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); - -var MILLISECONDS_IN_DAY = 86400000; // This function will be a part of public API when UTC function will be implemented. -// See issue: https://github.com/date-fns/date-fns/issues/376 - -function getUTCDayOfYear(dirtyDate) { - if (arguments.length < 1) { - throw new TypeError('1 argument required, but only ' + arguments.length + ' present'); - } - - var date = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDate); - var timestamp = date.getTime(); - date.setUTCMonth(0, 1); - date.setUTCHours(0, 0, 0, 0); - var startOfYearTimestamp = date.getTime(); - var difference = timestamp - startOfYearTimestamp; - return Math.floor(difference / MILLISECONDS_IN_DAY) + 1; -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/_lib/getUTCISOWeek/index.js": -/*!***************************************************************!*\ - !*** ./node_modules/date-fns/esm/_lib/getUTCISOWeek/index.js ***! - \***************************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return getUTCISOWeek; }); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); -/* harmony import */ var _startOfUTCISOWeek_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../startOfUTCISOWeek/index.js */ "./node_modules/date-fns/esm/_lib/startOfUTCISOWeek/index.js"); -/* harmony import */ var _startOfUTCISOWeekYear_index_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../startOfUTCISOWeekYear/index.js */ "./node_modules/date-fns/esm/_lib/startOfUTCISOWeekYear/index.js"); - - - -var MILLISECONDS_IN_WEEK = 604800000; // This function will be a part of public API when UTC function will be implemented. -// See issue: https://github.com/date-fns/date-fns/issues/376 - -function getUTCISOWeek(dirtyDate) { - if (arguments.length < 1) { - throw new TypeError('1 argument required, but only ' + arguments.length + ' present'); - } - - var date = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDate); - var diff = Object(_startOfUTCISOWeek_index_js__WEBPACK_IMPORTED_MODULE_1__["default"])(date).getTime() - Object(_startOfUTCISOWeekYear_index_js__WEBPACK_IMPORTED_MODULE_2__["default"])(date).getTime(); // Round the number of days to the nearest integer - // because the number of milliseconds in a week is not constant - // (e.g. it's different in the week of the daylight saving time clock shift) - - return Math.round(diff / MILLISECONDS_IN_WEEK) + 1; -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/_lib/getUTCISOWeekYear/index.js": -/*!*******************************************************************!*\ - !*** ./node_modules/date-fns/esm/_lib/getUTCISOWeekYear/index.js ***! - \*******************************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return getUTCISOWeekYear; }); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); -/* harmony import */ var _startOfUTCISOWeek_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../startOfUTCISOWeek/index.js */ "./node_modules/date-fns/esm/_lib/startOfUTCISOWeek/index.js"); - - // This function will be a part of public API when UTC function will be implemented. -// See issue: https://github.com/date-fns/date-fns/issues/376 - -function getUTCISOWeekYear(dirtyDate) { - if (arguments.length < 1) { - throw new TypeError('1 argument required, but only ' + arguments.length + ' present'); - } - - var date = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDate); - var year = date.getUTCFullYear(); - var fourthOfJanuaryOfNextYear = new Date(0); - fourthOfJanuaryOfNextYear.setUTCFullYear(year + 1, 0, 4); - fourthOfJanuaryOfNextYear.setUTCHours(0, 0, 0, 0); - var startOfNextYear = Object(_startOfUTCISOWeek_index_js__WEBPACK_IMPORTED_MODULE_1__["default"])(fourthOfJanuaryOfNextYear); - var fourthOfJanuaryOfThisYear = new Date(0); - fourthOfJanuaryOfThisYear.setUTCFullYear(year, 0, 4); - fourthOfJanuaryOfThisYear.setUTCHours(0, 0, 0, 0); - var startOfThisYear = Object(_startOfUTCISOWeek_index_js__WEBPACK_IMPORTED_MODULE_1__["default"])(fourthOfJanuaryOfThisYear); - - if (date.getTime() >= startOfNextYear.getTime()) { - return year + 1; - } else if (date.getTime() >= startOfThisYear.getTime()) { - return year; - } else { - return year - 1; - } -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/_lib/getUTCWeek/index.js": -/*!************************************************************!*\ - !*** ./node_modules/date-fns/esm/_lib/getUTCWeek/index.js ***! - \************************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return getUTCWeek; }); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); -/* harmony import */ var _startOfUTCWeek_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../startOfUTCWeek/index.js */ "./node_modules/date-fns/esm/_lib/startOfUTCWeek/index.js"); -/* harmony import */ var _startOfUTCWeekYear_index_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../startOfUTCWeekYear/index.js */ "./node_modules/date-fns/esm/_lib/startOfUTCWeekYear/index.js"); - - - -var MILLISECONDS_IN_WEEK = 604800000; // This function will be a part of public API when UTC function will be implemented. -// See issue: https://github.com/date-fns/date-fns/issues/376 - -function getUTCWeek(dirtyDate, options) { - if (arguments.length < 1) { - throw new TypeError('1 argument required, but only ' + arguments.length + ' present'); - } - - var date = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDate); - var diff = Object(_startOfUTCWeek_index_js__WEBPACK_IMPORTED_MODULE_1__["default"])(date, options).getTime() - Object(_startOfUTCWeekYear_index_js__WEBPACK_IMPORTED_MODULE_2__["default"])(date, options).getTime(); // Round the number of days to the nearest integer - // because the number of milliseconds in a week is not constant - // (e.g. it's different in the week of the daylight saving time clock shift) - - return Math.round(diff / MILLISECONDS_IN_WEEK) + 1; -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/_lib/getUTCWeekYear/index.js": -/*!****************************************************************!*\ - !*** ./node_modules/date-fns/esm/_lib/getUTCWeekYear/index.js ***! - \****************************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return getUTCWeekYear; }); -/* harmony import */ var _toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../toInteger/index.js */ "./node_modules/date-fns/esm/_lib/toInteger/index.js"); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); -/* harmony import */ var _startOfUTCWeek_index_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../startOfUTCWeek/index.js */ "./node_modules/date-fns/esm/_lib/startOfUTCWeek/index.js"); - - - // This function will be a part of public API when UTC function will be implemented. -// See issue: https://github.com/date-fns/date-fns/issues/376 - -function getUTCWeekYear(dirtyDate, dirtyOptions) { - if (arguments.length < 1) { - throw new TypeError('1 argument required, but only ' + arguments.length + ' present'); - } - - var date = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_1__["default"])(dirtyDate, dirtyOptions); - var year = date.getUTCFullYear(); - var options = dirtyOptions || {}; - var locale = options.locale; - var localeFirstWeekContainsDate = locale && locale.options && locale.options.firstWeekContainsDate; - var defaultFirstWeekContainsDate = localeFirstWeekContainsDate == null ? 1 : Object(_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(localeFirstWeekContainsDate); - var firstWeekContainsDate = options.firstWeekContainsDate == null ? defaultFirstWeekContainsDate : Object(_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(options.firstWeekContainsDate); // Test if weekStartsOn is between 1 and 7 _and_ is not NaN - - if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) { - throw new RangeError('firstWeekContainsDate must be between 1 and 7 inclusively'); - } - - var firstWeekOfNextYear = new Date(0); - firstWeekOfNextYear.setUTCFullYear(year + 1, 0, firstWeekContainsDate); - firstWeekOfNextYear.setUTCHours(0, 0, 0, 0); - var startOfNextYear = Object(_startOfUTCWeek_index_js__WEBPACK_IMPORTED_MODULE_2__["default"])(firstWeekOfNextYear, dirtyOptions); - var firstWeekOfThisYear = new Date(0); - firstWeekOfThisYear.setUTCFullYear(year, 0, firstWeekContainsDate); - firstWeekOfThisYear.setUTCHours(0, 0, 0, 0); - var startOfThisYear = Object(_startOfUTCWeek_index_js__WEBPACK_IMPORTED_MODULE_2__["default"])(firstWeekOfThisYear, dirtyOptions); - - if (date.getTime() >= startOfNextYear.getTime()) { - return year + 1; - } else if (date.getTime() >= startOfThisYear.getTime()) { - return year; - } else { - return year - 1; - } -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/_lib/protectedTokens/index.js": -/*!*****************************************************************!*\ - !*** ./node_modules/date-fns/esm/_lib/protectedTokens/index.js ***! - \*****************************************************************/ -/*! exports provided: protectedTokens, isProtectedToken, throwProtectedError */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "protectedTokens", function() { return protectedTokens; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isProtectedToken", function() { return isProtectedToken; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "throwProtectedError", function() { return throwProtectedError; }); -var protectedTokens = ['D', 'DD', 'YY', 'YYYY']; -function isProtectedToken(token) { - return protectedTokens.indexOf(token) !== -1; -} -function throwProtectedError(token) { - throw new RangeError('`options.awareOfUnicodeTokens` must be set to `true` to use `' + token + '` token; see: https://git.io/fxCyr'); -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/_lib/setUTCDay/index.js": -/*!***********************************************************!*\ - !*** ./node_modules/date-fns/esm/_lib/setUTCDay/index.js ***! - \***********************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return setUTCDay; }); -/* harmony import */ var _toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../toInteger/index.js */ "./node_modules/date-fns/esm/_lib/toInteger/index.js"); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); - - // This function will be a part of public API when UTC function will be implemented. -// See issue: https://github.com/date-fns/date-fns/issues/376 - -function setUTCDay(dirtyDate, dirtyDay, dirtyOptions) { - if (arguments.length < 2) { - throw new TypeError('2 arguments required, but only ' + arguments.length + ' present'); - } - - var options = dirtyOptions || {}; - var locale = options.locale; - var localeWeekStartsOn = locale && locale.options && locale.options.weekStartsOn; - var defaultWeekStartsOn = localeWeekStartsOn == null ? 0 : Object(_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(localeWeekStartsOn); - var weekStartsOn = options.weekStartsOn == null ? defaultWeekStartsOn : Object(_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(options.weekStartsOn); // Test if weekStartsOn is between 0 and 6 _and_ is not NaN - - if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) { - throw new RangeError('weekStartsOn must be between 0 and 6 inclusively'); - } - - var date = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_1__["default"])(dirtyDate); - var day = Object(_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDay); - var currentDay = date.getUTCDay(); - var remainder = day % 7; - var dayIndex = (remainder + 7) % 7; - var diff = (dayIndex < weekStartsOn ? 7 : 0) + day - currentDay; - date.setUTCDate(date.getUTCDate() + diff); - return date; -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/_lib/setUTCISODay/index.js": -/*!**************************************************************!*\ - !*** ./node_modules/date-fns/esm/_lib/setUTCISODay/index.js ***! - \**************************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return setUTCISODay; }); -/* harmony import */ var _toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../toInteger/index.js */ "./node_modules/date-fns/esm/_lib/toInteger/index.js"); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); - - // This function will be a part of public API when UTC function will be implemented. -// See issue: https://github.com/date-fns/date-fns/issues/376 - -function setUTCISODay(dirtyDate, dirtyDay) { - if (arguments.length < 2) { - throw new TypeError('2 arguments required, but only ' + arguments.length + ' present'); - } - - var day = Object(_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDay); - - if (day % 7 === 0) { - day = day - 7; - } - - var weekStartsOn = 1; - var date = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_1__["default"])(dirtyDate); - var currentDay = date.getUTCDay(); - var remainder = day % 7; - var dayIndex = (remainder + 7) % 7; - var diff = (dayIndex < weekStartsOn ? 7 : 0) + day - currentDay; - date.setUTCDate(date.getUTCDate() + diff); - return date; -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/_lib/setUTCISOWeek/index.js": -/*!***************************************************************!*\ - !*** ./node_modules/date-fns/esm/_lib/setUTCISOWeek/index.js ***! - \***************************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return setUTCISOWeek; }); -/* harmony import */ var _toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../toInteger/index.js */ "./node_modules/date-fns/esm/_lib/toInteger/index.js"); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); -/* harmony import */ var _getUTCISOWeek_index_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../getUTCISOWeek/index.js */ "./node_modules/date-fns/esm/_lib/getUTCISOWeek/index.js"); - - - // This function will be a part of public API when UTC function will be implemented. -// See issue: https://github.com/date-fns/date-fns/issues/376 - -function setUTCISOWeek(dirtyDate, dirtyISOWeek) { - if (arguments.length < 2) { - throw new TypeError('2 arguments required, but only ' + arguments.length + ' present'); - } - - var date = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_1__["default"])(dirtyDate); - var isoWeek = Object(_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyISOWeek); - var diff = Object(_getUTCISOWeek_index_js__WEBPACK_IMPORTED_MODULE_2__["default"])(date) - isoWeek; - date.setUTCDate(date.getUTCDate() - diff * 7); - return date; -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/_lib/setUTCWeek/index.js": -/*!************************************************************!*\ - !*** ./node_modules/date-fns/esm/_lib/setUTCWeek/index.js ***! - \************************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return setUTCWeek; }); -/* harmony import */ var _toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../toInteger/index.js */ "./node_modules/date-fns/esm/_lib/toInteger/index.js"); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); -/* harmony import */ var _getUTCWeek_index_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../getUTCWeek/index.js */ "./node_modules/date-fns/esm/_lib/getUTCWeek/index.js"); - - - // This function will be a part of public API when UTC function will be implemented. -// See issue: https://github.com/date-fns/date-fns/issues/376 - -function setUTCWeek(dirtyDate, dirtyWeek, options) { - if (arguments.length < 2) { - throw new TypeError('2 arguments required, but only ' + arguments.length + ' present'); - } - - var date = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_1__["default"])(dirtyDate); - var week = Object(_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyWeek); - var diff = Object(_getUTCWeek_index_js__WEBPACK_IMPORTED_MODULE_2__["default"])(date, options) - week; - date.setUTCDate(date.getUTCDate() - diff * 7); - return date; -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/_lib/startOfUTCISOWeek/index.js": -/*!*******************************************************************!*\ - !*** ./node_modules/date-fns/esm/_lib/startOfUTCISOWeek/index.js ***! - \*******************************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return startOfUTCISOWeek; }); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); - // This function will be a part of public API when UTC function will be implemented. -// See issue: https://github.com/date-fns/date-fns/issues/376 - -function startOfUTCISOWeek(dirtyDate) { - if (arguments.length < 1) { - throw new TypeError('1 argument required, but only ' + arguments.length + ' present'); - } - - var weekStartsOn = 1; - var date = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDate); - var day = date.getUTCDay(); - var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn; - date.setUTCDate(date.getUTCDate() - diff); - date.setUTCHours(0, 0, 0, 0); - return date; -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/_lib/startOfUTCISOWeekYear/index.js": -/*!***********************************************************************!*\ - !*** ./node_modules/date-fns/esm/_lib/startOfUTCISOWeekYear/index.js ***! - \***********************************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return startOfUTCISOWeekYear; }); -/* harmony import */ var _getUTCISOWeekYear_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../getUTCISOWeekYear/index.js */ "./node_modules/date-fns/esm/_lib/getUTCISOWeekYear/index.js"); -/* harmony import */ var _startOfUTCISOWeek_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../startOfUTCISOWeek/index.js */ "./node_modules/date-fns/esm/_lib/startOfUTCISOWeek/index.js"); - - // This function will be a part of public API when UTC function will be implemented. -// See issue: https://github.com/date-fns/date-fns/issues/376 - -function startOfUTCISOWeekYear(dirtyDate) { - if (arguments.length < 1) { - throw new TypeError('1 argument required, but only ' + arguments.length + ' present'); - } - - var year = Object(_getUTCISOWeekYear_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDate); - var fourthOfJanuary = new Date(0); - fourthOfJanuary.setUTCFullYear(year, 0, 4); - fourthOfJanuary.setUTCHours(0, 0, 0, 0); - var date = Object(_startOfUTCISOWeek_index_js__WEBPACK_IMPORTED_MODULE_1__["default"])(fourthOfJanuary); - return date; -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/_lib/startOfUTCWeek/index.js": -/*!****************************************************************!*\ - !*** ./node_modules/date-fns/esm/_lib/startOfUTCWeek/index.js ***! - \****************************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return startOfUTCWeek; }); -/* harmony import */ var _toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../toInteger/index.js */ "./node_modules/date-fns/esm/_lib/toInteger/index.js"); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); - - // This function will be a part of public API when UTC function will be implemented. -// See issue: https://github.com/date-fns/date-fns/issues/376 - -function startOfUTCWeek(dirtyDate, dirtyOptions) { - if (arguments.length < 1) { - throw new TypeError('1 argument required, but only ' + arguments.length + ' present'); - } - - var options = dirtyOptions || {}; - var locale = options.locale; - var localeWeekStartsOn = locale && locale.options && locale.options.weekStartsOn; - var defaultWeekStartsOn = localeWeekStartsOn == null ? 0 : Object(_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(localeWeekStartsOn); - var weekStartsOn = options.weekStartsOn == null ? defaultWeekStartsOn : Object(_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(options.weekStartsOn); // Test if weekStartsOn is between 0 and 6 _and_ is not NaN - - if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) { - throw new RangeError('weekStartsOn must be between 0 and 6 inclusively'); - } - - var date = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_1__["default"])(dirtyDate); - var day = date.getUTCDay(); - var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn; - date.setUTCDate(date.getUTCDate() - diff); - date.setUTCHours(0, 0, 0, 0); - return date; -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/_lib/startOfUTCWeekYear/index.js": -/*!********************************************************************!*\ - !*** ./node_modules/date-fns/esm/_lib/startOfUTCWeekYear/index.js ***! - \********************************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return startOfUTCWeekYear; }); -/* harmony import */ var _toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../toInteger/index.js */ "./node_modules/date-fns/esm/_lib/toInteger/index.js"); -/* harmony import */ var _getUTCWeekYear_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../getUTCWeekYear/index.js */ "./node_modules/date-fns/esm/_lib/getUTCWeekYear/index.js"); -/* harmony import */ var _startOfUTCWeek_index_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../startOfUTCWeek/index.js */ "./node_modules/date-fns/esm/_lib/startOfUTCWeek/index.js"); - - - // This function will be a part of public API when UTC function will be implemented. -// See issue: https://github.com/date-fns/date-fns/issues/376 - -function startOfUTCWeekYear(dirtyDate, dirtyOptions) { - if (arguments.length < 1) { - throw new TypeError('1 argument required, but only ' + arguments.length + ' present'); - } - - var options = dirtyOptions || {}; - var locale = options.locale; - var localeFirstWeekContainsDate = locale && locale.options && locale.options.firstWeekContainsDate; - var defaultFirstWeekContainsDate = localeFirstWeekContainsDate == null ? 1 : Object(_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(localeFirstWeekContainsDate); - var firstWeekContainsDate = options.firstWeekContainsDate == null ? defaultFirstWeekContainsDate : Object(_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(options.firstWeekContainsDate); - var year = Object(_getUTCWeekYear_index_js__WEBPACK_IMPORTED_MODULE_1__["default"])(dirtyDate, dirtyOptions); - var firstWeek = new Date(0); - firstWeek.setUTCFullYear(year, 0, firstWeekContainsDate); - firstWeek.setUTCHours(0, 0, 0, 0); - var date = Object(_startOfUTCWeek_index_js__WEBPACK_IMPORTED_MODULE_2__["default"])(firstWeek, dirtyOptions); - return date; -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/_lib/toInteger/index.js": -/*!***********************************************************!*\ - !*** ./node_modules/date-fns/esm/_lib/toInteger/index.js ***! - \***********************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return toInteger; }); -function toInteger(dirtyNumber) { - if (dirtyNumber === null || dirtyNumber === true || dirtyNumber === false) { - return NaN; - } - - var number = Number(dirtyNumber); - - if (isNaN(number)) { - return number; - } - - return number < 0 ? Math.ceil(number) : Math.floor(number); -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/addDays/index.js": -/*!****************************************************!*\ - !*** ./node_modules/date-fns/esm/addDays/index.js ***! - \****************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return addDays; }); -/* harmony import */ var _lib_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../_lib/toInteger/index.js */ "./node_modules/date-fns/esm/_lib/toInteger/index.js"); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); - - -/** - * @name addDays - * @category Day Helpers - * @summary Add the specified number of days to the given date. - * - * @description - * Add the specified number of days to the given date. - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} date - the date to be changed - * @param {Number} amount - the amount of days to be added - * @returns {Date} the new date with the days added - * @throws {TypeError} 2 arguments required - * - * @example - * // Add 10 days to 1 September 2014: - * var result = addDays(new Date(2014, 8, 1), 10) - * //=> Thu Sep 11 2014 00:00:00 - */ - -function addDays(dirtyDate, dirtyAmount) { - if (arguments.length < 2) { - throw new TypeError('2 arguments required, but only ' + arguments.length + ' present'); - } - - var date = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_1__["default"])(dirtyDate); - var amount = Object(_lib_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyAmount); - date.setDate(date.getDate() + amount); - return date; -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/addHours/index.js": -/*!*****************************************************!*\ - !*** ./node_modules/date-fns/esm/addHours/index.js ***! - \*****************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return addHours; }); -/* harmony import */ var _lib_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../_lib/toInteger/index.js */ "./node_modules/date-fns/esm/_lib/toInteger/index.js"); -/* harmony import */ var _addMilliseconds_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../addMilliseconds/index.js */ "./node_modules/date-fns/esm/addMilliseconds/index.js"); - - -var MILLISECONDS_IN_HOUR = 3600000; -/** - * @name addHours - * @category Hour Helpers - * @summary Add the specified number of hours to the given date. - * - * @description - * Add the specified number of hours to the given date. - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} date - the date to be changed - * @param {Number} amount - the amount of hours to be added - * @returns {Date} the new date with the hours added - * @throws {TypeError} 2 arguments required - * - * @example - * // Add 2 hours to 10 July 2014 23:00:00: - * var result = addHours(new Date(2014, 6, 10, 23, 0), 2) - * //=> Fri Jul 11 2014 01:00:00 - */ - -function addHours(dirtyDate, dirtyAmount) { - if (arguments.length < 2) { - throw new TypeError('2 arguments required, but only ' + arguments.length + ' present'); - } - - var amount = Object(_lib_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyAmount); - return Object(_addMilliseconds_index_js__WEBPACK_IMPORTED_MODULE_1__["default"])(dirtyDate, amount * MILLISECONDS_IN_HOUR); -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/addISOWeekYears/index.js": -/*!************************************************************!*\ - !*** ./node_modules/date-fns/esm/addISOWeekYears/index.js ***! - \************************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return addISOWeekYears; }); -/* harmony import */ var _lib_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../_lib/toInteger/index.js */ "./node_modules/date-fns/esm/_lib/toInteger/index.js"); -/* harmony import */ var _getISOWeekYear_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../getISOWeekYear/index.js */ "./node_modules/date-fns/esm/getISOWeekYear/index.js"); -/* harmony import */ var _setISOWeekYear_index_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../setISOWeekYear/index.js */ "./node_modules/date-fns/esm/setISOWeekYear/index.js"); - - - -/** - * @name addISOWeekYears - * @category ISO Week-Numbering Year Helpers - * @summary Add the specified number of ISO week-numbering years to the given date. - * - * @description - * Add the specified number of ISO week-numbering years to the given date. - * - * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * - The function was renamed from `addISOYears` to `addISOWeekYears`. - * "ISO week year" is short for [ISO week-numbering year](https://en.wikipedia.org/wiki/ISO_week_date). - * This change makes the name consistent with - * locale-dependent week-numbering year helpers, e.g., `addWeekYears`. - * - * @param {Date|Number} date - the date to be changed - * @param {Number} amount - the amount of ISO week-numbering years to be added - * @returns {Date} the new date with the ISO week-numbering years added - * @throws {TypeError} 2 arguments required - * - * @example - * // Add 5 ISO week-numbering years to 2 July 2010: - * var result = addISOWeekYears(new Date(2010, 6, 2), 5) - * //=> Fri Jun 26 2015 00:00:00 - */ - -function addISOWeekYears(dirtyDate, dirtyAmount) { - if (arguments.length < 2) { - throw new TypeError('2 arguments required, but only ' + arguments.length + ' present'); - } - - var amount = Object(_lib_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyAmount); - return Object(_setISOWeekYear_index_js__WEBPACK_IMPORTED_MODULE_2__["default"])(dirtyDate, Object(_getISOWeekYear_index_js__WEBPACK_IMPORTED_MODULE_1__["default"])(dirtyDate) + amount); -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/addMilliseconds/index.js": -/*!************************************************************!*\ - !*** ./node_modules/date-fns/esm/addMilliseconds/index.js ***! - \************************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return addMilliseconds; }); -/* harmony import */ var _lib_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../_lib/toInteger/index.js */ "./node_modules/date-fns/esm/_lib/toInteger/index.js"); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); - - -/** - * @name addMilliseconds - * @category Millisecond Helpers - * @summary Add the specified number of milliseconds to the given date. - * - * @description - * Add the specified number of milliseconds to the given date. - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} date - the date to be changed - * @param {Number} amount - the amount of milliseconds to be added - * @returns {Date} the new date with the milliseconds added - * @throws {TypeError} 2 arguments required - * - * @example - * // Add 750 milliseconds to 10 July 2014 12:45:30.000: - * var result = addMilliseconds(new Date(2014, 6, 10, 12, 45, 30, 0), 750) - * //=> Thu Jul 10 2014 12:45:30.750 - */ - -function addMilliseconds(dirtyDate, dirtyAmount) { - if (arguments.length < 2) { - throw new TypeError('2 arguments required, but only ' + arguments.length + ' present'); - } - - var timestamp = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_1__["default"])(dirtyDate).getTime(); - var amount = Object(_lib_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyAmount); - return new Date(timestamp + amount); -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/addMinutes/index.js": -/*!*******************************************************!*\ - !*** ./node_modules/date-fns/esm/addMinutes/index.js ***! - \*******************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return addMinutes; }); -/* harmony import */ var _lib_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../_lib/toInteger/index.js */ "./node_modules/date-fns/esm/_lib/toInteger/index.js"); -/* harmony import */ var _addMilliseconds_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../addMilliseconds/index.js */ "./node_modules/date-fns/esm/addMilliseconds/index.js"); - - -var MILLISECONDS_IN_MINUTE = 60000; -/** - * @name addMinutes - * @category Minute Helpers - * @summary Add the specified number of minutes to the given date. - * - * @description - * Add the specified number of minutes to the given date. - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} date - the date to be changed - * @param {Number} amount - the amount of minutes to be added - * @returns {Date} the new date with the minutes added - * @throws {TypeError} 2 arguments required - * - * @example - * // Add 30 minutes to 10 July 2014 12:00:00: - * var result = addMinutes(new Date(2014, 6, 10, 12, 0), 30) - * //=> Thu Jul 10 2014 12:30:00 - */ - -function addMinutes(dirtyDate, dirtyAmount) { - if (arguments.length < 2) { - throw new TypeError('2 arguments required, but only ' + arguments.length + ' present'); - } - - var amount = Object(_lib_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyAmount); - return Object(_addMilliseconds_index_js__WEBPACK_IMPORTED_MODULE_1__["default"])(dirtyDate, amount * MILLISECONDS_IN_MINUTE); -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/addMonths/index.js": -/*!******************************************************!*\ - !*** ./node_modules/date-fns/esm/addMonths/index.js ***! - \******************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return addMonths; }); -/* harmony import */ var _lib_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../_lib/toInteger/index.js */ "./node_modules/date-fns/esm/_lib/toInteger/index.js"); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); -/* harmony import */ var _getDaysInMonth_index_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../getDaysInMonth/index.js */ "./node_modules/date-fns/esm/getDaysInMonth/index.js"); - - - -/** - * @name addMonths - * @category Month Helpers - * @summary Add the specified number of months to the given date. - * - * @description - * Add the specified number of months to the given date. - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} date - the date to be changed - * @param {Number} amount - the amount of months to be added - * @returns {Date} the new date with the months added - * @throws {TypeError} 2 arguments required - * - * @example - * // Add 5 months to 1 September 2014: - * var result = addMonths(new Date(2014, 8, 1), 5) - * //=> Sun Feb 01 2015 00:00:00 - */ - -function addMonths(dirtyDate, dirtyAmount) { - if (arguments.length < 2) { - throw new TypeError('2 arguments required, but only ' + arguments.length + ' present'); - } - - var date = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_1__["default"])(dirtyDate); - var amount = Object(_lib_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyAmount); - var desiredMonth = date.getMonth() + amount; - var dateWithDesiredMonth = new Date(0); - dateWithDesiredMonth.setFullYear(date.getFullYear(), desiredMonth, 1); - dateWithDesiredMonth.setHours(0, 0, 0, 0); - var daysInMonth = Object(_getDaysInMonth_index_js__WEBPACK_IMPORTED_MODULE_2__["default"])(dateWithDesiredMonth); // Set the last day of the new month - // if the original date was the last day of the longer month - - date.setMonth(desiredMonth, Math.min(daysInMonth, date.getDate())); - return date; -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/addQuarters/index.js": -/*!********************************************************!*\ - !*** ./node_modules/date-fns/esm/addQuarters/index.js ***! - \********************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return addQuarters; }); -/* harmony import */ var _lib_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../_lib/toInteger/index.js */ "./node_modules/date-fns/esm/_lib/toInteger/index.js"); -/* harmony import */ var _addMonths_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../addMonths/index.js */ "./node_modules/date-fns/esm/addMonths/index.js"); - - -/** - * @name addQuarters - * @category Quarter Helpers - * @summary Add the specified number of year quarters to the given date. - * - * @description - * Add the specified number of year quarters to the given date. - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} date - the date to be changed - * @param {Number} amount - the amount of quarters to be added - * @returns {Date} the new date with the quarters added - * @throws {TypeError} 2 arguments required - * - * @example - * // Add 1 quarter to 1 September 2014: - * var result = addQuarters(new Date(2014, 8, 1), 1) - * //=> Mon Dec 01 2014 00:00:00 - */ - -function addQuarters(dirtyDate, dirtyAmount) { - if (arguments.length < 2) { - throw new TypeError('2 arguments required, but only ' + arguments.length + ' present'); - } - - var amount = Object(_lib_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyAmount); - var months = amount * 3; - return Object(_addMonths_index_js__WEBPACK_IMPORTED_MODULE_1__["default"])(dirtyDate, months); -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/addSeconds/index.js": -/*!*******************************************************!*\ - !*** ./node_modules/date-fns/esm/addSeconds/index.js ***! - \*******************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return addSeconds; }); -/* harmony import */ var _lib_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../_lib/toInteger/index.js */ "./node_modules/date-fns/esm/_lib/toInteger/index.js"); -/* harmony import */ var _addMilliseconds_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../addMilliseconds/index.js */ "./node_modules/date-fns/esm/addMilliseconds/index.js"); - - -/** - * @name addSeconds - * @category Second Helpers - * @summary Add the specified number of seconds to the given date. - * - * @description - * Add the specified number of seconds to the given date. - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} date - the date to be changed - * @param {Number} amount - the amount of seconds to be added - * @returns {Date} the new date with the seconds added - * @throws {TypeError} 2 arguments required - * - * @example - * // Add 30 seconds to 10 July 2014 12:45:00: - * var result = addSeconds(new Date(2014, 6, 10, 12, 45, 0), 30) - * //=> Thu Jul 10 2014 12:45:30 - */ - -function addSeconds(dirtyDate, dirtyAmount) { - if (arguments.length < 2) { - throw new TypeError('2 arguments required, but only ' + arguments.length + ' present'); - } - - var amount = Object(_lib_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyAmount); - return Object(_addMilliseconds_index_js__WEBPACK_IMPORTED_MODULE_1__["default"])(dirtyDate, amount * 1000); -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/addWeeks/index.js": -/*!*****************************************************!*\ - !*** ./node_modules/date-fns/esm/addWeeks/index.js ***! - \*****************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return addWeeks; }); -/* harmony import */ var _lib_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../_lib/toInteger/index.js */ "./node_modules/date-fns/esm/_lib/toInteger/index.js"); -/* harmony import */ var _addDays_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../addDays/index.js */ "./node_modules/date-fns/esm/addDays/index.js"); - - -/** - * @name addWeeks - * @category Week Helpers - * @summary Add the specified number of weeks to the given date. - * - * @description - * Add the specified number of week to the given date. - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} date - the date to be changed - * @param {Number} amount - the amount of weeks to be added - * @returns {Date} the new date with the weeks added - * @throws {TypeError} 2 arguments required - * - * @example - * // Add 4 weeks to 1 September 2014: - * var result = addWeeks(new Date(2014, 8, 1), 4) - * //=> Mon Sep 29 2014 00:00:00 - */ - -function addWeeks(dirtyDate, dirtyAmount) { - if (arguments.length < 2) { - throw new TypeError('2 arguments required, but only ' + arguments.length + ' present'); - } - - var amount = Object(_lib_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyAmount); - var days = amount * 7; - return Object(_addDays_index_js__WEBPACK_IMPORTED_MODULE_1__["default"])(dirtyDate, days); -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/addYears/index.js": -/*!*****************************************************!*\ - !*** ./node_modules/date-fns/esm/addYears/index.js ***! - \*****************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return addYears; }); -/* harmony import */ var _lib_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../_lib/toInteger/index.js */ "./node_modules/date-fns/esm/_lib/toInteger/index.js"); -/* harmony import */ var _addMonths_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../addMonths/index.js */ "./node_modules/date-fns/esm/addMonths/index.js"); - - -/** - * @name addYears - * @category Year Helpers - * @summary Add the specified number of years to the given date. - * - * @description - * Add the specified number of years to the given date. - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} date - the date to be changed - * @param {Number} amount - the amount of years to be added - * @returns {Date} the new date with the years added - * @throws {TypeError} 2 arguments required - * - * @example - * // Add 5 years to 1 September 2014: - * var result = addYears(new Date(2014, 8, 1), 5) - * //=> Sun Sep 01 2019 00:00:00 - */ - -function addYears(dirtyDate, dirtyAmount) { - if (arguments.length < 2) { - throw new TypeError('2 arguments required, but only ' + arguments.length + ' present'); - } - - var amount = Object(_lib_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyAmount); - return Object(_addMonths_index_js__WEBPACK_IMPORTED_MODULE_1__["default"])(dirtyDate, amount * 12); -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/areIntervalsOverlapping/index.js": -/*!********************************************************************!*\ - !*** ./node_modules/date-fns/esm/areIntervalsOverlapping/index.js ***! - \********************************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return areIntervalsOverlapping; }); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); - -/** - * @name areIntervalsOverlapping - * @category Interval Helpers - * @summary Is the given time interval overlapping with another time interval? - * - * @description - * Is the given time interval overlapping with another time interval? - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * - The function was renamed from `areRangesOverlapping` to `areIntervalsOverlapping`. - * This change was made to mirror the use of the word "interval" in standard ISO 8601:2004 terminology: - * - * ``` - * 2.1.3 - * time interval - * part of the time axis limited by two instants - * ``` - * - * Also, this function now accepts an object with `start` and `end` properties - * instead of two arguments as an interval. - * This function now throws `RangeError` if the start of the interval is after its end - * or if any date in the interval is `Invalid Date`. - * - * ```javascript - * // Before v2.0.0 - * - * areRangesOverlapping( - * new Date(2014, 0, 10), new Date(2014, 0, 20), - * new Date(2014, 0, 17), new Date(2014, 0, 21) - * ) - * - * // v2.0.0 onward - * - * areIntervalsOverlapping( - * { start: new Date(2014, 0, 10), end: new Date(2014, 0, 20) }, - * { start: new Date(2014, 0, 17), end: new Date(2014, 0, 21) } - * ) - * ``` - * - * @param {Interval} intervalLeft - the first interval to compare. See [Interval]{@link docs/types/Interval} - * @param {Interval} intervalRight - the second interval to compare. See [Interval]{@link docs/types/Interval} - * @returns {Boolean} whether the time intervals are overlapping - * @throws {TypeError} 2 arguments required - * @throws {RangeError} The start of an interval cannot be after its end - * @throws {RangeError} Date in interval cannot be `Invalid Date` - * - * @example - * // For overlapping time intervals: - * areIntervalsOverlapping( - * { start: new Date(2014, 0, 10), end: new Date(2014, 0, 20) }, - * { start: new Date(2014, 0, 17), end: new Date(2014, 0, 21) } - * ) - * //=> true - * - * @example - * // For non-overlapping time intervals: - * areIntervalsOverlapping( - * { start: new Date(2014, 0, 10), end: new Date(2014, 0, 20) }, - * { start: new Date(2014, 0, 21), end: new Date(2014, 0, 22) } - * ) - * //=> false - */ - -function areIntervalsOverlapping(dirtyIntervalLeft, dirtyIntervalRight) { - if (arguments.length < 2) { - throw new TypeError('2 arguments required, but only ' + arguments.length + ' present'); - } - - var intervalLeft = dirtyIntervalLeft || {}; - var intervalRight = dirtyIntervalRight || {}; - var leftStartTime = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(intervalLeft.start).getTime(); - var leftEndTime = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(intervalLeft.end).getTime(); - var rightStartTime = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(intervalRight.start).getTime(); - var rightEndTime = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(intervalRight.end).getTime(); // Throw an exception if start date is after end date or if any date is `Invalid Date` - - if (!(leftStartTime <= leftEndTime && rightStartTime <= rightEndTime)) { - throw new RangeError('Invalid interval'); - } - - return leftStartTime < rightEndTime && rightStartTime < leftEndTime; -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/closestIndexTo/index.js": -/*!***********************************************************!*\ - !*** ./node_modules/date-fns/esm/closestIndexTo/index.js ***! - \***********************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return closestIndexTo; }); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); - -/** - * @name closestIndexTo - * @category Common Helpers - * @summary Return an index of the closest date from the array comparing to the given date. - * - * @description - * Return an index of the closest date from the array comparing to the given date. - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * - Now, `closestIndexTo` doesn't throw an exception - * when the second argument is not an array, and returns Invalid Date instead. - * - * @param {Date|Number} dateToCompare - the date to compare with - * @param {Date[]|Number[]} datesArray - the array to search - * @returns {Number} an index of the date closest to the given date - * @throws {TypeError} 2 arguments required - * - * @example - * // Which date is closer to 6 September 2015? - * var dateToCompare = new Date(2015, 8, 6) - * var datesArray = [ - * new Date(2015, 0, 1), - * new Date(2016, 0, 1), - * new Date(2017, 0, 1) - * ] - * var result = closestIndexTo(dateToCompare, datesArray) - * //=> 1 - */ - -function closestIndexTo(dirtyDateToCompare, dirtyDatesArray) { - if (arguments.length < 2) { - throw new TypeError('2 arguments required, but only ' + arguments.length + ' present'); - } - - var dateToCompare = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDateToCompare); - - if (isNaN(dateToCompare)) { - return NaN; - } - - var timeToCompare = dateToCompare.getTime(); - var datesArray; // `dirtyDatesArray` is undefined or null - - if (dirtyDatesArray == null) { - datesArray = []; // `dirtyDatesArray` is Array, Set or Map, or object with custom `forEach` method - } else if (typeof dirtyDatesArray.forEach === 'function') { - datesArray = dirtyDatesArray; // If `dirtyDatesArray` is Array-like Object, convert to Array. Otherwise, make it empty Array - } else { - datesArray = Array.prototype.slice.call(dirtyDatesArray); - } - - var result; - var minDistance; - datesArray.forEach(function (dirtyDate, index) { - var currentDate = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDate); - - if (isNaN(currentDate)) { - result = NaN; - minDistance = NaN; - return; - } - - var distance = Math.abs(timeToCompare - currentDate.getTime()); - - if (result == null || distance < minDistance) { - result = index; - minDistance = distance; - } - }); - return result; -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/closestTo/index.js": -/*!******************************************************!*\ - !*** ./node_modules/date-fns/esm/closestTo/index.js ***! - \******************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return closestTo; }); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); - -/** - * @name closestTo - * @category Common Helpers - * @summary Return a date from the array closest to the given date. - * - * @description - * Return a date from the array closest to the given date. - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * - Now, `closestTo` doesn't throw an exception - * when the second argument is not an array, and returns Invalid Date instead. - * - * @param {Date|Number} dateToCompare - the date to compare with - * @param {Date[]|Number[]} datesArray - the array to search - * @returns {Date} the date from the array closest to the given date - * @throws {TypeError} 2 arguments required - * - * @example - * // Which date is closer to 6 September 2015: 1 January 2000 or 1 January 2030? - * var dateToCompare = new Date(2015, 8, 6) - * var result = closestTo(dateToCompare, [ - * new Date(2000, 0, 1), - * new Date(2030, 0, 1) - * ]) - * //=> Tue Jan 01 2030 00:00:00 - */ - -function closestTo(dirtyDateToCompare, dirtyDatesArray) { - if (arguments.length < 2) { - throw new TypeError('2 arguments required, but only ' + arguments.length + ' present'); - } - - var dateToCompare = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDateToCompare); - - if (isNaN(dateToCompare)) { - return new Date(NaN); - } - - var timeToCompare = dateToCompare.getTime(); - var datesArray; // `dirtyDatesArray` is undefined or null - - if (dirtyDatesArray == null) { - datesArray = []; // `dirtyDatesArray` is Array, Set or Map, or object with custom `forEach` method - } else if (typeof dirtyDatesArray.forEach === 'function') { - datesArray = dirtyDatesArray; // If `dirtyDatesArray` is Array-like Object, convert to Array. Otherwise, make it empty Array - } else { - datesArray = Array.prototype.slice.call(dirtyDatesArray); - } - - var result; - var minDistance; - datesArray.forEach(function (dirtyDate) { - var currentDate = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDate); - - if (isNaN(currentDate)) { - result = new Date(NaN); - minDistance = NaN; - return; - } - - var distance = Math.abs(timeToCompare - currentDate.getTime()); - - if (result == null || distance < minDistance) { - result = currentDate; - minDistance = distance; - } - }); - return result; -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/compareAsc/index.js": -/*!*******************************************************!*\ - !*** ./node_modules/date-fns/esm/compareAsc/index.js ***! - \*******************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return compareAsc; }); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); - -/** - * @name compareAsc - * @category Common Helpers - * @summary Compare the two dates and return -1, 0 or 1. - * - * @description - * Compare the two dates and return 1 if the first date is after the second, - * -1 if the first date is before the second or 0 if dates are equal. - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} dateLeft - the first date to compare - * @param {Date|Number} dateRight - the second date to compare - * @returns {Number} the result of the comparison - * @throws {TypeError} 2 arguments required - * - * @example - * // Compare 11 February 1987 and 10 July 1989: - * var result = compareAsc(new Date(1987, 1, 11), new Date(1989, 6, 10)) - * //=> -1 - * - * @example - * // Sort the array of dates: - * var result = [ - * new Date(1995, 6, 2), - * new Date(1987, 1, 11), - * new Date(1989, 6, 10) - * ].sort(compareAsc) - * //=> [ - * // Wed Feb 11 1987 00:00:00, - * // Mon Jul 10 1989 00:00:00, - * // Sun Jul 02 1995 00:00:00 - * // ] - */ - -function compareAsc(dirtyDateLeft, dirtyDateRight) { - if (arguments.length < 2) { - throw new TypeError('2 arguments required, but only ' + arguments.length + ' present'); - } - - var dateLeft = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDateLeft); - var dateRight = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDateRight); - var diff = dateLeft.getTime() - dateRight.getTime(); - - if (diff < 0) { - return -1; - } else if (diff > 0) { - return 1; // Return 0 if diff is 0; return NaN if diff is NaN - } else { - return diff; - } -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/compareDesc/index.js": -/*!********************************************************!*\ - !*** ./node_modules/date-fns/esm/compareDesc/index.js ***! - \********************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return compareDesc; }); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); - -/** - * @name compareDesc - * @category Common Helpers - * @summary Compare the two dates reverse chronologically and return -1, 0 or 1. - * - * @description - * Compare the two dates and return -1 if the first date is after the second, - * 1 if the first date is before the second or 0 if dates are equal. - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} dateLeft - the first date to compare - * @param {Date|Number} dateRight - the second date to compare - * @returns {Number} the result of the comparison - * @throws {TypeError} 2 arguments required - * - * @example - * // Compare 11 February 1987 and 10 July 1989 reverse chronologically: - * var result = compareDesc(new Date(1987, 1, 11), new Date(1989, 6, 10)) - * //=> 1 - * - * @example - * // Sort the array of dates in reverse chronological order: - * var result = [ - * new Date(1995, 6, 2), - * new Date(1987, 1, 11), - * new Date(1989, 6, 10) - * ].sort(compareDesc) - * //=> [ - * // Sun Jul 02 1995 00:00:00, - * // Mon Jul 10 1989 00:00:00, - * // Wed Feb 11 1987 00:00:00 - * // ] - */ - -function compareDesc(dirtyDateLeft, dirtyDateRight) { - if (arguments.length < 2) { - throw new TypeError('2 arguments required, but only ' + arguments.length + ' present'); - } - - var dateLeft = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDateLeft); - var dateRight = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDateRight); - var diff = dateLeft.getTime() - dateRight.getTime(); - - if (diff > 0) { - return -1; - } else if (diff < 0) { - return 1; // Return 0 if diff is 0; return NaN if diff is NaN - } else { - return diff; - } -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/differenceInCalendarDays/index.js": -/*!*********************************************************************!*\ - !*** ./node_modules/date-fns/esm/differenceInCalendarDays/index.js ***! - \*********************************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return differenceInCalendarDays; }); -/* harmony import */ var _lib_getTimezoneOffsetInMilliseconds_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../_lib/getTimezoneOffsetInMilliseconds/index.js */ "./node_modules/date-fns/esm/_lib/getTimezoneOffsetInMilliseconds/index.js"); -/* harmony import */ var _startOfDay_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../startOfDay/index.js */ "./node_modules/date-fns/esm/startOfDay/index.js"); - - -var MILLISECONDS_IN_DAY = 86400000; -/** - * @name differenceInCalendarDays - * @category Day Helpers - * @summary Get the number of calendar days between the given dates. - * - * @description - * Get the number of calendar days between the given dates. This means that the times are removed - * from the dates and then the difference in days is calculated. - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} dateLeft - the later date - * @param {Date|Number} dateRight - the earlier date - * @returns {Number} the number of calendar days - * @throws {TypeError} 2 arguments required - * - * @example - * // How many calendar days are between - * // 2 July 2011 23:00:00 and 2 July 2012 00:00:00? - * var result = differenceInCalendarDays( - * new Date(2012, 6, 2, 0, 0), - * new Date(2011, 6, 2, 23, 0) - * ) - * //=> 366 - * // How many calendar days are between - * // 2 July 2011 23:59:00 and 3 July 2011 00:01:00? - * var result = differenceInCalendarDays( - * new Date(2011, 6, 2, 0, 1), - * new Date(2011, 6, 2, 23, 59) - * ) - * //=> 1 - */ - -function differenceInCalendarDays(dirtyDateLeft, dirtyDateRight) { - if (arguments.length < 2) { - throw new TypeError('2 arguments required, but only ' + arguments.length + ' present'); - } - - var startOfDayLeft = Object(_startOfDay_index_js__WEBPACK_IMPORTED_MODULE_1__["default"])(dirtyDateLeft); - var startOfDayRight = Object(_startOfDay_index_js__WEBPACK_IMPORTED_MODULE_1__["default"])(dirtyDateRight); - var timestampLeft = startOfDayLeft.getTime() - Object(_lib_getTimezoneOffsetInMilliseconds_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(startOfDayLeft); - var timestampRight = startOfDayRight.getTime() - Object(_lib_getTimezoneOffsetInMilliseconds_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(startOfDayRight); // Round the number of days to the nearest integer - // because the number of milliseconds in a day is not constant - // (e.g. it's different in the day of the daylight saving time clock shift) - - return Math.round((timestampLeft - timestampRight) / MILLISECONDS_IN_DAY); -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/differenceInCalendarISOWeekYears/index.js": -/*!*****************************************************************************!*\ - !*** ./node_modules/date-fns/esm/differenceInCalendarISOWeekYears/index.js ***! - \*****************************************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return differenceInCalendarISOWeekYears; }); -/* harmony import */ var _getISOWeekYear_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../getISOWeekYear/index.js */ "./node_modules/date-fns/esm/getISOWeekYear/index.js"); - -/** - * @name differenceInCalendarISOWeekYears - * @category ISO Week-Numbering Year Helpers - * @summary Get the number of calendar ISO week-numbering years between the given dates. - * - * @description - * Get the number of calendar ISO week-numbering years between the given dates. - * - * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * - The function was renamed from `differenceInCalendarISOYears` to `differenceInCalendarISOWeekYears`. - * "ISO week year" is short for [ISO week-numbering year](https://en.wikipedia.org/wiki/ISO_week_date). - * This change makes the name consistent with - * locale-dependent week-numbering year helpers, e.g., `addWeekYears`. - * - * @param {Date|Number} dateLeft - the later date - * @param {Date|Number} dateRight - the earlier date - * @returns {Number} the number of calendar ISO week-numbering years - * @throws {TypeError} 2 arguments required - * - * @example - * // How many calendar ISO week-numbering years are 1 January 2010 and 1 January 2012? - * var result = differenceInCalendarISOWeekYears( - * new Date(2012, 0, 1), - * new Date(2010, 0, 1) - * ) - * //=> 2 - */ - -function differenceInCalendarISOWeekYears(dirtyDateLeft, dirtyDateRight) { - if (arguments.length < 2) { - throw new TypeError('2 arguments required, but only ' + arguments.length + ' present'); - } - - return Object(_getISOWeekYear_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDateLeft) - Object(_getISOWeekYear_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDateRight); -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/differenceInCalendarISOWeeks/index.js": -/*!*************************************************************************!*\ - !*** ./node_modules/date-fns/esm/differenceInCalendarISOWeeks/index.js ***! - \*************************************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return differenceInCalendarISOWeeks; }); -/* harmony import */ var _lib_getTimezoneOffsetInMilliseconds_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../_lib/getTimezoneOffsetInMilliseconds/index.js */ "./node_modules/date-fns/esm/_lib/getTimezoneOffsetInMilliseconds/index.js"); -/* harmony import */ var _startOfISOWeek_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../startOfISOWeek/index.js */ "./node_modules/date-fns/esm/startOfISOWeek/index.js"); - - -var MILLISECONDS_IN_WEEK = 604800000; -/** - * @name differenceInCalendarISOWeeks - * @category ISO Week Helpers - * @summary Get the number of calendar ISO weeks between the given dates. - * - * @description - * Get the number of calendar ISO weeks between the given dates. - * - * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} dateLeft - the later date - * @param {Date|Number} dateRight - the earlier date - * @returns {Number} the number of calendar ISO weeks - * @throws {TypeError} 2 arguments required - * - * @example - * // How many calendar ISO weeks are between 6 July 2014 and 21 July 2014? - * var result = differenceInCalendarISOWeeks( - * new Date(2014, 6, 21), - * new Date(2014, 6, 6) - * ) - * //=> 3 - */ - -function differenceInCalendarISOWeeks(dirtyDateLeft, dirtyDateRight) { - if (arguments.length < 2) { - throw new TypeError('2 arguments required, but only ' + arguments.length + ' present'); - } - - var startOfISOWeekLeft = Object(_startOfISOWeek_index_js__WEBPACK_IMPORTED_MODULE_1__["default"])(dirtyDateLeft); - var startOfISOWeekRight = Object(_startOfISOWeek_index_js__WEBPACK_IMPORTED_MODULE_1__["default"])(dirtyDateRight); - var timestampLeft = startOfISOWeekLeft.getTime() - Object(_lib_getTimezoneOffsetInMilliseconds_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(startOfISOWeekLeft); - var timestampRight = startOfISOWeekRight.getTime() - Object(_lib_getTimezoneOffsetInMilliseconds_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(startOfISOWeekRight); // Round the number of days to the nearest integer - // because the number of milliseconds in a week is not constant - // (e.g. it's different in the week of the daylight saving time clock shift) - - return Math.round((timestampLeft - timestampRight) / MILLISECONDS_IN_WEEK); -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/differenceInCalendarMonths/index.js": -/*!***********************************************************************!*\ - !*** ./node_modules/date-fns/esm/differenceInCalendarMonths/index.js ***! - \***********************************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return differenceInCalendarMonths; }); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); - -/** - * @name differenceInCalendarMonths - * @category Month Helpers - * @summary Get the number of calendar months between the given dates. - * - * @description - * Get the number of calendar months between the given dates. - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} dateLeft - the later date - * @param {Date|Number} dateRight - the earlier date - * @returns {Number} the number of calendar months - * @throws {TypeError} 2 arguments required - * - * @example - * // How many calendar months are between 31 January 2014 and 1 September 2014? - * var result = differenceInCalendarMonths( - * new Date(2014, 8, 1), - * new Date(2014, 0, 31) - * ) - * //=> 8 - */ - -function differenceInCalendarMonths(dirtyDateLeft, dirtyDateRight) { - if (arguments.length < 2) { - throw new TypeError('2 arguments required, but only ' + arguments.length + ' present'); - } - - var dateLeft = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDateLeft); - var dateRight = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDateRight); - var yearDiff = dateLeft.getFullYear() - dateRight.getFullYear(); - var monthDiff = dateLeft.getMonth() - dateRight.getMonth(); - return yearDiff * 12 + monthDiff; -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/differenceInCalendarQuarters/index.js": -/*!*************************************************************************!*\ - !*** ./node_modules/date-fns/esm/differenceInCalendarQuarters/index.js ***! - \*************************************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return differenceInCalendarQuarters; }); -/* harmony import */ var _getQuarter_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../getQuarter/index.js */ "./node_modules/date-fns/esm/getQuarter/index.js"); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); - - -/** - * @name differenceInCalendarQuarters - * @category Quarter Helpers - * @summary Get the number of calendar quarters between the given dates. - * - * @description - * Get the number of calendar quarters between the given dates. - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} dateLeft - the later date - * @param {Date|Number} dateRight - the earlier date - * @returns {Number} the number of calendar quarters - * @throws {TypeError} 2 arguments required - * - * @example - * // How many calendar quarters are between 31 December 2013 and 2 July 2014? - * var result = differenceInCalendarQuarters( - * new Date(2014, 6, 2), - * new Date(2013, 11, 31) - * ) - * //=> 3 - */ - -function differenceInCalendarQuarters(dirtyDateLeft, dirtyDateRight) { - if (arguments.length < 2) { - throw new TypeError('2 arguments required, but only ' + arguments.length + ' present'); - } - - var dateLeft = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_1__["default"])(dirtyDateLeft); - var dateRight = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_1__["default"])(dirtyDateRight); - var yearDiff = dateLeft.getFullYear() - dateRight.getFullYear(); - var quarterDiff = Object(_getQuarter_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dateLeft) - Object(_getQuarter_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dateRight); - return yearDiff * 4 + quarterDiff; -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/differenceInCalendarWeeks/index.js": -/*!**********************************************************************!*\ - !*** ./node_modules/date-fns/esm/differenceInCalendarWeeks/index.js ***! - \**********************************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return differenceInCalendarWeeks; }); -/* harmony import */ var _lib_getTimezoneOffsetInMilliseconds_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../_lib/getTimezoneOffsetInMilliseconds/index.js */ "./node_modules/date-fns/esm/_lib/getTimezoneOffsetInMilliseconds/index.js"); -/* harmony import */ var _startOfWeek_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../startOfWeek/index.js */ "./node_modules/date-fns/esm/startOfWeek/index.js"); - - -var MILLISECONDS_IN_WEEK = 604800000; -/** - * @name differenceInCalendarWeeks - * @category Week Helpers - * @summary Get the number of calendar weeks between the given dates. - * - * @description - * Get the number of calendar weeks between the given dates. - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} dateLeft - the later date - * @param {Date|Number} dateRight - the earlier date - * @param {Object} [options] - an object with options. - * @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday) - * @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale} - * @returns {Number} the number of calendar weeks - * @throws {TypeError} 2 arguments required - * @throws {RangeError} `options.weekStartsOn` must be between 0 and 6 - * - * @example - * // How many calendar weeks are between 5 July 2014 and 20 July 2014? - * var result = differenceInCalendarWeeks( - * new Date(2014, 6, 20), - * new Date(2014, 6, 5) - * ) - * //=> 3 - * - * @example - * // If the week starts on Monday, - * // how many calendar weeks are between 5 July 2014 and 20 July 2014? - * var result = differenceInCalendarWeeks( - * new Date(2014, 6, 20), - * new Date(2014, 6, 5), - * { weekStartsOn: 1 } - * ) - * //=> 2 - */ - -function differenceInCalendarWeeks(dirtyDateLeft, dirtyDateRight, dirtyOptions) { - if (arguments.length < 2) { - throw new TypeError('2 arguments required, but only ' + arguments.length + ' present'); - } - - var startOfWeekLeft = Object(_startOfWeek_index_js__WEBPACK_IMPORTED_MODULE_1__["default"])(dirtyDateLeft, dirtyOptions); - var startOfWeekRight = Object(_startOfWeek_index_js__WEBPACK_IMPORTED_MODULE_1__["default"])(dirtyDateRight, dirtyOptions); - var timestampLeft = startOfWeekLeft.getTime() - Object(_lib_getTimezoneOffsetInMilliseconds_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(startOfWeekLeft); - var timestampRight = startOfWeekRight.getTime() - Object(_lib_getTimezoneOffsetInMilliseconds_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(startOfWeekRight); // Round the number of days to the nearest integer - // because the number of milliseconds in a week is not constant - // (e.g. it's different in the week of the daylight saving time clock shift) - - return Math.round((timestampLeft - timestampRight) / MILLISECONDS_IN_WEEK); -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/differenceInCalendarYears/index.js": -/*!**********************************************************************!*\ - !*** ./node_modules/date-fns/esm/differenceInCalendarYears/index.js ***! - \**********************************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return differenceInCalendarYears; }); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); - -/** - * @name differenceInCalendarYears - * @category Year Helpers - * @summary Get the number of calendar years between the given dates. - * - * @description - * Get the number of calendar years between the given dates. - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} dateLeft - the later date - * @param {Date|Number} dateRight - the earlier date - * @returns {Number} the number of calendar years - * @throws {TypeError} 2 arguments required - * - * @example - * // How many calendar years are between 31 December 2013 and 11 February 2015? - * var result = differenceInCalendarYears( - * new Date(2015, 1, 11), - * new Date(2013, 11, 31) - * ) - * //=> 2 - */ - -function differenceInCalendarYears(dirtyDateLeft, dirtyDateRight) { - if (arguments.length < 2) { - throw new TypeError('2 arguments required, but only ' + arguments.length + ' present'); - } - - var dateLeft = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDateLeft); - var dateRight = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDateRight); - return dateLeft.getFullYear() - dateRight.getFullYear(); -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/differenceInDays/index.js": -/*!*************************************************************!*\ - !*** ./node_modules/date-fns/esm/differenceInDays/index.js ***! - \*************************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return differenceInDays; }); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); -/* harmony import */ var _differenceInCalendarDays_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../differenceInCalendarDays/index.js */ "./node_modules/date-fns/esm/differenceInCalendarDays/index.js"); -/* harmony import */ var _compareAsc_index_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../compareAsc/index.js */ "./node_modules/date-fns/esm/compareAsc/index.js"); - - - -/** - * @name differenceInDays - * @category Day Helpers - * @summary Get the number of full days between the given dates. - * - * @description - * Get the number of full day periods between the given dates. - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} dateLeft - the later date - * @param {Date|Number} dateRight - the earlier date - * @returns {Number} the number of full days - * @throws {TypeError} 2 arguments required - * - * @example - * // How many full days are between - * // 2 July 2011 23:00:00 and 2 July 2012 00:00:00? - * var result = differenceInDays( - * new Date(2012, 6, 2, 0, 0), - * new Date(2011, 6, 2, 23, 0) - * ) - * //=> 365 - * // How many days are between - * // 2 July 2011 23:59:00 and 3 July 2011 00:01:00? - * var result = differenceInDays( - * new Date(2011, 6, 2, 0, 1), - * new Date(2011, 6, 2, 23, 59) - * ) - * //=> 0 - */ - -function differenceInDays(dirtyDateLeft, dirtyDateRight) { - if (arguments.length < 2) { - throw new TypeError('2 arguments required, but only ' + arguments.length + ' present'); - } - - var dateLeft = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDateLeft); - var dateRight = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDateRight); - var sign = Object(_compareAsc_index_js__WEBPACK_IMPORTED_MODULE_2__["default"])(dateLeft, dateRight); - var difference = Math.abs(Object(_differenceInCalendarDays_index_js__WEBPACK_IMPORTED_MODULE_1__["default"])(dateLeft, dateRight)); - dateLeft.setDate(dateLeft.getDate() - sign * difference); // Math.abs(diff in full days - diff in calendar days) === 1 if last calendar day is not full - // If so, result must be decreased by 1 in absolute value - - var isLastDayNotFull = Object(_compareAsc_index_js__WEBPACK_IMPORTED_MODULE_2__["default"])(dateLeft, dateRight) === -sign; - var result = sign * (difference - isLastDayNotFull); // Prevent negative zero - - return result === 0 ? 0 : result; -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/differenceInHours/index.js": -/*!**************************************************************!*\ - !*** ./node_modules/date-fns/esm/differenceInHours/index.js ***! - \**************************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return differenceInHours; }); -/* harmony import */ var _differenceInMilliseconds_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../differenceInMilliseconds/index.js */ "./node_modules/date-fns/esm/differenceInMilliseconds/index.js"); - -var MILLISECONDS_IN_HOUR = 3600000; -/** - * @name differenceInHours - * @category Hour Helpers - * @summary Get the number of hours between the given dates. - * - * @description - * Get the number of hours between the given dates. - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} dateLeft - the later date - * @param {Date|Number} dateRight - the earlier date - * @returns {Number} the number of hours - * @throws {TypeError} 2 arguments required - * - * @example - * // How many hours are between 2 July 2014 06:50:00 and 2 July 2014 19:00:00? - * var result = differenceInHours( - * new Date(2014, 6, 2, 19, 0), - * new Date(2014, 6, 2, 6, 50) - * ) - * //=> 12 - */ - -function differenceInHours(dirtyDateLeft, dirtyDateRight) { - if (arguments.length < 2) { - throw new TypeError('2 arguments required, but only ' + arguments.length + ' present'); - } - - var diff = Object(_differenceInMilliseconds_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDateLeft, dirtyDateRight) / MILLISECONDS_IN_HOUR; - return diff > 0 ? Math.floor(diff) : Math.ceil(diff); -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/differenceInISOWeekYears/index.js": -/*!*********************************************************************!*\ - !*** ./node_modules/date-fns/esm/differenceInISOWeekYears/index.js ***! - \*********************************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return differenceInISOWeekYears; }); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); -/* harmony import */ var _differenceInCalendarISOWeekYears_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../differenceInCalendarISOWeekYears/index.js */ "./node_modules/date-fns/esm/differenceInCalendarISOWeekYears/index.js"); -/* harmony import */ var _compareAsc_index_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../compareAsc/index.js */ "./node_modules/date-fns/esm/compareAsc/index.js"); -/* harmony import */ var _subISOWeekYears_index_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../subISOWeekYears/index.js */ "./node_modules/date-fns/esm/subISOWeekYears/index.js"); - - - - -/** - * @name differenceInISOWeekYears - * @category ISO Week-Numbering Year Helpers - * @summary Get the number of full ISO week-numbering years between the given dates. - * - * @description - * Get the number of full ISO week-numbering years between the given dates. - * - * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * - The function was renamed from `differenceInISOYears` to `differenceInISOWeekYears`. - * "ISO week year" is short for [ISO week-numbering year](https://en.wikipedia.org/wiki/ISO_week_date). - * This change makes the name consistent with - * locale-dependent week-numbering year helpers, e.g., `addWeekYears`. - * - * @param {Date|Number} dateLeft - the later date - * @param {Date|Number} dateRight - the earlier date - * @returns {Number} the number of full ISO week-numbering years - * @throws {TypeError} 2 arguments required - * - * @example - * // How many full ISO week-numbering years are between 1 January 2010 and 1 January 2012? - * var result = differenceInISOWeekYears( - * new Date(2012, 0, 1), - * new Date(2010, 0, 1) - * ) - * //=> 1 - */ - -function differenceInISOWeekYears(dirtyDateLeft, dirtyDateRight) { - if (arguments.length < 2) { - throw new TypeError('2 arguments required, but only ' + arguments.length + ' present'); - } - - var dateLeft = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDateLeft); - var dateRight = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDateRight); - var sign = Object(_compareAsc_index_js__WEBPACK_IMPORTED_MODULE_2__["default"])(dateLeft, dateRight); - var difference = Math.abs(Object(_differenceInCalendarISOWeekYears_index_js__WEBPACK_IMPORTED_MODULE_1__["default"])(dateLeft, dateRight)); - dateLeft = Object(_subISOWeekYears_index_js__WEBPACK_IMPORTED_MODULE_3__["default"])(dateLeft, sign * difference); // Math.abs(diff in full ISO years - diff in calendar ISO years) === 1 - // if last calendar ISO year is not full - // If so, result must be decreased by 1 in absolute value - - var isLastISOWeekYearNotFull = Object(_compareAsc_index_js__WEBPACK_IMPORTED_MODULE_2__["default"])(dateLeft, dateRight) === -sign; - var result = sign * (difference - isLastISOWeekYearNotFull); // Prevent negative zero - - return result === 0 ? 0 : result; -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/differenceInMilliseconds/index.js": -/*!*********************************************************************!*\ - !*** ./node_modules/date-fns/esm/differenceInMilliseconds/index.js ***! - \*********************************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return differenceInMilliseconds; }); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); - -/** - * @name differenceInMilliseconds - * @category Millisecond Helpers - * @summary Get the number of milliseconds between the given dates. - * - * @description - * Get the number of milliseconds between the given dates. - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} dateLeft - the later date - * @param {Date|Number} dateRight - the earlier date - * @returns {Number} the number of milliseconds - * @throws {TypeError} 2 arguments required - * - * @example - * // How many milliseconds are between - * // 2 July 2014 12:30:20.600 and 2 July 2014 12:30:21.700? - * var result = differenceInMilliseconds( - * new Date(2014, 6, 2, 12, 30, 21, 700), - * new Date(2014, 6, 2, 12, 30, 20, 600) - * ) - * //=> 1100 - */ - -function differenceInMilliseconds(dirtyDateLeft, dirtyDateRight) { - if (arguments.length < 2) { - throw new TypeError('2 arguments required, but only ' + arguments.length + ' present'); - } - - var dateLeft = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDateLeft); - var dateRight = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDateRight); - return dateLeft.getTime() - dateRight.getTime(); -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/differenceInMinutes/index.js": -/*!****************************************************************!*\ - !*** ./node_modules/date-fns/esm/differenceInMinutes/index.js ***! - \****************************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return differenceInMinutes; }); -/* harmony import */ var _differenceInMilliseconds_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../differenceInMilliseconds/index.js */ "./node_modules/date-fns/esm/differenceInMilliseconds/index.js"); - -var MILLISECONDS_IN_MINUTE = 60000; -/** - * @name differenceInMinutes - * @category Minute Helpers - * @summary Get the number of minutes between the given dates. - * - * @description - * Get the number of minutes between the given dates. - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} dateLeft - the later date - * @param {Date|Number} dateRight - the earlier date - * @returns {Number} the number of minutes - * @throws {TypeError} 2 arguments required - * - * @example - * // How many minutes are between 2 July 2014 12:07:59 and 2 July 2014 12:20:00? - * var result = differenceInMinutes( - * new Date(2014, 6, 2, 12, 20, 0), - * new Date(2014, 6, 2, 12, 7, 59) - * ) - * //=> 12 - */ - -function differenceInMinutes(dirtyDateLeft, dirtyDateRight) { - if (arguments.length < 2) { - throw new TypeError('2 arguments required, but only ' + arguments.length + ' present'); - } - - var diff = Object(_differenceInMilliseconds_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDateLeft, dirtyDateRight) / MILLISECONDS_IN_MINUTE; - return diff > 0 ? Math.floor(diff) : Math.ceil(diff); -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/differenceInMonths/index.js": -/*!***************************************************************!*\ - !*** ./node_modules/date-fns/esm/differenceInMonths/index.js ***! - \***************************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return differenceInMonths; }); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); -/* harmony import */ var _differenceInCalendarMonths_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../differenceInCalendarMonths/index.js */ "./node_modules/date-fns/esm/differenceInCalendarMonths/index.js"); -/* harmony import */ var _compareAsc_index_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../compareAsc/index.js */ "./node_modules/date-fns/esm/compareAsc/index.js"); - - - -/** - * @name differenceInMonths - * @category Month Helpers - * @summary Get the number of full months between the given dates. - * - * @description - * Get the number of full months between the given dates. - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} dateLeft - the later date - * @param {Date|Number} dateRight - the earlier date - * @returns {Number} the number of full months - * @throws {TypeError} 2 arguments required - * - * @example - * // How many full months are between 31 January 2014 and 1 September 2014? - * var result = differenceInMonths(new Date(2014, 8, 1), new Date(2014, 0, 31)) - * //=> 7 - */ - -function differenceInMonths(dirtyDateLeft, dirtyDateRight) { - if (arguments.length < 2) { - throw new TypeError('2 arguments required, but only ' + arguments.length + ' present'); - } - - var dateLeft = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDateLeft); - var dateRight = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDateRight); - var sign = Object(_compareAsc_index_js__WEBPACK_IMPORTED_MODULE_2__["default"])(dateLeft, dateRight); - var difference = Math.abs(Object(_differenceInCalendarMonths_index_js__WEBPACK_IMPORTED_MODULE_1__["default"])(dateLeft, dateRight)); - dateLeft.setMonth(dateLeft.getMonth() - sign * difference); // Math.abs(diff in full months - diff in calendar months) === 1 if last calendar month is not full - // If so, result must be decreased by 1 in absolute value - - var isLastMonthNotFull = Object(_compareAsc_index_js__WEBPACK_IMPORTED_MODULE_2__["default"])(dateLeft, dateRight) === -sign; - var result = sign * (difference - isLastMonthNotFull); // Prevent negative zero - - return result === 0 ? 0 : result; -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/differenceInQuarters/index.js": -/*!*****************************************************************!*\ - !*** ./node_modules/date-fns/esm/differenceInQuarters/index.js ***! - \*****************************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return differenceInQuarters; }); -/* harmony import */ var _differenceInMonths_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../differenceInMonths/index.js */ "./node_modules/date-fns/esm/differenceInMonths/index.js"); - -/** - * @name differenceInQuarters - * @category Quarter Helpers - * @summary Get the number of full quarters between the given dates. - * - * @description - * Get the number of full quarters between the given dates. - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} dateLeft - the later date - * @param {Date|Number} dateRight - the earlier date - * @returns {Number} the number of full quarters - * @throws {TypeError} 2 arguments required - * - * @example - * // How many full quarters are between 31 December 2013 and 2 July 2014? - * var result = differenceInQuarters(new Date(2014, 6, 2), new Date(2013, 11, 31)) - * //=> 2 - */ - -function differenceInQuarters(dirtyDateLeft, dirtyDateRight) { - if (arguments.length < 2) { - throw new TypeError('2 arguments required, but only ' + arguments.length + ' present'); - } - - var diff = Object(_differenceInMonths_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDateLeft, dirtyDateRight) / 3; - return diff > 0 ? Math.floor(diff) : Math.ceil(diff); -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/differenceInSeconds/index.js": -/*!****************************************************************!*\ - !*** ./node_modules/date-fns/esm/differenceInSeconds/index.js ***! - \****************************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return differenceInSeconds; }); -/* harmony import */ var _differenceInMilliseconds_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../differenceInMilliseconds/index.js */ "./node_modules/date-fns/esm/differenceInMilliseconds/index.js"); - -/** - * @name differenceInSeconds - * @category Second Helpers - * @summary Get the number of seconds between the given dates. - * - * @description - * Get the number of seconds between the given dates. - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} dateLeft - the later date - * @param {Date|Number} dateRight - the earlier date - * @returns {Number} the number of seconds - * @throws {TypeError} 2 arguments required - * - * @example - * // How many seconds are between - * // 2 July 2014 12:30:07.999 and 2 July 2014 12:30:20.000? - * var result = differenceInSeconds( - * new Date(2014, 6, 2, 12, 30, 20, 0), - * new Date(2014, 6, 2, 12, 30, 7, 999) - * ) - * //=> 12 - */ - -function differenceInSeconds(dirtyDateLeft, dirtyDateRight) { - if (arguments.length < 2) { - throw new TypeError('2 arguments required, but only ' + arguments.length + ' present'); - } - - var diff = Object(_differenceInMilliseconds_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDateLeft, dirtyDateRight) / 1000; - return diff > 0 ? Math.floor(diff) : Math.ceil(diff); -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/differenceInWeeks/index.js": -/*!**************************************************************!*\ - !*** ./node_modules/date-fns/esm/differenceInWeeks/index.js ***! - \**************************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return differenceInWeeks; }); -/* harmony import */ var _differenceInDays_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../differenceInDays/index.js */ "./node_modules/date-fns/esm/differenceInDays/index.js"); - -/** - * @name differenceInWeeks - * @category Week Helpers - * @summary Get the number of full weeks between the given dates. - * - * @description - * Get the number of full weeks between the given dates. - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} dateLeft - the later date - * @param {Date|Number} dateRight - the earlier date - * @returns {Number} the number of full weeks - * @throws {TypeError} 2 arguments required - * - * @example - * // How many full weeks are between 5 July 2014 and 20 July 2014? - * var result = differenceInWeeks(new Date(2014, 6, 20), new Date(2014, 6, 5)) - * //=> 2 - */ - -function differenceInWeeks(dirtyDateLeft, dirtyDateRight) { - if (arguments.length < 2) { - throw new TypeError('2 arguments required, but only ' + arguments.length + ' present'); - } - - var diff = Object(_differenceInDays_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDateLeft, dirtyDateRight) / 7; - return diff > 0 ? Math.floor(diff) : Math.ceil(diff); -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/differenceInYears/index.js": -/*!**************************************************************!*\ - !*** ./node_modules/date-fns/esm/differenceInYears/index.js ***! - \**************************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return differenceInYears; }); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); -/* harmony import */ var _differenceInCalendarYears_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../differenceInCalendarYears/index.js */ "./node_modules/date-fns/esm/differenceInCalendarYears/index.js"); -/* harmony import */ var _compareAsc_index_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../compareAsc/index.js */ "./node_modules/date-fns/esm/compareAsc/index.js"); - - - -/** - * @name differenceInYears - * @category Year Helpers - * @summary Get the number of full years between the given dates. - * - * @description - * Get the number of full years between the given dates. - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} dateLeft - the later date - * @param {Date|Number} dateRight - the earlier date - * @returns {Number} the number of full years - * @throws {TypeError} 2 arguments required - * - * @example - * // How many full years are between 31 December 2013 and 11 February 2015? - * var result = differenceInYears(new Date(2015, 1, 11), new Date(2013, 11, 31)) - * //=> 1 - */ - -function differenceInYears(dirtyDateLeft, dirtyDateRight) { - if (arguments.length < 2) { - throw new TypeError('2 arguments required, but only ' + arguments.length + ' present'); - } - - var dateLeft = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDateLeft); - var dateRight = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDateRight); - var sign = Object(_compareAsc_index_js__WEBPACK_IMPORTED_MODULE_2__["default"])(dateLeft, dateRight); - var difference = Math.abs(Object(_differenceInCalendarYears_index_js__WEBPACK_IMPORTED_MODULE_1__["default"])(dateLeft, dateRight)); - dateLeft.setFullYear(dateLeft.getFullYear() - sign * difference); // Math.abs(diff in full years - diff in calendar years) === 1 if last calendar year is not full - // If so, result must be decreased by 1 in absolute value - - var isLastYearNotFull = Object(_compareAsc_index_js__WEBPACK_IMPORTED_MODULE_2__["default"])(dateLeft, dateRight) === -sign; - var result = sign * (difference - isLastYearNotFull); // Prevent negative zero - - return result === 0 ? 0 : result; -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/eachDayOfInterval/index.js": -/*!**************************************************************!*\ - !*** ./node_modules/date-fns/esm/eachDayOfInterval/index.js ***! - \**************************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return eachDayOfInterval; }); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); - -/** - * @name eachDayOfInterval - * @category Interval Helpers - * @summary Return the array of dates within the specified time interval. - * - * @description - * Return the array of dates within the specified time interval. - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * - The function was renamed from `eachDay` to `eachDayOfInterval`. - * This change was made to mirror the use of the word "interval" in standard ISO 8601:2004 terminology: - * - * ``` - * 2.1.3 - * time interval - * part of the time axis limited by two instants - * ``` - * - * Also, this function now accepts an object with `start` and `end` properties - * instead of two arguments as an interval. - * This function now throws `RangeError` if the start of the interval is after its end - * or if any date in the interval is `Invalid Date`. - * - * ```javascript - * // Before v2.0.0 - * - * eachDay(new Date(2014, 0, 10), new Date(2014, 0, 20)) - * - * // v2.0.0 onward - * - * eachDayOfInterval( - * { start: new Date(2014, 0, 10), end: new Date(2014, 0, 20) } - * ) - * ``` - * - * @param {Interval} interval - the interval. See [Interval]{@link docs/types/Interval} - * @param {Object} [options] - an object with options. - * @param {Number} [options.step=1] - the step to increment by. The value should be more than 1. - * @returns {Date[]} the array with starts of days from the day of the interval start to the day of the interval end - * @throws {TypeError} 1 argument required - * @throws {RangeError} `options.step` must be a number greater than 1 - * @throws {RangeError} The start of an interval cannot be after its end - * @throws {RangeError} Date in interval cannot be `Invalid Date` - * - * @example - * // Each day between 6 October 2014 and 10 October 2014: - * var result = eachDayOfInterval({ - * start: new Date(2014, 9, 6), - * end: new Date(2014, 9, 10) - * }) - * //=> [ - * // Mon Oct 06 2014 00:00:00, - * // Tue Oct 07 2014 00:00:00, - * // Wed Oct 08 2014 00:00:00, - * // Thu Oct 09 2014 00:00:00, - * // Fri Oct 10 2014 00:00:00 - * // ] - */ - -function eachDayOfInterval(dirtyInterval, options) { - if (arguments.length < 1) { - throw new TypeError('1 argument required, but only ' + arguments.length + ' present'); - } - - var interval = dirtyInterval || {}; - var startDate = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(interval.start); - var endDate = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(interval.end); - var endTime = endDate.getTime(); // Throw an exception if start date is after end date or if any date is `Invalid Date` - - if (!(startDate.getTime() <= endTime)) { - throw new RangeError('Invalid interval'); - } - - var dates = []; - var currentDate = startDate; - currentDate.setHours(0, 0, 0, 0); - var step = options && 'step' in options ? Number(options.step) : 1; - if (step < 1 || isNaN(step)) throw new RangeError('`options.step` must be a number greater than 1'); - - while (currentDate.getTime() <= endTime) { - dates.push(Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(currentDate)); - currentDate.setDate(currentDate.getDate() + step); - currentDate.setHours(0, 0, 0, 0); - } - - return dates; -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/eachWeekOfInterval/index.js": -/*!***************************************************************!*\ - !*** ./node_modules/date-fns/esm/eachWeekOfInterval/index.js ***! - \***************************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return eachWeekOfInterval; }); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); -/* harmony import */ var _startOfWeek_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../startOfWeek/index.js */ "./node_modules/date-fns/esm/startOfWeek/index.js"); -/* harmony import */ var _addWeeks_index_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../addWeeks/index.js */ "./node_modules/date-fns/esm/addWeeks/index.js"); - - - -/** - * @name eachWeekOfInterval - * @category Interval Helpers - * @summary Return the array of weeks within the specified time interval. - * - * @description - * Return the array of weeks within the specified time interval. - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Interval} interval - the interval. See [Interval]{@link docs/types/Interval} - * @param {Object} [options] - an object with options. - * @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday) - * @returns {Date[]} the array with starts of weeks from the week of the interval start to the week of the interval end - * @throws {TypeError} 1 argument required - * @throws {RangeError} `options.weekStartsOn` must be 0, 1, ..., 6 - * @throws {RangeError} The start of an interval cannot be after its end - * @throws {RangeError} Date in interval cannot be `Invalid Date` - * - * @example - * // Each week within interval 6 October 2014 - 23 November 2014: - * var result = eachWeekOfInterval({ - * start: new Date(2014, 9, 6), - * end: new Date(2014, 10, 23) - * }) - * //=> [ - * // Sun Oct 05 2014 00:00:00, - * // Sun Oct 12 2014 00:00:00, - * // Sun Oct 19 2014 00:00:00, - * // Sun Oct 26 2014 00:00:00, - * // Sun Nov 02 2014 00:00:00, - * // Sun Nov 09 2014 00:00:00, - * // Sun Nov 16 2014 00:00:00, - * // Sun Nov 23 2014 00:00:00 - * // ] - */ - -function eachWeekOfInterval(dirtyInterval, options) { - if (arguments.length < 1) { - throw new TypeError('1 argument required, but only ' + arguments.length + ' present'); - } - - var interval = dirtyInterval || {}; - var startDate = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(interval.start); - var endDate = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(interval.end); - var endTime = endDate.getTime(); // Throw an exception if start date is after end date or if any date is `Invalid Date` - - if (!(startDate.getTime() <= endTime)) { - throw new RangeError('Invalid interval'); - } - - var startDateWeek = Object(_startOfWeek_index_js__WEBPACK_IMPORTED_MODULE_1__["default"])(startDate, options); - var endDateWeek = Object(_startOfWeek_index_js__WEBPACK_IMPORTED_MODULE_1__["default"])(endDate, options); // Some timezones switch DST at midnight, making start of day unreliable in these timezones, 3pm is a safe bet - - startDateWeek.setHours(15); - endDateWeek.setHours(15); - endTime = endDateWeek.getTime(); - var weeks = []; - var currentWeek = startDateWeek; - - while (currentWeek.getTime() <= endTime) { - currentWeek.setHours(0); - weeks.push(Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(currentWeek)); - currentWeek = Object(_addWeeks_index_js__WEBPACK_IMPORTED_MODULE_2__["default"])(currentWeek, 1); - currentWeek.setHours(15); - } - - return weeks; -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/eachWeekendOfInterval/index.js": -/*!******************************************************************!*\ - !*** ./node_modules/date-fns/esm/eachWeekendOfInterval/index.js ***! - \******************************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return eachWeekendOfInterval; }); -/* harmony import */ var _eachDayOfInterval_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../eachDayOfInterval/index.js */ "./node_modules/date-fns/esm/eachDayOfInterval/index.js"); -/* harmony import */ var _isSunday_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../isSunday/index.js */ "./node_modules/date-fns/esm/isSunday/index.js"); -/* harmony import */ var _isWeekend_index_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../isWeekend/index.js */ "./node_modules/date-fns/esm/isWeekend/index.js"); - - - -/** - * @name eachWeekendOfInterval - * @category Interval Helpers - * @summary List all the Saturdays and Sundays in the given date interval. - * - * @description - * Get all the Saturdays and Sundays in the given date interval. - * - * @param {Interval} interval - the given interval. See [Interval]{@link docs/types/Interval} - * @returns {Date[]} an array containing all the Saturdays and Sundays - * @throws {TypeError} 1 argument required - * @throws {RangeError} The start of an interval cannot be after its end - * @throws {RangeError} Date in interval cannot be `Invalid Date` - * - * @example - * // Lists all Saturdays and Sundays in the given date interval - * var result = eachWeekendOfInterval({ - * start: new Date(2018, 8, 17), - * end: new Date(2018, 8, 30) - * }) - * //=> [ - * // Sat Sep 22 2018 00:00:00, - * // Sun Sep 23 2018 00:00:00, - * // Sat Sep 29 2018 00:00:00, - * // Sun Sep 30 2018 00:00:00 - * // ] - */ - -function eachWeekendOfInterval(interval) { - if (arguments.length < 1) { - throw new TypeError('1 argument required, but only ' + arguments.length + ' present'); - } - - var dateInterval = Object(_eachDayOfInterval_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(interval); - var weekends = []; - var index = 0; - - while (index++ < dateInterval.length) { - var date = dateInterval[index]; - - if (Object(_isWeekend_index_js__WEBPACK_IMPORTED_MODULE_2__["default"])(date)) { - weekends.push(date); - if (Object(_isSunday_index_js__WEBPACK_IMPORTED_MODULE_1__["default"])(date)) index = index + 5; - } - } - - return weekends; -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/eachWeekendOfMonth/index.js": -/*!***************************************************************!*\ - !*** ./node_modules/date-fns/esm/eachWeekendOfMonth/index.js ***! - \***************************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return eachWeekendOfMonth; }); -/* harmony import */ var _eachWeekendOfInterval_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../eachWeekendOfInterval/index.js */ "./node_modules/date-fns/esm/eachWeekendOfInterval/index.js"); -/* harmony import */ var _startOfMonth_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../startOfMonth/index.js */ "./node_modules/date-fns/esm/startOfMonth/index.js"); -/* harmony import */ var _endOfMonth_index_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../endOfMonth/index.js */ "./node_modules/date-fns/esm/endOfMonth/index.js"); - - - -/** - * @name eachWeekendOfMonth - * @category Month Helpers - * @summary List all the Saturdays and Sundays in the given month. - * - * @description - * Get all the Saturdays and Sundays in the given month. - * - * @param {Date|Number} date - the given month - * @returns {Date[]} an array containing all the Saturdays and Sundays - * @throws {TypeError} 1 argument required - * @throws {RangeError} The passed date is invalid - * - * @example - * // Lists all Saturdays and Sundays in the given month - * var result = eachWeekendOfMonth(new Date(2022, 1, 1)) - * //=> [ - * // Sat Feb 05 2022 00:00:00, - * // Sun Feb 06 2022 00:00:00, - * // Sat Feb 12 2022 00:00:00, - * // Sun Feb 13 2022 00:00:00, - * // Sat Feb 19 2022 00:00:00, - * // Sun Feb 20 2022 00:00:00, - * // Sat Feb 26 2022 00:00:00, - * // Sun Feb 27 2022 00:00:00 - * // ] - */ - -function eachWeekendOfMonth(dirtyDate) { - if (arguments.length < 1) { - throw new TypeError('1 arguments required, but only ' + arguments.length + ' present'); - } - - var startDate = Object(_startOfMonth_index_js__WEBPACK_IMPORTED_MODULE_1__["default"])(dirtyDate); - if (isNaN(startDate)) throw new RangeError('The passed date is invalid'); - var endDate = Object(_endOfMonth_index_js__WEBPACK_IMPORTED_MODULE_2__["default"])(dirtyDate); - return Object(_eachWeekendOfInterval_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])({ - start: startDate, - end: endDate - }); -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/eachWeekendOfYear/index.js": -/*!**************************************************************!*\ - !*** ./node_modules/date-fns/esm/eachWeekendOfYear/index.js ***! - \**************************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return eachWeekendOfYear; }); -/* harmony import */ var _eachWeekendOfInterval_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../eachWeekendOfInterval/index.js */ "./node_modules/date-fns/esm/eachWeekendOfInterval/index.js"); -/* harmony import */ var _startOfYear_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../startOfYear/index.js */ "./node_modules/date-fns/esm/startOfYear/index.js"); -/* harmony import */ var _endOfYear_index_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../endOfYear/index.js */ "./node_modules/date-fns/esm/endOfYear/index.js"); - - - -/** - * @name eachWeekendOfYear - * @category Year Helpers - * @summary List all the Saturdays and Sundays in the year. - * - * @description - * Get all the Saturdays and Sundays in the year. - * - * @param {Date|Number} date - the given year - * @returns {Date[]} an array containing all the Saturdays and Sundays - * @throws {TypeError} 1 argument required - * @throws {RangeError} The passed date is invalid - * - * @example - * // Lists all Saturdays and Sundays in the year - * var result = eachWeekendOfYear(new Date(2020, 1, 1)) - * //=> [ - * // Sat Jan 03 2020 00:00:00, - * // Sun Jan 04 2020 00:00:00, - * // ... - * // Sun Dec 27 2020 00:00:00 - * // ] - * ] - */ - -function eachWeekendOfYear(dirtyDate) { - if (arguments.length < 1) { - throw new TypeError('1 arguments required, but only ' + arguments.length + ' present'); - } - - var startDate = Object(_startOfYear_index_js__WEBPACK_IMPORTED_MODULE_1__["default"])(dirtyDate); - if (isNaN(startDate)) throw new RangeError('The passed date is invalid'); - var endDate = Object(_endOfYear_index_js__WEBPACK_IMPORTED_MODULE_2__["default"])(dirtyDate); - return Object(_eachWeekendOfInterval_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])({ - start: startDate, - end: endDate - }); -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/endOfDay/index.js": -/*!*****************************************************!*\ - !*** ./node_modules/date-fns/esm/endOfDay/index.js ***! - \*****************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return endOfDay; }); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); - -/** - * @name endOfDay - * @category Day Helpers - * @summary Return the end of a day for the given date. - * - * @description - * Return the end of a day for the given date. - * The result will be in the local timezone. - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} date - the original date - * @returns {Date} the end of a day - * @throws {TypeError} 1 argument required - * - * @example - * // The end of a day for 2 September 2014 11:55:00: - * var result = endOfDay(new Date(2014, 8, 2, 11, 55, 0)) - * //=> Tue Sep 02 2014 23:59:59.999 - */ - -function endOfDay(dirtyDate) { - if (arguments.length < 1) { - throw new TypeError('1 argument required, but only ' + arguments.length + ' present'); - } - - var date = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDate); - date.setHours(23, 59, 59, 999); - return date; -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/endOfDecade/index.js": -/*!********************************************************!*\ - !*** ./node_modules/date-fns/esm/endOfDecade/index.js ***! - \********************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return endOfDecade; }); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); - -/** - * @name endOfDecade - * @category Decade Helpers - * @summary Return the end of a decade for the given date. - * - * @description - * Return the end of a decade for the given date. - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} date - the original date - * @returns {Date} the end of a decade - * @param {Object} [options] - an object with options. - * @param {0|1|2} [options.additionalDigits=2] - passed to `toDate`. See [toDate]{@link https://date-fns.org/docs/toDate} - * @throws {TypeError} 1 argument required - * @throws {RangeError} `options.additionalDigits` must be 0, 1 or 2 - * - * @example - * // The end of a decade for 12 May 1984 00:00:00: - * var result = endOfDecade(new Date(1984, 4, 12, 00, 00, 00)) - * //=> Dec 31 1989 23:59:59.999 - */ - -function endOfDecade(dirtyDate) { - if (arguments.length < 1) { - throw new TypeError('1 argument required, but only ' + arguments.length + ' present'); - } - - var date = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDate); - var year = date.getFullYear(); - var decade = 9 + Math.floor(year / 10) * 10; - date.setFullYear(decade, 11, 31); - date.setHours(23, 59, 59, 999); - return date; -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/endOfHour/index.js": -/*!******************************************************!*\ - !*** ./node_modules/date-fns/esm/endOfHour/index.js ***! - \******************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return endOfHour; }); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); - -/** - * @name endOfHour - * @category Hour Helpers - * @summary Return the end of an hour for the given date. - * - * @description - * Return the end of an hour for the given date. - * The result will be in the local timezone. - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} date - the original date - * @returns {Date} the end of an hour - * @throws {TypeError} 1 argument required - * - * @example - * // The end of an hour for 2 September 2014 11:55:00: - * var result = endOfHour(new Date(2014, 8, 2, 11, 55)) - * //=> Tue Sep 02 2014 11:59:59.999 - */ - -function endOfHour(dirtyDate) { - if (arguments.length < 1) { - throw new TypeError('1 argument required, but only ' + arguments.length + ' present'); - } - - var date = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDate); - date.setMinutes(59, 59, 999); - return date; -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/endOfISOWeek/index.js": -/*!*********************************************************!*\ - !*** ./node_modules/date-fns/esm/endOfISOWeek/index.js ***! - \*********************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return endOfISOWeek; }); -/* harmony import */ var _endOfWeek_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../endOfWeek/index.js */ "./node_modules/date-fns/esm/endOfWeek/index.js"); - -/** - * @name endOfISOWeek - * @category ISO Week Helpers - * @summary Return the end of an ISO week for the given date. - * - * @description - * Return the end of an ISO week for the given date. - * The result will be in the local timezone. - * - * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} date - the original date - * @returns {Date} the end of an ISO week - * @throws {TypeError} 1 argument required - * - * @example - * // The end of an ISO week for 2 September 2014 11:55:00: - * var result = endOfISOWeek(new Date(2014, 8, 2, 11, 55, 0)) - * //=> Sun Sep 07 2014 23:59:59.999 - */ - -function endOfISOWeek(dirtyDate) { - if (arguments.length < 1) { - throw new TypeError('1 argument required, but only ' + arguments.length + ' present'); - } - - return Object(_endOfWeek_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDate, { - weekStartsOn: 1 - }); -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/endOfISOWeekYear/index.js": -/*!*************************************************************!*\ - !*** ./node_modules/date-fns/esm/endOfISOWeekYear/index.js ***! - \*************************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return endOfISOWeekYear; }); -/* harmony import */ var _getISOWeekYear_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../getISOWeekYear/index.js */ "./node_modules/date-fns/esm/getISOWeekYear/index.js"); -/* harmony import */ var _startOfISOWeek_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../startOfISOWeek/index.js */ "./node_modules/date-fns/esm/startOfISOWeek/index.js"); - - -/** - * @name endOfISOWeekYear - * @category ISO Week-Numbering Year Helpers - * @summary Return the end of an ISO week-numbering year for the given date. - * - * @description - * Return the end of an ISO week-numbering year, - * which always starts 3 days before the year's first Thursday. - * The result will be in the local timezone. - * - * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * - The function was renamed from `endOfISOYear` to `endOfISOWeekYear`. - * "ISO week year" is short for [ISO week-numbering year](https://en.wikipedia.org/wiki/ISO_week_date). - * This change makes the name consistent with - * locale-dependent week-numbering year helpers, e.g., `addWeekYears`. - * - * @param {Date|Number} date - the original date - * @returns {Date} the end of an ISO week-numbering year - * @throws {TypeError} 1 argument required - * - * @example - * // The end of an ISO week-numbering year for 2 July 2005: - * var result = endOfISOWeekYear(new Date(2005, 6, 2)) - * //=> Sun Jan 01 2006 23:59:59.999 - */ - -function endOfISOWeekYear(dirtyDate) { - if (arguments.length < 1) { - throw new TypeError('1 argument required, but only ' + arguments.length + ' present'); - } - - var year = Object(_getISOWeekYear_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDate); - var fourthOfJanuaryOfNextYear = new Date(0); - fourthOfJanuaryOfNextYear.setFullYear(year + 1, 0, 4); - fourthOfJanuaryOfNextYear.setHours(0, 0, 0, 0); - var date = Object(_startOfISOWeek_index_js__WEBPACK_IMPORTED_MODULE_1__["default"])(fourthOfJanuaryOfNextYear); - date.setMilliseconds(date.getMilliseconds() - 1); - return date; -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/endOfMinute/index.js": -/*!********************************************************!*\ - !*** ./node_modules/date-fns/esm/endOfMinute/index.js ***! - \********************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return endOfMinute; }); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); - -/** - * @name endOfMinute - * @category Minute Helpers - * @summary Return the end of a minute for the given date. - * - * @description - * Return the end of a minute for the given date. - * The result will be in the local timezone. - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} date - the original date - * @returns {Date} the end of a minute - * @throws {TypeError} 1 argument required - * - * @example - * // The end of a minute for 1 December 2014 22:15:45.400: - * var result = endOfMinute(new Date(2014, 11, 1, 22, 15, 45, 400)) - * //=> Mon Dec 01 2014 22:15:59.999 - */ - -function endOfMinute(dirtyDate) { - if (arguments.length < 1) { - throw new TypeError('1 argument required, but only ' + arguments.length + ' present'); - } - - var date = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDate); - date.setSeconds(59, 999); - return date; -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/endOfMonth/index.js": -/*!*******************************************************!*\ - !*** ./node_modules/date-fns/esm/endOfMonth/index.js ***! - \*******************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return endOfMonth; }); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); - -/** - * @name endOfMonth - * @category Month Helpers - * @summary Return the end of a month for the given date. - * - * @description - * Return the end of a month for the given date. - * The result will be in the local timezone. - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} date - the original date - * @returns {Date} the end of a month - * @throws {TypeError} 1 argument required - * - * @example - * // The end of a month for 2 September 2014 11:55:00: - * var result = endOfMonth(new Date(2014, 8, 2, 11, 55, 0)) - * //=> Tue Sep 30 2014 23:59:59.999 - */ - -function endOfMonth(dirtyDate) { - if (arguments.length < 1) { - throw new TypeError('1 argument required, but only ' + arguments.length + ' present'); - } - - var date = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDate); - var month = date.getMonth(); - date.setFullYear(date.getFullYear(), month + 1, 0); - date.setHours(23, 59, 59, 999); - return date; -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/endOfQuarter/index.js": -/*!*********************************************************!*\ - !*** ./node_modules/date-fns/esm/endOfQuarter/index.js ***! - \*********************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return endOfQuarter; }); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); - -/** - * @name endOfQuarter - * @category Quarter Helpers - * @summary Return the end of a year quarter for the given date. - * - * @description - * Return the end of a year quarter for the given date. - * The result will be in the local timezone. - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} date - the original date - * @returns {Date} the end of a quarter - * @throws {TypeError} 1 argument required - * - * @example - * // The end of a quarter for 2 September 2014 11:55:00: - * var result = endOfQuarter(new Date(2014, 8, 2, 11, 55, 0)) - * //=> Tue Sep 30 2014 23:59:59.999 - */ - -function endOfQuarter(dirtyDate) { - if (arguments.length < 1) { - throw new TypeError('1 argument required, but only ' + arguments.length + ' present'); - } - - var date = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDate); - var currentMonth = date.getMonth(); - var month = currentMonth - currentMonth % 3 + 3; - date.setMonth(month, 0); - date.setHours(23, 59, 59, 999); - return date; -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/endOfSecond/index.js": -/*!********************************************************!*\ - !*** ./node_modules/date-fns/esm/endOfSecond/index.js ***! - \********************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return endOfSecond; }); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); - -/** - * @name endOfSecond - * @category Second Helpers - * @summary Return the end of a second for the given date. - * - * @description - * Return the end of a second for the given date. - * The result will be in the local timezone. - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} date - the original date - * @returns {Date} the end of a second - * @throws {TypeError} 1 argument required - * - * @example - * // The end of a second for 1 December 2014 22:15:45.400: - * var result = endOfSecond(new Date(2014, 11, 1, 22, 15, 45, 400)) - * //=> Mon Dec 01 2014 22:15:45.999 - */ - -function endOfSecond(dirtyDate) { - if (arguments.length < 1) { - throw new TypeError('1 argument required, but only ' + arguments.length + ' present'); - } - - var date = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDate); - date.setMilliseconds(999); - return date; -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/endOfWeek/index.js": -/*!******************************************************!*\ - !*** ./node_modules/date-fns/esm/endOfWeek/index.js ***! - \******************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return endOfWeek; }); -/* harmony import */ var _lib_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../_lib/toInteger/index.js */ "./node_modules/date-fns/esm/_lib/toInteger/index.js"); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); - - -/** - * @name endOfWeek - * @category Week Helpers - * @summary Return the end of a week for the given date. - * - * @description - * Return the end of a week for the given date. - * The result will be in the local timezone. - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} date - the original date - * @param {Object} [options] - an object with options. - * @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday) - * @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale} - * @returns {Date} the end of a week - * @throws {TypeError} 1 argument required - * @throws {RangeError} `options.weekStartsOn` must be between 0 and 6 - * - * @example - * // The end of a week for 2 September 2014 11:55:00: - * var result = endOfWeek(new Date(2014, 8, 2, 11, 55, 0)) - * //=> Sat Sep 06 2014 23:59:59.999 - * - * @example - * // If the week starts on Monday, the end of the week for 2 September 2014 11:55:00: - * var result = endOfWeek(new Date(2014, 8, 2, 11, 55, 0), { weekStartsOn: 1 }) - * //=> Sun Sep 07 2014 23:59:59.999 - */ - -function endOfWeek(dirtyDate, dirtyOptions) { - if (arguments.length < 1) { - throw new TypeError('1 argument required, but only ' + arguments.length + ' present'); - } - - var options = dirtyOptions || {}; - var locale = options.locale; - var localeWeekStartsOn = locale && locale.options && locale.options.weekStartsOn; - var defaultWeekStartsOn = localeWeekStartsOn == null ? 0 : Object(_lib_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(localeWeekStartsOn); - var weekStartsOn = options.weekStartsOn == null ? defaultWeekStartsOn : Object(_lib_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(options.weekStartsOn); // Test if weekStartsOn is between 0 and 6 _and_ is not NaN - - if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) { - throw new RangeError('weekStartsOn must be between 0 and 6 inclusively'); - } - - var date = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_1__["default"])(dirtyDate); - var day = date.getDay(); - var diff = (day < weekStartsOn ? -7 : 0) + 6 - (day - weekStartsOn); - date.setDate(date.getDate() + diff); - date.setHours(23, 59, 59, 999); - return date; -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/endOfYear/index.js": -/*!******************************************************!*\ - !*** ./node_modules/date-fns/esm/endOfYear/index.js ***! - \******************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return endOfYear; }); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); - -/** - * @name endOfYear - * @category Year Helpers - * @summary Return the end of a year for the given date. - * - * @description - * Return the end of a year for the given date. - * The result will be in the local timezone. - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} date - the original date - * @returns {Date} the end of a year - * @throws {TypeError} 1 argument required - * - * @example - * // The end of a year for 2 September 2014 11:55:00: - * var result = endOfYear(new Date(2014, 8, 2, 11, 55, 00)) - * //=> Wed Dec 31 2014 23:59:59.999 - */ - -function endOfYear(dirtyDate) { - if (arguments.length < 1) { - throw new TypeError('1 argument required, but only ' + arguments.length + ' present'); - } - - var date = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDate); - var year = date.getFullYear(); - date.setFullYear(year + 1, 0, 0); - date.setHours(23, 59, 59, 999); - return date; -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/format/index.js": -/*!***************************************************!*\ - !*** ./node_modules/date-fns/esm/format/index.js ***! - \***************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return format; }); -/* harmony import */ var _lib_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../_lib/toInteger/index.js */ "./node_modules/date-fns/esm/_lib/toInteger/index.js"); -/* harmony import */ var _lib_getTimezoneOffsetInMilliseconds_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../_lib/getTimezoneOffsetInMilliseconds/index.js */ "./node_modules/date-fns/esm/_lib/getTimezoneOffsetInMilliseconds/index.js"); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); -/* harmony import */ var _isValid_index_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../isValid/index.js */ "./node_modules/date-fns/esm/isValid/index.js"); -/* harmony import */ var _locale_en_US_index_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../locale/en-US/index.js */ "./node_modules/date-fns/esm/locale/en-US/index.js"); -/* harmony import */ var _lib_format_formatters_index_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../_lib/format/formatters/index.js */ "./node_modules/date-fns/esm/_lib/format/formatters/index.js"); -/* harmony import */ var _lib_format_longFormatters_index_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../_lib/format/longFormatters/index.js */ "./node_modules/date-fns/esm/_lib/format/longFormatters/index.js"); -/* harmony import */ var _subMilliseconds_index_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../subMilliseconds/index.js */ "./node_modules/date-fns/esm/subMilliseconds/index.js"); -/* harmony import */ var _lib_protectedTokens_index_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../_lib/protectedTokens/index.js */ "./node_modules/date-fns/esm/_lib/protectedTokens/index.js"); - - - - - - - - - // This RegExp consists of three parts separated by `|`: -// - [yYQqMLwIdDecihHKkms]o matches any available ordinal number token -// (one of the certain letters followed by `o`) -// - (\w)\1* matches any sequences of the same letter -// - '' matches two quote characters in a row -// - '(''|[^'])+('|$) matches anything surrounded by two quote characters ('), -// except a single quote symbol, which ends the sequence. -// Two quote characters do not end the sequence. -// If there is no matching single quote -// then the sequence will continue until the end of the string. -// - . matches any single character unmatched by previous parts of the RegExps - -var formattingTokensRegExp = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g; // This RegExp catches symbols escaped by quotes, and also -// sequences of symbols P, p, and the combinations like `PPPPPPPppppp` - -var longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g; -var escapedStringRegExp = /^'(.*?)'?$/; -var doubleQuoteRegExp = /''/g; -/** - * @name format - * @category Common Helpers - * @summary Format the date. - * - * @description - * Return the formatted date string in the given format. The result may vary by locale. - * - * > âš ï¸ Please note that the `format` tokens differ from Moment.js and other libraries. - * > See: https://git.io/fxCyr - * - * The characters wrapped between two single quotes characters (') are escaped. - * Two single quotes in a row, whether inside or outside a quoted sequence, represent a 'real' single quote. - * (see the last example) - * - * Format of the string is based on Unicode Technical Standard #35: - * https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table - * with a few additions (see note 7 below the table). - * - * Accepted patterns: - * | Unit | Pattern | Result examples | Notes | - * |---------------------------------|---------|-----------------------------------|-------| - * | Era | G..GGG | AD, BC | | - * | | GGGG | Anno Domini, Before Christ | 2 | - * | | GGGGG | A, B | | - * | Calendar year | y | 44, 1, 1900, 2017 | 5 | - * | | yo | 44th, 1st, 0th, 17th | 5,7 | - * | | yy | 44, 01, 00, 17 | 5 | - * | | yyy | 044, 001, 1900, 2017 | 5 | - * | | yyyy | 0044, 0001, 1900, 2017 | 5 | - * | | yyyyy | ... | 3,5 | - * | Local week-numbering year | Y | 44, 1, 1900, 2017 | 5 | - * | | Yo | 44th, 1st, 1900th, 2017th | 5,7 | - * | | YY | 44, 01, 00, 17 | 5,8 | - * | | YYY | 044, 001, 1900, 2017 | 5 | - * | | YYYY | 0044, 0001, 1900, 2017 | 5,8 | - * | | YYYYY | ... | 3,5 | - * | ISO week-numbering year | R | -43, 0, 1, 1900, 2017 | 5,7 | - * | | RR | -43, 00, 01, 1900, 2017 | 5,7 | - * | | RRR | -043, 000, 001, 1900, 2017 | 5,7 | - * | | RRRR | -0043, 0000, 0001, 1900, 2017 | 5,7 | - * | | RRRRR | ... | 3,5,7 | - * | Extended year | u | -43, 0, 1, 1900, 2017 | 5 | - * | | uu | -43, 01, 1900, 2017 | 5 | - * | | uuu | -043, 001, 1900, 2017 | 5 | - * | | uuuu | -0043, 0001, 1900, 2017 | 5 | - * | | uuuuu | ... | 3,5 | - * | Quarter (formatting) | Q | 1, 2, 3, 4 | | - * | | Qo | 1st, 2nd, 3rd, 4th | 7 | - * | | QQ | 01, 02, 03, 04 | | - * | | QQQ | Q1, Q2, Q3, Q4 | | - * | | QQQQ | 1st quarter, 2nd quarter, ... | 2 | - * | | QQQQQ | 1, 2, 3, 4 | 4 | - * | Quarter (stand-alone) | q | 1, 2, 3, 4 | | - * | | qo | 1st, 2nd, 3rd, 4th | 7 | - * | | qq | 01, 02, 03, 04 | | - * | | qqq | Q1, Q2, Q3, Q4 | | - * | | qqqq | 1st quarter, 2nd quarter, ... | 2 | - * | | qqqqq | 1, 2, 3, 4 | 4 | - * | Month (formatting) | M | 1, 2, ..., 12 | | - * | | Mo | 1st, 2nd, ..., 12th | 7 | - * | | MM | 01, 02, ..., 12 | | - * | | MMM | Jan, Feb, ..., Dec | | - * | | MMMM | January, February, ..., December | 2 | - * | | MMMMM | J, F, ..., D | | - * | Month (stand-alone) | L | 1, 2, ..., 12 | | - * | | Lo | 1st, 2nd, ..., 12th | 7 | - * | | LL | 01, 02, ..., 12 | | - * | | LLL | Jan, Feb, ..., Dec | | - * | | LLLL | January, February, ..., December | 2 | - * | | LLLLL | J, F, ..., D | | - * | Local week of year | w | 1, 2, ..., 53 | | - * | | wo | 1st, 2nd, ..., 53th | 7 | - * | | ww | 01, 02, ..., 53 | | - * | ISO week of year | I | 1, 2, ..., 53 | 7 | - * | | Io | 1st, 2nd, ..., 53th | 7 | - * | | II | 01, 02, ..., 53 | 7 | - * | Day of month | d | 1, 2, ..., 31 | | - * | | do | 1st, 2nd, ..., 31st | 7 | - * | | dd | 01, 02, ..., 31 | | - * | Day of year | D | 1, 2, ..., 365, 366 | 8 | - * | | Do | 1st, 2nd, ..., 365th, 366th | 7 | - * | | DD | 01, 02, ..., 365, 366 | 8 | - * | | DDD | 001, 002, ..., 365, 366 | | - * | | DDDD | ... | 3 | - * | Day of week (formatting) | E..EEE | Mon, Tue, Wed, ..., Su | | - * | | EEEE | Monday, Tuesday, ..., Sunday | 2 | - * | | EEEEE | M, T, W, T, F, S, S | | - * | | EEEEEE | Mo, Tu, We, Th, Fr, Su, Sa | | - * | ISO day of week (formatting) | i | 1, 2, 3, ..., 7 | 7 | - * | | io | 1st, 2nd, ..., 7th | 7 | - * | | ii | 01, 02, ..., 07 | 7 | - * | | iii | Mon, Tue, Wed, ..., Su | 7 | - * | | iiii | Monday, Tuesday, ..., Sunday | 2,7 | - * | | iiiii | M, T, W, T, F, S, S | 7 | - * | | iiiiii | Mo, Tu, We, Th, Fr, Su, Sa | 7 | - * | Local day of week (formatting) | e | 2, 3, 4, ..., 1 | | - * | | eo | 2nd, 3rd, ..., 1st | 7 | - * | | ee | 02, 03, ..., 01 | | - * | | eee | Mon, Tue, Wed, ..., Su | | - * | | eeee | Monday, Tuesday, ..., Sunday | 2 | - * | | eeeee | M, T, W, T, F, S, S | | - * | | eeeeee | Mo, Tu, We, Th, Fr, Su, Sa | | - * | Local day of week (stand-alone) | c | 2, 3, 4, ..., 1 | | - * | | co | 2nd, 3rd, ..., 1st | 7 | - * | | cc | 02, 03, ..., 01 | | - * | | ccc | Mon, Tue, Wed, ..., Su | | - * | | cccc | Monday, Tuesday, ..., Sunday | 2 | - * | | ccccc | M, T, W, T, F, S, S | | - * | | cccccc | Mo, Tu, We, Th, Fr, Su, Sa | | - * | AM, PM | a..aaa | AM, PM | | - * | | aaaa | a.m., p.m. | 2 | - * | | aaaaa | a, p | | - * | AM, PM, noon, midnight | b..bbb | AM, PM, noon, midnight | | - * | | bbbb | a.m., p.m., noon, midnight | 2 | - * | | bbbbb | a, p, n, mi | | - * | Flexible day period | B..BBB | at night, in the morning, ... | | - * | | BBBB | at night, in the morning, ... | 2 | - * | | BBBBB | at night, in the morning, ... | | - * | Hour [1-12] | h | 1, 2, ..., 11, 12 | | - * | | ho | 1st, 2nd, ..., 11th, 12th | 7 | - * | | hh | 01, 02, ..., 11, 12 | | - * | Hour [0-23] | H | 0, 1, 2, ..., 23 | | - * | | Ho | 0th, 1st, 2nd, ..., 23rd | 7 | - * | | HH | 00, 01, 02, ..., 23 | | - * | Hour [0-11] | K | 1, 2, ..., 11, 0 | | - * | | Ko | 1st, 2nd, ..., 11th, 0th | 7 | - * | | KK | 1, 2, ..., 11, 0 | | - * | Hour [1-24] | k | 24, 1, 2, ..., 23 | | - * | | ko | 24th, 1st, 2nd, ..., 23rd | 7 | - * | | kk | 24, 01, 02, ..., 23 | | - * | Minute | m | 0, 1, ..., 59 | | - * | | mo | 0th, 1st, ..., 59th | 7 | - * | | mm | 00, 01, ..., 59 | | - * | Second | s | 0, 1, ..., 59 | | - * | | so | 0th, 1st, ..., 59th | 7 | - * | | ss | 00, 01, ..., 59 | | - * | Fraction of second | S | 0, 1, ..., 9 | | - * | | SS | 00, 01, ..., 99 | | - * | | SSS | 000, 0001, ..., 999 | | - * | | SSSS | ... | 3 | - * | Timezone (ISO-8601 w/ Z) | X | -08, +0530, Z | | - * | | XX | -0800, +0530, Z | | - * | | XXX | -08:00, +05:30, Z | | - * | | XXXX | -0800, +0530, Z, +123456 | 2 | - * | | XXXXX | -08:00, +05:30, Z, +12:34:56 | | - * | Timezone (ISO-8601 w/o Z) | x | -08, +0530, +00 | | - * | | xx | -0800, +0530, +0000 | | - * | | xxx | -08:00, +05:30, +00:00 | 2 | - * | | xxxx | -0800, +0530, +0000, +123456 | | - * | | xxxxx | -08:00, +05:30, +00:00, +12:34:56 | | - * | Timezone (GMT) | O...OOO | GMT-8, GMT+5:30, GMT+0 | | - * | | OOOO | GMT-08:00, GMT+05:30, GMT+00:00 | 2 | - * | Timezone (specific non-locat.) | z...zzz | GMT-8, GMT+5:30, GMT+0 | 6 | - * | | zzzz | GMT-08:00, GMT+05:30, GMT+00:00 | 2,6 | - * | Seconds timestamp | t | 512969520 | 7 | - * | | tt | ... | 3,7 | - * | Milliseconds timestamp | T | 512969520900 | 7 | - * | | TT | ... | 3,7 | - * | Long localized date | P | 05/29/1453 | 7 | - * | | PP | May 29, 1453 | 7 | - * | | PPP | May 29th, 1453 | 7 | - * | | PPPP | Sunday, May 29th, 1453 | 2,7 | - * | Long localized time | p | 12:00 AM | 7 | - * | | pp | 12:00:00 AM | 7 | - * | | ppp | 12:00:00 AM GMT+2 | 7 | - * | | pppp | 12:00:00 AM GMT+02:00 | 2,7 | - * | Combination of date and time | Pp | 05/29/1453, 12:00 AM | 7 | - * | | PPpp | May 29, 1453, 12:00:00 AM | 7 | - * | | PPPppp | May 29th, 1453 at ... | 7 | - * | | PPPPpppp| Sunday, May 29th, 1453 at ... | 2,7 | - * Notes: - * 1. "Formatting" units (e.g. formatting quarter) in the default en-US locale - * are the same as "stand-alone" units, but are different in some languages. - * "Formatting" units are declined according to the rules of the language - * in the context of a date. "Stand-alone" units are always nominative singular: - * - * `format(new Date(2017, 10, 6), 'do LLLL', {locale: cs}) //=> '6. listopad'` - * - * `format(new Date(2017, 10, 6), 'do MMMM', {locale: cs}) //=> '6. listopadu'` - * - * 2. Any sequence of the identical letters is a pattern, unless it is escaped by - * the single quote characters (see below). - * If the sequence is longer than listed in table (e.g. `EEEEEEEEEEE`) - * the output will be the same as default pattern for this unit, usually - * the longest one (in case of ISO weekdays, `EEEE`). Default patterns for units - * are marked with "2" in the last column of the table. - * - * `format(new Date(2017, 10, 6), 'MMM') //=> 'Nov'` - * - * `format(new Date(2017, 10, 6), 'MMMM') //=> 'November'` - * - * `format(new Date(2017, 10, 6), 'MMMMM') //=> 'N'` - * - * `format(new Date(2017, 10, 6), 'MMMMMM') //=> 'November'` - * - * `format(new Date(2017, 10, 6), 'MMMMMMM') //=> 'November'` - * - * 3. Some patterns could be unlimited length (such as `yyyyyyyy`). - * The output will be padded with zeros to match the length of the pattern. - * - * `format(new Date(2017, 10, 6), 'yyyyyyyy') //=> '00002017'` - * - * 4. `QQQQQ` and `qqqqq` could be not strictly numerical in some locales. - * These tokens represent the shortest form of the quarter. - * - * 5. The main difference between `y` and `u` patterns are B.C. years: - * - * | Year | `y` | `u` | - * |------|-----|-----| - * | AC 1 | 1 | 1 | - * | BC 1 | 1 | 0 | - * | BC 2 | 2 | -1 | - * - * Also `yy` always returns the last two digits of a year, - * while `uu` pads single digit years to 2 characters and returns other years unchanged: - * - * | Year | `yy` | `uu` | - * |------|------|------| - * | 1 | 01 | 01 | - * | 14 | 14 | 14 | - * | 376 | 76 | 376 | - * | 1453 | 53 | 1453 | - * - * The same difference is true for local and ISO week-numbering years (`Y` and `R`), - * except local week-numbering years are dependent on `options.weekStartsOn` - * and `options.firstWeekContainsDate` (compare [getISOWeekYear]{@link https://date-fns.org/docs/getISOWeekYear} - * and [getWeekYear]{@link https://date-fns.org/docs/getWeekYear}). - * - * 6. Specific non-location timezones are currently unavailable in `date-fns`, - * so right now these tokens fall back to GMT timezones. - * - * 7. These patterns are not in the Unicode Technical Standard #35: - * - `i`: ISO day of week - * - `I`: ISO week of year - * - `R`: ISO week-numbering year - * - `t`: seconds timestamp - * - `T`: milliseconds timestamp - * - `o`: ordinal number modifier - * - `P`: long localized date - * - `p`: long localized time - * - * 8. These tokens are often confused with others. See: https://git.io/fxCyr - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * - The second argument is now required for the sake of explicitness. - * - * ```javascript - * // Before v2.0.0 - * format(new Date(2016, 0, 1)) - * - * // v2.0.0 onward - * format(new Date(2016, 0, 1), "yyyy-MM-dd'T'HH:mm:ss.SSSxxx") - * ``` - * - * - New format string API for `format` function - * which is based on [Unicode Technical Standard #35](https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table). - * See [this post](https://blog.date-fns.org/post/unicode-tokens-in-date-fns-v2-sreatyki91jg) for more details. - * - * - Characters are now escaped using single quote symbols (`'`) instead of square brackets. - * - * @param {Date|Number} date - the original date - * @param {String} format - the string of tokens - * @param {Object} [options] - an object with options. - * @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday) - * @param {Number} [options.firstWeekContainsDate=1] - the day of January, which is - * @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale} - * @param {Boolean} [options.awareOfUnicodeTokens=false] - if true, allows usage of Unicode tokens causes confusion: - * - Some of the day of year tokens (`D`, `DD`) that are confused with the day of month tokens (`d`, `dd`). - * - Some of the local week-numbering year tokens (`YY`, `YYYY`) that are confused with the calendar year tokens (`yy`, `yyyy`). - * See: https://git.io/fxCyr - * @returns {String} the formatted date string - * @throws {TypeError} 2 arguments required - * @throws {RangeError} `options.locale` must contain `localize` property - * @throws {RangeError} `options.locale` must contain `formatLong` property - * @throws {RangeError} `options.weekStartsOn` must be between 0 and 6 - * @throws {RangeError} `options.firstWeekContainsDate` must be between 1 and 7 - * @throws {RangeError} `options.awareOfUnicodeTokens` must be set to `true` to use `XX` token; see: https://git.io/fxCyr - * - * @example - * // Represent 11 February 2014 in middle-endian format: - * var result = format(new Date(2014, 1, 11), 'MM/dd/yyyy') - * //=> '02/11/2014' - * - * @example - * // Represent 2 July 2014 in Esperanto: - * import { eoLocale } from 'date-fns/locale/eo' - * var result = format(new Date(2014, 6, 2), "do 'de' MMMM yyyy", { - * locale: eoLocale - * }) - * //=> '2-a de julio 2014' - * - * @example - * // Escape string by single quote characters: - * var result = format(new Date(2014, 6, 2, 15), "h 'o''clock'") - * //=> "3 o'clock" - */ - -function format(dirtyDate, dirtyFormatStr, dirtyOptions) { - if (arguments.length < 2) { - throw new TypeError('2 arguments required, but only ' + arguments.length + ' present'); - } - - var formatStr = String(dirtyFormatStr); - var options = dirtyOptions || {}; - var locale = options.locale || _locale_en_US_index_js__WEBPACK_IMPORTED_MODULE_4__["default"]; - var localeFirstWeekContainsDate = locale.options && locale.options.firstWeekContainsDate; - var defaultFirstWeekContainsDate = localeFirstWeekContainsDate == null ? 1 : Object(_lib_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(localeFirstWeekContainsDate); - var firstWeekContainsDate = options.firstWeekContainsDate == null ? defaultFirstWeekContainsDate : Object(_lib_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(options.firstWeekContainsDate); // Test if weekStartsOn is between 1 and 7 _and_ is not NaN - - if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) { - throw new RangeError('firstWeekContainsDate must be between 1 and 7 inclusively'); - } - - var localeWeekStartsOn = locale.options && locale.options.weekStartsOn; - var defaultWeekStartsOn = localeWeekStartsOn == null ? 0 : Object(_lib_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(localeWeekStartsOn); - var weekStartsOn = options.weekStartsOn == null ? defaultWeekStartsOn : Object(_lib_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(options.weekStartsOn); // Test if weekStartsOn is between 0 and 6 _and_ is not NaN - - if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) { - throw new RangeError('weekStartsOn must be between 0 and 6 inclusively'); - } - - if (!locale.localize) { - throw new RangeError('locale must contain localize property'); - } - - if (!locale.formatLong) { - throw new RangeError('locale must contain formatLong property'); - } - - var originalDate = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_2__["default"])(dirtyDate); - - if (!Object(_isValid_index_js__WEBPACK_IMPORTED_MODULE_3__["default"])(originalDate)) { - throw new RangeError('Invalid time value'); - } // Convert the date in system timezone to the same date in UTC+00:00 timezone. - // This ensures that when UTC functions will be implemented, locales will be compatible with them. - // See an issue about UTC functions: https://github.com/date-fns/date-fns/issues/376 - - - var timezoneOffset = Object(_lib_getTimezoneOffsetInMilliseconds_index_js__WEBPACK_IMPORTED_MODULE_1__["default"])(originalDate); - var utcDate = Object(_subMilliseconds_index_js__WEBPACK_IMPORTED_MODULE_7__["default"])(originalDate, timezoneOffset); - var formatterOptions = { - firstWeekContainsDate: firstWeekContainsDate, - weekStartsOn: weekStartsOn, - locale: locale, - _originalDate: originalDate - }; - var result = formatStr.match(longFormattingTokensRegExp).map(function (substring) { - var firstCharacter = substring[0]; - - if (firstCharacter === 'p' || firstCharacter === 'P') { - var longFormatter = _lib_format_longFormatters_index_js__WEBPACK_IMPORTED_MODULE_6__["default"][firstCharacter]; - return longFormatter(substring, locale.formatLong, formatterOptions); - } - - return substring; - }).join('').match(formattingTokensRegExp).map(function (substring) { - // Replace two single quote characters with one single quote character - if (substring === "''") { - return "'"; - } - - var firstCharacter = substring[0]; - - if (firstCharacter === "'") { - return cleanEscapedString(substring); - } - - var formatter = _lib_format_formatters_index_js__WEBPACK_IMPORTED_MODULE_5__["default"][firstCharacter]; - - if (formatter) { - if (!options.awareOfUnicodeTokens && Object(_lib_protectedTokens_index_js__WEBPACK_IMPORTED_MODULE_8__["isProtectedToken"])(substring)) { - Object(_lib_protectedTokens_index_js__WEBPACK_IMPORTED_MODULE_8__["throwProtectedError"])(substring); - } - - return formatter(utcDate, substring, locale.localize, formatterOptions); - } - - return substring; - }).join(''); - return result; -} - -function cleanEscapedString(input) { - return input.match(escapedStringRegExp)[1].replace(doubleQuoteRegExp, "'"); -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/formatDistance/index.js": -/*!***********************************************************!*\ - !*** ./node_modules/date-fns/esm/formatDistance/index.js ***! - \***********************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return formatDistance; }); -/* harmony import */ var _lib_getTimezoneOffsetInMilliseconds_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../_lib/getTimezoneOffsetInMilliseconds/index.js */ "./node_modules/date-fns/esm/_lib/getTimezoneOffsetInMilliseconds/index.js"); -/* harmony import */ var _compareAsc_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../compareAsc/index.js */ "./node_modules/date-fns/esm/compareAsc/index.js"); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); -/* harmony import */ var _differenceInSeconds_index_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../differenceInSeconds/index.js */ "./node_modules/date-fns/esm/differenceInSeconds/index.js"); -/* harmony import */ var _differenceInMonths_index_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../differenceInMonths/index.js */ "./node_modules/date-fns/esm/differenceInMonths/index.js"); -/* harmony import */ var _lib_cloneObject_index_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../_lib/cloneObject/index.js */ "./node_modules/date-fns/esm/_lib/cloneObject/index.js"); -/* harmony import */ var _locale_en_US_index_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../locale/en-US/index.js */ "./node_modules/date-fns/esm/locale/en-US/index.js"); - - - - - - - -var MINUTES_IN_DAY = 1440; -var MINUTES_IN_ALMOST_TWO_DAYS = 2520; -var MINUTES_IN_MONTH = 43200; -var MINUTES_IN_TWO_MONTHS = 86400; -/** - * @name formatDistance - * @category Common Helpers - * @summary Return the distance between the given dates in words. - * - * @description - * Return the distance between the given dates in words. - * - * | Distance between dates | Result | - * |-------------------------------------------------------------------|---------------------| - * | 0 ... 30 secs | less than a minute | - * | 30 secs ... 1 min 30 secs | 1 minute | - * | 1 min 30 secs ... 44 mins 30 secs | [2..44] minutes | - * | 44 mins ... 30 secs ... 89 mins 30 secs | about 1 hour | - * | 89 mins 30 secs ... 23 hrs 59 mins 30 secs | about [2..24] hours | - * | 23 hrs 59 mins 30 secs ... 41 hrs 59 mins 30 secs | 1 day | - * | 41 hrs 59 mins 30 secs ... 29 days 23 hrs 59 mins 30 secs | [2..30] days | - * | 29 days 23 hrs 59 mins 30 secs ... 44 days 23 hrs 59 mins 30 secs | about 1 month | - * | 44 days 23 hrs 59 mins 30 secs ... 59 days 23 hrs 59 mins 30 secs | about 2 months | - * | 59 days 23 hrs 59 mins 30 secs ... 1 yr | [2..12] months | - * | 1 yr ... 1 yr 3 months | about 1 year | - * | 1 yr 3 months ... 1 yr 9 month s | over 1 year | - * | 1 yr 9 months ... 2 yrs | almost 2 years | - * | N yrs ... N yrs 3 months | about N years | - * | N yrs 3 months ... N yrs 9 months | over N years | - * | N yrs 9 months ... N+1 yrs | almost N+1 years | - * - * With `options.includeSeconds == true`: - * | Distance between dates | Result | - * |------------------------|----------------------| - * | 0 secs ... 5 secs | less than 5 seconds | - * | 5 secs ... 10 secs | less than 10 seconds | - * | 10 secs ... 20 secs | less than 20 seconds | - * | 20 secs ... 40 secs | half a minute | - * | 40 secs ... 60 secs | less than a minute | - * | 60 secs ... 90 secs | 1 minute | - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * - The function was renamed from `distanceInWords ` to `formatDistance ` - * to make its name consistent with `format` and `formatRelative`. - * - * - The order of arguments is swapped to make the function - * consistent with `differenceIn...` functions. - * - * ```javascript - * // Before v2.0.0 - * - * distanceInWords( - * new Date(1986, 3, 4, 10, 32, 0), - * new Date(1986, 3, 4, 11, 32, 0), - * { addSuffix: true } - * ) //=> 'in about 1 hour' - * - * // v2.0.0 onward - * - * formatDistance( - * new Date(1986, 3, 4, 11, 32, 0), - * new Date(1986, 3, 4, 10, 32, 0), - * { addSuffix: true } - * ) //=> 'in about 1 hour' - * ``` - * - * @param {Date|Number} date - the date - * @param {Date|Number} baseDate - the date to compare with - * @param {Object} [options] - an object with options. - * @param {Boolean} [options.includeSeconds=false] - distances less than a minute are more detailed - * @param {Boolean} [options.addSuffix=false] - result indicates if the second date is earlier or later than the first - * @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale} - * @returns {String} the distance in words - * @throws {TypeError} 2 arguments required - * @throws {RangeError} `options.locale` must contain `formatDistance` property - * - * @example - * // What is the distance between 2 July 2014 and 1 January 2015? - * var result = formatDistance(new Date(2014, 6, 2), new Date(2015, 0, 1)) - * //=> '6 months' - * - * @example - * // What is the distance between 1 January 2015 00:00:15 - * // and 1 January 2015 00:00:00, including seconds? - * var result = formatDistance( - * new Date(2015, 0, 1, 0, 0, 15), - * new Date(2015, 0, 1, 0, 0, 0), - * { includeSeconds: true } - * ) - * //=> 'less than 20 seconds' - * - * @example - * // What is the distance from 1 January 2016 - * // to 1 January 2015, with a suffix? - * var result = formatDistance(new Date(2015, 0, 1), new Date(2016, 0, 1), { - * addSuffix: true - * }) - * //=> 'about 1 year ago' - * - * @example - * // What is the distance between 1 August 2016 and 1 January 2015 in Esperanto? - * import { eoLocale } from 'date-fns/locale/eo' - * var result = formatDistance(new Date(2016, 7, 1), new Date(2015, 0, 1), { - * locale: eoLocale - * }) - * //=> 'pli ol 1 jaro' - */ - -function formatDistance(dirtyDate, dirtyBaseDate, dirtyOptions) { - if (arguments.length < 2) { - throw new TypeError('2 arguments required, but only ' + arguments.length + ' present'); - } - - var options = dirtyOptions || {}; - var locale = options.locale || _locale_en_US_index_js__WEBPACK_IMPORTED_MODULE_6__["default"]; - - if (!locale.formatDistance) { - throw new RangeError('locale must contain formatDistance property'); - } - - var comparison = Object(_compareAsc_index_js__WEBPACK_IMPORTED_MODULE_1__["default"])(dirtyDate, dirtyBaseDate); - - if (isNaN(comparison)) { - throw new RangeError('Invalid time value'); - } - - var localizeOptions = Object(_lib_cloneObject_index_js__WEBPACK_IMPORTED_MODULE_5__["default"])(options); - localizeOptions.addSuffix = Boolean(options.addSuffix); - localizeOptions.comparison = comparison; - var dateLeft; - var dateRight; - - if (comparison > 0) { - dateLeft = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_2__["default"])(dirtyBaseDate); - dateRight = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_2__["default"])(dirtyDate); - } else { - dateLeft = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_2__["default"])(dirtyDate); - dateRight = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_2__["default"])(dirtyBaseDate); - } - - var seconds = Object(_differenceInSeconds_index_js__WEBPACK_IMPORTED_MODULE_3__["default"])(dateRight, dateLeft); - var offsetInSeconds = (Object(_lib_getTimezoneOffsetInMilliseconds_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dateRight) - Object(_lib_getTimezoneOffsetInMilliseconds_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dateLeft)) / 1000; - var minutes = Math.round((seconds - offsetInSeconds) / 60); - var months; // 0 up to 2 mins - - if (minutes < 2) { - if (options.includeSeconds) { - if (seconds < 5) { - return locale.formatDistance('lessThanXSeconds', 5, localizeOptions); - } else if (seconds < 10) { - return locale.formatDistance('lessThanXSeconds', 10, localizeOptions); - } else if (seconds < 20) { - return locale.formatDistance('lessThanXSeconds', 20, localizeOptions); - } else if (seconds < 40) { - return locale.formatDistance('halfAMinute', null, localizeOptions); - } else if (seconds < 60) { - return locale.formatDistance('lessThanXMinutes', 1, localizeOptions); - } else { - return locale.formatDistance('xMinutes', 1, localizeOptions); - } - } else { - if (minutes === 0) { - return locale.formatDistance('lessThanXMinutes', 1, localizeOptions); - } else { - return locale.formatDistance('xMinutes', minutes, localizeOptions); - } - } // 2 mins up to 0.75 hrs - - } else if (minutes < 45) { - return locale.formatDistance('xMinutes', minutes, localizeOptions); // 0.75 hrs up to 1.5 hrs - } else if (minutes < 90) { - return locale.formatDistance('aboutXHours', 1, localizeOptions); // 1.5 hrs up to 24 hrs - } else if (minutes < MINUTES_IN_DAY) { - var hours = Math.round(minutes / 60); - return locale.formatDistance('aboutXHours', hours, localizeOptions); // 1 day up to 1.75 days - } else if (minutes < MINUTES_IN_ALMOST_TWO_DAYS) { - return locale.formatDistance('xDays', 1, localizeOptions); // 1.75 days up to 30 days - } else if (minutes < MINUTES_IN_MONTH) { - var days = Math.round(minutes / MINUTES_IN_DAY); - return locale.formatDistance('xDays', days, localizeOptions); // 1 month up to 2 months - } else if (minutes < MINUTES_IN_TWO_MONTHS) { - months = Math.round(minutes / MINUTES_IN_MONTH); - return locale.formatDistance('aboutXMonths', months, localizeOptions); - } - - months = Object(_differenceInMonths_index_js__WEBPACK_IMPORTED_MODULE_4__["default"])(dateRight, dateLeft); // 2 months up to 12 months - - if (months < 12) { - var nearestMonth = Math.round(minutes / MINUTES_IN_MONTH); - return locale.formatDistance('xMonths', nearestMonth, localizeOptions); // 1 year up to max Date - } else { - var monthsSinceStartOfYear = months % 12; - var years = Math.floor(months / 12); // N years up to 1 years 3 months - - if (monthsSinceStartOfYear < 3) { - return locale.formatDistance('aboutXYears', years, localizeOptions); // N years 3 months up to N years 9 months - } else if (monthsSinceStartOfYear < 9) { - return locale.formatDistance('overXYears', years, localizeOptions); // N years 9 months up to N year 12 months - } else { - return locale.formatDistance('almostXYears', years + 1, localizeOptions); - } - } -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/formatDistanceStrict/index.js": -/*!*****************************************************************!*\ - !*** ./node_modules/date-fns/esm/formatDistanceStrict/index.js ***! - \*****************************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return formatDistanceStrict; }); -/* harmony import */ var _lib_getTimezoneOffsetInMilliseconds_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../_lib/getTimezoneOffsetInMilliseconds/index.js */ "./node_modules/date-fns/esm/_lib/getTimezoneOffsetInMilliseconds/index.js"); -/* harmony import */ var _compareAsc_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../compareAsc/index.js */ "./node_modules/date-fns/esm/compareAsc/index.js"); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); -/* harmony import */ var _differenceInSeconds_index_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../differenceInSeconds/index.js */ "./node_modules/date-fns/esm/differenceInSeconds/index.js"); -/* harmony import */ var _lib_cloneObject_index_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../_lib/cloneObject/index.js */ "./node_modules/date-fns/esm/_lib/cloneObject/index.js"); -/* harmony import */ var _locale_en_US_index_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../locale/en-US/index.js */ "./node_modules/date-fns/esm/locale/en-US/index.js"); - - - - - - -var MINUTES_IN_DAY = 1440; -var MINUTES_IN_MONTH = 43200; -var MINUTES_IN_YEAR = 525600; -/** - * @name formatDistanceStrict - * @category Common Helpers - * @summary Return the distance between the given dates in words. - * - * @description - * Return the distance between the given dates in words, using strict units. - * This is like `formatDistance`, but does not use helpers like 'almost', 'over', - * 'less than' and the like. - * - * | Distance between dates | Result | - * |------------------------|---------------------| - * | 0 ... 59 secs | [0..59] seconds | - * | 1 ... 59 mins | [1..59] minutes | - * | 1 ... 23 hrs | [1..23] hours | - * | 1 ... 29 days | [1..29] days | - * | 1 ... 11 months | [1..11] months | - * | 1 ... N years | [1..N] years | - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * - The function was renamed from `distanceInWordsStrict` to `formatDistanceStrict` - * to make its name consistent with `format` and `formatRelative`. - * - * - The order of arguments is swapped to make the function - * consistent with `differenceIn...` functions. - * - * ```javascript - * // Before v2.0.0 - * - * distanceInWordsStrict( - * new Date(2015, 0, 2), - * new Date(2014, 6, 2) - * ) //=> '6 months' - * - * // v2.0.0 onward - * - * formatDistanceStrict( - * new Date(2014, 6, 2), - * new Date(2015, 0, 2) - * ) //=> '6 months' - * ``` - * - * - `partialMethod` option is renamed to `roundingMethod`. - * - * ```javascript - * // Before v2.0.0 - * - * distanceInWordsStrict( - * new Date(1986, 3, 4, 10, 32, 0), - * new Date(1986, 3, 4, 10, 33, 1), - * { partialMethod: 'ceil' } - * ) //=> '2 minutes' - * - * // v2.0.0 onward - * - * formatDistanceStrict( - * new Date(1986, 3, 4, 10, 33, 1), - * new Date(1986, 3, 4, 10, 32, 0), - * { roundingMethod: 'ceil' } - * ) //=> '2 minutes' - * ``` - * - * - If `roundingMethod` is not specified, it now defaults to `round` instead of `floor`. - * - * - `unit` option now accepts one of the strings: - * 'second', 'minute', 'hour', 'day', 'month' or 'year' instead of 's', 'm', 'h', 'd', 'M' or 'Y' - * - * ```javascript - * // Before v2.0.0 - * - * distanceInWordsStrict( - * new Date(1986, 3, 4, 10, 32, 0), - * new Date(1986, 3, 4, 10, 33, 1), - * { unit: 'm' } - * ) - * - * // v2.0.0 onward - * - * formatDistanceStrict( - * new Date(1986, 3, 4, 10, 33, 1), - * new Date(1986, 3, 4, 10, 32, 0), - * { unit: 'minute' } - * ) - * ``` - * - * @param {Date|Number} date - the date - * @param {Date|Number} baseDate - the date to compare with - * @param {Object} [options] - an object with options. - * @param {Boolean} [options.addSuffix=false] - result indicates if the second date is earlier or later than the first - * @param {'second'|'minute'|'hour'|'day'|'month'|'year'} [options.unit] - if specified, will force a unit - * @param {'floor'|'ceil'|'round'} [options.roundingMethod='round'] - which way to round partial units - * @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale} - * @returns {String} the distance in words - * @throws {TypeError} 2 arguments required - * @throws {RangeError} `options.roundingMethod` must be 'floor', 'ceil' or 'round' - * @throws {RangeError} `options.unit` must be 'second', 'minute', 'hour', 'day', 'month' or 'year' - * @throws {RangeError} `options.locale` must contain `formatDistance` property - * - * @example - * // What is the distance between 2 July 2014 and 1 January 2015? - * var result = formatDistanceStrict(new Date(2014, 6, 2), new Date(2015, 0, 2)) - * //=> '6 months' - * - * @example - * // What is the distance between 1 January 2015 00:00:15 - * // and 1 January 2015 00:00:00? - * var result = formatDistanceStrict( - * new Date(2015, 0, 1, 0, 0, 15), - * new Date(2015, 0, 1, 0, 0, 0) - * ) - * //=> '15 seconds' - * - * @example - * // What is the distance from 1 January 2016 - * // to 1 January 2015, with a suffix? - * var result = formatDistanceStrict(new Date(2015, 0, 1), new Date(2016, 0, 1), { - * addSuffix: true - * }) - * //=> '1 year ago' - * - * @example - * // What is the distance from 1 January 2016 - * // to 1 January 2015, in minutes? - * var result = formatDistanceStrict(new Date(2016, 0, 1), new Date(2015, 0, 1), { - * unit: 'minute' - * }) - * //=> '525600 minutes' - * - * @example - * // What is the distance from 1 January 2016 - * // to 28 January 2015, in months, rounded up? - * var result = formatDistanceStrict(new Date(2015, 0, 28), new Date(2015, 0, 1), { - * unit: 'month', - * roundingMethod: 'ceil' - * }) - * //=> '1 month' - * - * @example - * // What is the distance between 1 August 2016 and 1 January 2015 in Esperanto? - * import { eoLocale } from 'date-fns/locale/eo' - * var result = formatDistanceStrict(new Date(2016, 7, 1), new Date(2015, 0, 1), { - * locale: eoLocale - * }) - * //=> '1 jaro' - */ - -function formatDistanceStrict(dirtyDate, dirtyBaseDate, dirtyOptions) { - if (arguments.length < 2) { - throw new TypeError('2 arguments required, but only ' + arguments.length + ' present'); - } - - var options = dirtyOptions || {}; - var locale = options.locale || _locale_en_US_index_js__WEBPACK_IMPORTED_MODULE_5__["default"]; - - if (!locale.formatDistance) { - throw new RangeError('locale must contain localize.formatDistance property'); - } - - var comparison = Object(_compareAsc_index_js__WEBPACK_IMPORTED_MODULE_1__["default"])(dirtyDate, dirtyBaseDate); - - if (isNaN(comparison)) { - throw new RangeError('Invalid time value'); - } - - var localizeOptions = Object(_lib_cloneObject_index_js__WEBPACK_IMPORTED_MODULE_4__["default"])(options); - localizeOptions.addSuffix = Boolean(options.addSuffix); - localizeOptions.comparison = comparison; - var dateLeft; - var dateRight; - - if (comparison > 0) { - dateLeft = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_2__["default"])(dirtyBaseDate); - dateRight = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_2__["default"])(dirtyDate); - } else { - dateLeft = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_2__["default"])(dirtyDate); - dateRight = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_2__["default"])(dirtyBaseDate); - } - - var roundingMethod = options.roundingMethod == null ? 'round' : String(options.roundingMethod); - var roundingMethodFn; - - if (roundingMethod === 'floor') { - roundingMethodFn = Math.floor; - } else if (roundingMethod === 'ceil') { - roundingMethodFn = Math.ceil; - } else if (roundingMethod === 'round') { - roundingMethodFn = Math.round; - } else { - throw new RangeError("roundingMethod must be 'floor', 'ceil' or 'round'"); - } - - var seconds = Object(_differenceInSeconds_index_js__WEBPACK_IMPORTED_MODULE_3__["default"])(dateRight, dateLeft); - var offsetInSeconds = (Object(_lib_getTimezoneOffsetInMilliseconds_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dateRight) - Object(_lib_getTimezoneOffsetInMilliseconds_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dateLeft)) / 1000; - var minutes = roundingMethodFn((seconds - offsetInSeconds) / 60); - var unit; - - if (options.unit == null) { - if (minutes < 1) { - unit = 'second'; - } else if (minutes < 60) { - unit = 'minute'; - } else if (minutes < MINUTES_IN_DAY) { - unit = 'hour'; - } else if (minutes < MINUTES_IN_MONTH) { - unit = 'day'; - } else if (minutes < MINUTES_IN_YEAR) { - unit = 'month'; - } else { - unit = 'year'; - } - } else { - unit = String(options.unit); - } // 0 up to 60 seconds - - - if (unit === 'second') { - return locale.formatDistance('xSeconds', seconds, localizeOptions); // 1 up to 60 mins - } else if (unit === 'minute') { - return locale.formatDistance('xMinutes', minutes, localizeOptions); // 1 up to 24 hours - } else if (unit === 'hour') { - var hours = roundingMethodFn(minutes / 60); - return locale.formatDistance('xHours', hours, localizeOptions); // 1 up to 30 days - } else if (unit === 'day') { - var days = roundingMethodFn(minutes / MINUTES_IN_DAY); - return locale.formatDistance('xDays', days, localizeOptions); // 1 up to 12 months - } else if (unit === 'month') { - var months = roundingMethodFn(minutes / MINUTES_IN_MONTH); - return locale.formatDistance('xMonths', months, localizeOptions); // 1 year up to max Date - } else if (unit === 'year') { - var years = roundingMethodFn(minutes / MINUTES_IN_YEAR); - return locale.formatDistance('xYears', years, localizeOptions); - } - - throw new RangeError("unit must be 'second', 'minute', 'hour', 'day', 'month' or 'year'"); -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/formatRelative/index.js": -/*!***********************************************************!*\ - !*** ./node_modules/date-fns/esm/formatRelative/index.js ***! - \***********************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return formatRelative; }); -/* harmony import */ var _lib_getTimezoneOffsetInMilliseconds_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../_lib/getTimezoneOffsetInMilliseconds/index.js */ "./node_modules/date-fns/esm/_lib/getTimezoneOffsetInMilliseconds/index.js"); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); -/* harmony import */ var _format_index_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../format/index.js */ "./node_modules/date-fns/esm/format/index.js"); -/* harmony import */ var _differenceInCalendarDays_index_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../differenceInCalendarDays/index.js */ "./node_modules/date-fns/esm/differenceInCalendarDays/index.js"); -/* harmony import */ var _locale_en_US_index_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../locale/en-US/index.js */ "./node_modules/date-fns/esm/locale/en-US/index.js"); -/* harmony import */ var _subMilliseconds_index_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../subMilliseconds/index.js */ "./node_modules/date-fns/esm/subMilliseconds/index.js"); - - - - - - -/** - * @name formatRelative - * @category Common Helpers - * @summary Represent the date in words relative to the given base date. - * - * @description - * Represent the date in words relative to the given base date. - * - * | Distance to the base date | Result | - * |---------------------------|---------------------------| - * | Previous 6 days | last Sunday at 04:30 AM | - * | Last day | yesterday at 04:30 AM | - * | Same day | today at 04:30 AM | - * | Next day | tomorrow at 04:30 AM | - * | Next 6 days | Sunday at 04:30 AM | - * | Other | 12/31/2017 | - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} date - the date to format - * @param {Date|Number} baseDate - the date to compare with - * @param {Object} [options] - an object with options. - * @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday) - * @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale} - * @returns {String} the date in words - * @throws {TypeError} 2 arguments required - * @throws {RangeError} `options.weekStartsOn` must be between 0 and 6 - * @throws {RangeError} `options.locale` must contain `localize` property - * @throws {RangeError} `options.locale` must contain `formatLong` property - * @throws {RangeError} `options.locale` must contain `formatRelative` property - */ - -function formatRelative(dirtyDate, dirtyBaseDate, dirtyOptions) { - if (arguments.length < 2) { - throw new TypeError('2 arguments required, but only ' + arguments.length + ' present'); - } - - var date = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_1__["default"])(dirtyDate); - var baseDate = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_1__["default"])(dirtyBaseDate); - var options = dirtyOptions || {}; - var locale = options.locale || _locale_en_US_index_js__WEBPACK_IMPORTED_MODULE_4__["default"]; - - if (!locale.localize) { - throw new RangeError('locale must contain localize property'); - } - - if (!locale.formatLong) { - throw new RangeError('locale must contain formatLong property'); - } - - if (!locale.formatRelative) { - throw new RangeError('locale must contain formatRelative property'); - } - - var diff = Object(_differenceInCalendarDays_index_js__WEBPACK_IMPORTED_MODULE_3__["default"])(date, baseDate); - - if (isNaN(diff)) { - throw new RangeError('Invalid time value'); - } - - var token; - - if (diff < -6) { - token = 'other'; - } else if (diff < -1) { - token = 'lastWeek'; - } else if (diff < 0) { - token = 'yesterday'; - } else if (diff < 1) { - token = 'today'; - } else if (diff < 2) { - token = 'tomorrow'; - } else if (diff < 7) { - token = 'nextWeek'; - } else { - token = 'other'; - } - - var utcDate = Object(_subMilliseconds_index_js__WEBPACK_IMPORTED_MODULE_5__["default"])(date, Object(_lib_getTimezoneOffsetInMilliseconds_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(date)); - var utcBaseDate = Object(_subMilliseconds_index_js__WEBPACK_IMPORTED_MODULE_5__["default"])(baseDate, Object(_lib_getTimezoneOffsetInMilliseconds_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(baseDate)); - var formatStr = locale.formatRelative(token, utcDate, utcBaseDate, options); - return Object(_format_index_js__WEBPACK_IMPORTED_MODULE_2__["default"])(date, formatStr, options); -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/fromUnixTime/index.js": -/*!*********************************************************!*\ - !*** ./node_modules/date-fns/esm/fromUnixTime/index.js ***! - \*********************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return fromUnixTime; }); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); -/* harmony import */ var _lib_toInteger_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../_lib/toInteger/index.js */ "./node_modules/date-fns/esm/_lib/toInteger/index.js"); - - -/** - * @name fromUnixTime - * @category Timestamp Helpers - * @summary Create a date from a Unix timestamp. - * - * @description - * Create a date from a Unix timestamp. - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Number} unixTime - the given Unix timestamp - * @returns {Date} the date - * @throws {TypeError} 1 argument required - * - * @example - * // Create the date 29 February 2012 11:45:05: - * var result = fromUnixTime(1330515905) - * //=> Wed Feb 29 2012 11:45:05 - */ - -function fromUnixTime(dirtyUnixTime) { - if (arguments.length < 1) { - throw new TypeError('1 argument required, but only ' + arguments.length + ' present'); - } - - var unixTime = Object(_lib_toInteger_index_js__WEBPACK_IMPORTED_MODULE_1__["default"])(dirtyUnixTime); - return Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(unixTime * 1000); -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/getDate/index.js": -/*!****************************************************!*\ - !*** ./node_modules/date-fns/esm/getDate/index.js ***! - \****************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return getDate; }); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); - -/** - * @name getDate - * @category Day Helpers - * @summary Get the day of the month of the given date. - * - * @description - * Get the day of the month of the given date. - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} date - the given date - * @returns {Number} the day of month - * @throws {TypeError} 1 argument required - * - * @example - * // Which day of the month is 29 February 2012? - * var result = getDate(new Date(2012, 1, 29)) - * //=> 29 - */ - -function getDate(dirtyDate) { - if (arguments.length < 1) { - throw new TypeError('1 argument required, but only ' + arguments.length + ' present'); - } - - var date = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDate); - var dayOfMonth = date.getDate(); - return dayOfMonth; -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/getDay/index.js": -/*!***************************************************!*\ - !*** ./node_modules/date-fns/esm/getDay/index.js ***! - \***************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return getDay; }); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); - -/** - * @name getDay - * @category Weekday Helpers - * @summary Get the day of the week of the given date. - * - * @description - * Get the day of the week of the given date. - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} date - the given date - * @returns {Number} the day of week - * @throws {TypeError} 1 argument required - * - * @example - * // Which day of the week is 29 February 2012? - * var result = getDay(new Date(2012, 1, 29)) - * //=> 3 - */ - -function getDay(dirtyDate) { - if (arguments.length < 1) { - throw new TypeError('1 argument required, but only ' + arguments.length + ' present'); - } - - var date = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDate); - var day = date.getDay(); - return day; -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/getDayOfYear/index.js": -/*!*********************************************************!*\ - !*** ./node_modules/date-fns/esm/getDayOfYear/index.js ***! - \*********************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return getDayOfYear; }); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); -/* harmony import */ var _startOfYear_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../startOfYear/index.js */ "./node_modules/date-fns/esm/startOfYear/index.js"); -/* harmony import */ var _differenceInCalendarDays_index_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../differenceInCalendarDays/index.js */ "./node_modules/date-fns/esm/differenceInCalendarDays/index.js"); - - - -/** - * @name getDayOfYear - * @category Day Helpers - * @summary Get the day of the year of the given date. - * - * @description - * Get the day of the year of the given date. - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} date - the given date - * @returns {Number} the day of year - * @throws {TypeError} 1 argument required - * - * @example - * // Which day of the year is 2 July 2014? - * var result = getDayOfYear(new Date(2014, 6, 2)) - * //=> 183 - */ - -function getDayOfYear(dirtyDate) { - if (arguments.length < 1) { - throw new TypeError('1 argument required, but only ' + arguments.length + ' present'); - } - - var date = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDate); - var diff = Object(_differenceInCalendarDays_index_js__WEBPACK_IMPORTED_MODULE_2__["default"])(date, Object(_startOfYear_index_js__WEBPACK_IMPORTED_MODULE_1__["default"])(date)); - var dayOfYear = diff + 1; - return dayOfYear; -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/getDaysInMonth/index.js": -/*!***********************************************************!*\ - !*** ./node_modules/date-fns/esm/getDaysInMonth/index.js ***! - \***********************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return getDaysInMonth; }); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); - -/** - * @name getDaysInMonth - * @category Month Helpers - * @summary Get the number of days in a month of the given date. - * - * @description - * Get the number of days in a month of the given date. - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} date - the given date - * @returns {Number} the number of days in a month - * @throws {TypeError} 1 argument required - * - * @example - * // How many days are in February 2000? - * var result = getDaysInMonth(new Date(2000, 1)) - * //=> 29 - */ - -function getDaysInMonth(dirtyDate) { - if (arguments.length < 1) { - throw new TypeError('1 argument required, but only ' + arguments.length + ' present'); - } - - var date = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDate); - var year = date.getFullYear(); - var monthIndex = date.getMonth(); - var lastDayOfMonth = new Date(0); - lastDayOfMonth.setFullYear(year, monthIndex + 1, 0); - lastDayOfMonth.setHours(0, 0, 0, 0); - return lastDayOfMonth.getDate(); -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/getDaysInYear/index.js": -/*!**********************************************************!*\ - !*** ./node_modules/date-fns/esm/getDaysInYear/index.js ***! - \**********************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return getDaysInYear; }); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); -/* harmony import */ var _isLeapYear_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../isLeapYear/index.js */ "./node_modules/date-fns/esm/isLeapYear/index.js"); - - -/** - * @name getDaysInYear - * @category Year Helpers - * @summary Get the number of days in a year of the given date. - * - * @description - * Get the number of days in a year of the given date. - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} date - the given date - * @returns {Number} the number of days in a year - * @throws {TypeError} 1 argument required - * - * @example - * // How many days are in 2012? - * var result = getDaysInYear(new Date(2012, 0, 1)) - * //=> 366 - */ - -function getDaysInYear(dirtyDate) { - if (arguments.length < 1) { - throw new TypeError('1 argument required, but only ' + arguments.length + ' present'); - } - - var date = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDate); - - if (isNaN(date)) { - return NaN; - } - - return Object(_isLeapYear_index_js__WEBPACK_IMPORTED_MODULE_1__["default"])(date) ? 366 : 365; -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/getDecade/index.js": -/*!******************************************************!*\ - !*** ./node_modules/date-fns/esm/getDecade/index.js ***! - \******************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return getDecade; }); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); - -/** - * @name getDecade - * @category Decade Helpers - * @summary Get the decade of the given date. - * - * @description - * Get the decade of the given date. - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} date - the given date - * @returns {Number} the year of decade - * @throws {TypeError} 1 argument required - * - * @example - * // Which decade belongs 27 November 1942? - * var result = getDecade(new Date(1942, 10, 27)) - * //=> 1940 - */ - -function getDecade(dirtyDate) { - if (arguments.length < 1) { - throw new TypeError('1 argument required, but only ' + arguments.length + ' present'); - } - - var date = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDate); - var year = date.getFullYear(); - var decade = Math.floor(year / 10) * 10; - return decade; -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/getHours/index.js": -/*!*****************************************************!*\ - !*** ./node_modules/date-fns/esm/getHours/index.js ***! - \*****************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return getHours; }); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); - -/** - * @name getHours - * @category Hour Helpers - * @summary Get the hours of the given date. - * - * @description - * Get the hours of the given date. - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} date - the given date - * @returns {Number} the hours - * @throws {TypeError} 1 argument required - * - * @example - * // Get the hours of 29 February 2012 11:45:00: - * var result = getHours(new Date(2012, 1, 29, 11, 45)) - * //=> 11 - */ - -function getHours(dirtyDate) { - if (arguments.length < 1) { - throw new TypeError('1 argument required, but only ' + arguments.length + ' present'); - } - - var date = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDate); - var hours = date.getHours(); - return hours; -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/getISODay/index.js": -/*!******************************************************!*\ - !*** ./node_modules/date-fns/esm/getISODay/index.js ***! - \******************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return getISODay; }); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); - -/** - * @name getISODay - * @category Weekday Helpers - * @summary Get the day of the ISO week of the given date. - * - * @description - * Get the day of the ISO week of the given date, - * which is 7 for Sunday, 1 for Monday etc. - * - * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} date - the given date - * @returns {Number} the day of ISO week - * @throws {TypeError} 1 argument required - * - * @example - * // Which day of the ISO week is 26 February 2012? - * var result = getISODay(new Date(2012, 1, 26)) - * //=> 7 - */ - -function getISODay(dirtyDate) { - if (arguments.length < 1) { - throw new TypeError('1 argument required, but only ' + arguments.length + ' present'); - } - - var date = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDate); - var day = date.getDay(); - - if (day === 0) { - day = 7; - } - - return day; -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/getISOWeek/index.js": -/*!*******************************************************!*\ - !*** ./node_modules/date-fns/esm/getISOWeek/index.js ***! - \*******************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return getISOWeek; }); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); -/* harmony import */ var _startOfISOWeek_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../startOfISOWeek/index.js */ "./node_modules/date-fns/esm/startOfISOWeek/index.js"); -/* harmony import */ var _startOfISOWeekYear_index_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../startOfISOWeekYear/index.js */ "./node_modules/date-fns/esm/startOfISOWeekYear/index.js"); - - - -var MILLISECONDS_IN_WEEK = 604800000; -/** - * @name getISOWeek - * @category ISO Week Helpers - * @summary Get the ISO week of the given date. - * - * @description - * Get the ISO week of the given date. - * - * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} date - the given date - * @returns {Number} the ISO week - * @throws {TypeError} 1 argument required - * - * @example - * // Which week of the ISO-week numbering year is 2 January 2005? - * var result = getISOWeek(new Date(2005, 0, 2)) - * //=> 53 - */ - -function getISOWeek(dirtyDate) { - if (arguments.length < 1) { - throw new TypeError('1 argument required, but only ' + arguments.length + ' present'); - } - - var date = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDate); - var diff = Object(_startOfISOWeek_index_js__WEBPACK_IMPORTED_MODULE_1__["default"])(date).getTime() - Object(_startOfISOWeekYear_index_js__WEBPACK_IMPORTED_MODULE_2__["default"])(date).getTime(); // Round the number of days to the nearest integer - // because the number of milliseconds in a week is not constant - // (e.g. it's different in the week of the daylight saving time clock shift) - - return Math.round(diff / MILLISECONDS_IN_WEEK) + 1; -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/getISOWeekYear/index.js": -/*!***********************************************************!*\ - !*** ./node_modules/date-fns/esm/getISOWeekYear/index.js ***! - \***********************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return getISOWeekYear; }); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); -/* harmony import */ var _startOfISOWeek_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../startOfISOWeek/index.js */ "./node_modules/date-fns/esm/startOfISOWeek/index.js"); - - -/** - * @name getISOWeekYear - * @category ISO Week-Numbering Year Helpers - * @summary Get the ISO week-numbering year of the given date. - * - * @description - * Get the ISO week-numbering year of the given date, - * which always starts 3 days before the year's first Thursday. - * - * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * - The function was renamed from `getISOYear` to `getISOWeekYear`. - * "ISO week year" is short for [ISO week-numbering year](https://en.wikipedia.org/wiki/ISO_week_date). - * This change makes the name consistent with - * locale-dependent week-numbering year helpers, e.g., `getWeekYear`. - * - * @param {Date|Number} date - the given date - * @returns {Number} the ISO week-numbering year - * @throws {TypeError} 1 argument required - * - * @example - * // Which ISO-week numbering year is 2 January 2005? - * var result = getISOWeekYear(new Date(2005, 0, 2)) - * //=> 2004 - */ - -function getISOWeekYear(dirtyDate) { - if (arguments.length < 1) { - throw new TypeError('1 argument required, but only ' + arguments.length + ' present'); - } - - var date = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDate); - var year = date.getFullYear(); - var fourthOfJanuaryOfNextYear = new Date(0); - fourthOfJanuaryOfNextYear.setFullYear(year + 1, 0, 4); - fourthOfJanuaryOfNextYear.setHours(0, 0, 0, 0); - var startOfNextYear = Object(_startOfISOWeek_index_js__WEBPACK_IMPORTED_MODULE_1__["default"])(fourthOfJanuaryOfNextYear); - var fourthOfJanuaryOfThisYear = new Date(0); - fourthOfJanuaryOfThisYear.setFullYear(year, 0, 4); - fourthOfJanuaryOfThisYear.setHours(0, 0, 0, 0); - var startOfThisYear = Object(_startOfISOWeek_index_js__WEBPACK_IMPORTED_MODULE_1__["default"])(fourthOfJanuaryOfThisYear); - - if (date.getTime() >= startOfNextYear.getTime()) { - return year + 1; - } else if (date.getTime() >= startOfThisYear.getTime()) { - return year; - } else { - return year - 1; - } -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/getISOWeeksInYear/index.js": -/*!**************************************************************!*\ - !*** ./node_modules/date-fns/esm/getISOWeeksInYear/index.js ***! - \**************************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return getISOWeeksInYear; }); -/* harmony import */ var _startOfISOWeekYear_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../startOfISOWeekYear/index.js */ "./node_modules/date-fns/esm/startOfISOWeekYear/index.js"); -/* harmony import */ var _addWeeks_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../addWeeks/index.js */ "./node_modules/date-fns/esm/addWeeks/index.js"); - - -var MILLISECONDS_IN_WEEK = 604800000; -/** - * @name getISOWeeksInYear - * @category ISO Week-Numbering Year Helpers - * @summary Get the number of weeks in an ISO week-numbering year of the given date. - * - * @description - * Get the number of weeks in an ISO week-numbering year of the given date. - * - * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} date - the given date - * @returns {Number} the number of ISO weeks in a year - * @throws {TypeError} 1 argument required - * - * @example - * // How many weeks are in ISO week-numbering year 2015? - * var result = getISOWeeksInYear(new Date(2015, 1, 11)) - * //=> 53 - */ - -function getISOWeeksInYear(dirtyDate) { - if (arguments.length < 1) { - throw new TypeError('1 argument required, but only ' + arguments.length + ' present'); - } - - var thisYear = Object(_startOfISOWeekYear_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDate); - var nextYear = Object(_startOfISOWeekYear_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(Object(_addWeeks_index_js__WEBPACK_IMPORTED_MODULE_1__["default"])(thisYear, 60)); - var diff = nextYear.valueOf() - thisYear.valueOf(); // Round the number of weeks to the nearest integer - // because the number of milliseconds in a week is not constant - // (e.g. it's different in the week of the daylight saving time clock shift) - - return Math.round(diff / MILLISECONDS_IN_WEEK); -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/getMilliseconds/index.js": -/*!************************************************************!*\ - !*** ./node_modules/date-fns/esm/getMilliseconds/index.js ***! - \************************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return getMilliseconds; }); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); - -/** - * @name getMilliseconds - * @category Millisecond Helpers - * @summary Get the milliseconds of the given date. - * - * @description - * Get the milliseconds of the given date. - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} date - the given date - * @returns {Number} the milliseconds - * @throws {TypeError} 1 argument required - * - * @example - * // Get the milliseconds of 29 February 2012 11:45:05.123: - * var result = getMilliseconds(new Date(2012, 1, 29, 11, 45, 5, 123)) - * //=> 123 - */ - -function getMilliseconds(dirtyDate) { - if (arguments.length < 1) { - throw new TypeError('1 argument required, but only ' + arguments.length + ' present'); - } - - var date = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDate); - var milliseconds = date.getMilliseconds(); - return milliseconds; -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/getMinutes/index.js": -/*!*******************************************************!*\ - !*** ./node_modules/date-fns/esm/getMinutes/index.js ***! - \*******************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return getMinutes; }); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); - -/** - * @name getMinutes - * @category Minute Helpers - * @summary Get the minutes of the given date. - * - * @description - * Get the minutes of the given date. - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} date - the given date - * @returns {Number} the minutes - * @throws {TypeError} 1 argument required - * - * @example - * // Get the minutes of 29 February 2012 11:45:05: - * var result = getMinutes(new Date(2012, 1, 29, 11, 45, 5)) - * //=> 45 - */ - -function getMinutes(dirtyDate) { - if (arguments.length < 1) { - throw new TypeError('1 argument required, but only ' + arguments.length + ' present'); - } - - var date = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDate); - var minutes = date.getMinutes(); - return minutes; -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/getMonth/index.js": -/*!*****************************************************!*\ - !*** ./node_modules/date-fns/esm/getMonth/index.js ***! - \*****************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return getMonth; }); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); - -/** - * @name getMonth - * @category Month Helpers - * @summary Get the month of the given date. - * - * @description - * Get the month of the given date. - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} date - the given date - * @returns {Number} the month - * @throws {TypeError} 1 argument required - * - * @example - * // Which month is 29 February 2012? - * var result = getMonth(new Date(2012, 1, 29)) - * //=> 1 - */ - -function getMonth(dirtyDate) { - if (arguments.length < 1) { - throw new TypeError('1 argument required, but only ' + arguments.length + ' present'); - } - - var date = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDate); - var month = date.getMonth(); - return month; -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/getOverlappingDaysInIntervals/index.js": -/*!**************************************************************************!*\ - !*** ./node_modules/date-fns/esm/getOverlappingDaysInIntervals/index.js ***! - \**************************************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return getOverlappingDaysInIntervals; }); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); - -var MILLISECONDS_IN_DAY = 24 * 60 * 60 * 1000; -/** - * @name getOverlappingDaysInIntervals - * @category Interval Helpers - * @summary Get the number of days that overlap in two time intervals - * - * @description - * Get the number of days that overlap in two time intervals - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * - The function was renamed from `getOverlappingDaysInRanges` to `getOverlappingDaysInIntervals`. - * This change was made to mirror the use of the word "interval" in standard ISO 8601:2004 terminology: - * - * ``` - * 2.1.3 - * time interval - * part of the time axis limited by two instants - * ``` - * - * Also, this function now accepts an object with `start` and `end` properties - * instead of two arguments as an interval. - * This function now throws `RangeError` if the start of the interval is after its end - * or if any date in the interval is `Invalid Date`. - * - * ```javascript - * // Before v2.0.0 - * - * getOverlappingDaysInRanges( - * new Date(2014, 0, 10), new Date(2014, 0, 20), - * new Date(2014, 0, 17), new Date(2014, 0, 21) - * ) - * - * // v2.0.0 onward - * - * getOverlappingDaysInIntervals( - * { start: new Date(2014, 0, 10), end: new Date(2014, 0, 20) }, - * { start: new Date(2014, 0, 17), end: new Date(2014, 0, 21) } - * ) - * ``` - * - * @param {Interval} intervalLeft - the first interval to compare. See [Interval]{@link docs/Interval} - * @param {Interval} intervalRight - the second interval to compare. See [Interval]{@link docs/Interval} - * @returns {Number} the number of days that overlap in two time intervals - * @throws {TypeError} 2 arguments required - * @throws {RangeError} The start of an interval cannot be after its end - * @throws {RangeError} Date in interval cannot be `Invalid Date` - * - * @example - * // For overlapping time intervals adds 1 for each started overlapping day: - * getOverlappingDaysInIntervals( - * { start: new Date(2014, 0, 10), end: new Date(2014, 0, 20) }, - * { start: new Date(2014, 0, 17), end: new Date(2014, 0, 21) } - * ) - * //=> 3 - * - * @example - * // For non-overlapping time intervals returns 0: - * getOverlappingDaysInIntervals( - * { start: new Date(2014, 0, 10), end: new Date(2014, 0, 20) }, - * { start: new Date(2014, 0, 21), end: new Date(2014, 0, 22) } - * ) - * //=> 0 - */ - -function getOverlappingDaysInIntervals(dirtyIntervalLeft, dirtyIntervalRight) { - if (arguments.length < 2) { - throw new TypeError('2 arguments required, but only ' + arguments.length + ' present'); - } - - var intervalLeft = dirtyIntervalLeft || {}; - var intervalRight = dirtyIntervalRight || {}; - var leftStartTime = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(intervalLeft.start).getTime(); - var leftEndTime = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(intervalLeft.end).getTime(); - var rightStartTime = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(intervalRight.start).getTime(); - var rightEndTime = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(intervalRight.end).getTime(); // Throw an exception if start date is after end date or if any date is `Invalid Date` - - if (!(leftStartTime <= leftEndTime && rightStartTime <= rightEndTime)) { - throw new RangeError('Invalid interval'); - } - - var isOverlapping = leftStartTime < rightEndTime && rightStartTime < leftEndTime; - - if (!isOverlapping) { - return 0; - } - - var overlapStartDate = rightStartTime < leftStartTime ? leftStartTime : rightStartTime; - var overlapEndDate = rightEndTime > leftEndTime ? leftEndTime : rightEndTime; - var differenceInMs = overlapEndDate - overlapStartDate; - return Math.ceil(differenceInMs / MILLISECONDS_IN_DAY); -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/getQuarter/index.js": -/*!*******************************************************!*\ - !*** ./node_modules/date-fns/esm/getQuarter/index.js ***! - \*******************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return getQuarter; }); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); - -/** - * @name getQuarter - * @category Quarter Helpers - * @summary Get the year quarter of the given date. - * - * @description - * Get the year quarter of the given date. - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} date - the given date - * @returns {Number} the quarter - * @throws {TypeError} 1 argument required - * - * @example - * // Which quarter is 2 July 2014? - * var result = getQuarter(new Date(2014, 6, 2)) - * //=> 3 - */ - -function getQuarter(dirtyDate) { - if (arguments.length < 1) { - throw new TypeError('1 argument required, but only ' + arguments.length + ' present'); - } - - var date = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDate); - var quarter = Math.floor(date.getMonth() / 3) + 1; - return quarter; -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/getSeconds/index.js": -/*!*******************************************************!*\ - !*** ./node_modules/date-fns/esm/getSeconds/index.js ***! - \*******************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return getSeconds; }); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); - -/** - * @name getSeconds - * @category Second Helpers - * @summary Get the seconds of the given date. - * - * @description - * Get the seconds of the given date. - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} date - the given date - * @returns {Number} the seconds - * @throws {TypeError} 1 argument required - * - * @example - * // Get the seconds of 29 February 2012 11:45:05.123: - * var result = getSeconds(new Date(2012, 1, 29, 11, 45, 5, 123)) - * //=> 5 - */ - -function getSeconds(dirtyDate) { - if (arguments.length < 1) { - throw new TypeError('1 argument required, but only ' + arguments.length + ' present'); - } - - var date = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDate); - var seconds = date.getSeconds(); - return seconds; -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/getTime/index.js": -/*!****************************************************!*\ - !*** ./node_modules/date-fns/esm/getTime/index.js ***! - \****************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return getTime; }); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); - -/** - * @name getTime - * @category Timestamp Helpers - * @summary Get the milliseconds timestamp of the given date. - * - * @description - * Get the milliseconds timestamp of the given date. - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} date - the given date - * @returns {Number} the timestamp - * @throws {TypeError} 1 argument required - * - * @example - * // Get the timestamp of 29 February 2012 11:45:05.123: - * var result = getTime(new Date(2012, 1, 29, 11, 45, 5, 123)) - * //=> 1330515905123 - */ - -function getTime(dirtyDate) { - if (arguments.length < 1) { - throw new TypeError('1 argument required, but only ' + arguments.length + ' present'); - } - - var date = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDate); - var timestamp = date.getTime(); - return timestamp; -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/getUnixTime/index.js": -/*!********************************************************!*\ - !*** ./node_modules/date-fns/esm/getUnixTime/index.js ***! - \********************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return getUnixTime; }); -/* harmony import */ var _getTime_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../getTime/index.js */ "./node_modules/date-fns/esm/getTime/index.js"); - -/** - * @name getUnixTime - * @category Timestamp Helpers - * @summary Get the seconds timestamp of the given date. - * - * @description - * Get the seconds timestamp of the given date. - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} date - the given date - * @returns {Number} the timestamp - * @throws {TypeError} 1 argument required - * - * @example - * // Get the timestamp of 29 February 2012 11:45:05 CET: - * var result = getUnixTime(new Date(2012, 1, 29, 11, 45, 5)) - * //=> 1330512305 - */ - -function getUnixTime(dirtyDate) { - if (arguments.length < 1) { - throw new TypeError('1 argument required, but only ' + arguments.length + ' present'); - } - - return Math.floor(Object(_getTime_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDate) / 1000); -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/getWeek/index.js": -/*!****************************************************!*\ - !*** ./node_modules/date-fns/esm/getWeek/index.js ***! - \****************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return getWeek; }); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); -/* harmony import */ var _startOfWeek_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../startOfWeek/index.js */ "./node_modules/date-fns/esm/startOfWeek/index.js"); -/* harmony import */ var _startOfWeekYear_index_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../startOfWeekYear/index.js */ "./node_modules/date-fns/esm/startOfWeekYear/index.js"); - - - -var MILLISECONDS_IN_WEEK = 604800000; -/** - * @name getWeek - * @category Week Helpers - * @summary Get the local week index of the given date. - * - * @description - * Get the local week index of the given date. - * The exact calculation depends on the values of - * `options.weekStartsOn` (which is the index of the first day of the week) - * and `options.firstWeekContainsDate` (which is the day of January, which is always in - * the first week of the week-numbering year) - * - * Week numbering: https://en.wikipedia.org/wiki/Week#Week_numbering - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} date - the given date - * @param {Object} [options] - an object with options. - * @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday) - * @param {1|2|3|4|5|6|7} [options.firstWeekContainsDate=1] - the day of January, which is always in the first week of the year - * @returns {Number} the week - * @throws {TypeError} 1 argument required - * @throws {RangeError} `options.weekStartsOn` must be between 0 and 6 - * @throws {RangeError} `options.firstWeekContainsDate` must be between 1 and 7 - * - * @example - * // Which week of the local week numbering year is 2 January 2005 with default options? - * var result = getISOWeek(new Date(2005, 0, 2)) - * //=> 2 - * - * // Which week of the local week numbering year is 2 January 2005, - * // if Monday is the first day of the week, - * // and the first week of the year always contains 4 January? - * var result = getISOWeek(new Date(2005, 0, 2), { - * weekStartsOn: 1, - * firstWeekContainsDate: 4 - * }) - * //=> 53 - */ - -function getWeek(dirtyDate, options) { - if (arguments.length < 1) { - throw new TypeError('1 argument required, but only ' + arguments.length + ' present'); - } - - var date = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDate); - var diff = Object(_startOfWeek_index_js__WEBPACK_IMPORTED_MODULE_1__["default"])(date, options).getTime() - Object(_startOfWeekYear_index_js__WEBPACK_IMPORTED_MODULE_2__["default"])(date, options).getTime(); // Round the number of days to the nearest integer - // because the number of milliseconds in a week is not constant - // (e.g. it's different in the week of the daylight saving time clock shift) - - return Math.round(diff / MILLISECONDS_IN_WEEK) + 1; -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/getWeekOfMonth/index.js": -/*!***********************************************************!*\ - !*** ./node_modules/date-fns/esm/getWeekOfMonth/index.js ***! - \***********************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return getWeekOfMonth; }); -/* harmony import */ var _lib_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../_lib/toInteger/index.js */ "./node_modules/date-fns/esm/_lib/toInteger/index.js"); -/* harmony import */ var _getDate_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../getDate/index.js */ "./node_modules/date-fns/esm/getDate/index.js"); -/* harmony import */ var _startOfMonth_index_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../startOfMonth/index.js */ "./node_modules/date-fns/esm/startOfMonth/index.js"); -/* harmony import */ var _getDay_index_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../getDay/index.js */ "./node_modules/date-fns/esm/getDay/index.js"); - - - - -/** - * @name getWeekOfMonth - * @category Week Helpers - * @summary Get the week of the month of the given date. - * - * @description - * Get the week of the month of the given date. - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} date - the given date - * @param {Object} [options] - an object with options. - * @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday) - * @returns {Number} the week of month - * @throws {TypeError} 1 argument required - * @throws {RangeError} `options.weekStartsOn` must be between 0 and 6 - * - * @example - * // Which week of the month is 9 November 2017? - * var result = getWeekOfMonth(new Date(2017, 10, 9)) - * //=> 2 - */ - -function getWeekOfMonth(date, dirtyOptions) { - if (arguments.length < 1) { - throw new TypeError('1 argument required, but only ' + arguments.length + ' present'); - } - - var options = dirtyOptions || {}; - var locale = options.locale; - var localeWeekStartsOn = locale && locale.options && locale.options.weekStartsOn; - var defaultWeekStartsOn = localeWeekStartsOn == null ? 0 : Object(_lib_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(localeWeekStartsOn); - var weekStartsOn = options.weekStartsOn == null ? defaultWeekStartsOn : Object(_lib_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(options.weekStartsOn); // Test if weekStartsOn is between 0 and 6 _and_ is not NaN - - if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) { - throw new RangeError('weekStartsOn must be between 0 and 6 inclusively'); - } - - var startWeekDay = Object(_getDay_index_js__WEBPACK_IMPORTED_MODULE_3__["default"])(Object(_startOfMonth_index_js__WEBPACK_IMPORTED_MODULE_2__["default"])(date)); - var currentWeekDay = Object(_getDay_index_js__WEBPACK_IMPORTED_MODULE_3__["default"])(date); - var startWeekDayWithOptions = startWeekDay < weekStartsOn ? 7 - weekStartsOn : startWeekDay; - var diff = startWeekDayWithOptions > currentWeekDay ? 7 - weekStartsOn : 0; - return Math.ceil((Object(_getDate_index_js__WEBPACK_IMPORTED_MODULE_1__["default"])(date) + diff) / 7); -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/getWeekYear/index.js": -/*!********************************************************!*\ - !*** ./node_modules/date-fns/esm/getWeekYear/index.js ***! - \********************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return getWeekYear; }); -/* harmony import */ var _lib_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../_lib/toInteger/index.js */ "./node_modules/date-fns/esm/_lib/toInteger/index.js"); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); -/* harmony import */ var _startOfWeek_index_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../startOfWeek/index.js */ "./node_modules/date-fns/esm/startOfWeek/index.js"); - - - -/** - * @name getWeekYear - * @category Week-Numbering Year Helpers - * @summary Get the local week-numbering year of the given date. - * - * @description - * Get the local week-numbering year of the given date. - * The exact calculation depends on the values of - * `options.weekStartsOn` (which is the index of the first day of the week) - * and `options.firstWeekContainsDate` (which is the day of January, which is always in - * the first week of the week-numbering year) - * - * Week numbering: https://en.wikipedia.org/wiki/Week#Week_numbering - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} date - the given date - * @param {Object} [options] - an object with options. - * @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday) - * @param {1|2|3|4|5|6|7} [options.firstWeekContainsDate=1] - the day of January, which is always in the first week of the year - * @returns {Number} the local week-numbering year - * @throws {TypeError} 1 argument required - * @throws {RangeError} `options.weekStartsOn` must be between 0 and 6 - * @throws {RangeError} `options.firstWeekContainsDate` must be between 1 and 7 - * - * @example - * // Which week numbering year is 26 December 2004 with the default settings? - * var result = getWeekYear(new Date(2004, 11, 26)) - * //=> 2005 - * - * @example - * // Which week numbering year is 26 December 2004 if week starts on Saturday? - * var result = getWeekYear(new Date(2004, 11, 26), { weekStartsOn: 6 }) - * //=> 2004 - * - * @example - * // Which week numbering year is 26 December 2004 if the first week contains 4 January? - * var result = getWeekYear(new Date(2004, 11, 26), { firstWeekContainsDate: 4 }) - * //=> 2004 - */ - -function getWeekYear(dirtyDate, dirtyOptions) { - if (arguments.length < 1) { - throw new TypeError('1 argument required, but only ' + arguments.length + ' present'); - } - - var date = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_1__["default"])(dirtyDate); - var year = date.getFullYear(); - var options = dirtyOptions || {}; - var locale = options.locale; - var localeFirstWeekContainsDate = locale && locale.options && locale.options.firstWeekContainsDate; - var defaultFirstWeekContainsDate = localeFirstWeekContainsDate == null ? 1 : Object(_lib_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(localeFirstWeekContainsDate); - var firstWeekContainsDate = options.firstWeekContainsDate == null ? defaultFirstWeekContainsDate : Object(_lib_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(options.firstWeekContainsDate); // Test if weekStartsOn is between 1 and 7 _and_ is not NaN - - if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) { - throw new RangeError('firstWeekContainsDate must be between 1 and 7 inclusively'); - } - - var firstWeekOfNextYear = new Date(0); - firstWeekOfNextYear.setFullYear(year + 1, 0, firstWeekContainsDate); - firstWeekOfNextYear.setHours(0, 0, 0, 0); - var startOfNextYear = Object(_startOfWeek_index_js__WEBPACK_IMPORTED_MODULE_2__["default"])(firstWeekOfNextYear, dirtyOptions); - var firstWeekOfThisYear = new Date(0); - firstWeekOfThisYear.setFullYear(year, 0, firstWeekContainsDate); - firstWeekOfThisYear.setHours(0, 0, 0, 0); - var startOfThisYear = Object(_startOfWeek_index_js__WEBPACK_IMPORTED_MODULE_2__["default"])(firstWeekOfThisYear, dirtyOptions); - - if (date.getTime() >= startOfNextYear.getTime()) { - return year + 1; - } else if (date.getTime() >= startOfThisYear.getTime()) { - return year; - } else { - return year - 1; - } -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/getWeeksInMonth/index.js": -/*!************************************************************!*\ - !*** ./node_modules/date-fns/esm/getWeeksInMonth/index.js ***! - \************************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return getWeeksInMonth; }); -/* harmony import */ var _differenceInCalendarWeeks_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../differenceInCalendarWeeks/index.js */ "./node_modules/date-fns/esm/differenceInCalendarWeeks/index.js"); -/* harmony import */ var _lastDayOfMonth_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../lastDayOfMonth/index.js */ "./node_modules/date-fns/esm/lastDayOfMonth/index.js"); -/* harmony import */ var _startOfMonth_index_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../startOfMonth/index.js */ "./node_modules/date-fns/esm/startOfMonth/index.js"); - - - -/** - * @name getWeeksInMonth - * @category Week Helpers - * @summary Get the number of calendar weeks a month spans. - * - * @description - * Get the number of calendar weeks the month in the given date spans. - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} date - the given date - * @param {Object} [options] - an object with options. - * @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday) - * @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale} - * @returns {Number} the number of calendar weeks - * @throws {TypeError} 2 arguments required - * @throws {RangeError} `options.weekStartsOn` must be between 0 and 6 - * - * @example - * // How many calendar weeks does February 2015 span? - * var result = getWeeksInMonth(new Date(2015, 1, 8)) - * //=> 4 - * - * @example - * // If the week starts on Monday, - * // how many calendar weeks does July 2017 span? - * var result = getWeeksInMonth(new Date(2017, 6, 5), { weekStartsOn: 1 }) - * //=> 6 - */ - -function getWeeksInMonth(date, options) { - if (arguments.length < 1) { - throw new TypeError('1 argument required, but only ' + arguments.length + ' present'); - } - - return Object(_differenceInCalendarWeeks_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(Object(_lastDayOfMonth_index_js__WEBPACK_IMPORTED_MODULE_1__["default"])(date), Object(_startOfMonth_index_js__WEBPACK_IMPORTED_MODULE_2__["default"])(date), options) + 1; -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/getYear/index.js": -/*!****************************************************!*\ - !*** ./node_modules/date-fns/esm/getYear/index.js ***! - \****************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return getYear; }); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); - -/** - * @name getYear - * @category Year Helpers - * @summary Get the year of the given date. - * - * @description - * Get the year of the given date. - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} date - the given date - * @returns {Number} the year - * @throws {TypeError} 1 argument required - * - * @example - * // Which year is 2 July 2014? - * var result = getYear(new Date(2014, 6, 2)) - * //=> 2014 - */ - -function getYear(dirtyDate) { - if (arguments.length < 1) { - throw new TypeError('1 argument required, but only ' + arguments.length + ' present'); - } - - var date = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDate); - var year = date.getFullYear(); - return year; -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/index.js": -/*!********************************************!*\ - !*** ./node_modules/date-fns/esm/index.js ***! - \********************************************/ -/*! exports provided: addDays, addHours, addISOWeekYears, addMilliseconds, addMinutes, addMonths, addQuarters, addSeconds, addWeeks, addYears, areIntervalsOverlapping, closestIndexTo, closestTo, compareAsc, compareDesc, differenceInCalendarDays, differenceInCalendarISOWeekYears, differenceInCalendarISOWeeks, differenceInCalendarMonths, differenceInCalendarQuarters, differenceInCalendarWeeks, differenceInCalendarYears, differenceInDays, differenceInHours, differenceInISOWeekYears, differenceInMilliseconds, differenceInMinutes, differenceInMonths, differenceInQuarters, differenceInSeconds, differenceInWeeks, differenceInYears, eachDayOfInterval, eachWeekOfInterval, eachWeekendOfInterval, eachWeekendOfMonth, eachWeekendOfYear, endOfDay, endOfDecade, endOfHour, endOfISOWeek, endOfISOWeekYear, endOfMinute, endOfMonth, endOfQuarter, endOfSecond, endOfWeek, endOfYear, format, formatDistance, formatDistanceStrict, formatRelative, fromUnixTime, getDate, getDay, getDayOfYear, getDaysInMonth, getDaysInYear, getDecade, getHours, getISODay, getISOWeek, getISOWeekYear, getISOWeeksInYear, getMilliseconds, getMinutes, getMonth, getOverlappingDaysInIntervals, getQuarter, getSeconds, getTime, getUnixTime, getWeek, getWeekOfMonth, getWeekYear, getWeeksInMonth, getYear, isAfter, isBefore, isDate, isEqual, isFirstDayOfMonth, isFriday, isLastDayOfMonth, isLeapYear, isMonday, isSameDay, isSameHour, isSameISOWeek, isSameISOWeekYear, isSameMinute, isSameMonth, isSameQuarter, isSameSecond, isSameWeek, isSameYear, isSaturday, isSunday, isThursday, isTuesday, isValid, isWednesday, isWeekend, isWithinInterval, lastDayOfDecade, lastDayOfISOWeek, lastDayOfISOWeekYear, lastDayOfMonth, lastDayOfQuarter, lastDayOfWeek, lastDayOfYear, lightFormat, max, min, parse, parseISO, roundToNearestMinutes, setDate, setDay, setDayOfYear, setHours, setISODay, setISOWeek, setISOWeekYear, setMilliseconds, setMinutes, setMonth, setQuarter, setSeconds, setWeek, setWeekYear, setYear, startOfDay, startOfDecade, startOfHour, startOfISOWeek, startOfISOWeekYear, startOfMinute, startOfMonth, startOfQuarter, startOfSecond, startOfWeek, startOfWeekYear, startOfYear, subDays, subHours, subISOWeekYears, subMilliseconds, subMinutes, subMonths, subQuarters, subSeconds, subWeeks, subYears, toDate */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var _addDays_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./addDays/index.js */ "./node_modules/date-fns/esm/addDays/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "addDays", function() { return _addDays_index_js__WEBPACK_IMPORTED_MODULE_0__["default"]; }); - -/* harmony import */ var _addHours_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./addHours/index.js */ "./node_modules/date-fns/esm/addHours/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "addHours", function() { return _addHours_index_js__WEBPACK_IMPORTED_MODULE_1__["default"]; }); - -/* harmony import */ var _addISOWeekYears_index_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./addISOWeekYears/index.js */ "./node_modules/date-fns/esm/addISOWeekYears/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "addISOWeekYears", function() { return _addISOWeekYears_index_js__WEBPACK_IMPORTED_MODULE_2__["default"]; }); - -/* harmony import */ var _addMilliseconds_index_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./addMilliseconds/index.js */ "./node_modules/date-fns/esm/addMilliseconds/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "addMilliseconds", function() { return _addMilliseconds_index_js__WEBPACK_IMPORTED_MODULE_3__["default"]; }); - -/* harmony import */ var _addMinutes_index_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./addMinutes/index.js */ "./node_modules/date-fns/esm/addMinutes/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "addMinutes", function() { return _addMinutes_index_js__WEBPACK_IMPORTED_MODULE_4__["default"]; }); - -/* harmony import */ var _addMonths_index_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./addMonths/index.js */ "./node_modules/date-fns/esm/addMonths/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "addMonths", function() { return _addMonths_index_js__WEBPACK_IMPORTED_MODULE_5__["default"]; }); - -/* harmony import */ var _addQuarters_index_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./addQuarters/index.js */ "./node_modules/date-fns/esm/addQuarters/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "addQuarters", function() { return _addQuarters_index_js__WEBPACK_IMPORTED_MODULE_6__["default"]; }); - -/* harmony import */ var _addSeconds_index_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./addSeconds/index.js */ "./node_modules/date-fns/esm/addSeconds/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "addSeconds", function() { return _addSeconds_index_js__WEBPACK_IMPORTED_MODULE_7__["default"]; }); - -/* harmony import */ var _addWeeks_index_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./addWeeks/index.js */ "./node_modules/date-fns/esm/addWeeks/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "addWeeks", function() { return _addWeeks_index_js__WEBPACK_IMPORTED_MODULE_8__["default"]; }); - -/* harmony import */ var _addYears_index_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./addYears/index.js */ "./node_modules/date-fns/esm/addYears/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "addYears", function() { return _addYears_index_js__WEBPACK_IMPORTED_MODULE_9__["default"]; }); - -/* harmony import */ var _areIntervalsOverlapping_index_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./areIntervalsOverlapping/index.js */ "./node_modules/date-fns/esm/areIntervalsOverlapping/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "areIntervalsOverlapping", function() { return _areIntervalsOverlapping_index_js__WEBPACK_IMPORTED_MODULE_10__["default"]; }); - -/* harmony import */ var _closestIndexTo_index_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./closestIndexTo/index.js */ "./node_modules/date-fns/esm/closestIndexTo/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "closestIndexTo", function() { return _closestIndexTo_index_js__WEBPACK_IMPORTED_MODULE_11__["default"]; }); - -/* harmony import */ var _closestTo_index_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./closestTo/index.js */ "./node_modules/date-fns/esm/closestTo/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "closestTo", function() { return _closestTo_index_js__WEBPACK_IMPORTED_MODULE_12__["default"]; }); - -/* harmony import */ var _compareAsc_index_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./compareAsc/index.js */ "./node_modules/date-fns/esm/compareAsc/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "compareAsc", function() { return _compareAsc_index_js__WEBPACK_IMPORTED_MODULE_13__["default"]; }); - -/* harmony import */ var _compareDesc_index_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./compareDesc/index.js */ "./node_modules/date-fns/esm/compareDesc/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "compareDesc", function() { return _compareDesc_index_js__WEBPACK_IMPORTED_MODULE_14__["default"]; }); - -/* harmony import */ var _differenceInCalendarDays_index_js__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./differenceInCalendarDays/index.js */ "./node_modules/date-fns/esm/differenceInCalendarDays/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "differenceInCalendarDays", function() { return _differenceInCalendarDays_index_js__WEBPACK_IMPORTED_MODULE_15__["default"]; }); - -/* harmony import */ var _differenceInCalendarISOWeekYears_index_js__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./differenceInCalendarISOWeekYears/index.js */ "./node_modules/date-fns/esm/differenceInCalendarISOWeekYears/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "differenceInCalendarISOWeekYears", function() { return _differenceInCalendarISOWeekYears_index_js__WEBPACK_IMPORTED_MODULE_16__["default"]; }); - -/* harmony import */ var _differenceInCalendarISOWeeks_index_js__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./differenceInCalendarISOWeeks/index.js */ "./node_modules/date-fns/esm/differenceInCalendarISOWeeks/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "differenceInCalendarISOWeeks", function() { return _differenceInCalendarISOWeeks_index_js__WEBPACK_IMPORTED_MODULE_17__["default"]; }); - -/* harmony import */ var _differenceInCalendarMonths_index_js__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./differenceInCalendarMonths/index.js */ "./node_modules/date-fns/esm/differenceInCalendarMonths/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "differenceInCalendarMonths", function() { return _differenceInCalendarMonths_index_js__WEBPACK_IMPORTED_MODULE_18__["default"]; }); - -/* harmony import */ var _differenceInCalendarQuarters_index_js__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./differenceInCalendarQuarters/index.js */ "./node_modules/date-fns/esm/differenceInCalendarQuarters/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "differenceInCalendarQuarters", function() { return _differenceInCalendarQuarters_index_js__WEBPACK_IMPORTED_MODULE_19__["default"]; }); - -/* harmony import */ var _differenceInCalendarWeeks_index_js__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ./differenceInCalendarWeeks/index.js */ "./node_modules/date-fns/esm/differenceInCalendarWeeks/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "differenceInCalendarWeeks", function() { return _differenceInCalendarWeeks_index_js__WEBPACK_IMPORTED_MODULE_20__["default"]; }); - -/* harmony import */ var _differenceInCalendarYears_index_js__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ./differenceInCalendarYears/index.js */ "./node_modules/date-fns/esm/differenceInCalendarYears/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "differenceInCalendarYears", function() { return _differenceInCalendarYears_index_js__WEBPACK_IMPORTED_MODULE_21__["default"]; }); - -/* harmony import */ var _differenceInDays_index_js__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ./differenceInDays/index.js */ "./node_modules/date-fns/esm/differenceInDays/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "differenceInDays", function() { return _differenceInDays_index_js__WEBPACK_IMPORTED_MODULE_22__["default"]; }); - -/* harmony import */ var _differenceInHours_index_js__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ./differenceInHours/index.js */ "./node_modules/date-fns/esm/differenceInHours/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "differenceInHours", function() { return _differenceInHours_index_js__WEBPACK_IMPORTED_MODULE_23__["default"]; }); - -/* harmony import */ var _differenceInISOWeekYears_index_js__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! ./differenceInISOWeekYears/index.js */ "./node_modules/date-fns/esm/differenceInISOWeekYears/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "differenceInISOWeekYears", function() { return _differenceInISOWeekYears_index_js__WEBPACK_IMPORTED_MODULE_24__["default"]; }); - -/* harmony import */ var _differenceInMilliseconds_index_js__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(/*! ./differenceInMilliseconds/index.js */ "./node_modules/date-fns/esm/differenceInMilliseconds/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "differenceInMilliseconds", function() { return _differenceInMilliseconds_index_js__WEBPACK_IMPORTED_MODULE_25__["default"]; }); - -/* harmony import */ var _differenceInMinutes_index_js__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(/*! ./differenceInMinutes/index.js */ "./node_modules/date-fns/esm/differenceInMinutes/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "differenceInMinutes", function() { return _differenceInMinutes_index_js__WEBPACK_IMPORTED_MODULE_26__["default"]; }); - -/* harmony import */ var _differenceInMonths_index_js__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__(/*! ./differenceInMonths/index.js */ "./node_modules/date-fns/esm/differenceInMonths/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "differenceInMonths", function() { return _differenceInMonths_index_js__WEBPACK_IMPORTED_MODULE_27__["default"]; }); - -/* harmony import */ var _differenceInQuarters_index_js__WEBPACK_IMPORTED_MODULE_28__ = __webpack_require__(/*! ./differenceInQuarters/index.js */ "./node_modules/date-fns/esm/differenceInQuarters/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "differenceInQuarters", function() { return _differenceInQuarters_index_js__WEBPACK_IMPORTED_MODULE_28__["default"]; }); - -/* harmony import */ var _differenceInSeconds_index_js__WEBPACK_IMPORTED_MODULE_29__ = __webpack_require__(/*! ./differenceInSeconds/index.js */ "./node_modules/date-fns/esm/differenceInSeconds/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "differenceInSeconds", function() { return _differenceInSeconds_index_js__WEBPACK_IMPORTED_MODULE_29__["default"]; }); - -/* harmony import */ var _differenceInWeeks_index_js__WEBPACK_IMPORTED_MODULE_30__ = __webpack_require__(/*! ./differenceInWeeks/index.js */ "./node_modules/date-fns/esm/differenceInWeeks/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "differenceInWeeks", function() { return _differenceInWeeks_index_js__WEBPACK_IMPORTED_MODULE_30__["default"]; }); - -/* harmony import */ var _differenceInYears_index_js__WEBPACK_IMPORTED_MODULE_31__ = __webpack_require__(/*! ./differenceInYears/index.js */ "./node_modules/date-fns/esm/differenceInYears/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "differenceInYears", function() { return _differenceInYears_index_js__WEBPACK_IMPORTED_MODULE_31__["default"]; }); - -/* harmony import */ var _eachDayOfInterval_index_js__WEBPACK_IMPORTED_MODULE_32__ = __webpack_require__(/*! ./eachDayOfInterval/index.js */ "./node_modules/date-fns/esm/eachDayOfInterval/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "eachDayOfInterval", function() { return _eachDayOfInterval_index_js__WEBPACK_IMPORTED_MODULE_32__["default"]; }); - -/* harmony import */ var _eachWeekOfInterval_index_js__WEBPACK_IMPORTED_MODULE_33__ = __webpack_require__(/*! ./eachWeekOfInterval/index.js */ "./node_modules/date-fns/esm/eachWeekOfInterval/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "eachWeekOfInterval", function() { return _eachWeekOfInterval_index_js__WEBPACK_IMPORTED_MODULE_33__["default"]; }); - -/* harmony import */ var _eachWeekendOfInterval_index_js__WEBPACK_IMPORTED_MODULE_34__ = __webpack_require__(/*! ./eachWeekendOfInterval/index.js */ "./node_modules/date-fns/esm/eachWeekendOfInterval/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "eachWeekendOfInterval", function() { return _eachWeekendOfInterval_index_js__WEBPACK_IMPORTED_MODULE_34__["default"]; }); - -/* harmony import */ var _eachWeekendOfMonth_index_js__WEBPACK_IMPORTED_MODULE_35__ = __webpack_require__(/*! ./eachWeekendOfMonth/index.js */ "./node_modules/date-fns/esm/eachWeekendOfMonth/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "eachWeekendOfMonth", function() { return _eachWeekendOfMonth_index_js__WEBPACK_IMPORTED_MODULE_35__["default"]; }); - -/* harmony import */ var _eachWeekendOfYear_index_js__WEBPACK_IMPORTED_MODULE_36__ = __webpack_require__(/*! ./eachWeekendOfYear/index.js */ "./node_modules/date-fns/esm/eachWeekendOfYear/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "eachWeekendOfYear", function() { return _eachWeekendOfYear_index_js__WEBPACK_IMPORTED_MODULE_36__["default"]; }); - -/* harmony import */ var _endOfDay_index_js__WEBPACK_IMPORTED_MODULE_37__ = __webpack_require__(/*! ./endOfDay/index.js */ "./node_modules/date-fns/esm/endOfDay/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "endOfDay", function() { return _endOfDay_index_js__WEBPACK_IMPORTED_MODULE_37__["default"]; }); - -/* harmony import */ var _endOfDecade_index_js__WEBPACK_IMPORTED_MODULE_38__ = __webpack_require__(/*! ./endOfDecade/index.js */ "./node_modules/date-fns/esm/endOfDecade/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "endOfDecade", function() { return _endOfDecade_index_js__WEBPACK_IMPORTED_MODULE_38__["default"]; }); - -/* harmony import */ var _endOfHour_index_js__WEBPACK_IMPORTED_MODULE_39__ = __webpack_require__(/*! ./endOfHour/index.js */ "./node_modules/date-fns/esm/endOfHour/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "endOfHour", function() { return _endOfHour_index_js__WEBPACK_IMPORTED_MODULE_39__["default"]; }); - -/* harmony import */ var _endOfISOWeek_index_js__WEBPACK_IMPORTED_MODULE_40__ = __webpack_require__(/*! ./endOfISOWeek/index.js */ "./node_modules/date-fns/esm/endOfISOWeek/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "endOfISOWeek", function() { return _endOfISOWeek_index_js__WEBPACK_IMPORTED_MODULE_40__["default"]; }); - -/* harmony import */ var _endOfISOWeekYear_index_js__WEBPACK_IMPORTED_MODULE_41__ = __webpack_require__(/*! ./endOfISOWeekYear/index.js */ "./node_modules/date-fns/esm/endOfISOWeekYear/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "endOfISOWeekYear", function() { return _endOfISOWeekYear_index_js__WEBPACK_IMPORTED_MODULE_41__["default"]; }); - -/* harmony import */ var _endOfMinute_index_js__WEBPACK_IMPORTED_MODULE_42__ = __webpack_require__(/*! ./endOfMinute/index.js */ "./node_modules/date-fns/esm/endOfMinute/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "endOfMinute", function() { return _endOfMinute_index_js__WEBPACK_IMPORTED_MODULE_42__["default"]; }); - -/* harmony import */ var _endOfMonth_index_js__WEBPACK_IMPORTED_MODULE_43__ = __webpack_require__(/*! ./endOfMonth/index.js */ "./node_modules/date-fns/esm/endOfMonth/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "endOfMonth", function() { return _endOfMonth_index_js__WEBPACK_IMPORTED_MODULE_43__["default"]; }); - -/* harmony import */ var _endOfQuarter_index_js__WEBPACK_IMPORTED_MODULE_44__ = __webpack_require__(/*! ./endOfQuarter/index.js */ "./node_modules/date-fns/esm/endOfQuarter/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "endOfQuarter", function() { return _endOfQuarter_index_js__WEBPACK_IMPORTED_MODULE_44__["default"]; }); - -/* harmony import */ var _endOfSecond_index_js__WEBPACK_IMPORTED_MODULE_45__ = __webpack_require__(/*! ./endOfSecond/index.js */ "./node_modules/date-fns/esm/endOfSecond/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "endOfSecond", function() { return _endOfSecond_index_js__WEBPACK_IMPORTED_MODULE_45__["default"]; }); - -/* harmony import */ var _endOfWeek_index_js__WEBPACK_IMPORTED_MODULE_46__ = __webpack_require__(/*! ./endOfWeek/index.js */ "./node_modules/date-fns/esm/endOfWeek/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "endOfWeek", function() { return _endOfWeek_index_js__WEBPACK_IMPORTED_MODULE_46__["default"]; }); - -/* harmony import */ var _endOfYear_index_js__WEBPACK_IMPORTED_MODULE_47__ = __webpack_require__(/*! ./endOfYear/index.js */ "./node_modules/date-fns/esm/endOfYear/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "endOfYear", function() { return _endOfYear_index_js__WEBPACK_IMPORTED_MODULE_47__["default"]; }); - -/* harmony import */ var _format_index_js__WEBPACK_IMPORTED_MODULE_48__ = __webpack_require__(/*! ./format/index.js */ "./node_modules/date-fns/esm/format/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "format", function() { return _format_index_js__WEBPACK_IMPORTED_MODULE_48__["default"]; }); - -/* harmony import */ var _formatDistance_index_js__WEBPACK_IMPORTED_MODULE_49__ = __webpack_require__(/*! ./formatDistance/index.js */ "./node_modules/date-fns/esm/formatDistance/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "formatDistance", function() { return _formatDistance_index_js__WEBPACK_IMPORTED_MODULE_49__["default"]; }); - -/* harmony import */ var _formatDistanceStrict_index_js__WEBPACK_IMPORTED_MODULE_50__ = __webpack_require__(/*! ./formatDistanceStrict/index.js */ "./node_modules/date-fns/esm/formatDistanceStrict/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "formatDistanceStrict", function() { return _formatDistanceStrict_index_js__WEBPACK_IMPORTED_MODULE_50__["default"]; }); - -/* harmony import */ var _formatRelative_index_js__WEBPACK_IMPORTED_MODULE_51__ = __webpack_require__(/*! ./formatRelative/index.js */ "./node_modules/date-fns/esm/formatRelative/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "formatRelative", function() { return _formatRelative_index_js__WEBPACK_IMPORTED_MODULE_51__["default"]; }); - -/* harmony import */ var _fromUnixTime_index_js__WEBPACK_IMPORTED_MODULE_52__ = __webpack_require__(/*! ./fromUnixTime/index.js */ "./node_modules/date-fns/esm/fromUnixTime/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "fromUnixTime", function() { return _fromUnixTime_index_js__WEBPACK_IMPORTED_MODULE_52__["default"]; }); - -/* harmony import */ var _getDate_index_js__WEBPACK_IMPORTED_MODULE_53__ = __webpack_require__(/*! ./getDate/index.js */ "./node_modules/date-fns/esm/getDate/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getDate", function() { return _getDate_index_js__WEBPACK_IMPORTED_MODULE_53__["default"]; }); - -/* harmony import */ var _getDay_index_js__WEBPACK_IMPORTED_MODULE_54__ = __webpack_require__(/*! ./getDay/index.js */ "./node_modules/date-fns/esm/getDay/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getDay", function() { return _getDay_index_js__WEBPACK_IMPORTED_MODULE_54__["default"]; }); - -/* harmony import */ var _getDayOfYear_index_js__WEBPACK_IMPORTED_MODULE_55__ = __webpack_require__(/*! ./getDayOfYear/index.js */ "./node_modules/date-fns/esm/getDayOfYear/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getDayOfYear", function() { return _getDayOfYear_index_js__WEBPACK_IMPORTED_MODULE_55__["default"]; }); - -/* harmony import */ var _getDaysInMonth_index_js__WEBPACK_IMPORTED_MODULE_56__ = __webpack_require__(/*! ./getDaysInMonth/index.js */ "./node_modules/date-fns/esm/getDaysInMonth/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getDaysInMonth", function() { return _getDaysInMonth_index_js__WEBPACK_IMPORTED_MODULE_56__["default"]; }); - -/* harmony import */ var _getDaysInYear_index_js__WEBPACK_IMPORTED_MODULE_57__ = __webpack_require__(/*! ./getDaysInYear/index.js */ "./node_modules/date-fns/esm/getDaysInYear/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getDaysInYear", function() { return _getDaysInYear_index_js__WEBPACK_IMPORTED_MODULE_57__["default"]; }); - -/* harmony import */ var _getDecade_index_js__WEBPACK_IMPORTED_MODULE_58__ = __webpack_require__(/*! ./getDecade/index.js */ "./node_modules/date-fns/esm/getDecade/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getDecade", function() { return _getDecade_index_js__WEBPACK_IMPORTED_MODULE_58__["default"]; }); - -/* harmony import */ var _getHours_index_js__WEBPACK_IMPORTED_MODULE_59__ = __webpack_require__(/*! ./getHours/index.js */ "./node_modules/date-fns/esm/getHours/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getHours", function() { return _getHours_index_js__WEBPACK_IMPORTED_MODULE_59__["default"]; }); - -/* harmony import */ var _getISODay_index_js__WEBPACK_IMPORTED_MODULE_60__ = __webpack_require__(/*! ./getISODay/index.js */ "./node_modules/date-fns/esm/getISODay/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getISODay", function() { return _getISODay_index_js__WEBPACK_IMPORTED_MODULE_60__["default"]; }); - -/* harmony import */ var _getISOWeek_index_js__WEBPACK_IMPORTED_MODULE_61__ = __webpack_require__(/*! ./getISOWeek/index.js */ "./node_modules/date-fns/esm/getISOWeek/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getISOWeek", function() { return _getISOWeek_index_js__WEBPACK_IMPORTED_MODULE_61__["default"]; }); - -/* harmony import */ var _getISOWeekYear_index_js__WEBPACK_IMPORTED_MODULE_62__ = __webpack_require__(/*! ./getISOWeekYear/index.js */ "./node_modules/date-fns/esm/getISOWeekYear/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getISOWeekYear", function() { return _getISOWeekYear_index_js__WEBPACK_IMPORTED_MODULE_62__["default"]; }); - -/* harmony import */ var _getISOWeeksInYear_index_js__WEBPACK_IMPORTED_MODULE_63__ = __webpack_require__(/*! ./getISOWeeksInYear/index.js */ "./node_modules/date-fns/esm/getISOWeeksInYear/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getISOWeeksInYear", function() { return _getISOWeeksInYear_index_js__WEBPACK_IMPORTED_MODULE_63__["default"]; }); - -/* harmony import */ var _getMilliseconds_index_js__WEBPACK_IMPORTED_MODULE_64__ = __webpack_require__(/*! ./getMilliseconds/index.js */ "./node_modules/date-fns/esm/getMilliseconds/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getMilliseconds", function() { return _getMilliseconds_index_js__WEBPACK_IMPORTED_MODULE_64__["default"]; }); - -/* harmony import */ var _getMinutes_index_js__WEBPACK_IMPORTED_MODULE_65__ = __webpack_require__(/*! ./getMinutes/index.js */ "./node_modules/date-fns/esm/getMinutes/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getMinutes", function() { return _getMinutes_index_js__WEBPACK_IMPORTED_MODULE_65__["default"]; }); - -/* harmony import */ var _getMonth_index_js__WEBPACK_IMPORTED_MODULE_66__ = __webpack_require__(/*! ./getMonth/index.js */ "./node_modules/date-fns/esm/getMonth/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getMonth", function() { return _getMonth_index_js__WEBPACK_IMPORTED_MODULE_66__["default"]; }); - -/* harmony import */ var _getOverlappingDaysInIntervals_index_js__WEBPACK_IMPORTED_MODULE_67__ = __webpack_require__(/*! ./getOverlappingDaysInIntervals/index.js */ "./node_modules/date-fns/esm/getOverlappingDaysInIntervals/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getOverlappingDaysInIntervals", function() { return _getOverlappingDaysInIntervals_index_js__WEBPACK_IMPORTED_MODULE_67__["default"]; }); - -/* harmony import */ var _getQuarter_index_js__WEBPACK_IMPORTED_MODULE_68__ = __webpack_require__(/*! ./getQuarter/index.js */ "./node_modules/date-fns/esm/getQuarter/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getQuarter", function() { return _getQuarter_index_js__WEBPACK_IMPORTED_MODULE_68__["default"]; }); - -/* harmony import */ var _getSeconds_index_js__WEBPACK_IMPORTED_MODULE_69__ = __webpack_require__(/*! ./getSeconds/index.js */ "./node_modules/date-fns/esm/getSeconds/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getSeconds", function() { return _getSeconds_index_js__WEBPACK_IMPORTED_MODULE_69__["default"]; }); - -/* harmony import */ var _getTime_index_js__WEBPACK_IMPORTED_MODULE_70__ = __webpack_require__(/*! ./getTime/index.js */ "./node_modules/date-fns/esm/getTime/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getTime", function() { return _getTime_index_js__WEBPACK_IMPORTED_MODULE_70__["default"]; }); - -/* harmony import */ var _getUnixTime_index_js__WEBPACK_IMPORTED_MODULE_71__ = __webpack_require__(/*! ./getUnixTime/index.js */ "./node_modules/date-fns/esm/getUnixTime/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getUnixTime", function() { return _getUnixTime_index_js__WEBPACK_IMPORTED_MODULE_71__["default"]; }); - -/* harmony import */ var _getWeek_index_js__WEBPACK_IMPORTED_MODULE_72__ = __webpack_require__(/*! ./getWeek/index.js */ "./node_modules/date-fns/esm/getWeek/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getWeek", function() { return _getWeek_index_js__WEBPACK_IMPORTED_MODULE_72__["default"]; }); - -/* harmony import */ var _getWeekOfMonth_index_js__WEBPACK_IMPORTED_MODULE_73__ = __webpack_require__(/*! ./getWeekOfMonth/index.js */ "./node_modules/date-fns/esm/getWeekOfMonth/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getWeekOfMonth", function() { return _getWeekOfMonth_index_js__WEBPACK_IMPORTED_MODULE_73__["default"]; }); - -/* harmony import */ var _getWeekYear_index_js__WEBPACK_IMPORTED_MODULE_74__ = __webpack_require__(/*! ./getWeekYear/index.js */ "./node_modules/date-fns/esm/getWeekYear/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getWeekYear", function() { return _getWeekYear_index_js__WEBPACK_IMPORTED_MODULE_74__["default"]; }); - -/* harmony import */ var _getWeeksInMonth_index_js__WEBPACK_IMPORTED_MODULE_75__ = __webpack_require__(/*! ./getWeeksInMonth/index.js */ "./node_modules/date-fns/esm/getWeeksInMonth/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getWeeksInMonth", function() { return _getWeeksInMonth_index_js__WEBPACK_IMPORTED_MODULE_75__["default"]; }); - -/* harmony import */ var _getYear_index_js__WEBPACK_IMPORTED_MODULE_76__ = __webpack_require__(/*! ./getYear/index.js */ "./node_modules/date-fns/esm/getYear/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getYear", function() { return _getYear_index_js__WEBPACK_IMPORTED_MODULE_76__["default"]; }); - -/* harmony import */ var _isAfter_index_js__WEBPACK_IMPORTED_MODULE_77__ = __webpack_require__(/*! ./isAfter/index.js */ "./node_modules/date-fns/esm/isAfter/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isAfter", function() { return _isAfter_index_js__WEBPACK_IMPORTED_MODULE_77__["default"]; }); - -/* harmony import */ var _isBefore_index_js__WEBPACK_IMPORTED_MODULE_78__ = __webpack_require__(/*! ./isBefore/index.js */ "./node_modules/date-fns/esm/isBefore/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isBefore", function() { return _isBefore_index_js__WEBPACK_IMPORTED_MODULE_78__["default"]; }); - -/* harmony import */ var _isDate_index_js__WEBPACK_IMPORTED_MODULE_79__ = __webpack_require__(/*! ./isDate/index.js */ "./node_modules/date-fns/esm/isDate/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isDate", function() { return _isDate_index_js__WEBPACK_IMPORTED_MODULE_79__["default"]; }); - -/* harmony import */ var _isEqual_index_js__WEBPACK_IMPORTED_MODULE_80__ = __webpack_require__(/*! ./isEqual/index.js */ "./node_modules/date-fns/esm/isEqual/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isEqual", function() { return _isEqual_index_js__WEBPACK_IMPORTED_MODULE_80__["default"]; }); - -/* harmony import */ var _isFirstDayOfMonth_index_js__WEBPACK_IMPORTED_MODULE_81__ = __webpack_require__(/*! ./isFirstDayOfMonth/index.js */ "./node_modules/date-fns/esm/isFirstDayOfMonth/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isFirstDayOfMonth", function() { return _isFirstDayOfMonth_index_js__WEBPACK_IMPORTED_MODULE_81__["default"]; }); - -/* harmony import */ var _isFriday_index_js__WEBPACK_IMPORTED_MODULE_82__ = __webpack_require__(/*! ./isFriday/index.js */ "./node_modules/date-fns/esm/isFriday/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isFriday", function() { return _isFriday_index_js__WEBPACK_IMPORTED_MODULE_82__["default"]; }); - -/* harmony import */ var _isLastDayOfMonth_index_js__WEBPACK_IMPORTED_MODULE_83__ = __webpack_require__(/*! ./isLastDayOfMonth/index.js */ "./node_modules/date-fns/esm/isLastDayOfMonth/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isLastDayOfMonth", function() { return _isLastDayOfMonth_index_js__WEBPACK_IMPORTED_MODULE_83__["default"]; }); - -/* harmony import */ var _isLeapYear_index_js__WEBPACK_IMPORTED_MODULE_84__ = __webpack_require__(/*! ./isLeapYear/index.js */ "./node_modules/date-fns/esm/isLeapYear/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isLeapYear", function() { return _isLeapYear_index_js__WEBPACK_IMPORTED_MODULE_84__["default"]; }); - -/* harmony import */ var _isMonday_index_js__WEBPACK_IMPORTED_MODULE_85__ = __webpack_require__(/*! ./isMonday/index.js */ "./node_modules/date-fns/esm/isMonday/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isMonday", function() { return _isMonday_index_js__WEBPACK_IMPORTED_MODULE_85__["default"]; }); - -/* harmony import */ var _isSameDay_index_js__WEBPACK_IMPORTED_MODULE_86__ = __webpack_require__(/*! ./isSameDay/index.js */ "./node_modules/date-fns/esm/isSameDay/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isSameDay", function() { return _isSameDay_index_js__WEBPACK_IMPORTED_MODULE_86__["default"]; }); - -/* harmony import */ var _isSameHour_index_js__WEBPACK_IMPORTED_MODULE_87__ = __webpack_require__(/*! ./isSameHour/index.js */ "./node_modules/date-fns/esm/isSameHour/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isSameHour", function() { return _isSameHour_index_js__WEBPACK_IMPORTED_MODULE_87__["default"]; }); - -/* harmony import */ var _isSameISOWeek_index_js__WEBPACK_IMPORTED_MODULE_88__ = __webpack_require__(/*! ./isSameISOWeek/index.js */ "./node_modules/date-fns/esm/isSameISOWeek/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isSameISOWeek", function() { return _isSameISOWeek_index_js__WEBPACK_IMPORTED_MODULE_88__["default"]; }); - -/* harmony import */ var _isSameISOWeekYear_index_js__WEBPACK_IMPORTED_MODULE_89__ = __webpack_require__(/*! ./isSameISOWeekYear/index.js */ "./node_modules/date-fns/esm/isSameISOWeekYear/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isSameISOWeekYear", function() { return _isSameISOWeekYear_index_js__WEBPACK_IMPORTED_MODULE_89__["default"]; }); - -/* harmony import */ var _isSameMinute_index_js__WEBPACK_IMPORTED_MODULE_90__ = __webpack_require__(/*! ./isSameMinute/index.js */ "./node_modules/date-fns/esm/isSameMinute/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isSameMinute", function() { return _isSameMinute_index_js__WEBPACK_IMPORTED_MODULE_90__["default"]; }); - -/* harmony import */ var _isSameMonth_index_js__WEBPACK_IMPORTED_MODULE_91__ = __webpack_require__(/*! ./isSameMonth/index.js */ "./node_modules/date-fns/esm/isSameMonth/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isSameMonth", function() { return _isSameMonth_index_js__WEBPACK_IMPORTED_MODULE_91__["default"]; }); - -/* harmony import */ var _isSameQuarter_index_js__WEBPACK_IMPORTED_MODULE_92__ = __webpack_require__(/*! ./isSameQuarter/index.js */ "./node_modules/date-fns/esm/isSameQuarter/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isSameQuarter", function() { return _isSameQuarter_index_js__WEBPACK_IMPORTED_MODULE_92__["default"]; }); - -/* harmony import */ var _isSameSecond_index_js__WEBPACK_IMPORTED_MODULE_93__ = __webpack_require__(/*! ./isSameSecond/index.js */ "./node_modules/date-fns/esm/isSameSecond/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isSameSecond", function() { return _isSameSecond_index_js__WEBPACK_IMPORTED_MODULE_93__["default"]; }); - -/* harmony import */ var _isSameWeek_index_js__WEBPACK_IMPORTED_MODULE_94__ = __webpack_require__(/*! ./isSameWeek/index.js */ "./node_modules/date-fns/esm/isSameWeek/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isSameWeek", function() { return _isSameWeek_index_js__WEBPACK_IMPORTED_MODULE_94__["default"]; }); - -/* harmony import */ var _isSameYear_index_js__WEBPACK_IMPORTED_MODULE_95__ = __webpack_require__(/*! ./isSameYear/index.js */ "./node_modules/date-fns/esm/isSameYear/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isSameYear", function() { return _isSameYear_index_js__WEBPACK_IMPORTED_MODULE_95__["default"]; }); - -/* harmony import */ var _isSaturday_index_js__WEBPACK_IMPORTED_MODULE_96__ = __webpack_require__(/*! ./isSaturday/index.js */ "./node_modules/date-fns/esm/isSaturday/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isSaturday", function() { return _isSaturday_index_js__WEBPACK_IMPORTED_MODULE_96__["default"]; }); - -/* harmony import */ var _isSunday_index_js__WEBPACK_IMPORTED_MODULE_97__ = __webpack_require__(/*! ./isSunday/index.js */ "./node_modules/date-fns/esm/isSunday/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isSunday", function() { return _isSunday_index_js__WEBPACK_IMPORTED_MODULE_97__["default"]; }); - -/* harmony import */ var _isThursday_index_js__WEBPACK_IMPORTED_MODULE_98__ = __webpack_require__(/*! ./isThursday/index.js */ "./node_modules/date-fns/esm/isThursday/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isThursday", function() { return _isThursday_index_js__WEBPACK_IMPORTED_MODULE_98__["default"]; }); - -/* harmony import */ var _isTuesday_index_js__WEBPACK_IMPORTED_MODULE_99__ = __webpack_require__(/*! ./isTuesday/index.js */ "./node_modules/date-fns/esm/isTuesday/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isTuesday", function() { return _isTuesday_index_js__WEBPACK_IMPORTED_MODULE_99__["default"]; }); - -/* harmony import */ var _isValid_index_js__WEBPACK_IMPORTED_MODULE_100__ = __webpack_require__(/*! ./isValid/index.js */ "./node_modules/date-fns/esm/isValid/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isValid", function() { return _isValid_index_js__WEBPACK_IMPORTED_MODULE_100__["default"]; }); - -/* harmony import */ var _isWednesday_index_js__WEBPACK_IMPORTED_MODULE_101__ = __webpack_require__(/*! ./isWednesday/index.js */ "./node_modules/date-fns/esm/isWednesday/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isWednesday", function() { return _isWednesday_index_js__WEBPACK_IMPORTED_MODULE_101__["default"]; }); - -/* harmony import */ var _isWeekend_index_js__WEBPACK_IMPORTED_MODULE_102__ = __webpack_require__(/*! ./isWeekend/index.js */ "./node_modules/date-fns/esm/isWeekend/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isWeekend", function() { return _isWeekend_index_js__WEBPACK_IMPORTED_MODULE_102__["default"]; }); - -/* harmony import */ var _isWithinInterval_index_js__WEBPACK_IMPORTED_MODULE_103__ = __webpack_require__(/*! ./isWithinInterval/index.js */ "./node_modules/date-fns/esm/isWithinInterval/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isWithinInterval", function() { return _isWithinInterval_index_js__WEBPACK_IMPORTED_MODULE_103__["default"]; }); - -/* harmony import */ var _lastDayOfDecade_index_js__WEBPACK_IMPORTED_MODULE_104__ = __webpack_require__(/*! ./lastDayOfDecade/index.js */ "./node_modules/date-fns/esm/lastDayOfDecade/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "lastDayOfDecade", function() { return _lastDayOfDecade_index_js__WEBPACK_IMPORTED_MODULE_104__["default"]; }); - -/* harmony import */ var _lastDayOfISOWeek_index_js__WEBPACK_IMPORTED_MODULE_105__ = __webpack_require__(/*! ./lastDayOfISOWeek/index.js */ "./node_modules/date-fns/esm/lastDayOfISOWeek/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "lastDayOfISOWeek", function() { return _lastDayOfISOWeek_index_js__WEBPACK_IMPORTED_MODULE_105__["default"]; }); - -/* harmony import */ var _lastDayOfISOWeekYear_index_js__WEBPACK_IMPORTED_MODULE_106__ = __webpack_require__(/*! ./lastDayOfISOWeekYear/index.js */ "./node_modules/date-fns/esm/lastDayOfISOWeekYear/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "lastDayOfISOWeekYear", function() { return _lastDayOfISOWeekYear_index_js__WEBPACK_IMPORTED_MODULE_106__["default"]; }); - -/* harmony import */ var _lastDayOfMonth_index_js__WEBPACK_IMPORTED_MODULE_107__ = __webpack_require__(/*! ./lastDayOfMonth/index.js */ "./node_modules/date-fns/esm/lastDayOfMonth/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "lastDayOfMonth", function() { return _lastDayOfMonth_index_js__WEBPACK_IMPORTED_MODULE_107__["default"]; }); - -/* harmony import */ var _lastDayOfQuarter_index_js__WEBPACK_IMPORTED_MODULE_108__ = __webpack_require__(/*! ./lastDayOfQuarter/index.js */ "./node_modules/date-fns/esm/lastDayOfQuarter/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "lastDayOfQuarter", function() { return _lastDayOfQuarter_index_js__WEBPACK_IMPORTED_MODULE_108__["default"]; }); - -/* harmony import */ var _lastDayOfWeek_index_js__WEBPACK_IMPORTED_MODULE_109__ = __webpack_require__(/*! ./lastDayOfWeek/index.js */ "./node_modules/date-fns/esm/lastDayOfWeek/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "lastDayOfWeek", function() { return _lastDayOfWeek_index_js__WEBPACK_IMPORTED_MODULE_109__["default"]; }); - -/* harmony import */ var _lastDayOfYear_index_js__WEBPACK_IMPORTED_MODULE_110__ = __webpack_require__(/*! ./lastDayOfYear/index.js */ "./node_modules/date-fns/esm/lastDayOfYear/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "lastDayOfYear", function() { return _lastDayOfYear_index_js__WEBPACK_IMPORTED_MODULE_110__["default"]; }); - -/* harmony import */ var _lightFormat_index_js__WEBPACK_IMPORTED_MODULE_111__ = __webpack_require__(/*! ./lightFormat/index.js */ "./node_modules/date-fns/esm/lightFormat/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "lightFormat", function() { return _lightFormat_index_js__WEBPACK_IMPORTED_MODULE_111__["default"]; }); - -/* harmony import */ var _max_index_js__WEBPACK_IMPORTED_MODULE_112__ = __webpack_require__(/*! ./max/index.js */ "./node_modules/date-fns/esm/max/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "max", function() { return _max_index_js__WEBPACK_IMPORTED_MODULE_112__["default"]; }); - -/* harmony import */ var _min_index_js__WEBPACK_IMPORTED_MODULE_113__ = __webpack_require__(/*! ./min/index.js */ "./node_modules/date-fns/esm/min/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "min", function() { return _min_index_js__WEBPACK_IMPORTED_MODULE_113__["default"]; }); - -/* harmony import */ var _parse_index_js__WEBPACK_IMPORTED_MODULE_114__ = __webpack_require__(/*! ./parse/index.js */ "./node_modules/date-fns/esm/parse/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "parse", function() { return _parse_index_js__WEBPACK_IMPORTED_MODULE_114__["default"]; }); - -/* harmony import */ var _parseISO_index_js__WEBPACK_IMPORTED_MODULE_115__ = __webpack_require__(/*! ./parseISO/index.js */ "./node_modules/date-fns/esm/parseISO/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "parseISO", function() { return _parseISO_index_js__WEBPACK_IMPORTED_MODULE_115__["default"]; }); - -/* harmony import */ var _roundToNearestMinutes_index_js__WEBPACK_IMPORTED_MODULE_116__ = __webpack_require__(/*! ./roundToNearestMinutes/index.js */ "./node_modules/date-fns/esm/roundToNearestMinutes/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "roundToNearestMinutes", function() { return _roundToNearestMinutes_index_js__WEBPACK_IMPORTED_MODULE_116__["default"]; }); - -/* harmony import */ var _setDate_index_js__WEBPACK_IMPORTED_MODULE_117__ = __webpack_require__(/*! ./setDate/index.js */ "./node_modules/date-fns/esm/setDate/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "setDate", function() { return _setDate_index_js__WEBPACK_IMPORTED_MODULE_117__["default"]; }); - -/* harmony import */ var _setDay_index_js__WEBPACK_IMPORTED_MODULE_118__ = __webpack_require__(/*! ./setDay/index.js */ "./node_modules/date-fns/esm/setDay/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "setDay", function() { return _setDay_index_js__WEBPACK_IMPORTED_MODULE_118__["default"]; }); - -/* harmony import */ var _setDayOfYear_index_js__WEBPACK_IMPORTED_MODULE_119__ = __webpack_require__(/*! ./setDayOfYear/index.js */ "./node_modules/date-fns/esm/setDayOfYear/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "setDayOfYear", function() { return _setDayOfYear_index_js__WEBPACK_IMPORTED_MODULE_119__["default"]; }); - -/* harmony import */ var _setHours_index_js__WEBPACK_IMPORTED_MODULE_120__ = __webpack_require__(/*! ./setHours/index.js */ "./node_modules/date-fns/esm/setHours/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "setHours", function() { return _setHours_index_js__WEBPACK_IMPORTED_MODULE_120__["default"]; }); - -/* harmony import */ var _setISODay_index_js__WEBPACK_IMPORTED_MODULE_121__ = __webpack_require__(/*! ./setISODay/index.js */ "./node_modules/date-fns/esm/setISODay/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "setISODay", function() { return _setISODay_index_js__WEBPACK_IMPORTED_MODULE_121__["default"]; }); - -/* harmony import */ var _setISOWeek_index_js__WEBPACK_IMPORTED_MODULE_122__ = __webpack_require__(/*! ./setISOWeek/index.js */ "./node_modules/date-fns/esm/setISOWeek/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "setISOWeek", function() { return _setISOWeek_index_js__WEBPACK_IMPORTED_MODULE_122__["default"]; }); - -/* harmony import */ var _setISOWeekYear_index_js__WEBPACK_IMPORTED_MODULE_123__ = __webpack_require__(/*! ./setISOWeekYear/index.js */ "./node_modules/date-fns/esm/setISOWeekYear/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "setISOWeekYear", function() { return _setISOWeekYear_index_js__WEBPACK_IMPORTED_MODULE_123__["default"]; }); - -/* harmony import */ var _setMilliseconds_index_js__WEBPACK_IMPORTED_MODULE_124__ = __webpack_require__(/*! ./setMilliseconds/index.js */ "./node_modules/date-fns/esm/setMilliseconds/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "setMilliseconds", function() { return _setMilliseconds_index_js__WEBPACK_IMPORTED_MODULE_124__["default"]; }); - -/* harmony import */ var _setMinutes_index_js__WEBPACK_IMPORTED_MODULE_125__ = __webpack_require__(/*! ./setMinutes/index.js */ "./node_modules/date-fns/esm/setMinutes/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "setMinutes", function() { return _setMinutes_index_js__WEBPACK_IMPORTED_MODULE_125__["default"]; }); - -/* harmony import */ var _setMonth_index_js__WEBPACK_IMPORTED_MODULE_126__ = __webpack_require__(/*! ./setMonth/index.js */ "./node_modules/date-fns/esm/setMonth/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "setMonth", function() { return _setMonth_index_js__WEBPACK_IMPORTED_MODULE_126__["default"]; }); - -/* harmony import */ var _setQuarter_index_js__WEBPACK_IMPORTED_MODULE_127__ = __webpack_require__(/*! ./setQuarter/index.js */ "./node_modules/date-fns/esm/setQuarter/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "setQuarter", function() { return _setQuarter_index_js__WEBPACK_IMPORTED_MODULE_127__["default"]; }); - -/* harmony import */ var _setSeconds_index_js__WEBPACK_IMPORTED_MODULE_128__ = __webpack_require__(/*! ./setSeconds/index.js */ "./node_modules/date-fns/esm/setSeconds/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "setSeconds", function() { return _setSeconds_index_js__WEBPACK_IMPORTED_MODULE_128__["default"]; }); - -/* harmony import */ var _setWeek_index_js__WEBPACK_IMPORTED_MODULE_129__ = __webpack_require__(/*! ./setWeek/index.js */ "./node_modules/date-fns/esm/setWeek/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "setWeek", function() { return _setWeek_index_js__WEBPACK_IMPORTED_MODULE_129__["default"]; }); - -/* harmony import */ var _setWeekYear_index_js__WEBPACK_IMPORTED_MODULE_130__ = __webpack_require__(/*! ./setWeekYear/index.js */ "./node_modules/date-fns/esm/setWeekYear/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "setWeekYear", function() { return _setWeekYear_index_js__WEBPACK_IMPORTED_MODULE_130__["default"]; }); - -/* harmony import */ var _setYear_index_js__WEBPACK_IMPORTED_MODULE_131__ = __webpack_require__(/*! ./setYear/index.js */ "./node_modules/date-fns/esm/setYear/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "setYear", function() { return _setYear_index_js__WEBPACK_IMPORTED_MODULE_131__["default"]; }); - -/* harmony import */ var _startOfDay_index_js__WEBPACK_IMPORTED_MODULE_132__ = __webpack_require__(/*! ./startOfDay/index.js */ "./node_modules/date-fns/esm/startOfDay/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "startOfDay", function() { return _startOfDay_index_js__WEBPACK_IMPORTED_MODULE_132__["default"]; }); - -/* harmony import */ var _startOfDecade_index_js__WEBPACK_IMPORTED_MODULE_133__ = __webpack_require__(/*! ./startOfDecade/index.js */ "./node_modules/date-fns/esm/startOfDecade/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "startOfDecade", function() { return _startOfDecade_index_js__WEBPACK_IMPORTED_MODULE_133__["default"]; }); - -/* harmony import */ var _startOfHour_index_js__WEBPACK_IMPORTED_MODULE_134__ = __webpack_require__(/*! ./startOfHour/index.js */ "./node_modules/date-fns/esm/startOfHour/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "startOfHour", function() { return _startOfHour_index_js__WEBPACK_IMPORTED_MODULE_134__["default"]; }); - -/* harmony import */ var _startOfISOWeek_index_js__WEBPACK_IMPORTED_MODULE_135__ = __webpack_require__(/*! ./startOfISOWeek/index.js */ "./node_modules/date-fns/esm/startOfISOWeek/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "startOfISOWeek", function() { return _startOfISOWeek_index_js__WEBPACK_IMPORTED_MODULE_135__["default"]; }); - -/* harmony import */ var _startOfISOWeekYear_index_js__WEBPACK_IMPORTED_MODULE_136__ = __webpack_require__(/*! ./startOfISOWeekYear/index.js */ "./node_modules/date-fns/esm/startOfISOWeekYear/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "startOfISOWeekYear", function() { return _startOfISOWeekYear_index_js__WEBPACK_IMPORTED_MODULE_136__["default"]; }); - -/* harmony import */ var _startOfMinute_index_js__WEBPACK_IMPORTED_MODULE_137__ = __webpack_require__(/*! ./startOfMinute/index.js */ "./node_modules/date-fns/esm/startOfMinute/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "startOfMinute", function() { return _startOfMinute_index_js__WEBPACK_IMPORTED_MODULE_137__["default"]; }); - -/* harmony import */ var _startOfMonth_index_js__WEBPACK_IMPORTED_MODULE_138__ = __webpack_require__(/*! ./startOfMonth/index.js */ "./node_modules/date-fns/esm/startOfMonth/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "startOfMonth", function() { return _startOfMonth_index_js__WEBPACK_IMPORTED_MODULE_138__["default"]; }); - -/* harmony import */ var _startOfQuarter_index_js__WEBPACK_IMPORTED_MODULE_139__ = __webpack_require__(/*! ./startOfQuarter/index.js */ "./node_modules/date-fns/esm/startOfQuarter/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "startOfQuarter", function() { return _startOfQuarter_index_js__WEBPACK_IMPORTED_MODULE_139__["default"]; }); - -/* harmony import */ var _startOfSecond_index_js__WEBPACK_IMPORTED_MODULE_140__ = __webpack_require__(/*! ./startOfSecond/index.js */ "./node_modules/date-fns/esm/startOfSecond/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "startOfSecond", function() { return _startOfSecond_index_js__WEBPACK_IMPORTED_MODULE_140__["default"]; }); - -/* harmony import */ var _startOfWeek_index_js__WEBPACK_IMPORTED_MODULE_141__ = __webpack_require__(/*! ./startOfWeek/index.js */ "./node_modules/date-fns/esm/startOfWeek/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "startOfWeek", function() { return _startOfWeek_index_js__WEBPACK_IMPORTED_MODULE_141__["default"]; }); - -/* harmony import */ var _startOfWeekYear_index_js__WEBPACK_IMPORTED_MODULE_142__ = __webpack_require__(/*! ./startOfWeekYear/index.js */ "./node_modules/date-fns/esm/startOfWeekYear/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "startOfWeekYear", function() { return _startOfWeekYear_index_js__WEBPACK_IMPORTED_MODULE_142__["default"]; }); - -/* harmony import */ var _startOfYear_index_js__WEBPACK_IMPORTED_MODULE_143__ = __webpack_require__(/*! ./startOfYear/index.js */ "./node_modules/date-fns/esm/startOfYear/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "startOfYear", function() { return _startOfYear_index_js__WEBPACK_IMPORTED_MODULE_143__["default"]; }); - -/* harmony import */ var _subDays_index_js__WEBPACK_IMPORTED_MODULE_144__ = __webpack_require__(/*! ./subDays/index.js */ "./node_modules/date-fns/esm/subDays/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "subDays", function() { return _subDays_index_js__WEBPACK_IMPORTED_MODULE_144__["default"]; }); - -/* harmony import */ var _subHours_index_js__WEBPACK_IMPORTED_MODULE_145__ = __webpack_require__(/*! ./subHours/index.js */ "./node_modules/date-fns/esm/subHours/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "subHours", function() { return _subHours_index_js__WEBPACK_IMPORTED_MODULE_145__["default"]; }); - -/* harmony import */ var _subISOWeekYears_index_js__WEBPACK_IMPORTED_MODULE_146__ = __webpack_require__(/*! ./subISOWeekYears/index.js */ "./node_modules/date-fns/esm/subISOWeekYears/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "subISOWeekYears", function() { return _subISOWeekYears_index_js__WEBPACK_IMPORTED_MODULE_146__["default"]; }); - -/* harmony import */ var _subMilliseconds_index_js__WEBPACK_IMPORTED_MODULE_147__ = __webpack_require__(/*! ./subMilliseconds/index.js */ "./node_modules/date-fns/esm/subMilliseconds/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "subMilliseconds", function() { return _subMilliseconds_index_js__WEBPACK_IMPORTED_MODULE_147__["default"]; }); - -/* harmony import */ var _subMinutes_index_js__WEBPACK_IMPORTED_MODULE_148__ = __webpack_require__(/*! ./subMinutes/index.js */ "./node_modules/date-fns/esm/subMinutes/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "subMinutes", function() { return _subMinutes_index_js__WEBPACK_IMPORTED_MODULE_148__["default"]; }); - -/* harmony import */ var _subMonths_index_js__WEBPACK_IMPORTED_MODULE_149__ = __webpack_require__(/*! ./subMonths/index.js */ "./node_modules/date-fns/esm/subMonths/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "subMonths", function() { return _subMonths_index_js__WEBPACK_IMPORTED_MODULE_149__["default"]; }); - -/* harmony import */ var _subQuarters_index_js__WEBPACK_IMPORTED_MODULE_150__ = __webpack_require__(/*! ./subQuarters/index.js */ "./node_modules/date-fns/esm/subQuarters/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "subQuarters", function() { return _subQuarters_index_js__WEBPACK_IMPORTED_MODULE_150__["default"]; }); - -/* harmony import */ var _subSeconds_index_js__WEBPACK_IMPORTED_MODULE_151__ = __webpack_require__(/*! ./subSeconds/index.js */ "./node_modules/date-fns/esm/subSeconds/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "subSeconds", function() { return _subSeconds_index_js__WEBPACK_IMPORTED_MODULE_151__["default"]; }); - -/* harmony import */ var _subWeeks_index_js__WEBPACK_IMPORTED_MODULE_152__ = __webpack_require__(/*! ./subWeeks/index.js */ "./node_modules/date-fns/esm/subWeeks/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "subWeeks", function() { return _subWeeks_index_js__WEBPACK_IMPORTED_MODULE_152__["default"]; }); - -/* harmony import */ var _subYears_index_js__WEBPACK_IMPORTED_MODULE_153__ = __webpack_require__(/*! ./subYears/index.js */ "./node_modules/date-fns/esm/subYears/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "subYears", function() { return _subYears_index_js__WEBPACK_IMPORTED_MODULE_153__["default"]; }); - -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_154__ = __webpack_require__(/*! ./toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "toDate", function() { return _toDate_index_js__WEBPACK_IMPORTED_MODULE_154__["default"]; }); - -// This file is generated automatically by `scripts/build/indices.js`. Please, don't change it. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -/***/ }), - -/***/ "./node_modules/date-fns/esm/isAfter/index.js": -/*!****************************************************!*\ - !*** ./node_modules/date-fns/esm/isAfter/index.js ***! - \****************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return isAfter; }); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); - -/** - * @name isAfter - * @category Common Helpers - * @summary Is the first date after the second one? - * - * @description - * Is the first date after the second one? - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} date - the date that should be after the other one to return true - * @param {Date|Number} dateToCompare - the date to compare with - * @returns {Boolean} the first date is after the second date - * @throws {TypeError} 2 arguments required - * - * @example - * // Is 10 July 1989 after 11 February 1987? - * var result = isAfter(new Date(1989, 6, 10), new Date(1987, 1, 11)) - * //=> true - */ - -function isAfter(dirtyDate, dirtyDateToCompare) { - if (arguments.length < 2) { - throw new TypeError('2 arguments required, but only ' + arguments.length + ' present'); - } - - var date = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDate); - var dateToCompare = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDateToCompare); - return date.getTime() > dateToCompare.getTime(); -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/isBefore/index.js": -/*!*****************************************************!*\ - !*** ./node_modules/date-fns/esm/isBefore/index.js ***! - \*****************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return isBefore; }); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); - -/** - * @name isBefore - * @category Common Helpers - * @summary Is the first date before the second one? - * - * @description - * Is the first date before the second one? - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} date - the date that should be before the other one to return true - * @param {Date|Number} dateToCompare - the date to compare with - * @returns {Boolean} the first date is before the second date - * @throws {TypeError} 2 arguments required - * - * @example - * // Is 10 July 1989 before 11 February 1987? - * var result = isBefore(new Date(1989, 6, 10), new Date(1987, 1, 11)) - * //=> false - */ - -function isBefore(dirtyDate, dirtyDateToCompare) { - if (arguments.length < 2) { - throw new TypeError('2 arguments required, but only ' + arguments.length + ' present'); - } - - var date = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDate); - var dateToCompare = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDateToCompare); - return date.getTime() < dateToCompare.getTime(); -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/isDate/index.js": -/*!***************************************************!*\ - !*** ./node_modules/date-fns/esm/isDate/index.js ***! - \***************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return isDate; }); -/** - * @name isDate - * @category Common Helpers - * @summary Is the given value a date? - * - * @description - * Returns true if the given value is an instance of Date. The function works for dates transferred across iframes. - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {*} value - the value to check - * @returns {boolean} true if the given value is a date - * @throws {TypeError} 1 arguments required - * - * @example - * // For a valid date: - * var result = isDate(new Date()) - * //=> true - * - * @example - * // For an invalid date: - * var result = isDate(new Date(NaN)) - * //=> true - * - * @example - * // For some value: - * var result = isDate('2014-02-31') - * //=> false - * - * @example - * // For an object: - * var result = isDate({}) - * //=> false - */ -function isDate(value) { - if (arguments.length < 1) { - throw new TypeError('1 argument required, but only ' + arguments.length + ' present'); - } - - return value instanceof Date || typeof value === 'object' && Object.prototype.toString.call(value) === '[object Date]'; -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/isEqual/index.js": -/*!****************************************************!*\ - !*** ./node_modules/date-fns/esm/isEqual/index.js ***! - \****************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return isEqual; }); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); - -/** - * @name isEqual - * @category Common Helpers - * @summary Are the given dates equal? - * - * @description - * Are the given dates equal? - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} dateLeft - the first date to compare - * @param {Date|Number} dateRight - the second date to compare - * @returns {Boolean} the dates are equal - * @throws {TypeError} 2 arguments required - * - * @example - * // Are 2 July 2014 06:30:45.000 and 2 July 2014 06:30:45.500 equal? - * var result = isEqual( - * new Date(2014, 6, 2, 6, 30, 45, 0), - * new Date(2014, 6, 2, 6, 30, 45, 500) - * ) - * //=> false - */ - -function isEqual(dirtyLeftDate, dirtyRightDate) { - if (arguments.length < 2) { - throw new TypeError('2 arguments required, but only ' + arguments.length + ' present'); - } - - var dateLeft = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyLeftDate); - var dateRight = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyRightDate); - return dateLeft.getTime() === dateRight.getTime(); -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/isFirstDayOfMonth/index.js": -/*!**************************************************************!*\ - !*** ./node_modules/date-fns/esm/isFirstDayOfMonth/index.js ***! - \**************************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return isFirstDayOfMonth; }); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); - -/** - * @name isFirstDayOfMonth - * @category Month Helpers - * @summary Is the given date the first day of a month? - * - * @description - * Is the given date the first day of a month? - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} date - the date to check - * @returns {Boolean} the date is the first day of a month - * @throws {TypeError} 1 argument required - * - * @example - * // Is 1 September 2014 the first day of a month? - * var result = isFirstDayOfMonth(new Date(2014, 8, 1)) - * //=> true - */ - -function isFirstDayOfMonth(dirtyDate) { - if (arguments.length < 1) { - throw new TypeError('1 argument required, but only ' + arguments.length + ' present'); - } - - return Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDate).getDate() === 1; -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/isFriday/index.js": -/*!*****************************************************!*\ - !*** ./node_modules/date-fns/esm/isFriday/index.js ***! - \*****************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return isFriday; }); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); - -/** - * @name isFriday - * @category Weekday Helpers - * @summary Is the given date Friday? - * - * @description - * Is the given date Friday? - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} date - the date to check - * @returns {Boolean} the date is Friday - * @throws {TypeError} 1 argument required - * - * @example - * // Is 26 September 2014 Friday? - * var result = isFriday(new Date(2014, 8, 26)) - * //=> true - */ - -function isFriday(dirtyDate) { - if (arguments.length < 1) { - throw new TypeError('1 argument required, but only ' + arguments.length + ' present'); - } - - return Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDate).getDay() === 5; -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/isLastDayOfMonth/index.js": -/*!*************************************************************!*\ - !*** ./node_modules/date-fns/esm/isLastDayOfMonth/index.js ***! - \*************************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return isLastDayOfMonth; }); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); -/* harmony import */ var _endOfDay_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../endOfDay/index.js */ "./node_modules/date-fns/esm/endOfDay/index.js"); -/* harmony import */ var _endOfMonth_index_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../endOfMonth/index.js */ "./node_modules/date-fns/esm/endOfMonth/index.js"); - - - -/** - * @name isLastDayOfMonth - * @category Month Helpers - * @summary Is the given date the last day of a month? - * - * @description - * Is the given date the last day of a month? - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} date - the date to check - * @returns {Boolean} the date is the last day of a month - * @throws {TypeError} 1 argument required - * - * @example - * // Is 28 February 2014 the last day of a month? - * var result = isLastDayOfMonth(new Date(2014, 1, 28)) - * //=> true - */ - -function isLastDayOfMonth(dirtyDate) { - if (arguments.length < 1) { - throw new TypeError('1 argument required, but only ' + arguments.length + ' present'); - } - - var date = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDate); - return Object(_endOfDay_index_js__WEBPACK_IMPORTED_MODULE_1__["default"])(date).getTime() === Object(_endOfMonth_index_js__WEBPACK_IMPORTED_MODULE_2__["default"])(date).getTime(); -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/isLeapYear/index.js": -/*!*******************************************************!*\ - !*** ./node_modules/date-fns/esm/isLeapYear/index.js ***! - \*******************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return isLeapYear; }); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); - -/** - * @name isLeapYear - * @category Year Helpers - * @summary Is the given date in the leap year? - * - * @description - * Is the given date in the leap year? - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} date - the date to check - * @returns {Boolean} the date is in the leap year - * @throws {TypeError} 1 argument required - * - * @example - * // Is 1 September 2012 in the leap year? - * var result = isLeapYear(new Date(2012, 8, 1)) - * //=> true - */ - -function isLeapYear(dirtyDate) { - if (arguments.length < 1) { - throw new TypeError('1 argument required, but only ' + arguments.length + ' present'); - } - - var date = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDate); - var year = date.getFullYear(); - return year % 400 === 0 || year % 4 === 0 && year % 100 !== 0; -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/isMonday/index.js": -/*!*****************************************************!*\ - !*** ./node_modules/date-fns/esm/isMonday/index.js ***! - \*****************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return isMonday; }); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); - -/** - * @name isMonday - * @category Weekday Helpers - * @summary Is the given date Monday? - * - * @description - * Is the given date Monday? - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} date - the date to check - * @returns {Boolean} the date is Monday - * @throws {TypeError} 1 argument required - * - * @example - * // Is 22 September 2014 Monday? - * var result = isMonday(new Date(2014, 8, 22)) - * //=> true - */ - -function isMonday(dirtyDate) { - if (arguments.length < 1) { - throw new TypeError('1 argument required, but only ' + arguments.length + ' present'); - } - - return Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDate).getDay() === 1; -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/isSameDay/index.js": -/*!******************************************************!*\ - !*** ./node_modules/date-fns/esm/isSameDay/index.js ***! - \******************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return isSameDay; }); -/* harmony import */ var _startOfDay_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../startOfDay/index.js */ "./node_modules/date-fns/esm/startOfDay/index.js"); - -/** - * @name isSameDay - * @category Day Helpers - * @summary Are the given dates in the same day? - * - * @description - * Are the given dates in the same day? - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} dateLeft - the first date to check - * @param {Date|Number} dateRight - the second date to check - * @returns {Boolean} the dates are in the same day - * @throws {TypeError} 2 arguments required - * - * @example - * // Are 4 September 06:00:00 and 4 September 18:00:00 in the same day? - * var result = isSameDay(new Date(2014, 8, 4, 6, 0), new Date(2014, 8, 4, 18, 0)) - * //=> true - */ - -function isSameDay(dirtyDateLeft, dirtyDateRight) { - if (arguments.length < 2) { - throw new TypeError('2 arguments required, but only ' + arguments.length + ' present'); - } - - var dateLeftStartOfDay = Object(_startOfDay_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDateLeft); - var dateRightStartOfDay = Object(_startOfDay_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDateRight); - return dateLeftStartOfDay.getTime() === dateRightStartOfDay.getTime(); -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/isSameHour/index.js": -/*!*******************************************************!*\ - !*** ./node_modules/date-fns/esm/isSameHour/index.js ***! - \*******************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return isSameHour; }); -/* harmony import */ var _startOfHour_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../startOfHour/index.js */ "./node_modules/date-fns/esm/startOfHour/index.js"); - -/** - * @name isSameHour - * @category Hour Helpers - * @summary Are the given dates in the same hour? - * - * @description - * Are the given dates in the same hour? - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} dateLeft - the first date to check - * @param {Date|Number} dateRight - the second date to check - * @returns {Boolean} the dates are in the same hour - * @throws {TypeError} 2 arguments required - * - * @example - * // Are 4 September 2014 06:00:00 and 4 September 06:30:00 in the same hour? - * var result = isSameHour(new Date(2014, 8, 4, 6, 0), new Date(2014, 8, 4, 6, 30)) - * //=> true - */ - -function isSameHour(dirtyDateLeft, dirtyDateRight) { - if (arguments.length < 2) { - throw new TypeError('2 arguments required, but only ' + arguments.length + ' present'); - } - - var dateLeftStartOfHour = Object(_startOfHour_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDateLeft); - var dateRightStartOfHour = Object(_startOfHour_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDateRight); - return dateLeftStartOfHour.getTime() === dateRightStartOfHour.getTime(); -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/isSameISOWeek/index.js": -/*!**********************************************************!*\ - !*** ./node_modules/date-fns/esm/isSameISOWeek/index.js ***! - \**********************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return isSameISOWeek; }); -/* harmony import */ var _isSameWeek_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../isSameWeek/index.js */ "./node_modules/date-fns/esm/isSameWeek/index.js"); - -/** - * @name isSameISOWeek - * @category ISO Week Helpers - * @summary Are the given dates in the same ISO week? - * - * @description - * Are the given dates in the same ISO week? - * - * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} dateLeft - the first date to check - * @param {Date|Number} dateRight - the second date to check - * @returns {Boolean} the dates are in the same ISO week - * @throws {TypeError} 2 arguments required - * - * @example - * // Are 1 September 2014 and 7 September 2014 in the same ISO week? - * var result = isSameISOWeek(new Date(2014, 8, 1), new Date(2014, 8, 7)) - * //=> true - */ - -function isSameISOWeek(dirtyDateLeft, dirtyDateRight) { - if (arguments.length < 2) { - throw new TypeError('2 arguments required, but only ' + arguments.length + ' present'); - } - - return Object(_isSameWeek_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDateLeft, dirtyDateRight, { - weekStartsOn: 1 - }); -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/isSameISOWeekYear/index.js": -/*!**************************************************************!*\ - !*** ./node_modules/date-fns/esm/isSameISOWeekYear/index.js ***! - \**************************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return isSameISOWeekYear; }); -/* harmony import */ var _startOfISOWeekYear_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../startOfISOWeekYear/index.js */ "./node_modules/date-fns/esm/startOfISOWeekYear/index.js"); - -/** - * @name isSameISOWeekYear - * @category ISO Week-Numbering Year Helpers - * @summary Are the given dates in the same ISO week-numbering year? - * - * @description - * Are the given dates in the same ISO week-numbering year? - * - * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * - The function was renamed from `isSameISOYear` to `isSameISOWeekYear`. - * "ISO week year" is short for [ISO week-numbering year](https://en.wikipedia.org/wiki/ISO_week_date). - * This change makes the name consistent with - * locale-dependent week-numbering year helpers, e.g., `getWeekYear`. - * - * @param {Date|Number} dateLeft - the first date to check - * @param {Date|Number} dateRight - the second date to check - * @returns {Boolean} the dates are in the same ISO week-numbering year - * @throws {TypeError} 2 arguments required - * - * @example - * // Are 29 December 2003 and 2 January 2005 in the same ISO week-numbering year? - * var result = isSameISOWeekYear(new Date(2003, 11, 29), new Date(2005, 0, 2)) - * //=> true - */ - -function isSameISOWeekYear(dirtyDateLeft, dirtyDateRight) { - if (arguments.length < 2) { - throw new TypeError('2 arguments required, but only ' + arguments.length + ' present'); - } - - var dateLeftStartOfYear = Object(_startOfISOWeekYear_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDateLeft); - var dateRightStartOfYear = Object(_startOfISOWeekYear_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDateRight); - return dateLeftStartOfYear.getTime() === dateRightStartOfYear.getTime(); -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/isSameMinute/index.js": -/*!*********************************************************!*\ - !*** ./node_modules/date-fns/esm/isSameMinute/index.js ***! - \*********************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return isSameMinute; }); -/* harmony import */ var _startOfMinute_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../startOfMinute/index.js */ "./node_modules/date-fns/esm/startOfMinute/index.js"); - -/** - * @name isSameMinute - * @category Minute Helpers - * @summary Are the given dates in the same minute? - * - * @description - * Are the given dates in the same minute? - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} dateLeft - the first date to check - * @param {Date|Number} dateRight - the second date to check - * @returns {Boolean} the dates are in the same minute - * @throws {TypeError} 2 arguments required - * - * @example - * // Are 4 September 2014 06:30:00 and 4 September 2014 06:30:15 - * // in the same minute? - * var result = isSameMinute( - * new Date(2014, 8, 4, 6, 30), - * new Date(2014, 8, 4, 6, 30, 15) - * ) - * //=> true - */ - -function isSameMinute(dirtyDateLeft, dirtyDateRight) { - if (arguments.length < 2) { - throw new TypeError('2 arguments required, but only ' + arguments.length + ' present'); - } - - var dateLeftStartOfMinute = Object(_startOfMinute_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDateLeft); - var dateRightStartOfMinute = Object(_startOfMinute_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDateRight); - return dateLeftStartOfMinute.getTime() === dateRightStartOfMinute.getTime(); -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/isSameMonth/index.js": -/*!********************************************************!*\ - !*** ./node_modules/date-fns/esm/isSameMonth/index.js ***! - \********************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return isSameMonth; }); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); - -/** - * @name isSameMonth - * @category Month Helpers - * @summary Are the given dates in the same month? - * - * @description - * Are the given dates in the same month? - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} dateLeft - the first date to check - * @param {Date|Number} dateRight - the second date to check - * @returns {Boolean} the dates are in the same month - * @throws {TypeError} 2 arguments required - * - * @example - * // Are 2 September 2014 and 25 September 2014 in the same month? - * var result = isSameMonth(new Date(2014, 8, 2), new Date(2014, 8, 25)) - * //=> true - */ - -function isSameMonth(dirtyDateLeft, dirtyDateRight) { - if (arguments.length < 2) { - throw new TypeError('2 arguments required, but only ' + arguments.length + ' present'); - } - - var dateLeft = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDateLeft); - var dateRight = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDateRight); - return dateLeft.getFullYear() === dateRight.getFullYear() && dateLeft.getMonth() === dateRight.getMonth(); -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/isSameQuarter/index.js": -/*!**********************************************************!*\ - !*** ./node_modules/date-fns/esm/isSameQuarter/index.js ***! - \**********************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return isSameQuarter; }); -/* harmony import */ var _startOfQuarter_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../startOfQuarter/index.js */ "./node_modules/date-fns/esm/startOfQuarter/index.js"); - -/** - * @name isSameQuarter - * @category Quarter Helpers - * @summary Are the given dates in the same year quarter? - * - * @description - * Are the given dates in the same year quarter? - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} dateLeft - the first date to check - * @param {Date|Number} dateRight - the second date to check - * @returns {Boolean} the dates are in the same quarter - * @throws {TypeError} 2 arguments required - * - * @example - * // Are 1 January 2014 and 8 March 2014 in the same quarter? - * var result = isSameQuarter(new Date(2014, 0, 1), new Date(2014, 2, 8)) - * //=> true - */ - -function isSameQuarter(dirtyDateLeft, dirtyDateRight) { - if (arguments.length < 2) { - throw new TypeError('2 arguments required, but only ' + arguments.length + ' present'); - } - - var dateLeftStartOfQuarter = Object(_startOfQuarter_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDateLeft); - var dateRightStartOfQuarter = Object(_startOfQuarter_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDateRight); - return dateLeftStartOfQuarter.getTime() === dateRightStartOfQuarter.getTime(); -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/isSameSecond/index.js": -/*!*********************************************************!*\ - !*** ./node_modules/date-fns/esm/isSameSecond/index.js ***! - \*********************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return isSameSecond; }); -/* harmony import */ var _startOfSecond_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../startOfSecond/index.js */ "./node_modules/date-fns/esm/startOfSecond/index.js"); - -/** - * @name isSameSecond - * @category Second Helpers - * @summary Are the given dates in the same second? - * - * @description - * Are the given dates in the same second? - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} dateLeft - the first date to check - * @param {Date|Number} dateRight - the second date to check - * @returns {Boolean} the dates are in the same second - * @throws {TypeError} 2 arguments required - * - * @example - * // Are 4 September 2014 06:30:15.000 and 4 September 2014 06:30.15.500 - * // in the same second? - * var result = isSameSecond( - * new Date(2014, 8, 4, 6, 30, 15), - * new Date(2014, 8, 4, 6, 30, 15, 500) - * ) - * //=> true - */ - -function isSameSecond(dirtyDateLeft, dirtyDateRight) { - if (arguments.length < 2) { - throw new TypeError('2 arguments required, but only ' + arguments.length + ' present'); - } - - var dateLeftStartOfSecond = Object(_startOfSecond_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDateLeft); - var dateRightStartOfSecond = Object(_startOfSecond_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDateRight); - return dateLeftStartOfSecond.getTime() === dateRightStartOfSecond.getTime(); -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/isSameWeek/index.js": -/*!*******************************************************!*\ - !*** ./node_modules/date-fns/esm/isSameWeek/index.js ***! - \*******************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return isSameWeek; }); -/* harmony import */ var _startOfWeek_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../startOfWeek/index.js */ "./node_modules/date-fns/esm/startOfWeek/index.js"); - -/** - * @name isSameWeek - * @category Week Helpers - * @summary Are the given dates in the same week? - * - * @description - * Are the given dates in the same week? - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} dateLeft - the first date to check - * @param {Date|Number} dateRight - the second date to check - * @param {Object} [options] - an object with options. - * @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday) - * @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale} - * @returns {Boolean} the dates are in the same week - * @throws {TypeError} 2 arguments required - * @throws {RangeError} `options.weekStartsOn` must be between 0 and 6 - * - * @example - * // Are 31 August 2014 and 4 September 2014 in the same week? - * var result = isSameWeek(new Date(2014, 7, 31), new Date(2014, 8, 4)) - * //=> true - * - * @example - * // If week starts with Monday, - * // are 31 August 2014 and 4 September 2014 in the same week? - * var result = isSameWeek(new Date(2014, 7, 31), new Date(2014, 8, 4), { - * weekStartsOn: 1 - * }) - * //=> false - */ - -function isSameWeek(dirtyDateLeft, dirtyDateRight, dirtyOptions) { - if (arguments.length < 2) { - throw new TypeError('2 arguments required, but only ' + arguments.length + ' present'); - } - - var dateLeftStartOfWeek = Object(_startOfWeek_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDateLeft, dirtyOptions); - var dateRightStartOfWeek = Object(_startOfWeek_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDateRight, dirtyOptions); - return dateLeftStartOfWeek.getTime() === dateRightStartOfWeek.getTime(); -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/isSameYear/index.js": -/*!*******************************************************!*\ - !*** ./node_modules/date-fns/esm/isSameYear/index.js ***! - \*******************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return isSameYear; }); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); - -/** - * @name isSameYear - * @category Year Helpers - * @summary Are the given dates in the same year? - * - * @description - * Are the given dates in the same year? - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} dateLeft - the first date to check - * @param {Date|Number} dateRight - the second date to check - * @returns {Boolean} the dates are in the same year - * @throws {TypeError} 2 arguments required - * - * @example - * // Are 2 September 2014 and 25 September 2014 in the same year? - * var result = isSameYear(new Date(2014, 8, 2), new Date(2014, 8, 25)) - * //=> true - */ - -function isSameYear(dirtyDateLeft, dirtyDateRight) { - if (arguments.length < 2) { - throw new TypeError('2 arguments required, but only ' + arguments.length + ' present'); - } - - var dateLeft = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDateLeft); - var dateRight = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDateRight); - return dateLeft.getFullYear() === dateRight.getFullYear(); -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/isSaturday/index.js": -/*!*******************************************************!*\ - !*** ./node_modules/date-fns/esm/isSaturday/index.js ***! - \*******************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return isSaturday; }); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); - -/** - * @name isSaturday - * @category Weekday Helpers - * @summary Is the given date Saturday? - * - * @description - * Is the given date Saturday? - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} date - the date to check - * @returns {Boolean} the date is Saturday - * @throws {TypeError} 1 argument required - * - * @example - * // Is 27 September 2014 Saturday? - * var result = isSaturday(new Date(2014, 8, 27)) - * //=> true - */ - -function isSaturday(dirtyDate) { - if (arguments.length < 1) { - throw new TypeError('1 argument required, but only ' + arguments.length + ' present'); - } - - return Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDate).getDay() === 6; -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/isSunday/index.js": -/*!*****************************************************!*\ - !*** ./node_modules/date-fns/esm/isSunday/index.js ***! - \*****************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return isSunday; }); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); - -/** - * @name isSunday - * @category Weekday Helpers - * @summary Is the given date Sunday? - * - * @description - * Is the given date Sunday? - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} date - the date to check - * @returns {Boolean} the date is Sunday - * @throws {TypeError} 1 argument required - * - * @example - * // Is 21 September 2014 Sunday? - * var result = isSunday(new Date(2014, 8, 21)) - * //=> true - */ - -function isSunday(dirtyDate) { - if (arguments.length < 1) { - throw new TypeError('1 argument required, but only ' + arguments.length + ' present'); - } - - return Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDate).getDay() === 0; -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/isThursday/index.js": -/*!*******************************************************!*\ - !*** ./node_modules/date-fns/esm/isThursday/index.js ***! - \*******************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return isThursday; }); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); - -/** - * @name isThursday - * @category Weekday Helpers - * @summary Is the given date Thursday? - * - * @description - * Is the given date Thursday? - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} date - the date to check - * @returns {Boolean} the date is Thursday - * @throws {TypeError} 1 argument required - * - * @example - * // Is 25 September 2014 Thursday? - * var result = isThursday(new Date(2014, 8, 25)) - * //=> true - */ - -function isThursday(dirtyDate) { - if (arguments.length < 1) { - throw new TypeError('1 argument required, but only ' + arguments.length + ' present'); - } - - return Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDate).getDay() === 4; -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/isTuesday/index.js": -/*!******************************************************!*\ - !*** ./node_modules/date-fns/esm/isTuesday/index.js ***! - \******************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return isTuesday; }); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); - -/** - * @name isTuesday - * @category Weekday Helpers - * @summary Is the given date Tuesday? - * - * @description - * Is the given date Tuesday? - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} date - the date to check - * @returns {Boolean} the date is Tuesday - * @throws {TypeError} 1 argument required - * - * @example - * // Is 23 September 2014 Tuesday? - * var result = isTuesday(new Date(2014, 8, 23)) - * //=> true - */ - -function isTuesday(dirtyDate) { - if (arguments.length < 1) { - throw new TypeError('1 argument required, but only ' + arguments.length + ' present'); - } - - return Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDate).getDay() === 2; -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/isValid/index.js": -/*!****************************************************!*\ - !*** ./node_modules/date-fns/esm/isValid/index.js ***! - \****************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return isValid; }); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); - -/** - * @name isValid - * @category Common Helpers - * @summary Is the given date valid? - * - * @description - * Returns false if argument is Invalid Date and true otherwise. - * Argument is converted to Date using `toDate`. See [toDate]{@link https://date-fns.org/docs/toDate} - * Invalid Date is a Date, whose time value is NaN. - * - * Time value of Date: http://es5.github.io/#x15.9.1.1 - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * - Now `isValid` doesn't throw an exception - * if the first argument is not an instance of Date. - * Instead, argument is converted beforehand using `toDate`. - * - * Examples: - * - * | `isValid` argument | Before v2.0.0 | v2.0.0 onward | - * |---------------------------|---------------|---------------| - * | `new Date()` | `true` | `true` | - * | `new Date('2016-01-01')` | `true` | `true` | - * | `new Date('')` | `false` | `false` | - * | `new Date(1488370835081)` | `true` | `true` | - * | `new Date(NaN)` | `false` | `false` | - * | `'2016-01-01'` | `TypeError` | `true` | - * | `''` | `TypeError` | `false` | - * | `1488370835081` | `TypeError` | `true` | - * | `NaN` | `TypeError` | `false` | - * - * We introduce this change to make *date-fns* consistent with ECMAScript behavior - * that try to coerce arguments to the expected type - * (which is also the case with other *date-fns* functions). - * - * @param {*} date - the date to check - * @returns {Boolean} the date is valid - * @throws {TypeError} 1 argument required - * - * @example - * // For the valid date: - * var result = isValid(new Date(2014, 1, 31)) - * //=> true - * - * @example - * // For the value, convertable into a date: - * var result = isValid(1393804800000) - * //=> true - * - * @example - * // For the invalid date: - * var result = isValid(new Date('')) - * //=> false - */ - -function isValid(dirtyDate) { - if (arguments.length < 1) { - throw new TypeError('1 argument required, but only ' + arguments.length + ' present'); - } - - var date = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDate); - return !isNaN(date); -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/isWednesday/index.js": -/*!********************************************************!*\ - !*** ./node_modules/date-fns/esm/isWednesday/index.js ***! - \********************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return isWednesday; }); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); - -/** - * @name isWednesday - * @category Weekday Helpers - * @summary Is the given date Wednesday? - * - * @description - * Is the given date Wednesday? - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} date - the date to check - * @returns {Boolean} the date is Wednesday - * @throws {TypeError} 1 argument required - * - * @example - * // Is 24 September 2014 Wednesday? - * var result = isWednesday(new Date(2014, 8, 24)) - * //=> true - */ - -function isWednesday(dirtyDate) { - if (arguments.length < 1) { - throw new TypeError('1 argument required, but only ' + arguments.length + ' present'); - } - - return Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDate).getDay() === 3; -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/isWeekend/index.js": -/*!******************************************************!*\ - !*** ./node_modules/date-fns/esm/isWeekend/index.js ***! - \******************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return isWeekend; }); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); - -/** - * @name isWeekend - * @category Weekday Helpers - * @summary Does the given date fall on a weekend? - * - * @description - * Does the given date fall on a weekend? - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} date - the date to check - * @returns {Boolean} the date falls on a weekend - * @throws {TypeError} 1 argument required - * - * @example - * // Does 5 October 2014 fall on a weekend? - * var result = isWeekend(new Date(2014, 9, 5)) - * //=> true - */ - -function isWeekend(dirtyDate) { - if (arguments.length < 1) { - throw new TypeError('1 argument required, but only ' + arguments.length + ' present'); - } - - var date = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDate); - var day = date.getDay(); - return day === 0 || day === 6; -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/isWithinInterval/index.js": -/*!*************************************************************!*\ - !*** ./node_modules/date-fns/esm/isWithinInterval/index.js ***! - \*************************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return isWithinInterval; }); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); - -/** - * @name isWithinInterval - * @category Interval Helpers - * @summary Is the given date within the interval? - * - * @description - * Is the given date within the interval? - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * - The function was renamed from `isWithinRange` to `isWithinInterval`. - * This change was made to mirror the use of the word "interval" in standard ISO 8601:2004 terminology: - * - * ``` - * 2.1.3 - * time interval - * part of the time axis limited by two instants - * ``` - * - * Also, this function now accepts an object with `start` and `end` properties - * instead of two arguments as an interval. - * This function now throws `RangeError` if the start of the interval is after its end - * or if any date in the interval is `Invalid Date`. - * - * ```javascript - * // Before v2.0.0 - * - * isWithinRange( - * new Date(2014, 0, 3), - * new Date(2014, 0, 1), new Date(2014, 0, 7) - * ) - * - * // v2.0.0 onward - * - * isWithinInterval( - * new Date(2014, 0, 3), - * { start: new Date(2014, 0, 1), end: new Date(2014, 0, 7) } - * ) - * ``` - * - * @param {Date|Number} date - the date to check - * @param {Interval} interval - the interval to check - * @returns {Boolean} the date is within the interval - * @throws {TypeError} 2 arguments required - * @throws {RangeError} The start of an interval cannot be after its end - * @throws {RangeError} Date in interval cannot be `Invalid Date` - * - * @example - * // For the date within the interval: - * isWithinInterval(new Date(2014, 0, 3), { - * start: new Date(2014, 0, 1), - * end: new Date(2014, 0, 7) - * }) - * //=> true - * - * @example - * // For the date outside of the interval: - * isWithinInterval(new Date(2014, 0, 10), { - * start: new Date(2014, 0, 1), - * end: new Date(2014, 0, 7) - * }) - * //=> false - */ - -function isWithinInterval(dirtyDate, dirtyInterval) { - if (arguments.length < 2) { - throw new TypeError('2 arguments required, but only ' + arguments.length + ' present'); - } - - var interval = dirtyInterval || {}; - var time = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDate).getTime(); - var startTime = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(interval.start).getTime(); - var endTime = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(interval.end).getTime(); // Throw an exception if start date is after end date or if any date is `Invalid Date` - - if (!(startTime <= endTime)) { - throw new RangeError('Invalid interval'); - } - - return time >= startTime && time <= endTime; -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/lastDayOfDecade/index.js": -/*!************************************************************!*\ - !*** ./node_modules/date-fns/esm/lastDayOfDecade/index.js ***! - \************************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return lastDayOfDecade; }); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); - -/** - * @name lastDayOfDecade - * @category Decade Helpers - * @summary Return the last day of a decade for the given date. - * - * @description - * Return the last day of a decade for the given date. - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} date - the original date - * @returns {Date} the last day of a decade - * @throws {TypeError} 1 argument required - * - * @example - * // The last day of a decade for 21 December 2012 21:12:00: - * var result = lastDayOfDecade(new Date(2012, 11, 21, 21, 12, 00)) - * //=> Wed Dec 31 2019 00:00:00 - */ - -function lastDayOfDecade(dirtyDate) { - if (arguments.length < 1) { - throw new TypeError('1 argument required, but only ' + arguments.length + ' present'); - } - - var date = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDate); - var year = date.getFullYear(); - var decade = 9 + Math.floor(year / 10) * 10; - date.setFullYear(decade + 1, 0, 0); - date.setHours(0, 0, 0, 0); - return date; -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/lastDayOfISOWeek/index.js": -/*!*************************************************************!*\ - !*** ./node_modules/date-fns/esm/lastDayOfISOWeek/index.js ***! - \*************************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return lastDayOfISOWeek; }); -/* harmony import */ var _lastDayOfWeek_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../lastDayOfWeek/index.js */ "./node_modules/date-fns/esm/lastDayOfWeek/index.js"); - -/** - * @name lastDayOfISOWeek - * @category ISO Week Helpers - * @summary Return the last day of an ISO week for the given date. - * - * @description - * Return the last day of an ISO week for the given date. - * The result will be in the local timezone. - * - * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} date - the original date - * @returns {Date} the last day of an ISO week - * @throws {TypeError} 1 argument required - * - * @example - * // The last day of an ISO week for 2 September 2014 11:55:00: - * var result = lastDayOfISOWeek(new Date(2014, 8, 2, 11, 55, 0)) - * //=> Sun Sep 07 2014 00:00:00 - */ - -function lastDayOfISOWeek(dirtyDate) { - if (arguments.length < 1) { - throw new TypeError('1 argument required, but only ' + arguments.length + ' present'); - } - - return Object(_lastDayOfWeek_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDate, { - weekStartsOn: 1 - }); -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/lastDayOfISOWeekYear/index.js": -/*!*****************************************************************!*\ - !*** ./node_modules/date-fns/esm/lastDayOfISOWeekYear/index.js ***! - \*****************************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return lastDayOfISOWeekYear; }); -/* harmony import */ var _getISOWeekYear_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../getISOWeekYear/index.js */ "./node_modules/date-fns/esm/getISOWeekYear/index.js"); -/* harmony import */ var _startOfISOWeek_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../startOfISOWeek/index.js */ "./node_modules/date-fns/esm/startOfISOWeek/index.js"); - - -/** - * @name lastDayOfISOWeekYear - * @category ISO Week-Numbering Year Helpers - * @summary Return the last day of an ISO week-numbering year for the given date. - * - * @description - * Return the last day of an ISO week-numbering year, - * which always starts 3 days before the year's first Thursday. - * The result will be in the local timezone. - * - * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * - The function was renamed from `lastDayOfISOYear` to `lastDayOfISOWeekYear`. - * "ISO week year" is short for [ISO week-numbering year](https://en.wikipedia.org/wiki/ISO_week_date). - * This change makes the name consistent with - * locale-dependent week-numbering year helpers, e.g., `getWeekYear`. - * - * @param {Date|Number} date - the original date - * @returns {Date} the end of an ISO week-numbering year - * @throws {TypeError} 1 argument required - * - * @example - * // The last day of an ISO week-numbering year for 2 July 2005: - * var result = lastDayOfISOWeekYear(new Date(2005, 6, 2)) - * //=> Sun Jan 01 2006 00:00:00 - */ - -function lastDayOfISOWeekYear(dirtyDate) { - if (arguments.length < 1) { - throw new TypeError('1 argument required, but only ' + arguments.length + ' present'); - } - - var year = Object(_getISOWeekYear_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDate); - var fourthOfJanuary = new Date(0); - fourthOfJanuary.setFullYear(year + 1, 0, 4); - fourthOfJanuary.setHours(0, 0, 0, 0); - var date = Object(_startOfISOWeek_index_js__WEBPACK_IMPORTED_MODULE_1__["default"])(fourthOfJanuary); - date.setDate(date.getDate() - 1); - return date; -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/lastDayOfMonth/index.js": -/*!***********************************************************!*\ - !*** ./node_modules/date-fns/esm/lastDayOfMonth/index.js ***! - \***********************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return lastDayOfMonth; }); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); - -/** - * @name lastDayOfMonth - * @category Month Helpers - * @summary Return the last day of a month for the given date. - * - * @description - * Return the last day of a month for the given date. - * The result will be in the local timezone. - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} date - the original date - * @returns {Date} the last day of a month - * @throws {TypeError} 1 argument required - * - * @example - * // The last day of a month for 2 September 2014 11:55:00: - * var result = lastDayOfMonth(new Date(2014, 8, 2, 11, 55, 0)) - * //=> Tue Sep 30 2014 00:00:00 - */ - -function lastDayOfMonth(dirtyDate) { - if (arguments.length < 1) { - throw new TypeError('1 argument required, but only ' + arguments.length + ' present'); - } - - var date = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDate); - var month = date.getMonth(); - date.setFullYear(date.getFullYear(), month + 1, 0); - date.setHours(0, 0, 0, 0); - return date; -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/lastDayOfQuarter/index.js": -/*!*************************************************************!*\ - !*** ./node_modules/date-fns/esm/lastDayOfQuarter/index.js ***! - \*************************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return lastDayOfQuarter; }); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); - -/** - * @name lastDayOfQuarter - * @category Quarter Helpers - * @summary Return the last day of a year quarter for the given date. - * - * @description - * Return the last day of a year quarter for the given date. - * The result will be in the local timezone. - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} date - the original date - * @param {Object} [options] - an object with options. - * @param {0|1|2} [options.additionalDigits=2] - passed to `toDate`. See [toDate]{@link https://date-fns.org/docs/toDate} - * @returns {Date} the last day of a quarter - * @throws {TypeError} 1 argument required - * @throws {RangeError} `options.additionalDigits` must be 0, 1 or 2 - * - * @example - * // The last day of a quarter for 2 September 2014 11:55:00: - * var result = lastDayOfQuarter(new Date(2014, 8, 2, 11, 55, 0)) - * //=> Tue Sep 30 2014 00:00:00 - */ - -function lastDayOfQuarter(dirtyDate) { - if (arguments.length < 1) { - throw new TypeError('1 argument required, but only ' + arguments.length + ' present'); - } - - var date = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDate); - var currentMonth = date.getMonth(); - var month = currentMonth - currentMonth % 3 + 3; - date.setMonth(month, 0); - date.setHours(0, 0, 0, 0); - return date; -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/lastDayOfWeek/index.js": -/*!**********************************************************!*\ - !*** ./node_modules/date-fns/esm/lastDayOfWeek/index.js ***! - \**********************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return lastDayOfWeek; }); -/* harmony import */ var _lib_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../_lib/toInteger/index.js */ "./node_modules/date-fns/esm/_lib/toInteger/index.js"); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); - - -/** - * @name lastDayOfWeek - * @category Week Helpers - * @summary Return the last day of a week for the given date. - * - * @description - * Return the last day of a week for the given date. - * The result will be in the local timezone. - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} date - the original date - * @param {Object} [options] - an object with options. - * @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday) - * @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale} - * @returns {Date} the last day of a week - * @throws {TypeError} 1 argument required - * @throws {RangeError} `options.weekStartsOn` must be between 0 and 6 - * - * @example - * // The last day of a week for 2 September 2014 11:55:00: - * var result = lastDayOfWeek(new Date(2014, 8, 2, 11, 55, 0)) - * //=> Sat Sep 06 2014 00:00:00 - * - * @example - * // If the week starts on Monday, the last day of the week for 2 September 2014 11:55:00: - * var result = lastDayOfWeek(new Date(2014, 8, 2, 11, 55, 0), { weekStartsOn: 1 }) - * //=> Sun Sep 07 2014 00:00:00 - */ - -function lastDayOfWeek(dirtyDate, dirtyOptions) { - if (arguments.length < 1) { - throw new TypeError('1 argument required, but only ' + arguments.length + ' present'); - } - - var options = dirtyOptions || {}; - var locale = options.locale; - var localeWeekStartsOn = locale && locale.options && locale.options.weekStartsOn; - var defaultWeekStartsOn = localeWeekStartsOn == null ? 0 : Object(_lib_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(localeWeekStartsOn); - var weekStartsOn = options.weekStartsOn == null ? defaultWeekStartsOn : Object(_lib_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(options.weekStartsOn); // Test if weekStartsOn is between 0 and 6 _and_ is not NaN - - if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) { - throw new RangeError('weekStartsOn must be between 0 and 6'); - } - - var date = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_1__["default"])(dirtyDate); - var day = date.getDay(); - var diff = (day < weekStartsOn ? -7 : 0) + 6 - (day - weekStartsOn); - date.setHours(0, 0, 0, 0); - date.setDate(date.getDate() + diff); - return date; -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/lastDayOfYear/index.js": -/*!**********************************************************!*\ - !*** ./node_modules/date-fns/esm/lastDayOfYear/index.js ***! - \**********************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return lastDayOfYear; }); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); - -/** - * @name lastDayOfYear - * @category Year Helpers - * @summary Return the last day of a year for the given date. - * - * @description - * Return the last day of a year for the given date. - * The result will be in the local timezone. - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} date - the original date - * @returns {Date} the last day of a year - * @throws {TypeError} 1 argument required - * - * @example - * // The last day of a year for 2 September 2014 11:55:00: - * var result = lastDayOfYear(new Date(2014, 8, 2, 11, 55, 00)) - * //=> Wed Dec 31 2014 00:00:00 - */ - -function lastDayOfYear(dirtyDate) { - if (arguments.length < 1) { - throw new TypeError('1 argument required, but only ' + arguments.length + ' present'); - } - - var date = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDate); - var year = date.getFullYear(); - date.setFullYear(year + 1, 0, 0); - date.setHours(0, 0, 0, 0); - return date; -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/lightFormat/index.js": -/*!********************************************************!*\ - !*** ./node_modules/date-fns/esm/lightFormat/index.js ***! - \********************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return lightFormat; }); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); -/* harmony import */ var _lib_format_lightFormatters_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../_lib/format/lightFormatters/index.js */ "./node_modules/date-fns/esm/_lib/format/lightFormatters/index.js"); -/* harmony import */ var _lib_getTimezoneOffsetInMilliseconds_index_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../_lib/getTimezoneOffsetInMilliseconds/index.js */ "./node_modules/date-fns/esm/_lib/getTimezoneOffsetInMilliseconds/index.js"); -/* harmony import */ var _isValid_index_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../isValid/index.js */ "./node_modules/date-fns/esm/isValid/index.js"); -/* harmony import */ var _subMilliseconds_index_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../subMilliseconds/index.js */ "./node_modules/date-fns/esm/subMilliseconds/index.js"); - - - - - // This RegExp consists of three parts separated by `|`: -// - (\w)\1* matches any sequences of the same letter -// - '' matches two quote characters in a row -// - '(''|[^'])+('|$) matches anything surrounded by two quote characters ('), -// except a single quote symbol, which ends the sequence. -// Two quote characters do not end the sequence. -// If there is no matching single quote -// then the sequence will continue until the end of the string. -// - . matches any single character unmatched by previous parts of the RegExps - -var formattingTokensRegExp = /(\w)\1*|''|'(''|[^'])+('|$)|./g; -var escapedStringRegExp = /^'(.*?)'?$/; -var doubleQuoteRegExp = /''/g; -/** - * @name lightFormat - * @category Common Helpers - * @summary Format the date. - * - * @description - * Return the formatted date string in the given format. Unlike `format`, - * `lightFormat` doesn't use locales and outputs date using the most popular tokens. - * - * > âš ï¸ Please note that the `lightFormat` tokens differ from Moment.js and other libraries. - * > See: https://git.io/fxCyr - * - * The characters wrapped between two single quotes characters (') are escaped. - * Two single quotes in a row, whether inside or outside a quoted sequence, represent a 'real' single quote. - * (see the last example) - * - * Format of the string is based on Unicode Technical Standard #35: - * https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table - * with a few additions (see note 7 below the table). - * - * Accepted patterns: - * | Unit | Pattern | Result examples | - * |---------------------------------|---------|-----------------------------------| - * | AM, PM | a..aaa | AM, PM | - * | | aaaa | a.m., p.m. | - * | | aaaaa | a, p | - * | Calendar year | y | 44, 1, 1900, 2017 | - * | | yy | 44, 01, 00, 17 | - * | | yyy | 044, 001, 000, 017 | - * | | yyyy | 0044, 0001, 1900, 2017 | - * | Month (formatting) | M | 1, 2, ..., 12 | - * | | MM | 01, 02, ..., 12 | - * | Day of month | d | 1, 2, ..., 31 | - * | | dd | 01, 02, ..., 31 | - * | Hour [1-12] | h | 1, 2, ..., 11, 12 | - * | | hh | 01, 02, ..., 11, 12 | - * | Hour [0-23] | H | 0, 1, 2, ..., 23 | - * | | HH | 00, 01, 02, ..., 23 | - * | Minute | m | 0, 1, ..., 59 | - * | | mm | 00, 01, ..., 59 | - * | Second | s | 0, 1, ..., 59 | - * | | ss | 00, 01, ..., 59 | - * | Timezone (ISO-8601 w/ Z) | X | -08, +0530, Z | - * | | XX | -0800, +0530, Z | - * | | XXX | -08:00, +05:30, Z | - * | | XXXX | -0800, +0530, Z, +123456 | - * | | XXXXX | -08:00, +05:30, Z, +12:34:56 | - * | Timezone (ISO-8601 w/o Z) | x | -08, +0530, +00 | - * | | xx | -0800, +0530, +0000 | - * | | xxx | -08:00, +05:30, +00:00 | - * | | xxxx | -0800, +0530, +0000, +123456 | - * | | xxxxx | -08:00, +05:30, +00:00, +12:34:56 | - * - * @param {Date|Number} date - the original date - * @param {String} format - the string of tokens - * @returns {String} the formatted date string - * @throws {TypeError} 2 arguments required - * - * @example - * var result = format(new Date(2014, 1, 11), 'yyyy-MM-dd') - * //=> '1987-02-11' - */ - -function lightFormat(dirtyDate, dirtyFormatStr) { - if (arguments.length < 2) { - throw new TypeError('2 arguments required, but only ' + arguments.length + ' present'); - } - - var formatStr = String(dirtyFormatStr); - var originalDate = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDate); - - if (!Object(_isValid_index_js__WEBPACK_IMPORTED_MODULE_3__["default"])(originalDate)) { - throw new RangeError('Invalid time value'); - } // Convert the date in system timezone to the same date in UTC+00:00 timezone. - // This ensures that when UTC functions will be implemented, locales will be compatible with them. - // See an issue about UTC functions: https://github.com/date-fns/date-fns/issues/376 - - - var timezoneOffset = Object(_lib_getTimezoneOffsetInMilliseconds_index_js__WEBPACK_IMPORTED_MODULE_2__["default"])(originalDate); - var utcDate = Object(_subMilliseconds_index_js__WEBPACK_IMPORTED_MODULE_4__["default"])(originalDate, timezoneOffset); - var result = formatStr.match(formattingTokensRegExp).map(function (substring) { - // Replace two single quote characters with one single quote character - if (substring === "''") { - return "'"; - } - - var firstCharacter = substring[0]; - - if (firstCharacter === "'") { - return cleanEscapedString(substring); - } - - var formatter = _lib_format_lightFormatters_index_js__WEBPACK_IMPORTED_MODULE_1__["default"][firstCharacter]; - - if (formatter) { - return formatter(utcDate, substring, null, {}); - } - - return substring; - }).join(''); - return result; -} - -function cleanEscapedString(input) { - return input.match(escapedStringRegExp)[1].replace(doubleQuoteRegExp, "'"); -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/locale/_lib/buildFormatLongFn/index.js": -/*!**************************************************************************!*\ - !*** ./node_modules/date-fns/esm/locale/_lib/buildFormatLongFn/index.js ***! - \**************************************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return buildFormatLongFn; }); -function buildFormatLongFn(args) { - return function (dirtyOptions) { - var options = dirtyOptions || {}; - var width = options.width ? String(options.width) : args.defaultWidth; - var format = args.formats[width] || args.formats[args.defaultWidth]; - return format; - }; -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/locale/_lib/buildLocalizeFn/index.js": -/*!************************************************************************!*\ - !*** ./node_modules/date-fns/esm/locale/_lib/buildLocalizeFn/index.js ***! - \************************************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return buildLocalizeFn; }); -function buildLocalizeFn(args) { - return function (dirtyIndex, dirtyOptions) { - var options = dirtyOptions || {}; - var width = options.width ? String(options.width) : args.defaultWidth; - var context = options.context ? String(options.context) : 'standalone'; - var valuesArray; - - if (context === 'formatting' && args.formattingValues) { - valuesArray = args.formattingValues[width] || args.formattingValues[args.defaultFormattingWidth]; - } else { - valuesArray = args.values[width] || args.values[args.defaultWidth]; - } - - var index = args.argumentCallback ? args.argumentCallback(dirtyIndex) : dirtyIndex; - return valuesArray[index]; - }; -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/locale/_lib/buildMatchFn/index.js": -/*!*********************************************************************!*\ - !*** ./node_modules/date-fns/esm/locale/_lib/buildMatchFn/index.js ***! - \*********************************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return buildMatchFn; }); -function buildMatchFn(args) { - return function (dirtyString, dirtyOptions) { - var string = String(dirtyString); - var options = dirtyOptions || {}; - var width = options.width; - var matchPattern = width && args.matchPatterns[width] || args.matchPatterns[args.defaultMatchWidth]; - var matchResult = string.match(matchPattern); - - if (!matchResult) { - return null; - } - - var matchedString = matchResult[0]; - var parsePatterns = width && args.parsePatterns[width] || args.parsePatterns[args.defaultParseWidth]; - var value; - - if (Object.prototype.toString.call(parsePatterns) === '[object Array]') { - value = parsePatterns.findIndex(function (pattern) { - return pattern.test(string); - }); - } else { - value = findKey(parsePatterns, function (pattern) { - return pattern.test(string); - }); - } - - value = args.valueCallback ? args.valueCallback(value) : value; - value = options.valueCallback ? options.valueCallback(value) : value; - return { - value: value, - rest: string.slice(matchedString.length) - }; - }; -} - -function findKey(object, predicate) { - for (var key in object) { - if (object.hasOwnProperty(key) && predicate(object[key])) { - return key; - } - } -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/locale/_lib/buildMatchPatternFn/index.js": -/*!****************************************************************************!*\ - !*** ./node_modules/date-fns/esm/locale/_lib/buildMatchPatternFn/index.js ***! - \****************************************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return buildMatchPatternFn; }); -function buildMatchPatternFn(args) { - return function (dirtyString, dirtyOptions) { - var string = String(dirtyString); - var options = dirtyOptions || {}; - var matchResult = string.match(args.matchPattern); - - if (!matchResult) { - return null; - } - - var matchedString = matchResult[0]; - var parseResult = string.match(args.parsePattern); - - if (!parseResult) { - return null; - } - - var value = args.valueCallback ? args.valueCallback(parseResult[0]) : parseResult[0]; - value = options.valueCallback ? options.valueCallback(value) : value; - return { - value: value, - rest: string.slice(matchedString.length) - }; - }; -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/locale/en-US/_lib/formatDistance/index.js": -/*!*****************************************************************************!*\ - !*** ./node_modules/date-fns/esm/locale/en-US/_lib/formatDistance/index.js ***! - \*****************************************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return formatDistance; }); -var formatDistanceLocale = { - lessThanXSeconds: { - one: 'less than a second', - other: 'less than {{count}} seconds' - }, - xSeconds: { - one: '1 second', - other: '{{count}} seconds' - }, - halfAMinute: 'half a minute', - lessThanXMinutes: { - one: 'less than a minute', - other: 'less than {{count}} minutes' - }, - xMinutes: { - one: '1 minute', - other: '{{count}} minutes' - }, - aboutXHours: { - one: 'about 1 hour', - other: 'about {{count}} hours' - }, - xHours: { - one: '1 hour', - other: '{{count}} hours' - }, - xDays: { - one: '1 day', - other: '{{count}} days' - }, - aboutXMonths: { - one: 'about 1 month', - other: 'about {{count}} months' - }, - xMonths: { - one: '1 month', - other: '{{count}} months' - }, - aboutXYears: { - one: 'about 1 year', - other: 'about {{count}} years' - }, - xYears: { - one: '1 year', - other: '{{count}} years' - }, - overXYears: { - one: 'over 1 year', - other: 'over {{count}} years' - }, - almostXYears: { - one: 'almost 1 year', - other: 'almost {{count}} years' - } -}; -function formatDistance(token, count, options) { - options = options || {}; - var result; - - if (typeof formatDistanceLocale[token] === 'string') { - result = formatDistanceLocale[token]; - } else if (count === 1) { - result = formatDistanceLocale[token].one; - } else { - result = formatDistanceLocale[token].other.replace('{{count}}', count); - } - - if (options.addSuffix) { - if (options.comparison > 0) { - return 'in ' + result; - } else { - return result + ' ago'; - } - } - - return result; -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/locale/en-US/_lib/formatLong/index.js": -/*!*************************************************************************!*\ - !*** ./node_modules/date-fns/esm/locale/en-US/_lib/formatLong/index.js ***! - \*************************************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var _lib_buildFormatLongFn_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../_lib/buildFormatLongFn/index.js */ "./node_modules/date-fns/esm/locale/_lib/buildFormatLongFn/index.js"); - -var dateFormats = { - full: 'EEEE, MMMM do, y', - long: 'MMMM do, y', - medium: 'MMM d, y', - short: 'MM/dd/yyyy' -}; -var timeFormats = { - full: 'h:mm:ss a zzzz', - long: 'h:mm:ss a z', - medium: 'h:mm:ss a', - short: 'h:mm a' -}; -var dateTimeFormats = { - full: "{{date}} 'at' {{time}}", - long: "{{date}} 'at' {{time}}", - medium: '{{date}}, {{time}}', - short: '{{date}}, {{time}}' -}; -var formatLong = { - date: Object(_lib_buildFormatLongFn_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])({ - formats: dateFormats, - defaultWidth: 'full' - }), - time: Object(_lib_buildFormatLongFn_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])({ - formats: timeFormats, - defaultWidth: 'full' - }), - dateTime: Object(_lib_buildFormatLongFn_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])({ - formats: dateTimeFormats, - defaultWidth: 'full' - }) -}; -/* harmony default export */ __webpack_exports__["default"] = (formatLong); - -/***/ }), - -/***/ "./node_modules/date-fns/esm/locale/en-US/_lib/formatRelative/index.js": -/*!*****************************************************************************!*\ - !*** ./node_modules/date-fns/esm/locale/en-US/_lib/formatRelative/index.js ***! - \*****************************************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return formatRelative; }); -var formatRelativeLocale = { - lastWeek: "'last' eeee 'at' p", - yesterday: "'yesterday at' p", - today: "'today at' p", - tomorrow: "'tomorrow at' p", - nextWeek: "eeee 'at' p", - other: 'P' -}; -function formatRelative(token, date, baseDate, options) { - return formatRelativeLocale[token]; -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/locale/en-US/_lib/localize/index.js": -/*!***********************************************************************!*\ - !*** ./node_modules/date-fns/esm/locale/en-US/_lib/localize/index.js ***! - \***********************************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var _lib_buildLocalizeFn_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../_lib/buildLocalizeFn/index.js */ "./node_modules/date-fns/esm/locale/_lib/buildLocalizeFn/index.js"); - -var eraValues = { - narrow: ['B', 'A'], - abbreviated: ['BC', 'AD'], - wide: ['Before Christ', 'Anno Domini'] -}; -var quarterValues = { - narrow: ['1', '2', '3', '4'], - abbreviated: ['Q1', 'Q2', 'Q3', 'Q4'], - wide: ['1st quarter', '2nd quarter', '3rd quarter', '4th quarter'] -}; // Note: in English, the names of days of the week and months are capitalized. -// If you are making a new locale based on this one, check if the same is true for the language you're working on. -// Generally, formatted dates should look like they are in the middle of a sentence, -// e.g. in Spanish language the weekdays and months should be in the lowercase. - -var monthValues = { - narrow: ['J', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', 'O', 'N', 'D'], - abbreviated: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], - wide: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'] -}; -var dayValues = { - narrow: ['S', 'M', 'T', 'W', 'T', 'F', 'S'], - short: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'], - abbreviated: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], - wide: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'] -}; -var dayPeriodValues = { - narrow: { - am: 'a', - pm: 'p', - midnight: 'mi', - noon: 'n', - morning: 'morning', - afternoon: 'afternoon', - evening: 'evening', - night: 'night' - }, - abbreviated: { - am: 'AM', - pm: 'PM', - midnight: 'midnight', - noon: 'noon', - morning: 'morning', - afternoon: 'afternoon', - evening: 'evening', - night: 'night' - }, - wide: { - am: 'a.m.', - pm: 'p.m.', - midnight: 'midnight', - noon: 'noon', - morning: 'morning', - afternoon: 'afternoon', - evening: 'evening', - night: 'night' - } -}; -var formattingDayPeriodValues = { - narrow: { - am: 'a', - pm: 'p', - midnight: 'mi', - noon: 'n', - morning: 'in the morning', - afternoon: 'in the afternoon', - evening: 'in the evening', - night: 'at night' - }, - abbreviated: { - am: 'AM', - pm: 'PM', - midnight: 'midnight', - noon: 'noon', - morning: 'in the morning', - afternoon: 'in the afternoon', - evening: 'in the evening', - night: 'at night' - }, - wide: { - am: 'a.m.', - pm: 'p.m.', - midnight: 'midnight', - noon: 'noon', - morning: 'in the morning', - afternoon: 'in the afternoon', - evening: 'in the evening', - night: 'at night' - } -}; - -function ordinalNumber(dirtyNumber, dirtyOptions) { - var number = Number(dirtyNumber); // If ordinal numbers depend on context, for example, - // if they are different for different grammatical genders, - // use `options.unit`: - // - // var options = dirtyOptions || {} - // var unit = String(options.unit) - // - // where `unit` can be 'year', 'quarter', 'month', 'week', 'date', 'dayOfYear', - // 'day', 'hour', 'minute', 'second' - - var rem100 = number % 100; - - if (rem100 > 20 || rem100 < 10) { - switch (rem100 % 10) { - case 1: - return number + 'st'; - - case 2: - return number + 'nd'; - - case 3: - return number + 'rd'; - } - } - - return number + 'th'; -} - -var localize = { - ordinalNumber: ordinalNumber, - era: Object(_lib_buildLocalizeFn_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])({ - values: eraValues, - defaultWidth: 'wide' - }), - quarter: Object(_lib_buildLocalizeFn_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])({ - values: quarterValues, - defaultWidth: 'wide', - argumentCallback: function (quarter) { - return Number(quarter) - 1; - } - }), - month: Object(_lib_buildLocalizeFn_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])({ - values: monthValues, - defaultWidth: 'wide' - }), - day: Object(_lib_buildLocalizeFn_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])({ - values: dayValues, - defaultWidth: 'wide' - }), - dayPeriod: Object(_lib_buildLocalizeFn_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])({ - values: dayPeriodValues, - defaultWidth: 'wide', - formattingValues: formattingDayPeriodValues, - defaultFormattingWidth: 'wide' - }) -}; -/* harmony default export */ __webpack_exports__["default"] = (localize); - -/***/ }), - -/***/ "./node_modules/date-fns/esm/locale/en-US/_lib/match/index.js": -/*!********************************************************************!*\ - !*** ./node_modules/date-fns/esm/locale/en-US/_lib/match/index.js ***! - \********************************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var _lib_buildMatchPatternFn_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../_lib/buildMatchPatternFn/index.js */ "./node_modules/date-fns/esm/locale/_lib/buildMatchPatternFn/index.js"); -/* harmony import */ var _lib_buildMatchFn_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../../_lib/buildMatchFn/index.js */ "./node_modules/date-fns/esm/locale/_lib/buildMatchFn/index.js"); - - -var matchOrdinalNumberPattern = /^(\d+)(th|st|nd|rd)?/i; -var parseOrdinalNumberPattern = /\d+/i; -var matchEraPatterns = { - narrow: /^(b|a)/i, - abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i, - wide: /^(before christ|before common era|anno domini|common era)/i -}; -var parseEraPatterns = { - any: [/^b/i, /^(a|c)/i] -}; -var matchQuarterPatterns = { - narrow: /^[1234]/i, - abbreviated: /^q[1234]/i, - wide: /^[1234](th|st|nd|rd)? quarter/i -}; -var parseQuarterPatterns = { - any: [/1/i, /2/i, /3/i, /4/i] -}; -var matchMonthPatterns = { - narrow: /^[jfmasond]/i, - abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i, - wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i -}; -var parseMonthPatterns = { - narrow: [/^j/i, /^f/i, /^m/i, /^a/i, /^m/i, /^j/i, /^j/i, /^a/i, /^s/i, /^o/i, /^n/i, /^d/i], - any: [/^ja/i, /^f/i, /^mar/i, /^ap/i, /^may/i, /^jun/i, /^jul/i, /^au/i, /^s/i, /^o/i, /^n/i, /^d/i] -}; -var matchDayPatterns = { - narrow: /^[smtwf]/i, - short: /^(su|mo|tu|we|th|fr|sa)/i, - abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i, - wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i -}; -var parseDayPatterns = { - narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i], - any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i] -}; -var matchDayPeriodPatterns = { - narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i, - any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i -}; -var parseDayPeriodPatterns = { - any: { - am: /^a/i, - pm: /^p/i, - midnight: /^mi/i, - noon: /^no/i, - morning: /morning/i, - afternoon: /afternoon/i, - evening: /evening/i, - night: /night/i - } -}; -var match = { - ordinalNumber: Object(_lib_buildMatchPatternFn_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])({ - matchPattern: matchOrdinalNumberPattern, - parsePattern: parseOrdinalNumberPattern, - valueCallback: function (value) { - return parseInt(value, 10); - } - }), - era: Object(_lib_buildMatchFn_index_js__WEBPACK_IMPORTED_MODULE_1__["default"])({ - matchPatterns: matchEraPatterns, - defaultMatchWidth: 'wide', - parsePatterns: parseEraPatterns, - defaultParseWidth: 'any' - }), - quarter: Object(_lib_buildMatchFn_index_js__WEBPACK_IMPORTED_MODULE_1__["default"])({ - matchPatterns: matchQuarterPatterns, - defaultMatchWidth: 'wide', - parsePatterns: parseQuarterPatterns, - defaultParseWidth: 'any', - valueCallback: function (index) { - return index + 1; - } - }), - month: Object(_lib_buildMatchFn_index_js__WEBPACK_IMPORTED_MODULE_1__["default"])({ - matchPatterns: matchMonthPatterns, - defaultMatchWidth: 'wide', - parsePatterns: parseMonthPatterns, - defaultParseWidth: 'any' - }), - day: Object(_lib_buildMatchFn_index_js__WEBPACK_IMPORTED_MODULE_1__["default"])({ - matchPatterns: matchDayPatterns, - defaultMatchWidth: 'wide', - parsePatterns: parseDayPatterns, - defaultParseWidth: 'any' - }), - dayPeriod: Object(_lib_buildMatchFn_index_js__WEBPACK_IMPORTED_MODULE_1__["default"])({ - matchPatterns: matchDayPeriodPatterns, - defaultMatchWidth: 'any', - parsePatterns: parseDayPeriodPatterns, - defaultParseWidth: 'any' - }) -}; -/* harmony default export */ __webpack_exports__["default"] = (match); - -/***/ }), - -/***/ "./node_modules/date-fns/esm/locale/en-US/index.js": -/*!*********************************************************!*\ - !*** ./node_modules/date-fns/esm/locale/en-US/index.js ***! - \*********************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var _lib_formatDistance_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_lib/formatDistance/index.js */ "./node_modules/date-fns/esm/locale/en-US/_lib/formatDistance/index.js"); -/* harmony import */ var _lib_formatLong_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./_lib/formatLong/index.js */ "./node_modules/date-fns/esm/locale/en-US/_lib/formatLong/index.js"); -/* harmony import */ var _lib_formatRelative_index_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./_lib/formatRelative/index.js */ "./node_modules/date-fns/esm/locale/en-US/_lib/formatRelative/index.js"); -/* harmony import */ var _lib_localize_index_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./_lib/localize/index.js */ "./node_modules/date-fns/esm/locale/en-US/_lib/localize/index.js"); -/* harmony import */ var _lib_match_index_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./_lib/match/index.js */ "./node_modules/date-fns/esm/locale/en-US/_lib/match/index.js"); - - - - - -/** - * @type {Locale} - * @category Locales - * @summary English locale (United States). - * @language English - * @iso-639-2 eng - * @author Sasha Koss [@kossnocorp]{@link https://github.com/kossnocorp} - * @author Lesha Koss [@leshakoss]{@link https://github.com/leshakoss} - */ - -var locale = { - formatDistance: _lib_formatDistance_index_js__WEBPACK_IMPORTED_MODULE_0__["default"], - formatLong: _lib_formatLong_index_js__WEBPACK_IMPORTED_MODULE_1__["default"], - formatRelative: _lib_formatRelative_index_js__WEBPACK_IMPORTED_MODULE_2__["default"], - localize: _lib_localize_index_js__WEBPACK_IMPORTED_MODULE_3__["default"], - match: _lib_match_index_js__WEBPACK_IMPORTED_MODULE_4__["default"], - options: { - weekStartsOn: 0 - /* Sunday */ - , - firstWeekContainsDate: 1 - } -}; -/* harmony default export */ __webpack_exports__["default"] = (locale); - -/***/ }), - -/***/ "./node_modules/date-fns/esm/max/index.js": -/*!************************************************!*\ - !*** ./node_modules/date-fns/esm/max/index.js ***! - \************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return max; }); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); - -/** - * @name max - * @category Common Helpers - * @summary Return the latest of the given dates. - * - * @description - * Return the latest of the given dates. - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * - `max` function now accepts an array of dates rather than spread arguments. - * - * ```javascript - * // Before v2.0.0 - * var date1 = new Date(1989, 6, 10) - * var date2 = new Date(1987, 1, 11) - * var maxDate = max(date1, date2) - * - * // v2.0.0 onward: - * var dates = [new Date(1989, 6, 10), new Date(1987, 1, 11)] - * var maxDate = max(dates) - * ``` - * - * @param {Date[]|Number[]} datesArray - the dates to compare - * @returns {Date} the latest of the dates - * @throws {TypeError} 1 argument required - * - * @example - * // Which of these dates is the latest? - * var result = max([ - * new Date(1989, 6, 10), - * new Date(1987, 1, 11), - * new Date(1995, 6, 2), - * new Date(1990, 0, 1) - * ]) - * //=> Sun Jul 02 1995 00:00:00 - */ - -function max(dirtyDatesArray) { - if (arguments.length < 1) { - throw new TypeError('1 argument required, but only ' + arguments.length + ' present'); - } - - var datesArray; // `dirtyDatesArray` is undefined or null - - if (dirtyDatesArray == null) { - datesArray = []; // `dirtyDatesArray` is Array, Set or Map, or object with custom `forEach` method - } else if (typeof dirtyDatesArray.forEach === 'function') { - datesArray = dirtyDatesArray; // If `dirtyDatesArray` is Array-like Object, convert to Array. Otherwise, make it empty Array - } else { - datesArray = Array.prototype.slice.call(dirtyDatesArray); - } - - var result; - datesArray.forEach(function (dirtyDate) { - var currentDate = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDate); - - if (result === undefined || result < currentDate || isNaN(currentDate)) { - result = currentDate; - } - }); - return result; -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/min/index.js": -/*!************************************************!*\ - !*** ./node_modules/date-fns/esm/min/index.js ***! - \************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return min; }); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); - -/** - * @name min - * @category Common Helpers - * @summary Return the earliest of the given dates. - * - * @description - * Return the earliest of the given dates. - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * - `min` function now accepts an array of dates rather than spread arguments. - * - * ```javascript - * // Before v2.0.0 - * var date1 = new Date(1989, 6, 10) - * var date2 = new Date(1987, 1, 11) - * var minDate = min(date1, date2) - * - * // v2.0.0 onward: - * var dates = [new Date(1989, 6, 10), new Date(1987, 1, 11)] - * var minDate = min(dates) - * ``` - * - * @param {Date[]|Number[]} datesArray - the dates to compare - * @returns {Date} the earliest of the dates - * @throws {TypeError} 1 argument required - * - * @example - * // Which of these dates is the earliest? - * var result = min([ - * new Date(1989, 6, 10), - * new Date(1987, 1, 11), - * new Date(1995, 6, 2), - * new Date(1990, 0, 1) - * ]) - * //=> Wed Feb 11 1987 00:00:00 - */ - -function min(dirtyDatesArray) { - if (arguments.length < 1) { - throw new TypeError('1 argument required, but only ' + arguments.length + ' present'); - } - - var datesArray; // `dirtyDatesArray` is undefined or null - - if (dirtyDatesArray == null) { - datesArray = []; // `dirtyDatesArray` is Array, Set or Map, or object with custom `forEach` method - } else if (typeof dirtyDatesArray.forEach === 'function') { - datesArray = dirtyDatesArray; // If `dirtyDatesArray` is Array-like Object, convert to Array. Otherwise, make it empty Array - } else { - datesArray = Array.prototype.slice.call(dirtyDatesArray); - } - - var result; - datesArray.forEach(function (dirtyDate) { - var currentDate = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDate); - - if (result === undefined || result > currentDate || isNaN(currentDate)) { - result = currentDate; - } - }); - return result; -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/parse/_lib/parsers/index.js": -/*!***************************************************************!*\ - !*** ./node_modules/date-fns/esm/parse/_lib/parsers/index.js ***! - \***************************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var _lib_getUTCWeekYear_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../_lib/getUTCWeekYear/index.js */ "./node_modules/date-fns/esm/_lib/getUTCWeekYear/index.js"); -/* harmony import */ var _lib_setUTCDay_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../../_lib/setUTCDay/index.js */ "./node_modules/date-fns/esm/_lib/setUTCDay/index.js"); -/* harmony import */ var _lib_setUTCWeek_index_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../_lib/setUTCWeek/index.js */ "./node_modules/date-fns/esm/_lib/setUTCWeek/index.js"); -/* harmony import */ var _lib_startOfUTCWeek_index_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../../_lib/startOfUTCWeek/index.js */ "./node_modules/date-fns/esm/_lib/startOfUTCWeek/index.js"); -/* harmony import */ var _lib_setUTCISODay_index_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../_lib/setUTCISODay/index.js */ "./node_modules/date-fns/esm/_lib/setUTCISODay/index.js"); -/* harmony import */ var _lib_setUTCISOWeek_index_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../../_lib/setUTCISOWeek/index.js */ "./node_modules/date-fns/esm/_lib/setUTCISOWeek/index.js"); -/* harmony import */ var _lib_startOfUTCISOWeek_index_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../../_lib/startOfUTCISOWeek/index.js */ "./node_modules/date-fns/esm/_lib/startOfUTCISOWeek/index.js"); - - - - - - - -var MILLISECONDS_IN_HOUR = 3600000; -var MILLISECONDS_IN_MINUTE = 60000; -var MILLISECONDS_IN_SECOND = 1000; -var numericPatterns = { - month: /^(1[0-2]|0?\d)/, - // 0 to 12 - date: /^(3[0-1]|[0-2]?\d)/, - // 0 to 31 - dayOfYear: /^(36[0-6]|3[0-5]\d|[0-2]?\d?\d)/, - // 0 to 366 - week: /^(5[0-3]|[0-4]?\d)/, - // 0 to 53 - hour23h: /^(2[0-3]|[0-1]?\d)/, - // 0 to 23 - hour24h: /^(2[0-4]|[0-1]?\d)/, - // 0 to 24 - hour11h: /^(1[0-1]|0?\d)/, - // 0 to 11 - hour12h: /^(1[0-2]|0?\d)/, - // 0 to 12 - minute: /^[0-5]?\d/, - // 0 to 59 - second: /^[0-5]?\d/, - // 0 to 59 - singleDigit: /^\d/, - // 0 to 9 - twoDigits: /^\d{1,2}/, - // 0 to 99 - threeDigits: /^\d{1,3}/, - // 0 to 999 - fourDigits: /^\d{1,4}/, - // 0 to 9999 - anyDigitsSigned: /^-?\d+/, - singleDigitSigned: /^-?\d/, - // 0 to 9, -0 to -9 - twoDigitsSigned: /^-?\d{1,2}/, - // 0 to 99, -0 to -99 - threeDigitsSigned: /^-?\d{1,3}/, - // 0 to 999, -0 to -999 - fourDigitsSigned: /^-?\d{1,4}/ // 0 to 9999, -0 to -9999 - -}; -var timezonePatterns = { - basicOptionalMinutes: /^([+-])(\d{2})(\d{2})?|Z/, - basic: /^([+-])(\d{2})(\d{2})|Z/, - basicOptionalSeconds: /^([+-])(\d{2})(\d{2})((\d{2}))?|Z/, - extended: /^([+-])(\d{2}):(\d{2})|Z/, - extendedOptionalSeconds: /^([+-])(\d{2}):(\d{2})(:(\d{2}))?|Z/ -}; - -function parseNumericPattern(pattern, string, valueCallback) { - var matchResult = string.match(pattern); - - if (!matchResult) { - return null; - } - - var value = parseInt(matchResult[0], 10); - return { - value: valueCallback ? valueCallback(value) : value, - rest: string.slice(matchResult[0].length) - }; -} - -function parseTimezonePattern(pattern, string) { - var matchResult = string.match(pattern); - - if (!matchResult) { - return null; - } // Input is 'Z' - - - if (matchResult[0] === 'Z') { - return { - value: 0, - rest: string.slice(1) - }; - } - - var sign = matchResult[1] === '+' ? 1 : -1; - var hours = matchResult[2] ? parseInt(matchResult[2], 10) : 0; - var minutes = matchResult[3] ? parseInt(matchResult[3], 10) : 0; - var seconds = matchResult[5] ? parseInt(matchResult[5], 10) : 0; - return { - value: sign * (hours * MILLISECONDS_IN_HOUR + minutes * MILLISECONDS_IN_MINUTE + seconds * MILLISECONDS_IN_SECOND), - rest: string.slice(matchResult[0].length) - }; -} - -function parseAnyDigitsSigned(string, valueCallback) { - return parseNumericPattern(numericPatterns.anyDigitsSigned, string, valueCallback); -} - -function parseNDigits(n, string, valueCallback) { - switch (n) { - case 1: - return parseNumericPattern(numericPatterns.singleDigit, string, valueCallback); - - case 2: - return parseNumericPattern(numericPatterns.twoDigits, string, valueCallback); - - case 3: - return parseNumericPattern(numericPatterns.threeDigits, string, valueCallback); - - case 4: - return parseNumericPattern(numericPatterns.fourDigits, string, valueCallback); - - default: - return parseNumericPattern(new RegExp('^\\d{1,' + n + '}'), string, valueCallback); - } -} - -function parseNDigitsSigned(n, string, valueCallback) { - switch (n) { - case 1: - return parseNumericPattern(numericPatterns.singleDigitSigned, string, valueCallback); - - case 2: - return parseNumericPattern(numericPatterns.twoDigitsSigned, string, valueCallback); - - case 3: - return parseNumericPattern(numericPatterns.threeDigitsSigned, string, valueCallback); - - case 4: - return parseNumericPattern(numericPatterns.fourDigitsSigned, string, valueCallback); - - default: - return parseNumericPattern(new RegExp('^-?\\d{1,' + n + '}'), string, valueCallback); - } -} - -function dayPeriodEnumToHours(enumValue) { - switch (enumValue) { - case 'morning': - return 4; - - case 'evening': - return 17; - - case 'pm': - case 'noon': - case 'afternoon': - return 12; - - case 'am': - case 'midnight': - case 'night': - default: - return 0; - } -} - -function normalizeTwoDigitYear(twoDigitYear, currentYear) { - var isCommonEra = currentYear > 0; // Absolute number of the current year: - // 1 -> 1 AC - // 0 -> 1 BC - // -1 -> 2 BC - - var absCurrentYear = isCommonEra ? currentYear : 1 - currentYear; - var result; - - if (absCurrentYear <= 50) { - result = twoDigitYear || 100; - } else { - var rangeEnd = absCurrentYear + 50; - var rangeEndCentury = Math.floor(rangeEnd / 100) * 100; - var isPreviousCentury = twoDigitYear >= rangeEnd % 100; - result = twoDigitYear + rangeEndCentury - (isPreviousCentury ? 100 : 0); - } - - return isCommonEra ? result : 1 - result; -} - -var DAYS_IN_MONTH = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; -var DAYS_IN_MONTH_LEAP_YEAR = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; // User for validation - -function isLeapYearIndex(year) { - return year % 400 === 0 || year % 4 === 0 && year % 100 !== 0; -} -/* - * | | Unit | | Unit | - * |-----|--------------------------------|-----|--------------------------------| - * | a | AM, PM | A* | Milliseconds in day | - * | b | AM, PM, noon, midnight | B | Flexible day period | - * | c | Stand-alone local day of week | C* | Localized hour w/ day period | - * | d | Day of month | D | Day of year | - * | e | Local day of week | E | Day of week | - * | f | | F* | Day of week in month | - * | g* | Modified Julian day | G | Era | - * | h | Hour [1-12] | H | Hour [0-23] | - * | i! | ISO day of week | I! | ISO week of year | - * | j* | Localized hour w/ day period | J* | Localized hour w/o day period | - * | k | Hour [1-24] | K | Hour [0-11] | - * | l* | (deprecated) | L | Stand-alone month | - * | m | Minute | M | Month | - * | n | | N | | - * | o! | Ordinal number modifier | O* | Timezone (GMT) | - * | p | | P | | - * | q | Stand-alone quarter | Q | Quarter | - * | r* | Related Gregorian year | R! | ISO week-numbering year | - * | s | Second | S | Fraction of second | - * | t! | Seconds timestamp | T! | Milliseconds timestamp | - * | u | Extended year | U* | Cyclic year | - * | v* | Timezone (generic non-locat.) | V* | Timezone (location) | - * | w | Local week of year | W* | Week of month | - * | x | Timezone (ISO-8601 w/o Z) | X | Timezone (ISO-8601) | - * | y | Year (abs) | Y | Local week-numbering year | - * | z* | Timezone (specific non-locat.) | Z* | Timezone (aliases) | - * - * Letters marked by * are not implemented but reserved by Unicode standard. - * - * Letters marked by ! are non-standard, but implemented by date-fns: - * - `o` modifies the previous token to turn it into an ordinal (see `parse` docs) - * - `i` is ISO day of week. For `i` and `ii` is returns numeric ISO week days, - * i.e. 7 for Sunday, 1 for Monday, etc. - * - `I` is ISO week of year, as opposed to `w` which is local week of year. - * - `R` is ISO week-numbering year, as opposed to `Y` which is local week-numbering year. - * `R` is supposed to be used in conjunction with `I` and `i` - * for universal ISO week-numbering date, whereas - * `Y` is supposed to be used in conjunction with `w` and `e` - * for week-numbering date specific to the locale. - */ - - -var parsers = { - // Era - G: { - priority: 140, - parse: function (string, token, match, options) { - switch (token) { - // AD, BC - case 'G': - case 'GG': - case 'GGG': - return match.era(string, { - width: 'abbreviated' - }) || match.era(string, { - width: 'narrow' - }); - // A, B - - case 'GGGGG': - return match.era(string, { - width: 'narrow' - }); - // Anno Domini, Before Christ - - case 'GGGG': - default: - return match.era(string, { - width: 'wide' - }) || match.era(string, { - width: 'abbreviated' - }) || match.era(string, { - width: 'narrow' - }); - } - }, - set: function (date, flags, value, options) { - // Sets year 10 BC if BC, or 10 AC if AC - date.setUTCFullYear(value === 1 ? 10 : -9, 0, 1); - date.setUTCHours(0, 0, 0, 0); - return date; - } - }, - // Year - y: { - // From http://www.unicode.org/reports/tr35/tr35-31/tr35-dates.html#Date_Format_Patterns - // | Year | y | yy | yyy | yyyy | yyyyy | - // |----------|-------|----|-------|-------|-------| - // | AD 1 | 1 | 01 | 001 | 0001 | 00001 | - // | AD 12 | 12 | 12 | 012 | 0012 | 00012 | - // | AD 123 | 123 | 23 | 123 | 0123 | 00123 | - // | AD 1234 | 1234 | 34 | 1234 | 1234 | 01234 | - // | AD 12345 | 12345 | 45 | 12345 | 12345 | 12345 | - priority: 130, - parse: function (string, token, match, options) { - var valueCallback = function (year) { - return { - year: year, - isTwoDigitYear: token === 'yy' - }; - }; - - switch (token) { - case 'y': - return parseNDigits(4, string, valueCallback); - - case 'yo': - return match.ordinalNumber(string, { - unit: 'year', - valueCallback: valueCallback - }); - - default: - return parseNDigits(token.length, string, valueCallback); - } - }, - validate: function (date, value, options) { - return value.isTwoDigitYear || value.year > 0; - }, - set: function (date, flags, value, options) { - var currentYear = Object(_lib_getUTCWeekYear_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(date, options); - - if (value.isTwoDigitYear) { - var normalizedTwoDigitYear = normalizeTwoDigitYear(value.year, currentYear); - date.setUTCFullYear(normalizedTwoDigitYear, 0, 1); - date.setUTCHours(0, 0, 0, 0); - return date; - } - - var year = currentYear > 0 ? value.year : 1 - value.year; - date.setUTCFullYear(year, 0, 1); - date.setUTCHours(0, 0, 0, 0); - return date; - } - }, - // Local week-numbering year - Y: { - priority: 130, - parse: function (string, token, match, options) { - var valueCallback = function (year) { - return { - year: year, - isTwoDigitYear: token === 'YY' - }; - }; - - switch (token) { - case 'Y': - return parseNDigits(4, string, valueCallback); - - case 'Yo': - return match.ordinalNumber(string, { - unit: 'year', - valueCallback: valueCallback - }); - - default: - return parseNDigits(token.length, string, valueCallback); - } - }, - validate: function (date, value, options) { - return value.isTwoDigitYear || value.year > 0; - }, - set: function (date, flags, value, options) { - var currentYear = date.getUTCFullYear(); - - if (value.isTwoDigitYear) { - var normalizedTwoDigitYear = normalizeTwoDigitYear(value.year, currentYear); - date.setUTCFullYear(normalizedTwoDigitYear, 0, options.firstWeekContainsDate); - date.setUTCHours(0, 0, 0, 0); - return Object(_lib_startOfUTCWeek_index_js__WEBPACK_IMPORTED_MODULE_3__["default"])(date, options); - } - - var year = currentYear > 0 ? value.year : 1 - value.year; - date.setUTCFullYear(year, 0, options.firstWeekContainsDate); - date.setUTCHours(0, 0, 0, 0); - return Object(_lib_startOfUTCWeek_index_js__WEBPACK_IMPORTED_MODULE_3__["default"])(date, options); - } - }, - // ISO week-numbering year - R: { - priority: 130, - parse: function (string, token, match, options) { - if (token === 'R') { - return parseNDigitsSigned(4, string); - } - - return parseNDigitsSigned(token.length, string); - }, - set: function (date, flags, value, options) { - var firstWeekOfYear = new Date(0); - firstWeekOfYear.setUTCFullYear(value, 0, 4); - firstWeekOfYear.setUTCHours(0, 0, 0, 0); - return Object(_lib_startOfUTCISOWeek_index_js__WEBPACK_IMPORTED_MODULE_6__["default"])(firstWeekOfYear); - } - }, - // Extended year - u: { - priority: 130, - parse: function (string, token, match, options) { - if (token === 'u') { - return parseNDigitsSigned(4, string); - } - - return parseNDigitsSigned(token.length, string); - }, - set: function (date, flags, value, options) { - date.setUTCFullYear(value, 0, 1); - date.setUTCHours(0, 0, 0, 0); - return date; - } - }, - // Quarter - Q: { - priority: 120, - parse: function (string, token, match, options) { - switch (token) { - // 1, 2, 3, 4 - case 'Q': - case 'QQ': - // 01, 02, 03, 04 - return parseNDigits(token.length, string); - // 1st, 2nd, 3rd, 4th - - case 'Qo': - return match.ordinalNumber(string, { - unit: 'quarter' - }); - // Q1, Q2, Q3, Q4 - - case 'QQQ': - return match.quarter(string, { - width: 'abbreviated', - context: 'formatting' - }) || match.quarter(string, { - width: 'narrow', - context: 'formatting' - }); - // 1, 2, 3, 4 (narrow quarter; could be not numerical) - - case 'QQQQQ': - return match.quarter(string, { - width: 'narrow', - context: 'formatting' - }); - // 1st quarter, 2nd quarter, ... - - case 'QQQQ': - default: - return match.quarter(string, { - width: 'wide', - context: 'formatting' - }) || match.quarter(string, { - width: 'abbreviated', - context: 'formatting' - }) || match.quarter(string, { - width: 'narrow', - context: 'formatting' - }); - } - }, - validate: function (date, value, options) { - return value >= 1 && value <= 4; - }, - set: function (date, flags, value, options) { - date.setUTCMonth((value - 1) * 3, 1); - date.setUTCHours(0, 0, 0, 0); - return date; - } - }, - // Stand-alone quarter - q: { - priority: 120, - parse: function (string, token, match, options) { - switch (token) { - // 1, 2, 3, 4 - case 'q': - case 'qq': - // 01, 02, 03, 04 - return parseNDigits(token.length, string); - // 1st, 2nd, 3rd, 4th - - case 'qo': - return match.ordinalNumber(string, { - unit: 'quarter' - }); - // Q1, Q2, Q3, Q4 - - case 'qqq': - return match.quarter(string, { - width: 'abbreviated', - context: 'standalone' - }) || match.quarter(string, { - width: 'narrow', - context: 'standalone' - }); - // 1, 2, 3, 4 (narrow quarter; could be not numerical) - - case 'qqqqq': - return match.quarter(string, { - width: 'narrow', - context: 'standalone' - }); - // 1st quarter, 2nd quarter, ... - - case 'qqqq': - default: - return match.quarter(string, { - width: 'wide', - context: 'standalone' - }) || match.quarter(string, { - width: 'abbreviated', - context: 'standalone' - }) || match.quarter(string, { - width: 'narrow', - context: 'standalone' - }); - } - }, - validate: function (date, value, options) { - return value >= 1 && value <= 4; - }, - set: function (date, flags, value, options) { - date.setUTCMonth((value - 1) * 3, 1); - date.setUTCHours(0, 0, 0, 0); - return date; - } - }, - // Month - M: { - priority: 110, - parse: function (string, token, match, options) { - var valueCallback = function (value) { - return value - 1; - }; - - switch (token) { - // 1, 2, ..., 12 - case 'M': - return parseNumericPattern(numericPatterns.month, string, valueCallback); - // 01, 02, ..., 12 - - case 'MM': - return parseNDigits(2, string, valueCallback); - // 1st, 2nd, ..., 12th - - case 'Mo': - return match.ordinalNumber(string, { - unit: 'month', - valueCallback: valueCallback - }); - // Jan, Feb, ..., Dec - - case 'MMM': - return match.month(string, { - width: 'abbreviated', - context: 'formatting' - }) || match.month(string, { - width: 'narrow', - context: 'formatting' - }); - // J, F, ..., D - - case 'MMMMM': - return match.month(string, { - width: 'narrow', - context: 'formatting' - }); - // January, February, ..., December - - case 'MMMM': - default: - return match.month(string, { - width: 'wide', - context: 'formatting' - }) || match.month(string, { - width: 'abbreviated', - context: 'formatting' - }) || match.month(string, { - width: 'narrow', - context: 'formatting' - }); - } - }, - validate: function (date, value, options) { - return value >= 0 && value <= 11; - }, - set: function (date, flags, value, options) { - date.setUTCMonth(value, 1); - date.setUTCHours(0, 0, 0, 0); - return date; - } - }, - // Stand-alone month - L: { - priority: 110, - parse: function (string, token, match, options) { - var valueCallback = function (value) { - return value - 1; - }; - - switch (token) { - // 1, 2, ..., 12 - case 'L': - return parseNumericPattern(numericPatterns.month, string, valueCallback); - // 01, 02, ..., 12 - - case 'LL': - return parseNDigits(2, string, valueCallback); - // 1st, 2nd, ..., 12th - - case 'Lo': - return match.ordinalNumber(string, { - unit: 'month', - valueCallback: valueCallback - }); - // Jan, Feb, ..., Dec - - case 'LLL': - return match.month(string, { - width: 'abbreviated', - context: 'standalone' - }) || match.month(string, { - width: 'narrow', - context: 'standalone' - }); - // J, F, ..., D - - case 'LLLLL': - return match.month(string, { - width: 'narrow', - context: 'standalone' - }); - // January, February, ..., December - - case 'LLLL': - default: - return match.month(string, { - width: 'wide', - context: 'standalone' - }) || match.month(string, { - width: 'abbreviated', - context: 'standalone' - }) || match.month(string, { - width: 'narrow', - context: 'standalone' - }); - } - }, - validate: function (date, value, options) { - return value >= 0 && value <= 11; - }, - set: function (date, flags, value, options) { - date.setUTCMonth(value, 1); - date.setUTCHours(0, 0, 0, 0); - return date; - } - }, - // Local week of year - w: { - priority: 100, - parse: function (string, token, match, options) { - switch (token) { - case 'w': - return parseNumericPattern(numericPatterns.week, string); - - case 'wo': - return match.ordinalNumber(string, { - unit: 'week' - }); - - default: - return parseNDigits(token.length, string); - } - }, - validate: function (date, value, options) { - return value >= 1 && value <= 53; - }, - set: function (date, flags, value, options) { - return Object(_lib_startOfUTCWeek_index_js__WEBPACK_IMPORTED_MODULE_3__["default"])(Object(_lib_setUTCWeek_index_js__WEBPACK_IMPORTED_MODULE_2__["default"])(date, value, options), options); - } - }, - // ISO week of year - I: { - priority: 100, - parse: function (string, token, match, options) { - switch (token) { - case 'I': - return parseNumericPattern(numericPatterns.week, string); - - case 'Io': - return match.ordinalNumber(string, { - unit: 'week' - }); - - default: - return parseNDigits(token.length, string); - } - }, - validate: function (date, value, options) { - return value >= 1 && value <= 53; - }, - set: function (date, flags, value, options) { - return Object(_lib_startOfUTCISOWeek_index_js__WEBPACK_IMPORTED_MODULE_6__["default"])(Object(_lib_setUTCISOWeek_index_js__WEBPACK_IMPORTED_MODULE_5__["default"])(date, value, options), options); - } - }, - // Day of the month - d: { - priority: 90, - parse: function (string, token, match, options) { - switch (token) { - case 'd': - return parseNumericPattern(numericPatterns.date, string); - - case 'do': - return match.ordinalNumber(string, { - unit: 'date' - }); - - default: - return parseNDigits(token.length, string); - } - }, - validate: function (date, value, options) { - var year = date.getUTCFullYear(); - var isLeapYear = isLeapYearIndex(year); - var month = date.getUTCMonth(); - - if (isLeapYear) { - return value >= 1 && value <= DAYS_IN_MONTH_LEAP_YEAR[month]; - } else { - return value >= 1 && value <= DAYS_IN_MONTH[month]; - } - }, - set: function (date, flags, value, options) { - date.setUTCDate(value); - date.setUTCHours(0, 0, 0, 0); - return date; - } - }, - // Day of year - D: { - priority: 90, - parse: function (string, token, match, options) { - switch (token) { - case 'D': - case 'DD': - return parseNumericPattern(numericPatterns.dayOfYear, string); - - case 'Do': - return match.ordinalNumber(string, { - unit: 'date' - }); - - default: - return parseNDigits(token.length, string); - } - }, - validate: function (date, value, options) { - var year = date.getUTCFullYear(); - var isLeapYear = isLeapYearIndex(year); - - if (isLeapYear) { - return value >= 1 && value <= 366; - } else { - return value >= 1 && value <= 365; - } - }, - set: function (date, flags, value, options) { - date.setUTCMonth(0, value); - date.setUTCHours(0, 0, 0, 0); - return date; - } - }, - // Day of week - E: { - priority: 90, - parse: function (string, token, match, options) { - switch (token) { - // Tue - case 'E': - case 'EE': - case 'EEE': - return match.day(string, { - width: 'abbreviated', - context: 'formatting' - }) || match.day(string, { - width: 'short', - context: 'formatting' - }) || match.day(string, { - width: 'narrow', - context: 'formatting' - }); - // T - - case 'EEEEE': - return match.day(string, { - width: 'narrow', - context: 'formatting' - }); - // Tu - - case 'EEEEEE': - return match.day(string, { - width: 'short', - context: 'formatting' - }) || match.day(string, { - width: 'narrow', - context: 'formatting' - }); - // Tuesday - - case 'EEEE': - default: - return match.day(string, { - width: 'wide', - context: 'formatting' - }) || match.day(string, { - width: 'abbreviated', - context: 'formatting' - }) || match.day(string, { - width: 'short', - context: 'formatting' - }) || match.day(string, { - width: 'narrow', - context: 'formatting' - }); - } - }, - validate: function (date, value, options) { - return value >= 0 && value <= 6; - }, - set: function (date, flags, value, options) { - date = Object(_lib_setUTCDay_index_js__WEBPACK_IMPORTED_MODULE_1__["default"])(date, value, options); - date.setUTCHours(0, 0, 0, 0); - return date; - } - }, - // Local day of week - e: { - priority: 90, - parse: function (string, token, match, options) { - var valueCallback = function (value) { - var wholeWeekDays = Math.floor((value - 1) / 7) * 7; - return (value + options.weekStartsOn + 6) % 7 + wholeWeekDays; - }; - - switch (token) { - // 3 - case 'e': - case 'ee': - // 03 - return parseNDigits(token.length, string, valueCallback); - // 3rd - - case 'eo': - return match.ordinalNumber(string, { - unit: 'day', - valueCallback: valueCallback - }); - // Tue - - case 'eee': - return match.day(string, { - width: 'abbreviated', - context: 'formatting' - }) || match.day(string, { - width: 'short', - context: 'formatting' - }) || match.day(string, { - width: 'narrow', - context: 'formatting' - }); - // T - - case 'eeeee': - return match.day(string, { - width: 'narrow', - context: 'formatting' - }); - // Tu - - case 'eeeeee': - return match.day(string, { - width: 'short', - context: 'formatting' - }) || match.day(string, { - width: 'narrow', - context: 'formatting' - }); - // Tuesday - - case 'eeee': - default: - return match.day(string, { - width: 'wide', - context: 'formatting' - }) || match.day(string, { - width: 'abbreviated', - context: 'formatting' - }) || match.day(string, { - width: 'short', - context: 'formatting' - }) || match.day(string, { - width: 'narrow', - context: 'formatting' - }); - } - }, - validate: function (date, value, options) { - return value >= 0 && value <= 6; - }, - set: function (date, flags, value, options) { - date = Object(_lib_setUTCDay_index_js__WEBPACK_IMPORTED_MODULE_1__["default"])(date, value, options); - date.setUTCHours(0, 0, 0, 0); - return date; - } - }, - // Stand-alone local day of week - c: { - priority: 90, - parse: function (string, token, match, options) { - var valueCallback = function (value) { - var wholeWeekDays = Math.floor((value - 1) / 7) * 7; - return (value + options.weekStartsOn + 6) % 7 + wholeWeekDays; - }; - - switch (token) { - // 3 - case 'c': - case 'cc': - // 03 - return parseNDigits(token.length, string, valueCallback); - // 3rd - - case 'co': - return match.ordinalNumber(string, { - unit: 'day', - valueCallback: valueCallback - }); - // Tue - - case 'ccc': - return match.day(string, { - width: 'abbreviated', - context: 'standalone' - }) || match.day(string, { - width: 'short', - context: 'standalone' - }) || match.day(string, { - width: 'narrow', - context: 'standalone' - }); - // T - - case 'ccccc': - return match.day(string, { - width: 'narrow', - context: 'standalone' - }); - // Tu - - case 'cccccc': - return match.day(string, { - width: 'short', - context: 'standalone' - }) || match.day(string, { - width: 'narrow', - context: 'standalone' - }); - // Tuesday - - case 'cccc': - default: - return match.day(string, { - width: 'wide', - context: 'standalone' - }) || match.day(string, { - width: 'abbreviated', - context: 'standalone' - }) || match.day(string, { - width: 'short', - context: 'standalone' - }) || match.day(string, { - width: 'narrow', - context: 'standalone' - }); - } - }, - validate: function (date, value, options) { - return value >= 0 && value <= 6; - }, - set: function (date, flags, value, options) { - date = Object(_lib_setUTCDay_index_js__WEBPACK_IMPORTED_MODULE_1__["default"])(date, value, options); - date.setUTCHours(0, 0, 0, 0); - return date; - } - }, - // ISO day of week - i: { - priority: 90, - parse: function (string, token, match, options) { - var valueCallback = function (value) { - if (value === 0) { - return 7; - } - - return value; - }; - - switch (token) { - // 2 - case 'i': - case 'ii': - // 02 - return parseNDigits(token.length, string); - // 2nd - - case 'io': - return match.ordinalNumber(string, { - unit: 'day' - }); - // Tue - - case 'iii': - return match.day(string, { - width: 'abbreviated', - context: 'formatting', - valueCallback: valueCallback - }) || match.day(string, { - width: 'short', - context: 'formatting', - valueCallback: valueCallback - }) || match.day(string, { - width: 'narrow', - context: 'formatting', - valueCallback: valueCallback - }); - // T - - case 'iiiii': - return match.day(string, { - width: 'narrow', - context: 'formatting', - valueCallback: valueCallback - }); - // Tu - - case 'iiiiii': - return match.day(string, { - width: 'short', - context: 'formatting', - valueCallback: valueCallback - }) || match.day(string, { - width: 'narrow', - context: 'formatting', - valueCallback: valueCallback - }); - // Tuesday - - case 'iiii': - default: - return match.day(string, { - width: 'wide', - context: 'formatting', - valueCallback: valueCallback - }) || match.day(string, { - width: 'abbreviated', - context: 'formatting', - valueCallback: valueCallback - }) || match.day(string, { - width: 'short', - context: 'formatting', - valueCallback: valueCallback - }) || match.day(string, { - width: 'narrow', - context: 'formatting', - valueCallback: valueCallback - }); - } - }, - validate: function (date, value, options) { - return value >= 1 && value <= 7; - }, - set: function (date, flags, value, options) { - date = Object(_lib_setUTCISODay_index_js__WEBPACK_IMPORTED_MODULE_4__["default"])(date, value, options); - date.setUTCHours(0, 0, 0, 0); - return date; - } - }, - // AM or PM - a: { - priority: 80, - parse: function (string, token, match, options) { - switch (token) { - case 'a': - case 'aa': - case 'aaa': - return match.dayPeriod(string, { - width: 'abbreviated', - context: 'formatting' - }) || match.dayPeriod(string, { - width: 'narrow', - context: 'formatting' - }); - - case 'aaaaa': - return match.dayPeriod(string, { - width: 'narrow', - context: 'formatting' - }); - - case 'aaaa': - default: - return match.dayPeriod(string, { - width: 'wide', - context: 'formatting' - }) || match.dayPeriod(string, { - width: 'abbreviated', - context: 'formatting' - }) || match.dayPeriod(string, { - width: 'narrow', - context: 'formatting' - }); - } - }, - set: function (date, flags, value, options) { - date.setUTCHours(dayPeriodEnumToHours(value), 0, 0, 0); - return date; - } - }, - // AM, PM, midnight - b: { - priority: 80, - parse: function (string, token, match, options) { - switch (token) { - case 'b': - case 'bb': - case 'bbb': - return match.dayPeriod(string, { - width: 'abbreviated', - context: 'formatting' - }) || match.dayPeriod(string, { - width: 'narrow', - context: 'formatting' - }); - - case 'bbbbb': - return match.dayPeriod(string, { - width: 'narrow', - context: 'formatting' - }); - - case 'bbbb': - default: - return match.dayPeriod(string, { - width: 'wide', - context: 'formatting' - }) || match.dayPeriod(string, { - width: 'abbreviated', - context: 'formatting' - }) || match.dayPeriod(string, { - width: 'narrow', - context: 'formatting' - }); - } - }, - set: function (date, flags, value, options) { - date.setUTCHours(dayPeriodEnumToHours(value), 0, 0, 0); - return date; - } - }, - // in the morning, in the afternoon, in the evening, at night - B: { - priority: 80, - parse: function (string, token, match, options) { - switch (token) { - case 'B': - case 'BB': - case 'BBB': - return match.dayPeriod(string, { - width: 'abbreviated', - context: 'formatting' - }) || match.dayPeriod(string, { - width: 'narrow', - context: 'formatting' - }); - - case 'BBBBB': - return match.dayPeriod(string, { - width: 'narrow', - context: 'formatting' - }); - - case 'BBBB': - default: - return match.dayPeriod(string, { - width: 'wide', - context: 'formatting' - }) || match.dayPeriod(string, { - width: 'abbreviated', - context: 'formatting' - }) || match.dayPeriod(string, { - width: 'narrow', - context: 'formatting' - }); - } - }, - set: function (date, flags, value, options) { - date.setUTCHours(dayPeriodEnumToHours(value), 0, 0, 0); - return date; - } - }, - // Hour [1-12] - h: { - priority: 70, - parse: function (string, token, match, options) { - switch (token) { - case 'h': - return parseNumericPattern(numericPatterns.hour12h, string); - - case 'ho': - return match.ordinalNumber(string, { - unit: 'hour' - }); - - default: - return parseNDigits(token.length, string); - } - }, - validate: function (date, value, options) { - return value >= 1 && value <= 12; - }, - set: function (date, flags, value, options) { - var isPM = date.getUTCHours() >= 12; - - if (isPM && value < 12) { - date.setUTCHours(value + 12, 0, 0, 0); - } else if (!isPM && value === 12) { - date.setUTCHours(0, 0, 0, 0); - } else { - date.setUTCHours(value, 0, 0, 0); - } - - return date; - } - }, - // Hour [0-23] - H: { - priority: 70, - parse: function (string, token, match, options) { - switch (token) { - case 'H': - return parseNumericPattern(numericPatterns.hour23h, string); - - case 'Ho': - return match.ordinalNumber(string, { - unit: 'hour' - }); - - default: - return parseNDigits(token.length, string); - } - }, - validate: function (date, value, options) { - return value >= 0 && value <= 23; - }, - set: function (date, flags, value, options) { - date.setUTCHours(value, 0, 0, 0); - return date; - } - }, - // Hour [0-11] - K: { - priority: 70, - parse: function (string, token, match, options) { - switch (token) { - case 'K': - return parseNumericPattern(numericPatterns.hour11h, string); - - case 'Ko': - return match.ordinalNumber(string, { - unit: 'hour' - }); - - default: - return parseNDigits(token.length, string); - } - }, - validate: function (date, value, options) { - return value >= 0 && value <= 11; - }, - set: function (date, flags, value, options) { - var isPM = date.getUTCHours() >= 12; - - if (isPM && value < 12) { - date.setUTCHours(value + 12, 0, 0, 0); - } else { - date.setUTCHours(value, 0, 0, 0); - } - - return date; - } - }, - // Hour [1-24] - k: { - priority: 70, - parse: function (string, token, match, options) { - switch (token) { - case 'k': - return parseNumericPattern(numericPatterns.hour24h, string); - - case 'ko': - return match.ordinalNumber(string, { - unit: 'hour' - }); - - default: - return parseNDigits(token.length, string); - } - }, - validate: function (date, value, options) { - return value >= 1 && value <= 24; - }, - set: function (date, flags, value, options) { - var hours = value <= 24 ? value % 24 : value; - date.setUTCHours(hours, 0, 0, 0); - return date; - } - }, - // Minute - m: { - priority: 60, - parse: function (string, token, match, options) { - switch (token) { - case 'm': - return parseNumericPattern(numericPatterns.minute, string); - - case 'mo': - return match.ordinalNumber(string, { - unit: 'minute' - }); - - default: - return parseNDigits(token.length, string); - } - }, - validate: function (date, value, options) { - return value >= 0 && value <= 59; - }, - set: function (date, flags, value, options) { - date.setUTCMinutes(value, 0, 0); - return date; - } - }, - // Second - s: { - priority: 50, - parse: function (string, token, match, options) { - switch (token) { - case 's': - return parseNumericPattern(numericPatterns.second, string); - - case 'so': - return match.ordinalNumber(string, { - unit: 'second' - }); - - default: - return parseNDigits(token.length, string); - } - }, - validate: function (date, value, options) { - return value >= 0 && value <= 59; - }, - set: function (date, flags, value, options) { - date.setUTCSeconds(value, 0); - return date; - } - }, - // Fraction of second - S: { - priority: 30, - parse: function (string, token, match, options) { - var valueCallback = function (value) { - return Math.floor(value * Math.pow(10, -token.length + 3)); - }; - - return parseNDigits(token.length, string, valueCallback); - }, - set: function (date, flags, value, options) { - date.setUTCMilliseconds(value); - return date; - } - }, - // Timezone (ISO-8601. +00:00 is `'Z'`) - X: { - priority: 10, - parse: function (string, token, match, options) { - switch (token) { - case 'X': - return parseTimezonePattern(timezonePatterns.basicOptionalMinutes, string); - - case 'XX': - return parseTimezonePattern(timezonePatterns.basic, string); - - case 'XXXX': - return parseTimezonePattern(timezonePatterns.basicOptionalSeconds, string); - - case 'XXXXX': - return parseTimezonePattern(timezonePatterns.extendedOptionalSeconds, string); - - case 'XXX': - default: - return parseTimezonePattern(timezonePatterns.extended, string); - } - }, - set: function (date, flags, value, options) { - if (flags.timestampIsSet) { - return date; - } - - return new Date(date.getTime() - value); - } - }, - // Timezone (ISO-8601) - x: { - priority: 10, - parse: function (string, token, match, options) { - switch (token) { - case 'x': - return parseTimezonePattern(timezonePatterns.basicOptionalMinutes, string); - - case 'xx': - return parseTimezonePattern(timezonePatterns.basic, string); - - case 'xxxx': - return parseTimezonePattern(timezonePatterns.basicOptionalSeconds, string); - - case 'xxxxx': - return parseTimezonePattern(timezonePatterns.extendedOptionalSeconds, string); - - case 'xxx': - default: - return parseTimezonePattern(timezonePatterns.extended, string); - } - }, - set: function (date, flags, value, options) { - if (flags.timestampIsSet) { - return date; - } - - return new Date(date.getTime() - value); - } - }, - // Seconds timestamp - t: { - priority: 40, - parse: function (string, token, match, options) { - return parseAnyDigitsSigned(string); - }, - set: function (date, flags, value, options) { - return [new Date(value * 1000), { - timestampIsSet: true - }]; - } - }, - // Milliseconds timestamp - T: { - priority: 20, - parse: function (string, token, match, options) { - return parseAnyDigitsSigned(string); - }, - set: function (date, flags, value, options) { - return [new Date(value), { - timestampIsSet: true - }]; - } - } -}; -/* harmony default export */ __webpack_exports__["default"] = (parsers); - -/***/ }), - -/***/ "./node_modules/date-fns/esm/parse/index.js": -/*!**************************************************!*\ - !*** ./node_modules/date-fns/esm/parse/index.js ***! - \**************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return parse; }); -/* harmony import */ var _lib_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../_lib/toInteger/index.js */ "./node_modules/date-fns/esm/_lib/toInteger/index.js"); -/* harmony import */ var _lib_assign_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../_lib/assign/index.js */ "./node_modules/date-fns/esm/_lib/assign/index.js"); -/* harmony import */ var _lib_getTimezoneOffsetInMilliseconds_index_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../_lib/getTimezoneOffsetInMilliseconds/index.js */ "./node_modules/date-fns/esm/_lib/getTimezoneOffsetInMilliseconds/index.js"); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); -/* harmony import */ var _subMilliseconds_index_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../subMilliseconds/index.js */ "./node_modules/date-fns/esm/subMilliseconds/index.js"); -/* harmony import */ var _locale_en_US_index_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../locale/en-US/index.js */ "./node_modules/date-fns/esm/locale/en-US/index.js"); -/* harmony import */ var _lib_parsers_index_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./_lib/parsers/index.js */ "./node_modules/date-fns/esm/parse/_lib/parsers/index.js"); -/* harmony import */ var _lib_protectedTokens_index_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../_lib/protectedTokens/index.js */ "./node_modules/date-fns/esm/_lib/protectedTokens/index.js"); - - - - - - - - -var TIMEZONE_UNIT_PRIORITY = 10; // This RegExp consists of three parts separated by `|`: -// - [yYQqMLwIdDecihHKkms]o matches any available ordinal number token -// (one of the certain letters followed by `o`) -// - (\w)\1* matches any sequences of the same letter -// - '' matches two quote characters in a row -// - '(''|[^'])+('|$) matches anything surrounded by two quote characters ('), -// except a single quote symbol, which ends the sequence. -// Two quote characters do not end the sequence. -// If there is no matching single quote -// then the sequence will continue until the end of the string. -// - . matches any single character unmatched by previous parts of the RegExps - -var formattingTokensRegExp = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g; -var escapedStringRegExp = /^'(.*?)'?$/; -var doubleQuoteRegExp = /''/g; -var notWhitespaceRegExp = /\S/; -/** - * @name parse - * @category Common Helpers - * @summary Parse the date. - * - * @description - * Return the date parsed from string using the given format string. - * - * > âš ï¸ Please note that the `format` tokens differ from Moment.js and other libraries. - * > See: https://git.io/fxCyr - * - * The characters in the format string wrapped between two single quotes characters (') are escaped. - * Two single quotes in a row, whether inside or outside a quoted sequence, represent a 'real' single quote. - * - * Format of the format string is based on Unicode Technical Standard #35: - * https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table - * with a few additions (see note 5 below the table). - * - * Accepted format string patterns: - * | Unit |Prior| Pattern | Result examples | Notes | - * |---------------------------------|-----|---------|-----------------------------------|-------| - * | Era | 140 | G..GGG | AD, BC | | - * | | | GGGG | Anno Domini, Before Christ | 2 | - * | | | GGGGG | A, B | | - * | Calendar year | 130 | y | 44, 1, 1900, 2017, 9999 | 4 | - * | | | yo | 44th, 1st, 1900th, 9999999th | 4,5 | - * | | | yy | 44, 01, 00, 17 | 4 | - * | | | yyy | 044, 001, 123, 999 | 4 | - * | | | yyyy | 0044, 0001, 1900, 2017 | 4 | - * | | | yyyyy | ... | 2,4 | - * | Local week-numbering year | 130 | Y | 44, 1, 1900, 2017, 9000 | 4 | - * | | | Yo | 44th, 1st, 1900th, 9999999th | 4,5 | - * | | | YY | 44, 01, 00, 17 | 4,6 | - * | | | YYY | 044, 001, 123, 999 | 4 | - * | | | YYYY | 0044, 0001, 1900, 2017 | 4,6 | - * | | | YYYYY | ... | 2,4 | - * | ISO week-numbering year | 130 | R | -43, 1, 1900, 2017, 9999, -9999 | 4,5 | - * | | | RR | -43, 01, 00, 17 | 4,5 | - * | | | RRR | -043, 001, 123, 999, -999 | 4,5 | - * | | | RRRR | -0043, 0001, 2017, 9999, -9999 | 4,5 | - * | | | RRRRR | ... | 2,4,5 | - * | Extended year | 130 | u | -43, 1, 1900, 2017, 9999, -999 | 4 | - * | | | uu | -43, 01, 99, -99 | 4 | - * | | | uuu | -043, 001, 123, 999, -999 | 4 | - * | | | uuuu | -0043, 0001, 2017, 9999, -9999 | 4 | - * | | | uuuuu | ... | 2,4 | - * | Quarter (formatting) | 120 | Q | 1, 2, 3, 4 | | - * | | | Qo | 1st, 2nd, 3rd, 4th | 5 | - * | | | QQ | 01, 02, 03, 04 | | - * | | | QQQ | Q1, Q2, Q3, Q4 | | - * | | | QQQQ | 1st quarter, 2nd quarter, ... | 2 | - * | | | QQQQQ | 1, 2, 3, 4 | 4 | - * | Quarter (stand-alone) | 120 | q | 1, 2, 3, 4 | | - * | | | qo | 1st, 2nd, 3rd, 4th | 5 | - * | | | qq | 01, 02, 03, 04 | | - * | | | qqq | Q1, Q2, Q3, Q4 | | - * | | | qqqq | 1st quarter, 2nd quarter, ... | 2 | - * | | | qqqqq | 1, 2, 3, 4 | 3 | - * | Month (formatting) | 110 | M | 1, 2, ..., 12 | | - * | | | Mo | 1st, 2nd, ..., 12th | 5 | - * | | | MM | 01, 02, ..., 12 | | - * | | | MMM | Jan, Feb, ..., Dec | | - * | | | MMMM | January, February, ..., December | 2 | - * | | | MMMMM | J, F, ..., D | | - * | Month (stand-alone) | 110 | L | 1, 2, ..., 12 | | - * | | | Lo | 1st, 2nd, ..., 12th | 5 | - * | | | LL | 01, 02, ..., 12 | | - * | | | LLL | Jan, Feb, ..., Dec | | - * | | | LLLL | January, February, ..., December | 2 | - * | | | LLLLL | J, F, ..., D | | - * | Local week of year | 100 | w | 1, 2, ..., 53 | | - * | | | wo | 1st, 2nd, ..., 53th | 5 | - * | | | ww | 01, 02, ..., 53 | | - * | ISO week of year | 100 | I | 1, 2, ..., 53 | 5 | - * | | | Io | 1st, 2nd, ..., 53th | 5 | - * | | | II | 01, 02, ..., 53 | 5 | - * | Day of month | 90 | d | 1, 2, ..., 31 | | - * | | | do | 1st, 2nd, ..., 31st | 5 | - * | | | dd | 01, 02, ..., 31 | | - * | Day of year | 90 | D | 1, 2, ..., 365, 366 | 6 | - * | | | Do | 1st, 2nd, ..., 365th, 366th | 5 | - * | | | DD | 01, 02, ..., 365, 366 | 6 | - * | | | DDD | 001, 002, ..., 365, 366 | | - * | | | DDDD | ... | 2 | - * | Day of week (formatting) | 90 | E..EEE | Mon, Tue, Wed, ..., Su | | - * | | | EEEE | Monday, Tuesday, ..., Sunday | 2 | - * | | | EEEEE | M, T, W, T, F, S, S | | - * | | | EEEEEE | Mo, Tu, We, Th, Fr, Su, Sa | | - * | ISO day of week (formatting) | 90 | i | 1, 2, 3, ..., 7 | 5 | - * | | | io | 1st, 2nd, ..., 7th | 5 | - * | | | ii | 01, 02, ..., 07 | 5 | - * | | | iii | Mon, Tue, Wed, ..., Su | 5 | - * | | | iiii | Monday, Tuesday, ..., Sunday | 2,5 | - * | | | iiiii | M, T, W, T, F, S, S | 5 | - * | | | iiiiii | Mo, Tu, We, Th, Fr, Su, Sa | 5 | - * | Local day of week (formatting) | 90 | e | 2, 3, 4, ..., 1 | | - * | | | eo | 2nd, 3rd, ..., 1st | 5 | - * | | | ee | 02, 03, ..., 01 | | - * | | | eee | Mon, Tue, Wed, ..., Su | | - * | | | eeee | Monday, Tuesday, ..., Sunday | 2 | - * | | | eeeee | M, T, W, T, F, S, S | | - * | | | eeeeee | Mo, Tu, We, Th, Fr, Su, Sa | | - * | Local day of week (stand-alone) | 90 | c | 2, 3, 4, ..., 1 | | - * | | | co | 2nd, 3rd, ..., 1st | 5 | - * | | | cc | 02, 03, ..., 01 | | - * | | | ccc | Mon, Tue, Wed, ..., Su | | - * | | | cccc | Monday, Tuesday, ..., Sunday | 2 | - * | | | ccccc | M, T, W, T, F, S, S | | - * | | | cccccc | Mo, Tu, We, Th, Fr, Su, Sa | | - * | AM, PM | 80 | a..aaa | AM, PM | | - * | | | aaaa | a.m., p.m. | 2 | - * | | | aaaaa | a, p | | - * | AM, PM, noon, midnight | 80 | b..bbb | AM, PM, noon, midnight | | - * | | | bbbb | a.m., p.m., noon, midnight | 2 | - * | | | bbbbb | a, p, n, mi | | - * | Flexible day period | 80 | B..BBB | at night, in the morning, ... | | - * | | | BBBB | at night, in the morning, ... | 2 | - * | | | BBBBB | at night, in the morning, ... | | - * | Hour [1-12] | 70 | h | 1, 2, ..., 11, 12 | | - * | | | ho | 1st, 2nd, ..., 11th, 12th | 5 | - * | | | hh | 01, 02, ..., 11, 12 | | - * | Hour [0-23] | 70 | H | 0, 1, 2, ..., 23 | | - * | | | Ho | 0th, 1st, 2nd, ..., 23rd | 5 | - * | | | HH | 00, 01, 02, ..., 23 | | - * | Hour [0-11] | 70 | K | 1, 2, ..., 11, 0 | | - * | | | Ko | 1st, 2nd, ..., 11th, 0th | 5 | - * | | | KK | 1, 2, ..., 11, 0 | | - * | Hour [1-24] | 70 | k | 24, 1, 2, ..., 23 | | - * | | | ko | 24th, 1st, 2nd, ..., 23rd | 5 | - * | | | kk | 24, 01, 02, ..., 23 | | - * | Minute | 60 | m | 0, 1, ..., 59 | | - * | | | mo | 0th, 1st, ..., 59th | 5 | - * | | | mm | 00, 01, ..., 59 | | - * | Second | 50 | s | 0, 1, ..., 59 | | - * | | | so | 0th, 1st, ..., 59th | 5 | - * | | | ss | 00, 01, ..., 59 | | - * | Seconds timestamp | 40 | t | 512969520 | | - * | | | tt | ... | 2 | - * | Fraction of second | 30 | S | 0, 1, ..., 9 | | - * | | | SS | 00, 01, ..., 99 | | - * | | | SSS | 000, 0001, ..., 999 | | - * | | | SSSS | ... | 2 | - * | Milliseconds timestamp | 20 | T | 512969520900 | | - * | | | TT | ... | 2 | - * | Timezone (ISO-8601 w/ Z) | 10 | X | -08, +0530, Z | | - * | | | XX | -0800, +0530, Z | | - * | | | XXX | -08:00, +05:30, Z | | - * | | | XXXX | -0800, +0530, Z, +123456 | 2 | - * | | | XXXXX | -08:00, +05:30, Z, +12:34:56 | | - * | Timezone (ISO-8601 w/o Z) | 10 | x | -08, +0530, +00 | | - * | | | xx | -0800, +0530, +0000 | | - * | | | xxx | -08:00, +05:30, +00:00 | 2 | - * | | | xxxx | -0800, +0530, +0000, +123456 | | - * | | | xxxxx | -08:00, +05:30, +00:00, +12:34:56 | | - * Notes: - * 1. "Formatting" units (e.g. formatting quarter) in the default en-US locale - * are the same as "stand-alone" units, but are different in some languages. - * "Formatting" units are declined according to the rules of the language - * in the context of a date. "Stand-alone" units are always nominative singular. - * In `format` function, they will produce different result: - * - * `format(new Date(2017, 10, 6), 'do LLLL', {locale: cs}) //=> '6. listopad'` - * - * `format(new Date(2017, 10, 6), 'do MMMM', {locale: cs}) //=> '6. listopadu'` - * - * `parse` will try to match both formatting and stand-alone units interchangably. - * - * 2. Any sequence of the identical letters is a pattern, unless it is escaped by - * the single quote characters (see below). - * If the sequence is longer than listed in table: - * - for numerical units (`yyyyyyyy`) `parse` will try to match a number - * as wide as the sequence - * - for text units (`MMMMMMMM`) `parse` will try to match the widest variation of the unit. - * These variations are marked with "2" in the last column of the table. - * - * 3. `QQQQQ` and `qqqqq` could be not strictly numerical in some locales. - * These tokens represent the shortest form of the quarter. - * - * 4. The main difference between `y` and `u` patterns are B.C. years: - * - * | Year | `y` | `u` | - * |------|-----|-----| - * | AC 1 | 1 | 1 | - * | BC 1 | 1 | 0 | - * | BC 2 | 2 | -1 | - * - * Also `yy` will try to guess the century of two digit year by proximity with `baseDate`: - * - * `parse('50', 'yy', new Date(2018, 0, 1)) //=> Sat Jan 01 2050 00:00:00` - * - * `parse('75', 'yy', new Date(2018, 0, 1)) //=> Wed Jan 01 1975 00:00:00` - * - * while `uu` will just assign the year as is: - * - * `parse('50', 'uu', new Date(2018, 0, 1)) //=> Sat Jan 01 0050 00:00:00` - * - * `parse('75', 'uu', new Date(2018, 0, 1)) //=> Tue Jan 01 0075 00:00:00` - * - * The same difference is true for local and ISO week-numbering years (`Y` and `R`), - * except local week-numbering years are dependent on `options.weekStartsOn` - * and `options.firstWeekContainsDate` (compare [setISOWeekYear]{@link https://date-fns.org/docs/setISOWeekYear} - * and [setWeekYear]{@link https://date-fns.org/docs/setWeekYear}). - * - * 5. These patterns are not in the Unicode Technical Standard #35: - * - `i`: ISO day of week - * - `I`: ISO week of year - * - `R`: ISO week-numbering year - * - `o`: ordinal number modifier - * - * 6. These tokens are often confused with others. See: https://git.io/fxCyr - * - * Values will be assigned to the date in the descending order of its unit's priority. - * Units of an equal priority overwrite each other in the order of appearance. - * - * If no values of higher priority are parsed (e.g. when parsing string 'January 1st' without a year), - * the values will be taken from 3rd argument `baseDate` which works as a context of parsing. - * - * `baseDate` must be passed for correct work of the function. - * If you're not sure which `baseDate` to supply, create a new instance of Date: - * `parse('02/11/2014', 'MM/dd/yyyy', new Date())` - * In this case parsing will be done in the context of the current date. - * If `baseDate` is `Invalid Date` or a value not convertible to valid `Date`, - * then `Invalid Date` will be returned. - * - * The result may vary by locale. - * - * If `formatString` matches with `dateString` but does not provides tokens, `baseDate` will be returned. - * - * If parsing failed, `Invalid Date` will be returned. - * Invalid Date is a Date, whose time value is NaN. - * Time value of Date: http://es5.github.io/#x15.9.1.1 - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * - Old `parse` was renamed to `toDate`. - * Now `parse` is a new function which parses a string using a provided format. - * - * ```javascript - * // Before v2.0.0 - * parse('2016-01-01') - * - * // v2.0.0 onward - * toDate('2016-01-01') - * parse('2016-01-01', 'yyyy-MM-dd', new Date()) - * ``` - * - * @param {String} dateString - the string to parse - * @param {String} formatString - the string of tokens - * @param {Date|Number} baseDate - defines values missing from the parsed dateString - * @param {Object} [options] - an object with options. - * @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale} - * @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday) - * @param {1|2|3|4|5|6|7} [options.firstWeekContainsDate=1] - the day of January, which is always in the first week of the year - * @param {Boolean} [options.awareOfUnicodeTokens=false] - if true, allows usage of Unicode tokens causes confusion: - * - Some of the day of year tokens (`D`, `DD`) that are confused with the day of month tokens (`d`, `dd`). - * - Some of the local week-numbering year tokens (`YY`, `YYYY`) that are confused with the calendar year tokens (`yy`, `yyyy`). - * See: https://git.io/fxCyr - * @returns {Date} the parsed date - * @throws {TypeError} 3 arguments required - * @throws {RangeError} `options.weekStartsOn` must be between 0 and 6 - * @throws {RangeError} `options.firstWeekContainsDate` must be between 1 and 7 - * @throws {RangeError} `options.locale` must contain `match` property - * @throws {RangeError} `options.awareOfUnicodeTokens` must be set to `true` to use `XX` token; see: https://git.io/fxCyr - * - * @example - * // Parse 11 February 2014 from middle-endian format: - * var result = parse('02/11/2014', 'MM/dd/yyyy', new Date()) - * //=> Tue Feb 11 2014 00:00:00 - * - * @example - * // Parse 28th of February in Esperanto locale in the context of 2010 year: - * import eo from 'date-fns/locale/eo' - * var result = parse('28-a de februaro', "do 'de' MMMM", new Date(2010, 0, 1), { - * locale: eo - * }) - * //=> Sun Feb 28 2010 00:00:00 - */ - -function parse(dirtyDateString, dirtyFormatString, dirtyBaseDate, dirtyOptions) { - if (arguments.length < 3) { - throw new TypeError('3 arguments required, but only ' + arguments.length + ' present'); - } - - var dateString = String(dirtyDateString); - var formatString = String(dirtyFormatString); - var options = dirtyOptions || {}; - var locale = options.locale || _locale_en_US_index_js__WEBPACK_IMPORTED_MODULE_5__["default"]; - - if (!locale.match) { - throw new RangeError('locale must contain match property'); - } - - var localeFirstWeekContainsDate = locale.options && locale.options.firstWeekContainsDate; - var defaultFirstWeekContainsDate = localeFirstWeekContainsDate == null ? 1 : Object(_lib_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(localeFirstWeekContainsDate); - var firstWeekContainsDate = options.firstWeekContainsDate == null ? defaultFirstWeekContainsDate : Object(_lib_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(options.firstWeekContainsDate); // Test if weekStartsOn is between 1 and 7 _and_ is not NaN - - if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) { - throw new RangeError('firstWeekContainsDate must be between 1 and 7 inclusively'); - } - - var localeWeekStartsOn = locale.options && locale.options.weekStartsOn; - var defaultWeekStartsOn = localeWeekStartsOn == null ? 0 : Object(_lib_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(localeWeekStartsOn); - var weekStartsOn = options.weekStartsOn == null ? defaultWeekStartsOn : Object(_lib_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(options.weekStartsOn); // Test if weekStartsOn is between 0 and 6 _and_ is not NaN - - if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) { - throw new RangeError('weekStartsOn must be between 0 and 6 inclusively'); - } - - if (formatString === '') { - if (dateString === '') { - return Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_3__["default"])(dirtyBaseDate); - } else { - return new Date(NaN); - } - } - - var subFnOptions = { - firstWeekContainsDate: firstWeekContainsDate, - weekStartsOn: weekStartsOn, - locale: locale - }; // If timezone isn't specified, it will be set to the system timezone - - var setters = [{ - priority: TIMEZONE_UNIT_PRIORITY, - set: dateToSystemTimezone, - index: 0 - }]; - var i; - var tokens = formatString.match(formattingTokensRegExp); - - for (i = 0; i < tokens.length; i++) { - var token = tokens[i]; - - if (!options.awareOfUnicodeTokens && Object(_lib_protectedTokens_index_js__WEBPACK_IMPORTED_MODULE_7__["isProtectedToken"])(token)) { - Object(_lib_protectedTokens_index_js__WEBPACK_IMPORTED_MODULE_7__["throwProtectedError"])(token); - } - - var firstCharacter = token[0]; - var parser = _lib_parsers_index_js__WEBPACK_IMPORTED_MODULE_6__["default"][firstCharacter]; - - if (parser) { - var parseResult = parser.parse(dateString, token, locale.match, subFnOptions); - - if (!parseResult) { - return new Date(NaN); - } - - setters.push({ - priority: parser.priority, - set: parser.set, - validate: parser.validate, - value: parseResult.value, - index: setters.length - }); - dateString = parseResult.rest; - } else { - // Replace two single quote characters with one single quote character - if (token === "''") { - token = "'"; - } else if (firstCharacter === "'") { - token = cleanEscapedString(token); - } // Cut token from string, or, if string doesn't match the token, return Invalid Date - - - if (dateString.indexOf(token) === 0) { - dateString = dateString.slice(token.length); - } else { - return new Date(NaN); - } - } - } // Check if the remaining input contains something other than whitespace - - - if (dateString.length > 0 && notWhitespaceRegExp.test(dateString)) { - return new Date(NaN); - } - - var uniquePrioritySetters = setters.map(function (setter) { - return setter.priority; - }).sort(function (a, b) { - return b - a; - }).filter(function (priority, index, array) { - return array.indexOf(priority) === index; - }).map(function (priority) { - return setters.filter(function (setter) { - return setter.priority === priority; - }).reverse(); - }).map(function (setterArray) { - return setterArray[0]; - }); - var date = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_3__["default"])(dirtyBaseDate); - - if (isNaN(date)) { - return new Date(NaN); - } // Convert the date in system timezone to the same date in UTC+00:00 timezone. - // This ensures that when UTC functions will be implemented, locales will be compatible with them. - // See an issue about UTC functions: https://github.com/date-fns/date-fns/issues/37 - - - var utcDate = Object(_subMilliseconds_index_js__WEBPACK_IMPORTED_MODULE_4__["default"])(date, Object(_lib_getTimezoneOffsetInMilliseconds_index_js__WEBPACK_IMPORTED_MODULE_2__["default"])(date)); - var flags = {}; - - for (i = 0; i < uniquePrioritySetters.length; i++) { - var setter = uniquePrioritySetters[i]; - - if (setter.validate && !setter.validate(utcDate, setter.value, subFnOptions)) { - return new Date(NaN); - } - - var result = setter.set(utcDate, flags, setter.value, subFnOptions); // Result is tuple (date, flags) - - if (result[0]) { - utcDate = result[0]; - Object(_lib_assign_index_js__WEBPACK_IMPORTED_MODULE_1__["default"])(flags, result[1]); // Result is date - } else { - utcDate = result; - } - } - - return utcDate; -} - -function dateToSystemTimezone(date, flags) { - if (flags.timestampIsSet) { - return date; - } - - var convertedDate = new Date(0); - convertedDate.setFullYear(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate()); - convertedDate.setHours(date.getUTCHours(), date.getUTCMinutes(), date.getUTCSeconds(), date.getUTCMilliseconds()); - return convertedDate; -} - -function cleanEscapedString(input) { - return input.match(escapedStringRegExp)[1].replace(doubleQuoteRegExp, "'"); -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/parseISO/index.js": -/*!*****************************************************!*\ - !*** ./node_modules/date-fns/esm/parseISO/index.js ***! - \*****************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return parseISO; }); -/* harmony import */ var _lib_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../_lib/toInteger/index.js */ "./node_modules/date-fns/esm/_lib/toInteger/index.js"); -/* harmony import */ var _lib_getTimezoneOffsetInMilliseconds_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../_lib/getTimezoneOffsetInMilliseconds/index.js */ "./node_modules/date-fns/esm/_lib/getTimezoneOffsetInMilliseconds/index.js"); - - -var MILLISECONDS_IN_HOUR = 3600000; -var MILLISECONDS_IN_MINUTE = 60000; -var DEFAULT_ADDITIONAL_DIGITS = 2; -var patterns = { - dateTimeDelimiter: /[T ]/, - timeZoneDelimiter: /[Z ]/i, - timezone: /([Z+-].*)$/ -}; -var dateRegex = /^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/; -var timeRegex = /^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/; -var timezoneRegex = /^([+-])(\d{2})(?::?(\d{2}))?$/; -/** - * @name parseISO - * @category Common Helpers - * @summary Parse ISO string - * - * @description - * Parse the given string in ISO 8601 format and return an instance of Date. - * - * Function accepts complete ISO 8601 formats as well as partial implementations. - * ISO 8601: http://en.wikipedia.org/wiki/ISO_8601 - * - * If the argument isn't a string, the function cannot parse the string or - * the values are invalid, it returns Invalid Date. - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * - The previous `parse` implementation was renamed to `parseISO`. - * - * ```javascript - * // Before v2.0.0 - * parse('2016-01-01') - * - * // v2.0.0 onward - * parseISO('2016-01-01') - * ``` - * - * - `parseISO` now validates separate date and time values in ISO-8601 strings - * and returns `Invalid Date` if the date is invalid. - * - * ```javascript - * parseISO('2018-13-32') - * //=> Invalid Date - * ``` - * - * - `parseISO` now doesn't fall back to `new Date` constructor - * if it fails to parse a string argument. Instead, it returns `Invalid Date`. - * - * @param {String} argument - the value to convert - * @param {Object} [options] - an object with options. - * @param {0|1|2} [options.additionalDigits=2] - the additional number of digits in the extended year format - * @returns {Date} the parsed date in the local time zone - * @throws {TypeError} 1 argument required - * @throws {RangeError} `options.additionalDigits` must be 0, 1 or 2 - * - * @example - * // Convert string '2014-02-11T11:30:30' to date: - * var result = parseISO('2014-02-11T11:30:30') - * //=> Tue Feb 11 2014 11:30:30 - * - * @example - * // Convert string '+02014101' to date, - * // if the additional number of digits in the extended year format is 1: - * var result = parseISO('+02014101', { additionalDigits: 1 }) - * //=> Fri Apr 11 2014 00:00:00 - */ - -function parseISO(argument, dirtyOptions) { - if (arguments.length < 1) { - throw new TypeError('1 argument required, but only ' + arguments.length + ' present'); - } - - var options = dirtyOptions || {}; - var additionalDigits = options.additionalDigits == null ? DEFAULT_ADDITIONAL_DIGITS : Object(_lib_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(options.additionalDigits); - - if (additionalDigits !== 2 && additionalDigits !== 1 && additionalDigits !== 0) { - throw new RangeError('additionalDigits must be 0, 1 or 2'); - } - - if (!(typeof argument === 'string' || Object.prototype.toString.call(argument) === '[object String]')) { - return new Date(NaN); - } - - var dateStrings = splitDateString(argument); - var parseYearResult = parseYear(dateStrings.date, additionalDigits); - var date = parseDate(parseYearResult.restDateString, parseYearResult.year); - - if (isNaN(date) || !date) { - return new Date(NaN); - } - - var timestamp = date.getTime(); - var time = 0; - var offset; - - if (dateStrings.time) { - time = parseTime(dateStrings.time); - - if (isNaN(time)) { - return new Date(NaN); - } - } - - if (dateStrings.timezone) { - offset = parseTimezone(dateStrings.timezone); - - if (isNaN(offset)) { - return new Date(NaN); - } - } else { - var fullTime = timestamp + time; - var fullTimeDate = new Date(fullTime); - offset = Object(_lib_getTimezoneOffsetInMilliseconds_index_js__WEBPACK_IMPORTED_MODULE_1__["default"])(fullTimeDate); // Adjust time when it's coming from DST - - var fullTimeDateNextDay = new Date(fullTime); - fullTimeDateNextDay.setDate(fullTimeDate.getDate() + 1); - var offsetDiff = Object(_lib_getTimezoneOffsetInMilliseconds_index_js__WEBPACK_IMPORTED_MODULE_1__["default"])(fullTimeDateNextDay) - offset; - - if (offsetDiff > 0) { - offset += offsetDiff; - } - } - - return new Date(timestamp + time + offset); -} - -function splitDateString(dateString) { - var dateStrings = {}; - var array = dateString.split(patterns.dateTimeDelimiter); - var timeString; - - if (/:/.test(array[0])) { - dateStrings.date = null; - timeString = array[0]; - } else { - dateStrings.date = array[0]; - timeString = array[1]; - - if (patterns.timeZoneDelimiter.test(dateStrings.date)) { - dateStrings.date = dateString.split(patterns.timeZoneDelimiter)[0]; - timeString = dateString.substr(dateStrings.date.length, dateString.length); - } - } - - if (timeString) { - var token = patterns.timezone.exec(timeString); - - if (token) { - dateStrings.time = timeString.replace(token[1], ''); - dateStrings.timezone = token[1]; - } else { - dateStrings.time = timeString; - } - } - - return dateStrings; -} - -function parseYear(dateString, additionalDigits) { - var regex = new RegExp('^(?:(\\d{4}|[+-]\\d{' + (4 + additionalDigits) + '})|(\\d{2}|[+-]\\d{' + (2 + additionalDigits) + '})$)'); - var captures = dateString.match(regex); // Invalid ISO-formatted year - - if (!captures) return { - year: null - }; - var year = captures[1] && parseInt(captures[1]); - var century = captures[2] && parseInt(captures[2]); - return { - year: century == null ? year : century * 100, - restDateString: dateString.slice((captures[1] || captures[2]).length) - }; -} - -function parseDate(dateString, year) { - // Invalid ISO-formatted year - if (year === null) return null; - var captures = dateString.match(dateRegex); // Invalid ISO-formatted string - - if (!captures) return null; - var isWeekDate = !!captures[4]; - var dayOfYear = parseDateUnit(captures[1]); - var month = parseDateUnit(captures[2]) - 1; - var day = parseDateUnit(captures[3]); - var week = parseDateUnit(captures[4]) - 1; - var dayOfWeek = parseDateUnit(captures[5]) - 1; - - if (isWeekDate) { - if (!validateWeekDate(year, week, dayOfWeek)) { - return new Date(NaN); - } - - return dayOfISOWeekYear(year, week, dayOfWeek); - } else { - var date = new Date(0); - - if (!validateDate(year, month, day) || !validateDayOfYearDate(year, dayOfYear)) { - return new Date(NaN); - } - - date.setUTCFullYear(year, month, Math.max(dayOfYear, day)); - return date; - } -} - -function parseDateUnit(value) { - return value ? parseInt(value) : 1; -} - -function parseTime(timeString) { - var captures = timeString.match(timeRegex); - if (!captures) return null; // Invalid ISO-formatted time - - var hours = parseTimeUnit(captures[1]); - var minutes = parseTimeUnit(captures[2]); - var seconds = parseTimeUnit(captures[3]); - - if (!validateTime(hours, minutes, seconds)) { - return NaN; - } - - return hours % 24 * MILLISECONDS_IN_HOUR + minutes * MILLISECONDS_IN_MINUTE + seconds * 1000; -} - -function parseTimeUnit(value) { - return value && parseFloat(value.replace(',', '.')) || 0; -} - -function parseTimezone(timezoneString) { - if (timezoneString === 'Z') return 0; - var captures = timezoneString.match(timezoneRegex); - if (!captures) return 0; - var sign = captures[1] === '+' ? -1 : 1; - var hours = parseInt(captures[2]); - var minutes = captures[3] && parseInt(captures[3]) || 0; - - if (!validateTimezone(hours, minutes)) { - return NaN; - } - - return sign * (hours * MILLISECONDS_IN_HOUR + minutes * MILLISECONDS_IN_MINUTE); -} - -function dayOfISOWeekYear(isoWeekYear, week, day) { - var date = new Date(0); - date.setUTCFullYear(isoWeekYear, 0, 4); - var fourthOfJanuaryDay = date.getUTCDay() || 7; - var diff = (week || 0) * 7 + (day || 0) + 1 - fourthOfJanuaryDay; - date.setUTCDate(date.getUTCDate() + diff); - return date; -} // Validation functions -// February is null to handle the leap year (using ||) - - -var daysInMonths = [31, null, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; - -function isLeapYearIndex(year) { - return year % 400 === 0 || year % 4 === 0 && year % 100; -} - -function validateDate(year, month, date) { - return !(month < 0 || month > 11 || date < 1 || date > (daysInMonths[month] || (isLeapYearIndex(year) ? 29 : 28))); -} - -function validateDayOfYearDate(year, dayOfYear) { - return !(dayOfYear < 1 || dayOfYear > (isLeapYearIndex(year) ? 366 : 365)); -} - -function validateWeekDate(_year, week, day) { - return !(week < 0 || week > 52 || day < 0 || day > 6); -} - -function validateTime(hours, minutes, seconds) { - return !(seconds < 0 || seconds >= 60 || minutes < 0 || minutes >= 60 || hours < 0 || hours >= 25); -} - -function validateTimezone(_hours, minutes) { - return !(minutes < 0 || minutes > 59); -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/roundToNearestMinutes/index.js": -/*!******************************************************************!*\ - !*** ./node_modules/date-fns/esm/roundToNearestMinutes/index.js ***! - \******************************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return roundToNearestMinutes; }); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); -/* harmony import */ var _lib_toInteger_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../_lib/toInteger/index.js */ "./node_modules/date-fns/esm/_lib/toInteger/index.js"); - - -/** - * @name roundToNearestMinutes - * @category Minute Helpers - * @summary Rounds the given date to the nearest minute - * - * @description - * Rounds the given date to the nearest minute - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} date - the date to round - * @param {Object} [options] - an object with options. - * @param {Number} [options.nearestTo=1] - passed to `toDate`. See [toDate]{@link https://date-fns.org/docs/toDate} - * @returns {Date} the new date rounded to the closest minute - * @throws {TypeError} 1 argument required - * @throws {RangeError} `options.nearestTo` must be between 1 and 30 - * - * @example - * // Round 10 July 2014 12:12:34 to nearest minute: - * var result = roundToNearestMinutes(new Date(2014, 6, 10, 12, 12, 34)) - * //=> Thu Jul 10 2014 12:13:00 - */ - -function roundToNearestMinutes(dirtyDate, options) { - if (arguments.length < 1) { - throw new TypeError('1 argument required, but only none provided present'); - } - - var nearestTo = options && 'nearestTo' in options ? Object(_lib_toInteger_index_js__WEBPACK_IMPORTED_MODULE_1__["default"])(options.nearestTo) : 1; - - if (nearestTo < 1 || nearestTo > 30) { - throw new RangeError('`options.nearestTo` must be between 1 and 30'); - } - - var date = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDate); - var seconds = date.getSeconds(); // relevant if nearestTo is 1, which is the default case - - var minutes = date.getMinutes() + seconds / 60; - var roundedMinutes = Math.floor(minutes / nearestTo) * nearestTo; - var remainderMinutes = minutes % nearestTo; - var addedMinutes = Math.round(remainderMinutes / nearestTo) * nearestTo; - return new Date(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), roundedMinutes + addedMinutes); -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/setDate/index.js": -/*!****************************************************!*\ - !*** ./node_modules/date-fns/esm/setDate/index.js ***! - \****************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return setDate; }); -/* harmony import */ var _lib_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../_lib/toInteger/index.js */ "./node_modules/date-fns/esm/_lib/toInteger/index.js"); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); - - -/** - * @name setDate - * @category Day Helpers - * @summary Set the day of the month to the given date. - * - * @description - * Set the day of the month to the given date. - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} date - the date to be changed - * @param {Number} dayOfMonth - the day of the month of the new date - * @returns {Date} the new date with the day of the month set - * @throws {TypeError} 2 arguments required - * - * @example - * // Set the 30th day of the month to 1 September 2014: - * var result = setDate(new Date(2014, 8, 1), 30) - * //=> Tue Sep 30 2014 00:00:00 - */ - -function setDate(dirtyDate, dirtyDayOfMonth) { - if (arguments.length < 2) { - throw new TypeError('2 arguments required, but only ' + arguments.length + ' present'); - } - - var date = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_1__["default"])(dirtyDate); - var dayOfMonth = Object(_lib_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDayOfMonth); - date.setDate(dayOfMonth); - return date; -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/setDay/index.js": -/*!***************************************************!*\ - !*** ./node_modules/date-fns/esm/setDay/index.js ***! - \***************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return setDay; }); -/* harmony import */ var _lib_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../_lib/toInteger/index.js */ "./node_modules/date-fns/esm/_lib/toInteger/index.js"); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); -/* harmony import */ var _addDays_index_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../addDays/index.js */ "./node_modules/date-fns/esm/addDays/index.js"); - - - -/** - * @name setDay - * @category Weekday Helpers - * @summary Set the day of the week to the given date. - * - * @description - * Set the day of the week to the given date. - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} date - the date to be changed - * @param {Number} day - the day of the week of the new date - * @param {Object} [options] - an object with options. - * @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday) - * @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale} - * @returns {Date} the new date with the day of the week set - * @throws {TypeError} 2 arguments required - * @throws {RangeError} `options.weekStartsOn` must be between 0 and 6 - * - * @example - * // Set Sunday to 1 September 2014: - * var result = setDay(new Date(2014, 8, 1), 0) - * //=> Sun Aug 31 2014 00:00:00 - * - * @example - * // If week starts with Monday, set Sunday to 1 September 2014: - * var result = setDay(new Date(2014, 8, 1), 0, { weekStartsOn: 1 }) - * //=> Sun Sep 07 2014 00:00:00 - */ - -function setDay(dirtyDate, dirtyDay, dirtyOptions) { - if (arguments.length < 2) { - throw new TypeError('2 arguments required, but only ' + arguments.length + ' present'); - } - - var options = dirtyOptions || {}; - var locale = options.locale; - var localeWeekStartsOn = locale && locale.options && locale.options.weekStartsOn; - var defaultWeekStartsOn = localeWeekStartsOn == null ? 0 : Object(_lib_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(localeWeekStartsOn); - var weekStartsOn = options.weekStartsOn == null ? defaultWeekStartsOn : Object(_lib_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(options.weekStartsOn); // Test if weekStartsOn is between 0 and 6 _and_ is not NaN - - if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) { - throw new RangeError('weekStartsOn must be between 0 and 6 inclusively'); - } - - var date = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_1__["default"])(dirtyDate, options); - var day = Object(_lib_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDay); - var currentDay = date.getDay(); - var remainder = day % 7; - var dayIndex = (remainder + 7) % 7; - var diff = (dayIndex < weekStartsOn ? 7 : 0) + day - currentDay; - return Object(_addDays_index_js__WEBPACK_IMPORTED_MODULE_2__["default"])(date, diff, options); -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/setDayOfYear/index.js": -/*!*********************************************************!*\ - !*** ./node_modules/date-fns/esm/setDayOfYear/index.js ***! - \*********************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return setDayOfYear; }); -/* harmony import */ var _lib_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../_lib/toInteger/index.js */ "./node_modules/date-fns/esm/_lib/toInteger/index.js"); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); - - -/** - * @name setDayOfYear - * @category Day Helpers - * @summary Set the day of the year to the given date. - * - * @description - * Set the day of the year to the given date. - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} date - the date to be changed - * @param {Number} dayOfYear - the day of the year of the new date - * @returns {Date} the new date with the day of the year set - * @throws {TypeError} 2 arguments required - * - * @example - * // Set the 2nd day of the year to 2 July 2014: - * var result = setDayOfYear(new Date(2014, 6, 2), 2) - * //=> Thu Jan 02 2014 00:00:00 - */ - -function setDayOfYear(dirtyDate, dirtyDayOfYear) { - if (arguments.length < 2) { - throw new TypeError('2 arguments required, but only ' + arguments.length + ' present'); - } - - var date = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_1__["default"])(dirtyDate); - var dayOfYear = Object(_lib_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDayOfYear); - date.setMonth(0); - date.setDate(dayOfYear); - return date; -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/setHours/index.js": -/*!*****************************************************!*\ - !*** ./node_modules/date-fns/esm/setHours/index.js ***! - \*****************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return setHours; }); -/* harmony import */ var _lib_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../_lib/toInteger/index.js */ "./node_modules/date-fns/esm/_lib/toInteger/index.js"); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); - - -/** - * @name setHours - * @category Hour Helpers - * @summary Set the hours to the given date. - * - * @description - * Set the hours to the given date. - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} date - the date to be changed - * @param {Number} hours - the hours of the new date - * @returns {Date} the new date with the hours set - * @throws {TypeError} 2 arguments required - * - * @example - * // Set 4 hours to 1 September 2014 11:30:00: - * var result = setHours(new Date(2014, 8, 1, 11, 30), 4) - * //=> Mon Sep 01 2014 04:30:00 - */ - -function setHours(dirtyDate, dirtyHours) { - if (arguments.length < 2) { - throw new TypeError('2 arguments required, but only ' + arguments.length + ' present'); - } - - var date = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_1__["default"])(dirtyDate); - var hours = Object(_lib_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyHours); - date.setHours(hours); - return date; -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/setISODay/index.js": -/*!******************************************************!*\ - !*** ./node_modules/date-fns/esm/setISODay/index.js ***! - \******************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return setISODay; }); -/* harmony import */ var _lib_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../_lib/toInteger/index.js */ "./node_modules/date-fns/esm/_lib/toInteger/index.js"); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); -/* harmony import */ var _addDays_index_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../addDays/index.js */ "./node_modules/date-fns/esm/addDays/index.js"); -/* harmony import */ var _getISODay_index_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../getISODay/index.js */ "./node_modules/date-fns/esm/getISODay/index.js"); - - - - -/** - * @name setISODay - * @category Weekday Helpers - * @summary Set the day of the ISO week to the given date. - * - * @description - * Set the day of the ISO week to the given date. - * ISO week starts with Monday. - * 7 is the index of Sunday, 1 is the index of Monday etc. - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} date - the date to be changed - * @param {Number} day - the day of the ISO week of the new date - * @returns {Date} the new date with the day of the ISO week set - * @throws {TypeError} 2 arguments required - * - * @example - * // Set Sunday to 1 September 2014: - * var result = setISODay(new Date(2014, 8, 1), 7) - * //=> Sun Sep 07 2014 00:00:00 - */ - -function setISODay(dirtyDate, dirtyDay) { - if (arguments.length < 2) { - throw new TypeError('2 arguments required, but only ' + arguments.length + ' present'); - } - - var date = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_1__["default"])(dirtyDate); - var day = Object(_lib_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDay); - var currentDay = Object(_getISODay_index_js__WEBPACK_IMPORTED_MODULE_3__["default"])(date); - var diff = day - currentDay; - return Object(_addDays_index_js__WEBPACK_IMPORTED_MODULE_2__["default"])(date, diff); -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/setISOWeek/index.js": -/*!*******************************************************!*\ - !*** ./node_modules/date-fns/esm/setISOWeek/index.js ***! - \*******************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return setISOWeek; }); -/* harmony import */ var _lib_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../_lib/toInteger/index.js */ "./node_modules/date-fns/esm/_lib/toInteger/index.js"); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); -/* harmony import */ var _getISOWeek_index_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../getISOWeek/index.js */ "./node_modules/date-fns/esm/getISOWeek/index.js"); - - - -/** - * @name setISOWeek - * @category ISO Week Helpers - * @summary Set the ISO week to the given date. - * - * @description - * Set the ISO week to the given date, saving the weekday number. - * - * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} date - the date to be changed - * @param {Number} isoWeek - the ISO week of the new date - * @returns {Date} the new date with the ISO week set - * @throws {TypeError} 2 arguments required - * - * @example - * // Set the 53rd ISO week to 7 August 2004: - * var result = setISOWeek(new Date(2004, 7, 7), 53) - * //=> Sat Jan 01 2005 00:00:00 - */ - -function setISOWeek(dirtyDate, dirtyISOWeek) { - if (arguments.length < 2) { - throw new TypeError('2 arguments required, but only ' + arguments.length + ' present'); - } - - var date = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_1__["default"])(dirtyDate); - var isoWeek = Object(_lib_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyISOWeek); - var diff = Object(_getISOWeek_index_js__WEBPACK_IMPORTED_MODULE_2__["default"])(date) - isoWeek; - date.setDate(date.getDate() - diff * 7); - return date; -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/setISOWeekYear/index.js": -/*!***********************************************************!*\ - !*** ./node_modules/date-fns/esm/setISOWeekYear/index.js ***! - \***********************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return setISOWeekYear; }); -/* harmony import */ var _lib_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../_lib/toInteger/index.js */ "./node_modules/date-fns/esm/_lib/toInteger/index.js"); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); -/* harmony import */ var _startOfISOWeekYear_index_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../startOfISOWeekYear/index.js */ "./node_modules/date-fns/esm/startOfISOWeekYear/index.js"); -/* harmony import */ var _differenceInCalendarDays_index_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../differenceInCalendarDays/index.js */ "./node_modules/date-fns/esm/differenceInCalendarDays/index.js"); - - - - -/** - * @name setISOWeekYear - * @category ISO Week-Numbering Year Helpers - * @summary Set the ISO week-numbering year to the given date. - * - * @description - * Set the ISO week-numbering year to the given date, - * saving the week number and the weekday number. - * - * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * - The function was renamed from `setISOYear` to `setISOWeekYear`. - * "ISO week year" is short for [ISO week-numbering year](https://en.wikipedia.org/wiki/ISO_week_date). - * This change makes the name consistent with - * locale-dependent week-numbering year helpers, e.g., `setWeekYear`. - * - * @param {Date|Number} date - the date to be changed - * @param {Number} isoWeekYear - the ISO week-numbering year of the new date - * @returns {Date} the new date with the ISO week-numbering year set - * @throws {TypeError} 2 arguments required - * - * @example - * // Set ISO week-numbering year 2007 to 29 December 2008: - * var result = setISOWeekYear(new Date(2008, 11, 29), 2007) - * //=> Mon Jan 01 2007 00:00:00 - */ - -function setISOWeekYear(dirtyDate, dirtyISOWeekYear) { - if (arguments.length < 2) { - throw new TypeError('2 arguments required, but only ' + arguments.length + ' present'); - } - - var date = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_1__["default"])(dirtyDate); - var isoWeekYear = Object(_lib_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyISOWeekYear); - var diff = Object(_differenceInCalendarDays_index_js__WEBPACK_IMPORTED_MODULE_3__["default"])(date, Object(_startOfISOWeekYear_index_js__WEBPACK_IMPORTED_MODULE_2__["default"])(date)); - var fourthOfJanuary = new Date(0); - fourthOfJanuary.setFullYear(isoWeekYear, 0, 4); - fourthOfJanuary.setHours(0, 0, 0, 0); - date = Object(_startOfISOWeekYear_index_js__WEBPACK_IMPORTED_MODULE_2__["default"])(fourthOfJanuary); - date.setDate(date.getDate() + diff); - return date; -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/setMilliseconds/index.js": -/*!************************************************************!*\ - !*** ./node_modules/date-fns/esm/setMilliseconds/index.js ***! - \************************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return setMilliseconds; }); -/* harmony import */ var _lib_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../_lib/toInteger/index.js */ "./node_modules/date-fns/esm/_lib/toInteger/index.js"); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); - - -/** - * @name setMilliseconds - * @category Millisecond Helpers - * @summary Set the milliseconds to the given date. - * - * @description - * Set the milliseconds to the given date. - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} date - the date to be changed - * @param {Number} milliseconds - the milliseconds of the new date - * @returns {Date} the new date with the milliseconds set - * @throws {TypeError} 2 arguments required - * - * @example - * // Set 300 milliseconds to 1 September 2014 11:30:40.500: - * var result = setMilliseconds(new Date(2014, 8, 1, 11, 30, 40, 500), 300) - * //=> Mon Sep 01 2014 11:30:40.300 - */ - -function setMilliseconds(dirtyDate, dirtyMilliseconds) { - if (arguments.length < 2) { - throw new TypeError('2 arguments required, but only ' + arguments.length + ' present'); - } - - var date = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_1__["default"])(dirtyDate); - var milliseconds = Object(_lib_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyMilliseconds); - date.setMilliseconds(milliseconds); - return date; -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/setMinutes/index.js": -/*!*******************************************************!*\ - !*** ./node_modules/date-fns/esm/setMinutes/index.js ***! - \*******************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return setMinutes; }); -/* harmony import */ var _lib_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../_lib/toInteger/index.js */ "./node_modules/date-fns/esm/_lib/toInteger/index.js"); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); - - -/** - * @name setMinutes - * @category Minute Helpers - * @summary Set the minutes to the given date. - * - * @description - * Set the minutes to the given date. - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} date - the date to be changed - * @param {Number} minutes - the minutes of the new date - * @returns {Date} the new date with the minutes set - * @throws {TypeError} 2 arguments required - * - * @example - * // Set 45 minutes to 1 September 2014 11:30:40: - * var result = setMinutes(new Date(2014, 8, 1, 11, 30, 40), 45) - * //=> Mon Sep 01 2014 11:45:40 - */ - -function setMinutes(dirtyDate, dirtyMinutes) { - if (arguments.length < 2) { - throw new TypeError('2 arguments required, but only ' + arguments.length + ' present'); - } - - var date = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_1__["default"])(dirtyDate); - var minutes = Object(_lib_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyMinutes); - date.setMinutes(minutes); - return date; -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/setMonth/index.js": -/*!*****************************************************!*\ - !*** ./node_modules/date-fns/esm/setMonth/index.js ***! - \*****************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return setMonth; }); -/* harmony import */ var _lib_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../_lib/toInteger/index.js */ "./node_modules/date-fns/esm/_lib/toInteger/index.js"); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); -/* harmony import */ var _getDaysInMonth_index_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../getDaysInMonth/index.js */ "./node_modules/date-fns/esm/getDaysInMonth/index.js"); - - - -/** - * @name setMonth - * @category Month Helpers - * @summary Set the month to the given date. - * - * @description - * Set the month to the given date. - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} date - the date to be changed - * @param {Number} month - the month of the new date - * @returns {Date} the new date with the month set - * @throws {TypeError} 2 arguments required - * - * @example - * // Set February to 1 September 2014: - * var result = setMonth(new Date(2014, 8, 1), 1) - * //=> Sat Feb 01 2014 00:00:00 - */ - -function setMonth(dirtyDate, dirtyMonth) { - if (arguments.length < 2) { - throw new TypeError('2 arguments required, but only ' + arguments.length + ' present'); - } - - var date = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_1__["default"])(dirtyDate); - var month = Object(_lib_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyMonth); - var year = date.getFullYear(); - var day = date.getDate(); - var dateWithDesiredMonth = new Date(0); - dateWithDesiredMonth.setFullYear(year, month, 15); - dateWithDesiredMonth.setHours(0, 0, 0, 0); - var daysInMonth = Object(_getDaysInMonth_index_js__WEBPACK_IMPORTED_MODULE_2__["default"])(dateWithDesiredMonth); // Set the last day of the new month - // if the original date was the last day of the longer month - - date.setMonth(month, Math.min(day, daysInMonth)); - return date; -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/setQuarter/index.js": -/*!*******************************************************!*\ - !*** ./node_modules/date-fns/esm/setQuarter/index.js ***! - \*******************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return setQuarter; }); -/* harmony import */ var _lib_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../_lib/toInteger/index.js */ "./node_modules/date-fns/esm/_lib/toInteger/index.js"); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); -/* harmony import */ var _setMonth_index_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../setMonth/index.js */ "./node_modules/date-fns/esm/setMonth/index.js"); - - - -/** - * @name setQuarter - * @category Quarter Helpers - * @summary Set the year quarter to the given date. - * - * @description - * Set the year quarter to the given date. - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} date - the date to be changed - * @param {Number} quarter - the quarter of the new date - * @returns {Date} the new date with the quarter set - * @throws {TypeError} 2 arguments required - * - * @example - * // Set the 2nd quarter to 2 July 2014: - * var result = setQuarter(new Date(2014, 6, 2), 2) - * //=> Wed Apr 02 2014 00:00:00 - */ - -function setQuarter(dirtyDate, dirtyQuarter) { - if (arguments.length < 2) { - throw new TypeError('2 arguments required, but only ' + arguments.length + ' present'); - } - - var date = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_1__["default"])(dirtyDate); - var quarter = Object(_lib_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyQuarter); - var oldQuarter = Math.floor(date.getMonth() / 3) + 1; - var diff = quarter - oldQuarter; - return Object(_setMonth_index_js__WEBPACK_IMPORTED_MODULE_2__["default"])(date, date.getMonth() + diff * 3); -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/setSeconds/index.js": -/*!*******************************************************!*\ - !*** ./node_modules/date-fns/esm/setSeconds/index.js ***! - \*******************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return setSeconds; }); -/* harmony import */ var _lib_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../_lib/toInteger/index.js */ "./node_modules/date-fns/esm/_lib/toInteger/index.js"); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); - - -/** - * @name setSeconds - * @category Second Helpers - * @summary Set the seconds to the given date. - * - * @description - * Set the seconds to the given date. - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} date - the date to be changed - * @param {Number} seconds - the seconds of the new date - * @returns {Date} the new date with the seconds set - * @throws {TypeError} 2 arguments required - * - * @example - * // Set 45 seconds to 1 September 2014 11:30:40: - * var result = setSeconds(new Date(2014, 8, 1, 11, 30, 40), 45) - * //=> Mon Sep 01 2014 11:30:45 - */ - -function setSeconds(dirtyDate, dirtySeconds) { - if (arguments.length < 2) { - throw new TypeError('2 arguments required, but only ' + arguments.length + ' present'); - } - - var date = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_1__["default"])(dirtyDate); - var seconds = Object(_lib_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtySeconds); - date.setSeconds(seconds); - return date; -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/setWeek/index.js": -/*!****************************************************!*\ - !*** ./node_modules/date-fns/esm/setWeek/index.js ***! - \****************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return setWeek; }); -/* harmony import */ var _lib_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../_lib/toInteger/index.js */ "./node_modules/date-fns/esm/_lib/toInteger/index.js"); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); -/* harmony import */ var _getWeek_index_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../getWeek/index.js */ "./node_modules/date-fns/esm/getWeek/index.js"); - - - -/** - * @name setWeek - * @category Week Helpers - * @summary Set the local week to the given date. - * - * @description - * Set the local week to the given date, saving the weekday number. - * The exact calculation depends on the values of - * `options.weekStartsOn` (which is the index of the first day of the week) - * and `options.firstWeekContainsDate` (which is the day of January, which is always in - * the first week of the week-numbering year) - * - * Week numbering: https://en.wikipedia.org/wiki/Week#Week_numbering - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} date - the date to be changed - * @param {Number} week - the week of the new date - * @param {Object} [options] - an object with options. - * @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday) - * @param {1|2|3|4|5|6|7} [options.firstWeekContainsDate=1] - the day of January, which is always in the first week of the year - * @returns {Date} the new date with the local week set - * @throws {TypeError} 2 arguments required - * @throws {RangeError} `options.weekStartsOn` must be between 0 and 6 - * @throws {RangeError} `options.firstWeekContainsDate` must be between 1 and 7 - * - * @example - * // Set the 1st week to 2 January 2005 with default options: - * var result = setWeek(new Date(2005, 0, 2), 1) - * //=> Sun Dec 26 2004 00:00:00 - * - * @example - * // Set the 1st week to 2 January 2005, - * // if Monday is the first day of the week, - * // and the first week of the year always contains 4 January: - * var result = setWeek(new Date(2005, 0, 2), 1, { - * weekStartsOn: 1, - * firstWeekContainsDate: 4 - * }) - * //=> Sun Jan 4 2004 00:00:00 - */ - -function setWeek(dirtyDate, dirtyWeek, dirtyOptions) { - if (arguments.length < 2) { - throw new TypeError('2 arguments required, but only ' + arguments.length + ' present'); - } - - var date = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_1__["default"])(dirtyDate); - var week = Object(_lib_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyWeek); - var diff = Object(_getWeek_index_js__WEBPACK_IMPORTED_MODULE_2__["default"])(date, dirtyOptions) - week; - date.setDate(date.getDate() - diff * 7); - return date; -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/setWeekYear/index.js": -/*!********************************************************!*\ - !*** ./node_modules/date-fns/esm/setWeekYear/index.js ***! - \********************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return setWeekYear; }); -/* harmony import */ var _lib_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../_lib/toInteger/index.js */ "./node_modules/date-fns/esm/_lib/toInteger/index.js"); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); -/* harmony import */ var _startOfWeekYear_index_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../startOfWeekYear/index.js */ "./node_modules/date-fns/esm/startOfWeekYear/index.js"); -/* harmony import */ var _differenceInCalendarDays_index_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../differenceInCalendarDays/index.js */ "./node_modules/date-fns/esm/differenceInCalendarDays/index.js"); - - - - -/** - * @name setWeekYear - * @category Week-Numbering Year Helpers - * @summary Set the local week-numbering year to the given date. - * - * @description - * Set the local week-numbering year to the given date, - * saving the week number and the weekday number. - * The exact calculation depends on the values of - * `options.weekStartsOn` (which is the index of the first day of the week) - * and `options.firstWeekContainsDate` (which is the day of January, which is always in - * the first week of the week-numbering year) - * - * Week numbering: https://en.wikipedia.org/wiki/Week#Week_numbering - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} date - the date to be changed - * @param {Number} weekYear - the local week-numbering year of the new date - * @param {Object} [options] - an object with options. - * @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday) - * @param {1|2|3|4|5|6|7} [options.firstWeekContainsDate=1] - the day of January, which is always in the first week of the year - * @returns {Date} the new date with the local week-numbering year set - * @throws {TypeError} 2 arguments required - * @throws {RangeError} `options.weekStartsOn` must be between 0 and 6 - * @throws {RangeError} `options.firstWeekContainsDate` must be between 1 and 7 - * - * @example - * // Set the local week-numbering year 2004 to 2 January 2010 with default options: - * var result = setWeekYear(new Date(2010, 0, 2), 2004) - * //=> Sat Jan 03 2004 00:00:00 - * - * @example - * // Set the local week-numbering year 2004 to 2 January 2010, - * // if Monday is the first day of week - * // and 4 January is always in the first week of the year: - * var result = setWeekYear(new Date(2010, 0, 2), 2004, { - * weekStartsOn: 1, - * firstWeekContainsDate: 4 - * }) - * //=> Sat Jan 01 2005 00:00:00 - */ - -function setWeekYear(dirtyDate, dirtyWeekYear, dirtyOptions) { - if (arguments.length < 2) { - throw new TypeError('2 arguments required, but only ' + arguments.length + ' present'); - } - - var options = dirtyOptions || {}; - var locale = options.locale; - var localeFirstWeekContainsDate = locale && locale.options && locale.options.firstWeekContainsDate; - var defaultFirstWeekContainsDate = localeFirstWeekContainsDate == null ? 1 : Object(_lib_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(localeFirstWeekContainsDate); - var firstWeekContainsDate = options.firstWeekContainsDate == null ? defaultFirstWeekContainsDate : Object(_lib_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(options.firstWeekContainsDate); - var date = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_1__["default"])(dirtyDate); - var weekYear = Object(_lib_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyWeekYear); - var diff = Object(_differenceInCalendarDays_index_js__WEBPACK_IMPORTED_MODULE_3__["default"])(date, Object(_startOfWeekYear_index_js__WEBPACK_IMPORTED_MODULE_2__["default"])(date, dirtyOptions)); - var firstWeek = new Date(0); - firstWeek.setFullYear(weekYear, 0, firstWeekContainsDate); - firstWeek.setHours(0, 0, 0, 0); - date = Object(_startOfWeekYear_index_js__WEBPACK_IMPORTED_MODULE_2__["default"])(firstWeek, dirtyOptions); - date.setDate(date.getDate() + diff); - return date; -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/setYear/index.js": -/*!****************************************************!*\ - !*** ./node_modules/date-fns/esm/setYear/index.js ***! - \****************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return setYear; }); -/* harmony import */ var _lib_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../_lib/toInteger/index.js */ "./node_modules/date-fns/esm/_lib/toInteger/index.js"); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); - - -/** - * @name setYear - * @category Year Helpers - * @summary Set the year to the given date. - * - * @description - * Set the year to the given date. - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} date - the date to be changed - * @param {Number} year - the year of the new date - * @returns {Date} the new date with the year set - * @throws {TypeError} 2 arguments required - * - * @example - * // Set year 2013 to 1 September 2014: - * var result = setYear(new Date(2014, 8, 1), 2013) - * //=> Sun Sep 01 2013 00:00:00 - */ - -function setYear(dirtyDate, dirtyYear) { - if (arguments.length < 2) { - throw new TypeError('2 arguments required, but only ' + arguments.length + ' present'); - } - - var date = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_1__["default"])(dirtyDate); - var year = Object(_lib_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyYear); // Check if date is Invalid Date because Date.prototype.setFullYear ignores the value of Invalid Date - - if (isNaN(date)) { - return new Date(NaN); - } - - date.setFullYear(year); - return date; -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/startOfDay/index.js": -/*!*******************************************************!*\ - !*** ./node_modules/date-fns/esm/startOfDay/index.js ***! - \*******************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return startOfDay; }); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); - -/** - * @name startOfDay - * @category Day Helpers - * @summary Return the start of a day for the given date. - * - * @description - * Return the start of a day for the given date. - * The result will be in the local timezone. - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} date - the original date - * @returns {Date} the start of a day - * @throws {TypeError} 1 argument required - * - * @example - * // The start of a day for 2 September 2014 11:55:00: - * var result = startOfDay(new Date(2014, 8, 2, 11, 55, 0)) - * //=> Tue Sep 02 2014 00:00:00 - */ - -function startOfDay(dirtyDate) { - if (arguments.length < 1) { - throw new TypeError('1 argument required, but only ' + arguments.length + ' present'); - } - - var date = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDate); - date.setHours(0, 0, 0, 0); - return date; -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/startOfDecade/index.js": -/*!**********************************************************!*\ - !*** ./node_modules/date-fns/esm/startOfDecade/index.js ***! - \**********************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return startOfDecade; }); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); - -/** - * @name startOfDecade - * @category Decade Helpers - * @summary Return the start of a decade for the given date. - * - * @description - * Return the start of a decade for the given date. - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} date - the original date - * @returns {Date} the start of a decade - * @throws {TypeError} 1 argument required - * - * @example - * // The start of a decade for 21 October 2015 00:00:00: - * var result = startOfDecade(new Date(2015, 9, 21, 00, 00, 00)) - * //=> Jan 01 2010 00:00:00 - */ - -function startOfDecade(dirtyDate) { - if (arguments.length < 1) { - throw new TypeError('1 argument required, but only ' + arguments.length + ' present'); - } - - var date = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDate); - var year = date.getFullYear(); - var decade = Math.floor(year / 10) * 10; - date.setFullYear(decade, 0, 1); - date.setHours(0, 0, 0, 0); - return date; -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/startOfHour/index.js": -/*!********************************************************!*\ - !*** ./node_modules/date-fns/esm/startOfHour/index.js ***! - \********************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return startOfHour; }); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); - -/** - * @name startOfHour - * @category Hour Helpers - * @summary Return the start of an hour for the given date. - * - * @description - * Return the start of an hour for the given date. - * The result will be in the local timezone. - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} date - the original date - * @returns {Date} the start of an hour - * @throws {TypeError} 1 argument required - * - * @example - * // The start of an hour for 2 September 2014 11:55:00: - * var result = startOfHour(new Date(2014, 8, 2, 11, 55)) - * //=> Tue Sep 02 2014 11:00:00 - */ - -function startOfHour(dirtyDate) { - if (arguments.length < 1) { - throw new TypeError('1 argument required, but only ' + arguments.length + ' present'); - } - - var date = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDate); - date.setMinutes(0, 0, 0); - return date; -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/startOfISOWeek/index.js": -/*!***********************************************************!*\ - !*** ./node_modules/date-fns/esm/startOfISOWeek/index.js ***! - \***********************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return startOfISOWeek; }); -/* harmony import */ var _startOfWeek_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../startOfWeek/index.js */ "./node_modules/date-fns/esm/startOfWeek/index.js"); - -/** - * @name startOfISOWeek - * @category ISO Week Helpers - * @summary Return the start of an ISO week for the given date. - * - * @description - * Return the start of an ISO week for the given date. - * The result will be in the local timezone. - * - * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} date - the original date - * @returns {Date} the start of an ISO week - * @throws {TypeError} 1 argument required - * - * @example - * // The start of an ISO week for 2 September 2014 11:55:00: - * var result = startOfISOWeek(new Date(2014, 8, 2, 11, 55, 0)) - * //=> Mon Sep 01 2014 00:00:00 - */ - -function startOfISOWeek(dirtyDate) { - if (arguments.length < 1) { - throw new TypeError('1 argument required, but only ' + arguments.length + ' present'); - } - - return Object(_startOfWeek_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDate, { - weekStartsOn: 1 - }); -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/startOfISOWeekYear/index.js": -/*!***************************************************************!*\ - !*** ./node_modules/date-fns/esm/startOfISOWeekYear/index.js ***! - \***************************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return startOfISOWeekYear; }); -/* harmony import */ var _getISOWeekYear_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../getISOWeekYear/index.js */ "./node_modules/date-fns/esm/getISOWeekYear/index.js"); -/* harmony import */ var _startOfISOWeek_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../startOfISOWeek/index.js */ "./node_modules/date-fns/esm/startOfISOWeek/index.js"); - - -/** - * @name startOfISOWeekYear - * @category ISO Week-Numbering Year Helpers - * @summary Return the start of an ISO week-numbering year for the given date. - * - * @description - * Return the start of an ISO week-numbering year, - * which always starts 3 days before the year's first Thursday. - * The result will be in the local timezone. - * - * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} date - the original date - * @returns {Date} the start of an ISO week-numbering year - * @throws {TypeError} 1 argument required - * - * @example - * // The start of an ISO week-numbering year for 2 July 2005: - * var result = startOfISOWeekYear(new Date(2005, 6, 2)) - * //=> Mon Jan 03 2005 00:00:00 - */ - -function startOfISOWeekYear(dirtyDate) { - if (arguments.length < 1) { - throw new TypeError('1 argument required, but only ' + arguments.length + ' present'); - } - - var year = Object(_getISOWeekYear_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDate); - var fourthOfJanuary = new Date(0); - fourthOfJanuary.setFullYear(year, 0, 4); - fourthOfJanuary.setHours(0, 0, 0, 0); - var date = Object(_startOfISOWeek_index_js__WEBPACK_IMPORTED_MODULE_1__["default"])(fourthOfJanuary); - return date; -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/startOfMinute/index.js": -/*!**********************************************************!*\ - !*** ./node_modules/date-fns/esm/startOfMinute/index.js ***! - \**********************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return startOfMinute; }); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); - -/** - * @name startOfMinute - * @category Minute Helpers - * @summary Return the start of a minute for the given date. - * - * @description - * Return the start of a minute for the given date. - * The result will be in the local timezone. - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} date - the original date - * @returns {Date} the start of a minute - * @throws {TypeError} 1 argument required - * - * @example - * // The start of a minute for 1 December 2014 22:15:45.400: - * var result = startOfMinute(new Date(2014, 11, 1, 22, 15, 45, 400)) - * //=> Mon Dec 01 2014 22:15:00 - */ - -function startOfMinute(dirtyDate) { - if (arguments.length < 1) { - throw new TypeError('1 argument required, but only ' + arguments.length + ' present'); - } - - var date = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDate); - date.setSeconds(0, 0); - return date; -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/startOfMonth/index.js": -/*!*********************************************************!*\ - !*** ./node_modules/date-fns/esm/startOfMonth/index.js ***! - \*********************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return startOfMonth; }); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); - -/** - * @name startOfMonth - * @category Month Helpers - * @summary Return the start of a month for the given date. - * - * @description - * Return the start of a month for the given date. - * The result will be in the local timezone. - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} date - the original date - * @returns {Date} the start of a month - * @throws {TypeError} 1 argument required - * - * @example - * // The start of a month for 2 September 2014 11:55:00: - * var result = startOfMonth(new Date(2014, 8, 2, 11, 55, 0)) - * //=> Mon Sep 01 2014 00:00:00 - */ - -function startOfMonth(dirtyDate) { - if (arguments.length < 1) { - throw new TypeError('1 argument required, but only ' + arguments.length + ' present'); - } - - var date = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDate); - date.setDate(1); - date.setHours(0, 0, 0, 0); - return date; -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/startOfQuarter/index.js": -/*!***********************************************************!*\ - !*** ./node_modules/date-fns/esm/startOfQuarter/index.js ***! - \***********************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return startOfQuarter; }); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); - -/** - * @name startOfQuarter - * @category Quarter Helpers - * @summary Return the start of a year quarter for the given date. - * - * @description - * Return the start of a year quarter for the given date. - * The result will be in the local timezone. - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} date - the original date - * @returns {Date} the start of a quarter - * @throws {TypeError} 1 argument required - * - * @example - * // The start of a quarter for 2 September 2014 11:55:00: - * var result = startOfQuarter(new Date(2014, 8, 2, 11, 55, 0)) - * //=> Tue Jul 01 2014 00:00:00 - */ - -function startOfQuarter(dirtyDate) { - if (arguments.length < 1) { - throw new TypeError('1 argument required, but only ' + arguments.length + ' present'); - } - - var date = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDate); - var currentMonth = date.getMonth(); - var month = currentMonth - currentMonth % 3; - date.setMonth(month, 1); - date.setHours(0, 0, 0, 0); - return date; -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/startOfSecond/index.js": -/*!**********************************************************!*\ - !*** ./node_modules/date-fns/esm/startOfSecond/index.js ***! - \**********************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return startOfSecond; }); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); - -/** - * @name startOfSecond - * @category Second Helpers - * @summary Return the start of a second for the given date. - * - * @description - * Return the start of a second for the given date. - * The result will be in the local timezone. - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} date - the original date - * @returns {Date} the start of a second - * @throws {TypeError} 1 argument required - * - * @example - * // The start of a second for 1 December 2014 22:15:45.400: - * var result = startOfSecond(new Date(2014, 11, 1, 22, 15, 45, 400)) - * //=> Mon Dec 01 2014 22:15:45.000 - */ - -function startOfSecond(dirtyDate) { - if (arguments.length < 1) { - throw new TypeError('1 argument required, but only ' + arguments.length + ' present'); - } - - var date = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDate); - date.setMilliseconds(0); - return date; -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/startOfWeek/index.js": -/*!********************************************************!*\ - !*** ./node_modules/date-fns/esm/startOfWeek/index.js ***! - \********************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return startOfWeek; }); -/* harmony import */ var _lib_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../_lib/toInteger/index.js */ "./node_modules/date-fns/esm/_lib/toInteger/index.js"); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); - - -/** - * @name startOfWeek - * @category Week Helpers - * @summary Return the start of a week for the given date. - * - * @description - * Return the start of a week for the given date. - * The result will be in the local timezone. - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} date - the original date - * @param {Object} [options] - an object with options. - * @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday) - * @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale} - * @returns {Date} the start of a week - * @throws {TypeError} 1 argument required - * @throws {RangeError} `options.weekStartsOn` must be between 0 and 6 - * - * @example - * // The start of a week for 2 September 2014 11:55:00: - * var result = startOfWeek(new Date(2014, 8, 2, 11, 55, 0)) - * //=> Sun Aug 31 2014 00:00:00 - * - * @example - * // If the week starts on Monday, the start of the week for 2 September 2014 11:55:00: - * var result = startOfWeek(new Date(2014, 8, 2, 11, 55, 0), { weekStartsOn: 1 }) - * //=> Mon Sep 01 2014 00:00:00 - */ - -function startOfWeek(dirtyDate, dirtyOptions) { - if (arguments.length < 1) { - throw new TypeError('1 argument required, but only ' + arguments.length + ' present'); - } - - var options = dirtyOptions || {}; - var locale = options.locale; - var localeWeekStartsOn = locale && locale.options && locale.options.weekStartsOn; - var defaultWeekStartsOn = localeWeekStartsOn == null ? 0 : Object(_lib_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(localeWeekStartsOn); - var weekStartsOn = options.weekStartsOn == null ? defaultWeekStartsOn : Object(_lib_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(options.weekStartsOn); // Test if weekStartsOn is between 0 and 6 _and_ is not NaN - - if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) { - throw new RangeError('weekStartsOn must be between 0 and 6 inclusively'); - } - - var date = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_1__["default"])(dirtyDate); - var day = date.getDay(); - var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn; - date.setDate(date.getDate() - diff); - date.setHours(0, 0, 0, 0); - return date; -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/startOfWeekYear/index.js": -/*!************************************************************!*\ - !*** ./node_modules/date-fns/esm/startOfWeekYear/index.js ***! - \************************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return startOfWeekYear; }); -/* harmony import */ var _lib_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../_lib/toInteger/index.js */ "./node_modules/date-fns/esm/_lib/toInteger/index.js"); -/* harmony import */ var _getWeekYear_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../getWeekYear/index.js */ "./node_modules/date-fns/esm/getWeekYear/index.js"); -/* harmony import */ var _startOfWeek_index_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../startOfWeek/index.js */ "./node_modules/date-fns/esm/startOfWeek/index.js"); - - - -/** - * @name startOfWeekYear - * @category Week-Numbering Year Helpers - * @summary Return the start of a local week-numbering year for the given date. - * - * @description - * Return the start of a local week-numbering year. - * The exact calculation depends on the values of - * `options.weekStartsOn` (which is the index of the first day of the week) - * and `options.firstWeekContainsDate` (which is the day of January, which is always in - * the first week of the week-numbering year) - * - * Week numbering: https://en.wikipedia.org/wiki/Week#Week_numbering - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} date - the original date - * @param {Object} [options] - an object with options. - * @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday) - * @param {1|2|3|4|5|6|7} [options.firstWeekContainsDate=1] - the day of January, which is always in the first week of the year - * @returns {Date} the start of a week-numbering year - * @throws {TypeError} 1 argument required - * @throws {RangeError} `options.weekStartsOn` must be between 0 and 6 - * @throws {RangeError} `options.firstWeekContainsDate` must be between 1 and 7 - * - * @example - * // The start of an a week-numbering year for 2 July 2005 with default settings: - * var result = startOfWeekYear(new Date(2005, 6, 2)) - * //=> Sun Dec 26 2004 00:00:00 - * - * @example - * // The start of a week-numbering year for 2 July 2005 - * // if Monday is the first day of week - * // and 4 January is always in the first week of the year: - * var result = startOfWeekYear(new Date(2005, 6, 2), { - * weekStartsOn: 1, - * firstWeekContainsDate: 4 - * }) - * //=> Mon Jan 03 2005 00:00:00 - */ - -function startOfWeekYear(dirtyDate, dirtyOptions) { - if (arguments.length < 1) { - throw new TypeError('1 argument required, but only ' + arguments.length + ' present'); - } - - var options = dirtyOptions || {}; - var locale = options.locale; - var localeFirstWeekContainsDate = locale && locale.options && locale.options.firstWeekContainsDate; - var defaultFirstWeekContainsDate = localeFirstWeekContainsDate == null ? 1 : Object(_lib_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(localeFirstWeekContainsDate); - var firstWeekContainsDate = options.firstWeekContainsDate == null ? defaultFirstWeekContainsDate : Object(_lib_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(options.firstWeekContainsDate); - var year = Object(_getWeekYear_index_js__WEBPACK_IMPORTED_MODULE_1__["default"])(dirtyDate, dirtyOptions); - var firstWeek = new Date(0); - firstWeek.setFullYear(year, 0, firstWeekContainsDate); - firstWeek.setHours(0, 0, 0, 0); - var date = Object(_startOfWeek_index_js__WEBPACK_IMPORTED_MODULE_2__["default"])(firstWeek, dirtyOptions); - return date; -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/startOfYear/index.js": -/*!********************************************************!*\ - !*** ./node_modules/date-fns/esm/startOfYear/index.js ***! - \********************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return startOfYear; }); -/* harmony import */ var _toDate_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../toDate/index.js */ "./node_modules/date-fns/esm/toDate/index.js"); - -/** - * @name startOfYear - * @category Year Helpers - * @summary Return the start of a year for the given date. - * - * @description - * Return the start of a year for the given date. - * The result will be in the local timezone. - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} date - the original date - * @returns {Date} the start of a year - * @throws {TypeError} 1 argument required - * - * @example - * // The start of a year for 2 September 2014 11:55:00: - * var result = startOfYear(new Date(2014, 8, 2, 11, 55, 00)) - * //=> Wed Jan 01 2014 00:00:00 - */ - -function startOfYear(dirtyDate) { - if (arguments.length < 1) { - throw new TypeError('1 argument required, but only ' + arguments.length + ' present'); - } - - var cleanDate = Object(_toDate_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyDate); - var date = new Date(0); - date.setFullYear(cleanDate.getFullYear(), 0, 1); - date.setHours(0, 0, 0, 0); - return date; -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/subDays/index.js": -/*!****************************************************!*\ - !*** ./node_modules/date-fns/esm/subDays/index.js ***! - \****************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return subDays; }); -/* harmony import */ var _lib_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../_lib/toInteger/index.js */ "./node_modules/date-fns/esm/_lib/toInteger/index.js"); -/* harmony import */ var _addDays_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../addDays/index.js */ "./node_modules/date-fns/esm/addDays/index.js"); - - -/** - * @name subDays - * @category Day Helpers - * @summary Subtract the specified number of days from the given date. - * - * @description - * Subtract the specified number of days from the given date. - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} date - the date to be changed - * @param {Number} amount - the amount of days to be subtracted - * @returns {Date} the new date with the days subtracted - * @throws {TypeError} 2 arguments required - * - * @example - * // Subtract 10 days from 1 September 2014: - * var result = subDays(new Date(2014, 8, 1), 10) - * //=> Fri Aug 22 2014 00:00:00 - */ - -function subDays(dirtyDate, dirtyAmount) { - if (arguments.length < 2) { - throw new TypeError('2 arguments required, but only ' + arguments.length + ' present'); - } - - var amount = Object(_lib_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyAmount); - return Object(_addDays_index_js__WEBPACK_IMPORTED_MODULE_1__["default"])(dirtyDate, -amount); -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/subHours/index.js": -/*!*****************************************************!*\ - !*** ./node_modules/date-fns/esm/subHours/index.js ***! - \*****************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return subHours; }); -/* harmony import */ var _lib_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../_lib/toInteger/index.js */ "./node_modules/date-fns/esm/_lib/toInteger/index.js"); -/* harmony import */ var _addHours_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../addHours/index.js */ "./node_modules/date-fns/esm/addHours/index.js"); - - -/** - * @name subHours - * @category Hour Helpers - * @summary Subtract the specified number of hours from the given date. - * - * @description - * Subtract the specified number of hours from the given date. - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} date - the date to be changed - * @param {Number} amount - the amount of hours to be subtracted - * @returns {Date} the new date with the hours subtracted - * @throws {TypeError} 2 arguments required - * - * @example - * // Subtract 2 hours from 11 July 2014 01:00:00: - * var result = subHours(new Date(2014, 6, 11, 1, 0), 2) - * //=> Thu Jul 10 2014 23:00:00 - */ - -function subHours(dirtyDate, dirtyAmount) { - if (arguments.length < 2) { - throw new TypeError('2 arguments required, but only ' + arguments.length + ' present'); - } - - var amount = Object(_lib_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyAmount); - return Object(_addHours_index_js__WEBPACK_IMPORTED_MODULE_1__["default"])(dirtyDate, -amount); -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/subISOWeekYears/index.js": -/*!************************************************************!*\ - !*** ./node_modules/date-fns/esm/subISOWeekYears/index.js ***! - \************************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return subISOWeekYears; }); -/* harmony import */ var _lib_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../_lib/toInteger/index.js */ "./node_modules/date-fns/esm/_lib/toInteger/index.js"); -/* harmony import */ var _addISOWeekYears_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../addISOWeekYears/index.js */ "./node_modules/date-fns/esm/addISOWeekYears/index.js"); - - -/** - * @name subISOWeekYears - * @category ISO Week-Numbering Year Helpers - * @summary Subtract the specified number of ISO week-numbering years from the given date. - * - * @description - * Subtract the specified number of ISO week-numbering years from the given date. - * - * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * - The function was renamed from `subISOYears` to `subISOWeekYears`. - * "ISO week year" is short for [ISO week-numbering year](https://en.wikipedia.org/wiki/ISO_week_date). - * This change makes the name consistent with - * locale-dependent week-numbering year helpers, e.g., `setWeekYear`. - * - * @param {Date|Number} date - the date to be changed - * @param {Number} amount - the amount of ISO week-numbering years to be subtracted - * @returns {Date} the new date with the ISO week-numbering years subtracted - * @throws {TypeError} 2 arguments required - * - * @example - * // Subtract 5 ISO week-numbering years from 1 September 2014: - * var result = subISOWeekYears(new Date(2014, 8, 1), 5) - * //=> Mon Aug 31 2009 00:00:00 - */ - -function subISOWeekYears(dirtyDate, dirtyAmount) { - if (arguments.length < 2) { - throw new TypeError('2 arguments required, but only ' + arguments.length + ' present'); - } - - var amount = Object(_lib_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyAmount); - return Object(_addISOWeekYears_index_js__WEBPACK_IMPORTED_MODULE_1__["default"])(dirtyDate, -amount); -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/subMilliseconds/index.js": -/*!************************************************************!*\ - !*** ./node_modules/date-fns/esm/subMilliseconds/index.js ***! - \************************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return subMilliseconds; }); -/* harmony import */ var _lib_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../_lib/toInteger/index.js */ "./node_modules/date-fns/esm/_lib/toInteger/index.js"); -/* harmony import */ var _addMilliseconds_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../addMilliseconds/index.js */ "./node_modules/date-fns/esm/addMilliseconds/index.js"); - - -/** - * @name subMilliseconds - * @category Millisecond Helpers - * @summary Subtract the specified number of milliseconds from the given date. - * - * @description - * Subtract the specified number of milliseconds from the given date. - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} date - the date to be changed - * @param {Number} amount - the amount of milliseconds to be subtracted - * @returns {Date} the new date with the milliseconds subtracted - * @throws {TypeError} 2 arguments required - * - * @example - * // Subtract 750 milliseconds from 10 July 2014 12:45:30.000: - * var result = subMilliseconds(new Date(2014, 6, 10, 12, 45, 30, 0), 750) - * //=> Thu Jul 10 2014 12:45:29.250 - */ - -function subMilliseconds(dirtyDate, dirtyAmount) { - if (arguments.length < 2) { - throw new TypeError('2 arguments required, but only ' + arguments.length + ' present'); - } - - var amount = Object(_lib_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyAmount); - return Object(_addMilliseconds_index_js__WEBPACK_IMPORTED_MODULE_1__["default"])(dirtyDate, -amount); -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/subMinutes/index.js": -/*!*******************************************************!*\ - !*** ./node_modules/date-fns/esm/subMinutes/index.js ***! - \*******************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return subMinutes; }); -/* harmony import */ var _lib_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../_lib/toInteger/index.js */ "./node_modules/date-fns/esm/_lib/toInteger/index.js"); -/* harmony import */ var _addMinutes_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../addMinutes/index.js */ "./node_modules/date-fns/esm/addMinutes/index.js"); - - -/** - * @name subMinutes - * @category Minute Helpers - * @summary Subtract the specified number of minutes from the given date. - * - * @description - * Subtract the specified number of minutes from the given date. - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} date - the date to be changed - * @param {Number} amount - the amount of minutes to be subtracted - * @returns {Date} the new date with the minutes subtracted - * @throws {TypeError} 2 arguments required - * - * @example - * // Subtract 30 minutes from 10 July 2014 12:00:00: - * var result = subMinutes(new Date(2014, 6, 10, 12, 0), 30) - * //=> Thu Jul 10 2014 11:30:00 - */ - -function subMinutes(dirtyDate, dirtyAmount) { - if (arguments.length < 2) { - throw new TypeError('2 arguments required, but only ' + arguments.length + ' present'); - } - - var amount = Object(_lib_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyAmount); - return Object(_addMinutes_index_js__WEBPACK_IMPORTED_MODULE_1__["default"])(dirtyDate, -amount); -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/subMonths/index.js": -/*!******************************************************!*\ - !*** ./node_modules/date-fns/esm/subMonths/index.js ***! - \******************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return subMonths; }); -/* harmony import */ var _lib_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../_lib/toInteger/index.js */ "./node_modules/date-fns/esm/_lib/toInteger/index.js"); -/* harmony import */ var _addMonths_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../addMonths/index.js */ "./node_modules/date-fns/esm/addMonths/index.js"); - - -/** - * @name subMonths - * @category Month Helpers - * @summary Subtract the specified number of months from the given date. - * - * @description - * Subtract the specified number of months from the given date. - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} date - the date to be changed - * @param {Number} amount - the amount of months to be subtracted - * @returns {Date} the new date with the months subtracted - * @throws {TypeError} 2 arguments required - * - * @example - * // Subtract 5 months from 1 February 2015: - * var result = subMonths(new Date(2015, 1, 1), 5) - * //=> Mon Sep 01 2014 00:00:00 - */ - -function subMonths(dirtyDate, dirtyAmount) { - if (arguments.length < 2) { - throw new TypeError('2 arguments required, but only ' + arguments.length + ' present'); - } - - var amount = Object(_lib_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyAmount); - return Object(_addMonths_index_js__WEBPACK_IMPORTED_MODULE_1__["default"])(dirtyDate, -amount); -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/subQuarters/index.js": -/*!********************************************************!*\ - !*** ./node_modules/date-fns/esm/subQuarters/index.js ***! - \********************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return subQuarters; }); -/* harmony import */ var _lib_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../_lib/toInteger/index.js */ "./node_modules/date-fns/esm/_lib/toInteger/index.js"); -/* harmony import */ var _addQuarters_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../addQuarters/index.js */ "./node_modules/date-fns/esm/addQuarters/index.js"); - - -/** - * @name subQuarters - * @category Quarter Helpers - * @summary Subtract the specified number of year quarters from the given date. - * - * @description - * Subtract the specified number of year quarters from the given date. - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} date - the date to be changed - * @param {Number} amount - the amount of quarters to be subtracted - * @returns {Date} the new date with the quarters subtracted - * @throws {TypeError} 2 arguments required - * - * @example - * // Subtract 3 quarters from 1 September 2014: - * var result = subQuarters(new Date(2014, 8, 1), 3) - * //=> Sun Dec 01 2013 00:00:00 - */ - -function subQuarters(dirtyDate, dirtyAmount) { - if (arguments.length < 2) { - throw new TypeError('2 arguments required, but only ' + arguments.length + ' present'); - } - - var amount = Object(_lib_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyAmount); - return Object(_addQuarters_index_js__WEBPACK_IMPORTED_MODULE_1__["default"])(dirtyDate, -amount); -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/subSeconds/index.js": -/*!*******************************************************!*\ - !*** ./node_modules/date-fns/esm/subSeconds/index.js ***! - \*******************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return subSeconds; }); -/* harmony import */ var _lib_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../_lib/toInteger/index.js */ "./node_modules/date-fns/esm/_lib/toInteger/index.js"); -/* harmony import */ var _addSeconds_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../addSeconds/index.js */ "./node_modules/date-fns/esm/addSeconds/index.js"); - - -/** - * @name subSeconds - * @category Second Helpers - * @summary Subtract the specified number of seconds from the given date. - * - * @description - * Subtract the specified number of seconds from the given date. - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} date - the date to be changed - * @param {Number} amount - the amount of seconds to be subtracted - * @returns {Date} the new date with the seconds subtracted - * @throws {TypeError} 2 arguments required - * - * @example - * // Subtract 30 seconds from 10 July 2014 12:45:00: - * var result = subSeconds(new Date(2014, 6, 10, 12, 45, 0), 30) - * //=> Thu Jul 10 2014 12:44:30 - */ - -function subSeconds(dirtyDate, dirtyAmount) { - if (arguments.length < 2) { - throw new TypeError('2 arguments required, but only ' + arguments.length + ' present'); - } - - var amount = Object(_lib_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyAmount); - return Object(_addSeconds_index_js__WEBPACK_IMPORTED_MODULE_1__["default"])(dirtyDate, -amount); -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/subWeeks/index.js": -/*!*****************************************************!*\ - !*** ./node_modules/date-fns/esm/subWeeks/index.js ***! - \*****************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return subWeeks; }); -/* harmony import */ var _lib_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../_lib/toInteger/index.js */ "./node_modules/date-fns/esm/_lib/toInteger/index.js"); -/* harmony import */ var _addWeeks_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../addWeeks/index.js */ "./node_modules/date-fns/esm/addWeeks/index.js"); - - -/** - * @name subWeeks - * @category Week Helpers - * @summary Subtract the specified number of weeks from the given date. - * - * @description - * Subtract the specified number of weeks from the given date. - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} date - the date to be changed - * @param {Number} amount - the amount of weeks to be subtracted - * @returns {Date} the new date with the weeks subtracted - * @throws {TypeError} 2 arguments required - * - * @example - * // Subtract 4 weeks from 1 September 2014: - * var result = subWeeks(new Date(2014, 8, 1), 4) - * //=> Mon Aug 04 2014 00:00:00 - */ - -function subWeeks(dirtyDate, dirtyAmount) { - if (arguments.length < 2) { - throw new TypeError('2 arguments required, but only ' + arguments.length + ' present'); - } - - var amount = Object(_lib_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyAmount); - return Object(_addWeeks_index_js__WEBPACK_IMPORTED_MODULE_1__["default"])(dirtyDate, -amount); -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/subYears/index.js": -/*!*****************************************************!*\ - !*** ./node_modules/date-fns/esm/subYears/index.js ***! - \*****************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return subYears; }); -/* harmony import */ var _lib_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../_lib/toInteger/index.js */ "./node_modules/date-fns/esm/_lib/toInteger/index.js"); -/* harmony import */ var _addYears_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../addYears/index.js */ "./node_modules/date-fns/esm/addYears/index.js"); - - -/** - * @name subYears - * @category Year Helpers - * @summary Subtract the specified number of years from the given date. - * - * @description - * Subtract the specified number of years from the given date. - * - * ### v2.0.0 breaking changes: - * - * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes). - * - * @param {Date|Number} date - the date to be changed - * @param {Number} amount - the amount of years to be subtracted - * @returns {Date} the new date with the years subtracted - * @throws {TypeError} 2 arguments required - * - * @example - * // Subtract 5 years from 1 September 2014: - * var result = subYears(new Date(2014, 8, 1), 5) - * //=> Tue Sep 01 2009 00:00:00 - */ - -function subYears(dirtyDate, dirtyAmount) { - if (arguments.length < 2) { - throw new TypeError('2 arguments required, but only ' + arguments.length + ' present'); - } - - var amount = Object(_lib_toInteger_index_js__WEBPACK_IMPORTED_MODULE_0__["default"])(dirtyAmount); - return Object(_addYears_index_js__WEBPACK_IMPORTED_MODULE_1__["default"])(dirtyDate, -amount); -} - -/***/ }), - -/***/ "./node_modules/date-fns/esm/toDate/index.js": -/*!***************************************************!*\ - !*** ./node_modules/date-fns/esm/toDate/index.js ***! - \***************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return toDate; }); -/** - * @name toDate - * @category Common Helpers - * @summary Convert the given argument to an instance of Date. - * - * @description - * Convert the given argument to an instance of Date. - * - * If the argument is an instance of Date, the function returns its clone. - * - * If the argument is a number, it is treated as a timestamp. - * - * If the argument is none of the above, the function returns Invalid Date. - * - * **Note**: *all* Date arguments passed to any *date-fns* function is processed by `toDate`. - * - * @param {Date|Number} argument - the value to convert - * @returns {Date} the parsed date in the local time zone - * @throws {TypeError} 1 argument required - * - * @example - * // Clone the date: - * var result = toDate(new Date(2014, 1, 11, 11, 30, 30)) - * //=> Tue Feb 11 2014 11:30:30 - * - * @example - * // Convert the timestamp to date: - * var result = toDate(1392098430000) - * //=> Tue Feb 11 2014 11:30:30 - */ -function toDate(argument) { - if (arguments.length < 1) { - throw new TypeError('1 argument required, but only ' + arguments.length + ' present'); - } - - var argStr = Object.prototype.toString.call(argument); // Clone the date - - if (argument instanceof Date || typeof argument === 'object' && argStr === '[object Date]') { - // Prevent the date to lose the milliseconds when passed to new Date() in IE10 - return new Date(argument.getTime()); - } else if (typeof argument === 'number' || argStr === '[object Number]') { - return new Date(argument); - } else { - if ((typeof argument === 'string' || argStr === '[object String]') && typeof console !== 'undefined') { - console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as arguments. Please use `parseISO` to parse strings. See: https://git.io/fpAk2"); - console.warn(new Error().stack); - } - - return new Date(NaN); - } -} - -/***/ }), - -/***/ "./node_modules/deep-equal/index.js": -/*!******************************************!*\ - !*** ./node_modules/deep-equal/index.js ***! - \******************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var objectKeys = __webpack_require__(/*! object-keys */ "./node_modules/object-keys/index.js"); - -var isArguments = __webpack_require__(/*! is-arguments */ "./node_modules/is-arguments/index.js"); - -var is = __webpack_require__(/*! object-is */ "./node_modules/object-is/index.js"); - -var isRegex = __webpack_require__(/*! is-regex */ "./node_modules/is-regex/index.js"); - -var flags = __webpack_require__(/*! regexp.prototype.flags */ "./node_modules/regexp.prototype.flags/index.js"); - -var isArray = __webpack_require__(/*! isarray */ "./node_modules/deep-equal/node_modules/isarray/index.js"); - -var isDate = __webpack_require__(/*! is-date-object */ "./node_modules/is-date-object/index.js"); - -var whichBoxedPrimitive = __webpack_require__(/*! which-boxed-primitive */ "./node_modules/which-boxed-primitive/index.js"); - -var GetIntrinsic = __webpack_require__(/*! get-intrinsic */ "./node_modules/get-intrinsic/index.js"); - -var callBound = __webpack_require__(/*! call-bind/callBound */ "./node_modules/call-bind/callBound.js"); - -var whichCollection = __webpack_require__(/*! which-collection */ "./node_modules/which-collection/index.js"); - -var getIterator = __webpack_require__(/*! es-get-iterator */ "./node_modules/es-get-iterator/index.js"); - -var getSideChannel = __webpack_require__(/*! side-channel */ "./node_modules/side-channel/index.js"); - -var whichTypedArray = __webpack_require__(/*! which-typed-array */ "./node_modules/which-typed-array/index.js"); - -var assign = __webpack_require__(/*! object.assign */ "./node_modules/object.assign/index.js"); - -var $getTime = callBound('Date.prototype.getTime'); -var gPO = Object.getPrototypeOf; -var $objToString = callBound('Object.prototype.toString'); -var $Set = GetIntrinsic('%Set%', true); -var $mapHas = callBound('Map.prototype.has', true); -var $mapGet = callBound('Map.prototype.get', true); -var $mapSize = callBound('Map.prototype.size', true); -var $setAdd = callBound('Set.prototype.add', true); -var $setDelete = callBound('Set.prototype.delete', true); -var $setHas = callBound('Set.prototype.has', true); -var $setSize = callBound('Set.prototype.size', true); // taken from https://github.com/browserify/commonjs-assert/blob/bba838e9ba9e28edf3127ce6974624208502f6bc/internal/util/comparisons.js#L401-L414 - -function setHasEqualElement(set, val1, opts, channel) { - var i = getIterator(set); - var result; - - while ((result = i.next()) && !result.done) { - if (internalDeepEqual(val1, result.value, opts, channel)) { - // eslint-disable-line no-use-before-define - // Remove the matching element to make sure we do not check that again. - $setDelete(set, result.value); - return true; - } - } - - return false; -} // taken from https://github.com/browserify/commonjs-assert/blob/bba838e9ba9e28edf3127ce6974624208502f6bc/internal/util/comparisons.js#L416-L439 - - -function findLooseMatchingPrimitives(prim) { - if (typeof prim === 'undefined') { - return null; - } - - if (typeof prim === 'object') { - // Only pass in null as object! - return void 0; - } - - if (typeof prim === 'symbol') { - return false; - } - - if (typeof prim === 'string' || typeof prim === 'number') { - // Loose equal entries exist only if the string is possible to convert to a regular number and not NaN. - return +prim === +prim; // eslint-disable-line no-implicit-coercion - } - - return true; -} // taken from https://github.com/browserify/commonjs-assert/blob/bba838e9ba9e28edf3127ce6974624208502f6bc/internal/util/comparisons.js#L449-L460 - - -function mapMightHaveLoosePrim(a, b, prim, item, opts, channel) { - var altValue = findLooseMatchingPrimitives(prim); - - if (altValue != null) { - return altValue; - } - - var curB = $mapGet(b, altValue); - var looseOpts = assign({}, opts, { - strict: false - }); - - if (typeof curB === 'undefined' && !$mapHas(b, altValue) // eslint-disable-next-line no-use-before-define - || !internalDeepEqual(item, curB, looseOpts, channel)) { - return false; - } // eslint-disable-next-line no-use-before-define - - - return !$mapHas(a, altValue) && internalDeepEqual(item, curB, looseOpts, channel); -} // taken from https://github.com/browserify/commonjs-assert/blob/bba838e9ba9e28edf3127ce6974624208502f6bc/internal/util/comparisons.js#L441-L447 - - -function setMightHaveLoosePrim(a, b, prim) { - var altValue = findLooseMatchingPrimitives(prim); - - if (altValue != null) { - return altValue; - } - - return $setHas(b, altValue) && !$setHas(a, altValue); -} // taken from https://github.com/browserify/commonjs-assert/blob/bba838e9ba9e28edf3127ce6974624208502f6bc/internal/util/comparisons.js#L518-L533 - - -function mapHasEqualEntry(set, map, key1, item1, opts, channel) { - var i = getIterator(set); - var result; - var key2; - - while ((result = i.next()) && !result.done) { - key2 = result.value; - - if ( // eslint-disable-next-line no-use-before-define - internalDeepEqual(key1, key2, opts, channel) // eslint-disable-next-line no-use-before-define - && internalDeepEqual(item1, $mapGet(map, key2), opts, channel)) { - $setDelete(set, key2); - return true; - } - } - - return false; -} - -function internalDeepEqual(actual, expected, options, channel) { - var opts = options || {}; // 7.1. All identical values are equivalent, as determined by ===. - - if (opts.strict ? is(actual, expected) : actual === expected) { - return true; - } - - var actualBoxed = whichBoxedPrimitive(actual); - var expectedBoxed = whichBoxedPrimitive(expected); - - if (actualBoxed !== expectedBoxed) { - return false; - } // 7.3. Other pairs that do not both pass typeof value == 'object', equivalence is determined by ==. - - - if (!actual || !expected || typeof actual !== 'object' && typeof expected !== 'object') { - return opts.strict ? is(actual, expected) : actual == expected; // eslint-disable-line eqeqeq - } - /* - * 7.4. For all other Object pairs, including Array objects, equivalence is - * determined by having the same number of owned properties (as verified - * with Object.prototype.hasOwnProperty.call), the same set of keys - * (although not necessarily the same order), equivalent values for every - * corresponding key, and an identical 'prototype' property. Note: this - * accounts for both named and indexed properties on Arrays. - */ - // see https://github.com/nodejs/node/commit/d3aafd02efd3a403d646a3044adcf14e63a88d32 for memos/channel inspiration - - - var hasActual = channel.has(actual); - var hasExpected = channel.has(expected); - var sentinel; - - if (hasActual && hasExpected) { - if (channel.get(actual) === channel.get(expected)) { - return true; - } - } else { - sentinel = {}; - } - - if (!hasActual) { - channel.set(actual, sentinel); - } - - if (!hasExpected) { - channel.set(expected, sentinel); - } // eslint-disable-next-line no-use-before-define - - - return objEquiv(actual, expected, opts, channel); -} - -function isBuffer(x) { - if (!x || typeof x !== 'object' || typeof x.length !== 'number') { - return false; - } - - if (typeof x.copy !== 'function' || typeof x.slice !== 'function') { - return false; - } - - if (x.length > 0 && typeof x[0] !== 'number') { - return false; - } - - return !!(x.constructor && x.constructor.isBuffer && x.constructor.isBuffer(x)); -} - -function setEquiv(a, b, opts, channel) { - if ($setSize(a) !== $setSize(b)) { - return false; - } - - var iA = getIterator(a); - var iB = getIterator(b); - var resultA; - var resultB; - var set; - - while ((resultA = iA.next()) && !resultA.done) { - if (resultA.value && typeof resultA.value === 'object') { - if (!set) { - set = new $Set(); - } - - $setAdd(set, resultA.value); - } else if (!$setHas(b, resultA.value)) { - if (opts.strict) { - return false; - } - - if (!setMightHaveLoosePrim(a, b, resultA.value)) { - return false; - } - - if (!set) { - set = new $Set(); - } - - $setAdd(set, resultA.value); - } - } - - if (set) { - while ((resultB = iB.next()) && !resultB.done) { - // We have to check if a primitive value is already matching and only if it's not, go hunting for it. - if (resultB.value && typeof resultB.value === 'object') { - if (!setHasEqualElement(set, resultB.value, opts.strict, channel)) { - return false; - } - } else if (!opts.strict && !$setHas(a, resultB.value) && !setHasEqualElement(set, resultB.value, opts.strict, channel)) { - return false; - } - } - - return $setSize(set) === 0; - } - - return true; -} - -function mapEquiv(a, b, opts, channel) { - if ($mapSize(a) !== $mapSize(b)) { - return false; - } - - var iA = getIterator(a); - var iB = getIterator(b); - var resultA; - var resultB; - var set; - var key; - var item1; - var item2; - - while ((resultA = iA.next()) && !resultA.done) { - key = resultA.value[0]; - item1 = resultA.value[1]; - - if (key && typeof key === 'object') { - if (!set) { - set = new $Set(); - } - - $setAdd(set, key); - } else { - item2 = $mapGet(b, key); - - if (typeof item2 === 'undefined' && !$mapHas(b, key) || !internalDeepEqual(item1, item2, opts, channel)) { - if (opts.strict) { - return false; - } - - if (!mapMightHaveLoosePrim(a, b, key, item1, opts, channel)) { - return false; - } - - if (!set) { - set = new $Set(); - } - - $setAdd(set, key); - } - } - } - - if (set) { - while ((resultB = iB.next()) && !resultB.done) { - key = resultB.value[0]; - item2 = resultB.value[1]; - - if (key && typeof key === 'object') { - if (!mapHasEqualEntry(set, a, key, item2, opts, channel)) { - return false; - } - } else if (!opts.strict && (!a.has(key) || !internalDeepEqual($mapGet(a, key), item2, opts, channel)) && !mapHasEqualEntry(set, a, key, item2, assign({}, opts, { - strict: false - }), channel)) { - return false; - } - } - - return $setSize(set) === 0; - } - - return true; -} - -function objEquiv(a, b, opts, channel) { - /* eslint max-statements: [2, 100], max-lines-per-function: [2, 120], max-depth: [2, 5] */ - var i, key; - - if (typeof a !== typeof b) { - return false; - } - - if (a == null || b == null) { - return false; - } - - if ($objToString(a) !== $objToString(b)) { - return false; - } - - if (isArguments(a) !== isArguments(b)) { - return false; - } - - var aIsArray = isArray(a); - var bIsArray = isArray(b); - - if (aIsArray !== bIsArray) { - return false; - } // TODO: replace when a cross-realm brand check is available - - - var aIsError = a instanceof Error; - var bIsError = b instanceof Error; - - if (aIsError !== bIsError) { - return false; - } - - if (aIsError || bIsError) { - if (a.name !== b.name || a.message !== b.message) { - return false; - } - } - - var aIsRegex = isRegex(a); - var bIsRegex = isRegex(b); - - if (aIsRegex !== bIsRegex) { - return false; - } - - if ((aIsRegex || bIsRegex) && (a.source !== b.source || flags(a) !== flags(b))) { - return false; - } - - var aIsDate = isDate(a); - var bIsDate = isDate(b); - - if (aIsDate !== bIsDate) { - return false; - } - - if (aIsDate || bIsDate) { - // && would work too, because both are true or both false here - if ($getTime(a) !== $getTime(b)) { - return false; - } - } - - if (opts.strict && gPO && gPO(a) !== gPO(b)) { - return false; - } - - if (whichTypedArray(a) !== whichTypedArray(b)) { - return false; - } - - var aIsBuffer = isBuffer(a); - var bIsBuffer = isBuffer(b); - - if (aIsBuffer !== bIsBuffer) { - return false; - } - - if (aIsBuffer || bIsBuffer) { - // && would work too, because both are true or both false here - if (a.length !== b.length) { - return false; - } - - for (i = 0; i < a.length; i++) { - if (a[i] !== b[i]) { - return false; - } - } - - return true; - } - - if (typeof a !== typeof b) { - return false; - } - - var ka = objectKeys(a); - var kb = objectKeys(b); // having the same number of owned properties (keys incorporates hasOwnProperty) - - if (ka.length !== kb.length) { - return false; - } // the same set of keys (although not necessarily the same order), - - - ka.sort(); - kb.sort(); // ~~~cheap key test - - for (i = ka.length - 1; i >= 0; i--) { - if (ka[i] != kb[i]) { - return false; - } // eslint-disable-line eqeqeq - - } // equivalent values for every corresponding key, and ~~~possibly expensive deep test - - - for (i = ka.length - 1; i >= 0; i--) { - key = ka[i]; - - if (!internalDeepEqual(a[key], b[key], opts, channel)) { - return false; - } - } - - var aCollection = whichCollection(a); - var bCollection = whichCollection(b); - - if (aCollection !== bCollection) { - return false; - } - - if (aCollection === 'Set' || bCollection === 'Set') { - // aCollection === bCollection - return setEquiv(a, b, opts, channel); - } - - if (aCollection === 'Map') { - // aCollection === bCollection - return mapEquiv(a, b, opts, channel); - } - - return true; -} - -module.exports = function deepEqual(a, b, opts) { - return internalDeepEqual(a, b, opts, getSideChannel()); -}; - -/***/ }), - -/***/ "./node_modules/deep-equal/node_modules/isarray/index.js": -/*!***************************************************************!*\ - !*** ./node_modules/deep-equal/node_modules/isarray/index.js ***! - \***************************************************************/ -/*! no static exports found */ -/***/ (function(module, exports) { - -var toString = {}.toString; - -module.exports = Array.isArray || function (arr) { - return toString.call(arr) == '[object Array]'; -}; - -/***/ }), - -/***/ "./node_modules/define-properties/index.js": -/*!*************************************************!*\ - !*** ./node_modules/define-properties/index.js ***! - \*************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var keys = __webpack_require__(/*! object-keys */ "./node_modules/object-keys/index.js"); - -var hasSymbols = typeof Symbol === 'function' && typeof Symbol('foo') === 'symbol'; -var toStr = Object.prototype.toString; -var concat = Array.prototype.concat; -var origDefineProperty = Object.defineProperty; - -var isFunction = function (fn) { - return typeof fn === 'function' && toStr.call(fn) === '[object Function]'; -}; - -var arePropertyDescriptorsSupported = function () { - var obj = {}; - - try { - origDefineProperty(obj, 'x', { - enumerable: false, - value: obj - }); // eslint-disable-next-line no-unused-vars, no-restricted-syntax - - for (var _ in obj) { - // jscs:ignore disallowUnusedVariables - return false; - } - - return obj.x === obj; - } catch (e) { - /* this is IE 8. */ - return false; - } -}; - -var supportsDescriptors = origDefineProperty && arePropertyDescriptorsSupported(); - -var defineProperty = function (object, name, value, predicate) { - if (name in object && (!isFunction(predicate) || !predicate())) { - return; - } - - if (supportsDescriptors) { - origDefineProperty(object, name, { - configurable: true, - enumerable: false, - value: value, - writable: true - }); - } else { - object[name] = value; - } -}; - -var defineProperties = function (object, map) { - var predicates = arguments.length > 2 ? arguments[2] : {}; - var props = keys(map); - - if (hasSymbols) { - props = concat.call(props, Object.getOwnPropertySymbols(map)); - } - - for (var i = 0; i < props.length; i += 1) { - defineProperty(object, props[i], map[props[i]], predicates[props[i]]); - } -}; - -defineProperties.supportsDescriptors = !!supportsDescriptors; -module.exports = defineProperties; - -/***/ }), - -/***/ "./node_modules/es-abstract/helpers/getOwnPropertyDescriptor.js": -/*!**********************************************************************!*\ - !*** ./node_modules/es-abstract/helpers/getOwnPropertyDescriptor.js ***! - \**********************************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var GetIntrinsic = __webpack_require__(/*! get-intrinsic */ "./node_modules/get-intrinsic/index.js"); - -var $gOPD = GetIntrinsic('%Object.getOwnPropertyDescriptor%', true); - -if ($gOPD) { - try { - $gOPD([], 'length'); - } catch (e) { - // IE 8 has a broken gOPD - $gOPD = null; - } -} - -module.exports = $gOPD; - -/***/ }), - -/***/ "./node_modules/es-get-iterator/index.js": -/*!***********************************************!*\ - !*** ./node_modules/es-get-iterator/index.js ***! - \***********************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -/* eslint global-require: 0 */ -// the code is structured this way so that bundlers can -// alias out `has-symbols` to `() => true` or `() => false` if your target -// environments' Symbol capabilities are known, and then use -// dead code elimination on the rest of this module. -// -// Similarly, `isarray` can be aliased to `Array.isArray` if -// available in all target environments. - -var isArguments = __webpack_require__(/*! is-arguments */ "./node_modules/is-arguments/index.js"); - -if (__webpack_require__(/*! has-symbols */ "./node_modules/has-symbols/index.js")() || __webpack_require__(/*! has-symbols/shams */ "./node_modules/has-symbols/shams.js")()) { - var $iterator = Symbol.iterator; // Symbol is available natively or shammed - // natively: - // - Chrome >= 38 - // - Edge 12-14?, Edge >= 15 for sure - // - FF >= 36 - // - Safari >= 9 - // - node >= 0.12 - - module.exports = function getIterator(iterable) { - // alternatively, `iterable[$iterator]?.()` - if (iterable != null && typeof iterable[$iterator] !== 'undefined') { - return iterable[$iterator](); - } - - if (isArguments(iterable)) { - // arguments objects lack Symbol.iterator - // - node 0.12 - return Array.prototype[$iterator].call(iterable); - } - }; -} else { - // Symbol is not available, native or shammed - var isArray = __webpack_require__(/*! isarray */ "./node_modules/es-get-iterator/node_modules/isarray/index.js"); - - var isString = __webpack_require__(/*! is-string */ "./node_modules/is-string/index.js"); - - var GetIntrinsic = __webpack_require__(/*! get-intrinsic */ "./node_modules/get-intrinsic/index.js"); - - var $Map = GetIntrinsic('%Map%', true); - var $Set = GetIntrinsic('%Set%', true); - - var callBound = __webpack_require__(/*! call-bind/callBound */ "./node_modules/call-bind/callBound.js"); - - var $arrayPush = callBound('Array.prototype.push'); - var $charCodeAt = callBound('String.prototype.charCodeAt'); - var $stringSlice = callBound('String.prototype.slice'); - - var advanceStringIndex = function advanceStringIndex(S, index) { - var length = S.length; - - if (index + 1 >= length) { - return index + 1; - } - - var first = $charCodeAt(S, index); - - if (first < 0xD800 || first > 0xDBFF) { - return index + 1; - } - - var second = $charCodeAt(S, index + 1); - - if (second < 0xDC00 || second > 0xDFFF) { - return index + 1; - } - - return index + 2; - }; - - var getArrayIterator = function getArrayIterator(arraylike) { - var i = 0; - return { - next: function next() { - var done = i >= arraylike.length; - var value; - - if (!done) { - value = arraylike[i]; - i += 1; - } - - return { - done: done, - value: value - }; - } - }; - }; - - var getNonCollectionIterator = function getNonCollectionIterator(iterable, noPrimordialCollections) { - if (isArray(iterable) || isArguments(iterable)) { - return getArrayIterator(iterable); - } - - if (isString(iterable)) { - var i = 0; - return { - next: function next() { - var nextIndex = advanceStringIndex(iterable, i); - var value = $stringSlice(iterable, i, nextIndex); - i = nextIndex; - return { - done: nextIndex > iterable.length, - value: value - }; - } - }; - } // es6-shim and es-shims' es-map use a string "_es6-shim iterator_" property on different iterables, such as MapIterator. - - - if (noPrimordialCollections && typeof iterable['_es6-shim iterator_'] !== 'undefined') { - return iterable['_es6-shim iterator_'](); - } - }; - - if (!$Map && !$Set) { - // the only language iterables are Array, String, arguments - // - Safari <= 6.0 - // - Chrome < 38 - // - node < 0.12 - // - FF < 13 - // - IE < 11 - // - Edge < 11 - module.exports = function getIterator(iterable) { - if (iterable != null) { - return getNonCollectionIterator(iterable, true); - } - }; - } else { - // either Map or Set are available, but Symbol is not - // - es6-shim on an ES5 browser - // - Safari 6.2 (maybe 6.1?) - // - FF v[13, 36) - // - IE 11 - // - Edge 11 - // - Safari v[6, 9) - var isMap = __webpack_require__(/*! is-map */ "./node_modules/is-map/index.js"); - - var isSet = __webpack_require__(/*! is-set */ "./node_modules/is-set/index.js"); // Firefox >= 27, IE 11, Safari 6.2 - 9, Edge 11, es6-shim in older envs, all have forEach - - - var $mapForEach = callBound('Map.prototype.forEach', true); - var $setForEach = callBound('Set.prototype.forEach', true); - - if (typeof process === 'undefined' || !process.versions || !process.versions.node) { - // "if is not node" - // Firefox 17 - 26 has `.iterator()`, whose iterator `.next()` either - // returns a value, or throws a StopIteration object. These browsers - // do not have any other mechanism for iteration. - var $mapIterator = callBound('Map.prototype.iterator', true); - var $setIterator = callBound('Set.prototype.iterator', true); - - var getStopIterationIterator = function (iterator) { - var done = false; - return { - next: function next() { - try { - return { - done: done, - value: done ? undefined : iterator.next() - }; - } catch (e) { - done = true; - return { - done: true, - value: undefined - }; - } - } - }; - }; - } // Firefox 27-35, and some older es6-shim versions, use a string "@@iterator" property - // this returns a proper iterator object, so we should use it instead of forEach. - // newer es6-shim versions use a string "_es6-shim iterator_" property. - - - var $mapAtAtIterator = callBound('Map.prototype.@@iterator', true) || callBound('Map.prototype._es6-shim iterator_', true); - var $setAtAtIterator = callBound('Set.prototype.@@iterator', true) || callBound('Set.prototype._es6-shim iterator_', true); - - var getCollectionIterator = function getCollectionIterator(iterable) { - if (isMap(iterable)) { - if ($mapIterator) { - return getStopIterationIterator($mapIterator(iterable)); - } - - if ($mapAtAtIterator) { - return $mapAtAtIterator(iterable); - } - - if ($mapForEach) { - var entries = []; - $mapForEach(iterable, function (v, k) { - $arrayPush(entries, [k, v]); - }); - return getArrayIterator(entries); - } - } - - if (isSet(iterable)) { - if ($setIterator) { - return getStopIterationIterator($setIterator(iterable)); - } - - if ($setAtAtIterator) { - return $setAtAtIterator(iterable); - } - - if ($setForEach) { - var values = []; - $setForEach(iterable, function (v) { - $arrayPush(values, v); - }); - return getArrayIterator(values); - } - } - }; - - module.exports = function getIterator(iterable) { - return getCollectionIterator(iterable) || getNonCollectionIterator(iterable); - }; - } -} - -/***/ }), - -/***/ "./node_modules/es-get-iterator/node_modules/isarray/index.js": -/*!********************************************************************!*\ - !*** ./node_modules/es-get-iterator/node_modules/isarray/index.js ***! - \********************************************************************/ -/*! no static exports found */ -/***/ (function(module, exports) { - -var toString = {}.toString; - -module.exports = Array.isArray || function (arr) { - return toString.call(arr) == '[object Array]'; -}; - -/***/ }), - -/***/ "./node_modules/foreach/index.js": -/*!***************************************!*\ - !*** ./node_modules/foreach/index.js ***! - \***************************************/ -/*! no static exports found */ -/***/ (function(module, exports) { - -var hasOwn = Object.prototype.hasOwnProperty; -var toString = Object.prototype.toString; - -module.exports = function forEach(obj, fn, ctx) { - if (toString.call(fn) !== '[object Function]') { - throw new TypeError('iterator must be a function'); - } - - var l = obj.length; - - if (l === +l) { - for (var i = 0; i < l; i++) { - fn.call(ctx, obj[i], i, obj); - } - } else { - for (var k in obj) { - if (hasOwn.call(obj, k)) { - fn.call(ctx, obj[k], k, obj); - } - } - } -}; - -/***/ }), - -/***/ "./node_modules/function-bind/implementation.js": -/*!******************************************************!*\ - !*** ./node_modules/function-bind/implementation.js ***! - \******************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -/* eslint no-invalid-this: 1 */ - -var ERROR_MESSAGE = 'Function.prototype.bind called on incompatible '; -var slice = Array.prototype.slice; -var toStr = Object.prototype.toString; -var funcType = '[object Function]'; - -module.exports = function bind(that) { - var target = this; - - if (typeof target !== 'function' || toStr.call(target) !== funcType) { - throw new TypeError(ERROR_MESSAGE + target); - } - - var args = slice.call(arguments, 1); - var bound; - - var binder = function () { - if (this instanceof bound) { - var result = target.apply(this, args.concat(slice.call(arguments))); - - if (Object(result) === result) { - return result; - } - - return this; - } else { - return target.apply(that, args.concat(slice.call(arguments))); - } - }; - - var boundLength = Math.max(0, target.length - args.length); - var boundArgs = []; - - for (var i = 0; i < boundLength; i++) { - boundArgs.push('$' + i); - } - - bound = Function('binder', 'return function (' + boundArgs.join(',') + '){ return binder.apply(this,arguments); }')(binder); - - if (target.prototype) { - var Empty = function Empty() {}; - - Empty.prototype = target.prototype; - bound.prototype = new Empty(); - Empty.prototype = null; - } - - return bound; -}; - -/***/ }), - -/***/ "./node_modules/function-bind/index.js": -/*!*********************************************!*\ - !*** ./node_modules/function-bind/index.js ***! - \*********************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var implementation = __webpack_require__(/*! ./implementation */ "./node_modules/function-bind/implementation.js"); - -module.exports = Function.prototype.bind || implementation; - -/***/ }), - -/***/ "./node_modules/get-intrinsic/index.js": -/*!*********************************************!*\ - !*** ./node_modules/get-intrinsic/index.js ***! - \*********************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var undefined; -var $SyntaxError = SyntaxError; -var $Function = Function; -var $TypeError = TypeError; // eslint-disable-next-line consistent-return - -var getEvalledConstructor = function (expressionSyntax) { - try { - return $Function('"use strict"; return (' + expressionSyntax + ').constructor;')(); - } catch (e) {} -}; - -var $gOPD = Object.getOwnPropertyDescriptor; - -if ($gOPD) { - try { - $gOPD({}, ''); - } catch (e) { - $gOPD = null; // this is IE 8, which has a broken gOPD - } -} - -var throwTypeError = function () { - throw new $TypeError(); -}; - -var ThrowTypeError = $gOPD ? function () { - try { - // eslint-disable-next-line no-unused-expressions, no-caller, no-restricted-properties - arguments.callee; // IE 8 does not throw here - - return throwTypeError; - } catch (calleeThrows) { - try { - // IE 8 throws on Object.getOwnPropertyDescriptor(arguments, '') - return $gOPD(arguments, 'callee').get; - } catch (gOPDthrows) { - return throwTypeError; - } - } -}() : throwTypeError; - -var hasSymbols = __webpack_require__(/*! has-symbols */ "./node_modules/has-symbols/index.js")(); - -var getProto = Object.getPrototypeOf || function (x) { - return x.__proto__; -}; // eslint-disable-line no-proto - - -var needsEval = {}; -var TypedArray = typeof Uint8Array === 'undefined' ? undefined : getProto(Uint8Array); -var INTRINSICS = { - '%AggregateError%': typeof AggregateError === 'undefined' ? undefined : AggregateError, - '%Array%': Array, - '%ArrayBuffer%': typeof ArrayBuffer === 'undefined' ? undefined : ArrayBuffer, - '%ArrayIteratorPrototype%': hasSymbols ? getProto([][Symbol.iterator]()) : undefined, - '%AsyncFromSyncIteratorPrototype%': undefined, - '%AsyncFunction%': needsEval, - '%AsyncGenerator%': needsEval, - '%AsyncGeneratorFunction%': needsEval, - '%AsyncIteratorPrototype%': needsEval, - '%Atomics%': typeof Atomics === 'undefined' ? undefined : Atomics, - '%BigInt%': typeof BigInt === 'undefined' ? undefined : BigInt, - '%Boolean%': Boolean, - '%DataView%': typeof DataView === 'undefined' ? undefined : DataView, - '%Date%': Date, - '%decodeURI%': decodeURI, - '%decodeURIComponent%': decodeURIComponent, - '%encodeURI%': encodeURI, - '%encodeURIComponent%': encodeURIComponent, - '%Error%': Error, - '%eval%': eval, - // eslint-disable-line no-eval - '%EvalError%': EvalError, - '%Float32Array%': typeof Float32Array === 'undefined' ? undefined : Float32Array, - '%Float64Array%': typeof Float64Array === 'undefined' ? undefined : Float64Array, - '%FinalizationRegistry%': typeof FinalizationRegistry === 'undefined' ? undefined : FinalizationRegistry, - '%Function%': $Function, - '%GeneratorFunction%': needsEval, - '%Int8Array%': typeof Int8Array === 'undefined' ? undefined : Int8Array, - '%Int16Array%': typeof Int16Array === 'undefined' ? undefined : Int16Array, - '%Int32Array%': typeof Int32Array === 'undefined' ? undefined : Int32Array, - '%isFinite%': isFinite, - '%isNaN%': isNaN, - '%IteratorPrototype%': hasSymbols ? getProto(getProto([][Symbol.iterator]())) : undefined, - '%JSON%': typeof JSON === 'object' ? JSON : undefined, - '%Map%': typeof Map === 'undefined' ? undefined : Map, - '%MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols ? undefined : getProto(new Map()[Symbol.iterator]()), - '%Math%': Math, - '%Number%': Number, - '%Object%': Object, - '%parseFloat%': parseFloat, - '%parseInt%': parseInt, - '%Promise%': typeof Promise === 'undefined' ? undefined : Promise, - '%Proxy%': typeof Proxy === 'undefined' ? undefined : Proxy, - '%RangeError%': RangeError, - '%ReferenceError%': ReferenceError, - '%Reflect%': typeof Reflect === 'undefined' ? undefined : Reflect, - '%RegExp%': RegExp, - '%Set%': typeof Set === 'undefined' ? undefined : Set, - '%SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols ? undefined : getProto(new Set()[Symbol.iterator]()), - '%SharedArrayBuffer%': typeof SharedArrayBuffer === 'undefined' ? undefined : SharedArrayBuffer, - '%String%': String, - '%StringIteratorPrototype%': hasSymbols ? getProto(''[Symbol.iterator]()) : undefined, - '%Symbol%': hasSymbols ? Symbol : undefined, - '%SyntaxError%': $SyntaxError, - '%ThrowTypeError%': ThrowTypeError, - '%TypedArray%': TypedArray, - '%TypeError%': $TypeError, - '%Uint8Array%': typeof Uint8Array === 'undefined' ? undefined : Uint8Array, - '%Uint8ClampedArray%': typeof Uint8ClampedArray === 'undefined' ? undefined : Uint8ClampedArray, - '%Uint16Array%': typeof Uint16Array === 'undefined' ? undefined : Uint16Array, - '%Uint32Array%': typeof Uint32Array === 'undefined' ? undefined : Uint32Array, - '%URIError%': URIError, - '%WeakMap%': typeof WeakMap === 'undefined' ? undefined : WeakMap, - '%WeakRef%': typeof WeakRef === 'undefined' ? undefined : WeakRef, - '%WeakSet%': typeof WeakSet === 'undefined' ? undefined : WeakSet -}; - -var doEval = function doEval(name) { - var value; - - if (name === '%AsyncFunction%') { - value = getEvalledConstructor('async function () {}'); - } else if (name === '%GeneratorFunction%') { - value = getEvalledConstructor('function* () {}'); - } else if (name === '%AsyncGeneratorFunction%') { - value = getEvalledConstructor('async function* () {}'); - } else if (name === '%AsyncGenerator%') { - var fn = doEval('%AsyncGeneratorFunction%'); - - if (fn) { - value = fn.prototype; - } - } else if (name === '%AsyncIteratorPrototype%') { - var gen = doEval('%AsyncGenerator%'); - - if (gen) { - value = getProto(gen.prototype); - } - } - - INTRINSICS[name] = value; - return value; -}; - -var LEGACY_ALIASES = { - '%ArrayBufferPrototype%': ['ArrayBuffer', 'prototype'], - '%ArrayPrototype%': ['Array', 'prototype'], - '%ArrayProto_entries%': ['Array', 'prototype', 'entries'], - '%ArrayProto_forEach%': ['Array', 'prototype', 'forEach'], - '%ArrayProto_keys%': ['Array', 'prototype', 'keys'], - '%ArrayProto_values%': ['Array', 'prototype', 'values'], - '%AsyncFunctionPrototype%': ['AsyncFunction', 'prototype'], - '%AsyncGenerator%': ['AsyncGeneratorFunction', 'prototype'], - '%AsyncGeneratorPrototype%': ['AsyncGeneratorFunction', 'prototype', 'prototype'], - '%BooleanPrototype%': ['Boolean', 'prototype'], - '%DataViewPrototype%': ['DataView', 'prototype'], - '%DatePrototype%': ['Date', 'prototype'], - '%ErrorPrototype%': ['Error', 'prototype'], - '%EvalErrorPrototype%': ['EvalError', 'prototype'], - '%Float32ArrayPrototype%': ['Float32Array', 'prototype'], - '%Float64ArrayPrototype%': ['Float64Array', 'prototype'], - '%FunctionPrototype%': ['Function', 'prototype'], - '%Generator%': ['GeneratorFunction', 'prototype'], - '%GeneratorPrototype%': ['GeneratorFunction', 'prototype', 'prototype'], - '%Int8ArrayPrototype%': ['Int8Array', 'prototype'], - '%Int16ArrayPrototype%': ['Int16Array', 'prototype'], - '%Int32ArrayPrototype%': ['Int32Array', 'prototype'], - '%JSONParse%': ['JSON', 'parse'], - '%JSONStringify%': ['JSON', 'stringify'], - '%MapPrototype%': ['Map', 'prototype'], - '%NumberPrototype%': ['Number', 'prototype'], - '%ObjectPrototype%': ['Object', 'prototype'], - '%ObjProto_toString%': ['Object', 'prototype', 'toString'], - '%ObjProto_valueOf%': ['Object', 'prototype', 'valueOf'], - '%PromisePrototype%': ['Promise', 'prototype'], - '%PromiseProto_then%': ['Promise', 'prototype', 'then'], - '%Promise_all%': ['Promise', 'all'], - '%Promise_reject%': ['Promise', 'reject'], - '%Promise_resolve%': ['Promise', 'resolve'], - '%RangeErrorPrototype%': ['RangeError', 'prototype'], - '%ReferenceErrorPrototype%': ['ReferenceError', 'prototype'], - '%RegExpPrototype%': ['RegExp', 'prototype'], - '%SetPrototype%': ['Set', 'prototype'], - '%SharedArrayBufferPrototype%': ['SharedArrayBuffer', 'prototype'], - '%StringPrototype%': ['String', 'prototype'], - '%SymbolPrototype%': ['Symbol', 'prototype'], - '%SyntaxErrorPrototype%': ['SyntaxError', 'prototype'], - '%TypedArrayPrototype%': ['TypedArray', 'prototype'], - '%TypeErrorPrototype%': ['TypeError', 'prototype'], - '%Uint8ArrayPrototype%': ['Uint8Array', 'prototype'], - '%Uint8ClampedArrayPrototype%': ['Uint8ClampedArray', 'prototype'], - '%Uint16ArrayPrototype%': ['Uint16Array', 'prototype'], - '%Uint32ArrayPrototype%': ['Uint32Array', 'prototype'], - '%URIErrorPrototype%': ['URIError', 'prototype'], - '%WeakMapPrototype%': ['WeakMap', 'prototype'], - '%WeakSetPrototype%': ['WeakSet', 'prototype'] -}; - -var bind = __webpack_require__(/*! function-bind */ "./node_modules/function-bind/index.js"); - -var hasOwn = __webpack_require__(/*! has */ "./node_modules/has/src/index.js"); - -var $concat = bind.call(Function.call, Array.prototype.concat); -var $spliceApply = bind.call(Function.apply, Array.prototype.splice); -var $replace = bind.call(Function.call, String.prototype.replace); -var $strSlice = bind.call(Function.call, String.prototype.slice); -/* adapted from https://github.com/lodash/lodash/blob/4.17.15/dist/lodash.js#L6735-L6744 */ - -var rePropName = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g; -var reEscapeChar = /\\(\\)?/g; -/** Used to match backslashes in property paths. */ - -var stringToPath = function stringToPath(string) { - var first = $strSlice(string, 0, 1); - var last = $strSlice(string, -1); - - if (first === '%' && last !== '%') { - throw new $SyntaxError('invalid intrinsic syntax, expected closing `%`'); - } else if (last === '%' && first !== '%') { - throw new $SyntaxError('invalid intrinsic syntax, expected opening `%`'); - } - - var result = []; - $replace(string, rePropName, function (match, number, quote, subString) { - result[result.length] = quote ? $replace(subString, reEscapeChar, '$1') : number || match; - }); - return result; -}; -/* end adaptation */ - - -var getBaseIntrinsic = function getBaseIntrinsic(name, allowMissing) { - var intrinsicName = name; - var alias; - - if (hasOwn(LEGACY_ALIASES, intrinsicName)) { - alias = LEGACY_ALIASES[intrinsicName]; - intrinsicName = '%' + alias[0] + '%'; - } - - if (hasOwn(INTRINSICS, intrinsicName)) { - var value = INTRINSICS[intrinsicName]; - - if (value === needsEval) { - value = doEval(intrinsicName); - } - - if (typeof value === 'undefined' && !allowMissing) { - throw new $TypeError('intrinsic ' + name + ' exists, but is not available. Please file an issue!'); - } - - return { - alias: alias, - name: intrinsicName, - value: value - }; - } - - throw new $SyntaxError('intrinsic ' + name + ' does not exist!'); -}; - -module.exports = function GetIntrinsic(name, allowMissing) { - if (typeof name !== 'string' || name.length === 0) { - throw new $TypeError('intrinsic name must be a non-empty string'); - } - - if (arguments.length > 1 && typeof allowMissing !== 'boolean') { - throw new $TypeError('"allowMissing" argument must be a boolean'); - } - - var parts = stringToPath(name); - var intrinsicBaseName = parts.length > 0 ? parts[0] : ''; - var intrinsic = getBaseIntrinsic('%' + intrinsicBaseName + '%', allowMissing); - var intrinsicRealName = intrinsic.name; - var value = intrinsic.value; - var skipFurtherCaching = false; - var alias = intrinsic.alias; - - if (alias) { - intrinsicBaseName = alias[0]; - $spliceApply(parts, $concat([0, 1], alias)); - } - - for (var i = 1, isOwn = true; i < parts.length; i += 1) { - var part = parts[i]; - var first = $strSlice(part, 0, 1); - var last = $strSlice(part, -1); - - if ((first === '"' || first === "'" || first === '`' || last === '"' || last === "'" || last === '`') && first !== last) { - throw new $SyntaxError('property names with quotes must have matching quotes'); - } - - if (part === 'constructor' || !isOwn) { - skipFurtherCaching = true; - } - - intrinsicBaseName += '.' + part; - intrinsicRealName = '%' + intrinsicBaseName + '%'; - - if (hasOwn(INTRINSICS, intrinsicRealName)) { - value = INTRINSICS[intrinsicRealName]; - } else if (value != null) { - if (!(part in value)) { - if (!allowMissing) { - throw new $TypeError('base intrinsic for ' + name + ' exists, but the property is not available.'); - } - - return void undefined; - } - - if ($gOPD && i + 1 >= parts.length) { - var desc = $gOPD(value, part); - isOwn = !!desc; // By convention, when a data property is converted to an accessor - // property to emulate a data property that does not suffer from - // the override mistake, that accessor's getter is marked with - // an `originalValue` property. Here, when we detect this, we - // uphold the illusion by pretending to see that original data - // property, i.e., returning the value rather than the getter - // itself. - - if (isOwn && 'get' in desc && !('originalValue' in desc.get)) { - value = desc.get; - } else { - value = value[part]; - } - } else { - isOwn = hasOwn(value, part); - value = value[part]; - } - - if (isOwn && !skipFurtherCaching) { - INTRINSICS[intrinsicRealName] = value; - } - } - } - - return value; -}; - -/***/ }), - -/***/ "./node_modules/google-protobuf/google-protobuf.js": -/*!*********************************************************!*\ - !*** ./node_modules/google-protobuf/google-protobuf.js ***! - \*********************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -var $jscomp = $jscomp || {}; -$jscomp.scope = {}; - -$jscomp.findInternal = function (a, b, c) { - a instanceof String && (a = String(a)); - - for (var d = a.length, e = 0; e < d; e++) { - var f = a[e]; - if (b.call(c, f, e, a)) return { - i: e, - v: f - }; - } - - return { - i: -1, - v: void 0 - }; -}; - -$jscomp.ASSUME_ES5 = !1; -$jscomp.ASSUME_NO_NATIVE_MAP = !1; -$jscomp.ASSUME_NO_NATIVE_SET = !1; -$jscomp.SIMPLE_FROUND_POLYFILL = !1; -$jscomp.defineProperty = $jscomp.ASSUME_ES5 || "function" == typeof Object.defineProperties ? Object.defineProperty : function (a, b, c) { - a != Array.prototype && a != Object.prototype && (a[b] = c.value); -}; - -$jscomp.getGlobal = function (a) { - return "undefined" != typeof window && window === a ? a : "undefined" != typeof global && null != global ? global : a; -}; - -$jscomp.global = $jscomp.getGlobal(this); - -$jscomp.polyfill = function (a, b, c, d) { - if (b) { - c = $jscomp.global; - a = a.split("."); - - for (d = 0; d < a.length - 1; d++) { - var e = a[d]; - e in c || (c[e] = {}); - c = c[e]; - } - - a = a[a.length - 1]; - d = c[a]; - b = b(d); - b != d && null != b && $jscomp.defineProperty(c, a, { - configurable: !0, - writable: !0, - value: b - }); - } -}; - -$jscomp.polyfill("Array.prototype.findIndex", function (a) { - return a ? a : function (a, c) { - return $jscomp.findInternal(this, a, c).i; - }; -}, "es6", "es3"); - -$jscomp.checkStringArgs = function (a, b, c) { - if (null == a) throw new TypeError("The 'this' value for String.prototype." + c + " must not be null or undefined"); - if (b instanceof RegExp) throw new TypeError("First argument to String.prototype." + c + " must not be a regular expression"); - return a + ""; -}; - -$jscomp.polyfill("String.prototype.endsWith", function (a) { - return a ? a : function (a, c) { - var b = $jscomp.checkStringArgs(this, a, "endsWith"); - a += ""; - void 0 === c && (c = b.length); - c = Math.max(0, Math.min(c | 0, b.length)); - - for (var e = a.length; 0 < e && 0 < c;) if (b[--c] != a[--e]) return !1; - - return 0 >= e; - }; -}, "es6", "es3"); -$jscomp.polyfill("Array.prototype.find", function (a) { - return a ? a : function (a, c) { - return $jscomp.findInternal(this, a, c).v; - }; -}, "es6", "es3"); -$jscomp.polyfill("String.prototype.startsWith", function (a) { - return a ? a : function (a, c) { - var b = $jscomp.checkStringArgs(this, a, "startsWith"); - a += ""; - var e = b.length, - f = a.length; - c = Math.max(0, Math.min(c | 0, b.length)); - - for (var g = 0; g < f && c < e;) if (b[c++] != a[g++]) return !1; - - return g >= f; - }; -}, "es6", "es3"); -$jscomp.polyfill("String.prototype.repeat", function (a) { - return a ? a : function (a) { - var b = $jscomp.checkStringArgs(this, null, "repeat"); - if (0 > a || 1342177279 < a) throw new RangeError("Invalid count value"); - a |= 0; - - for (var d = ""; a;) if (a & 1 && (d += b), a >>>= 1) b += b; - - return d; - }; -}, "es6", "es3"); -var COMPILED = !0, - goog = goog || {}; -goog.global = this || self; - -goog.isDef = function (a) { - return void 0 !== a; -}; - -goog.isString = function (a) { - return "string" == typeof a; -}; - -goog.isBoolean = function (a) { - return "boolean" == typeof a; -}; - -goog.isNumber = function (a) { - return "number" == typeof a; -}; - -goog.exportPath_ = function (a, b, c) { - a = a.split("."); - c = c || goog.global; - a[0] in c || "undefined" == typeof c.execScript || c.execScript("var " + a[0]); - - for (var d; a.length && (d = a.shift());) !a.length && goog.isDef(b) ? c[d] = b : c = c[d] && c[d] !== Object.prototype[d] ? c[d] : c[d] = {}; -}; - -goog.define = function (a, b) { - if (!COMPILED) { - var c = goog.global.CLOSURE_UNCOMPILED_DEFINES, - d = goog.global.CLOSURE_DEFINES; - c && void 0 === c.nodeType && Object.prototype.hasOwnProperty.call(c, a) ? b = c[a] : d && void 0 === d.nodeType && Object.prototype.hasOwnProperty.call(d, a) && (b = d[a]); - } - - return b; -}; - -goog.FEATURESET_YEAR = 2012; -goog.DEBUG = !0; -goog.LOCALE = "en"; -goog.TRUSTED_SITE = !0; -goog.STRICT_MODE_COMPATIBLE = !1; -goog.DISALLOW_TEST_ONLY_CODE = COMPILED && !goog.DEBUG; -goog.ENABLE_CHROME_APP_SAFE_SCRIPT_LOADING = !1; - -goog.provide = function (a) { - if (goog.isInModuleLoader_()) throw Error("goog.provide cannot be used within a module."); - if (!COMPILED && goog.isProvided_(a)) throw Error('Namespace "' + a + '" already declared.'); - goog.constructNamespace_(a); -}; - -goog.constructNamespace_ = function (a, b) { - if (!COMPILED) { - delete goog.implicitNamespaces_[a]; - - for (var c = a; (c = c.substring(0, c.lastIndexOf("."))) && !goog.getObjectByName(c);) goog.implicitNamespaces_[c] = !0; - } - - goog.exportPath_(a, b); -}; - -goog.getScriptNonce = function (a) { - if (a && a != goog.global) return goog.getScriptNonce_(a.document); - null === goog.cspNonce_ && (goog.cspNonce_ = goog.getScriptNonce_(goog.global.document)); - return goog.cspNonce_; -}; - -goog.NONCE_PATTERN_ = /^[\w+/_-]+[=]{0,2}$/; -goog.cspNonce_ = null; - -goog.getScriptNonce_ = function (a) { - return (a = a.querySelector && a.querySelector("script[nonce]")) && (a = a.nonce || a.getAttribute("nonce")) && goog.NONCE_PATTERN_.test(a) ? a : ""; -}; - -goog.VALID_MODULE_RE_ = /^[a-zA-Z_$][a-zA-Z0-9._$]*$/; - -goog.module = function (a) { - if (!goog.isString(a) || !a || -1 == a.search(goog.VALID_MODULE_RE_)) throw Error("Invalid module identifier"); - if (!goog.isInGoogModuleLoader_()) throw Error("Module " + a + " has been loaded incorrectly. Note, modules cannot be loaded as normal scripts. They require some kind of pre-processing step. You're likely trying to load a module via a script tag or as a part of a concatenated bundle without rewriting the module. For more info see: https://github.com/google/closure-library/wiki/goog.module:-an-ES6-module-like-alternative-to-goog.provide."); - if (goog.moduleLoaderState_.moduleName) throw Error("goog.module may only be called once per module."); - goog.moduleLoaderState_.moduleName = a; - - if (!COMPILED) { - if (goog.isProvided_(a)) throw Error('Namespace "' + a + '" already declared.'); - delete goog.implicitNamespaces_[a]; - } -}; - -goog.module.get = function (a) { - return goog.module.getInternal_(a); -}; - -goog.module.getInternal_ = function (a) { - if (!COMPILED) { - if (a in goog.loadedModules_) return goog.loadedModules_[a].exports; - if (!goog.implicitNamespaces_[a]) return a = goog.getObjectByName(a), null != a ? a : null; - } - - return null; -}; - -goog.ModuleType = { - ES6: "es6", - GOOG: "goog" -}; -goog.moduleLoaderState_ = null; - -goog.isInModuleLoader_ = function () { - return goog.isInGoogModuleLoader_() || goog.isInEs6ModuleLoader_(); -}; - -goog.isInGoogModuleLoader_ = function () { - return !!goog.moduleLoaderState_ && goog.moduleLoaderState_.type == goog.ModuleType.GOOG; -}; - -goog.isInEs6ModuleLoader_ = function () { - if (goog.moduleLoaderState_ && goog.moduleLoaderState_.type == goog.ModuleType.ES6) return !0; - var a = goog.global.$jscomp; - return a ? "function" != typeof a.getCurrentModulePath ? !1 : !!a.getCurrentModulePath() : !1; -}; - -goog.module.declareLegacyNamespace = function () { - if (!COMPILED && !goog.isInGoogModuleLoader_()) throw Error("goog.module.declareLegacyNamespace must be called from within a goog.module"); - if (!COMPILED && !goog.moduleLoaderState_.moduleName) throw Error("goog.module must be called prior to goog.module.declareLegacyNamespace."); - goog.moduleLoaderState_.declareLegacyNamespace = !0; -}; - -goog.declareModuleId = function (a) { - if (!COMPILED) { - if (!goog.isInEs6ModuleLoader_()) throw Error("goog.declareModuleId may only be called from within an ES6 module"); - if (goog.moduleLoaderState_ && goog.moduleLoaderState_.moduleName) throw Error("goog.declareModuleId may only be called once per module."); - if (a in goog.loadedModules_) throw Error('Module with namespace "' + a + '" already exists.'); - } - - if (goog.moduleLoaderState_) goog.moduleLoaderState_.moduleName = a;else { - var b = goog.global.$jscomp; - if (!b || "function" != typeof b.getCurrentModulePath) throw Error('Module with namespace "' + a + '" has been loaded incorrectly.'); - b = b.require(b.getCurrentModulePath()); - goog.loadedModules_[a] = { - exports: b, - type: goog.ModuleType.ES6, - moduleId: a - }; - } -}; - -goog.setTestOnly = function (a) { - if (goog.DISALLOW_TEST_ONLY_CODE) throw a = a || "", Error("Importing test-only code into non-debug environment" + (a ? ": " + a : ".")); -}; - -goog.forwardDeclare = function (a) {}; - -COMPILED || (goog.isProvided_ = function (a) { - return a in goog.loadedModules_ || !goog.implicitNamespaces_[a] && goog.isDefAndNotNull(goog.getObjectByName(a)); -}, goog.implicitNamespaces_ = { - "goog.module": !0 -}); - -goog.getObjectByName = function (a, b) { - a = a.split("."); - b = b || goog.global; - - for (var c = 0; c < a.length; c++) if (b = b[a[c]], !goog.isDefAndNotNull(b)) return null; - - return b; -}; - -goog.globalize = function (a, b) { - b = b || goog.global; - - for (var c in a) b[c] = a[c]; -}; - -goog.addDependency = function (a, b, c, d) { - !COMPILED && goog.DEPENDENCIES_ENABLED && goog.debugLoader_.addDependency(a, b, c, d); -}; - -goog.ENABLE_DEBUG_LOADER = !0; - -goog.logToConsole_ = function (a) { - goog.global.console && goog.global.console.error(a); -}; - -goog.require = function (a) { - if (!COMPILED) { - goog.ENABLE_DEBUG_LOADER && goog.debugLoader_.requested(a); - - if (goog.isProvided_(a)) { - if (goog.isInModuleLoader_()) return goog.module.getInternal_(a); - } else if (goog.ENABLE_DEBUG_LOADER) { - var b = goog.moduleLoaderState_; - goog.moduleLoaderState_ = null; - - try { - goog.debugLoader_.load_(a); - } finally { - goog.moduleLoaderState_ = b; - } - } - - return null; - } -}; - -goog.requireType = function (a) { - return {}; -}; - -goog.basePath = ""; - -goog.nullFunction = function () {}; - -goog.abstractMethod = function () { - throw Error("unimplemented abstract method"); -}; - -goog.addSingletonGetter = function (a) { - a.instance_ = void 0; - - a.getInstance = function () { - if (a.instance_) return a.instance_; - goog.DEBUG && (goog.instantiatedSingletons_[goog.instantiatedSingletons_.length] = a); - return a.instance_ = new a(); - }; -}; - -goog.instantiatedSingletons_ = []; -goog.LOAD_MODULE_USING_EVAL = !0; -goog.SEAL_MODULE_EXPORTS = goog.DEBUG; -goog.loadedModules_ = {}; -goog.DEPENDENCIES_ENABLED = !COMPILED && goog.ENABLE_DEBUG_LOADER; -goog.TRANSPILE = "detect"; -goog.ASSUME_ES_MODULES_TRANSPILED = !1; -goog.TRANSPILE_TO_LANGUAGE = ""; -goog.TRANSPILER = "transpile.js"; -goog.hasBadLetScoping = null; - -goog.useSafari10Workaround = function () { - if (null == goog.hasBadLetScoping) { - try { - var a = !eval('"use strict";let x = 1; function f() { return typeof x; };f() == "number";'); - } catch (b) { - a = !1; - } - - goog.hasBadLetScoping = a; - } - - return goog.hasBadLetScoping; -}; - -goog.workaroundSafari10EvalBug = function (a) { - return "(function(){" + a + "\n;})();\n"; -}; - -goog.loadModule = function (a) { - var b = goog.moduleLoaderState_; - - try { - goog.moduleLoaderState_ = { - moduleName: "", - declareLegacyNamespace: !1, - type: goog.ModuleType.GOOG - }; - if (goog.isFunction(a)) var c = a.call(void 0, {});else if (goog.isString(a)) goog.useSafari10Workaround() && (a = goog.workaroundSafari10EvalBug(a)), c = goog.loadModuleFromSource_.call(void 0, a);else throw Error("Invalid module definition"); - var d = goog.moduleLoaderState_.moduleName; - if (goog.isString(d) && d) goog.moduleLoaderState_.declareLegacyNamespace ? goog.constructNamespace_(d, c) : goog.SEAL_MODULE_EXPORTS && Object.seal && "object" == typeof c && null != c && Object.seal(c), goog.loadedModules_[d] = { - exports: c, - type: goog.ModuleType.GOOG, - moduleId: goog.moduleLoaderState_.moduleName - };else throw Error('Invalid module name "' + d + '"'); - } finally { - goog.moduleLoaderState_ = b; - } -}; - -goog.loadModuleFromSource_ = function (a) { - eval(a); - return {}; -}; - -goog.normalizePath_ = function (a) { - a = a.split("/"); - - for (var b = 0; b < a.length;) "." == a[b] ? a.splice(b, 1) : b && ".." == a[b] && a[b - 1] && ".." != a[b - 1] ? a.splice(--b, 2) : b++; - - return a.join("/"); -}; - -goog.loadFileSync_ = function (a) { - if (goog.global.CLOSURE_LOAD_FILE_SYNC) return goog.global.CLOSURE_LOAD_FILE_SYNC(a); - - try { - var b = new goog.global.XMLHttpRequest(); - b.open("get", a, !1); - b.send(); - return 0 == b.status || 200 == b.status ? b.responseText : null; - } catch (c) { - return null; - } -}; - -goog.transpile_ = function (a, b, c) { - var d = goog.global.$jscomp; - d || (goog.global.$jscomp = d = {}); - var e = d.transpile; - - if (!e) { - var f = goog.basePath + goog.TRANSPILER, - g = goog.loadFileSync_(f); - - if (g) { - (function () { - (0, eval)(g + "\n//# sourceURL=" + f); - }).call(goog.global); - if (goog.global.$gwtExport && goog.global.$gwtExport.$jscomp && !goog.global.$gwtExport.$jscomp.transpile) throw Error('The transpiler did not properly export the "transpile" method. $gwtExport: ' + JSON.stringify(goog.global.$gwtExport)); - goog.global.$jscomp.transpile = goog.global.$gwtExport.$jscomp.transpile; - d = goog.global.$jscomp; - e = d.transpile; - } - } - - e || (e = d.transpile = function (a, b) { - goog.logToConsole_(b + " requires transpilation but no transpiler was found."); - return a; - }); - return e(a, b, c); -}; - -goog.typeOf = function (a) { - var b = typeof a; - if ("object" == b) { - if (a) { - if (a instanceof Array) return "array"; - if (a instanceof Object) return b; - var c = Object.prototype.toString.call(a); - if ("[object Window]" == c) return "object"; - if ("[object Array]" == c || "number" == typeof a.length && "undefined" != typeof a.splice && "undefined" != typeof a.propertyIsEnumerable && !a.propertyIsEnumerable("splice")) return "array"; - if ("[object Function]" == c || "undefined" != typeof a.call && "undefined" != typeof a.propertyIsEnumerable && !a.propertyIsEnumerable("call")) return "function"; - } else return "null"; - } else if ("function" == b && "undefined" == typeof a.call) return "object"; - return b; -}; - -goog.isNull = function (a) { - return null === a; -}; - -goog.isDefAndNotNull = function (a) { - return null != a; -}; - -goog.isArray = function (a) { - return "array" == goog.typeOf(a); -}; - -goog.isArrayLike = function (a) { - var b = goog.typeOf(a); - return "array" == b || "object" == b && "number" == typeof a.length; -}; - -goog.isDateLike = function (a) { - return goog.isObject(a) && "function" == typeof a.getFullYear; -}; - -goog.isFunction = function (a) { - return "function" == goog.typeOf(a); -}; - -goog.isObject = function (a) { - var b = typeof a; - return "object" == b && null != a || "function" == b; -}; - -goog.getUid = function (a) { - return a[goog.UID_PROPERTY_] || (a[goog.UID_PROPERTY_] = ++goog.uidCounter_); -}; - -goog.hasUid = function (a) { - return !!a[goog.UID_PROPERTY_]; -}; - -goog.removeUid = function (a) { - null !== a && "removeAttribute" in a && a.removeAttribute(goog.UID_PROPERTY_); - - try { - delete a[goog.UID_PROPERTY_]; - } catch (b) {} -}; - -goog.UID_PROPERTY_ = "closure_uid_" + (1E9 * Math.random() >>> 0); -goog.uidCounter_ = 0; -goog.getHashCode = goog.getUid; -goog.removeHashCode = goog.removeUid; - -goog.cloneObject = function (a) { - var b = goog.typeOf(a); - - if ("object" == b || "array" == b) { - if ("function" === typeof a.clone) return a.clone(); - b = "array" == b ? [] : {}; - - for (var c in a) b[c] = goog.cloneObject(a[c]); - - return b; - } - - return a; -}; - -goog.bindNative_ = function (a, b, c) { - return a.call.apply(a.bind, arguments); -}; - -goog.bindJs_ = function (a, b, c) { - if (!a) throw Error(); - - if (2 < arguments.length) { - var d = Array.prototype.slice.call(arguments, 2); - return function () { - var c = Array.prototype.slice.call(arguments); - Array.prototype.unshift.apply(c, d); - return a.apply(b, c); - }; - } - - return function () { - return a.apply(b, arguments); - }; -}; - -goog.bind = function (a, b, c) { - Function.prototype.bind && -1 != Function.prototype.bind.toString().indexOf("native code") ? goog.bind = goog.bindNative_ : goog.bind = goog.bindJs_; - return goog.bind.apply(null, arguments); -}; - -goog.partial = function (a, b) { - var c = Array.prototype.slice.call(arguments, 1); - return function () { - var b = c.slice(); - b.push.apply(b, arguments); - return a.apply(this, b); - }; -}; - -goog.mixin = function (a, b) { - for (var c in b) a[c] = b[c]; -}; - -goog.now = goog.TRUSTED_SITE && Date.now || function () { - return +new Date(); -}; - -goog.globalEval = function (a) { - if (goog.global.execScript) goog.global.execScript(a, "JavaScript");else if (goog.global.eval) { - if (null == goog.evalWorksForGlobals_) { - try { - goog.global.eval("var _evalTest_ = 1;"); - } catch (d) {} - - if ("undefined" != typeof goog.global._evalTest_) { - try { - delete goog.global._evalTest_; - } catch (d) {} - - goog.evalWorksForGlobals_ = !0; - } else goog.evalWorksForGlobals_ = !1; - } - - if (goog.evalWorksForGlobals_) goog.global.eval(a);else { - var b = goog.global.document, - c = b.createElement("SCRIPT"); - c.type = "text/javascript"; - c.defer = !1; - c.appendChild(b.createTextNode(a)); - b.head.appendChild(c); - b.head.removeChild(c); - } - } else throw Error("goog.globalEval not available"); -}; - -goog.evalWorksForGlobals_ = null; - -goog.getCssName = function (a, b) { - if ("." == String(a).charAt(0)) throw Error('className passed in goog.getCssName must not start with ".". You passed: ' + a); - - var c = function (a) { - return goog.cssNameMapping_[a] || a; - }, - d = function (a) { - a = a.split("-"); - - for (var b = [], d = 0; d < a.length; d++) b.push(c(a[d])); - - return b.join("-"); - }; - - d = goog.cssNameMapping_ ? "BY_WHOLE" == goog.cssNameMappingStyle_ ? c : d : function (a) { - return a; - }; - a = b ? a + "-" + d(b) : d(a); - return goog.global.CLOSURE_CSS_NAME_MAP_FN ? goog.global.CLOSURE_CSS_NAME_MAP_FN(a) : a; -}; - -goog.setCssNameMapping = function (a, b) { - goog.cssNameMapping_ = a; - goog.cssNameMappingStyle_ = b; -}; - -!COMPILED && goog.global.CLOSURE_CSS_NAME_MAPPING && (goog.cssNameMapping_ = goog.global.CLOSURE_CSS_NAME_MAPPING); - -goog.getMsg = function (a, b, c) { - c && c.html && (a = a.replace(/</g, "<")); - b && (a = a.replace(/\{\$([^}]+)}/g, function (a, c) { - return null != b && c in b ? b[c] : a; - })); - return a; -}; - -goog.getMsgWithFallback = function (a, b) { - return a; -}; - -goog.exportSymbol = function (a, b, c) { - goog.exportPath_(a, b, c); -}; - -goog.exportProperty = function (a, b, c) { - a[b] = c; -}; - -goog.inherits = function (a, b) { - function c() {} - - c.prototype = b.prototype; - a.superClass_ = b.prototype; - a.prototype = new c(); - a.prototype.constructor = a; - - a.base = function (a, c, f) { - for (var d = Array(arguments.length - 2), e = 2; e < arguments.length; e++) d[e - 2] = arguments[e]; - - return b.prototype[c].apply(a, d); - }; -}; - -goog.base = function (a, b, c) { - var d = arguments.callee.caller; - if (goog.STRICT_MODE_COMPATIBLE || goog.DEBUG && !d) throw Error("arguments.caller not defined. goog.base() cannot be used with strict mode code. See http://www.ecma-international.org/ecma-262/5.1/#sec-C"); - - if ("undefined" !== typeof d.superClass_) { - for (var e = Array(arguments.length - 1), f = 1; f < arguments.length; f++) e[f - 1] = arguments[f]; - - return d.superClass_.constructor.apply(a, e); - } - - if ("string" != typeof b && "symbol" != typeof b) throw Error("method names provided to goog.base must be a string or a symbol"); - e = Array(arguments.length - 2); - - for (f = 2; f < arguments.length; f++) e[f - 2] = arguments[f]; - - f = !1; - - for (var g = a.constructor.prototype; g; g = Object.getPrototypeOf(g)) if (g[b] === d) f = !0;else if (f) return g[b].apply(a, e); - - if (a[b] === d) return a.constructor.prototype[b].apply(a, e); - throw Error("goog.base called from a method of one name to a method of a different name"); -}; - -goog.scope = function (a) { - if (goog.isInModuleLoader_()) throw Error("goog.scope is not supported within a module."); - a.call(goog.global); -}; - -COMPILED || (goog.global.COMPILED = COMPILED); - -goog.defineClass = function (a, b) { - var c = b.constructor, - d = b.statics; - c && c != Object.prototype.constructor || (c = function () { - throw Error("cannot instantiate an interface (no constructor defined)."); - }); - c = goog.defineClass.createSealingConstructor_(c, a); - a && goog.inherits(c, a); - delete b.constructor; - delete b.statics; - goog.defineClass.applyProperties_(c.prototype, b); - null != d && (d instanceof Function ? d(c) : goog.defineClass.applyProperties_(c, d)); - return c; -}; - -goog.defineClass.SEAL_CLASS_INSTANCES = goog.DEBUG; - -goog.defineClass.createSealingConstructor_ = function (a, b) { - if (!goog.defineClass.SEAL_CLASS_INSTANCES) return a; - - var c = !goog.defineClass.isUnsealable_(b), - d = function () { - var b = a.apply(this, arguments) || this; - b[goog.UID_PROPERTY_] = b[goog.UID_PROPERTY_]; - this.constructor === d && c && Object.seal instanceof Function && Object.seal(b); - return b; - }; - - return d; -}; - -goog.defineClass.isUnsealable_ = function (a) { - return a && a.prototype && a.prototype[goog.UNSEALABLE_CONSTRUCTOR_PROPERTY_]; -}; - -goog.defineClass.OBJECT_PROTOTYPE_FIELDS_ = "constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "); - -goog.defineClass.applyProperties_ = function (a, b) { - for (var c in b) Object.prototype.hasOwnProperty.call(b, c) && (a[c] = b[c]); - - for (var d = 0; d < goog.defineClass.OBJECT_PROTOTYPE_FIELDS_.length; d++) c = goog.defineClass.OBJECT_PROTOTYPE_FIELDS_[d], Object.prototype.hasOwnProperty.call(b, c) && (a[c] = b[c]); -}; - -goog.tagUnsealableClass = function (a) { - !COMPILED && goog.defineClass.SEAL_CLASS_INSTANCES && (a.prototype[goog.UNSEALABLE_CONSTRUCTOR_PROPERTY_] = !0); -}; - -goog.UNSEALABLE_CONSTRUCTOR_PROPERTY_ = "goog_defineClass_legacy_unsealable"; -!COMPILED && goog.DEPENDENCIES_ENABLED && (goog.inHtmlDocument_ = function () { - var a = goog.global.document; - return null != a && "write" in a; -}, goog.isDocumentLoading_ = function () { - var a = goog.global.document; - return a.attachEvent ? "complete" != a.readyState : "loading" == a.readyState; -}, goog.findBasePath_ = function () { - if (goog.isDef(goog.global.CLOSURE_BASE_PATH) && goog.isString(goog.global.CLOSURE_BASE_PATH)) goog.basePath = goog.global.CLOSURE_BASE_PATH;else if (goog.inHtmlDocument_()) { - var a = goog.global.document, - b = a.currentScript; - a = b ? [b] : a.getElementsByTagName("SCRIPT"); - - for (b = a.length - 1; 0 <= b; --b) { - var c = a[b].src, - d = c.lastIndexOf("?"); - d = -1 == d ? c.length : d; - - if ("base.js" == c.substr(d - 7, 7)) { - goog.basePath = c.substr(0, d - 7); - break; - } - } - } -}, goog.findBasePath_(), goog.Transpiler = function () { - this.requiresTranspilation_ = null; - this.transpilationTarget_ = goog.TRANSPILE_TO_LANGUAGE; -}, goog.Transpiler.prototype.createRequiresTranspilation_ = function () { - function a(a, b) { - e ? d[a] = !0 : b() ? (c = a, d[a] = !1) : e = d[a] = !0; - } - - function b(a) { - try { - return !!eval(a); - } catch (h) { - return !1; - } - } - - var c = "es3", - d = { - es3: !1 - }, - e = !1, - f = goog.global.navigator && goog.global.navigator.userAgent ? goog.global.navigator.userAgent : ""; - a("es5", function () { - return b("[1,].length==1"); - }); - a("es6", function () { - return f.match(/Edge\/(\d+)(\.\d)*/i) ? !1 : b('(()=>{"use strict";class X{constructor(){if(new.target!=String)throw 1;this.x=42}}let q=Reflect.construct(X,[],String);if(q.x!=42||!(q instanceof String))throw 1;for(const a of[2,3]){if(a==2)continue;function f(z={a}){let a=0;return z.a}{function f(){return 0;}}return f()==3}})()'); - }); - a("es7", function () { - return b("2 ** 2 == 4"); - }); - a("es8", function () { - return b("async () => 1, true"); - }); - a("es9", function () { - return b("({...rest} = {}), true"); - }); - a("es_next", function () { - return !1; - }); - return { - target: c, - map: d - }; -}, goog.Transpiler.prototype.needsTranspile = function (a, b) { - if ("always" == goog.TRANSPILE) return !0; - if ("never" == goog.TRANSPILE) return !1; - - if (!this.requiresTranspilation_) { - var c = this.createRequiresTranspilation_(); - this.requiresTranspilation_ = c.map; - this.transpilationTarget_ = this.transpilationTarget_ || c.target; - } - - if (a in this.requiresTranspilation_) return this.requiresTranspilation_[a] ? !0 : !goog.inHtmlDocument_() || "es6" != b || "noModule" in goog.global.document.createElement("script") ? !1 : !0; - throw Error("Unknown language mode: " + a); -}, goog.Transpiler.prototype.transpile = function (a, b) { - return goog.transpile_(a, b, this.transpilationTarget_); -}, goog.transpiler_ = new goog.Transpiler(), goog.protectScriptTag_ = function (a) { - return a.replace(/<\/(SCRIPT)/ig, "\\x3c/$1"); -}, goog.DebugLoader_ = function () { - this.dependencies_ = {}; - this.idToPath_ = {}; - this.written_ = {}; - this.loadingDeps_ = []; - this.depsToLoad_ = []; - this.paused_ = !1; - this.factory_ = new goog.DependencyFactory(goog.transpiler_); - this.deferredCallbacks_ = {}; - this.deferredQueue_ = []; -}, goog.DebugLoader_.prototype.bootstrap = function (a, b) { - function c() { - d && (goog.global.setTimeout(d, 0), d = null); - } - - var d = b; - - if (a.length) { - b = []; - - for (var e = 0; e < a.length; e++) { - var f = this.getPathFromDeps_(a[e]); - if (!f) throw Error("Unregonized namespace: " + a[e]); - b.push(this.dependencies_[f]); - } - - f = goog.require; - var g = 0; - - for (e = 0; e < a.length; e++) f(a[e]), b[e].onLoad(function () { - ++g == a.length && c(); - }); - } else c(); -}, goog.DebugLoader_.prototype.loadClosureDeps = function () { - this.depsToLoad_.push(this.factory_.createDependency(goog.normalizePath_(goog.basePath + "deps.js"), "deps.js", [], [], {}, !1)); - this.loadDeps_(); -}, goog.DebugLoader_.prototype.requested = function (a, b) { - (a = this.getPathFromDeps_(a)) && (b || this.areDepsLoaded_(this.dependencies_[a].requires)) && (b = this.deferredCallbacks_[a]) && (delete this.deferredCallbacks_[a], b()); -}, goog.DebugLoader_.prototype.setDependencyFactory = function (a) { - this.factory_ = a; -}, goog.DebugLoader_.prototype.load_ = function (a) { - if (this.getPathFromDeps_(a)) { - var b = this, - c = [], - d = function (a) { - var e = b.getPathFromDeps_(a); - if (!e) throw Error("Bad dependency path or symbol: " + a); - - if (!b.written_[e]) { - b.written_[e] = !0; - a = b.dependencies_[e]; - - for (e = 0; e < a.requires.length; e++) goog.isProvided_(a.requires[e]) || d(a.requires[e]); - - c.push(a); - } - }; - - d(a); - a = !!this.depsToLoad_.length; - this.depsToLoad_ = this.depsToLoad_.concat(c); - this.paused_ || a || this.loadDeps_(); - } else throw a = "goog.require could not find: " + a, goog.logToConsole_(a), Error(a); -}, goog.DebugLoader_.prototype.loadDeps_ = function () { - for (var a = this, b = this.paused_; this.depsToLoad_.length && !b;) (function () { - var c = !1, - d = a.depsToLoad_.shift(), - e = !1; - a.loading_(d); - var f = { - pause: function () { - if (c) throw Error("Cannot call pause after the call to load."); - b = !0; - }, - resume: function () { - c ? a.resume_() : b = !1; - }, - loaded: function () { - if (e) throw Error("Double call to loaded."); - e = !0; - a.loaded_(d); - }, - pending: function () { - for (var b = [], c = 0; c < a.loadingDeps_.length; c++) b.push(a.loadingDeps_[c]); - - return b; - }, - setModuleState: function (a) { - goog.moduleLoaderState_ = { - type: a, - moduleName: "", - declareLegacyNamespace: !1 - }; - }, - registerEs6ModuleExports: function (a, b, c) { - c && (goog.loadedModules_[c] = { - exports: b, - type: goog.ModuleType.ES6, - moduleId: c || "" - }); - }, - registerGoogModuleExports: function (a, b) { - goog.loadedModules_[a] = { - exports: b, - type: goog.ModuleType.GOOG, - moduleId: a - }; - }, - clearModuleState: function () { - goog.moduleLoaderState_ = null; - }, - defer: function (b) { - if (c) throw Error("Cannot register with defer after the call to load."); - a.defer_(d, b); - }, - areDepsLoaded: function () { - return a.areDepsLoaded_(d.requires); - } - }; - - try { - d.load(f); - } finally { - c = !0; - } - })(); - - b && this.pause_(); -}, goog.DebugLoader_.prototype.pause_ = function () { - this.paused_ = !0; -}, goog.DebugLoader_.prototype.resume_ = function () { - this.paused_ && (this.paused_ = !1, this.loadDeps_()); -}, goog.DebugLoader_.prototype.loading_ = function (a) { - this.loadingDeps_.push(a); -}, goog.DebugLoader_.prototype.loaded_ = function (a) { - for (var b = 0; b < this.loadingDeps_.length; b++) if (this.loadingDeps_[b] == a) { - this.loadingDeps_.splice(b, 1); - break; - } - - for (b = 0; b < this.deferredQueue_.length; b++) if (this.deferredQueue_[b] == a.path) { - this.deferredQueue_.splice(b, 1); - break; - } - - if (this.loadingDeps_.length == this.deferredQueue_.length && !this.depsToLoad_.length) for (; this.deferredQueue_.length;) this.requested(this.deferredQueue_.shift(), !0); - a.loaded(); -}, goog.DebugLoader_.prototype.areDepsLoaded_ = function (a) { - for (var b = 0; b < a.length; b++) { - var c = this.getPathFromDeps_(a[b]); - if (!c || !(c in this.deferredCallbacks_ || goog.isProvided_(a[b]))) return !1; - } - - return !0; -}, goog.DebugLoader_.prototype.getPathFromDeps_ = function (a) { - return a in this.idToPath_ ? this.idToPath_[a] : a in this.dependencies_ ? a : null; -}, goog.DebugLoader_.prototype.defer_ = function (a, b) { - this.deferredCallbacks_[a.path] = b; - this.deferredQueue_.push(a.path); -}, goog.LoadController = function () {}, goog.LoadController.prototype.pause = function () {}, goog.LoadController.prototype.resume = function () {}, goog.LoadController.prototype.loaded = function () {}, goog.LoadController.prototype.pending = function () {}, goog.LoadController.prototype.registerEs6ModuleExports = function (a, b, c) {}, goog.LoadController.prototype.setModuleState = function (a) {}, goog.LoadController.prototype.clearModuleState = function () {}, goog.LoadController.prototype.defer = function (a) {}, goog.LoadController.prototype.areDepsLoaded = function () {}, goog.Dependency = function (a, b, c, d, e) { - this.path = a; - this.relativePath = b; - this.provides = c; - this.requires = d; - this.loadFlags = e; - this.loaded_ = !1; - this.loadCallbacks_ = []; -}, goog.Dependency.prototype.getPathName = function () { - var a = this.path, - b = a.indexOf("://"); - 0 <= b && (a = a.substring(b + 3), b = a.indexOf("/"), 0 <= b && (a = a.substring(b + 1))); - return a; -}, goog.Dependency.prototype.onLoad = function (a) { - this.loaded_ ? a() : this.loadCallbacks_.push(a); -}, goog.Dependency.prototype.loaded = function () { - this.loaded_ = !0; - var a = this.loadCallbacks_; - this.loadCallbacks_ = []; - - for (var b = 0; b < a.length; b++) a[b](); -}, goog.Dependency.defer_ = !1, goog.Dependency.callbackMap_ = {}, goog.Dependency.registerCallback_ = function (a) { - var b = Math.random().toString(32); - goog.Dependency.callbackMap_[b] = a; - return b; -}, goog.Dependency.unregisterCallback_ = function (a) { - delete goog.Dependency.callbackMap_[a]; -}, goog.Dependency.callback_ = function (a, b) { - if (a in goog.Dependency.callbackMap_) { - for (var c = goog.Dependency.callbackMap_[a], d = [], e = 1; e < arguments.length; e++) d.push(arguments[e]); - - c.apply(void 0, d); - } else throw Error("Callback key " + a + " does not exist (was base.js loaded more than once?)."); -}, goog.Dependency.prototype.load = function (a) { - if (goog.global.CLOSURE_IMPORT_SCRIPT) goog.global.CLOSURE_IMPORT_SCRIPT(this.path) ? a.loaded() : a.pause();else if (goog.inHtmlDocument_()) { - var b = goog.global.document; - - if ("complete" == b.readyState && !goog.ENABLE_CHROME_APP_SAFE_SCRIPT_LOADING) { - if (/\bdeps.js$/.test(this.path)) { - a.loaded(); - return; - } - - throw Error('Cannot write "' + this.path + '" after document load'); - } - - if (!goog.ENABLE_CHROME_APP_SAFE_SCRIPT_LOADING && goog.isDocumentLoading_()) { - var c = goog.Dependency.registerCallback_(function (b) { - goog.DebugLoader_.IS_OLD_IE_ && "complete" != b.readyState || (goog.Dependency.unregisterCallback_(c), a.loaded()); - }), - d = !goog.DebugLoader_.IS_OLD_IE_ && goog.getScriptNonce() ? ' nonce="' + goog.getScriptNonce() + '"' : ""; - d = '<script src="' + this.path + '" ' + (goog.DebugLoader_.IS_OLD_IE_ ? "onreadystatechange" : "onload") + "=\"goog.Dependency.callback_('" + c + '\', this)" type="text/javascript" ' + (goog.Dependency.defer_ ? "defer" : "") + d + ">\x3c/script>"; - b.write(goog.TRUSTED_TYPES_POLICY_ ? goog.TRUSTED_TYPES_POLICY_.createHTML(d) : d); - } else { - var e = b.createElement("script"); - e.defer = goog.Dependency.defer_; - e.async = !1; - e.type = "text/javascript"; - (d = goog.getScriptNonce()) && e.setAttribute("nonce", d); - goog.DebugLoader_.IS_OLD_IE_ ? (a.pause(), e.onreadystatechange = function () { - if ("loaded" == e.readyState || "complete" == e.readyState) a.loaded(), a.resume(); - }) : e.onload = function () { - e.onload = null; - a.loaded(); - }; - e.src = goog.TRUSTED_TYPES_POLICY_ ? goog.TRUSTED_TYPES_POLICY_.createScriptURL(this.path) : this.path; - b.head.appendChild(e); - } - } else goog.logToConsole_("Cannot use default debug loader outside of HTML documents."), "deps.js" == this.relativePath ? (goog.logToConsole_("Consider setting CLOSURE_IMPORT_SCRIPT before loading base.js, or setting CLOSURE_NO_DEPS to true."), a.loaded()) : a.pause(); -}, goog.Es6ModuleDependency = function (a, b, c, d, e) { - goog.Dependency.call(this, a, b, c, d, e); -}, goog.inherits(goog.Es6ModuleDependency, goog.Dependency), goog.Es6ModuleDependency.prototype.load = function (a) { - function b(a, b) { - a = b ? '<script type="module" crossorigin>' + b + "\x3c/script>" : '<script type="module" crossorigin src="' + a + '">\x3c/script>'; - d.write(goog.TRUSTED_TYPES_POLICY_ ? goog.TRUSTED_TYPES_POLICY_.createHTML(a) : a); - } - - function c(a, b) { - var c = d.createElement("script"); - c.defer = !0; - c.async = !1; - c.type = "module"; - c.setAttribute("crossorigin", !0); - var e = goog.getScriptNonce(); - e && c.setAttribute("nonce", e); - b ? c.textContent = goog.TRUSTED_TYPES_POLICY_ ? goog.TRUSTED_TYPES_POLICY_.createScript(b) : b : c.src = goog.TRUSTED_TYPES_POLICY_ ? goog.TRUSTED_TYPES_POLICY_.createScriptURL(a) : a; - d.head.appendChild(c); - } - - if (goog.global.CLOSURE_IMPORT_SCRIPT) goog.global.CLOSURE_IMPORT_SCRIPT(this.path) ? a.loaded() : a.pause();else if (goog.inHtmlDocument_()) { - var d = goog.global.document, - e = this; - - if (goog.isDocumentLoading_()) { - var f = b; - goog.Dependency.defer_ = !0; - } else f = c; - - var g = goog.Dependency.registerCallback_(function () { - goog.Dependency.unregisterCallback_(g); - a.setModuleState(goog.ModuleType.ES6); - }); - f(void 0, 'goog.Dependency.callback_("' + g + '")'); - f(this.path, void 0); - var h = goog.Dependency.registerCallback_(function (b) { - goog.Dependency.unregisterCallback_(h); - a.registerEs6ModuleExports(e.path, b, goog.moduleLoaderState_.moduleName); - }); - f(void 0, 'import * as m from "' + this.path + '"; goog.Dependency.callback_("' + h + '", m)'); - var k = goog.Dependency.registerCallback_(function () { - goog.Dependency.unregisterCallback_(k); - a.clearModuleState(); - a.loaded(); - }); - f(void 0, 'goog.Dependency.callback_("' + k + '")'); - } else goog.logToConsole_("Cannot use default debug loader outside of HTML documents."), a.pause(); -}, goog.TransformedDependency = function (a, b, c, d, e) { - goog.Dependency.call(this, a, b, c, d, e); - this.contents_ = null; - this.lazyFetch_ = !goog.inHtmlDocument_() || !("noModule" in goog.global.document.createElement("script")); -}, goog.inherits(goog.TransformedDependency, goog.Dependency), goog.TransformedDependency.prototype.load = function (a) { - function b() { - e.contents_ = goog.loadFileSync_(e.path); - e.contents_ && (e.contents_ = e.transform(e.contents_), e.contents_ && (e.contents_ += "\n//# sourceURL=" + e.path)); - } - - function c() { - e.lazyFetch_ && b(); - - if (e.contents_) { - f && a.setModuleState(goog.ModuleType.ES6); - - try { - var c = e.contents_; - e.contents_ = null; - goog.globalEval(c); - if (f) var d = goog.moduleLoaderState_.moduleName; - } finally { - f && a.clearModuleState(); - } - - f && goog.global.$jscomp.require.ensure([e.getPathName()], function () { - a.registerEs6ModuleExports(e.path, goog.global.$jscomp.require(e.getPathName()), d); - }); - a.loaded(); - } - } - - function d() { - var a = goog.global.document, - b = goog.Dependency.registerCallback_(function () { - goog.Dependency.unregisterCallback_(b); - c(); - }), - d = '<script type="text/javascript">' + goog.protectScriptTag_('goog.Dependency.callback_("' + b + '");') + "\x3c/script>"; - a.write(goog.TRUSTED_TYPES_POLICY_ ? goog.TRUSTED_TYPES_POLICY_.createHTML(d) : d); - } - - var e = this; - if (goog.global.CLOSURE_IMPORT_SCRIPT) b(), this.contents_ && goog.global.CLOSURE_IMPORT_SCRIPT("", this.contents_) ? (this.contents_ = null, a.loaded()) : a.pause();else { - var f = this.loadFlags.module == goog.ModuleType.ES6; - this.lazyFetch_ || b(); - var g = 1 < a.pending().length, - h = g && goog.DebugLoader_.IS_OLD_IE_; - g = goog.Dependency.defer_ && (g || goog.isDocumentLoading_()); - if (h || g) a.defer(function () { - c(); - });else { - var k = goog.global.document; - h = goog.inHtmlDocument_() && "ActiveXObject" in goog.global; - - if (f && goog.inHtmlDocument_() && goog.isDocumentLoading_() && !h) { - goog.Dependency.defer_ = !0; - a.pause(); - var l = k.onreadystatechange; - - k.onreadystatechange = function () { - "interactive" == k.readyState && (k.onreadystatechange = l, c(), a.resume()); - goog.isFunction(l) && l.apply(void 0, arguments); - }; - } else !goog.DebugLoader_.IS_OLD_IE_ && goog.inHtmlDocument_() && goog.isDocumentLoading_() ? d() : c(); - } - } -}, goog.TransformedDependency.prototype.transform = function (a) {}, goog.TranspiledDependency = function (a, b, c, d, e, f) { - goog.TransformedDependency.call(this, a, b, c, d, e); - this.transpiler = f; -}, goog.inherits(goog.TranspiledDependency, goog.TransformedDependency), goog.TranspiledDependency.prototype.transform = function (a) { - return this.transpiler.transpile(a, this.getPathName()); -}, goog.PreTranspiledEs6ModuleDependency = function (a, b, c, d, e) { - goog.TransformedDependency.call(this, a, b, c, d, e); -}, goog.inherits(goog.PreTranspiledEs6ModuleDependency, goog.TransformedDependency), goog.PreTranspiledEs6ModuleDependency.prototype.transform = function (a) { - return a; -}, goog.GoogModuleDependency = function (a, b, c, d, e, f, g) { - goog.TransformedDependency.call(this, a, b, c, d, e); - this.needsTranspile_ = f; - this.transpiler_ = g; -}, goog.inherits(goog.GoogModuleDependency, goog.TransformedDependency), goog.GoogModuleDependency.prototype.transform = function (a) { - this.needsTranspile_ && (a = this.transpiler_.transpile(a, this.getPathName())); - return goog.LOAD_MODULE_USING_EVAL && goog.isDef(goog.global.JSON) ? "goog.loadModule(" + goog.global.JSON.stringify(a + "\n//# sourceURL=" + this.path + "\n") + ");" : 'goog.loadModule(function(exports) {"use strict";' + a + "\n;return exports});\n//# sourceURL=" + this.path + "\n"; -}, goog.DebugLoader_.IS_OLD_IE_ = !(goog.global.atob || !goog.global.document || !goog.global.document.all), goog.DebugLoader_.prototype.addDependency = function (a, b, c, d) { - b = b || []; - a = a.replace(/\\/g, "/"); - var e = goog.normalizePath_(goog.basePath + a); - d && "boolean" !== typeof d || (d = d ? { - module: goog.ModuleType.GOOG - } : {}); - c = this.factory_.createDependency(e, a, b, c, d, goog.transpiler_.needsTranspile(d.lang || "es3", d.module)); - this.dependencies_[e] = c; - - for (c = 0; c < b.length; c++) this.idToPath_[b[c]] = e; - - this.idToPath_[a] = e; -}, goog.DependencyFactory = function (a) { - this.transpiler = a; -}, goog.DependencyFactory.prototype.createDependency = function (a, b, c, d, e, f) { - return e.module == goog.ModuleType.GOOG ? new goog.GoogModuleDependency(a, b, c, d, e, f, this.transpiler) : f ? new goog.TranspiledDependency(a, b, c, d, e, this.transpiler) : e.module == goog.ModuleType.ES6 ? "never" == goog.TRANSPILE && goog.ASSUME_ES_MODULES_TRANSPILED ? new goog.PreTranspiledEs6ModuleDependency(a, b, c, d, e) : new goog.Es6ModuleDependency(a, b, c, d, e) : new goog.Dependency(a, b, c, d, e); -}, goog.debugLoader_ = new goog.DebugLoader_(), goog.loadClosureDeps = function () { - goog.debugLoader_.loadClosureDeps(); -}, goog.setDependencyFactory = function (a) { - goog.debugLoader_.setDependencyFactory(a); -}, goog.global.CLOSURE_NO_DEPS || goog.debugLoader_.loadClosureDeps(), goog.bootstrap = function (a, b) { - goog.debugLoader_.bootstrap(a, b); -}); -goog.TRUSTED_TYPES_POLICY_NAME = ""; - -goog.identity_ = function (a) { - return a; -}; - -goog.createTrustedTypesPolicy = function (a) { - var b = null; - if ("undefined" === typeof TrustedTypes || !TrustedTypes.createPolicy) return b; - - try { - b = TrustedTypes.createPolicy(a, { - createHTML: goog.identity_, - createScript: goog.identity_, - createScriptURL: goog.identity_, - createURL: goog.identity_ - }); - } catch (c) { - goog.logToConsole_(c.message); - } - - return b; -}; - -goog.TRUSTED_TYPES_POLICY_ = goog.TRUSTED_TYPES_POLICY_NAME ? goog.createTrustedTypesPolicy(goog.TRUSTED_TYPES_POLICY_NAME + "#base") : null; -goog.object = {}; - -goog.object.is = function (a, b) { - return a === b ? 0 !== a || 1 / a === 1 / b : a !== a && b !== b; -}; - -goog.object.forEach = function (a, b, c) { - for (var d in a) b.call(c, a[d], d, a); -}; - -goog.object.filter = function (a, b, c) { - var d = {}, - e; - - for (e in a) b.call(c, a[e], e, a) && (d[e] = a[e]); - - return d; -}; - -goog.object.map = function (a, b, c) { - var d = {}, - e; - - for (e in a) d[e] = b.call(c, a[e], e, a); - - return d; -}; - -goog.object.some = function (a, b, c) { - for (var d in a) if (b.call(c, a[d], d, a)) return !0; - - return !1; -}; - -goog.object.every = function (a, b, c) { - for (var d in a) if (!b.call(c, a[d], d, a)) return !1; - - return !0; -}; - -goog.object.getCount = function (a) { - var b = 0, - c; - - for (c in a) b++; - - return b; -}; - -goog.object.getAnyKey = function (a) { - for (var b in a) return b; -}; - -goog.object.getAnyValue = function (a) { - for (var b in a) return a[b]; -}; - -goog.object.contains = function (a, b) { - return goog.object.containsValue(a, b); -}; - -goog.object.getValues = function (a) { - var b = [], - c = 0, - d; - - for (d in a) b[c++] = a[d]; - - return b; -}; - -goog.object.getKeys = function (a) { - var b = [], - c = 0, - d; - - for (d in a) b[c++] = d; - - return b; -}; - -goog.object.getValueByKeys = function (a, b) { - var c = goog.isArrayLike(b), - d = c ? b : arguments; - - for (c = c ? 0 : 1; c < d.length; c++) { - if (null == a) return; - a = a[d[c]]; - } - - return a; -}; - -goog.object.containsKey = function (a, b) { - return null !== a && b in a; -}; - -goog.object.containsValue = function (a, b) { - for (var c in a) if (a[c] == b) return !0; - - return !1; -}; - -goog.object.findKey = function (a, b, c) { - for (var d in a) if (b.call(c, a[d], d, a)) return d; -}; - -goog.object.findValue = function (a, b, c) { - return (b = goog.object.findKey(a, b, c)) && a[b]; -}; - -goog.object.isEmpty = function (a) { - for (var b in a) return !1; - - return !0; -}; - -goog.object.clear = function (a) { - for (var b in a) delete a[b]; -}; - -goog.object.remove = function (a, b) { - var c; - (c = b in a) && delete a[b]; - return c; -}; - -goog.object.add = function (a, b, c) { - if (null !== a && b in a) throw Error('The object already contains the key "' + b + '"'); - goog.object.set(a, b, c); -}; - -goog.object.get = function (a, b, c) { - return null !== a && b in a ? a[b] : c; -}; - -goog.object.set = function (a, b, c) { - a[b] = c; -}; - -goog.object.setIfUndefined = function (a, b, c) { - return b in a ? a[b] : a[b] = c; -}; - -goog.object.setWithReturnValueIfNotSet = function (a, b, c) { - if (b in a) return a[b]; - c = c(); - return a[b] = c; -}; - -goog.object.equals = function (a, b) { - for (var c in a) if (!(c in b) || a[c] !== b[c]) return !1; - - for (var d in b) if (!(d in a)) return !1; - - return !0; -}; - -goog.object.clone = function (a) { - var b = {}, - c; - - for (c in a) b[c] = a[c]; - - return b; -}; - -goog.object.unsafeClone = function (a) { - var b = goog.typeOf(a); - - if ("object" == b || "array" == b) { - if (goog.isFunction(a.clone)) return a.clone(); - b = "array" == b ? [] : {}; - - for (var c in a) b[c] = goog.object.unsafeClone(a[c]); - - return b; - } - - return a; -}; - -goog.object.transpose = function (a) { - var b = {}, - c; - - for (c in a) b[a[c]] = c; - - return b; -}; - -goog.object.PROTOTYPE_FIELDS_ = "constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "); - -goog.object.extend = function (a, b) { - for (var c, d, e = 1; e < arguments.length; e++) { - d = arguments[e]; - - for (c in d) a[c] = d[c]; - - for (var f = 0; f < goog.object.PROTOTYPE_FIELDS_.length; f++) c = goog.object.PROTOTYPE_FIELDS_[f], Object.prototype.hasOwnProperty.call(d, c) && (a[c] = d[c]); - } -}; - -goog.object.create = function (a) { - var b = arguments.length; - if (1 == b && goog.isArray(arguments[0])) return goog.object.create.apply(null, arguments[0]); - if (b % 2) throw Error("Uneven number of arguments"); - - for (var c = {}, d = 0; d < b; d += 2) c[arguments[d]] = arguments[d + 1]; - - return c; -}; - -goog.object.createSet = function (a) { - var b = arguments.length; - if (1 == b && goog.isArray(arguments[0])) return goog.object.createSet.apply(null, arguments[0]); - - for (var c = {}, d = 0; d < b; d++) c[arguments[d]] = !0; - - return c; -}; - -goog.object.createImmutableView = function (a) { - var b = a; - Object.isFrozen && !Object.isFrozen(a) && (b = Object.create(a), Object.freeze(b)); - return b; -}; - -goog.object.isImmutableView = function (a) { - return !!Object.isFrozen && Object.isFrozen(a); -}; - -goog.object.getAllPropertyNames = function (a, b, c) { - if (!a) return []; - if (!Object.getOwnPropertyNames || !Object.getPrototypeOf) return goog.object.getKeys(a); - - for (var d = {}; a && (a !== Object.prototype || b) && (a !== Function.prototype || c);) { - for (var e = Object.getOwnPropertyNames(a), f = 0; f < e.length; f++) d[e[f]] = !0; - - a = Object.getPrototypeOf(a); - } - - return goog.object.getKeys(d); -}; - -goog.object.getSuperClass = function (a) { - return (a = Object.getPrototypeOf(a.prototype)) && a.constructor; -}; - -goog.debug = {}; - -goog.debug.Error = function (a) { - if (Error.captureStackTrace) Error.captureStackTrace(this, goog.debug.Error);else { - var b = Error().stack; - b && (this.stack = b); - } - a && (this.message = String(a)); - this.reportErrorToServer = !0; -}; - -goog.inherits(goog.debug.Error, Error); -goog.debug.Error.prototype.name = "CustomError"; -goog.dom = {}; -goog.dom.NodeType = { - ELEMENT: 1, - ATTRIBUTE: 2, - TEXT: 3, - CDATA_SECTION: 4, - ENTITY_REFERENCE: 5, - ENTITY: 6, - PROCESSING_INSTRUCTION: 7, - COMMENT: 8, - DOCUMENT: 9, - DOCUMENT_TYPE: 10, - DOCUMENT_FRAGMENT: 11, - NOTATION: 12 -}; -goog.asserts = {}; -goog.asserts.ENABLE_ASSERTS = goog.DEBUG; - -goog.asserts.AssertionError = function (a, b) { - goog.debug.Error.call(this, goog.asserts.subs_(a, b)); - this.messagePattern = a; -}; - -goog.inherits(goog.asserts.AssertionError, goog.debug.Error); -goog.asserts.AssertionError.prototype.name = "AssertionError"; - -goog.asserts.DEFAULT_ERROR_HANDLER = function (a) { - throw a; -}; - -goog.asserts.errorHandler_ = goog.asserts.DEFAULT_ERROR_HANDLER; - -goog.asserts.subs_ = function (a, b) { - a = a.split("%s"); - - for (var c = "", d = a.length - 1, e = 0; e < d; e++) c += a[e] + (e < b.length ? b[e] : "%s"); - - return c + a[d]; -}; - -goog.asserts.doAssertFailure_ = function (a, b, c, d) { - var e = "Assertion failed"; - - if (c) { - e += ": " + c; - var f = d; - } else a && (e += ": " + a, f = b); - - a = new goog.asserts.AssertionError("" + e, f || []); - goog.asserts.errorHandler_(a); -}; - -goog.asserts.setErrorHandler = function (a) { - goog.asserts.ENABLE_ASSERTS && (goog.asserts.errorHandler_ = a); -}; - -goog.asserts.assert = function (a, b, c) { - goog.asserts.ENABLE_ASSERTS && !a && goog.asserts.doAssertFailure_("", null, b, Array.prototype.slice.call(arguments, 2)); - return a; -}; - -goog.asserts.assertExists = function (a, b, c) { - goog.asserts.ENABLE_ASSERTS && null == a && goog.asserts.doAssertFailure_("Expected to exist: %s.", [a], b, Array.prototype.slice.call(arguments, 2)); - return a; -}; - -goog.asserts.fail = function (a, b) { - goog.asserts.ENABLE_ASSERTS && goog.asserts.errorHandler_(new goog.asserts.AssertionError("Failure" + (a ? ": " + a : ""), Array.prototype.slice.call(arguments, 1))); -}; - -goog.asserts.assertNumber = function (a, b, c) { - goog.asserts.ENABLE_ASSERTS && !goog.isNumber(a) && goog.asserts.doAssertFailure_("Expected number but got %s: %s.", [goog.typeOf(a), a], b, Array.prototype.slice.call(arguments, 2)); - return a; -}; - -goog.asserts.assertString = function (a, b, c) { - goog.asserts.ENABLE_ASSERTS && !goog.isString(a) && goog.asserts.doAssertFailure_("Expected string but got %s: %s.", [goog.typeOf(a), a], b, Array.prototype.slice.call(arguments, 2)); - return a; -}; - -goog.asserts.assertFunction = function (a, b, c) { - goog.asserts.ENABLE_ASSERTS && !goog.isFunction(a) && goog.asserts.doAssertFailure_("Expected function but got %s: %s.", [goog.typeOf(a), a], b, Array.prototype.slice.call(arguments, 2)); - return a; -}; - -goog.asserts.assertObject = function (a, b, c) { - goog.asserts.ENABLE_ASSERTS && !goog.isObject(a) && goog.asserts.doAssertFailure_("Expected object but got %s: %s.", [goog.typeOf(a), a], b, Array.prototype.slice.call(arguments, 2)); - return a; -}; - -goog.asserts.assertArray = function (a, b, c) { - goog.asserts.ENABLE_ASSERTS && !goog.isArray(a) && goog.asserts.doAssertFailure_("Expected array but got %s: %s.", [goog.typeOf(a), a], b, Array.prototype.slice.call(arguments, 2)); - return a; -}; - -goog.asserts.assertBoolean = function (a, b, c) { - goog.asserts.ENABLE_ASSERTS && !goog.isBoolean(a) && goog.asserts.doAssertFailure_("Expected boolean but got %s: %s.", [goog.typeOf(a), a], b, Array.prototype.slice.call(arguments, 2)); - return a; -}; - -goog.asserts.assertElement = function (a, b, c) { - !goog.asserts.ENABLE_ASSERTS || goog.isObject(a) && a.nodeType == goog.dom.NodeType.ELEMENT || goog.asserts.doAssertFailure_("Expected Element but got %s: %s.", [goog.typeOf(a), a], b, Array.prototype.slice.call(arguments, 2)); - return a; -}; - -goog.asserts.assertInstanceof = function (a, b, c, d) { - !goog.asserts.ENABLE_ASSERTS || a instanceof b || goog.asserts.doAssertFailure_("Expected instanceof %s but got %s.", [goog.asserts.getType_(b), goog.asserts.getType_(a)], c, Array.prototype.slice.call(arguments, 3)); - return a; -}; - -goog.asserts.assertFinite = function (a, b, c) { - !goog.asserts.ENABLE_ASSERTS || "number" == typeof a && isFinite(a) || goog.asserts.doAssertFailure_("Expected %s to be a finite number but it is not.", [a], b, Array.prototype.slice.call(arguments, 2)); - return a; -}; - -goog.asserts.assertObjectPrototypeIsIntact = function () { - for (var a in Object.prototype) goog.asserts.fail(a + " should not be enumerable in Object.prototype."); -}; - -goog.asserts.getType_ = function (a) { - return a instanceof Function ? a.displayName || a.name || "unknown type name" : a instanceof Object ? a.constructor.displayName || a.constructor.name || Object.prototype.toString.call(a) : null === a ? "null" : typeof a; -}; - -var jspb = { - BinaryConstants: {}, - ConstBinaryMessage: function () {}, - BinaryMessage: function () {} -}; -jspb.BinaryConstants.FieldType = { - INVALID: -1, - DOUBLE: 1, - FLOAT: 2, - INT64: 3, - UINT64: 4, - INT32: 5, - FIXED64: 6, - FIXED32: 7, - BOOL: 8, - STRING: 9, - GROUP: 10, - MESSAGE: 11, - BYTES: 12, - UINT32: 13, - ENUM: 14, - SFIXED32: 15, - SFIXED64: 16, - SINT32: 17, - SINT64: 18, - FHASH64: 30, - VHASH64: 31 -}; -jspb.BinaryConstants.WireType = { - INVALID: -1, - VARINT: 0, - FIXED64: 1, - DELIMITED: 2, - START_GROUP: 3, - END_GROUP: 4, - FIXED32: 5 -}; - -jspb.BinaryConstants.FieldTypeToWireType = function (a) { - var b = jspb.BinaryConstants.FieldType, - c = jspb.BinaryConstants.WireType; - - switch (a) { - case b.INT32: - case b.INT64: - case b.UINT32: - case b.UINT64: - case b.SINT32: - case b.SINT64: - case b.BOOL: - case b.ENUM: - case b.VHASH64: - return c.VARINT; - - case b.DOUBLE: - case b.FIXED64: - case b.SFIXED64: - case b.FHASH64: - return c.FIXED64; - - case b.STRING: - case b.MESSAGE: - case b.BYTES: - return c.DELIMITED; - - case b.FLOAT: - case b.FIXED32: - case b.SFIXED32: - return c.FIXED32; - - default: - return c.INVALID; - } -}; - -jspb.BinaryConstants.INVALID_FIELD_NUMBER = -1; -jspb.BinaryConstants.FLOAT32_EPS = 1.401298464324817E-45; -jspb.BinaryConstants.FLOAT32_MIN = 1.1754943508222875E-38; -jspb.BinaryConstants.FLOAT32_MAX = 3.4028234663852886E38; -jspb.BinaryConstants.FLOAT64_EPS = 4.9E-324; -jspb.BinaryConstants.FLOAT64_MIN = 2.2250738585072014E-308; -jspb.BinaryConstants.FLOAT64_MAX = 1.7976931348623157E308; -jspb.BinaryConstants.TWO_TO_20 = 1048576; -jspb.BinaryConstants.TWO_TO_23 = 8388608; -jspb.BinaryConstants.TWO_TO_31 = 2147483648; -jspb.BinaryConstants.TWO_TO_32 = 4294967296; -jspb.BinaryConstants.TWO_TO_52 = 4503599627370496; -jspb.BinaryConstants.TWO_TO_63 = 0x7fffffffffffffff; -jspb.BinaryConstants.TWO_TO_64 = 1.8446744073709552E19; -jspb.BinaryConstants.ZERO_HASH = "\x00\x00\x00\x00\x00\x00\x00\x00"; -goog.array = {}; -goog.NATIVE_ARRAY_PROTOTYPES = goog.TRUSTED_SITE; -goog.array.ASSUME_NATIVE_FUNCTIONS = 2012 < goog.FEATURESET_YEAR; - -goog.array.peek = function (a) { - return a[a.length - 1]; -}; - -goog.array.last = goog.array.peek; -goog.array.indexOf = goog.NATIVE_ARRAY_PROTOTYPES && (goog.array.ASSUME_NATIVE_FUNCTIONS || Array.prototype.indexOf) ? function (a, b, c) { - goog.asserts.assert(null != a.length); - return Array.prototype.indexOf.call(a, b, c); -} : function (a, b, c) { - c = null == c ? 0 : 0 > c ? Math.max(0, a.length + c) : c; - if (goog.isString(a)) return goog.isString(b) && 1 == b.length ? a.indexOf(b, c) : -1; - - for (; c < a.length; c++) if (c in a && a[c] === b) return c; - - return -1; -}; -goog.array.lastIndexOf = goog.NATIVE_ARRAY_PROTOTYPES && (goog.array.ASSUME_NATIVE_FUNCTIONS || Array.prototype.lastIndexOf) ? function (a, b, c) { - goog.asserts.assert(null != a.length); - return Array.prototype.lastIndexOf.call(a, b, null == c ? a.length - 1 : c); -} : function (a, b, c) { - c = null == c ? a.length - 1 : c; - 0 > c && (c = Math.max(0, a.length + c)); - if (goog.isString(a)) return goog.isString(b) && 1 == b.length ? a.lastIndexOf(b, c) : -1; - - for (; 0 <= c; c--) if (c in a && a[c] === b) return c; - - return -1; -}; -goog.array.forEach = goog.NATIVE_ARRAY_PROTOTYPES && (goog.array.ASSUME_NATIVE_FUNCTIONS || Array.prototype.forEach) ? function (a, b, c) { - goog.asserts.assert(null != a.length); - Array.prototype.forEach.call(a, b, c); -} : function (a, b, c) { - for (var d = a.length, e = goog.isString(a) ? a.split("") : a, f = 0; f < d; f++) f in e && b.call(c, e[f], f, a); -}; - -goog.array.forEachRight = function (a, b, c) { - var d = a.length, - e = goog.isString(a) ? a.split("") : a; - - for (--d; 0 <= d; --d) d in e && b.call(c, e[d], d, a); -}; - -goog.array.filter = goog.NATIVE_ARRAY_PROTOTYPES && (goog.array.ASSUME_NATIVE_FUNCTIONS || Array.prototype.filter) ? function (a, b, c) { - goog.asserts.assert(null != a.length); - return Array.prototype.filter.call(a, b, c); -} : function (a, b, c) { - for (var d = a.length, e = [], f = 0, g = goog.isString(a) ? a.split("") : a, h = 0; h < d; h++) if (h in g) { - var k = g[h]; - b.call(c, k, h, a) && (e[f++] = k); - } - - return e; -}; -goog.array.map = goog.NATIVE_ARRAY_PROTOTYPES && (goog.array.ASSUME_NATIVE_FUNCTIONS || Array.prototype.map) ? function (a, b, c) { - goog.asserts.assert(null != a.length); - return Array.prototype.map.call(a, b, c); -} : function (a, b, c) { - for (var d = a.length, e = Array(d), f = goog.isString(a) ? a.split("") : a, g = 0; g < d; g++) g in f && (e[g] = b.call(c, f[g], g, a)); - - return e; -}; -goog.array.reduce = goog.NATIVE_ARRAY_PROTOTYPES && (goog.array.ASSUME_NATIVE_FUNCTIONS || Array.prototype.reduce) ? function (a, b, c, d) { - goog.asserts.assert(null != a.length); - d && (b = goog.bind(b, d)); - return Array.prototype.reduce.call(a, b, c); -} : function (a, b, c, d) { - var e = c; - goog.array.forEach(a, function (c, g) { - e = b.call(d, e, c, g, a); - }); - return e; -}; -goog.array.reduceRight = goog.NATIVE_ARRAY_PROTOTYPES && (goog.array.ASSUME_NATIVE_FUNCTIONS || Array.prototype.reduceRight) ? function (a, b, c, d) { - goog.asserts.assert(null != a.length); - goog.asserts.assert(null != b); - d && (b = goog.bind(b, d)); - return Array.prototype.reduceRight.call(a, b, c); -} : function (a, b, c, d) { - var e = c; - goog.array.forEachRight(a, function (c, g) { - e = b.call(d, e, c, g, a); - }); - return e; -}; -goog.array.some = goog.NATIVE_ARRAY_PROTOTYPES && (goog.array.ASSUME_NATIVE_FUNCTIONS || Array.prototype.some) ? function (a, b, c) { - goog.asserts.assert(null != a.length); - return Array.prototype.some.call(a, b, c); -} : function (a, b, c) { - for (var d = a.length, e = goog.isString(a) ? a.split("") : a, f = 0; f < d; f++) if (f in e && b.call(c, e[f], f, a)) return !0; - - return !1; -}; -goog.array.every = goog.NATIVE_ARRAY_PROTOTYPES && (goog.array.ASSUME_NATIVE_FUNCTIONS || Array.prototype.every) ? function (a, b, c) { - goog.asserts.assert(null != a.length); - return Array.prototype.every.call(a, b, c); -} : function (a, b, c) { - for (var d = a.length, e = goog.isString(a) ? a.split("") : a, f = 0; f < d; f++) if (f in e && !b.call(c, e[f], f, a)) return !1; - - return !0; -}; - -goog.array.count = function (a, b, c) { - var d = 0; - goog.array.forEach(a, function (a, f, g) { - b.call(c, a, f, g) && ++d; - }, c); - return d; -}; - -goog.array.find = function (a, b, c) { - b = goog.array.findIndex(a, b, c); - return 0 > b ? null : goog.isString(a) ? a.charAt(b) : a[b]; -}; - -goog.array.findIndex = function (a, b, c) { - for (var d = a.length, e = goog.isString(a) ? a.split("") : a, f = 0; f < d; f++) if (f in e && b.call(c, e[f], f, a)) return f; - - return -1; -}; - -goog.array.findRight = function (a, b, c) { - b = goog.array.findIndexRight(a, b, c); - return 0 > b ? null : goog.isString(a) ? a.charAt(b) : a[b]; -}; - -goog.array.findIndexRight = function (a, b, c) { - var d = a.length, - e = goog.isString(a) ? a.split("") : a; - - for (--d; 0 <= d; d--) if (d in e && b.call(c, e[d], d, a)) return d; - - return -1; -}; - -goog.array.contains = function (a, b) { - return 0 <= goog.array.indexOf(a, b); -}; - -goog.array.isEmpty = function (a) { - return 0 == a.length; -}; - -goog.array.clear = function (a) { - if (!goog.isArray(a)) for (var b = a.length - 1; 0 <= b; b--) delete a[b]; - a.length = 0; -}; - -goog.array.insert = function (a, b) { - goog.array.contains(a, b) || a.push(b); -}; - -goog.array.insertAt = function (a, b, c) { - goog.array.splice(a, c, 0, b); -}; - -goog.array.insertArrayAt = function (a, b, c) { - goog.partial(goog.array.splice, a, c, 0).apply(null, b); -}; - -goog.array.insertBefore = function (a, b, c) { - var d; - 2 == arguments.length || 0 > (d = goog.array.indexOf(a, c)) ? a.push(b) : goog.array.insertAt(a, b, d); -}; - -goog.array.remove = function (a, b) { - b = goog.array.indexOf(a, b); - var c; - (c = 0 <= b) && goog.array.removeAt(a, b); - return c; -}; - -goog.array.removeLast = function (a, b) { - b = goog.array.lastIndexOf(a, b); - return 0 <= b ? (goog.array.removeAt(a, b), !0) : !1; -}; - -goog.array.removeAt = function (a, b) { - goog.asserts.assert(null != a.length); - return 1 == Array.prototype.splice.call(a, b, 1).length; -}; - -goog.array.removeIf = function (a, b, c) { - b = goog.array.findIndex(a, b, c); - return 0 <= b ? (goog.array.removeAt(a, b), !0) : !1; -}; - -goog.array.removeAllIf = function (a, b, c) { - var d = 0; - goog.array.forEachRight(a, function (e, f) { - b.call(c, e, f, a) && goog.array.removeAt(a, f) && d++; - }); - return d; -}; - -goog.array.concat = function (a) { - return Array.prototype.concat.apply([], arguments); -}; - -goog.array.join = function (a) { - return Array.prototype.concat.apply([], arguments); -}; - -goog.array.toArray = function (a) { - var b = a.length; - - if (0 < b) { - for (var c = Array(b), d = 0; d < b; d++) c[d] = a[d]; - - return c; - } - - return []; -}; - -goog.array.clone = goog.array.toArray; - -goog.array.extend = function (a, b) { - for (var c = 1; c < arguments.length; c++) { - var d = arguments[c]; - - if (goog.isArrayLike(d)) { - var e = a.length || 0, - f = d.length || 0; - a.length = e + f; - - for (var g = 0; g < f; g++) a[e + g] = d[g]; - } else a.push(d); - } -}; - -goog.array.splice = function (a, b, c, d) { - goog.asserts.assert(null != a.length); - return Array.prototype.splice.apply(a, goog.array.slice(arguments, 1)); -}; - -goog.array.slice = function (a, b, c) { - goog.asserts.assert(null != a.length); - return 2 >= arguments.length ? Array.prototype.slice.call(a, b) : Array.prototype.slice.call(a, b, c); -}; - -goog.array.removeDuplicates = function (a, b, c) { - b = b || a; - - var d = function (a) { - return goog.isObject(a) ? "o" + goog.getUid(a) : (typeof a).charAt(0) + a; - }; - - c = c || d; - d = {}; - - for (var e = 0, f = 0; f < a.length;) { - var g = a[f++], - h = c(g); - Object.prototype.hasOwnProperty.call(d, h) || (d[h] = !0, b[e++] = g); - } - - b.length = e; -}; - -goog.array.binarySearch = function (a, b, c) { - return goog.array.binarySearch_(a, c || goog.array.defaultCompare, !1, b); -}; - -goog.array.binarySelect = function (a, b, c) { - return goog.array.binarySearch_(a, b, !0, void 0, c); -}; - -goog.array.binarySearch_ = function (a, b, c, d, e) { - for (var f = 0, g = a.length, h; f < g;) { - var k = f + g >> 1; - var l = c ? b.call(e, a[k], k, a) : b(d, a[k]); - 0 < l ? f = k + 1 : (g = k, h = !l); - } - - return h ? f : ~f; -}; - -goog.array.sort = function (a, b) { - a.sort(b || goog.array.defaultCompare); -}; - -goog.array.stableSort = function (a, b) { - for (var c = Array(a.length), d = 0; d < a.length; d++) c[d] = { - index: d, - value: a[d] - }; - - var e = b || goog.array.defaultCompare; - goog.array.sort(c, function (a, b) { - return e(a.value, b.value) || a.index - b.index; - }); - - for (d = 0; d < a.length; d++) a[d] = c[d].value; -}; - -goog.array.sortByKey = function (a, b, c) { - var d = c || goog.array.defaultCompare; - goog.array.sort(a, function (a, c) { - return d(b(a), b(c)); - }); -}; - -goog.array.sortObjectsByKey = function (a, b, c) { - goog.array.sortByKey(a, function (a) { - return a[b]; - }, c); -}; - -goog.array.isSorted = function (a, b, c) { - b = b || goog.array.defaultCompare; - - for (var d = 1; d < a.length; d++) { - var e = b(a[d - 1], a[d]); - if (0 < e || 0 == e && c) return !1; - } - - return !0; -}; - -goog.array.equals = function (a, b, c) { - if (!goog.isArrayLike(a) || !goog.isArrayLike(b) || a.length != b.length) return !1; - var d = a.length; - c = c || goog.array.defaultCompareEquality; - - for (var e = 0; e < d; e++) if (!c(a[e], b[e])) return !1; - - return !0; -}; - -goog.array.compare3 = function (a, b, c) { - c = c || goog.array.defaultCompare; - - for (var d = Math.min(a.length, b.length), e = 0; e < d; e++) { - var f = c(a[e], b[e]); - if (0 != f) return f; - } - - return goog.array.defaultCompare(a.length, b.length); -}; - -goog.array.defaultCompare = function (a, b) { - return a > b ? 1 : a < b ? -1 : 0; -}; - -goog.array.inverseDefaultCompare = function (a, b) { - return -goog.array.defaultCompare(a, b); -}; - -goog.array.defaultCompareEquality = function (a, b) { - return a === b; -}; - -goog.array.binaryInsert = function (a, b, c) { - c = goog.array.binarySearch(a, b, c); - return 0 > c ? (goog.array.insertAt(a, b, -(c + 1)), !0) : !1; -}; - -goog.array.binaryRemove = function (a, b, c) { - b = goog.array.binarySearch(a, b, c); - return 0 <= b ? goog.array.removeAt(a, b) : !1; -}; - -goog.array.bucket = function (a, b, c) { - for (var d = {}, e = 0; e < a.length; e++) { - var f = a[e], - g = b.call(c, f, e, a); - goog.isDef(g) && (d[g] || (d[g] = [])).push(f); - } - - return d; -}; - -goog.array.toObject = function (a, b, c) { - var d = {}; - goog.array.forEach(a, function (e, f) { - d[b.call(c, e, f, a)] = e; - }); - return d; -}; - -goog.array.range = function (a, b, c) { - var d = [], - e = 0, - f = a; - c = c || 1; - void 0 !== b && (e = a, f = b); - if (0 > c * (f - e)) return []; - if (0 < c) for (a = e; a < f; a += c) d.push(a);else for (a = e; a > f; a += c) d.push(a); - return d; -}; - -goog.array.repeat = function (a, b) { - for (var c = [], d = 0; d < b; d++) c[d] = a; - - return c; -}; - -goog.array.flatten = function (a) { - for (var b = [], c = 0; c < arguments.length; c++) { - var d = arguments[c]; - if (goog.isArray(d)) for (var e = 0; e < d.length; e += 8192) { - var f = goog.array.slice(d, e, e + 8192); - f = goog.array.flatten.apply(null, f); - - for (var g = 0; g < f.length; g++) b.push(f[g]); - } else b.push(d); - } - - return b; -}; - -goog.array.rotate = function (a, b) { - goog.asserts.assert(null != a.length); - a.length && (b %= a.length, 0 < b ? Array.prototype.unshift.apply(a, a.splice(-b, b)) : 0 > b && Array.prototype.push.apply(a, a.splice(0, -b))); - return a; -}; - -goog.array.moveItem = function (a, b, c) { - goog.asserts.assert(0 <= b && b < a.length); - goog.asserts.assert(0 <= c && c < a.length); - b = Array.prototype.splice.call(a, b, 1); - Array.prototype.splice.call(a, c, 0, b[0]); -}; - -goog.array.zip = function (a) { - if (!arguments.length) return []; - - for (var b = [], c = arguments[0].length, d = 1; d < arguments.length; d++) arguments[d].length < c && (c = arguments[d].length); - - for (d = 0; d < c; d++) { - for (var e = [], f = 0; f < arguments.length; f++) e.push(arguments[f][d]); - - b.push(e); - } - - return b; -}; - -goog.array.shuffle = function (a, b) { - b = b || Math.random; - - for (var c = a.length - 1; 0 < c; c--) { - var d = Math.floor(b() * (c + 1)), - e = a[c]; - a[c] = a[d]; - a[d] = e; - } -}; - -goog.array.copyByIndex = function (a, b) { - var c = []; - goog.array.forEach(b, function (b) { - c.push(a[b]); - }); - return c; -}; - -goog.array.concatMap = function (a, b, c) { - return goog.array.concat.apply([], goog.array.map(a, b, c)); -}; - -goog.crypt = {}; - -goog.crypt.stringToByteArray = function (a) { - for (var b = [], c = 0, d = 0; d < a.length; d++) { - var e = a.charCodeAt(d); - 255 < e && (b[c++] = e & 255, e >>= 8); - b[c++] = e; - } - - return b; -}; - -goog.crypt.byteArrayToString = function (a) { - if (8192 >= a.length) return String.fromCharCode.apply(null, a); - - for (var b = "", c = 0; c < a.length; c += 8192) { - var d = goog.array.slice(a, c, c + 8192); - b += String.fromCharCode.apply(null, d); - } - - return b; -}; - -goog.crypt.byteArrayToHex = function (a, b) { - return goog.array.map(a, function (a) { - a = a.toString(16); - return 1 < a.length ? a : "0" + a; - }).join(b || ""); -}; - -goog.crypt.hexToByteArray = function (a) { - goog.asserts.assert(0 == a.length % 2, "Key string length must be multiple of 2"); - - for (var b = [], c = 0; c < a.length; c += 2) b.push(parseInt(a.substring(c, c + 2), 16)); - - return b; -}; - -goog.crypt.stringToUtf8ByteArray = function (a) { - for (var b = [], c = 0, d = 0; d < a.length; d++) { - var e = a.charCodeAt(d); - 128 > e ? b[c++] = e : (2048 > e ? b[c++] = e >> 6 | 192 : (55296 == (e & 64512) && d + 1 < a.length && 56320 == (a.charCodeAt(d + 1) & 64512) ? (e = 65536 + ((e & 1023) << 10) + (a.charCodeAt(++d) & 1023), b[c++] = e >> 18 | 240, b[c++] = e >> 12 & 63 | 128) : b[c++] = e >> 12 | 224, b[c++] = e >> 6 & 63 | 128), b[c++] = e & 63 | 128); - } - - return b; -}; - -goog.crypt.utf8ByteArrayToString = function (a) { - for (var b = [], c = 0, d = 0; c < a.length;) { - var e = a[c++]; - if (128 > e) b[d++] = String.fromCharCode(e);else if (191 < e && 224 > e) { - var f = a[c++]; - b[d++] = String.fromCharCode((e & 31) << 6 | f & 63); - } else if (239 < e && 365 > e) { - f = a[c++]; - var g = a[c++], - h = a[c++]; - e = ((e & 7) << 18 | (f & 63) << 12 | (g & 63) << 6 | h & 63) - 65536; - b[d++] = String.fromCharCode(55296 + (e >> 10)); - b[d++] = String.fromCharCode(56320 + (e & 1023)); - } else f = a[c++], g = a[c++], b[d++] = String.fromCharCode((e & 15) << 12 | (f & 63) << 6 | g & 63); - } - - return b.join(""); -}; - -goog.crypt.xorByteArray = function (a, b) { - goog.asserts.assert(a.length == b.length, "XOR array lengths must match"); - - for (var c = [], d = 0; d < a.length; d++) c.push(a[d] ^ b[d]); - - return c; -}; - -goog.dom.asserts = {}; - -goog.dom.asserts.assertIsLocation = function (a) { - if (goog.asserts.ENABLE_ASSERTS) { - var b = goog.dom.asserts.getWindow_(a); - b && (!a || !(a instanceof b.Location) && a instanceof b.Element) && goog.asserts.fail("Argument is not a Location (or a non-Element mock); got: %s", goog.dom.asserts.debugStringForType_(a)); - } - - return a; -}; - -goog.dom.asserts.assertIsElementType_ = function (a, b) { - if (goog.asserts.ENABLE_ASSERTS) { - var c = goog.dom.asserts.getWindow_(a); - c && "undefined" != typeof c[b] && (a && (a instanceof c[b] || !(a instanceof c.Location || a instanceof c.Element)) || goog.asserts.fail("Argument is not a %s (or a non-Element, non-Location mock); got: %s", b, goog.dom.asserts.debugStringForType_(a))); - } - - return a; -}; - -goog.dom.asserts.assertIsHTMLAnchorElement = function (a) { - return goog.dom.asserts.assertIsElementType_(a, "HTMLAnchorElement"); -}; - -goog.dom.asserts.assertIsHTMLButtonElement = function (a) { - return goog.dom.asserts.assertIsElementType_(a, "HTMLButtonElement"); -}; - -goog.dom.asserts.assertIsHTMLLinkElement = function (a) { - return goog.dom.asserts.assertIsElementType_(a, "HTMLLinkElement"); -}; - -goog.dom.asserts.assertIsHTMLImageElement = function (a) { - return goog.dom.asserts.assertIsElementType_(a, "HTMLImageElement"); -}; - -goog.dom.asserts.assertIsHTMLAudioElement = function (a) { - return goog.dom.asserts.assertIsElementType_(a, "HTMLAudioElement"); -}; - -goog.dom.asserts.assertIsHTMLVideoElement = function (a) { - return goog.dom.asserts.assertIsElementType_(a, "HTMLVideoElement"); -}; - -goog.dom.asserts.assertIsHTMLInputElement = function (a) { - return goog.dom.asserts.assertIsElementType_(a, "HTMLInputElement"); -}; - -goog.dom.asserts.assertIsHTMLTextAreaElement = function (a) { - return goog.dom.asserts.assertIsElementType_(a, "HTMLTextAreaElement"); -}; - -goog.dom.asserts.assertIsHTMLCanvasElement = function (a) { - return goog.dom.asserts.assertIsElementType_(a, "HTMLCanvasElement"); -}; - -goog.dom.asserts.assertIsHTMLEmbedElement = function (a) { - return goog.dom.asserts.assertIsElementType_(a, "HTMLEmbedElement"); -}; - -goog.dom.asserts.assertIsHTMLFormElement = function (a) { - return goog.dom.asserts.assertIsElementType_(a, "HTMLFormElement"); -}; - -goog.dom.asserts.assertIsHTMLFrameElement = function (a) { - return goog.dom.asserts.assertIsElementType_(a, "HTMLFrameElement"); -}; - -goog.dom.asserts.assertIsHTMLIFrameElement = function (a) { - return goog.dom.asserts.assertIsElementType_(a, "HTMLIFrameElement"); -}; - -goog.dom.asserts.assertIsHTMLObjectElement = function (a) { - return goog.dom.asserts.assertIsElementType_(a, "HTMLObjectElement"); -}; - -goog.dom.asserts.assertIsHTMLScriptElement = function (a) { - return goog.dom.asserts.assertIsElementType_(a, "HTMLScriptElement"); -}; - -goog.dom.asserts.debugStringForType_ = function (a) { - if (goog.isObject(a)) try { - return a.constructor.displayName || a.constructor.name || Object.prototype.toString.call(a); - } catch (b) { - return "<object could not be stringified>"; - } else return void 0 === a ? "undefined" : null === a ? "null" : typeof a; -}; - -goog.dom.asserts.getWindow_ = function (a) { - try { - var b = a && a.ownerDocument, - c = b && (b.defaultView || b.parentWindow); - c = c || goog.global; - if (c.Element && c.Location) return c; - } catch (d) {} - - return null; -}; - -goog.functions = {}; - -goog.functions.constant = function (a) { - return function () { - return a; - }; -}; - -goog.functions.FALSE = function () { - return !1; -}; - -goog.functions.TRUE = function () { - return !0; -}; - -goog.functions.NULL = function () { - return null; -}; - -goog.functions.identity = function (a, b) { - return a; -}; - -goog.functions.error = function (a) { - return function () { - throw Error(a); - }; -}; - -goog.functions.fail = function (a) { - return function () { - throw a; - }; -}; - -goog.functions.lock = function (a, b) { - b = b || 0; - return function () { - return a.apply(this, Array.prototype.slice.call(arguments, 0, b)); - }; -}; - -goog.functions.nth = function (a) { - return function () { - return arguments[a]; - }; -}; - -goog.functions.partialRight = function (a, b) { - var c = Array.prototype.slice.call(arguments, 1); - return function () { - var b = Array.prototype.slice.call(arguments); - b.push.apply(b, c); - return a.apply(this, b); - }; -}; - -goog.functions.withReturnValue = function (a, b) { - return goog.functions.sequence(a, goog.functions.constant(b)); -}; - -goog.functions.equalTo = function (a, b) { - return function (c) { - return b ? a == c : a === c; - }; -}; - -goog.functions.compose = function (a, b) { - var c = arguments, - d = c.length; - return function () { - var a; - d && (a = c[d - 1].apply(this, arguments)); - - for (var b = d - 2; 0 <= b; b--) a = c[b].call(this, a); - - return a; - }; -}; - -goog.functions.sequence = function (a) { - var b = arguments, - c = b.length; - return function () { - for (var a, e = 0; e < c; e++) a = b[e].apply(this, arguments); - - return a; - }; -}; - -goog.functions.and = function (a) { - var b = arguments, - c = b.length; - return function () { - for (var a = 0; a < c; a++) if (!b[a].apply(this, arguments)) return !1; - - return !0; - }; -}; - -goog.functions.or = function (a) { - var b = arguments, - c = b.length; - return function () { - for (var a = 0; a < c; a++) if (b[a].apply(this, arguments)) return !0; - - return !1; - }; -}; - -goog.functions.not = function (a) { - return function () { - return !a.apply(this, arguments); - }; -}; - -goog.functions.create = function (a, b) { - var c = function () {}; - - c.prototype = a.prototype; - c = new c(); - a.apply(c, Array.prototype.slice.call(arguments, 1)); - return c; -}; - -goog.functions.CACHE_RETURN_VALUE = !0; - -goog.functions.cacheReturnValue = function (a) { - var b = !1, - c; - return function () { - if (!goog.functions.CACHE_RETURN_VALUE) return a(); - b || (c = a(), b = !0); - return c; - }; -}; - -goog.functions.once = function (a) { - var b = a; - return function () { - if (b) { - var a = b; - b = null; - a(); - } - }; -}; - -goog.functions.debounce = function (a, b, c) { - var d = 0; - return function (e) { - goog.global.clearTimeout(d); - var f = arguments; - d = goog.global.setTimeout(function () { - a.apply(c, f); - }, b); - }; -}; - -goog.functions.throttle = function (a, b, c) { - var d = 0, - e = !1, - f = [], - g = function () { - d = 0; - e && (e = !1, h()); - }, - h = function () { - d = goog.global.setTimeout(g, b); - a.apply(c, f); - }; - - return function (a) { - f = arguments; - d ? e = !0 : h(); - }; -}; - -goog.functions.rateLimit = function (a, b, c) { - var d = 0, - e = function () { - d = 0; - }; - - return function (f) { - d || (d = goog.global.setTimeout(e, b), a.apply(c, arguments)); - }; -}; - -goog.dom.HtmlElement = function () {}; - -goog.dom.TagName = function (a) { - this.tagName_ = a; -}; - -goog.dom.TagName.prototype.toString = function () { - return this.tagName_; -}; - -goog.dom.TagName.A = new goog.dom.TagName("A"); -goog.dom.TagName.ABBR = new goog.dom.TagName("ABBR"); -goog.dom.TagName.ACRONYM = new goog.dom.TagName("ACRONYM"); -goog.dom.TagName.ADDRESS = new goog.dom.TagName("ADDRESS"); -goog.dom.TagName.APPLET = new goog.dom.TagName("APPLET"); -goog.dom.TagName.AREA = new goog.dom.TagName("AREA"); -goog.dom.TagName.ARTICLE = new goog.dom.TagName("ARTICLE"); -goog.dom.TagName.ASIDE = new goog.dom.TagName("ASIDE"); -goog.dom.TagName.AUDIO = new goog.dom.TagName("AUDIO"); -goog.dom.TagName.B = new goog.dom.TagName("B"); -goog.dom.TagName.BASE = new goog.dom.TagName("BASE"); -goog.dom.TagName.BASEFONT = new goog.dom.TagName("BASEFONT"); -goog.dom.TagName.BDI = new goog.dom.TagName("BDI"); -goog.dom.TagName.BDO = new goog.dom.TagName("BDO"); -goog.dom.TagName.BIG = new goog.dom.TagName("BIG"); -goog.dom.TagName.BLOCKQUOTE = new goog.dom.TagName("BLOCKQUOTE"); -goog.dom.TagName.BODY = new goog.dom.TagName("BODY"); -goog.dom.TagName.BR = new goog.dom.TagName("BR"); -goog.dom.TagName.BUTTON = new goog.dom.TagName("BUTTON"); -goog.dom.TagName.CANVAS = new goog.dom.TagName("CANVAS"); -goog.dom.TagName.CAPTION = new goog.dom.TagName("CAPTION"); -goog.dom.TagName.CENTER = new goog.dom.TagName("CENTER"); -goog.dom.TagName.CITE = new goog.dom.TagName("CITE"); -goog.dom.TagName.CODE = new goog.dom.TagName("CODE"); -goog.dom.TagName.COL = new goog.dom.TagName("COL"); -goog.dom.TagName.COLGROUP = new goog.dom.TagName("COLGROUP"); -goog.dom.TagName.COMMAND = new goog.dom.TagName("COMMAND"); -goog.dom.TagName.DATA = new goog.dom.TagName("DATA"); -goog.dom.TagName.DATALIST = new goog.dom.TagName("DATALIST"); -goog.dom.TagName.DD = new goog.dom.TagName("DD"); -goog.dom.TagName.DEL = new goog.dom.TagName("DEL"); -goog.dom.TagName.DETAILS = new goog.dom.TagName("DETAILS"); -goog.dom.TagName.DFN = new goog.dom.TagName("DFN"); -goog.dom.TagName.DIALOG = new goog.dom.TagName("DIALOG"); -goog.dom.TagName.DIR = new goog.dom.TagName("DIR"); -goog.dom.TagName.DIV = new goog.dom.TagName("DIV"); -goog.dom.TagName.DL = new goog.dom.TagName("DL"); -goog.dom.TagName.DT = new goog.dom.TagName("DT"); -goog.dom.TagName.EM = new goog.dom.TagName("EM"); -goog.dom.TagName.EMBED = new goog.dom.TagName("EMBED"); -goog.dom.TagName.FIELDSET = new goog.dom.TagName("FIELDSET"); -goog.dom.TagName.FIGCAPTION = new goog.dom.TagName("FIGCAPTION"); -goog.dom.TagName.FIGURE = new goog.dom.TagName("FIGURE"); -goog.dom.TagName.FONT = new goog.dom.TagName("FONT"); -goog.dom.TagName.FOOTER = new goog.dom.TagName("FOOTER"); -goog.dom.TagName.FORM = new goog.dom.TagName("FORM"); -goog.dom.TagName.FRAME = new goog.dom.TagName("FRAME"); -goog.dom.TagName.FRAMESET = new goog.dom.TagName("FRAMESET"); -goog.dom.TagName.H1 = new goog.dom.TagName("H1"); -goog.dom.TagName.H2 = new goog.dom.TagName("H2"); -goog.dom.TagName.H3 = new goog.dom.TagName("H3"); -goog.dom.TagName.H4 = new goog.dom.TagName("H4"); -goog.dom.TagName.H5 = new goog.dom.TagName("H5"); -goog.dom.TagName.H6 = new goog.dom.TagName("H6"); -goog.dom.TagName.HEAD = new goog.dom.TagName("HEAD"); -goog.dom.TagName.HEADER = new goog.dom.TagName("HEADER"); -goog.dom.TagName.HGROUP = new goog.dom.TagName("HGROUP"); -goog.dom.TagName.HR = new goog.dom.TagName("HR"); -goog.dom.TagName.HTML = new goog.dom.TagName("HTML"); -goog.dom.TagName.I = new goog.dom.TagName("I"); -goog.dom.TagName.IFRAME = new goog.dom.TagName("IFRAME"); -goog.dom.TagName.IMG = new goog.dom.TagName("IMG"); -goog.dom.TagName.INPUT = new goog.dom.TagName("INPUT"); -goog.dom.TagName.INS = new goog.dom.TagName("INS"); -goog.dom.TagName.ISINDEX = new goog.dom.TagName("ISINDEX"); -goog.dom.TagName.KBD = new goog.dom.TagName("KBD"); -goog.dom.TagName.KEYGEN = new goog.dom.TagName("KEYGEN"); -goog.dom.TagName.LABEL = new goog.dom.TagName("LABEL"); -goog.dom.TagName.LEGEND = new goog.dom.TagName("LEGEND"); -goog.dom.TagName.LI = new goog.dom.TagName("LI"); -goog.dom.TagName.LINK = new goog.dom.TagName("LINK"); -goog.dom.TagName.MAIN = new goog.dom.TagName("MAIN"); -goog.dom.TagName.MAP = new goog.dom.TagName("MAP"); -goog.dom.TagName.MARK = new goog.dom.TagName("MARK"); -goog.dom.TagName.MATH = new goog.dom.TagName("MATH"); -goog.dom.TagName.MENU = new goog.dom.TagName("MENU"); -goog.dom.TagName.MENUITEM = new goog.dom.TagName("MENUITEM"); -goog.dom.TagName.META = new goog.dom.TagName("META"); -goog.dom.TagName.METER = new goog.dom.TagName("METER"); -goog.dom.TagName.NAV = new goog.dom.TagName("NAV"); -goog.dom.TagName.NOFRAMES = new goog.dom.TagName("NOFRAMES"); -goog.dom.TagName.NOSCRIPT = new goog.dom.TagName("NOSCRIPT"); -goog.dom.TagName.OBJECT = new goog.dom.TagName("OBJECT"); -goog.dom.TagName.OL = new goog.dom.TagName("OL"); -goog.dom.TagName.OPTGROUP = new goog.dom.TagName("OPTGROUP"); -goog.dom.TagName.OPTION = new goog.dom.TagName("OPTION"); -goog.dom.TagName.OUTPUT = new goog.dom.TagName("OUTPUT"); -goog.dom.TagName.P = new goog.dom.TagName("P"); -goog.dom.TagName.PARAM = new goog.dom.TagName("PARAM"); -goog.dom.TagName.PICTURE = new goog.dom.TagName("PICTURE"); -goog.dom.TagName.PRE = new goog.dom.TagName("PRE"); -goog.dom.TagName.PROGRESS = new goog.dom.TagName("PROGRESS"); -goog.dom.TagName.Q = new goog.dom.TagName("Q"); -goog.dom.TagName.RP = new goog.dom.TagName("RP"); -goog.dom.TagName.RT = new goog.dom.TagName("RT"); -goog.dom.TagName.RTC = new goog.dom.TagName("RTC"); -goog.dom.TagName.RUBY = new goog.dom.TagName("RUBY"); -goog.dom.TagName.S = new goog.dom.TagName("S"); -goog.dom.TagName.SAMP = new goog.dom.TagName("SAMP"); -goog.dom.TagName.SCRIPT = new goog.dom.TagName("SCRIPT"); -goog.dom.TagName.SECTION = new goog.dom.TagName("SECTION"); -goog.dom.TagName.SELECT = new goog.dom.TagName("SELECT"); -goog.dom.TagName.SMALL = new goog.dom.TagName("SMALL"); -goog.dom.TagName.SOURCE = new goog.dom.TagName("SOURCE"); -goog.dom.TagName.SPAN = new goog.dom.TagName("SPAN"); -goog.dom.TagName.STRIKE = new goog.dom.TagName("STRIKE"); -goog.dom.TagName.STRONG = new goog.dom.TagName("STRONG"); -goog.dom.TagName.STYLE = new goog.dom.TagName("STYLE"); -goog.dom.TagName.SUB = new goog.dom.TagName("SUB"); -goog.dom.TagName.SUMMARY = new goog.dom.TagName("SUMMARY"); -goog.dom.TagName.SUP = new goog.dom.TagName("SUP"); -goog.dom.TagName.SVG = new goog.dom.TagName("SVG"); -goog.dom.TagName.TABLE = new goog.dom.TagName("TABLE"); -goog.dom.TagName.TBODY = new goog.dom.TagName("TBODY"); -goog.dom.TagName.TD = new goog.dom.TagName("TD"); -goog.dom.TagName.TEMPLATE = new goog.dom.TagName("TEMPLATE"); -goog.dom.TagName.TEXTAREA = new goog.dom.TagName("TEXTAREA"); -goog.dom.TagName.TFOOT = new goog.dom.TagName("TFOOT"); -goog.dom.TagName.TH = new goog.dom.TagName("TH"); -goog.dom.TagName.THEAD = new goog.dom.TagName("THEAD"); -goog.dom.TagName.TIME = new goog.dom.TagName("TIME"); -goog.dom.TagName.TITLE = new goog.dom.TagName("TITLE"); -goog.dom.TagName.TR = new goog.dom.TagName("TR"); -goog.dom.TagName.TRACK = new goog.dom.TagName("TRACK"); -goog.dom.TagName.TT = new goog.dom.TagName("TT"); -goog.dom.TagName.U = new goog.dom.TagName("U"); -goog.dom.TagName.UL = new goog.dom.TagName("UL"); -goog.dom.TagName.VAR = new goog.dom.TagName("VAR"); -goog.dom.TagName.VIDEO = new goog.dom.TagName("VIDEO"); -goog.dom.TagName.WBR = new goog.dom.TagName("WBR"); -goog.dom.tags = {}; -goog.dom.tags.VOID_TAGS_ = { - area: !0, - base: !0, - br: !0, - col: !0, - command: !0, - embed: !0, - hr: !0, - img: !0, - input: !0, - keygen: !0, - link: !0, - meta: !0, - param: !0, - source: !0, - track: !0, - wbr: !0 -}; - -goog.dom.tags.isVoidTag = function (a) { - return !0 === goog.dom.tags.VOID_TAGS_[a]; -}; - -goog.html = {}; -goog.html.trustedtypes = {}; -goog.html.trustedtypes.PRIVATE_DO_NOT_ACCESS_OR_ELSE_POLICY = goog.TRUSTED_TYPES_POLICY_NAME ? goog.createTrustedTypesPolicy(goog.TRUSTED_TYPES_POLICY_NAME + "#html") : null; -goog.string = {}; - -goog.string.TypedString = function () {}; - -goog.string.Const = function (a, b) { - this.stringConstValueWithSecurityContract__googStringSecurityPrivate_ = a === goog.string.Const.GOOG_STRING_CONSTRUCTOR_TOKEN_PRIVATE_ && b || ""; - this.STRING_CONST_TYPE_MARKER__GOOG_STRING_SECURITY_PRIVATE_ = goog.string.Const.TYPE_MARKER_; -}; - -goog.string.Const.prototype.implementsGoogStringTypedString = !0; - -goog.string.Const.prototype.getTypedStringValue = function () { - return this.stringConstValueWithSecurityContract__googStringSecurityPrivate_; -}; - -goog.string.Const.prototype.toString = function () { - return "Const{" + this.stringConstValueWithSecurityContract__googStringSecurityPrivate_ + "}"; -}; - -goog.string.Const.unwrap = function (a) { - if (a instanceof goog.string.Const && a.constructor === goog.string.Const && a.STRING_CONST_TYPE_MARKER__GOOG_STRING_SECURITY_PRIVATE_ === goog.string.Const.TYPE_MARKER_) return a.stringConstValueWithSecurityContract__googStringSecurityPrivate_; - goog.asserts.fail("expected object of type Const, got '" + a + "'"); - return "type_error:Const"; -}; - -goog.string.Const.from = function (a) { - return new goog.string.Const(goog.string.Const.GOOG_STRING_CONSTRUCTOR_TOKEN_PRIVATE_, a); -}; - -goog.string.Const.TYPE_MARKER_ = {}; -goog.string.Const.GOOG_STRING_CONSTRUCTOR_TOKEN_PRIVATE_ = {}; -goog.string.Const.EMPTY = goog.string.Const.from(""); - -goog.html.SafeScript = function () { - this.privateDoNotAccessOrElseSafeScriptWrappedValue_ = ""; - this.SAFE_SCRIPT_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_ = goog.html.SafeScript.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_; -}; - -goog.html.SafeScript.prototype.implementsGoogStringTypedString = !0; -goog.html.SafeScript.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_ = {}; - -goog.html.SafeScript.fromConstant = function (a) { - a = goog.string.Const.unwrap(a); - return 0 === a.length ? goog.html.SafeScript.EMPTY : goog.html.SafeScript.createSafeScriptSecurityPrivateDoNotAccessOrElse(a); -}; - -goog.html.SafeScript.fromConstantAndArgs = function (a, b) { - for (var c = [], d = 1; d < arguments.length; d++) c.push(goog.html.SafeScript.stringify_(arguments[d])); - - return goog.html.SafeScript.createSafeScriptSecurityPrivateDoNotAccessOrElse("(" + goog.string.Const.unwrap(a) + ")(" + c.join(", ") + ");"); -}; - -goog.html.SafeScript.fromJson = function (a) { - return goog.html.SafeScript.createSafeScriptSecurityPrivateDoNotAccessOrElse(goog.html.SafeScript.stringify_(a)); -}; - -goog.html.SafeScript.prototype.getTypedStringValue = function () { - return this.privateDoNotAccessOrElseSafeScriptWrappedValue_.toString(); -}; - -goog.DEBUG && (goog.html.SafeScript.prototype.toString = function () { - return "SafeScript{" + this.privateDoNotAccessOrElseSafeScriptWrappedValue_ + "}"; -}); - -goog.html.SafeScript.unwrap = function (a) { - return goog.html.SafeScript.unwrapTrustedScript(a).toString(); -}; - -goog.html.SafeScript.unwrapTrustedScript = function (a) { - if (a instanceof goog.html.SafeScript && a.constructor === goog.html.SafeScript && a.SAFE_SCRIPT_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_ === goog.html.SafeScript.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_) return a.privateDoNotAccessOrElseSafeScriptWrappedValue_; - goog.asserts.fail("expected object of type SafeScript, got '" + a + "' of type " + goog.typeOf(a)); - return "type_error:SafeScript"; -}; - -goog.html.SafeScript.stringify_ = function (a) { - return JSON.stringify(a).replace(/</g, "\\x3c"); -}; - -goog.html.SafeScript.createSafeScriptSecurityPrivateDoNotAccessOrElse = function (a) { - return new goog.html.SafeScript().initSecurityPrivateDoNotAccessOrElse_(a); -}; - -goog.html.SafeScript.prototype.initSecurityPrivateDoNotAccessOrElse_ = function (a) { - this.privateDoNotAccessOrElseSafeScriptWrappedValue_ = goog.html.trustedtypes.PRIVATE_DO_NOT_ACCESS_OR_ELSE_POLICY ? goog.html.trustedtypes.PRIVATE_DO_NOT_ACCESS_OR_ELSE_POLICY.createScript(a) : a; - return this; -}; - -goog.html.SafeScript.EMPTY = goog.html.SafeScript.createSafeScriptSecurityPrivateDoNotAccessOrElse(""); -goog.fs = {}; -goog.fs.url = {}; - -goog.fs.url.createObjectUrl = function (a) { - return goog.fs.url.getUrlObject_().createObjectURL(a); -}; - -goog.fs.url.revokeObjectUrl = function (a) { - goog.fs.url.getUrlObject_().revokeObjectURL(a); -}; - -goog.fs.url.getUrlObject_ = function () { - var a = goog.fs.url.findUrlObject_(); - if (null != a) return a; - throw Error("This browser doesn't seem to support blob URLs"); -}; - -goog.fs.url.findUrlObject_ = function () { - return goog.isDef(goog.global.URL) && goog.isDef(goog.global.URL.createObjectURL) ? goog.global.URL : goog.isDef(goog.global.webkitURL) && goog.isDef(goog.global.webkitURL.createObjectURL) ? goog.global.webkitURL : goog.isDef(goog.global.createObjectURL) ? goog.global : null; -}; - -goog.fs.url.browserSupportsObjectUrls = function () { - return null != goog.fs.url.findUrlObject_(); -}; - -goog.i18n = {}; -goog.i18n.bidi = {}; -goog.i18n.bidi.FORCE_RTL = !1; -goog.i18n.bidi.IS_RTL = goog.i18n.bidi.FORCE_RTL || ("ar" == goog.LOCALE.substring(0, 2).toLowerCase() || "fa" == goog.LOCALE.substring(0, 2).toLowerCase() || "he" == goog.LOCALE.substring(0, 2).toLowerCase() || "iw" == goog.LOCALE.substring(0, 2).toLowerCase() || "ps" == goog.LOCALE.substring(0, 2).toLowerCase() || "sd" == goog.LOCALE.substring(0, 2).toLowerCase() || "ug" == goog.LOCALE.substring(0, 2).toLowerCase() || "ur" == goog.LOCALE.substring(0, 2).toLowerCase() || "yi" == goog.LOCALE.substring(0, 2).toLowerCase()) && (2 == goog.LOCALE.length || "-" == goog.LOCALE.substring(2, 3) || "_" == goog.LOCALE.substring(2, 3)) || 3 <= goog.LOCALE.length && "ckb" == goog.LOCALE.substring(0, 3).toLowerCase() && (3 == goog.LOCALE.length || "-" == goog.LOCALE.substring(3, 4) || "_" == goog.LOCALE.substring(3, 4)) || 7 <= goog.LOCALE.length && ("-" == goog.LOCALE.substring(2, 3) || "_" == goog.LOCALE.substring(2, 3)) && ("adlm" == goog.LOCALE.substring(3, 7).toLowerCase() || "arab" == goog.LOCALE.substring(3, 7).toLowerCase() || "hebr" == goog.LOCALE.substring(3, 7).toLowerCase() || "nkoo" == goog.LOCALE.substring(3, 7).toLowerCase() || "rohg" == goog.LOCALE.substring(3, 7).toLowerCase() || "thaa" == goog.LOCALE.substring(3, 7).toLowerCase()) || 8 <= goog.LOCALE.length && ("-" == goog.LOCALE.substring(3, 4) || "_" == goog.LOCALE.substring(3, 4)) && ("adlm" == goog.LOCALE.substring(4, 8).toLowerCase() || "arab" == goog.LOCALE.substring(4, 8).toLowerCase() || "hebr" == goog.LOCALE.substring(4, 8).toLowerCase() || "nkoo" == goog.LOCALE.substring(4, 8).toLowerCase() || "rohg" == goog.LOCALE.substring(4, 8).toLowerCase() || "thaa" == goog.LOCALE.substring(4, 8).toLowerCase()); -goog.i18n.bidi.Format = { - LRE: "\u202a", - RLE: "\u202b", - PDF: "\u202c", - LRM: "\u200e", - RLM: "\u200f" -}; -goog.i18n.bidi.Dir = { - LTR: 1, - RTL: -1, - NEUTRAL: 0 -}; -goog.i18n.bidi.RIGHT = "right"; -goog.i18n.bidi.LEFT = "left"; -goog.i18n.bidi.I18N_RIGHT = goog.i18n.bidi.IS_RTL ? goog.i18n.bidi.LEFT : goog.i18n.bidi.RIGHT; -goog.i18n.bidi.I18N_LEFT = goog.i18n.bidi.IS_RTL ? goog.i18n.bidi.RIGHT : goog.i18n.bidi.LEFT; - -goog.i18n.bidi.toDir = function (a, b) { - return "number" == typeof a ? 0 < a ? goog.i18n.bidi.Dir.LTR : 0 > a ? goog.i18n.bidi.Dir.RTL : b ? null : goog.i18n.bidi.Dir.NEUTRAL : null == a ? null : a ? goog.i18n.bidi.Dir.RTL : goog.i18n.bidi.Dir.LTR; -}; - -goog.i18n.bidi.ltrChars_ = "A-Za-z\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u02b8\u0300-\u0590\u0900-\u1fff\u200e\u2c00-\ud801\ud804-\ud839\ud83c-\udbff\uf900-\ufb1c\ufe00-\ufe6f\ufefd-\uffff"; -goog.i18n.bidi.rtlChars_ = "\u0591-\u06ef\u06fa-\u08ff\u200f\ud802-\ud803\ud83a-\ud83b\ufb1d-\ufdff\ufe70-\ufefc"; -goog.i18n.bidi.htmlSkipReg_ = /<[^>]*>|&[^;]+;/g; - -goog.i18n.bidi.stripHtmlIfNeeded_ = function (a, b) { - return b ? a.replace(goog.i18n.bidi.htmlSkipReg_, "") : a; -}; - -goog.i18n.bidi.rtlCharReg_ = new RegExp("[" + goog.i18n.bidi.rtlChars_ + "]"); -goog.i18n.bidi.ltrCharReg_ = new RegExp("[" + goog.i18n.bidi.ltrChars_ + "]"); - -goog.i18n.bidi.hasAnyRtl = function (a, b) { - return goog.i18n.bidi.rtlCharReg_.test(goog.i18n.bidi.stripHtmlIfNeeded_(a, b)); -}; - -goog.i18n.bidi.hasRtlChar = goog.i18n.bidi.hasAnyRtl; - -goog.i18n.bidi.hasAnyLtr = function (a, b) { - return goog.i18n.bidi.ltrCharReg_.test(goog.i18n.bidi.stripHtmlIfNeeded_(a, b)); -}; - -goog.i18n.bidi.ltrRe_ = new RegExp("^[" + goog.i18n.bidi.ltrChars_ + "]"); -goog.i18n.bidi.rtlRe_ = new RegExp("^[" + goog.i18n.bidi.rtlChars_ + "]"); - -goog.i18n.bidi.isRtlChar = function (a) { - return goog.i18n.bidi.rtlRe_.test(a); -}; - -goog.i18n.bidi.isLtrChar = function (a) { - return goog.i18n.bidi.ltrRe_.test(a); -}; - -goog.i18n.bidi.isNeutralChar = function (a) { - return !goog.i18n.bidi.isLtrChar(a) && !goog.i18n.bidi.isRtlChar(a); -}; - -goog.i18n.bidi.ltrDirCheckRe_ = new RegExp("^[^" + goog.i18n.bidi.rtlChars_ + "]*[" + goog.i18n.bidi.ltrChars_ + "]"); -goog.i18n.bidi.rtlDirCheckRe_ = new RegExp("^[^" + goog.i18n.bidi.ltrChars_ + "]*[" + goog.i18n.bidi.rtlChars_ + "]"); - -goog.i18n.bidi.startsWithRtl = function (a, b) { - return goog.i18n.bidi.rtlDirCheckRe_.test(goog.i18n.bidi.stripHtmlIfNeeded_(a, b)); -}; - -goog.i18n.bidi.isRtlText = goog.i18n.bidi.startsWithRtl; - -goog.i18n.bidi.startsWithLtr = function (a, b) { - return goog.i18n.bidi.ltrDirCheckRe_.test(goog.i18n.bidi.stripHtmlIfNeeded_(a, b)); -}; - -goog.i18n.bidi.isLtrText = goog.i18n.bidi.startsWithLtr; -goog.i18n.bidi.isRequiredLtrRe_ = /^http:\/\/.*/; - -goog.i18n.bidi.isNeutralText = function (a, b) { - a = goog.i18n.bidi.stripHtmlIfNeeded_(a, b); - return goog.i18n.bidi.isRequiredLtrRe_.test(a) || !goog.i18n.bidi.hasAnyLtr(a) && !goog.i18n.bidi.hasAnyRtl(a); -}; - -goog.i18n.bidi.ltrExitDirCheckRe_ = new RegExp("[" + goog.i18n.bidi.ltrChars_ + "][^" + goog.i18n.bidi.rtlChars_ + "]*$"); -goog.i18n.bidi.rtlExitDirCheckRe_ = new RegExp("[" + goog.i18n.bidi.rtlChars_ + "][^" + goog.i18n.bidi.ltrChars_ + "]*$"); - -goog.i18n.bidi.endsWithLtr = function (a, b) { - return goog.i18n.bidi.ltrExitDirCheckRe_.test(goog.i18n.bidi.stripHtmlIfNeeded_(a, b)); -}; - -goog.i18n.bidi.isLtrExitText = goog.i18n.bidi.endsWithLtr; - -goog.i18n.bidi.endsWithRtl = function (a, b) { - return goog.i18n.bidi.rtlExitDirCheckRe_.test(goog.i18n.bidi.stripHtmlIfNeeded_(a, b)); -}; - -goog.i18n.bidi.isRtlExitText = goog.i18n.bidi.endsWithRtl; -goog.i18n.bidi.rtlLocalesRe_ = /^(ar|ckb|dv|he|iw|fa|nqo|ps|sd|ug|ur|yi|.*[-_](Adlm|Arab|Hebr|Nkoo|Rohg|Thaa))(?!.*[-_](Latn|Cyrl)($|-|_))($|-|_)/i; - -goog.i18n.bidi.isRtlLanguage = function (a) { - return goog.i18n.bidi.rtlLocalesRe_.test(a); -}; - -goog.i18n.bidi.bracketGuardTextRe_ = /(\(.*?\)+)|(\[.*?\]+)|(\{.*?\}+)|(<.*?>+)/g; - -goog.i18n.bidi.guardBracketInText = function (a, b) { - b = (void 0 === b ? goog.i18n.bidi.hasAnyRtl(a) : b) ? goog.i18n.bidi.Format.RLM : goog.i18n.bidi.Format.LRM; - return a.replace(goog.i18n.bidi.bracketGuardTextRe_, b + "$&" + b); -}; - -goog.i18n.bidi.enforceRtlInHtml = function (a) { - return "<" == a.charAt(0) ? a.replace(/<\w+/, "$& dir=rtl") : "\n<span dir=rtl>" + a + "</span>"; -}; - -goog.i18n.bidi.enforceRtlInText = function (a) { - return goog.i18n.bidi.Format.RLE + a + goog.i18n.bidi.Format.PDF; -}; - -goog.i18n.bidi.enforceLtrInHtml = function (a) { - return "<" == a.charAt(0) ? a.replace(/<\w+/, "$& dir=ltr") : "\n<span dir=ltr>" + a + "</span>"; -}; - -goog.i18n.bidi.enforceLtrInText = function (a) { - return goog.i18n.bidi.Format.LRE + a + goog.i18n.bidi.Format.PDF; -}; - -goog.i18n.bidi.dimensionsRe_ = /:\s*([.\d][.\w]*)\s+([.\d][.\w]*)\s+([.\d][.\w]*)\s+([.\d][.\w]*)/g; -goog.i18n.bidi.leftRe_ = /left/gi; -goog.i18n.bidi.rightRe_ = /right/gi; -goog.i18n.bidi.tempRe_ = /%%%%/g; - -goog.i18n.bidi.mirrorCSS = function (a) { - return a.replace(goog.i18n.bidi.dimensionsRe_, ":$1 $4 $3 $2").replace(goog.i18n.bidi.leftRe_, "%%%%").replace(goog.i18n.bidi.rightRe_, goog.i18n.bidi.LEFT).replace(goog.i18n.bidi.tempRe_, goog.i18n.bidi.RIGHT); -}; - -goog.i18n.bidi.doubleQuoteSubstituteRe_ = /([\u0591-\u05f2])"/g; -goog.i18n.bidi.singleQuoteSubstituteRe_ = /([\u0591-\u05f2])'/g; - -goog.i18n.bidi.normalizeHebrewQuote = function (a) { - return a.replace(goog.i18n.bidi.doubleQuoteSubstituteRe_, "$1\u05f4").replace(goog.i18n.bidi.singleQuoteSubstituteRe_, "$1\u05f3"); -}; - -goog.i18n.bidi.wordSeparatorRe_ = /\s+/; -goog.i18n.bidi.hasNumeralsRe_ = /[\d\u06f0-\u06f9]/; -goog.i18n.bidi.rtlDetectionThreshold_ = .4; - -goog.i18n.bidi.estimateDirection = function (a, b) { - var c = 0, - d = 0, - e = !1; - a = goog.i18n.bidi.stripHtmlIfNeeded_(a, b).split(goog.i18n.bidi.wordSeparatorRe_); - - for (b = 0; b < a.length; b++) { - var f = a[b]; - goog.i18n.bidi.startsWithRtl(f) ? (c++, d++) : goog.i18n.bidi.isRequiredLtrRe_.test(f) ? e = !0 : goog.i18n.bidi.hasAnyLtr(f) ? d++ : goog.i18n.bidi.hasNumeralsRe_.test(f) && (e = !0); - } - - return 0 == d ? e ? goog.i18n.bidi.Dir.LTR : goog.i18n.bidi.Dir.NEUTRAL : c / d > goog.i18n.bidi.rtlDetectionThreshold_ ? goog.i18n.bidi.Dir.RTL : goog.i18n.bidi.Dir.LTR; -}; - -goog.i18n.bidi.detectRtlDirectionality = function (a, b) { - return goog.i18n.bidi.estimateDirection(a, b) == goog.i18n.bidi.Dir.RTL; -}; - -goog.i18n.bidi.setElementDirAndAlign = function (a, b) { - a && (b = goog.i18n.bidi.toDir(b)) && (a.style.textAlign = b == goog.i18n.bidi.Dir.RTL ? goog.i18n.bidi.RIGHT : goog.i18n.bidi.LEFT, a.dir = b == goog.i18n.bidi.Dir.RTL ? "rtl" : "ltr"); -}; - -goog.i18n.bidi.setElementDirByTextDirectionality = function (a, b) { - switch (goog.i18n.bidi.estimateDirection(b)) { - case goog.i18n.bidi.Dir.LTR: - a.dir = "ltr"; - break; - - case goog.i18n.bidi.Dir.RTL: - a.dir = "rtl"; - break; - - default: - a.removeAttribute("dir"); - } -}; - -goog.i18n.bidi.DirectionalString = function () {}; - -goog.html.TrustedResourceUrl = function () { - this.privateDoNotAccessOrElseTrustedResourceUrlWrappedValue_ = ""; - this.trustedURL_ = null; - this.TRUSTED_RESOURCE_URL_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_ = goog.html.TrustedResourceUrl.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_; -}; - -goog.html.TrustedResourceUrl.prototype.implementsGoogStringTypedString = !0; - -goog.html.TrustedResourceUrl.prototype.getTypedStringValue = function () { - return this.privateDoNotAccessOrElseTrustedResourceUrlWrappedValue_.toString(); -}; - -goog.html.TrustedResourceUrl.prototype.implementsGoogI18nBidiDirectionalString = !0; - -goog.html.TrustedResourceUrl.prototype.getDirection = function () { - return goog.i18n.bidi.Dir.LTR; -}; - -goog.html.TrustedResourceUrl.prototype.cloneWithParams = function (a, b) { - var c = goog.html.TrustedResourceUrl.unwrap(this); - c = goog.html.TrustedResourceUrl.URL_PARAM_PARSER_.exec(c); - var d = c[3] || ""; - return goog.html.TrustedResourceUrl.createTrustedResourceUrlSecurityPrivateDoNotAccessOrElse(c[1] + goog.html.TrustedResourceUrl.stringifyParams_("?", c[2] || "", a) + goog.html.TrustedResourceUrl.stringifyParams_("#", d, b)); -}; - -goog.DEBUG && (goog.html.TrustedResourceUrl.prototype.toString = function () { - return "TrustedResourceUrl{" + this.privateDoNotAccessOrElseTrustedResourceUrlWrappedValue_ + "}"; -}); - -goog.html.TrustedResourceUrl.unwrap = function (a) { - return goog.html.TrustedResourceUrl.unwrapTrustedScriptURL(a).toString(); -}; - -goog.html.TrustedResourceUrl.unwrapTrustedScriptURL = function (a) { - if (a instanceof goog.html.TrustedResourceUrl && a.constructor === goog.html.TrustedResourceUrl && a.TRUSTED_RESOURCE_URL_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_ === goog.html.TrustedResourceUrl.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_) return a.privateDoNotAccessOrElseTrustedResourceUrlWrappedValue_; - goog.asserts.fail("expected object of type TrustedResourceUrl, got '" + a + "' of type " + goog.typeOf(a)); - return "type_error:TrustedResourceUrl"; -}; - -goog.html.TrustedResourceUrl.unwrapTrustedURL = function (a) { - return a.trustedURL_ ? a.trustedURL_ : goog.html.TrustedResourceUrl.unwrap(a); -}; - -goog.html.TrustedResourceUrl.format = function (a, b) { - var c = goog.string.Const.unwrap(a); - if (!goog.html.TrustedResourceUrl.BASE_URL_.test(c)) throw Error("Invalid TrustedResourceUrl format: " + c); - a = c.replace(goog.html.TrustedResourceUrl.FORMAT_MARKER_, function (a, e) { - if (!Object.prototype.hasOwnProperty.call(b, e)) throw Error('Found marker, "' + e + '", in format string, "' + c + '", but no valid label mapping found in args: ' + JSON.stringify(b)); - a = b[e]; - return a instanceof goog.string.Const ? goog.string.Const.unwrap(a) : encodeURIComponent(String(a)); - }); - return goog.html.TrustedResourceUrl.createTrustedResourceUrlSecurityPrivateDoNotAccessOrElse(a); -}; - -goog.html.TrustedResourceUrl.FORMAT_MARKER_ = /%{(\w+)}/g; -goog.html.TrustedResourceUrl.BASE_URL_ = /^((https:)?\/\/[0-9a-z.:[\]-]+\/|\/[^/\\]|[^:/\\%]+\/|[^:/\\%]*[?#]|about:blank#)/i; -goog.html.TrustedResourceUrl.URL_PARAM_PARSER_ = /^([^?#]*)(\?[^#]*)?(#[\s\S]*)?/; - -goog.html.TrustedResourceUrl.formatWithParams = function (a, b, c, d) { - return goog.html.TrustedResourceUrl.format(a, b).cloneWithParams(c, d); -}; - -goog.html.TrustedResourceUrl.fromConstant = function (a) { - return goog.html.TrustedResourceUrl.createTrustedResourceUrlSecurityPrivateDoNotAccessOrElse(goog.string.Const.unwrap(a)); -}; - -goog.html.TrustedResourceUrl.fromConstants = function (a) { - for (var b = "", c = 0; c < a.length; c++) b += goog.string.Const.unwrap(a[c]); - - return goog.html.TrustedResourceUrl.createTrustedResourceUrlSecurityPrivateDoNotAccessOrElse(b); -}; - -goog.html.TrustedResourceUrl.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_ = {}; - -goog.html.TrustedResourceUrl.createTrustedResourceUrlSecurityPrivateDoNotAccessOrElse = function (a) { - var b = new goog.html.TrustedResourceUrl(); - b.privateDoNotAccessOrElseTrustedResourceUrlWrappedValue_ = goog.html.trustedtypes.PRIVATE_DO_NOT_ACCESS_OR_ELSE_POLICY ? goog.html.trustedtypes.PRIVATE_DO_NOT_ACCESS_OR_ELSE_POLICY.createScriptURL(a) : a; - goog.html.trustedtypes.PRIVATE_DO_NOT_ACCESS_OR_ELSE_POLICY && (b.trustedURL_ = goog.html.trustedtypes.PRIVATE_DO_NOT_ACCESS_OR_ELSE_POLICY.createURL(a)); - return b; -}; - -goog.html.TrustedResourceUrl.stringifyParams_ = function (a, b, c) { - if (null == c) return b; - if (goog.isString(c)) return c ? a + encodeURIComponent(c) : ""; - - for (var d in c) { - var e = c[d]; - e = goog.isArray(e) ? e : [e]; - - for (var f = 0; f < e.length; f++) { - var g = e[f]; - null != g && (b || (b = a), b += (b.length > a.length ? "&" : "") + encodeURIComponent(d) + "=" + encodeURIComponent(String(g))); - } - } - - return b; -}; - -goog.string.internal = {}; - -goog.string.internal.startsWith = function (a, b) { - return 0 == a.lastIndexOf(b, 0); -}; - -goog.string.internal.endsWith = function (a, b) { - var c = a.length - b.length; - return 0 <= c && a.indexOf(b, c) == c; -}; - -goog.string.internal.caseInsensitiveStartsWith = function (a, b) { - return 0 == goog.string.internal.caseInsensitiveCompare(b, a.substr(0, b.length)); -}; - -goog.string.internal.caseInsensitiveEndsWith = function (a, b) { - return 0 == goog.string.internal.caseInsensitiveCompare(b, a.substr(a.length - b.length, b.length)); -}; - -goog.string.internal.caseInsensitiveEquals = function (a, b) { - return a.toLowerCase() == b.toLowerCase(); -}; - -goog.string.internal.isEmptyOrWhitespace = function (a) { - return /^[\s\xa0]*$/.test(a); -}; - -goog.string.internal.trim = goog.TRUSTED_SITE && String.prototype.trim ? function (a) { - return a.trim(); -} : function (a) { - return /^[\s\xa0]*([\s\S]*?)[\s\xa0]*$/.exec(a)[1]; -}; - -goog.string.internal.caseInsensitiveCompare = function (a, b) { - a = String(a).toLowerCase(); - b = String(b).toLowerCase(); - return a < b ? -1 : a == b ? 0 : 1; -}; - -goog.string.internal.newLineToBr = function (a, b) { - return a.replace(/(\r\n|\r|\n)/g, b ? "<br />" : "<br>"); -}; - -goog.string.internal.htmlEscape = function (a, b) { - if (b) a = a.replace(goog.string.internal.AMP_RE_, "&").replace(goog.string.internal.LT_RE_, "<").replace(goog.string.internal.GT_RE_, ">").replace(goog.string.internal.QUOT_RE_, """).replace(goog.string.internal.SINGLE_QUOTE_RE_, "'").replace(goog.string.internal.NULL_RE_, "�");else { - if (!goog.string.internal.ALL_RE_.test(a)) return a; - -1 != a.indexOf("&") && (a = a.replace(goog.string.internal.AMP_RE_, "&")); - -1 != a.indexOf("<") && (a = a.replace(goog.string.internal.LT_RE_, "<")); - -1 != a.indexOf(">") && (a = a.replace(goog.string.internal.GT_RE_, ">")); - -1 != a.indexOf('"') && (a = a.replace(goog.string.internal.QUOT_RE_, """)); - -1 != a.indexOf("'") && (a = a.replace(goog.string.internal.SINGLE_QUOTE_RE_, "'")); - -1 != a.indexOf("\x00") && (a = a.replace(goog.string.internal.NULL_RE_, "�")); - } - return a; -}; - -goog.string.internal.AMP_RE_ = /&/g; -goog.string.internal.LT_RE_ = /</g; -goog.string.internal.GT_RE_ = />/g; -goog.string.internal.QUOT_RE_ = /"/g; -goog.string.internal.SINGLE_QUOTE_RE_ = /'/g; -goog.string.internal.NULL_RE_ = /\x00/g; -goog.string.internal.ALL_RE_ = /[\x00&<>"']/; - -goog.string.internal.whitespaceEscape = function (a, b) { - return goog.string.internal.newLineToBr(a.replace(/ /g, "  "), b); -}; - -goog.string.internal.contains = function (a, b) { - return -1 != a.indexOf(b); -}; - -goog.string.internal.caseInsensitiveContains = function (a, b) { - return goog.string.internal.contains(a.toLowerCase(), b.toLowerCase()); -}; - -goog.string.internal.compareVersions = function (a, b) { - var c = 0; - a = goog.string.internal.trim(String(a)).split("."); - b = goog.string.internal.trim(String(b)).split("."); - - for (var d = Math.max(a.length, b.length), e = 0; 0 == c && e < d; e++) { - var f = a[e] || "", - g = b[e] || ""; - - do { - f = /(\d*)(\D*)(.*)/.exec(f) || ["", "", "", ""]; - g = /(\d*)(\D*)(.*)/.exec(g) || ["", "", "", ""]; - if (0 == f[0].length && 0 == g[0].length) break; - c = 0 == f[1].length ? 0 : parseInt(f[1], 10); - var h = 0 == g[1].length ? 0 : parseInt(g[1], 10); - c = goog.string.internal.compareElements_(c, h) || goog.string.internal.compareElements_(0 == f[2].length, 0 == g[2].length) || goog.string.internal.compareElements_(f[2], g[2]); - f = f[3]; - g = g[3]; - } while (0 == c); - } - - return c; -}; - -goog.string.internal.compareElements_ = function (a, b) { - return a < b ? -1 : a > b ? 1 : 0; -}; - -goog.html.SafeUrl = function () { - this.privateDoNotAccessOrElseSafeUrlWrappedValue_ = ""; - this.SAFE_URL_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_ = goog.html.SafeUrl.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_; -}; - -goog.html.SafeUrl.INNOCUOUS_STRING = "about:invalid#zClosurez"; -goog.html.SafeUrl.prototype.implementsGoogStringTypedString = !0; - -goog.html.SafeUrl.prototype.getTypedStringValue = function () { - return this.privateDoNotAccessOrElseSafeUrlWrappedValue_.toString(); -}; - -goog.html.SafeUrl.prototype.implementsGoogI18nBidiDirectionalString = !0; - -goog.html.SafeUrl.prototype.getDirection = function () { - return goog.i18n.bidi.Dir.LTR; -}; - -goog.DEBUG && (goog.html.SafeUrl.prototype.toString = function () { - return "SafeUrl{" + this.privateDoNotAccessOrElseSafeUrlWrappedValue_ + "}"; -}); - -goog.html.SafeUrl.unwrap = function (a) { - return goog.html.SafeUrl.unwrapTrustedURL(a).toString(); -}; - -goog.html.SafeUrl.unwrapTrustedURL = function (a) { - if (a instanceof goog.html.SafeUrl && a.constructor === goog.html.SafeUrl && a.SAFE_URL_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_ === goog.html.SafeUrl.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_) return a.privateDoNotAccessOrElseSafeUrlWrappedValue_; - goog.asserts.fail("expected object of type SafeUrl, got '" + a + "' of type " + goog.typeOf(a)); - return "type_error:SafeUrl"; -}; - -goog.html.SafeUrl.fromConstant = function (a) { - return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(goog.string.Const.unwrap(a)); -}; - -goog.html.SAFE_MIME_TYPE_PATTERN_ = /^(?:audio\/(?:3gpp2|3gpp|aac|L16|midi|mp3|mp4|mpeg|oga|ogg|opus|x-m4a|x-wav|wav|webm)|image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp|x-icon)|text\/csv|video\/(?:mpeg|mp4|ogg|webm|quicktime))(?:;\w+=(?:\w+|"[\w;=]+"))*$/i; - -goog.html.SafeUrl.isSafeMimeType = function (a) { - return goog.html.SAFE_MIME_TYPE_PATTERN_.test(a); -}; - -goog.html.SafeUrl.fromBlob = function (a) { - a = goog.html.SAFE_MIME_TYPE_PATTERN_.test(a.type) ? goog.fs.url.createObjectUrl(a) : goog.html.SafeUrl.INNOCUOUS_STRING; - return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(a); -}; - -goog.html.DATA_URL_PATTERN_ = /^data:([^,]*);base64,[a-z0-9+\/]+=*$/i; - -goog.html.SafeUrl.fromDataUrl = function (a) { - a = a.replace(/(%0A|%0D)/g, ""); - var b = a.match(goog.html.DATA_URL_PATTERN_); - b = b && goog.html.SAFE_MIME_TYPE_PATTERN_.test(b[1]); - return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(b ? a : goog.html.SafeUrl.INNOCUOUS_STRING); -}; - -goog.html.SafeUrl.fromTelUrl = function (a) { - goog.string.internal.caseInsensitiveStartsWith(a, "tel:") || (a = goog.html.SafeUrl.INNOCUOUS_STRING); - return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(a); -}; - -goog.html.SIP_URL_PATTERN_ = /^sip[s]?:[+a-z0-9_.!$%&'*\/=^`{|}~-]+@([a-z0-9-]+\.)+[a-z0-9]{2,63}$/i; - -goog.html.SafeUrl.fromSipUrl = function (a) { - goog.html.SIP_URL_PATTERN_.test(decodeURIComponent(a)) || (a = goog.html.SafeUrl.INNOCUOUS_STRING); - return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(a); -}; - -goog.html.SafeUrl.fromFacebookMessengerUrl = function (a) { - goog.string.internal.caseInsensitiveStartsWith(a, "fb-messenger://share") || (a = goog.html.SafeUrl.INNOCUOUS_STRING); - return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(a); -}; - -goog.html.SafeUrl.fromWhatsAppUrl = function (a) { - goog.string.internal.caseInsensitiveStartsWith(a, "whatsapp://send") || (a = goog.html.SafeUrl.INNOCUOUS_STRING); - return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(a); -}; - -goog.html.SafeUrl.fromSmsUrl = function (a) { - goog.string.internal.caseInsensitiveStartsWith(a, "sms:") && goog.html.SafeUrl.isSmsUrlBodyValid_(a) || (a = goog.html.SafeUrl.INNOCUOUS_STRING); - return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(a); -}; - -goog.html.SafeUrl.isSmsUrlBodyValid_ = function (a) { - var b = a.indexOf("#"); - 0 < b && (a = a.substring(0, b)); - b = a.match(/[?&]body=/gi); - if (!b) return !0; - if (1 < b.length) return !1; - a = a.match(/[?&]body=([^&]*)/)[1]; - if (!a) return !0; - - try { - decodeURIComponent(a); - } catch (c) { - return !1; - } - - return /^(?:[a-z0-9\-_.~]|%[0-9a-f]{2})+$/i.test(a); -}; - -goog.html.SafeUrl.fromSshUrl = function (a) { - goog.string.internal.caseInsensitiveStartsWith(a, "ssh://") || (a = goog.html.SafeUrl.INNOCUOUS_STRING); - return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(a); -}; - -goog.html.SafeUrl.sanitizeChromeExtensionUrl = function (a, b) { - return goog.html.SafeUrl.sanitizeExtensionUrl_(/^chrome-extension:\/\/([^\/]+)\//, a, b); -}; - -goog.html.SafeUrl.sanitizeFirefoxExtensionUrl = function (a, b) { - return goog.html.SafeUrl.sanitizeExtensionUrl_(/^moz-extension:\/\/([^\/]+)\//, a, b); -}; - -goog.html.SafeUrl.sanitizeEdgeExtensionUrl = function (a, b) { - return goog.html.SafeUrl.sanitizeExtensionUrl_(/^ms-browser-extension:\/\/([^\/]+)\//, a, b); -}; - -goog.html.SafeUrl.sanitizeExtensionUrl_ = function (a, b, c) { - (a = a.exec(b)) ? (a = a[1], -1 == (c instanceof goog.string.Const ? [goog.string.Const.unwrap(c)] : c.map(function (a) { - return goog.string.Const.unwrap(a); - })).indexOf(a) && (b = goog.html.SafeUrl.INNOCUOUS_STRING)) : b = goog.html.SafeUrl.INNOCUOUS_STRING; - return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(b); -}; - -goog.html.SafeUrl.fromTrustedResourceUrl = function (a) { - return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(goog.html.TrustedResourceUrl.unwrap(a)); -}; - -goog.html.SAFE_URL_PATTERN_ = /^(?:(?:https?|mailto|ftp):|[^:/?#]*(?:[/?#]|$))/i; -goog.html.SafeUrl.SAFE_URL_PATTERN = goog.html.SAFE_URL_PATTERN_; - -goog.html.SafeUrl.sanitize = function (a) { - if (a instanceof goog.html.SafeUrl) return a; - a = "object" == typeof a && a.implementsGoogStringTypedString ? a.getTypedStringValue() : String(a); - goog.html.SAFE_URL_PATTERN_.test(a) || (a = goog.html.SafeUrl.INNOCUOUS_STRING); - return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(a); -}; - -goog.html.SafeUrl.sanitizeAssertUnchanged = function (a, b) { - if (a instanceof goog.html.SafeUrl) return a; - a = "object" == typeof a && a.implementsGoogStringTypedString ? a.getTypedStringValue() : String(a); - if (b && /^data:/i.test(a) && (b = goog.html.SafeUrl.fromDataUrl(a), b.getTypedStringValue() == a)) return b; - goog.asserts.assert(goog.html.SAFE_URL_PATTERN_.test(a), "%s does not match the safe URL pattern", a) || (a = goog.html.SafeUrl.INNOCUOUS_STRING); - return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(a); -}; - -goog.html.SafeUrl.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_ = {}; - -goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse = function (a) { - var b = new goog.html.SafeUrl(); - b.privateDoNotAccessOrElseSafeUrlWrappedValue_ = goog.html.trustedtypes.PRIVATE_DO_NOT_ACCESS_OR_ELSE_POLICY ? goog.html.trustedtypes.PRIVATE_DO_NOT_ACCESS_OR_ELSE_POLICY.createURL(a) : a; - return b; -}; - -goog.html.SafeUrl.ABOUT_BLANK = goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse("about:blank"); - -goog.html.SafeStyle = function () { - this.privateDoNotAccessOrElseSafeStyleWrappedValue_ = ""; - this.SAFE_STYLE_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_ = goog.html.SafeStyle.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_; -}; - -goog.html.SafeStyle.prototype.implementsGoogStringTypedString = !0; -goog.html.SafeStyle.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_ = {}; - -goog.html.SafeStyle.fromConstant = function (a) { - a = goog.string.Const.unwrap(a); - if (0 === a.length) return goog.html.SafeStyle.EMPTY; - goog.asserts.assert(goog.string.internal.endsWith(a, ";"), "Last character of style string is not ';': " + a); - goog.asserts.assert(goog.string.internal.contains(a, ":"), "Style string must contain at least one ':', to specify a \"name: value\" pair: " + a); - return goog.html.SafeStyle.createSafeStyleSecurityPrivateDoNotAccessOrElse(a); -}; - -goog.html.SafeStyle.prototype.getTypedStringValue = function () { - return this.privateDoNotAccessOrElseSafeStyleWrappedValue_; -}; - -goog.DEBUG && (goog.html.SafeStyle.prototype.toString = function () { - return "SafeStyle{" + this.privateDoNotAccessOrElseSafeStyleWrappedValue_ + "}"; -}); - -goog.html.SafeStyle.unwrap = function (a) { - if (a instanceof goog.html.SafeStyle && a.constructor === goog.html.SafeStyle && a.SAFE_STYLE_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_ === goog.html.SafeStyle.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_) return a.privateDoNotAccessOrElseSafeStyleWrappedValue_; - goog.asserts.fail("expected object of type SafeStyle, got '" + a + "' of type " + goog.typeOf(a)); - return "type_error:SafeStyle"; -}; - -goog.html.SafeStyle.createSafeStyleSecurityPrivateDoNotAccessOrElse = function (a) { - return new goog.html.SafeStyle().initSecurityPrivateDoNotAccessOrElse_(a); -}; - -goog.html.SafeStyle.prototype.initSecurityPrivateDoNotAccessOrElse_ = function (a) { - this.privateDoNotAccessOrElseSafeStyleWrappedValue_ = a; - return this; -}; - -goog.html.SafeStyle.EMPTY = goog.html.SafeStyle.createSafeStyleSecurityPrivateDoNotAccessOrElse(""); -goog.html.SafeStyle.INNOCUOUS_STRING = "zClosurez"; - -goog.html.SafeStyle.create = function (a) { - var b = "", - c; - - for (c in a) { - if (!/^[-_a-zA-Z0-9]+$/.test(c)) throw Error("Name allows only [-_a-zA-Z0-9], got: " + c); - var d = a[c]; - null != d && (d = goog.isArray(d) ? goog.array.map(d, goog.html.SafeStyle.sanitizePropertyValue_).join(" ") : goog.html.SafeStyle.sanitizePropertyValue_(d), b += c + ":" + d + ";"); - } - - return b ? goog.html.SafeStyle.createSafeStyleSecurityPrivateDoNotAccessOrElse(b) : goog.html.SafeStyle.EMPTY; -}; - -goog.html.SafeStyle.sanitizePropertyValue_ = function (a) { - if (a instanceof goog.html.SafeUrl) return 'url("' + goog.html.SafeUrl.unwrap(a).replace(/</g, "%3c").replace(/[\\"]/g, "\\$&") + '")'; - a = a instanceof goog.string.Const ? goog.string.Const.unwrap(a) : goog.html.SafeStyle.sanitizePropertyValueString_(String(a)); - if (/[{;}]/.test(a)) throw new goog.asserts.AssertionError("Value does not allow [{;}], got: %s.", [a]); - return a; -}; - -goog.html.SafeStyle.sanitizePropertyValueString_ = function (a) { - var b = a.replace(goog.html.SafeStyle.FUNCTIONS_RE_, "$1").replace(goog.html.SafeStyle.FUNCTIONS_RE_, "$1").replace(goog.html.SafeStyle.URL_RE_, "url"); - - if (goog.html.SafeStyle.VALUE_RE_.test(b)) { - if (goog.html.SafeStyle.COMMENT_RE_.test(a)) return goog.asserts.fail("String value disallows comments, got: " + a), goog.html.SafeStyle.INNOCUOUS_STRING; - if (!goog.html.SafeStyle.hasBalancedQuotes_(a)) return goog.asserts.fail("String value requires balanced quotes, got: " + a), goog.html.SafeStyle.INNOCUOUS_STRING; - if (!goog.html.SafeStyle.hasBalancedSquareBrackets_(a)) return goog.asserts.fail("String value requires balanced square brackets and one identifier per pair of brackets, got: " + a), goog.html.SafeStyle.INNOCUOUS_STRING; - } else return goog.asserts.fail("String value allows only " + goog.html.SafeStyle.VALUE_ALLOWED_CHARS_ + " and simple functions, got: " + a), goog.html.SafeStyle.INNOCUOUS_STRING; - - return goog.html.SafeStyle.sanitizeUrl_(a); -}; - -goog.html.SafeStyle.hasBalancedQuotes_ = function (a) { - for (var b = !0, c = !0, d = 0; d < a.length; d++) { - var e = a.charAt(d); - "'" == e && c ? b = !b : '"' == e && b && (c = !c); - } - - return b && c; -}; - -goog.html.SafeStyle.hasBalancedSquareBrackets_ = function (a) { - for (var b = !0, c = /^[-_a-zA-Z0-9]$/, d = 0; d < a.length; d++) { - var e = a.charAt(d); - - if ("]" == e) { - if (b) return !1; - b = !0; - } else if ("[" == e) { - if (!b) return !1; - b = !1; - } else if (!b && !c.test(e)) return !1; - } - - return b; -}; - -goog.html.SafeStyle.VALUE_ALLOWED_CHARS_ = "[-,.\"'%_!# a-zA-Z0-9\\[\\]]"; -goog.html.SafeStyle.VALUE_RE_ = new RegExp("^" + goog.html.SafeStyle.VALUE_ALLOWED_CHARS_ + "+$"); -goog.html.SafeStyle.URL_RE_ = /\b(url\([ \t\n]*)('[ -&(-\[\]-~]*'|"[ !#-\[\]-~]*"|[!#-&*-\[\]-~]*)([ \t\n]*\))/g; -goog.html.SafeStyle.FUNCTIONS_RE_ = /\b(hsl|hsla|rgb|rgba|matrix|calc|minmax|fit-content|repeat|(rotate|scale|translate)(X|Y|Z|3d)?)\([-+*/0-9a-z.%\[\], ]+\)/g; -goog.html.SafeStyle.COMMENT_RE_ = /\/\*/; - -goog.html.SafeStyle.sanitizeUrl_ = function (a) { - return a.replace(goog.html.SafeStyle.URL_RE_, function (a, c, d, e) { - var b = ""; - d = d.replace(/^(['"])(.*)\1$/, function (a, c, d) { - b = c; - return d; - }); - a = goog.html.SafeUrl.sanitize(d).getTypedStringValue(); - return c + b + a + b + e; - }); -}; - -goog.html.SafeStyle.concat = function (a) { - var b = "", - c = function (a) { - goog.isArray(a) ? goog.array.forEach(a, c) : b += goog.html.SafeStyle.unwrap(a); - }; - - goog.array.forEach(arguments, c); - return b ? goog.html.SafeStyle.createSafeStyleSecurityPrivateDoNotAccessOrElse(b) : goog.html.SafeStyle.EMPTY; -}; - -goog.html.SafeStyleSheet = function () { - this.privateDoNotAccessOrElseSafeStyleSheetWrappedValue_ = ""; - this.SAFE_STYLE_SHEET_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_ = goog.html.SafeStyleSheet.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_; -}; - -goog.html.SafeStyleSheet.prototype.implementsGoogStringTypedString = !0; -goog.html.SafeStyleSheet.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_ = {}; - -goog.html.SafeStyleSheet.createRule = function (a, b) { - if (goog.string.internal.contains(a, "<")) throw Error("Selector does not allow '<', got: " + a); - var c = a.replace(/('|")((?!\1)[^\r\n\f\\]|\\[\s\S])*\1/g, ""); - if (!/^[-_a-zA-Z0-9#.:* ,>+~[\]()=^$|]+$/.test(c)) throw Error("Selector allows only [-_a-zA-Z0-9#.:* ,>+~[\\]()=^$|] and strings, got: " + a); - if (!goog.html.SafeStyleSheet.hasBalancedBrackets_(c)) throw Error("() and [] in selector must be balanced, got: " + a); - b instanceof goog.html.SafeStyle || (b = goog.html.SafeStyle.create(b)); - a = a + "{" + goog.html.SafeStyle.unwrap(b).replace(/</g, "\\3C ") + "}"; - return goog.html.SafeStyleSheet.createSafeStyleSheetSecurityPrivateDoNotAccessOrElse(a); -}; - -goog.html.SafeStyleSheet.hasBalancedBrackets_ = function (a) { - for (var b = { - "(": ")", - "[": "]" - }, c = [], d = 0; d < a.length; d++) { - var e = a[d]; - if (b[e]) c.push(b[e]);else if (goog.object.contains(b, e) && c.pop() != e) return !1; - } - - return 0 == c.length; -}; - -goog.html.SafeStyleSheet.concat = function (a) { - var b = "", - c = function (a) { - goog.isArray(a) ? goog.array.forEach(a, c) : b += goog.html.SafeStyleSheet.unwrap(a); - }; - - goog.array.forEach(arguments, c); - return goog.html.SafeStyleSheet.createSafeStyleSheetSecurityPrivateDoNotAccessOrElse(b); -}; - -goog.html.SafeStyleSheet.fromConstant = function (a) { - a = goog.string.Const.unwrap(a); - if (0 === a.length) return goog.html.SafeStyleSheet.EMPTY; - goog.asserts.assert(!goog.string.internal.contains(a, "<"), "Forbidden '<' character in style sheet string: " + a); - return goog.html.SafeStyleSheet.createSafeStyleSheetSecurityPrivateDoNotAccessOrElse(a); -}; - -goog.html.SafeStyleSheet.prototype.getTypedStringValue = function () { - return this.privateDoNotAccessOrElseSafeStyleSheetWrappedValue_; -}; - -goog.DEBUG && (goog.html.SafeStyleSheet.prototype.toString = function () { - return "SafeStyleSheet{" + this.privateDoNotAccessOrElseSafeStyleSheetWrappedValue_ + "}"; -}); - -goog.html.SafeStyleSheet.unwrap = function (a) { - if (a instanceof goog.html.SafeStyleSheet && a.constructor === goog.html.SafeStyleSheet && a.SAFE_STYLE_SHEET_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_ === goog.html.SafeStyleSheet.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_) return a.privateDoNotAccessOrElseSafeStyleSheetWrappedValue_; - goog.asserts.fail("expected object of type SafeStyleSheet, got '" + a + "' of type " + goog.typeOf(a)); - return "type_error:SafeStyleSheet"; -}; - -goog.html.SafeStyleSheet.createSafeStyleSheetSecurityPrivateDoNotAccessOrElse = function (a) { - return new goog.html.SafeStyleSheet().initSecurityPrivateDoNotAccessOrElse_(a); -}; - -goog.html.SafeStyleSheet.prototype.initSecurityPrivateDoNotAccessOrElse_ = function (a) { - this.privateDoNotAccessOrElseSafeStyleSheetWrappedValue_ = a; - return this; -}; - -goog.html.SafeStyleSheet.EMPTY = goog.html.SafeStyleSheet.createSafeStyleSheetSecurityPrivateDoNotAccessOrElse(""); -goog.labs = {}; -goog.labs.userAgent = {}; -goog.labs.userAgent.util = {}; - -goog.labs.userAgent.util.getNativeUserAgentString_ = function () { - var a = goog.labs.userAgent.util.getNavigator_(); - return a && (a = a.userAgent) ? a : ""; -}; - -goog.labs.userAgent.util.getNavigator_ = function () { - return goog.global.navigator; -}; - -goog.labs.userAgent.util.userAgent_ = goog.labs.userAgent.util.getNativeUserAgentString_(); - -goog.labs.userAgent.util.setUserAgent = function (a) { - goog.labs.userAgent.util.userAgent_ = a || goog.labs.userAgent.util.getNativeUserAgentString_(); -}; - -goog.labs.userAgent.util.getUserAgent = function () { - return goog.labs.userAgent.util.userAgent_; -}; - -goog.labs.userAgent.util.matchUserAgent = function (a) { - var b = goog.labs.userAgent.util.getUserAgent(); - return goog.string.internal.contains(b, a); -}; - -goog.labs.userAgent.util.matchUserAgentIgnoreCase = function (a) { - var b = goog.labs.userAgent.util.getUserAgent(); - return goog.string.internal.caseInsensitiveContains(b, a); -}; - -goog.labs.userAgent.util.extractVersionTuples = function (a) { - for (var b = /(\w[\w ]+)\/([^\s]+)\s*(?:\((.*?)\))?/g, c = [], d; d = b.exec(a);) c.push([d[1], d[2], d[3] || void 0]); - - return c; -}; - -goog.labs.userAgent.browser = {}; - -goog.labs.userAgent.browser.matchOpera_ = function () { - return goog.labs.userAgent.util.matchUserAgent("Opera"); -}; - -goog.labs.userAgent.browser.matchIE_ = function () { - return goog.labs.userAgent.util.matchUserAgent("Trident") || goog.labs.userAgent.util.matchUserAgent("MSIE"); -}; - -goog.labs.userAgent.browser.matchEdgeHtml_ = function () { - return goog.labs.userAgent.util.matchUserAgent("Edge"); -}; - -goog.labs.userAgent.browser.matchEdgeChromium_ = function () { - return goog.labs.userAgent.util.matchUserAgent("Edg/"); -}; - -goog.labs.userAgent.browser.matchOperaChromium_ = function () { - return goog.labs.userAgent.util.matchUserAgent("OPR"); -}; - -goog.labs.userAgent.browser.matchFirefox_ = function () { - return goog.labs.userAgent.util.matchUserAgent("Firefox") || goog.labs.userAgent.util.matchUserAgent("FxiOS"); -}; - -goog.labs.userAgent.browser.matchSafari_ = function () { - return goog.labs.userAgent.util.matchUserAgent("Safari") && !(goog.labs.userAgent.browser.matchChrome_() || goog.labs.userAgent.browser.matchCoast_() || goog.labs.userAgent.browser.matchOpera_() || goog.labs.userAgent.browser.matchEdgeHtml_() || goog.labs.userAgent.browser.matchEdgeChromium_() || goog.labs.userAgent.browser.matchOperaChromium_() || goog.labs.userAgent.browser.matchFirefox_() || goog.labs.userAgent.browser.isSilk() || goog.labs.userAgent.util.matchUserAgent("Android")); -}; - -goog.labs.userAgent.browser.matchCoast_ = function () { - return goog.labs.userAgent.util.matchUserAgent("Coast"); -}; - -goog.labs.userAgent.browser.matchIosWebview_ = function () { - return (goog.labs.userAgent.util.matchUserAgent("iPad") || goog.labs.userAgent.util.matchUserAgent("iPhone")) && !goog.labs.userAgent.browser.matchSafari_() && !goog.labs.userAgent.browser.matchChrome_() && !goog.labs.userAgent.browser.matchCoast_() && !goog.labs.userAgent.browser.matchFirefox_() && goog.labs.userAgent.util.matchUserAgent("AppleWebKit"); -}; - -goog.labs.userAgent.browser.matchChrome_ = function () { - return (goog.labs.userAgent.util.matchUserAgent("Chrome") || goog.labs.userAgent.util.matchUserAgent("CriOS")) && !goog.labs.userAgent.browser.matchEdgeHtml_(); -}; - -goog.labs.userAgent.browser.matchAndroidBrowser_ = function () { - return goog.labs.userAgent.util.matchUserAgent("Android") && !(goog.labs.userAgent.browser.isChrome() || goog.labs.userAgent.browser.isFirefox() || goog.labs.userAgent.browser.isOpera() || goog.labs.userAgent.browser.isSilk()); -}; - -goog.labs.userAgent.browser.isOpera = goog.labs.userAgent.browser.matchOpera_; -goog.labs.userAgent.browser.isIE = goog.labs.userAgent.browser.matchIE_; -goog.labs.userAgent.browser.isEdge = goog.labs.userAgent.browser.matchEdgeHtml_; -goog.labs.userAgent.browser.isEdgeChromium = goog.labs.userAgent.browser.matchEdgeChromium_; -goog.labs.userAgent.browser.isOperaChromium = goog.labs.userAgent.browser.matchOperaChromium_; -goog.labs.userAgent.browser.isFirefox = goog.labs.userAgent.browser.matchFirefox_; -goog.labs.userAgent.browser.isSafari = goog.labs.userAgent.browser.matchSafari_; -goog.labs.userAgent.browser.isCoast = goog.labs.userAgent.browser.matchCoast_; -goog.labs.userAgent.browser.isIosWebview = goog.labs.userAgent.browser.matchIosWebview_; -goog.labs.userAgent.browser.isChrome = goog.labs.userAgent.browser.matchChrome_; -goog.labs.userAgent.browser.isAndroidBrowser = goog.labs.userAgent.browser.matchAndroidBrowser_; - -goog.labs.userAgent.browser.isSilk = function () { - return goog.labs.userAgent.util.matchUserAgent("Silk"); -}; - -goog.labs.userAgent.browser.getVersion = function () { - function a(a) { - a = goog.array.find(a, d); - return c[a] || ""; - } - - var b = goog.labs.userAgent.util.getUserAgent(); - if (goog.labs.userAgent.browser.isIE()) return goog.labs.userAgent.browser.getIEVersion_(b); - b = goog.labs.userAgent.util.extractVersionTuples(b); - var c = {}; - goog.array.forEach(b, function (a) { - c[a[0]] = a[1]; - }); - var d = goog.partial(goog.object.containsKey, c); - return goog.labs.userAgent.browser.isOpera() ? a(["Version", "Opera"]) : goog.labs.userAgent.browser.isEdge() ? a(["Edge"]) : goog.labs.userAgent.browser.isEdgeChromium() ? a(["Edg"]) : goog.labs.userAgent.browser.isChrome() ? a(["Chrome", "CriOS"]) : (b = b[2]) && b[1] || ""; -}; - -goog.labs.userAgent.browser.isVersionOrHigher = function (a) { - return 0 <= goog.string.internal.compareVersions(goog.labs.userAgent.browser.getVersion(), a); -}; - -goog.labs.userAgent.browser.getIEVersion_ = function (a) { - var b = /rv: *([\d\.]*)/.exec(a); - if (b && b[1]) return b[1]; - b = ""; - var c = /MSIE +([\d\.]+)/.exec(a); - if (c && c[1]) if (a = /Trident\/(\d.\d)/.exec(a), "7.0" == c[1]) { - if (a && a[1]) switch (a[1]) { - case "4.0": - b = "8.0"; - break; - - case "5.0": - b = "9.0"; - break; - - case "6.0": - b = "10.0"; - break; - - case "7.0": - b = "11.0"; - } else b = "7.0"; - } else b = c[1]; - return b; -}; - -goog.html.SafeHtml = function () { - this.privateDoNotAccessOrElseSafeHtmlWrappedValue_ = ""; - this.SAFE_HTML_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_ = goog.html.SafeHtml.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_; - this.dir_ = null; -}; - -goog.html.SafeHtml.prototype.implementsGoogI18nBidiDirectionalString = !0; - -goog.html.SafeHtml.prototype.getDirection = function () { - return this.dir_; -}; - -goog.html.SafeHtml.prototype.implementsGoogStringTypedString = !0; - -goog.html.SafeHtml.prototype.getTypedStringValue = function () { - return this.privateDoNotAccessOrElseSafeHtmlWrappedValue_.toString(); -}; - -goog.DEBUG && (goog.html.SafeHtml.prototype.toString = function () { - return "SafeHtml{" + this.privateDoNotAccessOrElseSafeHtmlWrappedValue_ + "}"; -}); - -goog.html.SafeHtml.unwrap = function (a) { - return goog.html.SafeHtml.unwrapTrustedHTML(a).toString(); -}; - -goog.html.SafeHtml.unwrapTrustedHTML = function (a) { - if (a instanceof goog.html.SafeHtml && a.constructor === goog.html.SafeHtml && a.SAFE_HTML_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_ === goog.html.SafeHtml.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_) return a.privateDoNotAccessOrElseSafeHtmlWrappedValue_; - goog.asserts.fail("expected object of type SafeHtml, got '" + a + "' of type " + goog.typeOf(a)); - return "type_error:SafeHtml"; -}; - -goog.html.SafeHtml.htmlEscape = function (a) { - if (a instanceof goog.html.SafeHtml) return a; - var b = "object" == typeof a, - c = null; - b && a.implementsGoogI18nBidiDirectionalString && (c = a.getDirection()); - a = b && a.implementsGoogStringTypedString ? a.getTypedStringValue() : String(a); - return goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse(goog.string.internal.htmlEscape(a), c); -}; - -goog.html.SafeHtml.htmlEscapePreservingNewlines = function (a) { - if (a instanceof goog.html.SafeHtml) return a; - a = goog.html.SafeHtml.htmlEscape(a); - return goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse(goog.string.internal.newLineToBr(goog.html.SafeHtml.unwrap(a)), a.getDirection()); -}; - -goog.html.SafeHtml.htmlEscapePreservingNewlinesAndSpaces = function (a) { - if (a instanceof goog.html.SafeHtml) return a; - a = goog.html.SafeHtml.htmlEscape(a); - return goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse(goog.string.internal.whitespaceEscape(goog.html.SafeHtml.unwrap(a)), a.getDirection()); -}; - -goog.html.SafeHtml.from = goog.html.SafeHtml.htmlEscape; -goog.html.SafeHtml.VALID_NAMES_IN_TAG_ = /^[a-zA-Z0-9-]+$/; -goog.html.SafeHtml.URL_ATTRIBUTES_ = { - action: !0, - cite: !0, - data: !0, - formaction: !0, - href: !0, - manifest: !0, - poster: !0, - src: !0 -}; -goog.html.SafeHtml.NOT_ALLOWED_TAG_NAMES_ = { - APPLET: !0, - BASE: !0, - EMBED: !0, - IFRAME: !0, - LINK: !0, - MATH: !0, - META: !0, - OBJECT: !0, - SCRIPT: !0, - STYLE: !0, - SVG: !0, - TEMPLATE: !0 -}; - -goog.html.SafeHtml.create = function (a, b, c) { - goog.html.SafeHtml.verifyTagName(String(a)); - return goog.html.SafeHtml.createSafeHtmlTagSecurityPrivateDoNotAccessOrElse(String(a), b, c); -}; - -goog.html.SafeHtml.verifyTagName = function (a) { - if (!goog.html.SafeHtml.VALID_NAMES_IN_TAG_.test(a)) throw Error("Invalid tag name <" + a + ">."); - if (a.toUpperCase() in goog.html.SafeHtml.NOT_ALLOWED_TAG_NAMES_) throw Error("Tag name <" + a + "> is not allowed for SafeHtml."); -}; - -goog.html.SafeHtml.createIframe = function (a, b, c, d) { - a && goog.html.TrustedResourceUrl.unwrap(a); - var e = {}; - e.src = a || null; - e.srcdoc = b && goog.html.SafeHtml.unwrap(b); - a = goog.html.SafeHtml.combineAttributes(e, { - sandbox: "" - }, c); - return goog.html.SafeHtml.createSafeHtmlTagSecurityPrivateDoNotAccessOrElse("iframe", a, d); -}; - -goog.html.SafeHtml.createSandboxIframe = function (a, b, c, d) { - if (!goog.html.SafeHtml.canUseSandboxIframe()) throw Error("The browser does not support sandboxed iframes."); - var e = {}; - e.src = a ? goog.html.SafeUrl.unwrap(goog.html.SafeUrl.sanitize(a)) : null; - e.srcdoc = b || null; - e.sandbox = ""; - a = goog.html.SafeHtml.combineAttributes(e, {}, c); - return goog.html.SafeHtml.createSafeHtmlTagSecurityPrivateDoNotAccessOrElse("iframe", a, d); -}; - -goog.html.SafeHtml.canUseSandboxIframe = function () { - return goog.global.HTMLIFrameElement && "sandbox" in goog.global.HTMLIFrameElement.prototype; -}; - -goog.html.SafeHtml.createScriptSrc = function (a, b) { - goog.html.TrustedResourceUrl.unwrap(a); - a = goog.html.SafeHtml.combineAttributes({ - src: a - }, {}, b); - return goog.html.SafeHtml.createSafeHtmlTagSecurityPrivateDoNotAccessOrElse("script", a); -}; - -goog.html.SafeHtml.createScript = function (a, b) { - for (var c in b) { - var d = c.toLowerCase(); - if ("language" == d || "src" == d || "text" == d || "type" == d) throw Error('Cannot set "' + d + '" attribute'); - } - - c = ""; - a = goog.array.concat(a); - - for (d = 0; d < a.length; d++) c += goog.html.SafeScript.unwrap(a[d]); - - a = goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse(c, goog.i18n.bidi.Dir.NEUTRAL); - return goog.html.SafeHtml.createSafeHtmlTagSecurityPrivateDoNotAccessOrElse("script", b, a); -}; - -goog.html.SafeHtml.createStyle = function (a, b) { - b = goog.html.SafeHtml.combineAttributes({ - type: "text/css" - }, {}, b); - var c = ""; - a = goog.array.concat(a); - - for (var d = 0; d < a.length; d++) c += goog.html.SafeStyleSheet.unwrap(a[d]); - - a = goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse(c, goog.i18n.bidi.Dir.NEUTRAL); - return goog.html.SafeHtml.createSafeHtmlTagSecurityPrivateDoNotAccessOrElse("style", b, a); -}; - -goog.html.SafeHtml.createMetaRefresh = function (a, b) { - a = goog.html.SafeUrl.unwrap(goog.html.SafeUrl.sanitize(a)); - (goog.labs.userAgent.browser.isIE() || goog.labs.userAgent.browser.isEdge()) && goog.string.internal.contains(a, ";") && (a = "'" + a.replace(/'/g, "%27") + "'"); - return goog.html.SafeHtml.createSafeHtmlTagSecurityPrivateDoNotAccessOrElse("meta", { - "http-equiv": "refresh", - content: (b || 0) + "; url=" + a - }); -}; - -goog.html.SafeHtml.getAttrNameAndValue_ = function (a, b, c) { - if (c instanceof goog.string.Const) c = goog.string.Const.unwrap(c);else if ("style" == b.toLowerCase()) c = goog.html.SafeHtml.getStyleValue_(c);else { - if (/^on/i.test(b)) throw Error('Attribute "' + b + '" requires goog.string.Const value, "' + c + '" given.'); - if (b.toLowerCase() in goog.html.SafeHtml.URL_ATTRIBUTES_) if (c instanceof goog.html.TrustedResourceUrl) c = goog.html.TrustedResourceUrl.unwrap(c);else if (c instanceof goog.html.SafeUrl) c = goog.html.SafeUrl.unwrap(c);else if (goog.isString(c)) c = goog.html.SafeUrl.sanitize(c).getTypedStringValue();else throw Error('Attribute "' + b + '" on tag "' + a + '" requires goog.html.SafeUrl, goog.string.Const, or string, value "' + c + '" given.'); - } - c.implementsGoogStringTypedString && (c = c.getTypedStringValue()); - goog.asserts.assert(goog.isString(c) || goog.isNumber(c), "String or number value expected, got " + typeof c + " with value: " + c); - return b + '="' + goog.string.internal.htmlEscape(String(c)) + '"'; -}; - -goog.html.SafeHtml.getStyleValue_ = function (a) { - if (!goog.isObject(a)) throw Error('The "style" attribute requires goog.html.SafeStyle or map of style properties, ' + typeof a + " given: " + a); - a instanceof goog.html.SafeStyle || (a = goog.html.SafeStyle.create(a)); - return goog.html.SafeStyle.unwrap(a); -}; - -goog.html.SafeHtml.createWithDir = function (a, b, c, d) { - b = goog.html.SafeHtml.create(b, c, d); - b.dir_ = a; - return b; -}; - -goog.html.SafeHtml.join = function (a, b) { - a = goog.html.SafeHtml.htmlEscape(a); - - var c = a.getDirection(), - d = [], - e = function (a) { - goog.isArray(a) ? goog.array.forEach(a, e) : (a = goog.html.SafeHtml.htmlEscape(a), d.push(goog.html.SafeHtml.unwrap(a)), a = a.getDirection(), c == goog.i18n.bidi.Dir.NEUTRAL ? c = a : a != goog.i18n.bidi.Dir.NEUTRAL && c != a && (c = null)); - }; - - goog.array.forEach(b, e); - return goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse(d.join(goog.html.SafeHtml.unwrap(a)), c); -}; - -goog.html.SafeHtml.concat = function (a) { - return goog.html.SafeHtml.join(goog.html.SafeHtml.EMPTY, Array.prototype.slice.call(arguments)); -}; - -goog.html.SafeHtml.concatWithDir = function (a, b) { - var c = goog.html.SafeHtml.concat(goog.array.slice(arguments, 1)); - c.dir_ = a; - return c; -}; - -goog.html.SafeHtml.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_ = {}; - -goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse = function (a, b) { - return new goog.html.SafeHtml().initSecurityPrivateDoNotAccessOrElse_(a, b); -}; - -goog.html.SafeHtml.prototype.initSecurityPrivateDoNotAccessOrElse_ = function (a, b) { - this.privateDoNotAccessOrElseSafeHtmlWrappedValue_ = goog.html.trustedtypes.PRIVATE_DO_NOT_ACCESS_OR_ELSE_POLICY ? goog.html.trustedtypes.PRIVATE_DO_NOT_ACCESS_OR_ELSE_POLICY.createHTML(a) : a; - this.dir_ = b; - return this; -}; - -goog.html.SafeHtml.createSafeHtmlTagSecurityPrivateDoNotAccessOrElse = function (a, b, c) { - var d = null; - var e = "<" + a + goog.html.SafeHtml.stringifyAttributes(a, b); - goog.isDefAndNotNull(c) ? goog.isArray(c) || (c = [c]) : c = []; - goog.dom.tags.isVoidTag(a.toLowerCase()) ? (goog.asserts.assert(!c.length, "Void tag <" + a + "> does not allow content."), e += ">") : (d = goog.html.SafeHtml.concat(c), e += ">" + goog.html.SafeHtml.unwrap(d) + "</" + a + ">", d = d.getDirection()); - (a = b && b.dir) && (d = /^(ltr|rtl|auto)$/i.test(a) ? goog.i18n.bidi.Dir.NEUTRAL : null); - return goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse(e, d); -}; - -goog.html.SafeHtml.stringifyAttributes = function (a, b) { - var c = ""; - if (b) for (var d in b) { - if (!goog.html.SafeHtml.VALID_NAMES_IN_TAG_.test(d)) throw Error('Invalid attribute name "' + d + '".'); - var e = b[d]; - goog.isDefAndNotNull(e) && (c += " " + goog.html.SafeHtml.getAttrNameAndValue_(a, d, e)); - } - return c; -}; - -goog.html.SafeHtml.combineAttributes = function (a, b, c) { - var d = {}, - e; - - for (e in a) goog.asserts.assert(e.toLowerCase() == e, "Must be lower case"), d[e] = a[e]; - - for (e in b) goog.asserts.assert(e.toLowerCase() == e, "Must be lower case"), d[e] = b[e]; - - for (e in c) { - var f = e.toLowerCase(); - if (f in a) throw Error('Cannot override "' + f + '" attribute, got "' + e + '" with value "' + c[e] + '"'); - f in b && delete d[f]; - d[e] = c[e]; - } - - return d; -}; - -goog.html.SafeHtml.DOCTYPE_HTML = goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse("<!DOCTYPE html>", goog.i18n.bidi.Dir.NEUTRAL); -goog.html.SafeHtml.EMPTY = goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse("", goog.i18n.bidi.Dir.NEUTRAL); -goog.html.SafeHtml.BR = goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse("<br>", goog.i18n.bidi.Dir.NEUTRAL); -goog.html.uncheckedconversions = {}; - -goog.html.uncheckedconversions.safeHtmlFromStringKnownToSatisfyTypeContract = function (a, b, c) { - goog.asserts.assertString(goog.string.Const.unwrap(a), "must provide justification"); - goog.asserts.assert(!goog.string.internal.isEmptyOrWhitespace(goog.string.Const.unwrap(a)), "must provide non-empty justification"); - return goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse(b, c || null); -}; - -goog.html.uncheckedconversions.safeScriptFromStringKnownToSatisfyTypeContract = function (a, b) { - goog.asserts.assertString(goog.string.Const.unwrap(a), "must provide justification"); - goog.asserts.assert(!goog.string.internal.isEmptyOrWhitespace(goog.string.Const.unwrap(a)), "must provide non-empty justification"); - return goog.html.SafeScript.createSafeScriptSecurityPrivateDoNotAccessOrElse(b); -}; - -goog.html.uncheckedconversions.safeStyleFromStringKnownToSatisfyTypeContract = function (a, b) { - goog.asserts.assertString(goog.string.Const.unwrap(a), "must provide justification"); - goog.asserts.assert(!goog.string.internal.isEmptyOrWhitespace(goog.string.Const.unwrap(a)), "must provide non-empty justification"); - return goog.html.SafeStyle.createSafeStyleSecurityPrivateDoNotAccessOrElse(b); -}; - -goog.html.uncheckedconversions.safeStyleSheetFromStringKnownToSatisfyTypeContract = function (a, b) { - goog.asserts.assertString(goog.string.Const.unwrap(a), "must provide justification"); - goog.asserts.assert(!goog.string.internal.isEmptyOrWhitespace(goog.string.Const.unwrap(a)), "must provide non-empty justification"); - return goog.html.SafeStyleSheet.createSafeStyleSheetSecurityPrivateDoNotAccessOrElse(b); -}; - -goog.html.uncheckedconversions.safeUrlFromStringKnownToSatisfyTypeContract = function (a, b) { - goog.asserts.assertString(goog.string.Const.unwrap(a), "must provide justification"); - goog.asserts.assert(!goog.string.internal.isEmptyOrWhitespace(goog.string.Const.unwrap(a)), "must provide non-empty justification"); - return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(b); -}; - -goog.html.uncheckedconversions.trustedResourceUrlFromStringKnownToSatisfyTypeContract = function (a, b) { - goog.asserts.assertString(goog.string.Const.unwrap(a), "must provide justification"); - goog.asserts.assert(!goog.string.internal.isEmptyOrWhitespace(goog.string.Const.unwrap(a)), "must provide non-empty justification"); - return goog.html.TrustedResourceUrl.createTrustedResourceUrlSecurityPrivateDoNotAccessOrElse(b); -}; - -goog.dom.safe = {}; -goog.dom.safe.InsertAdjacentHtmlPosition = { - AFTERBEGIN: "afterbegin", - AFTEREND: "afterend", - BEFOREBEGIN: "beforebegin", - BEFOREEND: "beforeend" -}; - -goog.dom.safe.insertAdjacentHtml = function (a, b, c) { - a.insertAdjacentHTML(b, goog.html.SafeHtml.unwrapTrustedHTML(c)); -}; - -goog.dom.safe.SET_INNER_HTML_DISALLOWED_TAGS_ = { - MATH: !0, - SCRIPT: !0, - STYLE: !0, - SVG: !0, - TEMPLATE: !0 -}; -goog.dom.safe.isInnerHtmlCleanupRecursive_ = goog.functions.cacheReturnValue(function () { - if (goog.DEBUG && "undefined" === typeof document) return !1; - var a = document.createElement("div"), - b = document.createElement("div"); - b.appendChild(document.createElement("div")); - a.appendChild(b); - if (goog.DEBUG && !a.firstChild) return !1; - b = a.firstChild.firstChild; - a.innerHTML = goog.html.SafeHtml.unwrapTrustedHTML(goog.html.SafeHtml.EMPTY); - return !b.parentElement; -}); - -goog.dom.safe.unsafeSetInnerHtmlDoNotUseOrElse = function (a, b) { - if (goog.dom.safe.isInnerHtmlCleanupRecursive_()) for (; a.lastChild;) a.removeChild(a.lastChild); - a.innerHTML = goog.html.SafeHtml.unwrapTrustedHTML(b); -}; - -goog.dom.safe.setInnerHtml = function (a, b) { - if (goog.asserts.ENABLE_ASSERTS) { - var c = a.tagName.toUpperCase(); - if (goog.dom.safe.SET_INNER_HTML_DISALLOWED_TAGS_[c]) throw Error("goog.dom.safe.setInnerHtml cannot be used to set content of " + a.tagName + "."); - } - - goog.dom.safe.unsafeSetInnerHtmlDoNotUseOrElse(a, b); -}; - -goog.dom.safe.setOuterHtml = function (a, b) { - a.outerHTML = goog.html.SafeHtml.unwrapTrustedHTML(b); -}; - -goog.dom.safe.setFormElementAction = function (a, b) { - b = b instanceof goog.html.SafeUrl ? b : goog.html.SafeUrl.sanitizeAssertUnchanged(b); - goog.dom.asserts.assertIsHTMLFormElement(a).action = goog.html.SafeUrl.unwrapTrustedURL(b); -}; - -goog.dom.safe.setButtonFormAction = function (a, b) { - b = b instanceof goog.html.SafeUrl ? b : goog.html.SafeUrl.sanitizeAssertUnchanged(b); - goog.dom.asserts.assertIsHTMLButtonElement(a).formAction = goog.html.SafeUrl.unwrapTrustedURL(b); -}; - -goog.dom.safe.setInputFormAction = function (a, b) { - b = b instanceof goog.html.SafeUrl ? b : goog.html.SafeUrl.sanitizeAssertUnchanged(b); - goog.dom.asserts.assertIsHTMLInputElement(a).formAction = goog.html.SafeUrl.unwrapTrustedURL(b); -}; - -goog.dom.safe.setStyle = function (a, b) { - a.style.cssText = goog.html.SafeStyle.unwrap(b); -}; - -goog.dom.safe.documentWrite = function (a, b) { - a.write(goog.html.SafeHtml.unwrapTrustedHTML(b)); -}; - -goog.dom.safe.setAnchorHref = function (a, b) { - goog.dom.asserts.assertIsHTMLAnchorElement(a); - b = b instanceof goog.html.SafeUrl ? b : goog.html.SafeUrl.sanitizeAssertUnchanged(b); - a.href = goog.html.SafeUrl.unwrapTrustedURL(b); -}; - -goog.dom.safe.setImageSrc = function (a, b) { - goog.dom.asserts.assertIsHTMLImageElement(a); - - if (!(b instanceof goog.html.SafeUrl)) { - var c = /^data:image\//i.test(b); - b = goog.html.SafeUrl.sanitizeAssertUnchanged(b, c); - } - - a.src = goog.html.SafeUrl.unwrapTrustedURL(b); -}; - -goog.dom.safe.setAudioSrc = function (a, b) { - goog.dom.asserts.assertIsHTMLAudioElement(a); - - if (!(b instanceof goog.html.SafeUrl)) { - var c = /^data:audio\//i.test(b); - b = goog.html.SafeUrl.sanitizeAssertUnchanged(b, c); - } - - a.src = goog.html.SafeUrl.unwrapTrustedURL(b); -}; - -goog.dom.safe.setVideoSrc = function (a, b) { - goog.dom.asserts.assertIsHTMLVideoElement(a); - - if (!(b instanceof goog.html.SafeUrl)) { - var c = /^data:video\//i.test(b); - b = goog.html.SafeUrl.sanitizeAssertUnchanged(b, c); - } - - a.src = goog.html.SafeUrl.unwrapTrustedURL(b); -}; - -goog.dom.safe.setEmbedSrc = function (a, b) { - goog.dom.asserts.assertIsHTMLEmbedElement(a); - a.src = goog.html.TrustedResourceUrl.unwrapTrustedScriptURL(b); -}; - -goog.dom.safe.setFrameSrc = function (a, b) { - goog.dom.asserts.assertIsHTMLFrameElement(a); - a.src = goog.html.TrustedResourceUrl.unwrapTrustedURL(b); -}; - -goog.dom.safe.setIframeSrc = function (a, b) { - goog.dom.asserts.assertIsHTMLIFrameElement(a); - a.src = goog.html.TrustedResourceUrl.unwrapTrustedURL(b); -}; - -goog.dom.safe.setIframeSrcdoc = function (a, b) { - goog.dom.asserts.assertIsHTMLIFrameElement(a); - a.srcdoc = goog.html.SafeHtml.unwrapTrustedHTML(b); -}; - -goog.dom.safe.setLinkHrefAndRel = function (a, b, c) { - goog.dom.asserts.assertIsHTMLLinkElement(a); - a.rel = c; - goog.string.internal.caseInsensitiveContains(c, "stylesheet") ? (goog.asserts.assert(b instanceof goog.html.TrustedResourceUrl, 'URL must be TrustedResourceUrl because "rel" contains "stylesheet"'), a.href = goog.html.TrustedResourceUrl.unwrapTrustedURL(b)) : a.href = b instanceof goog.html.TrustedResourceUrl ? goog.html.TrustedResourceUrl.unwrapTrustedURL(b) : b instanceof goog.html.SafeUrl ? goog.html.SafeUrl.unwrapTrustedURL(b) : goog.html.SafeUrl.unwrapTrustedURL(goog.html.SafeUrl.sanitizeAssertUnchanged(b)); -}; - -goog.dom.safe.setObjectData = function (a, b) { - goog.dom.asserts.assertIsHTMLObjectElement(a); - a.data = goog.html.TrustedResourceUrl.unwrapTrustedScriptURL(b); -}; - -goog.dom.safe.setScriptSrc = function (a, b) { - goog.dom.asserts.assertIsHTMLScriptElement(a); - a.src = goog.html.TrustedResourceUrl.unwrapTrustedScriptURL(b); - (b = goog.getScriptNonce()) && a.setAttribute("nonce", b); -}; - -goog.dom.safe.setScriptContent = function (a, b) { - goog.dom.asserts.assertIsHTMLScriptElement(a); - a.text = goog.html.SafeScript.unwrapTrustedScript(b); - (b = goog.getScriptNonce()) && a.setAttribute("nonce", b); -}; - -goog.dom.safe.setLocationHref = function (a, b) { - goog.dom.asserts.assertIsLocation(a); - b = b instanceof goog.html.SafeUrl ? b : goog.html.SafeUrl.sanitizeAssertUnchanged(b); - a.href = goog.html.SafeUrl.unwrapTrustedURL(b); -}; - -goog.dom.safe.assignLocation = function (a, b) { - goog.dom.asserts.assertIsLocation(a); - b = b instanceof goog.html.SafeUrl ? b : goog.html.SafeUrl.sanitizeAssertUnchanged(b); - a.assign(goog.html.SafeUrl.unwrapTrustedURL(b)); -}; - -goog.dom.safe.replaceLocation = function (a, b) { - goog.dom.asserts.assertIsLocation(a); - b = b instanceof goog.html.SafeUrl ? b : goog.html.SafeUrl.sanitizeAssertUnchanged(b); - a.replace(goog.html.SafeUrl.unwrapTrustedURL(b)); -}; - -goog.dom.safe.openInWindow = function (a, b, c, d, e) { - a = a instanceof goog.html.SafeUrl ? a : goog.html.SafeUrl.sanitizeAssertUnchanged(a); - return (b || goog.global).open(goog.html.SafeUrl.unwrapTrustedURL(a), c ? goog.string.Const.unwrap(c) : "", d, e); -}; - -goog.dom.safe.parseFromStringHtml = function (a, b) { - return goog.dom.safe.parseFromString(a, b, "text/html"); -}; - -goog.dom.safe.parseFromString = function (a, b, c) { - return a.parseFromString(goog.html.SafeHtml.unwrapTrustedHTML(b), c); -}; - -goog.dom.safe.createImageFromBlob = function (a) { - if (!/^image\/.*/g.test(a.type)) throw Error("goog.dom.safe.createImageFromBlob only accepts MIME type image/.*."); - var b = goog.global.URL.createObjectURL(a); - a = new goog.global.Image(); - - a.onload = function () { - goog.global.URL.revokeObjectURL(b); - }; - - goog.dom.safe.setImageSrc(a, goog.html.uncheckedconversions.safeUrlFromStringKnownToSatisfyTypeContract(goog.string.Const.from("Image blob URL."), b)); - return a; -}; - -goog.string.DETECT_DOUBLE_ESCAPING = !1; -goog.string.FORCE_NON_DOM_HTML_UNESCAPING = !1; -goog.string.Unicode = { - NBSP: "\u00a0" -}; -goog.string.startsWith = goog.string.internal.startsWith; -goog.string.endsWith = goog.string.internal.endsWith; -goog.string.caseInsensitiveStartsWith = goog.string.internal.caseInsensitiveStartsWith; -goog.string.caseInsensitiveEndsWith = goog.string.internal.caseInsensitiveEndsWith; -goog.string.caseInsensitiveEquals = goog.string.internal.caseInsensitiveEquals; - -goog.string.subs = function (a, b) { - for (var c = a.split("%s"), d = "", e = Array.prototype.slice.call(arguments, 1); e.length && 1 < c.length;) d += c.shift() + e.shift(); - - return d + c.join("%s"); -}; - -goog.string.collapseWhitespace = function (a) { - return a.replace(/[\s\xa0]+/g, " ").replace(/^\s+|\s+$/g, ""); -}; - -goog.string.isEmptyOrWhitespace = goog.string.internal.isEmptyOrWhitespace; - -goog.string.isEmptyString = function (a) { - return 0 == a.length; -}; - -goog.string.isEmpty = goog.string.isEmptyOrWhitespace; - -goog.string.isEmptyOrWhitespaceSafe = function (a) { - return goog.string.isEmptyOrWhitespace(goog.string.makeSafe(a)); -}; - -goog.string.isEmptySafe = goog.string.isEmptyOrWhitespaceSafe; - -goog.string.isBreakingWhitespace = function (a) { - return !/[^\t\n\r ]/.test(a); -}; - -goog.string.isAlpha = function (a) { - return !/[^a-zA-Z]/.test(a); -}; - -goog.string.isNumeric = function (a) { - return !/[^0-9]/.test(a); -}; - -goog.string.isAlphaNumeric = function (a) { - return !/[^a-zA-Z0-9]/.test(a); -}; - -goog.string.isSpace = function (a) { - return " " == a; -}; - -goog.string.isUnicodeChar = function (a) { - return 1 == a.length && " " <= a && "~" >= a || "\u0080" <= a && "\ufffd" >= a; -}; - -goog.string.stripNewlines = function (a) { - return a.replace(/(\r\n|\r|\n)+/g, " "); -}; - -goog.string.canonicalizeNewlines = function (a) { - return a.replace(/(\r\n|\r|\n)/g, "\n"); -}; - -goog.string.normalizeWhitespace = function (a) { - return a.replace(/\xa0|\s/g, " "); -}; - -goog.string.normalizeSpaces = function (a) { - return a.replace(/\xa0|[ \t]+/g, " "); -}; - -goog.string.collapseBreakingSpaces = function (a) { - return a.replace(/[\t\r\n ]+/g, " ").replace(/^[\t\r\n ]+|[\t\r\n ]+$/g, ""); -}; - -goog.string.trim = goog.string.internal.trim; - -goog.string.trimLeft = function (a) { - return a.replace(/^[\s\xa0]+/, ""); -}; - -goog.string.trimRight = function (a) { - return a.replace(/[\s\xa0]+$/, ""); -}; - -goog.string.caseInsensitiveCompare = goog.string.internal.caseInsensitiveCompare; - -goog.string.numberAwareCompare_ = function (a, b, c) { - if (a == b) return 0; - if (!a) return -1; - if (!b) return 1; - - for (var d = a.toLowerCase().match(c), e = b.toLowerCase().match(c), f = Math.min(d.length, e.length), g = 0; g < f; g++) { - c = d[g]; - var h = e[g]; - if (c != h) return a = parseInt(c, 10), !isNaN(a) && (b = parseInt(h, 10), !isNaN(b) && a - b) ? a - b : c < h ? -1 : 1; - } - - return d.length != e.length ? d.length - e.length : a < b ? -1 : 1; -}; - -goog.string.intAwareCompare = function (a, b) { - return goog.string.numberAwareCompare_(a, b, /\d+|\D+/g); -}; - -goog.string.floatAwareCompare = function (a, b) { - return goog.string.numberAwareCompare_(a, b, /\d+|\.\d+|\D+/g); -}; - -goog.string.numerateCompare = goog.string.floatAwareCompare; - -goog.string.urlEncode = function (a) { - return encodeURIComponent(String(a)); -}; - -goog.string.urlDecode = function (a) { - return decodeURIComponent(a.replace(/\+/g, " ")); -}; - -goog.string.newLineToBr = goog.string.internal.newLineToBr; - -goog.string.htmlEscape = function (a, b) { - a = goog.string.internal.htmlEscape(a, b); - goog.string.DETECT_DOUBLE_ESCAPING && (a = a.replace(goog.string.E_RE_, "e")); - return a; -}; - -goog.string.E_RE_ = /e/g; - -goog.string.unescapeEntities = function (a) { - return goog.string.contains(a, "&") ? !goog.string.FORCE_NON_DOM_HTML_UNESCAPING && "document" in goog.global ? goog.string.unescapeEntitiesUsingDom_(a) : goog.string.unescapePureXmlEntities_(a) : a; -}; - -goog.string.unescapeEntitiesWithDocument = function (a, b) { - return goog.string.contains(a, "&") ? goog.string.unescapeEntitiesUsingDom_(a, b) : a; -}; - -goog.string.unescapeEntitiesUsingDom_ = function (a, b) { - var c = { - "&": "&", - "<": "<", - ">": ">", - """: '"' - }; - var d = b ? b.createElement("div") : goog.global.document.createElement("div"); - return a.replace(goog.string.HTML_ENTITY_PATTERN_, function (a, b) { - var e = c[a]; - if (e) return e; - "#" == b.charAt(0) && (b = Number("0" + b.substr(1)), isNaN(b) || (e = String.fromCharCode(b))); - e || (goog.dom.safe.setInnerHtml(d, goog.html.uncheckedconversions.safeHtmlFromStringKnownToSatisfyTypeContract(goog.string.Const.from("Single HTML entity."), a + " ")), e = d.firstChild.nodeValue.slice(0, -1)); - return c[a] = e; - }); -}; - -goog.string.unescapePureXmlEntities_ = function (a) { - return a.replace(/&([^;]+);/g, function (a, c) { - switch (c) { - case "amp": - return "&"; - - case "lt": - return "<"; - - case "gt": - return ">"; - - case "quot": - return '"'; - - default: - return "#" != c.charAt(0) || (c = Number("0" + c.substr(1)), isNaN(c)) ? a : String.fromCharCode(c); - } - }); -}; - -goog.string.HTML_ENTITY_PATTERN_ = /&([^;\s<&]+);?/g; - -goog.string.whitespaceEscape = function (a, b) { - return goog.string.newLineToBr(a.replace(/ /g, "  "), b); -}; - -goog.string.preserveSpaces = function (a) { - return a.replace(/(^|[\n ]) /g, "$1" + goog.string.Unicode.NBSP); -}; - -goog.string.stripQuotes = function (a, b) { - for (var c = b.length, d = 0; d < c; d++) { - var e = 1 == c ? b : b.charAt(d); - if (a.charAt(0) == e && a.charAt(a.length - 1) == e) return a.substring(1, a.length - 1); - } - - return a; -}; - -goog.string.truncate = function (a, b, c) { - c && (a = goog.string.unescapeEntities(a)); - a.length > b && (a = a.substring(0, b - 3) + "..."); - c && (a = goog.string.htmlEscape(a)); - return a; -}; - -goog.string.truncateMiddle = function (a, b, c, d) { - c && (a = goog.string.unescapeEntities(a)); - - if (d && a.length > b) { - d > b && (d = b); - var e = a.length - d; - a = a.substring(0, b - d) + "..." + a.substring(e); - } else a.length > b && (d = Math.floor(b / 2), e = a.length - d, a = a.substring(0, d + b % 2) + "..." + a.substring(e)); - - c && (a = goog.string.htmlEscape(a)); - return a; -}; - -goog.string.specialEscapeChars_ = { - "\x00": "\\0", - "\b": "\\b", - "\f": "\\f", - "\n": "\\n", - "\r": "\\r", - "\t": "\\t", - "\x0B": "\\x0B", - '"': '\\"', - "\\": "\\\\", - "<": "\\u003C" -}; -goog.string.jsEscapeCache_ = { - "'": "\\'" -}; - -goog.string.quote = function (a) { - a = String(a); - - for (var b = ['"'], c = 0; c < a.length; c++) { - var d = a.charAt(c), - e = d.charCodeAt(0); - b[c + 1] = goog.string.specialEscapeChars_[d] || (31 < e && 127 > e ? d : goog.string.escapeChar(d)); - } - - b.push('"'); - return b.join(""); -}; - -goog.string.escapeString = function (a) { - for (var b = [], c = 0; c < a.length; c++) b[c] = goog.string.escapeChar(a.charAt(c)); - - return b.join(""); -}; - -goog.string.escapeChar = function (a) { - if (a in goog.string.jsEscapeCache_) return goog.string.jsEscapeCache_[a]; - if (a in goog.string.specialEscapeChars_) return goog.string.jsEscapeCache_[a] = goog.string.specialEscapeChars_[a]; - var b = a.charCodeAt(0); - if (31 < b && 127 > b) var c = a;else { - if (256 > b) { - if (c = "\\x", 16 > b || 256 < b) c += "0"; - } else c = "\\u", 4096 > b && (c += "0"); - - c += b.toString(16).toUpperCase(); - } - return goog.string.jsEscapeCache_[a] = c; -}; - -goog.string.contains = goog.string.internal.contains; -goog.string.caseInsensitiveContains = goog.string.internal.caseInsensitiveContains; - -goog.string.countOf = function (a, b) { - return a && b ? a.split(b).length - 1 : 0; -}; - -goog.string.removeAt = function (a, b, c) { - var d = a; - 0 <= b && b < a.length && 0 < c && (d = a.substr(0, b) + a.substr(b + c, a.length - b - c)); - return d; -}; - -goog.string.remove = function (a, b) { - return a.replace(b, ""); -}; - -goog.string.removeAll = function (a, b) { - b = new RegExp(goog.string.regExpEscape(b), "g"); - return a.replace(b, ""); -}; - -goog.string.replaceAll = function (a, b, c) { - b = new RegExp(goog.string.regExpEscape(b), "g"); - return a.replace(b, c.replace(/\$/g, "$$$$")); -}; - -goog.string.regExpEscape = function (a) { - return String(a).replace(/([-()\[\]{}+?*.$\^|,:#<!\\])/g, "\\$1").replace(/\x08/g, "\\x08"); -}; - -goog.string.repeat = String.prototype.repeat ? function (a, b) { - return a.repeat(b); -} : function (a, b) { - return Array(b + 1).join(a); -}; - -goog.string.padNumber = function (a, b, c) { - a = goog.isDef(c) ? a.toFixed(c) : String(a); - c = a.indexOf("."); - -1 == c && (c = a.length); - return goog.string.repeat("0", Math.max(0, b - c)) + a; -}; - -goog.string.makeSafe = function (a) { - return null == a ? "" : String(a); -}; - -goog.string.buildString = function (a) { - return Array.prototype.join.call(arguments, ""); -}; - -goog.string.getRandomString = function () { - return Math.floor(2147483648 * Math.random()).toString(36) + Math.abs(Math.floor(2147483648 * Math.random()) ^ goog.now()).toString(36); -}; - -goog.string.compareVersions = goog.string.internal.compareVersions; - -goog.string.hashCode = function (a) { - for (var b = 0, c = 0; c < a.length; ++c) b = 31 * b + a.charCodeAt(c) >>> 0; - - return b; -}; - -goog.string.uniqueStringCounter_ = 2147483648 * Math.random() | 0; - -goog.string.createUniqueString = function () { - return "goog_" + goog.string.uniqueStringCounter_++; -}; - -goog.string.toNumber = function (a) { - var b = Number(a); - return 0 == b && goog.string.isEmptyOrWhitespace(a) ? NaN : b; -}; - -goog.string.isLowerCamelCase = function (a) { - return /^[a-z]+([A-Z][a-z]*)*$/.test(a); -}; - -goog.string.isUpperCamelCase = function (a) { - return /^([A-Z][a-z]*)+$/.test(a); -}; - -goog.string.toCamelCase = function (a) { - return String(a).replace(/\-([a-z])/g, function (a, c) { - return c.toUpperCase(); - }); -}; - -goog.string.toSelectorCase = function (a) { - return String(a).replace(/([A-Z])/g, "-$1").toLowerCase(); -}; - -goog.string.toTitleCase = function (a, b) { - b = goog.isString(b) ? goog.string.regExpEscape(b) : "\\s"; - return a.replace(new RegExp("(^" + (b ? "|[" + b + "]+" : "") + ")([a-z])", "g"), function (a, b, e) { - return b + e.toUpperCase(); - }); -}; - -goog.string.capitalize = function (a) { - return String(a.charAt(0)).toUpperCase() + String(a.substr(1)).toLowerCase(); -}; - -goog.string.parseInt = function (a) { - isFinite(a) && (a = String(a)); - return goog.isString(a) ? /^\s*-?0x/i.test(a) ? parseInt(a, 16) : parseInt(a, 10) : NaN; -}; - -goog.string.splitLimit = function (a, b, c) { - a = a.split(b); - - for (var d = []; 0 < c && a.length;) d.push(a.shift()), c--; - - a.length && d.push(a.join(b)); - return d; -}; - -goog.string.lastComponent = function (a, b) { - if (b) "string" == typeof b && (b = [b]);else return a; - - for (var c = -1, d = 0; d < b.length; d++) if ("" != b[d]) { - var e = a.lastIndexOf(b[d]); - e > c && (c = e); - } - - return -1 == c ? a : a.slice(c + 1); -}; - -goog.string.editDistance = function (a, b) { - var c = [], - d = []; - if (a == b) return 0; - if (!a.length || !b.length) return Math.max(a.length, b.length); - - for (var e = 0; e < b.length + 1; e++) c[e] = e; - - for (e = 0; e < a.length; e++) { - d[0] = e + 1; - - for (var f = 0; f < b.length; f++) d[f + 1] = Math.min(d[f] + 1, c[f + 1] + 1, c[f] + Number(a[e] != b[f])); - - for (f = 0; f < c.length; f++) c[f] = d[f]; - } - - return d[b.length]; -}; - -goog.labs.userAgent.engine = {}; - -goog.labs.userAgent.engine.isPresto = function () { - return goog.labs.userAgent.util.matchUserAgent("Presto"); -}; - -goog.labs.userAgent.engine.isTrident = function () { - return goog.labs.userAgent.util.matchUserAgent("Trident") || goog.labs.userAgent.util.matchUserAgent("MSIE"); -}; - -goog.labs.userAgent.engine.isEdge = function () { - return goog.labs.userAgent.util.matchUserAgent("Edge"); -}; - -goog.labs.userAgent.engine.isWebKit = function () { - return goog.labs.userAgent.util.matchUserAgentIgnoreCase("WebKit") && !goog.labs.userAgent.engine.isEdge(); -}; - -goog.labs.userAgent.engine.isGecko = function () { - return goog.labs.userAgent.util.matchUserAgent("Gecko") && !goog.labs.userAgent.engine.isWebKit() && !goog.labs.userAgent.engine.isTrident() && !goog.labs.userAgent.engine.isEdge(); -}; - -goog.labs.userAgent.engine.getVersion = function () { - var a = goog.labs.userAgent.util.getUserAgent(); - - if (a) { - a = goog.labs.userAgent.util.extractVersionTuples(a); - var b = goog.labs.userAgent.engine.getEngineTuple_(a); - if (b) return "Gecko" == b[0] ? goog.labs.userAgent.engine.getVersionForKey_(a, "Firefox") : b[1]; - a = a[0]; - var c; - if (a && (c = a[2]) && (c = /Trident\/([^\s;]+)/.exec(c))) return c[1]; - } - - return ""; -}; - -goog.labs.userAgent.engine.getEngineTuple_ = function (a) { - if (!goog.labs.userAgent.engine.isEdge()) return a[1]; - - for (var b = 0; b < a.length; b++) { - var c = a[b]; - if ("Edge" == c[0]) return c; - } -}; - -goog.labs.userAgent.engine.isVersionOrHigher = function (a) { - return 0 <= goog.string.compareVersions(goog.labs.userAgent.engine.getVersion(), a); -}; - -goog.labs.userAgent.engine.getVersionForKey_ = function (a, b) { - return (a = goog.array.find(a, function (a) { - return b == a[0]; - })) && a[1] || ""; -}; - -goog.labs.userAgent.platform = {}; - -goog.labs.userAgent.platform.isAndroid = function () { - return goog.labs.userAgent.util.matchUserAgent("Android"); -}; - -goog.labs.userAgent.platform.isIpod = function () { - return goog.labs.userAgent.util.matchUserAgent("iPod"); -}; - -goog.labs.userAgent.platform.isIphone = function () { - return goog.labs.userAgent.util.matchUserAgent("iPhone") && !goog.labs.userAgent.util.matchUserAgent("iPod") && !goog.labs.userAgent.util.matchUserAgent("iPad"); -}; - -goog.labs.userAgent.platform.isIpad = function () { - return goog.labs.userAgent.util.matchUserAgent("iPad"); -}; - -goog.labs.userAgent.platform.isIos = function () { - return goog.labs.userAgent.platform.isIphone() || goog.labs.userAgent.platform.isIpad() || goog.labs.userAgent.platform.isIpod(); -}; - -goog.labs.userAgent.platform.isMacintosh = function () { - return goog.labs.userAgent.util.matchUserAgent("Macintosh"); -}; - -goog.labs.userAgent.platform.isLinux = function () { - return goog.labs.userAgent.util.matchUserAgent("Linux"); -}; - -goog.labs.userAgent.platform.isWindows = function () { - return goog.labs.userAgent.util.matchUserAgent("Windows"); -}; - -goog.labs.userAgent.platform.isChromeOS = function () { - return goog.labs.userAgent.util.matchUserAgent("CrOS"); -}; - -goog.labs.userAgent.platform.isChromecast = function () { - return goog.labs.userAgent.util.matchUserAgent("CrKey"); -}; - -goog.labs.userAgent.platform.isKaiOS = function () { - return goog.labs.userAgent.util.matchUserAgentIgnoreCase("KaiOS"); -}; - -goog.labs.userAgent.platform.isGo2Phone = function () { - return goog.labs.userAgent.util.matchUserAgentIgnoreCase("GAFP"); -}; - -goog.labs.userAgent.platform.getVersion = function () { - var a = goog.labs.userAgent.util.getUserAgent(), - b = ""; - goog.labs.userAgent.platform.isWindows() ? (b = /Windows (?:NT|Phone) ([0-9.]+)/, b = (a = b.exec(a)) ? a[1] : "0.0") : goog.labs.userAgent.platform.isIos() ? (b = /(?:iPhone|iPod|iPad|CPU)\s+OS\s+(\S+)/, b = (a = b.exec(a)) && a[1].replace(/_/g, ".")) : goog.labs.userAgent.platform.isMacintosh() ? (b = /Mac OS X ([0-9_.]+)/, b = (a = b.exec(a)) ? a[1].replace(/_/g, ".") : "10") : goog.labs.userAgent.platform.isKaiOS() ? (b = /(?:KaiOS)\/(\S+)/i, b = (a = b.exec(a)) && a[1]) : goog.labs.userAgent.platform.isAndroid() ? (b = /Android\s+([^\);]+)(\)|;)/, b = (a = b.exec(a)) && a[1]) : goog.labs.userAgent.platform.isChromeOS() && (b = /(?:CrOS\s+(?:i686|x86_64)\s+([0-9.]+))/, b = (a = b.exec(a)) && a[1]); - return b || ""; -}; - -goog.labs.userAgent.platform.isVersionOrHigher = function (a) { - return 0 <= goog.string.compareVersions(goog.labs.userAgent.platform.getVersion(), a); -}; - -goog.reflect = {}; - -goog.reflect.object = function (a, b) { - return b; -}; - -goog.reflect.objectProperty = function (a, b) { - return a; -}; - -goog.reflect.sinkValue = function (a) { - goog.reflect.sinkValue[" "](a); - return a; -}; - -goog.reflect.sinkValue[" "] = goog.nullFunction; - -goog.reflect.canAccessProperty = function (a, b) { - try { - return goog.reflect.sinkValue(a[b]), !0; - } catch (c) {} - - return !1; -}; - -goog.reflect.cache = function (a, b, c, d) { - d = d ? d(b) : b; - return Object.prototype.hasOwnProperty.call(a, d) ? a[d] : a[d] = c(b); -}; - -goog.userAgent = {}; -goog.userAgent.ASSUME_IE = !1; -goog.userAgent.ASSUME_EDGE = !1; -goog.userAgent.ASSUME_GECKO = !1; -goog.userAgent.ASSUME_WEBKIT = !1; -goog.userAgent.ASSUME_MOBILE_WEBKIT = !1; -goog.userAgent.ASSUME_OPERA = !1; -goog.userAgent.ASSUME_ANY_VERSION = !1; -goog.userAgent.BROWSER_KNOWN_ = goog.userAgent.ASSUME_IE || goog.userAgent.ASSUME_EDGE || goog.userAgent.ASSUME_GECKO || goog.userAgent.ASSUME_MOBILE_WEBKIT || goog.userAgent.ASSUME_WEBKIT || goog.userAgent.ASSUME_OPERA; - -goog.userAgent.getUserAgentString = function () { - return goog.labs.userAgent.util.getUserAgent(); -}; - -goog.userAgent.getNavigatorTyped = function () { - return goog.global.navigator || null; -}; - -goog.userAgent.getNavigator = function () { - return goog.userAgent.getNavigatorTyped(); -}; - -goog.userAgent.OPERA = goog.userAgent.BROWSER_KNOWN_ ? goog.userAgent.ASSUME_OPERA : goog.labs.userAgent.browser.isOpera(); -goog.userAgent.IE = goog.userAgent.BROWSER_KNOWN_ ? goog.userAgent.ASSUME_IE : goog.labs.userAgent.browser.isIE(); -goog.userAgent.EDGE = goog.userAgent.BROWSER_KNOWN_ ? goog.userAgent.ASSUME_EDGE : goog.labs.userAgent.engine.isEdge(); -goog.userAgent.EDGE_OR_IE = goog.userAgent.EDGE || goog.userAgent.IE; -goog.userAgent.GECKO = goog.userAgent.BROWSER_KNOWN_ ? goog.userAgent.ASSUME_GECKO : goog.labs.userAgent.engine.isGecko(); -goog.userAgent.WEBKIT = goog.userAgent.BROWSER_KNOWN_ ? goog.userAgent.ASSUME_WEBKIT || goog.userAgent.ASSUME_MOBILE_WEBKIT : goog.labs.userAgent.engine.isWebKit(); - -goog.userAgent.isMobile_ = function () { - return goog.userAgent.WEBKIT && goog.labs.userAgent.util.matchUserAgent("Mobile"); -}; - -goog.userAgent.MOBILE = goog.userAgent.ASSUME_MOBILE_WEBKIT || goog.userAgent.isMobile_(); -goog.userAgent.SAFARI = goog.userAgent.WEBKIT; - -goog.userAgent.determinePlatform_ = function () { - var a = goog.userAgent.getNavigatorTyped(); - return a && a.platform || ""; -}; - -goog.userAgent.PLATFORM = goog.userAgent.determinePlatform_(); -goog.userAgent.ASSUME_MAC = !1; -goog.userAgent.ASSUME_WINDOWS = !1; -goog.userAgent.ASSUME_LINUX = !1; -goog.userAgent.ASSUME_X11 = !1; -goog.userAgent.ASSUME_ANDROID = !1; -goog.userAgent.ASSUME_IPHONE = !1; -goog.userAgent.ASSUME_IPAD = !1; -goog.userAgent.ASSUME_IPOD = !1; -goog.userAgent.ASSUME_KAIOS = !1; -goog.userAgent.ASSUME_GO2PHONE = !1; -goog.userAgent.PLATFORM_KNOWN_ = goog.userAgent.ASSUME_MAC || goog.userAgent.ASSUME_WINDOWS || goog.userAgent.ASSUME_LINUX || goog.userAgent.ASSUME_X11 || goog.userAgent.ASSUME_ANDROID || goog.userAgent.ASSUME_IPHONE || goog.userAgent.ASSUME_IPAD || goog.userAgent.ASSUME_IPOD; -goog.userAgent.MAC = goog.userAgent.PLATFORM_KNOWN_ ? goog.userAgent.ASSUME_MAC : goog.labs.userAgent.platform.isMacintosh(); -goog.userAgent.WINDOWS = goog.userAgent.PLATFORM_KNOWN_ ? goog.userAgent.ASSUME_WINDOWS : goog.labs.userAgent.platform.isWindows(); - -goog.userAgent.isLegacyLinux_ = function () { - return goog.labs.userAgent.platform.isLinux() || goog.labs.userAgent.platform.isChromeOS(); -}; - -goog.userAgent.LINUX = goog.userAgent.PLATFORM_KNOWN_ ? goog.userAgent.ASSUME_LINUX : goog.userAgent.isLegacyLinux_(); - -goog.userAgent.isX11_ = function () { - var a = goog.userAgent.getNavigatorTyped(); - return !!a && goog.string.contains(a.appVersion || "", "X11"); -}; - -goog.userAgent.X11 = goog.userAgent.PLATFORM_KNOWN_ ? goog.userAgent.ASSUME_X11 : goog.userAgent.isX11_(); -goog.userAgent.ANDROID = goog.userAgent.PLATFORM_KNOWN_ ? goog.userAgent.ASSUME_ANDROID : goog.labs.userAgent.platform.isAndroid(); -goog.userAgent.IPHONE = goog.userAgent.PLATFORM_KNOWN_ ? goog.userAgent.ASSUME_IPHONE : goog.labs.userAgent.platform.isIphone(); -goog.userAgent.IPAD = goog.userAgent.PLATFORM_KNOWN_ ? goog.userAgent.ASSUME_IPAD : goog.labs.userAgent.platform.isIpad(); -goog.userAgent.IPOD = goog.userAgent.PLATFORM_KNOWN_ ? goog.userAgent.ASSUME_IPOD : goog.labs.userAgent.platform.isIpod(); -goog.userAgent.IOS = goog.userAgent.PLATFORM_KNOWN_ ? goog.userAgent.ASSUME_IPHONE || goog.userAgent.ASSUME_IPAD || goog.userAgent.ASSUME_IPOD : goog.labs.userAgent.platform.isIos(); -goog.userAgent.KAIOS = goog.userAgent.PLATFORM_KNOWN_ ? goog.userAgent.ASSUME_KAIOS : goog.labs.userAgent.platform.isKaiOS(); -goog.userAgent.GO2PHONE = goog.userAgent.PLATFORM_KNOWN_ ? goog.userAgent.ASSUME_GO2PHONE : goog.labs.userAgent.platform.isGo2Phone(); - -goog.userAgent.determineVersion_ = function () { - var a = "", - b = goog.userAgent.getVersionRegexResult_(); - b && (a = b ? b[1] : ""); - return goog.userAgent.IE && (b = goog.userAgent.getDocumentMode_(), null != b && b > parseFloat(a)) ? String(b) : a; -}; - -goog.userAgent.getVersionRegexResult_ = function () { - var a = goog.userAgent.getUserAgentString(); - if (goog.userAgent.GECKO) return /rv:([^\);]+)(\)|;)/.exec(a); - if (goog.userAgent.EDGE) return /Edge\/([\d\.]+)/.exec(a); - if (goog.userAgent.IE) return /\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(a); - if (goog.userAgent.WEBKIT) return /WebKit\/(\S+)/.exec(a); - if (goog.userAgent.OPERA) return /(?:Version)[ \/]?(\S+)/.exec(a); -}; - -goog.userAgent.getDocumentMode_ = function () { - var a = goog.global.document; - return a ? a.documentMode : void 0; -}; - -goog.userAgent.VERSION = goog.userAgent.determineVersion_(); - -goog.userAgent.compare = function (a, b) { - return goog.string.compareVersions(a, b); -}; - -goog.userAgent.isVersionOrHigherCache_ = {}; - -goog.userAgent.isVersionOrHigher = function (a) { - return goog.userAgent.ASSUME_ANY_VERSION || goog.reflect.cache(goog.userAgent.isVersionOrHigherCache_, a, function () { - return 0 <= goog.string.compareVersions(goog.userAgent.VERSION, a); - }); -}; - -goog.userAgent.isVersion = goog.userAgent.isVersionOrHigher; - -goog.userAgent.isDocumentModeOrHigher = function (a) { - return Number(goog.userAgent.DOCUMENT_MODE) >= a; -}; - -goog.userAgent.isDocumentMode = goog.userAgent.isDocumentModeOrHigher; - -goog.userAgent.DOCUMENT_MODE = function () { - if (goog.global.document && goog.userAgent.IE) return goog.userAgent.getDocumentMode_(); -}(); - -goog.userAgent.product = {}; -goog.userAgent.product.ASSUME_FIREFOX = !1; -goog.userAgent.product.ASSUME_IPHONE = !1; -goog.userAgent.product.ASSUME_IPAD = !1; -goog.userAgent.product.ASSUME_ANDROID = !1; -goog.userAgent.product.ASSUME_CHROME = !1; -goog.userAgent.product.ASSUME_SAFARI = !1; -goog.userAgent.product.PRODUCT_KNOWN_ = goog.userAgent.ASSUME_IE || goog.userAgent.ASSUME_EDGE || goog.userAgent.ASSUME_OPERA || goog.userAgent.product.ASSUME_FIREFOX || goog.userAgent.product.ASSUME_IPHONE || goog.userAgent.product.ASSUME_IPAD || goog.userAgent.product.ASSUME_ANDROID || goog.userAgent.product.ASSUME_CHROME || goog.userAgent.product.ASSUME_SAFARI; -goog.userAgent.product.OPERA = goog.userAgent.OPERA; -goog.userAgent.product.IE = goog.userAgent.IE; -goog.userAgent.product.EDGE = goog.userAgent.EDGE; -goog.userAgent.product.FIREFOX = goog.userAgent.product.PRODUCT_KNOWN_ ? goog.userAgent.product.ASSUME_FIREFOX : goog.labs.userAgent.browser.isFirefox(); - -goog.userAgent.product.isIphoneOrIpod_ = function () { - return goog.labs.userAgent.platform.isIphone() || goog.labs.userAgent.platform.isIpod(); -}; - -goog.userAgent.product.IPHONE = goog.userAgent.product.PRODUCT_KNOWN_ ? goog.userAgent.product.ASSUME_IPHONE : goog.userAgent.product.isIphoneOrIpod_(); -goog.userAgent.product.IPAD = goog.userAgent.product.PRODUCT_KNOWN_ ? goog.userAgent.product.ASSUME_IPAD : goog.labs.userAgent.platform.isIpad(); -goog.userAgent.product.ANDROID = goog.userAgent.product.PRODUCT_KNOWN_ ? goog.userAgent.product.ASSUME_ANDROID : goog.labs.userAgent.browser.isAndroidBrowser(); -goog.userAgent.product.CHROME = goog.userAgent.product.PRODUCT_KNOWN_ ? goog.userAgent.product.ASSUME_CHROME : goog.labs.userAgent.browser.isChrome(); - -goog.userAgent.product.isSafariDesktop_ = function () { - return goog.labs.userAgent.browser.isSafari() && !goog.labs.userAgent.platform.isIos(); -}; - -goog.userAgent.product.SAFARI = goog.userAgent.product.PRODUCT_KNOWN_ ? goog.userAgent.product.ASSUME_SAFARI : goog.userAgent.product.isSafariDesktop_(); -goog.crypt.base64 = {}; -goog.crypt.base64.DEFAULT_ALPHABET_COMMON_ = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; -goog.crypt.base64.ENCODED_VALS = goog.crypt.base64.DEFAULT_ALPHABET_COMMON_ + "+/="; -goog.crypt.base64.ENCODED_VALS_WEBSAFE = goog.crypt.base64.DEFAULT_ALPHABET_COMMON_ + "-_."; -goog.crypt.base64.Alphabet = { - DEFAULT: 0, - NO_PADDING: 1, - WEBSAFE: 2, - WEBSAFE_DOT_PADDING: 3, - WEBSAFE_NO_PADDING: 4 -}; -goog.crypt.base64.paddingChars_ = "=."; - -goog.crypt.base64.isPadding_ = function (a) { - return goog.string.contains(goog.crypt.base64.paddingChars_, a); -}; - -goog.crypt.base64.byteToCharMaps_ = {}; -goog.crypt.base64.charToByteMap_ = null; -goog.crypt.base64.ASSUME_NATIVE_SUPPORT_ = goog.userAgent.GECKO || goog.userAgent.WEBKIT && !goog.userAgent.product.SAFARI || goog.userAgent.OPERA; -goog.crypt.base64.HAS_NATIVE_ENCODE_ = goog.crypt.base64.ASSUME_NATIVE_SUPPORT_ || "function" == typeof goog.global.btoa; -goog.crypt.base64.HAS_NATIVE_DECODE_ = goog.crypt.base64.ASSUME_NATIVE_SUPPORT_ || !goog.userAgent.product.SAFARI && !goog.userAgent.IE && "function" == typeof goog.global.atob; - -goog.crypt.base64.encodeByteArray = function (a, b) { - goog.asserts.assert(goog.isArrayLike(a), "encodeByteArray takes an array as a parameter"); - void 0 === b && (b = goog.crypt.base64.Alphabet.DEFAULT); - goog.crypt.base64.init_(); - b = goog.crypt.base64.byteToCharMaps_[b]; - - for (var c = [], d = 0; d < a.length; d += 3) { - var e = a[d], - f = d + 1 < a.length, - g = f ? a[d + 1] : 0, - h = d + 2 < a.length, - k = h ? a[d + 2] : 0, - l = e >> 2; - e = (e & 3) << 4 | g >> 4; - g = (g & 15) << 2 | k >> 6; - k &= 63; - h || (k = 64, f || (g = 64)); - c.push(b[l], b[e], b[g] || "", b[k] || ""); - } - - return c.join(""); -}; - -goog.crypt.base64.encodeString = function (a, b) { - return goog.crypt.base64.HAS_NATIVE_ENCODE_ && !b ? goog.global.btoa(a) : goog.crypt.base64.encodeByteArray(goog.crypt.stringToByteArray(a), b); -}; - -goog.crypt.base64.decodeString = function (a, b) { - if (goog.crypt.base64.HAS_NATIVE_DECODE_ && !b) return goog.global.atob(a); - var c = ""; - goog.crypt.base64.decodeStringInternal_(a, function (a) { - c += String.fromCharCode(a); - }); - return c; -}; - -goog.crypt.base64.decodeStringToByteArray = function (a, b) { - var c = []; - goog.crypt.base64.decodeStringInternal_(a, function (a) { - c.push(a); - }); - return c; -}; - -goog.crypt.base64.decodeStringToUint8Array = function (a) { - goog.asserts.assert(!goog.userAgent.IE || goog.userAgent.isVersionOrHigher("10"), "Browser does not support typed arrays"); - var b = a.length, - c = 3 * b / 4; - c % 3 ? c = Math.floor(c) : goog.crypt.base64.isPadding_(a[b - 1]) && (c = goog.crypt.base64.isPadding_(a[b - 2]) ? c - 2 : c - 1); - var d = new Uint8Array(c), - e = 0; - goog.crypt.base64.decodeStringInternal_(a, function (a) { - d[e++] = a; - }); - return d.subarray(0, e); -}; - -goog.crypt.base64.decodeStringInternal_ = function (a, b) { - function c(b) { - for (; d < a.length;) { - var c = a.charAt(d++), - e = goog.crypt.base64.charToByteMap_[c]; - if (null != e) return e; - if (!goog.string.isEmptyOrWhitespace(c)) throw Error("Unknown base64 encoding at char: " + c); - } - - return b; - } - - goog.crypt.base64.init_(); - - for (var d = 0;;) { - var e = c(-1), - f = c(0), - g = c(64), - h = c(64); - if (64 === h && -1 === e) break; - b(e << 2 | f >> 4); - 64 != g && (b(f << 4 & 240 | g >> 2), 64 != h && b(g << 6 & 192 | h)); - } -}; - -goog.crypt.base64.init_ = function () { - if (!goog.crypt.base64.charToByteMap_) { - goog.crypt.base64.charToByteMap_ = {}; - - for (var a = goog.crypt.base64.DEFAULT_ALPHABET_COMMON_.split(""), b = ["+/=", "+/", "-_=", "-_.", "-_"], c = 0; 5 > c; c++) { - var d = a.concat(b[c].split("")); - goog.crypt.base64.byteToCharMaps_[c] = d; - - for (var e = 0; e < d.length; e++) { - var f = d[e], - g = goog.crypt.base64.charToByteMap_[f]; - void 0 === g ? goog.crypt.base64.charToByteMap_[f] = e : goog.asserts.assert(g === e); - } - } - } -}; - -jspb.utils = {}; -jspb.utils.split64Low = 0; -jspb.utils.split64High = 0; - -jspb.utils.splitUint64 = function (a) { - var b = a >>> 0; - a = Math.floor((a - b) / jspb.BinaryConstants.TWO_TO_32) >>> 0; - jspb.utils.split64Low = b; - jspb.utils.split64High = a; -}; - -jspb.utils.splitInt64 = function (a) { - var b = 0 > a; - a = Math.abs(a); - var c = a >>> 0; - a = Math.floor((a - c) / jspb.BinaryConstants.TWO_TO_32); - a >>>= 0; - b && (a = ~a >>> 0, c = (~c >>> 0) + 1, 4294967295 < c && (c = 0, a++, 4294967295 < a && (a = 0))); - jspb.utils.split64Low = c; - jspb.utils.split64High = a; -}; - -jspb.utils.splitZigzag64 = function (a) { - var b = 0 > a; - a = 2 * Math.abs(a); - jspb.utils.splitUint64(a); - a = jspb.utils.split64Low; - var c = jspb.utils.split64High; - b && (0 == a ? 0 == c ? c = a = 4294967295 : (c--, a = 4294967295) : a--); - jspb.utils.split64Low = a; - jspb.utils.split64High = c; -}; - -jspb.utils.splitFloat32 = function (a) { - var b = 0 > a ? 1 : 0; - a = b ? -a : a; - if (0 === a) 0 < 1 / a ? (jspb.utils.split64High = 0, jspb.utils.split64Low = 0) : (jspb.utils.split64High = 0, jspb.utils.split64Low = 2147483648);else if (isNaN(a)) jspb.utils.split64High = 0, jspb.utils.split64Low = 2147483647;else if (a > jspb.BinaryConstants.FLOAT32_MAX) jspb.utils.split64High = 0, jspb.utils.split64Low = (b << 31 | 2139095040) >>> 0;else if (a < jspb.BinaryConstants.FLOAT32_MIN) a = Math.round(a / Math.pow(2, -149)), jspb.utils.split64High = 0, jspb.utils.split64Low = (b << 31 | a) >>> 0;else { - var c = Math.floor(Math.log(a) / Math.LN2); - a *= Math.pow(2, -c); - a = Math.round(a * jspb.BinaryConstants.TWO_TO_23); - 16777216 <= a && ++c; - jspb.utils.split64High = 0; - jspb.utils.split64Low = (b << 31 | c + 127 << 23 | a & 8388607) >>> 0; - } -}; - -jspb.utils.splitFloat64 = function (a) { - var b = 0 > a ? 1 : 0; - a = b ? -a : a; - if (0 === a) jspb.utils.split64High = 0 < 1 / a ? 0 : 2147483648, jspb.utils.split64Low = 0;else if (isNaN(a)) jspb.utils.split64High = 2147483647, jspb.utils.split64Low = 4294967295;else if (a > jspb.BinaryConstants.FLOAT64_MAX) jspb.utils.split64High = (b << 31 | 2146435072) >>> 0, jspb.utils.split64Low = 0;else if (a < jspb.BinaryConstants.FLOAT64_MIN) { - var c = a / Math.pow(2, -1074); - a = c / jspb.BinaryConstants.TWO_TO_32; - jspb.utils.split64High = (b << 31 | a) >>> 0; - jspb.utils.split64Low = c >>> 0; - } else { - c = a; - var d = 0; - if (2 <= c) for (; 2 <= c && 1023 > d;) d++, c /= 2;else for (; 1 > c && -1022 < d;) c *= 2, d--; - c = a * Math.pow(2, -d); - a = c * jspb.BinaryConstants.TWO_TO_20 & 1048575; - c = c * jspb.BinaryConstants.TWO_TO_52 >>> 0; - jspb.utils.split64High = (b << 31 | d + 1023 << 20 | a) >>> 0; - jspb.utils.split64Low = c; - } -}; - -jspb.utils.splitHash64 = function (a) { - var b = a.charCodeAt(0), - c = a.charCodeAt(1), - d = a.charCodeAt(2), - e = a.charCodeAt(3), - f = a.charCodeAt(4), - g = a.charCodeAt(5), - h = a.charCodeAt(6); - a = a.charCodeAt(7); - jspb.utils.split64Low = b + (c << 8) + (d << 16) + (e << 24) >>> 0; - jspb.utils.split64High = f + (g << 8) + (h << 16) + (a << 24) >>> 0; -}; - -jspb.utils.joinUint64 = function (a, b) { - return b * jspb.BinaryConstants.TWO_TO_32 + (a >>> 0); -}; - -jspb.utils.joinInt64 = function (a, b) { - var c = b & 2147483648; - c && (a = ~a + 1 >>> 0, b = ~b >>> 0, 0 == a && (b = b + 1 >>> 0)); - a = jspb.utils.joinUint64(a, b); - return c ? -a : a; -}; - -jspb.utils.toZigzag64 = function (a, b, c) { - var d = b >> 31; - return c(a << 1 ^ d, (b << 1 | a >>> 31) ^ d); -}; - -jspb.utils.joinZigzag64 = function (a, b) { - return jspb.utils.fromZigzag64(a, b, jspb.utils.joinInt64); -}; - -jspb.utils.fromZigzag64 = function (a, b, c) { - var d = -(a & 1); - return c((a >>> 1 | b << 31) ^ d, b >>> 1 ^ d); -}; - -jspb.utils.joinFloat32 = function (a, b) { - b = 2 * (a >> 31) + 1; - var c = a >>> 23 & 255; - a &= 8388607; - return 255 == c ? a ? NaN : Infinity * b : 0 == c ? b * Math.pow(2, -149) * a : b * Math.pow(2, c - 150) * (a + Math.pow(2, 23)); -}; - -jspb.utils.joinFloat64 = function (a, b) { - var c = 2 * (b >> 31) + 1, - d = b >>> 20 & 2047; - a = jspb.BinaryConstants.TWO_TO_32 * (b & 1048575) + a; - return 2047 == d ? a ? NaN : Infinity * c : 0 == d ? c * Math.pow(2, -1074) * a : c * Math.pow(2, d - 1075) * (a + jspb.BinaryConstants.TWO_TO_52); -}; - -jspb.utils.joinHash64 = function (a, b) { - return String.fromCharCode(a >>> 0 & 255, a >>> 8 & 255, a >>> 16 & 255, a >>> 24 & 255, b >>> 0 & 255, b >>> 8 & 255, b >>> 16 & 255, b >>> 24 & 255); -}; - -jspb.utils.DIGITS = "0123456789abcdef".split(""); -jspb.utils.ZERO_CHAR_CODE_ = 48; -jspb.utils.A_CHAR_CODE_ = 97; - -jspb.utils.joinUnsignedDecimalString = function (a, b) { - function c(a, b) { - a = a ? String(a) : ""; - return b ? "0000000".slice(a.length) + a : a; - } - - if (2097151 >= b) return "" + jspb.utils.joinUint64(a, b); - var d = (a >>> 24 | b << 8) >>> 0 & 16777215; - b = b >> 16 & 65535; - a = (a & 16777215) + 6777216 * d + 6710656 * b; - d += 8147497 * b; - b *= 2; - 1E7 <= a && (d += Math.floor(a / 1E7), a %= 1E7); - 1E7 <= d && (b += Math.floor(d / 1E7), d %= 1E7); - return c(b, 0) + c(d, b) + c(a, 1); -}; - -jspb.utils.joinSignedDecimalString = function (a, b) { - var c = b & 2147483648; - c && (a = ~a + 1 >>> 0, b = ~b + (0 == a ? 1 : 0) >>> 0); - a = jspb.utils.joinUnsignedDecimalString(a, b); - return c ? "-" + a : a; -}; - -jspb.utils.hash64ToDecimalString = function (a, b) { - jspb.utils.splitHash64(a); - a = jspb.utils.split64Low; - var c = jspb.utils.split64High; - return b ? jspb.utils.joinSignedDecimalString(a, c) : jspb.utils.joinUnsignedDecimalString(a, c); -}; - -jspb.utils.hash64ArrayToDecimalStrings = function (a, b) { - for (var c = Array(a.length), d = 0; d < a.length; d++) c[d] = jspb.utils.hash64ToDecimalString(a[d], b); - - return c; -}; - -jspb.utils.decimalStringToHash64 = function (a) { - function b(a, b) { - for (var c = 0; 8 > c && (1 !== a || 0 < b); c++) b = a * e[c] + b, e[c] = b & 255, b >>>= 8; - } - - function c() { - for (var a = 0; 8 > a; a++) e[a] = ~e[a] & 255; - } - - goog.asserts.assert(0 < a.length); - var d = !1; - "-" === a[0] && (d = !0, a = a.slice(1)); - - for (var e = [0, 0, 0, 0, 0, 0, 0, 0], f = 0; f < a.length; f++) b(10, a.charCodeAt(f) - jspb.utils.ZERO_CHAR_CODE_); - - d && (c(), b(1, 1)); - return goog.crypt.byteArrayToString(e); -}; - -jspb.utils.splitDecimalString = function (a) { - jspb.utils.splitHash64(jspb.utils.decimalStringToHash64(a)); -}; - -jspb.utils.toHexDigit_ = function (a) { - return String.fromCharCode(10 > a ? jspb.utils.ZERO_CHAR_CODE_ + a : jspb.utils.A_CHAR_CODE_ - 10 + a); -}; - -jspb.utils.fromHexCharCode_ = function (a) { - return a >= jspb.utils.A_CHAR_CODE_ ? a - jspb.utils.A_CHAR_CODE_ + 10 : a - jspb.utils.ZERO_CHAR_CODE_; -}; - -jspb.utils.hash64ToHexString = function (a) { - var b = Array(18); - b[0] = "0"; - b[1] = "x"; - - for (var c = 0; 8 > c; c++) { - var d = a.charCodeAt(7 - c); - b[2 * c + 2] = jspb.utils.toHexDigit_(d >> 4); - b[2 * c + 3] = jspb.utils.toHexDigit_(d & 15); - } - - return b.join(""); -}; - -jspb.utils.hexStringToHash64 = function (a) { - a = a.toLowerCase(); - goog.asserts.assert(18 == a.length); - goog.asserts.assert("0" == a[0]); - goog.asserts.assert("x" == a[1]); - - for (var b = "", c = 0; 8 > c; c++) { - var d = jspb.utils.fromHexCharCode_(a.charCodeAt(2 * c + 2)), - e = jspb.utils.fromHexCharCode_(a.charCodeAt(2 * c + 3)); - b = String.fromCharCode(16 * d + e) + b; - } - - return b; -}; - -jspb.utils.hash64ToNumber = function (a, b) { - jspb.utils.splitHash64(a); - a = jspb.utils.split64Low; - var c = jspb.utils.split64High; - return b ? jspb.utils.joinInt64(a, c) : jspb.utils.joinUint64(a, c); -}; - -jspb.utils.numberToHash64 = function (a) { - jspb.utils.splitInt64(a); - return jspb.utils.joinHash64(jspb.utils.split64Low, jspb.utils.split64High); -}; - -jspb.utils.countVarints = function (a, b, c) { - for (var d = 0, e = b; e < c; e++) d += a[e] >> 7; - - return c - b - d; -}; - -jspb.utils.countVarintFields = function (a, b, c, d) { - var e = 0; - d = 8 * d + jspb.BinaryConstants.WireType.VARINT; - if (128 > d) for (; b < c && a[b++] == d;) for (e++;;) { - var f = a[b++]; - if (0 == (f & 128)) break; - } else for (; b < c;) { - for (f = d; 128 < f;) { - if (a[b] != (f & 127 | 128)) return e; - b++; - f >>= 7; - } - - if (a[b++] != f) break; - - for (e++; f = a[b++], 0 != (f & 128);); - } - return e; -}; - -jspb.utils.countFixedFields_ = function (a, b, c, d, e) { - var f = 0; - if (128 > d) for (; b < c && a[b++] == d;) f++, b += e;else for (; b < c;) { - for (var g = d; 128 < g;) { - if (a[b++] != (g & 127 | 128)) return f; - g >>= 7; - } - - if (a[b++] != g) break; - f++; - b += e; - } - return f; -}; - -jspb.utils.countFixed32Fields = function (a, b, c, d) { - return jspb.utils.countFixedFields_(a, b, c, 8 * d + jspb.BinaryConstants.WireType.FIXED32, 4); -}; - -jspb.utils.countFixed64Fields = function (a, b, c, d) { - return jspb.utils.countFixedFields_(a, b, c, 8 * d + jspb.BinaryConstants.WireType.FIXED64, 8); -}; - -jspb.utils.countDelimitedFields = function (a, b, c, d) { - var e = 0; - - for (d = 8 * d + jspb.BinaryConstants.WireType.DELIMITED; b < c;) { - for (var f = d; 128 < f;) { - if (a[b++] != (f & 127 | 128)) return e; - f >>= 7; - } - - if (a[b++] != f) break; - e++; - - for (var g = 0, h = 1; f = a[b++], g += (f & 127) * h, h *= 128, 0 != (f & 128);); - - b += g; - } - - return e; -}; - -jspb.utils.debugBytesToTextFormat = function (a) { - var b = '"'; - - if (a) { - a = jspb.utils.byteSourceToUint8Array(a); - - for (var c = 0; c < a.length; c++) b += "\\x", 16 > a[c] && (b += "0"), b += a[c].toString(16); - } - - return b + '"'; -}; - -jspb.utils.debugScalarToTextFormat = function (a) { - return "string" === typeof a ? goog.string.quote(a) : a.toString(); -}; - -jspb.utils.stringToByteArray = function (a) { - for (var b = new Uint8Array(a.length), c = 0; c < a.length; c++) { - var d = a.charCodeAt(c); - if (255 < d) throw Error("Conversion error: string contains codepoint outside of byte range"); - b[c] = d; - } - - return b; -}; - -jspb.utils.byteSourceToUint8Array = function (a) { - if (a.constructor === Uint8Array) return a; - if (a.constructor === ArrayBuffer || "undefined" != typeof Buffer && a.constructor === Buffer || a.constructor === Array) return new Uint8Array(a); - if (a.constructor === String) return goog.crypt.base64.decodeStringToUint8Array(a); - goog.asserts.fail("Type not convertible to Uint8Array."); - return new Uint8Array(0); -}; - -jspb.BinaryDecoder = function (a, b, c) { - this.bytes_ = null; - this.cursor_ = this.end_ = this.start_ = 0; - this.error_ = !1; - a && this.setBlock(a, b, c); -}; - -jspb.BinaryDecoder.instanceCache_ = []; - -jspb.BinaryDecoder.alloc = function (a, b, c) { - if (jspb.BinaryDecoder.instanceCache_.length) { - var d = jspb.BinaryDecoder.instanceCache_.pop(); - a && d.setBlock(a, b, c); - return d; - } - - return new jspb.BinaryDecoder(a, b, c); -}; - -jspb.BinaryDecoder.prototype.free = function () { - this.clear(); - 100 > jspb.BinaryDecoder.instanceCache_.length && jspb.BinaryDecoder.instanceCache_.push(this); -}; - -jspb.BinaryDecoder.prototype.clone = function () { - return jspb.BinaryDecoder.alloc(this.bytes_, this.start_, this.end_ - this.start_); -}; - -jspb.BinaryDecoder.prototype.clear = function () { - this.bytes_ = null; - this.cursor_ = this.end_ = this.start_ = 0; - this.error_ = !1; -}; - -jspb.BinaryDecoder.prototype.getBuffer = function () { - return this.bytes_; -}; - -jspb.BinaryDecoder.prototype.setBlock = function (a, b, c) { - this.bytes_ = jspb.utils.byteSourceToUint8Array(a); - this.start_ = void 0 !== b ? b : 0; - this.end_ = void 0 !== c ? this.start_ + c : this.bytes_.length; - this.cursor_ = this.start_; -}; - -jspb.BinaryDecoder.prototype.getEnd = function () { - return this.end_; -}; - -jspb.BinaryDecoder.prototype.setEnd = function (a) { - this.end_ = a; -}; - -jspb.BinaryDecoder.prototype.reset = function () { - this.cursor_ = this.start_; -}; - -jspb.BinaryDecoder.prototype.getCursor = function () { - return this.cursor_; -}; - -jspb.BinaryDecoder.prototype.setCursor = function (a) { - this.cursor_ = a; -}; - -jspb.BinaryDecoder.prototype.advance = function (a) { - this.cursor_ += a; - goog.asserts.assert(this.cursor_ <= this.end_); -}; - -jspb.BinaryDecoder.prototype.atEnd = function () { - return this.cursor_ == this.end_; -}; - -jspb.BinaryDecoder.prototype.pastEnd = function () { - return this.cursor_ > this.end_; -}; - -jspb.BinaryDecoder.prototype.getError = function () { - return this.error_ || 0 > this.cursor_ || this.cursor_ > this.end_; -}; - -jspb.BinaryDecoder.prototype.readSplitVarint64 = function (a) { - for (var b = 128, c = 0, d = 0, e = 0; 4 > e && 128 <= b; e++) b = this.bytes_[this.cursor_++], c |= (b & 127) << 7 * e; - - 128 <= b && (b = this.bytes_[this.cursor_++], c |= (b & 127) << 28, d |= (b & 127) >> 4); - if (128 <= b) for (e = 0; 5 > e && 128 <= b; e++) b = this.bytes_[this.cursor_++], d |= (b & 127) << 7 * e + 3; - if (128 > b) return a(c >>> 0, d >>> 0); - goog.asserts.fail("Failed to read varint, encoding is invalid."); - this.error_ = !0; -}; - -jspb.BinaryDecoder.prototype.readSplitZigzagVarint64 = function (a) { - return this.readSplitVarint64(function (b, c) { - return jspb.utils.fromZigzag64(b, c, a); - }); -}; - -jspb.BinaryDecoder.prototype.readSplitFixed64 = function (a) { - var b = this.bytes_, - c = this.cursor_; - this.cursor_ += 8; - - for (var d = 0, e = 0, f = c + 7; f >= c; f--) d = d << 8 | b[f], e = e << 8 | b[f + 4]; - - return a(d, e); -}; - -jspb.BinaryDecoder.prototype.skipVarint = function () { - for (; this.bytes_[this.cursor_] & 128;) this.cursor_++; - - this.cursor_++; -}; - -jspb.BinaryDecoder.prototype.unskipVarint = function (a) { - for (; 128 < a;) this.cursor_--, a >>>= 7; - - this.cursor_--; -}; - -jspb.BinaryDecoder.prototype.readUnsignedVarint32 = function () { - var a = this.bytes_; - var b = a[this.cursor_ + 0]; - var c = b & 127; - if (128 > b) return this.cursor_ += 1, goog.asserts.assert(this.cursor_ <= this.end_), c; - b = a[this.cursor_ + 1]; - c |= (b & 127) << 7; - if (128 > b) return this.cursor_ += 2, goog.asserts.assert(this.cursor_ <= this.end_), c; - b = a[this.cursor_ + 2]; - c |= (b & 127) << 14; - if (128 > b) return this.cursor_ += 3, goog.asserts.assert(this.cursor_ <= this.end_), c; - b = a[this.cursor_ + 3]; - c |= (b & 127) << 21; - if (128 > b) return this.cursor_ += 4, goog.asserts.assert(this.cursor_ <= this.end_), c; - b = a[this.cursor_ + 4]; - c |= (b & 15) << 28; - if (128 > b) return this.cursor_ += 5, goog.asserts.assert(this.cursor_ <= this.end_), c >>> 0; - this.cursor_ += 5; - 128 <= a[this.cursor_++] && 128 <= a[this.cursor_++] && 128 <= a[this.cursor_++] && 128 <= a[this.cursor_++] && 128 <= a[this.cursor_++] && goog.asserts.assert(!1); - goog.asserts.assert(this.cursor_ <= this.end_); - return c; -}; - -jspb.BinaryDecoder.prototype.readSignedVarint32 = jspb.BinaryDecoder.prototype.readUnsignedVarint32; - -jspb.BinaryDecoder.prototype.readUnsignedVarint32String = function () { - return this.readUnsignedVarint32().toString(); -}; - -jspb.BinaryDecoder.prototype.readSignedVarint32String = function () { - return this.readSignedVarint32().toString(); -}; - -jspb.BinaryDecoder.prototype.readZigzagVarint32 = function () { - var a = this.readUnsignedVarint32(); - return a >>> 1 ^ -(a & 1); -}; - -jspb.BinaryDecoder.prototype.readUnsignedVarint64 = function () { - return this.readSplitVarint64(jspb.utils.joinUint64); -}; - -jspb.BinaryDecoder.prototype.readUnsignedVarint64String = function () { - return this.readSplitVarint64(jspb.utils.joinUnsignedDecimalString); -}; - -jspb.BinaryDecoder.prototype.readSignedVarint64 = function () { - return this.readSplitVarint64(jspb.utils.joinInt64); -}; - -jspb.BinaryDecoder.prototype.readSignedVarint64String = function () { - return this.readSplitVarint64(jspb.utils.joinSignedDecimalString); -}; - -jspb.BinaryDecoder.prototype.readZigzagVarint64 = function () { - return this.readSplitVarint64(jspb.utils.joinZigzag64); -}; - -jspb.BinaryDecoder.prototype.readZigzagVarintHash64 = function () { - return this.readSplitZigzagVarint64(jspb.utils.joinHash64); -}; - -jspb.BinaryDecoder.prototype.readZigzagVarint64String = function () { - return this.readSplitZigzagVarint64(jspb.utils.joinSignedDecimalString); -}; - -jspb.BinaryDecoder.prototype.readUint8 = function () { - var a = this.bytes_[this.cursor_ + 0]; - this.cursor_ += 1; - goog.asserts.assert(this.cursor_ <= this.end_); - return a; -}; - -jspb.BinaryDecoder.prototype.readUint16 = function () { - var a = this.bytes_[this.cursor_ + 0], - b = this.bytes_[this.cursor_ + 1]; - this.cursor_ += 2; - goog.asserts.assert(this.cursor_ <= this.end_); - return a << 0 | b << 8; -}; - -jspb.BinaryDecoder.prototype.readUint32 = function () { - var a = this.bytes_[this.cursor_ + 0], - b = this.bytes_[this.cursor_ + 1], - c = this.bytes_[this.cursor_ + 2], - d = this.bytes_[this.cursor_ + 3]; - this.cursor_ += 4; - goog.asserts.assert(this.cursor_ <= this.end_); - return (a << 0 | b << 8 | c << 16 | d << 24) >>> 0; -}; - -jspb.BinaryDecoder.prototype.readUint64 = function () { - var a = this.readUint32(), - b = this.readUint32(); - return jspb.utils.joinUint64(a, b); -}; - -jspb.BinaryDecoder.prototype.readUint64String = function () { - var a = this.readUint32(), - b = this.readUint32(); - return jspb.utils.joinUnsignedDecimalString(a, b); -}; - -jspb.BinaryDecoder.prototype.readInt8 = function () { - var a = this.bytes_[this.cursor_ + 0]; - this.cursor_ += 1; - goog.asserts.assert(this.cursor_ <= this.end_); - return a << 24 >> 24; -}; - -jspb.BinaryDecoder.prototype.readInt16 = function () { - var a = this.bytes_[this.cursor_ + 0], - b = this.bytes_[this.cursor_ + 1]; - this.cursor_ += 2; - goog.asserts.assert(this.cursor_ <= this.end_); - return (a << 0 | b << 8) << 16 >> 16; -}; - -jspb.BinaryDecoder.prototype.readInt32 = function () { - var a = this.bytes_[this.cursor_ + 0], - b = this.bytes_[this.cursor_ + 1], - c = this.bytes_[this.cursor_ + 2], - d = this.bytes_[this.cursor_ + 3]; - this.cursor_ += 4; - goog.asserts.assert(this.cursor_ <= this.end_); - return a << 0 | b << 8 | c << 16 | d << 24; -}; - -jspb.BinaryDecoder.prototype.readInt64 = function () { - var a = this.readUint32(), - b = this.readUint32(); - return jspb.utils.joinInt64(a, b); -}; - -jspb.BinaryDecoder.prototype.readInt64String = function () { - var a = this.readUint32(), - b = this.readUint32(); - return jspb.utils.joinSignedDecimalString(a, b); -}; - -jspb.BinaryDecoder.prototype.readFloat = function () { - var a = this.readUint32(); - return jspb.utils.joinFloat32(a, 0); -}; - -jspb.BinaryDecoder.prototype.readDouble = function () { - var a = this.readUint32(), - b = this.readUint32(); - return jspb.utils.joinFloat64(a, b); -}; - -jspb.BinaryDecoder.prototype.readBool = function () { - return !!this.bytes_[this.cursor_++]; -}; - -jspb.BinaryDecoder.prototype.readEnum = function () { - return this.readSignedVarint32(); -}; - -jspb.BinaryDecoder.prototype.readString = function (a) { - var b = this.bytes_, - c = this.cursor_; - a = c + a; - - for (var d = [], e = ""; c < a;) { - var f = b[c++]; - if (128 > f) d.push(f);else if (192 > f) continue;else if (224 > f) { - var g = b[c++]; - d.push((f & 31) << 6 | g & 63); - } else if (240 > f) { - g = b[c++]; - var h = b[c++]; - d.push((f & 15) << 12 | (g & 63) << 6 | h & 63); - } else if (248 > f) { - g = b[c++]; - h = b[c++]; - var k = b[c++]; - f = (f & 7) << 18 | (g & 63) << 12 | (h & 63) << 6 | k & 63; - f -= 65536; - d.push((f >> 10 & 1023) + 55296, (f & 1023) + 56320); - } - 8192 <= d.length && (e += String.fromCharCode.apply(null, d), d.length = 0); - } - - e += goog.crypt.byteArrayToString(d); - this.cursor_ = c; - return e; -}; - -jspb.BinaryDecoder.prototype.readStringWithLength = function () { - var a = this.readUnsignedVarint32(); - return this.readString(a); -}; - -jspb.BinaryDecoder.prototype.readBytes = function (a) { - if (0 > a || this.cursor_ + a > this.bytes_.length) return this.error_ = !0, goog.asserts.fail("Invalid byte length!"), new Uint8Array(0); - var b = this.bytes_.subarray(this.cursor_, this.cursor_ + a); - this.cursor_ += a; - goog.asserts.assert(this.cursor_ <= this.end_); - return b; -}; - -jspb.BinaryDecoder.prototype.readVarintHash64 = function () { - return this.readSplitVarint64(jspb.utils.joinHash64); -}; - -jspb.BinaryDecoder.prototype.readFixedHash64 = function () { - var a = this.bytes_, - b = this.cursor_, - c = a[b + 0], - d = a[b + 1], - e = a[b + 2], - f = a[b + 3], - g = a[b + 4], - h = a[b + 5], - k = a[b + 6]; - a = a[b + 7]; - this.cursor_ += 8; - return String.fromCharCode(c, d, e, f, g, h, k, a); -}; - -jspb.BinaryReader = function (a, b, c) { - this.decoder_ = jspb.BinaryDecoder.alloc(a, b, c); - this.fieldCursor_ = this.decoder_.getCursor(); - this.nextField_ = jspb.BinaryConstants.INVALID_FIELD_NUMBER; - this.nextWireType_ = jspb.BinaryConstants.WireType.INVALID; - this.error_ = !1; - this.readCallbacks_ = null; -}; - -jspb.BinaryReader.instanceCache_ = []; - -jspb.BinaryReader.alloc = function (a, b, c) { - if (jspb.BinaryReader.instanceCache_.length) { - var d = jspb.BinaryReader.instanceCache_.pop(); - a && d.decoder_.setBlock(a, b, c); - return d; - } - - return new jspb.BinaryReader(a, b, c); -}; - -jspb.BinaryReader.prototype.alloc = jspb.BinaryReader.alloc; - -jspb.BinaryReader.prototype.free = function () { - this.decoder_.clear(); - this.nextField_ = jspb.BinaryConstants.INVALID_FIELD_NUMBER; - this.nextWireType_ = jspb.BinaryConstants.WireType.INVALID; - this.error_ = !1; - this.readCallbacks_ = null; - 100 > jspb.BinaryReader.instanceCache_.length && jspb.BinaryReader.instanceCache_.push(this); -}; - -jspb.BinaryReader.prototype.getFieldCursor = function () { - return this.fieldCursor_; -}; - -jspb.BinaryReader.prototype.getCursor = function () { - return this.decoder_.getCursor(); -}; - -jspb.BinaryReader.prototype.getBuffer = function () { - return this.decoder_.getBuffer(); -}; - -jspb.BinaryReader.prototype.getFieldNumber = function () { - return this.nextField_; -}; - -jspb.BinaryReader.prototype.getWireType = function () { - return this.nextWireType_; -}; - -jspb.BinaryReader.prototype.isDelimited = function () { - return this.nextWireType_ == jspb.BinaryConstants.WireType.DELIMITED; -}; - -jspb.BinaryReader.prototype.isEndGroup = function () { - return this.nextWireType_ == jspb.BinaryConstants.WireType.END_GROUP; -}; - -jspb.BinaryReader.prototype.getError = function () { - return this.error_ || this.decoder_.getError(); -}; - -jspb.BinaryReader.prototype.setBlock = function (a, b, c) { - this.decoder_.setBlock(a, b, c); - this.nextField_ = jspb.BinaryConstants.INVALID_FIELD_NUMBER; - this.nextWireType_ = jspb.BinaryConstants.WireType.INVALID; -}; - -jspb.BinaryReader.prototype.reset = function () { - this.decoder_.reset(); - this.nextField_ = jspb.BinaryConstants.INVALID_FIELD_NUMBER; - this.nextWireType_ = jspb.BinaryConstants.WireType.INVALID; -}; - -jspb.BinaryReader.prototype.advance = function (a) { - this.decoder_.advance(a); -}; - -jspb.BinaryReader.prototype.nextField = function () { - if (this.decoder_.atEnd()) return !1; - if (this.getError()) return goog.asserts.fail("Decoder hit an error"), !1; - this.fieldCursor_ = this.decoder_.getCursor(); - var a = this.decoder_.readUnsignedVarint32(), - b = a >>> 3; - a &= 7; - if (a != jspb.BinaryConstants.WireType.VARINT && a != jspb.BinaryConstants.WireType.FIXED32 && a != jspb.BinaryConstants.WireType.FIXED64 && a != jspb.BinaryConstants.WireType.DELIMITED && a != jspb.BinaryConstants.WireType.START_GROUP && a != jspb.BinaryConstants.WireType.END_GROUP) return goog.asserts.fail("Invalid wire type: %s (at position %s)", a, this.fieldCursor_), this.error_ = !0, !1; - this.nextField_ = b; - this.nextWireType_ = a; - return !0; -}; - -jspb.BinaryReader.prototype.unskipHeader = function () { - this.decoder_.unskipVarint(this.nextField_ << 3 | this.nextWireType_); -}; - -jspb.BinaryReader.prototype.skipMatchingFields = function () { - var a = this.nextField_; - - for (this.unskipHeader(); this.nextField() && this.getFieldNumber() == a;) this.skipField(); - - this.decoder_.atEnd() || this.unskipHeader(); -}; - -jspb.BinaryReader.prototype.skipVarintField = function () { - this.nextWireType_ != jspb.BinaryConstants.WireType.VARINT ? (goog.asserts.fail("Invalid wire type for skipVarintField"), this.skipField()) : this.decoder_.skipVarint(); -}; - -jspb.BinaryReader.prototype.skipDelimitedField = function () { - if (this.nextWireType_ != jspb.BinaryConstants.WireType.DELIMITED) goog.asserts.fail("Invalid wire type for skipDelimitedField"), this.skipField();else { - var a = this.decoder_.readUnsignedVarint32(); - this.decoder_.advance(a); - } -}; - -jspb.BinaryReader.prototype.skipFixed32Field = function () { - this.nextWireType_ != jspb.BinaryConstants.WireType.FIXED32 ? (goog.asserts.fail("Invalid wire type for skipFixed32Field"), this.skipField()) : this.decoder_.advance(4); -}; - -jspb.BinaryReader.prototype.skipFixed64Field = function () { - this.nextWireType_ != jspb.BinaryConstants.WireType.FIXED64 ? (goog.asserts.fail("Invalid wire type for skipFixed64Field"), this.skipField()) : this.decoder_.advance(8); -}; - -jspb.BinaryReader.prototype.skipGroup = function () { - var a = this.nextField_; - - do { - if (!this.nextField()) { - goog.asserts.fail("Unmatched start-group tag: stream EOF"); - this.error_ = !0; - break; - } - - if (this.nextWireType_ == jspb.BinaryConstants.WireType.END_GROUP) { - this.nextField_ != a && (goog.asserts.fail("Unmatched end-group tag"), this.error_ = !0); - break; - } - - this.skipField(); - } while (1); -}; - -jspb.BinaryReader.prototype.skipField = function () { - switch (this.nextWireType_) { - case jspb.BinaryConstants.WireType.VARINT: - this.skipVarintField(); - break; - - case jspb.BinaryConstants.WireType.FIXED64: - this.skipFixed64Field(); - break; - - case jspb.BinaryConstants.WireType.DELIMITED: - this.skipDelimitedField(); - break; - - case jspb.BinaryConstants.WireType.FIXED32: - this.skipFixed32Field(); - break; - - case jspb.BinaryConstants.WireType.START_GROUP: - this.skipGroup(); - break; - - default: - goog.asserts.fail("Invalid wire encoding for field."); - } -}; - -jspb.BinaryReader.prototype.registerReadCallback = function (a, b) { - null === this.readCallbacks_ && (this.readCallbacks_ = {}); - goog.asserts.assert(!this.readCallbacks_[a]); - this.readCallbacks_[a] = b; -}; - -jspb.BinaryReader.prototype.runReadCallback = function (a) { - goog.asserts.assert(null !== this.readCallbacks_); - a = this.readCallbacks_[a]; - goog.asserts.assert(a); - return a(this); -}; - -jspb.BinaryReader.prototype.readAny = function (a) { - this.nextWireType_ = jspb.BinaryConstants.FieldTypeToWireType(a); - var b = jspb.BinaryConstants.FieldType; - - switch (a) { - case b.DOUBLE: - return this.readDouble(); - - case b.FLOAT: - return this.readFloat(); - - case b.INT64: - return this.readInt64(); - - case b.UINT64: - return this.readUint64(); - - case b.INT32: - return this.readInt32(); - - case b.FIXED64: - return this.readFixed64(); - - case b.FIXED32: - return this.readFixed32(); - - case b.BOOL: - return this.readBool(); - - case b.STRING: - return this.readString(); - - case b.GROUP: - goog.asserts.fail("Group field type not supported in readAny()"); - - case b.MESSAGE: - goog.asserts.fail("Message field type not supported in readAny()"); - - case b.BYTES: - return this.readBytes(); - - case b.UINT32: - return this.readUint32(); - - case b.ENUM: - return this.readEnum(); - - case b.SFIXED32: - return this.readSfixed32(); - - case b.SFIXED64: - return this.readSfixed64(); - - case b.SINT32: - return this.readSint32(); - - case b.SINT64: - return this.readSint64(); - - case b.FHASH64: - return this.readFixedHash64(); - - case b.VHASH64: - return this.readVarintHash64(); - - default: - goog.asserts.fail("Invalid field type in readAny()"); - } - - return 0; -}; - -jspb.BinaryReader.prototype.readMessage = function (a, b) { - goog.asserts.assert(this.nextWireType_ == jspb.BinaryConstants.WireType.DELIMITED); - var c = this.decoder_.getEnd(), - d = this.decoder_.readUnsignedVarint32(); - d = this.decoder_.getCursor() + d; - this.decoder_.setEnd(d); - b(a, this); - this.decoder_.setCursor(d); - this.decoder_.setEnd(c); -}; - -jspb.BinaryReader.prototype.readGroup = function (a, b, c) { - goog.asserts.assert(this.nextWireType_ == jspb.BinaryConstants.WireType.START_GROUP); - goog.asserts.assert(this.nextField_ == a); - c(b, this); - this.error_ || this.nextWireType_ == jspb.BinaryConstants.WireType.END_GROUP || (goog.asserts.fail("Group submessage did not end with an END_GROUP tag"), this.error_ = !0); -}; - -jspb.BinaryReader.prototype.getFieldDecoder = function () { - goog.asserts.assert(this.nextWireType_ == jspb.BinaryConstants.WireType.DELIMITED); - var a = this.decoder_.readUnsignedVarint32(), - b = this.decoder_.getCursor(), - c = b + a; - a = jspb.BinaryDecoder.alloc(this.decoder_.getBuffer(), b, a); - this.decoder_.setCursor(c); - return a; -}; - -jspb.BinaryReader.prototype.readInt32 = function () { - goog.asserts.assert(this.nextWireType_ == jspb.BinaryConstants.WireType.VARINT); - return this.decoder_.readSignedVarint32(); -}; - -jspb.BinaryReader.prototype.readInt32String = function () { - goog.asserts.assert(this.nextWireType_ == jspb.BinaryConstants.WireType.VARINT); - return this.decoder_.readSignedVarint32String(); -}; - -jspb.BinaryReader.prototype.readInt64 = function () { - goog.asserts.assert(this.nextWireType_ == jspb.BinaryConstants.WireType.VARINT); - return this.decoder_.readSignedVarint64(); -}; - -jspb.BinaryReader.prototype.readInt64String = function () { - goog.asserts.assert(this.nextWireType_ == jspb.BinaryConstants.WireType.VARINT); - return this.decoder_.readSignedVarint64String(); -}; - -jspb.BinaryReader.prototype.readUint32 = function () { - goog.asserts.assert(this.nextWireType_ == jspb.BinaryConstants.WireType.VARINT); - return this.decoder_.readUnsignedVarint32(); -}; - -jspb.BinaryReader.prototype.readUint32String = function () { - goog.asserts.assert(this.nextWireType_ == jspb.BinaryConstants.WireType.VARINT); - return this.decoder_.readUnsignedVarint32String(); -}; - -jspb.BinaryReader.prototype.readUint64 = function () { - goog.asserts.assert(this.nextWireType_ == jspb.BinaryConstants.WireType.VARINT); - return this.decoder_.readUnsignedVarint64(); -}; - -jspb.BinaryReader.prototype.readUint64String = function () { - goog.asserts.assert(this.nextWireType_ == jspb.BinaryConstants.WireType.VARINT); - return this.decoder_.readUnsignedVarint64String(); -}; - -jspb.BinaryReader.prototype.readSint32 = function () { - goog.asserts.assert(this.nextWireType_ == jspb.BinaryConstants.WireType.VARINT); - return this.decoder_.readZigzagVarint32(); -}; - -jspb.BinaryReader.prototype.readSint64 = function () { - goog.asserts.assert(this.nextWireType_ == jspb.BinaryConstants.WireType.VARINT); - return this.decoder_.readZigzagVarint64(); -}; - -jspb.BinaryReader.prototype.readSint64String = function () { - goog.asserts.assert(this.nextWireType_ == jspb.BinaryConstants.WireType.VARINT); - return this.decoder_.readZigzagVarint64String(); -}; - -jspb.BinaryReader.prototype.readFixed32 = function () { - goog.asserts.assert(this.nextWireType_ == jspb.BinaryConstants.WireType.FIXED32); - return this.decoder_.readUint32(); -}; - -jspb.BinaryReader.prototype.readFixed64 = function () { - goog.asserts.assert(this.nextWireType_ == jspb.BinaryConstants.WireType.FIXED64); - return this.decoder_.readUint64(); -}; - -jspb.BinaryReader.prototype.readFixed64String = function () { - goog.asserts.assert(this.nextWireType_ == jspb.BinaryConstants.WireType.FIXED64); - return this.decoder_.readUint64String(); -}; - -jspb.BinaryReader.prototype.readSfixed32 = function () { - goog.asserts.assert(this.nextWireType_ == jspb.BinaryConstants.WireType.FIXED32); - return this.decoder_.readInt32(); -}; - -jspb.BinaryReader.prototype.readSfixed32String = function () { - goog.asserts.assert(this.nextWireType_ == jspb.BinaryConstants.WireType.FIXED32); - return this.decoder_.readInt32().toString(); -}; - -jspb.BinaryReader.prototype.readSfixed64 = function () { - goog.asserts.assert(this.nextWireType_ == jspb.BinaryConstants.WireType.FIXED64); - return this.decoder_.readInt64(); -}; - -jspb.BinaryReader.prototype.readSfixed64String = function () { - goog.asserts.assert(this.nextWireType_ == jspb.BinaryConstants.WireType.FIXED64); - return this.decoder_.readInt64String(); -}; - -jspb.BinaryReader.prototype.readFloat = function () { - goog.asserts.assert(this.nextWireType_ == jspb.BinaryConstants.WireType.FIXED32); - return this.decoder_.readFloat(); -}; - -jspb.BinaryReader.prototype.readDouble = function () { - goog.asserts.assert(this.nextWireType_ == jspb.BinaryConstants.WireType.FIXED64); - return this.decoder_.readDouble(); -}; - -jspb.BinaryReader.prototype.readBool = function () { - goog.asserts.assert(this.nextWireType_ == jspb.BinaryConstants.WireType.VARINT); - return !!this.decoder_.readUnsignedVarint32(); -}; - -jspb.BinaryReader.prototype.readEnum = function () { - goog.asserts.assert(this.nextWireType_ == jspb.BinaryConstants.WireType.VARINT); - return this.decoder_.readSignedVarint64(); -}; - -jspb.BinaryReader.prototype.readString = function () { - goog.asserts.assert(this.nextWireType_ == jspb.BinaryConstants.WireType.DELIMITED); - var a = this.decoder_.readUnsignedVarint32(); - return this.decoder_.readString(a); -}; - -jspb.BinaryReader.prototype.readBytes = function () { - goog.asserts.assert(this.nextWireType_ == jspb.BinaryConstants.WireType.DELIMITED); - var a = this.decoder_.readUnsignedVarint32(); - return this.decoder_.readBytes(a); -}; - -jspb.BinaryReader.prototype.readVarintHash64 = function () { - goog.asserts.assert(this.nextWireType_ == jspb.BinaryConstants.WireType.VARINT); - return this.decoder_.readVarintHash64(); -}; - -jspb.BinaryReader.prototype.readSintHash64 = function () { - goog.asserts.assert(this.nextWireType_ == jspb.BinaryConstants.WireType.VARINT); - return this.decoder_.readZigzagVarintHash64(); -}; - -jspb.BinaryReader.prototype.readSplitVarint64 = function (a) { - goog.asserts.assert(this.nextWireType_ == jspb.BinaryConstants.WireType.VARINT); - return this.decoder_.readSplitVarint64(a); -}; - -jspb.BinaryReader.prototype.readSplitZigzagVarint64 = function (a) { - goog.asserts.assert(this.nextWireType_ == jspb.BinaryConstants.WireType.VARINT); - return this.decoder_.readSplitVarint64(function (b, c) { - return jspb.utils.fromZigzag64(b, c, a); - }); -}; - -jspb.BinaryReader.prototype.readFixedHash64 = function () { - goog.asserts.assert(this.nextWireType_ == jspb.BinaryConstants.WireType.FIXED64); - return this.decoder_.readFixedHash64(); -}; - -jspb.BinaryReader.prototype.readSplitFixed64 = function (a) { - goog.asserts.assert(this.nextWireType_ == jspb.BinaryConstants.WireType.FIXED64); - return this.decoder_.readSplitFixed64(a); -}; - -jspb.BinaryReader.prototype.readPackedField_ = function (a) { - goog.asserts.assert(this.nextWireType_ == jspb.BinaryConstants.WireType.DELIMITED); - var b = this.decoder_.readUnsignedVarint32(); - b = this.decoder_.getCursor() + b; - - for (var c = []; this.decoder_.getCursor() < b;) c.push(a.call(this.decoder_)); - - return c; -}; - -jspb.BinaryReader.prototype.readPackedInt32 = function () { - return this.readPackedField_(this.decoder_.readSignedVarint32); -}; - -jspb.BinaryReader.prototype.readPackedInt32String = function () { - return this.readPackedField_(this.decoder_.readSignedVarint32String); -}; - -jspb.BinaryReader.prototype.readPackedInt64 = function () { - return this.readPackedField_(this.decoder_.readSignedVarint64); -}; - -jspb.BinaryReader.prototype.readPackedInt64String = function () { - return this.readPackedField_(this.decoder_.readSignedVarint64String); -}; - -jspb.BinaryReader.prototype.readPackedUint32 = function () { - return this.readPackedField_(this.decoder_.readUnsignedVarint32); -}; - -jspb.BinaryReader.prototype.readPackedUint32String = function () { - return this.readPackedField_(this.decoder_.readUnsignedVarint32String); -}; - -jspb.BinaryReader.prototype.readPackedUint64 = function () { - return this.readPackedField_(this.decoder_.readUnsignedVarint64); -}; - -jspb.BinaryReader.prototype.readPackedUint64String = function () { - return this.readPackedField_(this.decoder_.readUnsignedVarint64String); -}; - -jspb.BinaryReader.prototype.readPackedSint32 = function () { - return this.readPackedField_(this.decoder_.readZigzagVarint32); -}; - -jspb.BinaryReader.prototype.readPackedSint64 = function () { - return this.readPackedField_(this.decoder_.readZigzagVarint64); -}; - -jspb.BinaryReader.prototype.readPackedSint64String = function () { - return this.readPackedField_(this.decoder_.readZigzagVarint64String); -}; - -jspb.BinaryReader.prototype.readPackedFixed32 = function () { - return this.readPackedField_(this.decoder_.readUint32); -}; - -jspb.BinaryReader.prototype.readPackedFixed64 = function () { - return this.readPackedField_(this.decoder_.readUint64); -}; - -jspb.BinaryReader.prototype.readPackedFixed64String = function () { - return this.readPackedField_(this.decoder_.readUint64String); -}; - -jspb.BinaryReader.prototype.readPackedSfixed32 = function () { - return this.readPackedField_(this.decoder_.readInt32); -}; - -jspb.BinaryReader.prototype.readPackedSfixed64 = function () { - return this.readPackedField_(this.decoder_.readInt64); -}; - -jspb.BinaryReader.prototype.readPackedSfixed64String = function () { - return this.readPackedField_(this.decoder_.readInt64String); -}; - -jspb.BinaryReader.prototype.readPackedFloat = function () { - return this.readPackedField_(this.decoder_.readFloat); -}; - -jspb.BinaryReader.prototype.readPackedDouble = function () { - return this.readPackedField_(this.decoder_.readDouble); -}; - -jspb.BinaryReader.prototype.readPackedBool = function () { - return this.readPackedField_(this.decoder_.readBool); -}; - -jspb.BinaryReader.prototype.readPackedEnum = function () { - return this.readPackedField_(this.decoder_.readEnum); -}; - -jspb.BinaryReader.prototype.readPackedVarintHash64 = function () { - return this.readPackedField_(this.decoder_.readVarintHash64); -}; - -jspb.BinaryReader.prototype.readPackedFixedHash64 = function () { - return this.readPackedField_(this.decoder_.readFixedHash64); -}; - -jspb.BinaryEncoder = function () { - this.buffer_ = []; -}; - -jspb.BinaryEncoder.prototype.length = function () { - return this.buffer_.length; -}; - -jspb.BinaryEncoder.prototype.end = function () { - var a = this.buffer_; - this.buffer_ = []; - return a; -}; - -jspb.BinaryEncoder.prototype.writeSplitVarint64 = function (a, b) { - goog.asserts.assert(a == Math.floor(a)); - goog.asserts.assert(b == Math.floor(b)); - goog.asserts.assert(0 <= a && a < jspb.BinaryConstants.TWO_TO_32); - - for (goog.asserts.assert(0 <= b && b < jspb.BinaryConstants.TWO_TO_32); 0 < b || 127 < a;) this.buffer_.push(a & 127 | 128), a = (a >>> 7 | b << 25) >>> 0, b >>>= 7; - - this.buffer_.push(a); -}; - -jspb.BinaryEncoder.prototype.writeSplitFixed64 = function (a, b) { - goog.asserts.assert(a == Math.floor(a)); - goog.asserts.assert(b == Math.floor(b)); - goog.asserts.assert(0 <= a && a < jspb.BinaryConstants.TWO_TO_32); - goog.asserts.assert(0 <= b && b < jspb.BinaryConstants.TWO_TO_32); - this.writeUint32(a); - this.writeUint32(b); -}; - -jspb.BinaryEncoder.prototype.writeUnsignedVarint32 = function (a) { - goog.asserts.assert(a == Math.floor(a)); - - for (goog.asserts.assert(0 <= a && a < jspb.BinaryConstants.TWO_TO_32); 127 < a;) this.buffer_.push(a & 127 | 128), a >>>= 7; - - this.buffer_.push(a); -}; - -jspb.BinaryEncoder.prototype.writeSignedVarint32 = function (a) { - goog.asserts.assert(a == Math.floor(a)); - goog.asserts.assert(a >= -jspb.BinaryConstants.TWO_TO_31 && a < jspb.BinaryConstants.TWO_TO_31); - if (0 <= a) this.writeUnsignedVarint32(a);else { - for (var b = 0; 9 > b; b++) this.buffer_.push(a & 127 | 128), a >>= 7; - - this.buffer_.push(1); - } -}; - -jspb.BinaryEncoder.prototype.writeUnsignedVarint64 = function (a) { - goog.asserts.assert(a == Math.floor(a)); - goog.asserts.assert(0 <= a && a < jspb.BinaryConstants.TWO_TO_64); - jspb.utils.splitInt64(a); - this.writeSplitVarint64(jspb.utils.split64Low, jspb.utils.split64High); -}; - -jspb.BinaryEncoder.prototype.writeSignedVarint64 = function (a) { - goog.asserts.assert(a == Math.floor(a)); - goog.asserts.assert(a >= -jspb.BinaryConstants.TWO_TO_63 && a < jspb.BinaryConstants.TWO_TO_63); - jspb.utils.splitInt64(a); - this.writeSplitVarint64(jspb.utils.split64Low, jspb.utils.split64High); -}; - -jspb.BinaryEncoder.prototype.writeZigzagVarint32 = function (a) { - goog.asserts.assert(a == Math.floor(a)); - goog.asserts.assert(a >= -jspb.BinaryConstants.TWO_TO_31 && a < jspb.BinaryConstants.TWO_TO_31); - this.writeUnsignedVarint32((a << 1 ^ a >> 31) >>> 0); -}; - -jspb.BinaryEncoder.prototype.writeZigzagVarint64 = function (a) { - goog.asserts.assert(a == Math.floor(a)); - goog.asserts.assert(a >= -jspb.BinaryConstants.TWO_TO_63 && a < jspb.BinaryConstants.TWO_TO_63); - jspb.utils.splitZigzag64(a); - this.writeSplitVarint64(jspb.utils.split64Low, jspb.utils.split64High); -}; - -jspb.BinaryEncoder.prototype.writeZigzagVarint64String = function (a) { - this.writeZigzagVarintHash64(jspb.utils.decimalStringToHash64(a)); -}; - -jspb.BinaryEncoder.prototype.writeZigzagVarintHash64 = function (a) { - var b = this; - jspb.utils.splitHash64(a); - jspb.utils.toZigzag64(jspb.utils.split64Low, jspb.utils.split64High, function (a, d) { - b.writeSplitVarint64(a >>> 0, d >>> 0); - }); -}; - -jspb.BinaryEncoder.prototype.writeUint8 = function (a) { - goog.asserts.assert(a == Math.floor(a)); - goog.asserts.assert(0 <= a && 256 > a); - this.buffer_.push(a >>> 0 & 255); -}; - -jspb.BinaryEncoder.prototype.writeUint16 = function (a) { - goog.asserts.assert(a == Math.floor(a)); - goog.asserts.assert(0 <= a && 65536 > a); - this.buffer_.push(a >>> 0 & 255); - this.buffer_.push(a >>> 8 & 255); -}; - -jspb.BinaryEncoder.prototype.writeUint32 = function (a) { - goog.asserts.assert(a == Math.floor(a)); - goog.asserts.assert(0 <= a && a < jspb.BinaryConstants.TWO_TO_32); - this.buffer_.push(a >>> 0 & 255); - this.buffer_.push(a >>> 8 & 255); - this.buffer_.push(a >>> 16 & 255); - this.buffer_.push(a >>> 24 & 255); -}; - -jspb.BinaryEncoder.prototype.writeUint64 = function (a) { - goog.asserts.assert(a == Math.floor(a)); - goog.asserts.assert(0 <= a && a < jspb.BinaryConstants.TWO_TO_64); - jspb.utils.splitUint64(a); - this.writeUint32(jspb.utils.split64Low); - this.writeUint32(jspb.utils.split64High); -}; - -jspb.BinaryEncoder.prototype.writeInt8 = function (a) { - goog.asserts.assert(a == Math.floor(a)); - goog.asserts.assert(-128 <= a && 128 > a); - this.buffer_.push(a >>> 0 & 255); -}; - -jspb.BinaryEncoder.prototype.writeInt16 = function (a) { - goog.asserts.assert(a == Math.floor(a)); - goog.asserts.assert(-32768 <= a && 32768 > a); - this.buffer_.push(a >>> 0 & 255); - this.buffer_.push(a >>> 8 & 255); -}; - -jspb.BinaryEncoder.prototype.writeInt32 = function (a) { - goog.asserts.assert(a == Math.floor(a)); - goog.asserts.assert(a >= -jspb.BinaryConstants.TWO_TO_31 && a < jspb.BinaryConstants.TWO_TO_31); - this.buffer_.push(a >>> 0 & 255); - this.buffer_.push(a >>> 8 & 255); - this.buffer_.push(a >>> 16 & 255); - this.buffer_.push(a >>> 24 & 255); -}; - -jspb.BinaryEncoder.prototype.writeInt64 = function (a) { - goog.asserts.assert(a == Math.floor(a)); - goog.asserts.assert(a >= -jspb.BinaryConstants.TWO_TO_63 && a < jspb.BinaryConstants.TWO_TO_63); - jspb.utils.splitInt64(a); - this.writeSplitFixed64(jspb.utils.split64Low, jspb.utils.split64High); -}; - -jspb.BinaryEncoder.prototype.writeInt64String = function (a) { - goog.asserts.assert(a == Math.floor(a)); - goog.asserts.assert(+a >= -jspb.BinaryConstants.TWO_TO_63 && +a < jspb.BinaryConstants.TWO_TO_63); - jspb.utils.splitHash64(jspb.utils.decimalStringToHash64(a)); - this.writeSplitFixed64(jspb.utils.split64Low, jspb.utils.split64High); -}; - -jspb.BinaryEncoder.prototype.writeFloat = function (a) { - goog.asserts.assert(Infinity === a || -Infinity === a || isNaN(a) || a >= -jspb.BinaryConstants.FLOAT32_MAX && a <= jspb.BinaryConstants.FLOAT32_MAX); - jspb.utils.splitFloat32(a); - this.writeUint32(jspb.utils.split64Low); -}; - -jspb.BinaryEncoder.prototype.writeDouble = function (a) { - goog.asserts.assert(Infinity === a || -Infinity === a || isNaN(a) || a >= -jspb.BinaryConstants.FLOAT64_MAX && a <= jspb.BinaryConstants.FLOAT64_MAX); - jspb.utils.splitFloat64(a); - this.writeUint32(jspb.utils.split64Low); - this.writeUint32(jspb.utils.split64High); -}; - -jspb.BinaryEncoder.prototype.writeBool = function (a) { - goog.asserts.assert("boolean" === typeof a || "number" === typeof a); - this.buffer_.push(a ? 1 : 0); -}; - -jspb.BinaryEncoder.prototype.writeEnum = function (a) { - goog.asserts.assert(a == Math.floor(a)); - goog.asserts.assert(a >= -jspb.BinaryConstants.TWO_TO_31 && a < jspb.BinaryConstants.TWO_TO_31); - this.writeSignedVarint32(a); -}; - -jspb.BinaryEncoder.prototype.writeBytes = function (a) { - this.buffer_.push.apply(this.buffer_, a); -}; - -jspb.BinaryEncoder.prototype.writeVarintHash64 = function (a) { - jspb.utils.splitHash64(a); - this.writeSplitVarint64(jspb.utils.split64Low, jspb.utils.split64High); -}; - -jspb.BinaryEncoder.prototype.writeFixedHash64 = function (a) { - jspb.utils.splitHash64(a); - this.writeUint32(jspb.utils.split64Low); - this.writeUint32(jspb.utils.split64High); -}; - -jspb.BinaryEncoder.prototype.writeString = function (a) { - for (var b = this.buffer_.length, c = 0; c < a.length; c++) { - var d = a.charCodeAt(c); - if (128 > d) this.buffer_.push(d);else if (2048 > d) this.buffer_.push(d >> 6 | 192), this.buffer_.push(d & 63 | 128);else if (65536 > d) if (55296 <= d && 56319 >= d && c + 1 < a.length) { - var e = a.charCodeAt(c + 1); - 56320 <= e && 57343 >= e && (d = 1024 * (d - 55296) + e - 56320 + 65536, this.buffer_.push(d >> 18 | 240), this.buffer_.push(d >> 12 & 63 | 128), this.buffer_.push(d >> 6 & 63 | 128), this.buffer_.push(d & 63 | 128), c++); - } else this.buffer_.push(d >> 12 | 224), this.buffer_.push(d >> 6 & 63 | 128), this.buffer_.push(d & 63 | 128); - } - - return this.buffer_.length - b; -}; - -jspb.arith = {}; - -jspb.arith.UInt64 = function (a, b) { - this.lo = a; - this.hi = b; -}; - -jspb.arith.UInt64.prototype.cmp = function (a) { - return this.hi < a.hi || this.hi == a.hi && this.lo < a.lo ? -1 : this.hi == a.hi && this.lo == a.lo ? 0 : 1; -}; - -jspb.arith.UInt64.prototype.rightShift = function () { - return new jspb.arith.UInt64((this.lo >>> 1 | (this.hi & 1) << 31) >>> 0, this.hi >>> 1 >>> 0); -}; - -jspb.arith.UInt64.prototype.leftShift = function () { - return new jspb.arith.UInt64(this.lo << 1 >>> 0, (this.hi << 1 | this.lo >>> 31) >>> 0); -}; - -jspb.arith.UInt64.prototype.msb = function () { - return !!(this.hi & 2147483648); -}; - -jspb.arith.UInt64.prototype.lsb = function () { - return !!(this.lo & 1); -}; - -jspb.arith.UInt64.prototype.zero = function () { - return 0 == this.lo && 0 == this.hi; -}; - -jspb.arith.UInt64.prototype.add = function (a) { - return new jspb.arith.UInt64((this.lo + a.lo & 4294967295) >>> 0 >>> 0, ((this.hi + a.hi & 4294967295) >>> 0) + (4294967296 <= this.lo + a.lo ? 1 : 0) >>> 0); -}; - -jspb.arith.UInt64.prototype.sub = function (a) { - return new jspb.arith.UInt64((this.lo - a.lo & 4294967295) >>> 0 >>> 0, ((this.hi - a.hi & 4294967295) >>> 0) - (0 > this.lo - a.lo ? 1 : 0) >>> 0); -}; - -jspb.arith.UInt64.mul32x32 = function (a, b) { - var c = a & 65535; - a >>>= 16; - var d = b & 65535, - e = b >>> 16; - b = c * d + 65536 * (c * e & 65535) + 65536 * (a * d & 65535); - - for (c = a * e + (c * e >>> 16) + (a * d >>> 16); 4294967296 <= b;) b -= 4294967296, c += 1; - - return new jspb.arith.UInt64(b >>> 0, c >>> 0); -}; - -jspb.arith.UInt64.prototype.mul = function (a) { - var b = jspb.arith.UInt64.mul32x32(this.lo, a); - a = jspb.arith.UInt64.mul32x32(this.hi, a); - a.hi = a.lo; - a.lo = 0; - return b.add(a); -}; - -jspb.arith.UInt64.prototype.div = function (a) { - if (0 == a) return []; - var b = new jspb.arith.UInt64(0, 0), - c = new jspb.arith.UInt64(this.lo, this.hi); - a = new jspb.arith.UInt64(a, 0); - - for (var d = new jspb.arith.UInt64(1, 0); !a.msb();) a = a.leftShift(), d = d.leftShift(); - - for (; !d.zero();) 0 >= a.cmp(c) && (b = b.add(d), c = c.sub(a)), a = a.rightShift(), d = d.rightShift(); - - return [b, c]; -}; - -jspb.arith.UInt64.prototype.toString = function () { - for (var a = "", b = this; !b.zero();) { - b = b.div(10); - var c = b[0]; - a = b[1].lo + a; - b = c; - } - - "" == a && (a = "0"); - return a; -}; - -jspb.arith.UInt64.fromString = function (a) { - for (var b = new jspb.arith.UInt64(0, 0), c = new jspb.arith.UInt64(0, 0), d = 0; d < a.length; d++) { - if ("0" > a[d] || "9" < a[d]) return null; - var e = parseInt(a[d], 10); - c.lo = e; - b = b.mul(10).add(c); - } - - return b; -}; - -jspb.arith.UInt64.prototype.clone = function () { - return new jspb.arith.UInt64(this.lo, this.hi); -}; - -jspb.arith.Int64 = function (a, b) { - this.lo = a; - this.hi = b; -}; - -jspb.arith.Int64.prototype.add = function (a) { - return new jspb.arith.Int64((this.lo + a.lo & 4294967295) >>> 0 >>> 0, ((this.hi + a.hi & 4294967295) >>> 0) + (4294967296 <= this.lo + a.lo ? 1 : 0) >>> 0); -}; - -jspb.arith.Int64.prototype.sub = function (a) { - return new jspb.arith.Int64((this.lo - a.lo & 4294967295) >>> 0 >>> 0, ((this.hi - a.hi & 4294967295) >>> 0) - (0 > this.lo - a.lo ? 1 : 0) >>> 0); -}; - -jspb.arith.Int64.prototype.clone = function () { - return new jspb.arith.Int64(this.lo, this.hi); -}; - -jspb.arith.Int64.prototype.toString = function () { - var a = 0 != (this.hi & 2147483648), - b = new jspb.arith.UInt64(this.lo, this.hi); - a && (b = new jspb.arith.UInt64(0, 0).sub(b)); - return (a ? "-" : "") + b.toString(); -}; - -jspb.arith.Int64.fromString = function (a) { - var b = 0 < a.length && "-" == a[0]; - b && (a = a.substring(1)); - a = jspb.arith.UInt64.fromString(a); - if (null === a) return null; - b && (a = new jspb.arith.UInt64(0, 0).sub(a)); - return new jspb.arith.Int64(a.lo, a.hi); -}; - -jspb.BinaryWriter = function () { - this.blocks_ = []; - this.totalLength_ = 0; - this.encoder_ = new jspb.BinaryEncoder(); - this.bookmarks_ = []; -}; - -jspb.BinaryWriter.prototype.appendUint8Array_ = function (a) { - var b = this.encoder_.end(); - this.blocks_.push(b); - this.blocks_.push(a); - this.totalLength_ += b.length + a.length; -}; - -jspb.BinaryWriter.prototype.beginDelimited_ = function (a) { - this.writeFieldHeader_(a, jspb.BinaryConstants.WireType.DELIMITED); - a = this.encoder_.end(); - this.blocks_.push(a); - this.totalLength_ += a.length; - a.push(this.totalLength_); - return a; -}; - -jspb.BinaryWriter.prototype.endDelimited_ = function (a) { - var b = a.pop(); - b = this.totalLength_ + this.encoder_.length() - b; - - for (goog.asserts.assert(0 <= b); 127 < b;) a.push(b & 127 | 128), b >>>= 7, this.totalLength_++; - - a.push(b); - this.totalLength_++; -}; - -jspb.BinaryWriter.prototype.writeSerializedMessage = function (a, b, c) { - this.appendUint8Array_(a.subarray(b, c)); -}; - -jspb.BinaryWriter.prototype.maybeWriteSerializedMessage = function (a, b, c) { - null != a && null != b && null != c && this.writeSerializedMessage(a, b, c); -}; - -jspb.BinaryWriter.prototype.reset = function () { - this.blocks_ = []; - this.encoder_.end(); - this.totalLength_ = 0; - this.bookmarks_ = []; -}; - -jspb.BinaryWriter.prototype.getResultBuffer = function () { - goog.asserts.assert(0 == this.bookmarks_.length); - - for (var a = new Uint8Array(this.totalLength_ + this.encoder_.length()), b = this.blocks_, c = b.length, d = 0, e = 0; e < c; e++) { - var f = b[e]; - a.set(f, d); - d += f.length; - } - - b = this.encoder_.end(); - a.set(b, d); - d += b.length; - goog.asserts.assert(d == a.length); - this.blocks_ = [a]; - return a; -}; - -jspb.BinaryWriter.prototype.getResultBase64String = function (a) { - return goog.crypt.base64.encodeByteArray(this.getResultBuffer(), a); -}; - -jspb.BinaryWriter.prototype.beginSubMessage = function (a) { - this.bookmarks_.push(this.beginDelimited_(a)); -}; - -jspb.BinaryWriter.prototype.endSubMessage = function () { - goog.asserts.assert(0 <= this.bookmarks_.length); - this.endDelimited_(this.bookmarks_.pop()); -}; - -jspb.BinaryWriter.prototype.writeFieldHeader_ = function (a, b) { - goog.asserts.assert(1 <= a && a == Math.floor(a)); - this.encoder_.writeUnsignedVarint32(8 * a + b); -}; - -jspb.BinaryWriter.prototype.writeAny = function (a, b, c) { - var d = jspb.BinaryConstants.FieldType; - - switch (a) { - case d.DOUBLE: - this.writeDouble(b, c); - break; - - case d.FLOAT: - this.writeFloat(b, c); - break; - - case d.INT64: - this.writeInt64(b, c); - break; - - case d.UINT64: - this.writeUint64(b, c); - break; - - case d.INT32: - this.writeInt32(b, c); - break; - - case d.FIXED64: - this.writeFixed64(b, c); - break; - - case d.FIXED32: - this.writeFixed32(b, c); - break; - - case d.BOOL: - this.writeBool(b, c); - break; - - case d.STRING: - this.writeString(b, c); - break; - - case d.GROUP: - goog.asserts.fail("Group field type not supported in writeAny()"); - break; - - case d.MESSAGE: - goog.asserts.fail("Message field type not supported in writeAny()"); - break; - - case d.BYTES: - this.writeBytes(b, c); - break; - - case d.UINT32: - this.writeUint32(b, c); - break; - - case d.ENUM: - this.writeEnum(b, c); - break; - - case d.SFIXED32: - this.writeSfixed32(b, c); - break; - - case d.SFIXED64: - this.writeSfixed64(b, c); - break; - - case d.SINT32: - this.writeSint32(b, c); - break; - - case d.SINT64: - this.writeSint64(b, c); - break; - - case d.FHASH64: - this.writeFixedHash64(b, c); - break; - - case d.VHASH64: - this.writeVarintHash64(b, c); - break; - - default: - goog.asserts.fail("Invalid field type in writeAny()"); - } -}; - -jspb.BinaryWriter.prototype.writeUnsignedVarint32_ = function (a, b) { - null != b && (this.writeFieldHeader_(a, jspb.BinaryConstants.WireType.VARINT), this.encoder_.writeUnsignedVarint32(b)); -}; - -jspb.BinaryWriter.prototype.writeSignedVarint32_ = function (a, b) { - null != b && (this.writeFieldHeader_(a, jspb.BinaryConstants.WireType.VARINT), this.encoder_.writeSignedVarint32(b)); -}; - -jspb.BinaryWriter.prototype.writeUnsignedVarint64_ = function (a, b) { - null != b && (this.writeFieldHeader_(a, jspb.BinaryConstants.WireType.VARINT), this.encoder_.writeUnsignedVarint64(b)); -}; - -jspb.BinaryWriter.prototype.writeSignedVarint64_ = function (a, b) { - null != b && (this.writeFieldHeader_(a, jspb.BinaryConstants.WireType.VARINT), this.encoder_.writeSignedVarint64(b)); -}; - -jspb.BinaryWriter.prototype.writeZigzagVarint32_ = function (a, b) { - null != b && (this.writeFieldHeader_(a, jspb.BinaryConstants.WireType.VARINT), this.encoder_.writeZigzagVarint32(b)); -}; - -jspb.BinaryWriter.prototype.writeZigzagVarint64_ = function (a, b) { - null != b && (this.writeFieldHeader_(a, jspb.BinaryConstants.WireType.VARINT), this.encoder_.writeZigzagVarint64(b)); -}; - -jspb.BinaryWriter.prototype.writeZigzagVarint64String_ = function (a, b) { - null != b && (this.writeFieldHeader_(a, jspb.BinaryConstants.WireType.VARINT), this.encoder_.writeZigzagVarint64String(b)); -}; - -jspb.BinaryWriter.prototype.writeZigzagVarintHash64_ = function (a, b) { - null != b && (this.writeFieldHeader_(a, jspb.BinaryConstants.WireType.VARINT), this.encoder_.writeZigzagVarintHash64(b)); -}; - -jspb.BinaryWriter.prototype.writeInt32 = function (a, b) { - null != b && (goog.asserts.assert(b >= -jspb.BinaryConstants.TWO_TO_31 && b < jspb.BinaryConstants.TWO_TO_31), this.writeSignedVarint32_(a, b)); -}; - -jspb.BinaryWriter.prototype.writeInt32String = function (a, b) { - null != b && (b = parseInt(b, 10), goog.asserts.assert(b >= -jspb.BinaryConstants.TWO_TO_31 && b < jspb.BinaryConstants.TWO_TO_31), this.writeSignedVarint32_(a, b)); -}; - -jspb.BinaryWriter.prototype.writeInt64 = function (a, b) { - null != b && (goog.asserts.assert(b >= -jspb.BinaryConstants.TWO_TO_63 && b < jspb.BinaryConstants.TWO_TO_63), this.writeSignedVarint64_(a, b)); -}; - -jspb.BinaryWriter.prototype.writeInt64String = function (a, b) { - null != b && (b = jspb.arith.Int64.fromString(b), this.writeFieldHeader_(a, jspb.BinaryConstants.WireType.VARINT), this.encoder_.writeSplitVarint64(b.lo, b.hi)); -}; - -jspb.BinaryWriter.prototype.writeUint32 = function (a, b) { - null != b && (goog.asserts.assert(0 <= b && b < jspb.BinaryConstants.TWO_TO_32), this.writeUnsignedVarint32_(a, b)); -}; - -jspb.BinaryWriter.prototype.writeUint32String = function (a, b) { - null != b && (b = parseInt(b, 10), goog.asserts.assert(0 <= b && b < jspb.BinaryConstants.TWO_TO_32), this.writeUnsignedVarint32_(a, b)); -}; - -jspb.BinaryWriter.prototype.writeUint64 = function (a, b) { - null != b && (goog.asserts.assert(0 <= b && b < jspb.BinaryConstants.TWO_TO_64), this.writeUnsignedVarint64_(a, b)); -}; - -jspb.BinaryWriter.prototype.writeUint64String = function (a, b) { - null != b && (b = jspb.arith.UInt64.fromString(b), this.writeFieldHeader_(a, jspb.BinaryConstants.WireType.VARINT), this.encoder_.writeSplitVarint64(b.lo, b.hi)); -}; - -jspb.BinaryWriter.prototype.writeSint32 = function (a, b) { - null != b && (goog.asserts.assert(b >= -jspb.BinaryConstants.TWO_TO_31 && b < jspb.BinaryConstants.TWO_TO_31), this.writeZigzagVarint32_(a, b)); -}; - -jspb.BinaryWriter.prototype.writeSint64 = function (a, b) { - null != b && (goog.asserts.assert(b >= -jspb.BinaryConstants.TWO_TO_63 && b < jspb.BinaryConstants.TWO_TO_63), this.writeZigzagVarint64_(a, b)); -}; - -jspb.BinaryWriter.prototype.writeSintHash64 = function (a, b) { - null != b && this.writeZigzagVarintHash64_(a, b); -}; - -jspb.BinaryWriter.prototype.writeSint64String = function (a, b) { - null != b && this.writeZigzagVarint64String_(a, b); -}; - -jspb.BinaryWriter.prototype.writeFixed32 = function (a, b) { - null != b && (goog.asserts.assert(0 <= b && b < jspb.BinaryConstants.TWO_TO_32), this.writeFieldHeader_(a, jspb.BinaryConstants.WireType.FIXED32), this.encoder_.writeUint32(b)); -}; - -jspb.BinaryWriter.prototype.writeFixed64 = function (a, b) { - null != b && (goog.asserts.assert(0 <= b && b < jspb.BinaryConstants.TWO_TO_64), this.writeFieldHeader_(a, jspb.BinaryConstants.WireType.FIXED64), this.encoder_.writeUint64(b)); -}; - -jspb.BinaryWriter.prototype.writeFixed64String = function (a, b) { - null != b && (b = jspb.arith.UInt64.fromString(b), this.writeFieldHeader_(a, jspb.BinaryConstants.WireType.FIXED64), this.encoder_.writeSplitFixed64(b.lo, b.hi)); -}; - -jspb.BinaryWriter.prototype.writeSfixed32 = function (a, b) { - null != b && (goog.asserts.assert(b >= -jspb.BinaryConstants.TWO_TO_31 && b < jspb.BinaryConstants.TWO_TO_31), this.writeFieldHeader_(a, jspb.BinaryConstants.WireType.FIXED32), this.encoder_.writeInt32(b)); -}; - -jspb.BinaryWriter.prototype.writeSfixed64 = function (a, b) { - null != b && (goog.asserts.assert(b >= -jspb.BinaryConstants.TWO_TO_63 && b < jspb.BinaryConstants.TWO_TO_63), this.writeFieldHeader_(a, jspb.BinaryConstants.WireType.FIXED64), this.encoder_.writeInt64(b)); -}; - -jspb.BinaryWriter.prototype.writeSfixed64String = function (a, b) { - null != b && (b = jspb.arith.Int64.fromString(b), this.writeFieldHeader_(a, jspb.BinaryConstants.WireType.FIXED64), this.encoder_.writeSplitFixed64(b.lo, b.hi)); -}; - -jspb.BinaryWriter.prototype.writeFloat = function (a, b) { - null != b && (this.writeFieldHeader_(a, jspb.BinaryConstants.WireType.FIXED32), this.encoder_.writeFloat(b)); -}; - -jspb.BinaryWriter.prototype.writeDouble = function (a, b) { - null != b && (this.writeFieldHeader_(a, jspb.BinaryConstants.WireType.FIXED64), this.encoder_.writeDouble(b)); -}; - -jspb.BinaryWriter.prototype.writeBool = function (a, b) { - null != b && (goog.asserts.assert("boolean" === typeof b || "number" === typeof b), this.writeFieldHeader_(a, jspb.BinaryConstants.WireType.VARINT), this.encoder_.writeBool(b)); -}; - -jspb.BinaryWriter.prototype.writeEnum = function (a, b) { - null != b && (goog.asserts.assert(b >= -jspb.BinaryConstants.TWO_TO_31 && b < jspb.BinaryConstants.TWO_TO_31), this.writeFieldHeader_(a, jspb.BinaryConstants.WireType.VARINT), this.encoder_.writeSignedVarint32(b)); -}; - -jspb.BinaryWriter.prototype.writeString = function (a, b) { - null != b && (a = this.beginDelimited_(a), this.encoder_.writeString(b), this.endDelimited_(a)); -}; - -jspb.BinaryWriter.prototype.writeBytes = function (a, b) { - null != b && (b = jspb.utils.byteSourceToUint8Array(b), this.writeFieldHeader_(a, jspb.BinaryConstants.WireType.DELIMITED), this.encoder_.writeUnsignedVarint32(b.length), this.appendUint8Array_(b)); -}; - -jspb.BinaryWriter.prototype.writeMessage = function (a, b, c) { - null != b && (a = this.beginDelimited_(a), c(b, this), this.endDelimited_(a)); -}; - -jspb.BinaryWriter.prototype.writeMessageSet = function (a, b, c) { - null != b && (this.writeFieldHeader_(1, jspb.BinaryConstants.WireType.START_GROUP), this.writeFieldHeader_(2, jspb.BinaryConstants.WireType.VARINT), this.encoder_.writeSignedVarint32(a), a = this.beginDelimited_(3), c(b, this), this.endDelimited_(a), this.writeFieldHeader_(1, jspb.BinaryConstants.WireType.END_GROUP)); -}; - -jspb.BinaryWriter.prototype.writeGroup = function (a, b, c) { - null != b && (this.writeFieldHeader_(a, jspb.BinaryConstants.WireType.START_GROUP), c(b, this), this.writeFieldHeader_(a, jspb.BinaryConstants.WireType.END_GROUP)); -}; - -jspb.BinaryWriter.prototype.writeFixedHash64 = function (a, b) { - null != b && (goog.asserts.assert(8 == b.length), this.writeFieldHeader_(a, jspb.BinaryConstants.WireType.FIXED64), this.encoder_.writeFixedHash64(b)); -}; - -jspb.BinaryWriter.prototype.writeVarintHash64 = function (a, b) { - null != b && (goog.asserts.assert(8 == b.length), this.writeFieldHeader_(a, jspb.BinaryConstants.WireType.VARINT), this.encoder_.writeVarintHash64(b)); -}; - -jspb.BinaryWriter.prototype.writeSplitFixed64 = function (a, b, c) { - this.writeFieldHeader_(a, jspb.BinaryConstants.WireType.FIXED64); - this.encoder_.writeSplitFixed64(b, c); -}; - -jspb.BinaryWriter.prototype.writeSplitVarint64 = function (a, b, c) { - this.writeFieldHeader_(a, jspb.BinaryConstants.WireType.VARINT); - this.encoder_.writeSplitVarint64(b, c); -}; - -jspb.BinaryWriter.prototype.writeSplitZigzagVarint64 = function (a, b, c) { - this.writeFieldHeader_(a, jspb.BinaryConstants.WireType.VARINT); - var d = this.encoder_; - jspb.utils.toZigzag64(b, c, function (a, b) { - d.writeSplitVarint64(a >>> 0, b >>> 0); - }); -}; - -jspb.BinaryWriter.prototype.writeRepeatedInt32 = function (a, b) { - if (null != b) for (var c = 0; c < b.length; c++) this.writeSignedVarint32_(a, b[c]); -}; - -jspb.BinaryWriter.prototype.writeRepeatedInt32String = function (a, b) { - if (null != b) for (var c = 0; c < b.length; c++) this.writeInt32String(a, b[c]); -}; - -jspb.BinaryWriter.prototype.writeRepeatedInt64 = function (a, b) { - if (null != b) for (var c = 0; c < b.length; c++) this.writeSignedVarint64_(a, b[c]); -}; - -jspb.BinaryWriter.prototype.writeRepeatedSplitFixed64 = function (a, b, c, d) { - if (null != b) for (var e = 0; e < b.length; e++) this.writeSplitFixed64(a, c(b[e]), d(b[e])); -}; - -jspb.BinaryWriter.prototype.writeRepeatedSplitVarint64 = function (a, b, c, d) { - if (null != b) for (var e = 0; e < b.length; e++) this.writeSplitVarint64(a, c(b[e]), d(b[e])); -}; - -jspb.BinaryWriter.prototype.writeRepeatedSplitZigzagVarint64 = function (a, b, c, d) { - if (null != b) for (var e = 0; e < b.length; e++) this.writeSplitZigzagVarint64(a, c(b[e]), d(b[e])); -}; - -jspb.BinaryWriter.prototype.writeRepeatedInt64String = function (a, b) { - if (null != b) for (var c = 0; c < b.length; c++) this.writeInt64String(a, b[c]); -}; - -jspb.BinaryWriter.prototype.writeRepeatedUint32 = function (a, b) { - if (null != b) for (var c = 0; c < b.length; c++) this.writeUnsignedVarint32_(a, b[c]); -}; - -jspb.BinaryWriter.prototype.writeRepeatedUint32String = function (a, b) { - if (null != b) for (var c = 0; c < b.length; c++) this.writeUint32String(a, b[c]); -}; - -jspb.BinaryWriter.prototype.writeRepeatedUint64 = function (a, b) { - if (null != b) for (var c = 0; c < b.length; c++) this.writeUnsignedVarint64_(a, b[c]); -}; - -jspb.BinaryWriter.prototype.writeRepeatedUint64String = function (a, b) { - if (null != b) for (var c = 0; c < b.length; c++) this.writeUint64String(a, b[c]); -}; - -jspb.BinaryWriter.prototype.writeRepeatedSint32 = function (a, b) { - if (null != b) for (var c = 0; c < b.length; c++) this.writeZigzagVarint32_(a, b[c]); -}; - -jspb.BinaryWriter.prototype.writeRepeatedSint64 = function (a, b) { - if (null != b) for (var c = 0; c < b.length; c++) this.writeZigzagVarint64_(a, b[c]); -}; - -jspb.BinaryWriter.prototype.writeRepeatedSint64String = function (a, b) { - if (null != b) for (var c = 0; c < b.length; c++) this.writeZigzagVarint64String_(a, b[c]); -}; - -jspb.BinaryWriter.prototype.writeRepeatedSintHash64 = function (a, b) { - if (null != b) for (var c = 0; c < b.length; c++) this.writeZigzagVarintHash64_(a, b[c]); -}; - -jspb.BinaryWriter.prototype.writeRepeatedFixed32 = function (a, b) { - if (null != b) for (var c = 0; c < b.length; c++) this.writeFixed32(a, b[c]); -}; - -jspb.BinaryWriter.prototype.writeRepeatedFixed64 = function (a, b) { - if (null != b) for (var c = 0; c < b.length; c++) this.writeFixed64(a, b[c]); -}; - -jspb.BinaryWriter.prototype.writeRepeatedFixed64String = function (a, b) { - if (null != b) for (var c = 0; c < b.length; c++) this.writeFixed64String(a, b[c]); -}; - -jspb.BinaryWriter.prototype.writeRepeatedSfixed32 = function (a, b) { - if (null != b) for (var c = 0; c < b.length; c++) this.writeSfixed32(a, b[c]); -}; - -jspb.BinaryWriter.prototype.writeRepeatedSfixed64 = function (a, b) { - if (null != b) for (var c = 0; c < b.length; c++) this.writeSfixed64(a, b[c]); -}; - -jspb.BinaryWriter.prototype.writeRepeatedSfixed64String = function (a, b) { - if (null != b) for (var c = 0; c < b.length; c++) this.writeSfixed64String(a, b[c]); -}; - -jspb.BinaryWriter.prototype.writeRepeatedFloat = function (a, b) { - if (null != b) for (var c = 0; c < b.length; c++) this.writeFloat(a, b[c]); -}; - -jspb.BinaryWriter.prototype.writeRepeatedDouble = function (a, b) { - if (null != b) for (var c = 0; c < b.length; c++) this.writeDouble(a, b[c]); -}; - -jspb.BinaryWriter.prototype.writeRepeatedBool = function (a, b) { - if (null != b) for (var c = 0; c < b.length; c++) this.writeBool(a, b[c]); -}; - -jspb.BinaryWriter.prototype.writeRepeatedEnum = function (a, b) { - if (null != b) for (var c = 0; c < b.length; c++) this.writeEnum(a, b[c]); -}; - -jspb.BinaryWriter.prototype.writeRepeatedString = function (a, b) { - if (null != b) for (var c = 0; c < b.length; c++) this.writeString(a, b[c]); -}; - -jspb.BinaryWriter.prototype.writeRepeatedBytes = function (a, b) { - if (null != b) for (var c = 0; c < b.length; c++) this.writeBytes(a, b[c]); -}; - -jspb.BinaryWriter.prototype.writeRepeatedMessage = function (a, b, c) { - if (null != b) for (var d = 0; d < b.length; d++) { - var e = this.beginDelimited_(a); - c(b[d], this); - this.endDelimited_(e); - } -}; - -jspb.BinaryWriter.prototype.writeRepeatedGroup = function (a, b, c) { - if (null != b) for (var d = 0; d < b.length; d++) this.writeFieldHeader_(a, jspb.BinaryConstants.WireType.START_GROUP), c(b[d], this), this.writeFieldHeader_(a, jspb.BinaryConstants.WireType.END_GROUP); -}; - -jspb.BinaryWriter.prototype.writeRepeatedFixedHash64 = function (a, b) { - if (null != b) for (var c = 0; c < b.length; c++) this.writeFixedHash64(a, b[c]); -}; - -jspb.BinaryWriter.prototype.writeRepeatedVarintHash64 = function (a, b) { - if (null != b) for (var c = 0; c < b.length; c++) this.writeVarintHash64(a, b[c]); -}; - -jspb.BinaryWriter.prototype.writePackedInt32 = function (a, b) { - if (null != b && b.length) { - a = this.beginDelimited_(a); - - for (var c = 0; c < b.length; c++) this.encoder_.writeSignedVarint32(b[c]); - - this.endDelimited_(a); - } -}; - -jspb.BinaryWriter.prototype.writePackedInt32String = function (a, b) { - if (null != b && b.length) { - a = this.beginDelimited_(a); - - for (var c = 0; c < b.length; c++) this.encoder_.writeSignedVarint32(parseInt(b[c], 10)); - - this.endDelimited_(a); - } -}; - -jspb.BinaryWriter.prototype.writePackedInt64 = function (a, b) { - if (null != b && b.length) { - a = this.beginDelimited_(a); - - for (var c = 0; c < b.length; c++) this.encoder_.writeSignedVarint64(b[c]); - - this.endDelimited_(a); - } -}; - -jspb.BinaryWriter.prototype.writePackedSplitFixed64 = function (a, b, c, d) { - if (null != b) { - a = this.beginDelimited_(a); - - for (var e = 0; e < b.length; e++) this.encoder_.writeSplitFixed64(c(b[e]), d(b[e])); - - this.endDelimited_(a); - } -}; - -jspb.BinaryWriter.prototype.writePackedSplitVarint64 = function (a, b, c, d) { - if (null != b) { - a = this.beginDelimited_(a); - - for (var e = 0; e < b.length; e++) this.encoder_.writeSplitVarint64(c(b[e]), d(b[e])); - - this.endDelimited_(a); - } -}; - -jspb.BinaryWriter.prototype.writePackedSplitZigzagVarint64 = function (a, b, c, d) { - if (null != b) { - a = this.beginDelimited_(a); - - for (var e = this.encoder_, f = 0; f < b.length; f++) jspb.utils.toZigzag64(c(b[f]), d(b[f]), function (a, b) { - e.writeSplitVarint64(a >>> 0, b >>> 0); - }); - - this.endDelimited_(a); - } -}; - -jspb.BinaryWriter.prototype.writePackedInt64String = function (a, b) { - if (null != b && b.length) { - a = this.beginDelimited_(a); - - for (var c = 0; c < b.length; c++) { - var d = jspb.arith.Int64.fromString(b[c]); - this.encoder_.writeSplitVarint64(d.lo, d.hi); - } - - this.endDelimited_(a); - } -}; - -jspb.BinaryWriter.prototype.writePackedUint32 = function (a, b) { - if (null != b && b.length) { - a = this.beginDelimited_(a); - - for (var c = 0; c < b.length; c++) this.encoder_.writeUnsignedVarint32(b[c]); - - this.endDelimited_(a); - } -}; - -jspb.BinaryWriter.prototype.writePackedUint32String = function (a, b) { - if (null != b && b.length) { - a = this.beginDelimited_(a); - - for (var c = 0; c < b.length; c++) this.encoder_.writeUnsignedVarint32(parseInt(b[c], 10)); - - this.endDelimited_(a); - } -}; - -jspb.BinaryWriter.prototype.writePackedUint64 = function (a, b) { - if (null != b && b.length) { - a = this.beginDelimited_(a); - - for (var c = 0; c < b.length; c++) this.encoder_.writeUnsignedVarint64(b[c]); - - this.endDelimited_(a); - } -}; - -jspb.BinaryWriter.prototype.writePackedUint64String = function (a, b) { - if (null != b && b.length) { - a = this.beginDelimited_(a); - - for (var c = 0; c < b.length; c++) { - var d = jspb.arith.UInt64.fromString(b[c]); - this.encoder_.writeSplitVarint64(d.lo, d.hi); - } - - this.endDelimited_(a); - } -}; - -jspb.BinaryWriter.prototype.writePackedSint32 = function (a, b) { - if (null != b && b.length) { - a = this.beginDelimited_(a); - - for (var c = 0; c < b.length; c++) this.encoder_.writeZigzagVarint32(b[c]); - - this.endDelimited_(a); - } -}; - -jspb.BinaryWriter.prototype.writePackedSint64 = function (a, b) { - if (null != b && b.length) { - a = this.beginDelimited_(a); - - for (var c = 0; c < b.length; c++) this.encoder_.writeZigzagVarint64(b[c]); - - this.endDelimited_(a); - } -}; - -jspb.BinaryWriter.prototype.writePackedSint64String = function (a, b) { - if (null != b && b.length) { - a = this.beginDelimited_(a); - - for (var c = 0; c < b.length; c++) this.encoder_.writeZigzagVarintHash64(jspb.utils.decimalStringToHash64(b[c])); - - this.endDelimited_(a); - } -}; - -jspb.BinaryWriter.prototype.writePackedSintHash64 = function (a, b) { - if (null != b && b.length) { - a = this.beginDelimited_(a); - - for (var c = 0; c < b.length; c++) this.encoder_.writeZigzagVarintHash64(b[c]); - - this.endDelimited_(a); - } -}; - -jspb.BinaryWriter.prototype.writePackedFixed32 = function (a, b) { - if (null != b && b.length) for (this.writeFieldHeader_(a, jspb.BinaryConstants.WireType.DELIMITED), this.encoder_.writeUnsignedVarint32(4 * b.length), a = 0; a < b.length; a++) this.encoder_.writeUint32(b[a]); -}; - -jspb.BinaryWriter.prototype.writePackedFixed64 = function (a, b) { - if (null != b && b.length) for (this.writeFieldHeader_(a, jspb.BinaryConstants.WireType.DELIMITED), this.encoder_.writeUnsignedVarint32(8 * b.length), a = 0; a < b.length; a++) this.encoder_.writeUint64(b[a]); -}; - -jspb.BinaryWriter.prototype.writePackedFixed64String = function (a, b) { - if (null != b && b.length) for (this.writeFieldHeader_(a, jspb.BinaryConstants.WireType.DELIMITED), this.encoder_.writeUnsignedVarint32(8 * b.length), a = 0; a < b.length; a++) { - var c = jspb.arith.UInt64.fromString(b[a]); - this.encoder_.writeSplitFixed64(c.lo, c.hi); - } -}; - -jspb.BinaryWriter.prototype.writePackedSfixed32 = function (a, b) { - if (null != b && b.length) for (this.writeFieldHeader_(a, jspb.BinaryConstants.WireType.DELIMITED), this.encoder_.writeUnsignedVarint32(4 * b.length), a = 0; a < b.length; a++) this.encoder_.writeInt32(b[a]); -}; - -jspb.BinaryWriter.prototype.writePackedSfixed64 = function (a, b) { - if (null != b && b.length) for (this.writeFieldHeader_(a, jspb.BinaryConstants.WireType.DELIMITED), this.encoder_.writeUnsignedVarint32(8 * b.length), a = 0; a < b.length; a++) this.encoder_.writeInt64(b[a]); -}; - -jspb.BinaryWriter.prototype.writePackedSfixed64String = function (a, b) { - if (null != b && b.length) for (this.writeFieldHeader_(a, jspb.BinaryConstants.WireType.DELIMITED), this.encoder_.writeUnsignedVarint32(8 * b.length), a = 0; a < b.length; a++) this.encoder_.writeInt64String(b[a]); -}; - -jspb.BinaryWriter.prototype.writePackedFloat = function (a, b) { - if (null != b && b.length) for (this.writeFieldHeader_(a, jspb.BinaryConstants.WireType.DELIMITED), this.encoder_.writeUnsignedVarint32(4 * b.length), a = 0; a < b.length; a++) this.encoder_.writeFloat(b[a]); -}; - -jspb.BinaryWriter.prototype.writePackedDouble = function (a, b) { - if (null != b && b.length) for (this.writeFieldHeader_(a, jspb.BinaryConstants.WireType.DELIMITED), this.encoder_.writeUnsignedVarint32(8 * b.length), a = 0; a < b.length; a++) this.encoder_.writeDouble(b[a]); -}; - -jspb.BinaryWriter.prototype.writePackedBool = function (a, b) { - if (null != b && b.length) for (this.writeFieldHeader_(a, jspb.BinaryConstants.WireType.DELIMITED), this.encoder_.writeUnsignedVarint32(b.length), a = 0; a < b.length; a++) this.encoder_.writeBool(b[a]); -}; - -jspb.BinaryWriter.prototype.writePackedEnum = function (a, b) { - if (null != b && b.length) { - a = this.beginDelimited_(a); - - for (var c = 0; c < b.length; c++) this.encoder_.writeEnum(b[c]); - - this.endDelimited_(a); - } -}; - -jspb.BinaryWriter.prototype.writePackedFixedHash64 = function (a, b) { - if (null != b && b.length) for (this.writeFieldHeader_(a, jspb.BinaryConstants.WireType.DELIMITED), this.encoder_.writeUnsignedVarint32(8 * b.length), a = 0; a < b.length; a++) this.encoder_.writeFixedHash64(b[a]); -}; - -jspb.BinaryWriter.prototype.writePackedVarintHash64 = function (a, b) { - if (null != b && b.length) { - a = this.beginDelimited_(a); - - for (var c = 0; c < b.length; c++) this.encoder_.writeVarintHash64(b[c]); - - this.endDelimited_(a); - } -}; - -jspb.Map = function (a, b) { - this.arr_ = a; - this.valueCtor_ = b; - this.map_ = {}; - this.arrClean = !0; - 0 < this.arr_.length && this.loadFromArray_(); -}; - -jspb.Map.prototype.loadFromArray_ = function () { - for (var a = 0; a < this.arr_.length; a++) { - var b = this.arr_[a], - c = b[0]; - this.map_[c.toString()] = new jspb.Map.Entry_(c, b[1]); - } - - this.arrClean = !0; -}; - -jspb.Map.prototype.toArray = function () { - if (this.arrClean) { - if (this.valueCtor_) { - var a = this.map_, - b; - - for (b in a) if (Object.prototype.hasOwnProperty.call(a, b)) { - var c = a[b].valueWrapper; - c && c.toArray(); - } - } - } else { - this.arr_.length = 0; - a = this.stringKeys_(); - a.sort(); - - for (b = 0; b < a.length; b++) { - var d = this.map_[a[b]]; - (c = d.valueWrapper) && c.toArray(); - this.arr_.push([d.key, d.value]); - } - - this.arrClean = !0; - } - - return this.arr_; -}; - -jspb.Map.prototype.toObject = function (a, b) { - for (var c = this.toArray(), d = [], e = 0; e < c.length; e++) { - var f = this.map_[c[e][0].toString()]; - this.wrapEntry_(f); - var g = f.valueWrapper; - g ? (goog.asserts.assert(b), d.push([f.key, b(a, g)])) : d.push([f.key, f.value]); - } - - return d; -}; - -jspb.Map.fromObject = function (a, b, c) { - b = new jspb.Map([], b); - - for (var d = 0; d < a.length; d++) { - var e = a[d][0], - f = c(a[d][1]); - b.set(e, f); - } - - return b; -}; - -jspb.Map.ArrayIteratorIterable_ = function (a) { - this.idx_ = 0; - this.arr_ = a; -}; - -jspb.Map.ArrayIteratorIterable_.prototype.next = function () { - return this.idx_ < this.arr_.length ? { - done: !1, - value: this.arr_[this.idx_++] - } : { - done: !0, - value: void 0 - }; -}; - -"undefined" != typeof Symbol && (jspb.Map.ArrayIteratorIterable_.prototype[Symbol.iterator] = function () { - return this; -}); - -jspb.Map.prototype.getLength = function () { - return this.stringKeys_().length; -}; - -jspb.Map.prototype.clear = function () { - this.map_ = {}; - this.arrClean = !1; -}; - -jspb.Map.prototype.del = function (a) { - a = a.toString(); - var b = this.map_.hasOwnProperty(a); - delete this.map_[a]; - this.arrClean = !1; - return b; -}; - -jspb.Map.prototype.getEntryList = function () { - var a = [], - b = this.stringKeys_(); - b.sort(); - - for (var c = 0; c < b.length; c++) { - var d = this.map_[b[c]]; - a.push([d.key, d.value]); - } - - return a; -}; - -jspb.Map.prototype.entries = function () { - var a = [], - b = this.stringKeys_(); - b.sort(); - - for (var c = 0; c < b.length; c++) { - var d = this.map_[b[c]]; - a.push([d.key, this.wrapEntry_(d)]); - } - - return new jspb.Map.ArrayIteratorIterable_(a); -}; - -jspb.Map.prototype.keys = function () { - var a = [], - b = this.stringKeys_(); - b.sort(); - - for (var c = 0; c < b.length; c++) a.push(this.map_[b[c]].key); - - return new jspb.Map.ArrayIteratorIterable_(a); -}; - -jspb.Map.prototype.values = function () { - var a = [], - b = this.stringKeys_(); - b.sort(); - - for (var c = 0; c < b.length; c++) a.push(this.wrapEntry_(this.map_[b[c]])); - - return new jspb.Map.ArrayIteratorIterable_(a); -}; - -jspb.Map.prototype.forEach = function (a, b) { - var c = this.stringKeys_(); - c.sort(); - - for (var d = 0; d < c.length; d++) { - var e = this.map_[c[d]]; - a.call(b, this.wrapEntry_(e), e.key, this); - } -}; - -jspb.Map.prototype.set = function (a, b) { - var c = new jspb.Map.Entry_(a); - this.valueCtor_ ? (c.valueWrapper = b, c.value = b.toArray()) : c.value = b; - this.map_[a.toString()] = c; - this.arrClean = !1; - return this; -}; - -jspb.Map.prototype.wrapEntry_ = function (a) { - return this.valueCtor_ ? (a.valueWrapper || (a.valueWrapper = new this.valueCtor_(a.value)), a.valueWrapper) : a.value; -}; - -jspb.Map.prototype.get = function (a) { - if (a = this.map_[a.toString()]) return this.wrapEntry_(a); -}; - -jspb.Map.prototype.has = function (a) { - return a.toString() in this.map_; -}; - -jspb.Map.prototype.serializeBinary = function (a, b, c, d, e) { - var f = this.stringKeys_(); - f.sort(); - - for (var g = 0; g < f.length; g++) { - var h = this.map_[f[g]]; - b.beginSubMessage(a); - c.call(b, 1, h.key); - this.valueCtor_ ? d.call(b, 2, this.wrapEntry_(h), e) : d.call(b, 2, h.value); - b.endSubMessage(); - } -}; - -jspb.Map.deserializeBinary = function (a, b, c, d, e, f, g) { - for (; b.nextField() && !b.isEndGroup();) { - var h = b.getFieldNumber(); - 1 == h ? f = c.call(b) : 2 == h && (a.valueCtor_ ? (goog.asserts.assert(e), g || (g = new a.valueCtor_()), d.call(b, g, e)) : g = d.call(b)); - } - - goog.asserts.assert(void 0 != f); - goog.asserts.assert(void 0 != g); - a.set(f, g); -}; - -jspb.Map.prototype.stringKeys_ = function () { - var a = this.map_, - b = [], - c; - - for (c in a) Object.prototype.hasOwnProperty.call(a, c) && b.push(c); - - return b; -}; - -jspb.Map.Entry_ = function (a, b) { - this.key = a; - this.value = b; - this.valueWrapper = void 0; -}; - -jspb.ExtensionFieldInfo = function (a, b, c, d, e) { - this.fieldIndex = a; - this.fieldName = b; - this.ctor = c; - this.toObjectFn = d; - this.isRepeated = e; -}; - -jspb.ExtensionFieldBinaryInfo = function (a, b, c, d, e, f) { - this.fieldInfo = a; - this.binaryReaderFn = b; - this.binaryWriterFn = c; - this.binaryMessageSerializeFn = d; - this.binaryMessageDeserializeFn = e; - this.isPacked = f; -}; - -jspb.ExtensionFieldInfo.prototype.isMessageType = function () { - return !!this.ctor; -}; - -jspb.Message = function () {}; - -jspb.Message.GENERATE_TO_OBJECT = !0; -jspb.Message.GENERATE_FROM_OBJECT = !goog.DISALLOW_TEST_ONLY_CODE; -jspb.Message.GENERATE_TO_STRING = !0; -jspb.Message.ASSUME_LOCAL_ARRAYS = !1; -jspb.Message.SERIALIZE_EMPTY_TRAILING_FIELDS = !0; -jspb.Message.SUPPORTS_UINT8ARRAY_ = "function" == typeof Uint8Array; - -jspb.Message.prototype.getJsPbMessageId = function () { - return this.messageId_; -}; - -jspb.Message.getIndex_ = function (a, b) { - return b + a.arrayIndexOffset_; -}; - -jspb.Message.hiddenES6Property_ = function () {}; - -jspb.Message.getFieldNumber_ = function (a, b) { - return b - a.arrayIndexOffset_; -}; - -jspb.Message.initialize = function (a, b, c, d, e, f) { - a.wrappers_ = null; - b || (b = c ? [c] : []); - a.messageId_ = c ? String(c) : void 0; - a.arrayIndexOffset_ = 0 === c ? -1 : 0; - a.array = b; - jspb.Message.initPivotAndExtensionObject_(a, d); - a.convertedPrimitiveFields_ = {}; - jspb.Message.SERIALIZE_EMPTY_TRAILING_FIELDS || (a.repeatedFields = e); - if (e) for (b = 0; b < e.length; b++) c = e[b], c < a.pivot_ ? (c = jspb.Message.getIndex_(a, c), a.array[c] = a.array[c] || jspb.Message.EMPTY_LIST_SENTINEL_) : (jspb.Message.maybeInitEmptyExtensionObject_(a), a.extensionObject_[c] = a.extensionObject_[c] || jspb.Message.EMPTY_LIST_SENTINEL_); - if (f && f.length) for (b = 0; b < f.length; b++) jspb.Message.computeOneofCase(a, f[b]); -}; - -jspb.Message.EMPTY_LIST_SENTINEL_ = goog.DEBUG && Object.freeze ? Object.freeze([]) : []; - -jspb.Message.isArray_ = function (a) { - return jspb.Message.ASSUME_LOCAL_ARRAYS ? a instanceof Array : Array.isArray(a); -}; - -jspb.Message.isExtensionObject_ = function (a) { - return null !== a && "object" == typeof a && !jspb.Message.isArray_(a) && !(jspb.Message.SUPPORTS_UINT8ARRAY_ && a instanceof Uint8Array); -}; - -jspb.Message.initPivotAndExtensionObject_ = function (a, b) { - var c = a.array.length, - d = -1; - - if (c && (d = c - 1, c = a.array[d], jspb.Message.isExtensionObject_(c))) { - a.pivot_ = jspb.Message.getFieldNumber_(a, d); - a.extensionObject_ = c; - return; - } - - -1 < b ? (a.pivot_ = Math.max(b, jspb.Message.getFieldNumber_(a, d + 1)), a.extensionObject_ = null) : a.pivot_ = Number.MAX_VALUE; -}; - -jspb.Message.maybeInitEmptyExtensionObject_ = function (a) { - var b = jspb.Message.getIndex_(a, a.pivot_); - a.array[b] || (a.extensionObject_ = a.array[b] = {}); -}; - -jspb.Message.toObjectList = function (a, b, c) { - for (var d = [], e = 0; e < a.length; e++) d[e] = b.call(a[e], c, a[e]); - - return d; -}; - -jspb.Message.toObjectExtension = function (a, b, c, d, e) { - for (var f in c) { - var g = c[f], - h = d.call(a, g); - - if (null != h) { - for (var k in g.fieldName) if (g.fieldName.hasOwnProperty(k)) break; - - b[k] = g.toObjectFn ? g.isRepeated ? jspb.Message.toObjectList(h, g.toObjectFn, e) : g.toObjectFn(e, h) : h; - } - } -}; - -jspb.Message.serializeBinaryExtensions = function (a, b, c, d) { - for (var e in c) { - var f = c[e], - g = f.fieldInfo; - if (!f.binaryWriterFn) throw Error("Message extension present that was generated without binary serialization support"); - var h = d.call(a, g); - if (null != h) if (g.isMessageType()) { - if (f.binaryMessageSerializeFn) f.binaryWriterFn.call(b, g.fieldIndex, h, f.binaryMessageSerializeFn);else throw Error("Message extension present holding submessage without binary support enabled, and message is being serialized to binary format"); - } else f.binaryWriterFn.call(b, g.fieldIndex, h); - } -}; - -jspb.Message.readBinaryExtension = function (a, b, c, d, e) { - var f = c[b.getFieldNumber()]; - - if (f) { - c = f.fieldInfo; - if (!f.binaryReaderFn) throw Error("Deserializing extension whose generated code does not support binary format"); - - if (c.isMessageType()) { - var g = new c.ctor(); - f.binaryReaderFn.call(b, g, f.binaryMessageDeserializeFn); - } else g = f.binaryReaderFn.call(b); - - c.isRepeated && !f.isPacked ? (b = d.call(a, c)) ? b.push(g) : e.call(a, c, [g]) : e.call(a, c, g); - } else b.skipField(); -}; - -jspb.Message.getField = function (a, b) { - if (b < a.pivot_) { - b = jspb.Message.getIndex_(a, b); - var c = a.array[b]; - return c === jspb.Message.EMPTY_LIST_SENTINEL_ ? a.array[b] = [] : c; - } - - if (a.extensionObject_) return c = a.extensionObject_[b], c === jspb.Message.EMPTY_LIST_SENTINEL_ ? a.extensionObject_[b] = [] : c; -}; - -jspb.Message.getRepeatedField = function (a, b) { - return jspb.Message.getField(a, b); -}; - -jspb.Message.getOptionalFloatingPointField = function (a, b) { - a = jspb.Message.getField(a, b); - return null == a ? a : +a; -}; - -jspb.Message.getBooleanField = function (a, b) { - a = jspb.Message.getField(a, b); - return null == a ? a : !!a; -}; - -jspb.Message.getRepeatedFloatingPointField = function (a, b) { - var c = jspb.Message.getRepeatedField(a, b); - a.convertedPrimitiveFields_ || (a.convertedPrimitiveFields_ = {}); - - if (!a.convertedPrimitiveFields_[b]) { - for (var d = 0; d < c.length; d++) c[d] = +c[d]; - - a.convertedPrimitiveFields_[b] = !0; - } - - return c; -}; - -jspb.Message.getRepeatedBooleanField = function (a, b) { - var c = jspb.Message.getRepeatedField(a, b); - a.convertedPrimitiveFields_ || (a.convertedPrimitiveFields_ = {}); - - if (!a.convertedPrimitiveFields_[b]) { - for (var d = 0; d < c.length; d++) c[d] = !!c[d]; - - a.convertedPrimitiveFields_[b] = !0; - } - - return c; -}; - -jspb.Message.bytesAsB64 = function (a) { - if (null == a || "string" === typeof a) return a; - if (jspb.Message.SUPPORTS_UINT8ARRAY_ && a instanceof Uint8Array) return goog.crypt.base64.encodeByteArray(a); - goog.asserts.fail("Cannot coerce to b64 string: " + goog.typeOf(a)); - return null; -}; - -jspb.Message.bytesAsU8 = function (a) { - if (null == a || a instanceof Uint8Array) return a; - if ("string" === typeof a) return goog.crypt.base64.decodeStringToUint8Array(a); - goog.asserts.fail("Cannot coerce to Uint8Array: " + goog.typeOf(a)); - return null; -}; - -jspb.Message.bytesListAsB64 = function (a) { - jspb.Message.assertConsistentTypes_(a); - return a.length && "string" !== typeof a[0] ? goog.array.map(a, jspb.Message.bytesAsB64) : a; -}; - -jspb.Message.bytesListAsU8 = function (a) { - jspb.Message.assertConsistentTypes_(a); - return !a.length || a[0] instanceof Uint8Array ? a : goog.array.map(a, jspb.Message.bytesAsU8); -}; - -jspb.Message.assertConsistentTypes_ = function (a) { - if (goog.DEBUG && a && 1 < a.length) { - var b = goog.typeOf(a[0]); - goog.array.forEach(a, function (a) { - goog.typeOf(a) != b && goog.asserts.fail("Inconsistent type in JSPB repeated field array. Got " + goog.typeOf(a) + " expected " + b); - }); - } -}; - -jspb.Message.getFieldWithDefault = function (a, b, c) { - a = jspb.Message.getField(a, b); - return null == a ? c : a; -}; - -jspb.Message.getBooleanFieldWithDefault = function (a, b, c) { - a = jspb.Message.getBooleanField(a, b); - return null == a ? c : a; -}; - -jspb.Message.getFloatingPointFieldWithDefault = function (a, b, c) { - a = jspb.Message.getOptionalFloatingPointField(a, b); - return null == a ? c : a; -}; - -jspb.Message.getFieldProto3 = jspb.Message.getFieldWithDefault; - -jspb.Message.getMapField = function (a, b, c, d) { - a.wrappers_ || (a.wrappers_ = {}); - if (b in a.wrappers_) return a.wrappers_[b]; - var e = jspb.Message.getField(a, b); - - if (!e) { - if (c) return; - e = []; - jspb.Message.setField(a, b, e); - } - - return a.wrappers_[b] = new jspb.Map(e, d); -}; - -jspb.Message.setField = function (a, b, c) { - goog.asserts.assertInstanceof(a, jspb.Message); - b < a.pivot_ ? a.array[jspb.Message.getIndex_(a, b)] = c : (jspb.Message.maybeInitEmptyExtensionObject_(a), a.extensionObject_[b] = c); - return a; -}; - -jspb.Message.setProto3IntField = function (a, b, c) { - return jspb.Message.setFieldIgnoringDefault_(a, b, c, 0); -}; - -jspb.Message.setProto3FloatField = function (a, b, c) { - return jspb.Message.setFieldIgnoringDefault_(a, b, c, 0); -}; - -jspb.Message.setProto3BooleanField = function (a, b, c) { - return jspb.Message.setFieldIgnoringDefault_(a, b, c, !1); -}; - -jspb.Message.setProto3StringField = function (a, b, c) { - return jspb.Message.setFieldIgnoringDefault_(a, b, c, ""); -}; - -jspb.Message.setProto3BytesField = function (a, b, c) { - return jspb.Message.setFieldIgnoringDefault_(a, b, c, ""); -}; - -jspb.Message.setProto3EnumField = function (a, b, c) { - return jspb.Message.setFieldIgnoringDefault_(a, b, c, 0); -}; - -jspb.Message.setProto3StringIntField = function (a, b, c) { - return jspb.Message.setFieldIgnoringDefault_(a, b, c, "0"); -}; - -jspb.Message.setFieldIgnoringDefault_ = function (a, b, c, d) { - goog.asserts.assertInstanceof(a, jspb.Message); - c !== d ? jspb.Message.setField(a, b, c) : b < a.pivot_ ? a.array[jspb.Message.getIndex_(a, b)] = null : (jspb.Message.maybeInitEmptyExtensionObject_(a), delete a.extensionObject_[b]); - return a; -}; - -jspb.Message.addToRepeatedField = function (a, b, c, d) { - goog.asserts.assertInstanceof(a, jspb.Message); - b = jspb.Message.getRepeatedField(a, b); - void 0 != d ? b.splice(d, 0, c) : b.push(c); - return a; -}; - -jspb.Message.setOneofField = function (a, b, c, d) { - goog.asserts.assertInstanceof(a, jspb.Message); - (c = jspb.Message.computeOneofCase(a, c)) && c !== b && void 0 !== d && (a.wrappers_ && c in a.wrappers_ && (a.wrappers_[c] = void 0), jspb.Message.setField(a, c, void 0)); - return jspb.Message.setField(a, b, d); -}; - -jspb.Message.computeOneofCase = function (a, b) { - for (var c, d, e = 0; e < b.length; e++) { - var f = b[e], - g = jspb.Message.getField(a, f); - null != g && (c = f, d = g, jspb.Message.setField(a, f, void 0)); - } - - return c ? (jspb.Message.setField(a, c, d), c) : 0; -}; - -jspb.Message.getWrapperField = function (a, b, c, d) { - a.wrappers_ || (a.wrappers_ = {}); - - if (!a.wrappers_[c]) { - var e = jspb.Message.getField(a, c); - if (d || e) a.wrappers_[c] = new b(e); - } - - return a.wrappers_[c]; -}; - -jspb.Message.getRepeatedWrapperField = function (a, b, c) { - jspb.Message.wrapRepeatedField_(a, b, c); - b = a.wrappers_[c]; - b == jspb.Message.EMPTY_LIST_SENTINEL_ && (b = a.wrappers_[c] = []); - return b; -}; - -jspb.Message.wrapRepeatedField_ = function (a, b, c) { - a.wrappers_ || (a.wrappers_ = {}); - - if (!a.wrappers_[c]) { - for (var d = jspb.Message.getRepeatedField(a, c), e = [], f = 0; f < d.length; f++) e[f] = new b(d[f]); - - a.wrappers_[c] = e; - } -}; - -jspb.Message.setWrapperField = function (a, b, c) { - goog.asserts.assertInstanceof(a, jspb.Message); - a.wrappers_ || (a.wrappers_ = {}); - var d = c ? c.toArray() : c; - a.wrappers_[b] = c; - return jspb.Message.setField(a, b, d); -}; - -jspb.Message.setOneofWrapperField = function (a, b, c, d) { - goog.asserts.assertInstanceof(a, jspb.Message); - a.wrappers_ || (a.wrappers_ = {}); - var e = d ? d.toArray() : d; - a.wrappers_[b] = d; - return jspb.Message.setOneofField(a, b, c, e); -}; - -jspb.Message.setRepeatedWrapperField = function (a, b, c) { - goog.asserts.assertInstanceof(a, jspb.Message); - a.wrappers_ || (a.wrappers_ = {}); - c = c || []; - - for (var d = [], e = 0; e < c.length; e++) d[e] = c[e].toArray(); - - a.wrappers_[b] = c; - return jspb.Message.setField(a, b, d); -}; - -jspb.Message.addToRepeatedWrapperField = function (a, b, c, d, e) { - jspb.Message.wrapRepeatedField_(a, d, b); - var f = a.wrappers_[b]; - f || (f = a.wrappers_[b] = []); - c = c ? c : new d(); - a = jspb.Message.getRepeatedField(a, b); - void 0 != e ? (f.splice(e, 0, c), a.splice(e, 0, c.toArray())) : (f.push(c), a.push(c.toArray())); - return c; -}; - -jspb.Message.toMap = function (a, b, c, d) { - for (var e = {}, f = 0; f < a.length; f++) e[b.call(a[f])] = c ? c.call(a[f], d, a[f]) : a[f]; - - return e; -}; - -jspb.Message.prototype.syncMapFields_ = function () { - if (this.wrappers_) for (var a in this.wrappers_) { - var b = this.wrappers_[a]; - if (Array.isArray(b)) for (var c = 0; c < b.length; c++) b[c] && b[c].toArray();else b && b.toArray(); - } -}; - -jspb.Message.prototype.toArray = function () { - this.syncMapFields_(); - return this.array; -}; - -jspb.Message.GENERATE_TO_STRING && (jspb.Message.prototype.toString = function () { - this.syncMapFields_(); - return this.array.toString(); -}); - -jspb.Message.prototype.getExtension = function (a) { - if (this.extensionObject_) { - this.wrappers_ || (this.wrappers_ = {}); - var b = a.fieldIndex; - - if (a.isRepeated) { - if (a.isMessageType()) return this.wrappers_[b] || (this.wrappers_[b] = goog.array.map(this.extensionObject_[b] || [], function (b) { - return new a.ctor(b); - })), this.wrappers_[b]; - } else if (a.isMessageType()) return !this.wrappers_[b] && this.extensionObject_[b] && (this.wrappers_[b] = new a.ctor(this.extensionObject_[b])), this.wrappers_[b]; - - return this.extensionObject_[b]; - } -}; - -jspb.Message.prototype.setExtension = function (a, b) { - this.wrappers_ || (this.wrappers_ = {}); - jspb.Message.maybeInitEmptyExtensionObject_(this); - var c = a.fieldIndex; - a.isRepeated ? (b = b || [], a.isMessageType() ? (this.wrappers_[c] = b, this.extensionObject_[c] = goog.array.map(b, function (a) { - return a.toArray(); - })) : this.extensionObject_[c] = b) : a.isMessageType() ? (this.wrappers_[c] = b, this.extensionObject_[c] = b ? b.toArray() : b) : this.extensionObject_[c] = b; - return this; -}; - -jspb.Message.difference = function (a, b) { - if (!(a instanceof b.constructor)) throw Error("Messages have different types."); - var c = a.toArray(); - b = b.toArray(); - var d = [], - e = 0, - f = c.length > b.length ? c.length : b.length; - a.getJsPbMessageId() && (d[0] = a.getJsPbMessageId(), e = 1); - - for (; e < f; e++) jspb.Message.compareFields(c[e], b[e]) || (d[e] = b[e]); - - return new a.constructor(d); -}; - -jspb.Message.equals = function (a, b) { - return a == b || !(!a || !b) && a instanceof b.constructor && jspb.Message.compareFields(a.toArray(), b.toArray()); -}; - -jspb.Message.compareExtensions = function (a, b) { - a = a || {}; - b = b || {}; - var c = {}, - d; - - for (d in a) c[d] = 0; - - for (d in b) c[d] = 0; - - for (d in c) if (!jspb.Message.compareFields(a[d], b[d])) return !1; - - return !0; -}; - -jspb.Message.compareFields = function (a, b) { - if (a == b) return !0; - if (!goog.isObject(a) || !goog.isObject(b)) return "number" === typeof a && isNaN(a) || "number" === typeof b && isNaN(b) ? String(a) == String(b) : !1; - if (a.constructor != b.constructor) return !1; - - if (jspb.Message.SUPPORTS_UINT8ARRAY_ && a.constructor === Uint8Array) { - if (a.length != b.length) return !1; - - for (var c = 0; c < a.length; c++) if (a[c] != b[c]) return !1; - - return !0; - } - - if (a.constructor === Array) { - var d = void 0, - e = void 0, - f = Math.max(a.length, b.length); - - for (c = 0; c < f; c++) { - var g = a[c], - h = b[c]; - g && g.constructor == Object && (goog.asserts.assert(void 0 === d), goog.asserts.assert(c === a.length - 1), d = g, g = void 0); - h && h.constructor == Object && (goog.asserts.assert(void 0 === e), goog.asserts.assert(c === b.length - 1), e = h, h = void 0); - if (!jspb.Message.compareFields(g, h)) return !1; - } - - return d || e ? (d = d || {}, e = e || {}, jspb.Message.compareExtensions(d, e)) : !0; - } - - if (a.constructor === Object) return jspb.Message.compareExtensions(a, b); - throw Error("Invalid type in JSPB array"); -}; - -jspb.Message.prototype.cloneMessage = function () { - return jspb.Message.cloneMessage(this); -}; - -jspb.Message.prototype.clone = function () { - return jspb.Message.cloneMessage(this); -}; - -jspb.Message.clone = function (a) { - return jspb.Message.cloneMessage(a); -}; - -jspb.Message.cloneMessage = function (a) { - return new a.constructor(jspb.Message.clone_(a.toArray())); -}; - -jspb.Message.copyInto = function (a, b) { - goog.asserts.assertInstanceof(a, jspb.Message); - goog.asserts.assertInstanceof(b, jspb.Message); - goog.asserts.assert(a.constructor == b.constructor, "Copy source and target message should have the same type."); - a = jspb.Message.clone(a); - - for (var c = b.toArray(), d = a.toArray(), e = c.length = 0; e < d.length; e++) c[e] = d[e]; - - b.wrappers_ = a.wrappers_; - b.extensionObject_ = a.extensionObject_; -}; - -jspb.Message.clone_ = function (a) { - if (Array.isArray(a)) { - for (var b = Array(a.length), c = 0; c < a.length; c++) { - var d = a[c]; - null != d && (b[c] = "object" == typeof d ? jspb.Message.clone_(goog.asserts.assert(d)) : d); - } - - return b; - } - - if (jspb.Message.SUPPORTS_UINT8ARRAY_ && a instanceof Uint8Array) return new Uint8Array(a); - b = {}; - - for (c in a) d = a[c], null != d && (b[c] = "object" == typeof d ? jspb.Message.clone_(goog.asserts.assert(d)) : d); - - return b; -}; - -jspb.Message.registerMessageType = function (a, b) { - b.messageId = a; -}; - -jspb.Message.messageSetExtensions = {}; -jspb.Message.messageSetExtensionsBinary = {}; -jspb.Export = {}; - true && (exports.Map = jspb.Map, exports.Message = jspb.Message, exports.BinaryReader = jspb.BinaryReader, exports.BinaryWriter = jspb.BinaryWriter, exports.ExtensionFieldInfo = jspb.ExtensionFieldInfo, exports.ExtensionFieldBinaryInfo = jspb.ExtensionFieldBinaryInfo, exports.exportSymbol = goog.exportSymbol, exports.inherits = goog.inherits, exports.object = { - extend: goog.object.extend -}, exports.typeOf = goog.typeOf); - -/***/ }), - -/***/ "./node_modules/has-bigints/index.js": -/*!*******************************************!*\ - !*** ./node_modules/has-bigints/index.js ***! - \*******************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var $BigInt = global.BigInt; - -module.exports = function hasNativeBigInts() { - return typeof $BigInt === 'function' && typeof BigInt === 'function' && typeof $BigInt(42) === 'bigint' // eslint-disable-line no-magic-numbers - && typeof BigInt(42) === 'bigint'; // eslint-disable-line no-magic-numbers -}; - -/***/ }), - -/***/ "./node_modules/has-symbols/index.js": -/*!*******************************************!*\ - !*** ./node_modules/has-symbols/index.js ***! - \*******************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var origSymbol = typeof Symbol !== 'undefined' && Symbol; - -var hasSymbolSham = __webpack_require__(/*! ./shams */ "./node_modules/has-symbols/shams.js"); - -module.exports = function hasNativeSymbols() { - if (typeof origSymbol !== 'function') { - return false; - } - - if (typeof Symbol !== 'function') { - return false; - } - - if (typeof origSymbol('foo') !== 'symbol') { - return false; - } - - if (typeof Symbol('bar') !== 'symbol') { - return false; - } - - return hasSymbolSham(); -}; - -/***/ }), - -/***/ "./node_modules/has-symbols/shams.js": -/*!*******************************************!*\ - !*** ./node_modules/has-symbols/shams.js ***! - \*******************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -/* eslint complexity: [2, 18], max-statements: [2, 33] */ - -module.exports = function hasSymbols() { - if (typeof Symbol !== 'function' || typeof Object.getOwnPropertySymbols !== 'function') { - return false; - } - - if (typeof Symbol.iterator === 'symbol') { - return true; - } - - var obj = {}; - var sym = Symbol('test'); - var symObj = Object(sym); - - if (typeof sym === 'string') { - return false; - } - - if (Object.prototype.toString.call(sym) !== '[object Symbol]') { - return false; - } - - if (Object.prototype.toString.call(symObj) !== '[object Symbol]') { - return false; - } // temp disabled per https://github.com/ljharb/object.assign/issues/17 - // if (sym instanceof Symbol) { return false; } - // temp disabled per https://github.com/WebReflection/get-own-property-symbols/issues/4 - // if (!(symObj instanceof Symbol)) { return false; } - // if (typeof Symbol.prototype.toString !== 'function') { return false; } - // if (String(sym) !== Symbol.prototype.toString.call(sym)) { return false; } - - - var symVal = 42; - obj[sym] = symVal; - - for (sym in obj) { - return false; - } // eslint-disable-line no-restricted-syntax, no-unreachable-loop - - - if (typeof Object.keys === 'function' && Object.keys(obj).length !== 0) { - return false; - } - - if (typeof Object.getOwnPropertyNames === 'function' && Object.getOwnPropertyNames(obj).length !== 0) { - return false; - } - - var syms = Object.getOwnPropertySymbols(obj); - - if (syms.length !== 1 || syms[0] !== sym) { - return false; - } - - if (!Object.prototype.propertyIsEnumerable.call(obj, sym)) { - return false; - } - - if (typeof Object.getOwnPropertyDescriptor === 'function') { - var descriptor = Object.getOwnPropertyDescriptor(obj, sym); - - if (descriptor.value !== symVal || descriptor.enumerable !== true) { - return false; - } - } - - return true; -}; - -/***/ }), - -/***/ "./node_modules/has-tostringtag/shams.js": -/*!***********************************************!*\ - !*** ./node_modules/has-tostringtag/shams.js ***! - \***********************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var hasSymbols = __webpack_require__(/*! has-symbols/shams */ "./node_modules/has-symbols/shams.js"); - -module.exports = function hasToStringTagShams() { - return hasSymbols() && !!Symbol.toStringTag; -}; - -/***/ }), - -/***/ "./node_modules/has/src/index.js": -/*!***************************************!*\ - !*** ./node_modules/has/src/index.js ***! - \***************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var bind = __webpack_require__(/*! function-bind */ "./node_modules/function-bind/index.js"); - -module.exports = bind.call(Function.call, Object.prototype.hasOwnProperty); - -/***/ }), - -/***/ "./node_modules/is-arguments/index.js": -/*!********************************************!*\ - !*** ./node_modules/is-arguments/index.js ***! - \********************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var hasToStringTag = __webpack_require__(/*! has-tostringtag/shams */ "./node_modules/has-tostringtag/shams.js")(); - -var callBound = __webpack_require__(/*! call-bind/callBound */ "./node_modules/call-bind/callBound.js"); - -var $toString = callBound('Object.prototype.toString'); - -var isStandardArguments = function isArguments(value) { - if (hasToStringTag && value && typeof value === 'object' && Symbol.toStringTag in value) { - return false; - } - - return $toString(value) === '[object Arguments]'; -}; - -var isLegacyArguments = function isArguments(value) { - if (isStandardArguments(value)) { - return true; - } - - return value !== null && typeof value === 'object' && typeof value.length === 'number' && value.length >= 0 && $toString(value) !== '[object Array]' && $toString(value.callee) === '[object Function]'; -}; - -var supportsStandardArguments = function () { - return isStandardArguments(arguments); -}(); - -isStandardArguments.isLegacyArguments = isLegacyArguments; // for tests - -module.exports = supportsStandardArguments ? isStandardArguments : isLegacyArguments; - -/***/ }), - -/***/ "./node_modules/is-bigint/index.js": -/*!*****************************************!*\ - !*** ./node_modules/is-bigint/index.js ***! - \*****************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var hasBigInts = __webpack_require__(/*! has-bigints */ "./node_modules/has-bigints/index.js")(); - -if (hasBigInts) { - var bigIntValueOf = BigInt.prototype.valueOf; - - var tryBigInt = function tryBigIntObject(value) { - try { - bigIntValueOf.call(value); - return true; - } catch (e) {} - - return false; - }; - - module.exports = function isBigInt(value) { - if (value === null || typeof value === 'undefined' || typeof value === 'boolean' || typeof value === 'string' || typeof value === 'number' || typeof value === 'symbol' || typeof value === 'function') { - return false; - } - - if (typeof value === 'bigint') { - return true; - } - - return tryBigInt(value); - }; -} else { - module.exports = function isBigInt(value) { - return false && false; - }; -} - -/***/ }), - -/***/ "./node_modules/is-boolean-object/index.js": -/*!*************************************************!*\ - !*** ./node_modules/is-boolean-object/index.js ***! - \*************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var callBound = __webpack_require__(/*! call-bind/callBound */ "./node_modules/call-bind/callBound.js"); - -var $boolToStr = callBound('Boolean.prototype.toString'); -var $toString = callBound('Object.prototype.toString'); - -var tryBooleanObject = function booleanBrandCheck(value) { - try { - $boolToStr(value); - return true; - } catch (e) { - return false; - } -}; - -var boolClass = '[object Boolean]'; - -var hasToStringTag = __webpack_require__(/*! has-tostringtag/shams */ "./node_modules/has-tostringtag/shams.js")(); - -module.exports = function isBoolean(value) { - if (typeof value === 'boolean') { - return true; - } - - if (value === null || typeof value !== 'object') { - return false; - } - - return hasToStringTag && Symbol.toStringTag in value ? tryBooleanObject(value) : $toString(value) === boolClass; -}; - -/***/ }), - -/***/ "./node_modules/is-buffer/index.js": -/*!*****************************************!*\ - !*** ./node_modules/is-buffer/index.js ***! - \*****************************************/ -/*! no static exports found */ -/***/ (function(module, exports) { - -/*! - * Determine if an object is a Buffer - * - * @author Feross Aboukhadijeh <https://feross.org> - * @license MIT - */ -// The _isBuffer check is for Safari 5-7 support, because it's missing -// Object.prototype.constructor. Remove this eventually -module.exports = function (obj) { - return obj != null && (isBuffer(obj) || isSlowBuffer(obj) || !!obj._isBuffer); -}; - -function isBuffer(obj) { - return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj); -} // For Node v0.10 support. Remove this eventually. - - -function isSlowBuffer(obj) { - return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0)); -} - -/***/ }), - -/***/ "./node_modules/is-date-object/index.js": -/*!**********************************************!*\ - !*** ./node_modules/is-date-object/index.js ***! - \**********************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var getDay = Date.prototype.getDay; - -var tryDateObject = function tryDateGetDayCall(value) { - try { - getDay.call(value); - return true; - } catch (e) { - return false; - } -}; - -var toStr = Object.prototype.toString; -var dateClass = '[object Date]'; - -var hasToStringTag = __webpack_require__(/*! has-tostringtag/shams */ "./node_modules/has-tostringtag/shams.js")(); - -module.exports = function isDateObject(value) { - if (typeof value !== 'object' || value === null) { - return false; - } - - return hasToStringTag ? tryDateObject(value) : toStr.call(value) === dateClass; -}; - -/***/ }), - -/***/ "./node_modules/is-map/index.js": -/*!**************************************!*\ - !*** ./node_modules/is-map/index.js ***! - \**************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var $Map = typeof Map === 'function' && Map.prototype ? Map : null; -var $Set = typeof Set === 'function' && Set.prototype ? Set : null; -var exported; - -if (!$Map) { - // eslint-disable-next-line no-unused-vars - exported = function isMap(x) { - // `Map` is not present in this environment. - return false; - }; -} - -var $mapHas = $Map ? Map.prototype.has : null; -var $setHas = $Set ? Set.prototype.has : null; - -if (!exported && !$mapHas) { - // eslint-disable-next-line no-unused-vars - exported = function isMap(x) { - // `Map` does not have a `has` method - return false; - }; -} - -module.exports = exported || function isMap(x) { - if (!x || typeof x !== 'object') { - return false; - } - - try { - $mapHas.call(x); - - if ($setHas) { - try { - $setHas.call(x); - } catch (e) { - return true; - } - } - - return x instanceof $Map; // core-js workaround, pre-v2.5.0 - } catch (e) {} - - return false; -}; - -/***/ }), - -/***/ "./node_modules/is-number-object/index.js": -/*!************************************************!*\ - !*** ./node_modules/is-number-object/index.js ***! - \************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var numToStr = Number.prototype.toString; - -var tryNumberObject = function tryNumberObject(value) { - try { - numToStr.call(value); - return true; - } catch (e) { - return false; - } -}; - -var toStr = Object.prototype.toString; -var numClass = '[object Number]'; - -var hasToStringTag = __webpack_require__(/*! has-tostringtag/shams */ "./node_modules/has-tostringtag/shams.js")(); - -module.exports = function isNumberObject(value) { - if (typeof value === 'number') { - return true; - } - - if (typeof value !== 'object') { - return false; - } - - return hasToStringTag ? tryNumberObject(value) : toStr.call(value) === numClass; -}; - -/***/ }), - -/***/ "./node_modules/is-regex/index.js": -/*!****************************************!*\ - !*** ./node_modules/is-regex/index.js ***! - \****************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var callBound = __webpack_require__(/*! call-bind/callBound */ "./node_modules/call-bind/callBound.js"); - -var hasToStringTag = __webpack_require__(/*! has-tostringtag/shams */ "./node_modules/has-tostringtag/shams.js")(); - -var has; -var $exec; -var isRegexMarker; -var badStringifier; - -if (hasToStringTag) { - has = callBound('Object.prototype.hasOwnProperty'); - $exec = callBound('RegExp.prototype.exec'); - isRegexMarker = {}; - - var throwRegexMarker = function () { - throw isRegexMarker; - }; - - badStringifier = { - toString: throwRegexMarker, - valueOf: throwRegexMarker - }; - - if (typeof Symbol.toPrimitive === 'symbol') { - badStringifier[Symbol.toPrimitive] = throwRegexMarker; - } -} - -var $toString = callBound('Object.prototype.toString'); -var gOPD = Object.getOwnPropertyDescriptor; -var regexClass = '[object RegExp]'; -module.exports = hasToStringTag // eslint-disable-next-line consistent-return -? function isRegex(value) { - if (!value || typeof value !== 'object') { - return false; - } - - var descriptor = gOPD(value, 'lastIndex'); - var hasLastIndexDataProperty = descriptor && has(descriptor, 'value'); - - if (!hasLastIndexDataProperty) { - return false; - } - - try { - $exec(value, badStringifier); - } catch (e) { - return e === isRegexMarker; - } -} : function isRegex(value) { - // In older browsers, typeof regex incorrectly returns 'function' - if (!value || typeof value !== 'object' && typeof value !== 'function') { - return false; - } - - return $toString(value) === regexClass; -}; - -/***/ }), - -/***/ "./node_modules/is-set/index.js": -/*!**************************************!*\ - !*** ./node_modules/is-set/index.js ***! - \**************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var $Map = typeof Map === 'function' && Map.prototype ? Map : null; -var $Set = typeof Set === 'function' && Set.prototype ? Set : null; -var exported; - -if (!$Set) { - // eslint-disable-next-line no-unused-vars - exported = function isSet(x) { - // `Set` is not present in this environment. - return false; - }; -} - -var $mapHas = $Map ? Map.prototype.has : null; -var $setHas = $Set ? Set.prototype.has : null; - -if (!exported && !$setHas) { - // eslint-disable-next-line no-unused-vars - exported = function isSet(x) { - // `Set` does not have a `has` method - return false; - }; -} - -module.exports = exported || function isSet(x) { - if (!x || typeof x !== 'object') { - return false; - } - - try { - $setHas.call(x); - - if ($mapHas) { - try { - $mapHas.call(x); - } catch (e) { - return true; - } - } - - return x instanceof $Set; // core-js workaround, pre-v2.5.0 - } catch (e) {} - - return false; -}; - -/***/ }), - -/***/ "./node_modules/is-string/index.js": -/*!*****************************************!*\ - !*** ./node_modules/is-string/index.js ***! - \*****************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var strValue = String.prototype.valueOf; - -var tryStringObject = function tryStringObject(value) { - try { - strValue.call(value); - return true; - } catch (e) { - return false; - } -}; - -var toStr = Object.prototype.toString; -var strClass = '[object String]'; - -var hasToStringTag = __webpack_require__(/*! has-tostringtag/shams */ "./node_modules/has-tostringtag/shams.js")(); - -module.exports = function isString(value) { - if (typeof value === 'string') { - return true; - } - - if (typeof value !== 'object') { - return false; - } - - return hasToStringTag ? tryStringObject(value) : toStr.call(value) === strClass; -}; - -/***/ }), - -/***/ "./node_modules/is-symbol/index.js": -/*!*****************************************!*\ - !*** ./node_modules/is-symbol/index.js ***! - \*****************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var toStr = Object.prototype.toString; - -var hasSymbols = __webpack_require__(/*! has-symbols */ "./node_modules/has-symbols/index.js")(); - -if (hasSymbols) { - var symToStr = Symbol.prototype.toString; - var symStringRegex = /^Symbol\(.*\)$/; - - var isSymbolObject = function isRealSymbolObject(value) { - if (typeof value.valueOf() !== 'symbol') { - return false; - } - - return symStringRegex.test(symToStr.call(value)); - }; - - module.exports = function isSymbol(value) { - if (typeof value === 'symbol') { - return true; - } - - if (toStr.call(value) !== '[object Symbol]') { - return false; - } - - try { - return isSymbolObject(value); - } catch (e) { - return false; - } - }; -} else { - module.exports = function isSymbol(value) { - // this environment does not support Symbols. - return false && false; - }; -} - -/***/ }), - -/***/ "./node_modules/is-typed-array/index.js": -/*!**********************************************!*\ - !*** ./node_modules/is-typed-array/index.js ***! - \**********************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var forEach = __webpack_require__(/*! foreach */ "./node_modules/foreach/index.js"); - -var availableTypedArrays = __webpack_require__(/*! available-typed-arrays */ "./node_modules/available-typed-arrays/index.js"); - -var callBound = __webpack_require__(/*! call-bind/callBound */ "./node_modules/call-bind/callBound.js"); - -var $toString = callBound('Object.prototype.toString'); - -var hasToStringTag = __webpack_require__(/*! has-tostringtag/shams */ "./node_modules/has-tostringtag/shams.js")(); - -var g = typeof globalThis === 'undefined' ? global : globalThis; -var typedArrays = availableTypedArrays(); - -var $indexOf = callBound('Array.prototype.indexOf', true) || function indexOf(array, value) { - for (var i = 0; i < array.length; i += 1) { - if (array[i] === value) { - return i; - } - } - - return -1; -}; - -var $slice = callBound('String.prototype.slice'); -var toStrTags = {}; - -var gOPD = __webpack_require__(/*! es-abstract/helpers/getOwnPropertyDescriptor */ "./node_modules/es-abstract/helpers/getOwnPropertyDescriptor.js"); - -var getPrototypeOf = Object.getPrototypeOf; // require('getprototypeof'); - -if (hasToStringTag && gOPD && getPrototypeOf) { - forEach(typedArrays, function (typedArray) { - var arr = new g[typedArray](); - - if (Symbol.toStringTag in arr) { - var proto = getPrototypeOf(arr); - var descriptor = gOPD(proto, Symbol.toStringTag); - - if (!descriptor) { - var superProto = getPrototypeOf(proto); - descriptor = gOPD(superProto, Symbol.toStringTag); - } - - toStrTags[typedArray] = descriptor.get; - } - }); -} - -var tryTypedArrays = function tryAllTypedArrays(value) { - var anyTrue = false; - forEach(toStrTags, function (getter, typedArray) { - if (!anyTrue) { - try { - anyTrue = getter.call(value) === typedArray; - } catch (e) { - /**/ - } - } - }); - return anyTrue; -}; - -module.exports = function isTypedArray(value) { - if (!value || typeof value !== 'object') { - return false; - } - - if (!hasToStringTag || !(Symbol.toStringTag in value)) { - var tag = $slice($toString(value), 8, -1); - return $indexOf(typedArrays, tag) > -1; - } - - if (!gOPD) { - return false; - } - - return tryTypedArrays(value); -}; - -/***/ }), - -/***/ "./node_modules/is-weakmap/index.js": -/*!******************************************!*\ - !*** ./node_modules/is-weakmap/index.js ***! - \******************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var $WeakMap = typeof WeakMap === 'function' && WeakMap.prototype ? WeakMap : null; -var $WeakSet = typeof WeakSet === 'function' && WeakSet.prototype ? WeakSet : null; -var exported; - -if (!$WeakMap) { - // eslint-disable-next-line no-unused-vars - exported = function isWeakMap(x) { - // `WeakMap` is not present in this environment. - return false; - }; -} - -var $mapHas = $WeakMap ? $WeakMap.prototype.has : null; -var $setHas = $WeakSet ? $WeakSet.prototype.has : null; - -if (!exported && !$mapHas) { - // eslint-disable-next-line no-unused-vars - exported = function isWeakMap(x) { - // `WeakMap` does not have a `has` method - return false; - }; -} - -module.exports = exported || function isWeakMap(x) { - if (!x || typeof x !== 'object') { - return false; - } - - try { - $mapHas.call(x, $mapHas); - - if ($setHas) { - try { - $setHas.call(x, $setHas); - } catch (e) { - return true; - } - } - - return x instanceof $WeakMap; // core-js workaround, pre-v3 - } catch (e) {} - - return false; -}; - -/***/ }), - -/***/ "./node_modules/is-weakset/index.js": -/*!******************************************!*\ - !*** ./node_modules/is-weakset/index.js ***! - \******************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var GetIntrinsic = __webpack_require__(/*! get-intrinsic */ "./node_modules/get-intrinsic/index.js"); - -var callBound = __webpack_require__(/*! call-bind/callBound */ "./node_modules/call-bind/callBound.js"); - -var $WeakSet = GetIntrinsic('%WeakSet%', true); -var $setHas = callBound('WeakSet.prototype.has', true); - -if ($setHas) { - var $mapHas = callBound('WeakMap.prototype.has', true); - - module.exports = function isWeakSet(x) { - if (!x || typeof x !== 'object') { - return false; - } - - try { - $setHas(x, $setHas); - - if ($mapHas) { - try { - $mapHas(x, $mapHas); - } catch (e) { - return true; - } - } - - return x instanceof $WeakSet; // core-js workaround, pre-v3 - } catch (e) {} - - return false; - }; -} else { - // eslint-disable-next-line no-unused-vars - module.exports = function isWeakSet(x) { - // `WeakSet` does not exist, or does not have a `has` method - return false; - }; -} - -/***/ }), - -/***/ "./node_modules/locale-currency/index.js": -/*!***********************************************!*\ - !*** ./node_modules/locale-currency/index.js ***! - \***********************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -var map = __webpack_require__(/*! ./map */ "./node_modules/locale-currency/map.js"); - -var getCountryCode = function (localeString) { - var components = localeString.split("_"); - - if (components.length == 2) { - return components.pop(); - } - - components = localeString.split("-"); - - if (components.length == 2) { - return components.pop(); - } - - return localeString; -}; - -exports.getCurrency = function (locale) { - var countryCode = getCountryCode(locale).toUpperCase(); - - if (countryCode in map) { - return map[countryCode]; - } - - return null; -}; - -exports.getLocales = function (currencyCode) { - currencyCode = currencyCode.toUpperCase(); - var locales = []; - - for (countryCode in map) { - if (map[countryCode] === currencyCode) { - locales.push(countryCode); - } - } - - return locales; -}; - -/***/ }), - -/***/ "./node_modules/locale-currency/map.js": -/*!*********************************************!*\ - !*** ./node_modules/locale-currency/map.js ***! - \*********************************************/ -/*! no static exports found */ -/***/ (function(module, exports) { - -// Generated using ShowCurrencies.java -var map = { - AD: 'EUR', - AE: 'AED', - AF: 'AFN', - AG: 'XCD', - AI: 'XCD', - AL: 'ALL', - AM: 'AMD', - AN: 'ANG', - AO: 'AOA', - AR: 'ARS', - AS: 'USD', - AT: 'EUR', - AU: 'AUD', - AW: 'AWG', - AX: 'EUR', - AZ: 'AZN', - BA: 'BAM', - BB: 'BBD', - BD: 'BDT', - BE: 'EUR', - BF: 'XOF', - BG: 'BGN', - BH: 'BHD', - BI: 'BIF', - BJ: 'XOF', - BL: 'EUR', - BM: 'BMD', - BN: 'BND', - BO: 'BOB', - BQ: 'USD', - BR: 'BRL', - BS: 'BSD', - BT: 'BTN', - BV: 'NOK', - BW: 'BWP', - BY: 'BYR', - BZ: 'BZD', - CA: 'CAD', - CC: 'AUD', - CD: 'CDF', - CF: 'XAF', - CG: 'XAF', - CH: 'CHF', - CI: 'XOF', - CK: 'NZD', - CL: 'CLP', - CM: 'XAF', - CN: 'CNY', - CO: 'COP', - CR: 'CRC', - CU: 'CUP', - CV: 'CVE', - CW: 'ANG', - CX: 'AUD', - CY: 'EUR', - CZ: 'CZK', - DE: 'EUR', - DJ: 'DJF', - DK: 'DKK', - DM: 'XCD', - DO: 'DOP', - DZ: 'DZD', - EC: 'USD', - EE: 'EUR', - EG: 'EGP', - EH: 'MAD', - ER: 'ERN', - ES: 'EUR', - ET: 'ETB', - FI: 'EUR', - FJ: 'FJD', - FK: 'FKP', - FM: 'USD', - FO: 'DKK', - FR: 'EUR', - GA: 'XAF', - GB: 'GBP', - GD: 'XCD', - GE: 'GEL', - GF: 'EUR', - GG: 'GBP', - GH: 'GHS', - GI: 'GIP', - GL: 'DKK', - GM: 'GMD', - GN: 'GNF', - GP: 'EUR', - GQ: 'XAF', - GR: 'EUR', - GS: 'GBP', - GT: 'GTQ', - GU: 'USD', - GW: 'XOF', - GY: 'GYD', - HK: 'HKD', - HM: 'AUD', - HN: 'HNL', - HR: 'HRK', - HT: 'HTG', - HU: 'HUF', - ID: 'IDR', - IE: 'EUR', - IL: 'ILS', - IM: 'GBP', - IN: 'INR', - IO: 'USD', - IQ: 'IQD', - IR: 'IRR', - IS: 'ISK', - IT: 'EUR', - JE: 'GBP', - JM: 'JMD', - JO: 'JOD', - JP: 'JPY', - KE: 'KES', - KG: 'KGS', - KH: 'KHR', - KI: 'AUD', - KM: 'KMF', - KN: 'XCD', - KP: 'KPW', - KR: 'KRW', - KW: 'KWD', - KY: 'KYD', - KZ: 'KZT', - LA: 'LAK', - LB: 'LBP', - LC: 'XCD', - LI: 'CHF', - LK: 'LKR', - LR: 'LRD', - LS: 'LSL', - LT: 'LTL', - LU: 'EUR', - LV: 'LVL', - LY: 'LYD', - MA: 'MAD', - MC: 'EUR', - MD: 'MDL', - ME: 'EUR', - MF: 'EUR', - MG: 'MGA', - MH: 'USD', - MK: 'MKD', - ML: 'XOF', - MM: 'MMK', - MN: 'MNT', - MO: 'MOP', - MP: 'USD', - MQ: 'EUR', - MR: 'MRO', - MS: 'XCD', - MT: 'EUR', - MU: 'MUR', - MV: 'MVR', - MW: 'MWK', - MX: 'MXN', - MY: 'MYR', - MZ: 'MZN', - NA: 'NAD', - NC: 'XPF', - NE: 'XOF', - NF: 'AUD', - NG: 'NGN', - NI: 'NIO', - NL: 'EUR', - NO: 'NOK', - NP: 'NPR', - NR: 'AUD', - NU: 'NZD', - NZ: 'NZD', - OM: 'OMR', - PA: 'PAB', - PE: 'PEN', - PF: 'XPF', - PG: 'PGK', - PH: 'PHP', - PK: 'PKR', - PL: 'PLN', - PM: 'EUR', - PN: 'NZD', - PR: 'USD', - PS: 'ILS', - PT: 'EUR', - PW: 'USD', - PY: 'PYG', - QA: 'QAR', - RE: 'EUR', - RO: 'RON', - RS: 'RSD', - RU: 'RUB', - RW: 'RWF', - SA: 'SAR', - SB: 'SBD', - SC: 'SCR', - SD: 'SDG', - SE: 'SEK', - SG: 'SGD', - SH: 'SHP', - SI: 'EUR', - SJ: 'NOK', - SK: 'EUR', - SL: 'SLL', - SM: 'EUR', - SN: 'XOF', - SO: 'SOS', - SR: 'SRD', - ST: 'STD', - SV: 'SVC', - SX: 'ANG', - SY: 'SYP', - SZ: 'SZL', - TC: 'USD', - TD: 'XAF', - TF: 'EUR', - TG: 'XOF', - TH: 'THB', - TJ: 'TJS', - TK: 'NZD', - TL: 'USD', - TM: 'TMT', - TN: 'TND', - TO: 'TOP', - TR: 'TRY', - TT: 'TTD', - TV: 'AUD', - TW: 'TWD', - TZ: 'TZS', - UA: 'UAH', - UG: 'UGX', - UM: 'USD', - US: 'USD', - UY: 'UYU', - UZ: 'UZS', - VA: 'EUR', - VC: 'XCD', - VE: 'VEF', - VG: 'USD', - VI: 'USD', - VN: 'VND', - VU: 'VUV', - WF: 'XPF', - WS: 'WST', - YE: 'YER', - YT: 'EUR', - ZA: 'ZAR', - ZM: 'ZMK', - ZW: 'ZWL' -}; -module.exports = map; - -/***/ }), - -/***/ "./node_modules/lru-cache/index.js": -/*!*****************************************!*\ - !*** ./node_modules/lru-cache/index.js ***! - \*****************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - // A linked list to keep track of recently-used-ness - -const Yallist = __webpack_require__(/*! yallist */ "./node_modules/lru-cache/node_modules/yallist/yallist.js"); - -const MAX = Symbol('max'); -const LENGTH = Symbol('length'); -const LENGTH_CALCULATOR = Symbol('lengthCalculator'); -const ALLOW_STALE = Symbol('allowStale'); -const MAX_AGE = Symbol('maxAge'); -const DISPOSE = Symbol('dispose'); -const NO_DISPOSE_ON_SET = Symbol('noDisposeOnSet'); -const LRU_LIST = Symbol('lruList'); -const CACHE = Symbol('cache'); -const UPDATE_AGE_ON_GET = Symbol('updateAgeOnGet'); - -const naiveLength = () => 1; // lruList is a yallist where the head is the youngest -// item, and the tail is the oldest. the list contains the Hit -// objects as the entries. -// Each Hit object has a reference to its Yallist.Node. This -// never changes. -// -// cache is a Map (or PseudoMap) that matches the keys to -// the Yallist.Node object. - - -class LRUCache { - constructor(options) { - if (typeof options === 'number') options = { - max: options - }; - if (!options) options = {}; - if (options.max && (typeof options.max !== 'number' || options.max < 0)) throw new TypeError('max must be a non-negative number'); // Kind of weird to have a default max of Infinity, but oh well. - - const max = this[MAX] = options.max || Infinity; - const lc = options.length || naiveLength; - this[LENGTH_CALCULATOR] = typeof lc !== 'function' ? naiveLength : lc; - this[ALLOW_STALE] = options.stale || false; - if (options.maxAge && typeof options.maxAge !== 'number') throw new TypeError('maxAge must be a number'); - this[MAX_AGE] = options.maxAge || 0; - this[DISPOSE] = options.dispose; - this[NO_DISPOSE_ON_SET] = options.noDisposeOnSet || false; - this[UPDATE_AGE_ON_GET] = options.updateAgeOnGet || false; - this.reset(); - } // resize the cache when the max changes. - - - set max(mL) { - if (typeof mL !== 'number' || mL < 0) throw new TypeError('max must be a non-negative number'); - this[MAX] = mL || Infinity; - trim(this); - } - - get max() { - return this[MAX]; - } - - set allowStale(allowStale) { - this[ALLOW_STALE] = !!allowStale; - } - - get allowStale() { - return this[ALLOW_STALE]; - } - - set maxAge(mA) { - if (typeof mA !== 'number') throw new TypeError('maxAge must be a non-negative number'); - this[MAX_AGE] = mA; - trim(this); - } - - get maxAge() { - return this[MAX_AGE]; - } // resize the cache when the lengthCalculator changes. - - - set lengthCalculator(lC) { - if (typeof lC !== 'function') lC = naiveLength; - - if (lC !== this[LENGTH_CALCULATOR]) { - this[LENGTH_CALCULATOR] = lC; - this[LENGTH] = 0; - this[LRU_LIST].forEach(hit => { - hit.length = this[LENGTH_CALCULATOR](hit.value, hit.key); - this[LENGTH] += hit.length; - }); - } - - trim(this); - } - - get lengthCalculator() { - return this[LENGTH_CALCULATOR]; - } - - get length() { - return this[LENGTH]; - } - - get itemCount() { - return this[LRU_LIST].length; - } - - rforEach(fn, thisp) { - thisp = thisp || this; - - for (let walker = this[LRU_LIST].tail; walker !== null;) { - const prev = walker.prev; - forEachStep(this, fn, walker, thisp); - walker = prev; - } - } - - forEach(fn, thisp) { - thisp = thisp || this; - - for (let walker = this[LRU_LIST].head; walker !== null;) { - const next = walker.next; - forEachStep(this, fn, walker, thisp); - walker = next; - } - } - - keys() { - return this[LRU_LIST].toArray().map(k => k.key); - } - - values() { - return this[LRU_LIST].toArray().map(k => k.value); - } - - reset() { - if (this[DISPOSE] && this[LRU_LIST] && this[LRU_LIST].length) { - this[LRU_LIST].forEach(hit => this[DISPOSE](hit.key, hit.value)); - } - - this[CACHE] = new Map(); // hash of items by key - - this[LRU_LIST] = new Yallist(); // list of items in order of use recency - - this[LENGTH] = 0; // length of items in the list - } - - dump() { - return this[LRU_LIST].map(hit => isStale(this, hit) ? false : { - k: hit.key, - v: hit.value, - e: hit.now + (hit.maxAge || 0) - }).toArray().filter(h => h); - } - - dumpLru() { - return this[LRU_LIST]; - } - - set(key, value, maxAge) { - maxAge = maxAge || this[MAX_AGE]; - if (maxAge && typeof maxAge !== 'number') throw new TypeError('maxAge must be a number'); - const now = maxAge ? Date.now() : 0; - const len = this[LENGTH_CALCULATOR](value, key); - - if (this[CACHE].has(key)) { - if (len > this[MAX]) { - del(this, this[CACHE].get(key)); - return false; - } - - const node = this[CACHE].get(key); - const item = node.value; // dispose of the old one before overwriting - // split out into 2 ifs for better coverage tracking - - if (this[DISPOSE]) { - if (!this[NO_DISPOSE_ON_SET]) this[DISPOSE](key, item.value); - } - - item.now = now; - item.maxAge = maxAge; - item.value = value; - this[LENGTH] += len - item.length; - item.length = len; - this.get(key); - trim(this); - return true; - } - - const hit = new Entry(key, value, len, now, maxAge); // oversized objects fall out of cache automatically. - - if (hit.length > this[MAX]) { - if (this[DISPOSE]) this[DISPOSE](key, value); - return false; - } - - this[LENGTH] += hit.length; - this[LRU_LIST].unshift(hit); - this[CACHE].set(key, this[LRU_LIST].head); - trim(this); - return true; - } - - has(key) { - if (!this[CACHE].has(key)) return false; - const hit = this[CACHE].get(key).value; - return !isStale(this, hit); - } - - get(key) { - return get(this, key, true); - } - - peek(key) { - return get(this, key, false); - } - - pop() { - const node = this[LRU_LIST].tail; - if (!node) return null; - del(this, node); - return node.value; - } - - del(key) { - del(this, this[CACHE].get(key)); - } - - load(arr) { - // reset the cache - this.reset(); - const now = Date.now(); // A previous serialized cache has the most recent items first - - for (let l = arr.length - 1; l >= 0; l--) { - const hit = arr[l]; - const expiresAt = hit.e || 0; - if (expiresAt === 0) // the item was created without expiration in a non aged cache - this.set(hit.k, hit.v);else { - const maxAge = expiresAt - now; // dont add already expired items - - if (maxAge > 0) { - this.set(hit.k, hit.v, maxAge); - } - } - } - } - - prune() { - this[CACHE].forEach((value, key) => get(this, key, false)); - } - -} - -const get = (self, key, doUse) => { - const node = self[CACHE].get(key); - - if (node) { - const hit = node.value; - - if (isStale(self, hit)) { - del(self, node); - if (!self[ALLOW_STALE]) return undefined; - } else { - if (doUse) { - if (self[UPDATE_AGE_ON_GET]) node.value.now = Date.now(); - self[LRU_LIST].unshiftNode(node); - } - } - - return hit.value; - } -}; - -const isStale = (self, hit) => { - if (!hit || !hit.maxAge && !self[MAX_AGE]) return false; - const diff = Date.now() - hit.now; - return hit.maxAge ? diff > hit.maxAge : self[MAX_AGE] && diff > self[MAX_AGE]; -}; - -const trim = self => { - if (self[LENGTH] > self[MAX]) { - for (let walker = self[LRU_LIST].tail; self[LENGTH] > self[MAX] && walker !== null;) { - // We know that we're about to delete this one, and also - // what the next least recently used key will be, so just - // go ahead and set it now. - const prev = walker.prev; - del(self, walker); - walker = prev; - } - } -}; - -const del = (self, node) => { - if (node) { - const hit = node.value; - if (self[DISPOSE]) self[DISPOSE](hit.key, hit.value); - self[LENGTH] -= hit.length; - self[CACHE].delete(hit.key); - self[LRU_LIST].removeNode(node); - } -}; - -class Entry { - constructor(key, value, length, now, maxAge) { - this.key = key; - this.value = value; - this.length = length; - this.now = now; - this.maxAge = maxAge || 0; - } - -} - -const forEachStep = (self, fn, node, thisp) => { - let hit = node.value; - - if (isStale(self, hit)) { - del(self, node); - if (!self[ALLOW_STALE]) hit = undefined; - } - - if (hit) fn.call(thisp, hit.value, hit.key, self); -}; - -module.exports = LRUCache; - -/***/ }), - -/***/ "./node_modules/lru-cache/node_modules/yallist/iterator.js": -/*!*****************************************************************!*\ - !*** ./node_modules/lru-cache/node_modules/yallist/iterator.js ***! - \*****************************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -module.exports = function (Yallist) { - Yallist.prototype[Symbol.iterator] = function* () { - for (let walker = this.head; walker; walker = walker.next) { - yield walker.value; - } - }; -}; - -/***/ }), - -/***/ "./node_modules/lru-cache/node_modules/yallist/yallist.js": -/*!****************************************************************!*\ - !*** ./node_modules/lru-cache/node_modules/yallist/yallist.js ***! - \****************************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -module.exports = Yallist; -Yallist.Node = Node; -Yallist.create = Yallist; - -function Yallist(list) { - var self = this; - - if (!(self instanceof Yallist)) { - self = new Yallist(); - } - - self.tail = null; - self.head = null; - self.length = 0; - - if (list && typeof list.forEach === 'function') { - list.forEach(function (item) { - self.push(item); - }); - } else if (arguments.length > 0) { - for (var i = 0, l = arguments.length; i < l; i++) { - self.push(arguments[i]); - } - } - - return self; -} - -Yallist.prototype.removeNode = function (node) { - if (node.list !== this) { - throw new Error('removing node which does not belong to this list'); - } - - var next = node.next; - var prev = node.prev; - - if (next) { - next.prev = prev; - } - - if (prev) { - prev.next = next; - } - - if (node === this.head) { - this.head = next; - } - - if (node === this.tail) { - this.tail = prev; - } - - node.list.length--; - node.next = null; - node.prev = null; - node.list = null; - return next; -}; - -Yallist.prototype.unshiftNode = function (node) { - if (node === this.head) { - return; - } - - if (node.list) { - node.list.removeNode(node); - } - - var head = this.head; - node.list = this; - node.next = head; - - if (head) { - head.prev = node; - } - - this.head = node; - - if (!this.tail) { - this.tail = node; - } - - this.length++; -}; - -Yallist.prototype.pushNode = function (node) { - if (node === this.tail) { - return; - } - - if (node.list) { - node.list.removeNode(node); - } - - var tail = this.tail; - node.list = this; - node.prev = tail; - - if (tail) { - tail.next = node; - } - - this.tail = node; - - if (!this.head) { - this.head = node; - } - - this.length++; -}; - -Yallist.prototype.push = function () { - for (var i = 0, l = arguments.length; i < l; i++) { - push(this, arguments[i]); - } - - return this.length; -}; - -Yallist.prototype.unshift = function () { - for (var i = 0, l = arguments.length; i < l; i++) { - unshift(this, arguments[i]); - } - - return this.length; -}; - -Yallist.prototype.pop = function () { - if (!this.tail) { - return undefined; - } - - var res = this.tail.value; - this.tail = this.tail.prev; - - if (this.tail) { - this.tail.next = null; - } else { - this.head = null; - } - - this.length--; - return res; -}; - -Yallist.prototype.shift = function () { - if (!this.head) { - return undefined; - } - - var res = this.head.value; - this.head = this.head.next; - - if (this.head) { - this.head.prev = null; - } else { - this.tail = null; - } - - this.length--; - return res; -}; - -Yallist.prototype.forEach = function (fn, thisp) { - thisp = thisp || this; - - for (var walker = this.head, i = 0; walker !== null; i++) { - fn.call(thisp, walker.value, i, this); - walker = walker.next; - } -}; - -Yallist.prototype.forEachReverse = function (fn, thisp) { - thisp = thisp || this; - - for (var walker = this.tail, i = this.length - 1; walker !== null; i--) { - fn.call(thisp, walker.value, i, this); - walker = walker.prev; - } -}; - -Yallist.prototype.get = function (n) { - for (var i = 0, walker = this.head; walker !== null && i < n; i++) { - // abort out of the list early if we hit a cycle - walker = walker.next; - } - - if (i === n && walker !== null) { - return walker.value; - } -}; - -Yallist.prototype.getReverse = function (n) { - for (var i = 0, walker = this.tail; walker !== null && i < n; i++) { - // abort out of the list early if we hit a cycle - walker = walker.prev; - } - - if (i === n && walker !== null) { - return walker.value; - } -}; - -Yallist.prototype.map = function (fn, thisp) { - thisp = thisp || this; - var res = new Yallist(); - - for (var walker = this.head; walker !== null;) { - res.push(fn.call(thisp, walker.value, this)); - walker = walker.next; - } - - return res; -}; - -Yallist.prototype.mapReverse = function (fn, thisp) { - thisp = thisp || this; - var res = new Yallist(); - - for (var walker = this.tail; walker !== null;) { - res.push(fn.call(thisp, walker.value, this)); - walker = walker.prev; - } - - return res; -}; - -Yallist.prototype.reduce = function (fn, initial) { - var acc; - var walker = this.head; - - if (arguments.length > 1) { - acc = initial; - } else if (this.head) { - walker = this.head.next; - acc = this.head.value; - } else { - throw new TypeError('Reduce of empty list with no initial value'); - } - - for (var i = 0; walker !== null; i++) { - acc = fn(acc, walker.value, i); - walker = walker.next; - } - - return acc; -}; - -Yallist.prototype.reduceReverse = function (fn, initial) { - var acc; - var walker = this.tail; - - if (arguments.length > 1) { - acc = initial; - } else if (this.tail) { - walker = this.tail.prev; - acc = this.tail.value; - } else { - throw new TypeError('Reduce of empty list with no initial value'); - } - - for (var i = this.length - 1; walker !== null; i--) { - acc = fn(acc, walker.value, i); - walker = walker.prev; - } - - return acc; -}; - -Yallist.prototype.toArray = function () { - var arr = new Array(this.length); - - for (var i = 0, walker = this.head; walker !== null; i++) { - arr[i] = walker.value; - walker = walker.next; - } - - return arr; -}; - -Yallist.prototype.toArrayReverse = function () { - var arr = new Array(this.length); - - for (var i = 0, walker = this.tail; walker !== null; i++) { - arr[i] = walker.value; - walker = walker.prev; - } - - return arr; -}; - -Yallist.prototype.slice = function (from, to) { - to = to || this.length; - - if (to < 0) { - to += this.length; - } - - from = from || 0; - - if (from < 0) { - from += this.length; - } - - var ret = new Yallist(); - - if (to < from || to < 0) { - return ret; - } - - if (from < 0) { - from = 0; - } - - if (to > this.length) { - to = this.length; - } - - for (var i = 0, walker = this.head; walker !== null && i < from; i++) { - walker = walker.next; - } - - for (; walker !== null && i < to; i++, walker = walker.next) { - ret.push(walker.value); - } - - return ret; -}; - -Yallist.prototype.sliceReverse = function (from, to) { - to = to || this.length; - - if (to < 0) { - to += this.length; - } - - from = from || 0; - - if (from < 0) { - from += this.length; - } - - var ret = new Yallist(); - - if (to < from || to < 0) { - return ret; - } - - if (from < 0) { - from = 0; - } - - if (to > this.length) { - to = this.length; - } - - for (var i = this.length, walker = this.tail; walker !== null && i > to; i--) { - walker = walker.prev; - } - - for (; walker !== null && i > from; i--, walker = walker.prev) { - ret.push(walker.value); - } - - return ret; -}; - -Yallist.prototype.splice = function (start, deleteCount -/*, ...nodes */ -) { - if (start > this.length) { - start = this.length - 1; - } - - if (start < 0) { - start = this.length + start; - } - - for (var i = 0, walker = this.head; walker !== null && i < start; i++) { - walker = walker.next; - } - - var ret = []; - - for (var i = 0; walker && i < deleteCount; i++) { - ret.push(walker.value); - walker = this.removeNode(walker); - } - - if (walker === null) { - walker = this.tail; - } - - if (walker !== this.head && walker !== this.tail) { - walker = walker.prev; - } - - for (var i = 2; i < arguments.length; i++) { - walker = insert(this, walker, arguments[i]); - } - - return ret; -}; - -Yallist.prototype.reverse = function () { - var head = this.head; - var tail = this.tail; - - for (var walker = head; walker !== null; walker = walker.prev) { - var p = walker.prev; - walker.prev = walker.next; - walker.next = p; - } - - this.head = tail; - this.tail = head; - return this; -}; - -function insert(self, node, value) { - var inserted = node === self.head ? new Node(value, null, node, self) : new Node(value, node, node.next, self); - - if (inserted.next === null) { - self.tail = inserted; - } - - if (inserted.prev === null) { - self.head = inserted; - } - - self.length++; - return inserted; -} - -function push(self, item) { - self.tail = new Node(item, self.tail, null, self); - - if (!self.head) { - self.head = self.tail; - } - - self.length++; -} - -function unshift(self, item) { - self.head = new Node(item, null, self.head, self); - - if (!self.tail) { - self.tail = self.head; - } - - self.length++; -} - -function Node(value, prev, next, list) { - if (!(this instanceof Node)) { - return new Node(value, prev, next, list); - } - - this.list = list; - this.value = value; - - if (prev) { - prev.next = this; - this.prev = prev; - } else { - this.prev = null; - } - - if (next) { - next.prev = this; - this.next = next; - } else { - this.next = null; - } -} - -try { - // add if support for Symbol.iterator is present - __webpack_require__(/*! ./iterator.js */ "./node_modules/lru-cache/node_modules/yallist/iterator.js")(Yallist); -} catch (er) {} - -/***/ }), - -/***/ "./node_modules/md5/md5.js": -/*!*********************************!*\ - !*** ./node_modules/md5/md5.js ***! - \*********************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -(function () { - var crypt = __webpack_require__(/*! crypt */ "./node_modules/crypt/crypt.js"), - utf8 = __webpack_require__(/*! charenc */ "./node_modules/charenc/charenc.js").utf8, - isBuffer = __webpack_require__(/*! is-buffer */ "./node_modules/is-buffer/index.js"), - bin = __webpack_require__(/*! charenc */ "./node_modules/charenc/charenc.js").bin, - // The core - md5 = function (message, options) { - // Convert to byte array - if (message.constructor == String) { - if (options && options.encoding === 'binary') message = bin.stringToBytes(message);else message = utf8.stringToBytes(message); - } else if (isBuffer(message)) message = Array.prototype.slice.call(message, 0);else if (!Array.isArray(message) && message.constructor !== Uint8Array) message = message.toString(); // else, assume byte array already - - var m = crypt.bytesToWords(message), - l = message.length * 8, - a = 1732584193, - b = -271733879, - c = -1732584194, - d = 271733878; // Swap endian - - for (var i = 0; i < m.length; i++) { - m[i] = (m[i] << 8 | m[i] >>> 24) & 0x00FF00FF | (m[i] << 24 | m[i] >>> 8) & 0xFF00FF00; - } // Padding - - - m[l >>> 5] |= 0x80 << l % 32; - m[(l + 64 >>> 9 << 4) + 14] = l; // Method shortcuts - - var FF = md5._ff, - GG = md5._gg, - HH = md5._hh, - II = md5._ii; - - for (var i = 0; i < m.length; i += 16) { - var aa = a, - bb = b, - cc = c, - dd = d; - a = FF(a, b, c, d, m[i + 0], 7, -680876936); - d = FF(d, a, b, c, m[i + 1], 12, -389564586); - c = FF(c, d, a, b, m[i + 2], 17, 606105819); - b = FF(b, c, d, a, m[i + 3], 22, -1044525330); - a = FF(a, b, c, d, m[i + 4], 7, -176418897); - d = FF(d, a, b, c, m[i + 5], 12, 1200080426); - c = FF(c, d, a, b, m[i + 6], 17, -1473231341); - b = FF(b, c, d, a, m[i + 7], 22, -45705983); - a = FF(a, b, c, d, m[i + 8], 7, 1770035416); - d = FF(d, a, b, c, m[i + 9], 12, -1958414417); - c = FF(c, d, a, b, m[i + 10], 17, -42063); - b = FF(b, c, d, a, m[i + 11], 22, -1990404162); - a = FF(a, b, c, d, m[i + 12], 7, 1804603682); - d = FF(d, a, b, c, m[i + 13], 12, -40341101); - c = FF(c, d, a, b, m[i + 14], 17, -1502002290); - b = FF(b, c, d, a, m[i + 15], 22, 1236535329); - a = GG(a, b, c, d, m[i + 1], 5, -165796510); - d = GG(d, a, b, c, m[i + 6], 9, -1069501632); - c = GG(c, d, a, b, m[i + 11], 14, 643717713); - b = GG(b, c, d, a, m[i + 0], 20, -373897302); - a = GG(a, b, c, d, m[i + 5], 5, -701558691); - d = GG(d, a, b, c, m[i + 10], 9, 38016083); - c = GG(c, d, a, b, m[i + 15], 14, -660478335); - b = GG(b, c, d, a, m[i + 4], 20, -405537848); - a = GG(a, b, c, d, m[i + 9], 5, 568446438); - d = GG(d, a, b, c, m[i + 14], 9, -1019803690); - c = GG(c, d, a, b, m[i + 3], 14, -187363961); - b = GG(b, c, d, a, m[i + 8], 20, 1163531501); - a = GG(a, b, c, d, m[i + 13], 5, -1444681467); - d = GG(d, a, b, c, m[i + 2], 9, -51403784); - c = GG(c, d, a, b, m[i + 7], 14, 1735328473); - b = GG(b, c, d, a, m[i + 12], 20, -1926607734); - a = HH(a, b, c, d, m[i + 5], 4, -378558); - d = HH(d, a, b, c, m[i + 8], 11, -2022574463); - c = HH(c, d, a, b, m[i + 11], 16, 1839030562); - b = HH(b, c, d, a, m[i + 14], 23, -35309556); - a = HH(a, b, c, d, m[i + 1], 4, -1530992060); - d = HH(d, a, b, c, m[i + 4], 11, 1272893353); - c = HH(c, d, a, b, m[i + 7], 16, -155497632); - b = HH(b, c, d, a, m[i + 10], 23, -1094730640); - a = HH(a, b, c, d, m[i + 13], 4, 681279174); - d = HH(d, a, b, c, m[i + 0], 11, -358537222); - c = HH(c, d, a, b, m[i + 3], 16, -722521979); - b = HH(b, c, d, a, m[i + 6], 23, 76029189); - a = HH(a, b, c, d, m[i + 9], 4, -640364487); - d = HH(d, a, b, c, m[i + 12], 11, -421815835); - c = HH(c, d, a, b, m[i + 15], 16, 530742520); - b = HH(b, c, d, a, m[i + 2], 23, -995338651); - a = II(a, b, c, d, m[i + 0], 6, -198630844); - d = II(d, a, b, c, m[i + 7], 10, 1126891415); - c = II(c, d, a, b, m[i + 14], 15, -1416354905); - b = II(b, c, d, a, m[i + 5], 21, -57434055); - a = II(a, b, c, d, m[i + 12], 6, 1700485571); - d = II(d, a, b, c, m[i + 3], 10, -1894986606); - c = II(c, d, a, b, m[i + 10], 15, -1051523); - b = II(b, c, d, a, m[i + 1], 21, -2054922799); - a = II(a, b, c, d, m[i + 8], 6, 1873313359); - d = II(d, a, b, c, m[i + 15], 10, -30611744); - c = II(c, d, a, b, m[i + 6], 15, -1560198380); - b = II(b, c, d, a, m[i + 13], 21, 1309151649); - a = II(a, b, c, d, m[i + 4], 6, -145523070); - d = II(d, a, b, c, m[i + 11], 10, -1120210379); - c = II(c, d, a, b, m[i + 2], 15, 718787259); - b = II(b, c, d, a, m[i + 9], 21, -343485551); - a = a + aa >>> 0; - b = b + bb >>> 0; - c = c + cc >>> 0; - d = d + dd >>> 0; - } - - return crypt.endian([a, b, c, d]); - }; // Auxiliary functions - - - md5._ff = function (a, b, c, d, x, s, t) { - var n = a + (b & c | ~b & d) + (x >>> 0) + t; - return (n << s | n >>> 32 - s) + b; - }; - - md5._gg = function (a, b, c, d, x, s, t) { - var n = a + (b & d | c & ~d) + (x >>> 0) + t; - return (n << s | n >>> 32 - s) + b; - }; - - md5._hh = function (a, b, c, d, x, s, t) { - var n = a + (b ^ c ^ d) + (x >>> 0) + t; - return (n << s | n >>> 32 - s) + b; - }; - - md5._ii = function (a, b, c, d, x, s, t) { - var n = a + (c ^ (b | ~d)) + (x >>> 0) + t; - return (n << s | n >>> 32 - s) + b; - }; // Package private blocksize - - - md5._blocksize = 16; - md5._digestsize = 16; - - module.exports = function (message, options) { - if (message === undefined || message === null) throw new Error('Illegal argument ' + message); - var digestbytes = crypt.wordsToBytes(md5(message, options)); - return options && options.asBytes ? digestbytes : options && options.asString ? bin.bytesToString(digestbytes) : crypt.bytesToHex(digestbytes); - }; -})(); - -/***/ }), - -/***/ "./node_modules/memoize-one/dist/memoize-one.esm.js": -/*!**********************************************************!*\ - !*** ./node_modules/memoize-one/dist/memoize-one.esm.js ***! - \**********************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -var simpleIsEqual = function simpleIsEqual(a, b) { - return a === b; -}; - -function index(resultFn, isEqual) { - if (isEqual === void 0) { - isEqual = simpleIsEqual; - } - - var lastThis; - var lastArgs = []; - var lastResult; - var calledOnce = false; - - var isNewArgEqualToLast = function isNewArgEqualToLast(newArg, index) { - return isEqual(newArg, lastArgs[index], index); - }; - - var result = function result() { - for (var _len = arguments.length, newArgs = new Array(_len), _key = 0; _key < _len; _key++) { - newArgs[_key] = arguments[_key]; - } - - if (calledOnce && lastThis === this && newArgs.length === lastArgs.length && newArgs.every(isNewArgEqualToLast)) { - return lastResult; - } - - lastResult = resultFn.apply(this, newArgs); - calledOnce = true; - lastThis = this; - lastArgs = newArgs; - return lastResult; - }; - - return result; -} - -/* harmony default export */ __webpack_exports__["default"] = (index); - -/***/ }), - -/***/ "./node_modules/murmurhash/murmurhash.js": -/*!***********************************************!*\ - !*** ./node_modules/murmurhash/murmurhash.js ***! - \***********************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -(function () { - var _global = this; - /** - * JS Implementation of MurmurHash2 - * - * @author <a href="mailto:gary.court@gmail.com">Gary Court</a> - * @see http://github.com/garycourt/murmurhash-js - * @author <a href="mailto:aappleby@gmail.com">Austin Appleby</a> - * @see http://sites.google.com/site/murmurhash/ - * - * @param {string} str ASCII only - * @param {number} seed Positive integer only - * @return {number} 32-bit positive integer hash - */ - - - function MurmurHashV2(str, seed) { - var l = str.length, - h = seed ^ l, - i = 0, - k; - - while (l >= 4) { - k = str.charCodeAt(i) & 0xff | (str.charCodeAt(++i) & 0xff) << 8 | (str.charCodeAt(++i) & 0xff) << 16 | (str.charCodeAt(++i) & 0xff) << 24; - k = (k & 0xffff) * 0x5bd1e995 + (((k >>> 16) * 0x5bd1e995 & 0xffff) << 16); - k ^= k >>> 24; - k = (k & 0xffff) * 0x5bd1e995 + (((k >>> 16) * 0x5bd1e995 & 0xffff) << 16); - h = (h & 0xffff) * 0x5bd1e995 + (((h >>> 16) * 0x5bd1e995 & 0xffff) << 16) ^ k; - l -= 4; - ++i; - } - - switch (l) { - case 3: - h ^= (str.charCodeAt(i + 2) & 0xff) << 16; - - case 2: - h ^= (str.charCodeAt(i + 1) & 0xff) << 8; - - case 1: - h ^= str.charCodeAt(i) & 0xff; - h = (h & 0xffff) * 0x5bd1e995 + (((h >>> 16) * 0x5bd1e995 & 0xffff) << 16); - } - - h ^= h >>> 13; - h = (h & 0xffff) * 0x5bd1e995 + (((h >>> 16) * 0x5bd1e995 & 0xffff) << 16); - h ^= h >>> 15; - return h >>> 0; - } - - ; - /** - * JS Implementation of MurmurHash3 (r136) (as of May 20, 2011) - * - * @author <a href="mailto:gary.court@gmail.com">Gary Court</a> - * @see http://github.com/garycourt/murmurhash-js - * @author <a href="mailto:aappleby@gmail.com">Austin Appleby</a> - * @see http://sites.google.com/site/murmurhash/ - * - * @param {string} key ASCII only - * @param {number} seed Positive integer only - * @return {number} 32-bit positive integer hash - */ - - function MurmurHashV3(key, seed) { - var remainder, bytes, h1, h1b, c1, c1b, c2, c2b, k1, i; - remainder = key.length & 3; // key.length % 4 - - bytes = key.length - remainder; - h1 = seed; - c1 = 0xcc9e2d51; - c2 = 0x1b873593; - i = 0; - - while (i < bytes) { - k1 = key.charCodeAt(i) & 0xff | (key.charCodeAt(++i) & 0xff) << 8 | (key.charCodeAt(++i) & 0xff) << 16 | (key.charCodeAt(++i) & 0xff) << 24; - ++i; - k1 = (k1 & 0xffff) * c1 + (((k1 >>> 16) * c1 & 0xffff) << 16) & 0xffffffff; - k1 = k1 << 15 | k1 >>> 17; - k1 = (k1 & 0xffff) * c2 + (((k1 >>> 16) * c2 & 0xffff) << 16) & 0xffffffff; - h1 ^= k1; - h1 = h1 << 13 | h1 >>> 19; - h1b = (h1 & 0xffff) * 5 + (((h1 >>> 16) * 5 & 0xffff) << 16) & 0xffffffff; - h1 = (h1b & 0xffff) + 0x6b64 + (((h1b >>> 16) + 0xe654 & 0xffff) << 16); - } - - k1 = 0; - - switch (remainder) { - case 3: - k1 ^= (key.charCodeAt(i + 2) & 0xff) << 16; - - case 2: - k1 ^= (key.charCodeAt(i + 1) & 0xff) << 8; - - case 1: - k1 ^= key.charCodeAt(i) & 0xff; - k1 = (k1 & 0xffff) * c1 + (((k1 >>> 16) * c1 & 0xffff) << 16) & 0xffffffff; - k1 = k1 << 15 | k1 >>> 17; - k1 = (k1 & 0xffff) * c2 + (((k1 >>> 16) * c2 & 0xffff) << 16) & 0xffffffff; - h1 ^= k1; - } - - h1 ^= key.length; - h1 ^= h1 >>> 16; - h1 = (h1 & 0xffff) * 0x85ebca6b + (((h1 >>> 16) * 0x85ebca6b & 0xffff) << 16) & 0xffffffff; - h1 ^= h1 >>> 13; - h1 = (h1 & 0xffff) * 0xc2b2ae35 + (((h1 >>> 16) * 0xc2b2ae35 & 0xffff) << 16) & 0xffffffff; - h1 ^= h1 >>> 16; - return h1 >>> 0; - } - - var murmur = MurmurHashV3; - murmur.v2 = MurmurHashV2; - murmur.v3 = MurmurHashV3; - - if (true) { - module.exports = murmur; - } else { var _previousRoot; } -})(); - -/***/ }), - -/***/ "./node_modules/object-assign/index.js": -/*!*********************************************!*\ - !*** ./node_modules/object-assign/index.js ***! - \*********************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/* -object-assign -(c) Sindre Sorhus -@license MIT -*/ - -/* eslint-disable no-unused-vars */ - -var getOwnPropertySymbols = Object.getOwnPropertySymbols; -var hasOwnProperty = Object.prototype.hasOwnProperty; -var propIsEnumerable = Object.prototype.propertyIsEnumerable; - -function toObject(val) { - if (val === null || val === undefined) { - throw new TypeError('Object.assign cannot be called with null or undefined'); - } - - return Object(val); -} - -function shouldUseNative() { - try { - if (!Object.assign) { - return false; - } // Detect buggy property enumeration order in older V8 versions. - // https://bugs.chromium.org/p/v8/issues/detail?id=4118 - - - var test1 = new String('abc'); // eslint-disable-line no-new-wrappers - - test1[5] = 'de'; - - if (Object.getOwnPropertyNames(test1)[0] === '5') { - return false; - } // https://bugs.chromium.org/p/v8/issues/detail?id=3056 - - - var test2 = {}; - - for (var i = 0; i < 10; i++) { - test2['_' + String.fromCharCode(i)] = i; - } - - var order2 = Object.getOwnPropertyNames(test2).map(function (n) { - return test2[n]; - }); - - if (order2.join('') !== '0123456789') { - return false; - } // https://bugs.chromium.org/p/v8/issues/detail?id=3056 - - - var test3 = {}; - 'abcdefghijklmnopqrst'.split('').forEach(function (letter) { - test3[letter] = letter; - }); - - if (Object.keys(Object.assign({}, test3)).join('') !== 'abcdefghijklmnopqrst') { - return false; - } - - return true; - } catch (err) { - // We don't expect any of the above to throw, but better to be safe. - return false; - } -} - -module.exports = shouldUseNative() ? Object.assign : function (target, source) { - var from; - var to = toObject(target); - var symbols; - - for (var s = 1; s < arguments.length; s++) { - from = Object(arguments[s]); - - for (var key in from) { - if (hasOwnProperty.call(from, key)) { - to[key] = from[key]; - } - } - - if (getOwnPropertySymbols) { - symbols = getOwnPropertySymbols(from); - - for (var i = 0; i < symbols.length; i++) { - if (propIsEnumerable.call(from, symbols[i])) { - to[symbols[i]] = from[symbols[i]]; - } - } - } - } - - return to; -}; - -/***/ }), - -/***/ "./node_modules/object-inspect/index.js": -/*!**********************************************!*\ - !*** ./node_modules/object-inspect/index.js ***! - \**********************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -var hasMap = typeof Map === 'function' && Map.prototype; -var mapSizeDescriptor = Object.getOwnPropertyDescriptor && hasMap ? Object.getOwnPropertyDescriptor(Map.prototype, 'size') : null; -var mapSize = hasMap && mapSizeDescriptor && typeof mapSizeDescriptor.get === 'function' ? mapSizeDescriptor.get : null; -var mapForEach = hasMap && Map.prototype.forEach; -var hasSet = typeof Set === 'function' && Set.prototype; -var setSizeDescriptor = Object.getOwnPropertyDescriptor && hasSet ? Object.getOwnPropertyDescriptor(Set.prototype, 'size') : null; -var setSize = hasSet && setSizeDescriptor && typeof setSizeDescriptor.get === 'function' ? setSizeDescriptor.get : null; -var setForEach = hasSet && Set.prototype.forEach; -var hasWeakMap = typeof WeakMap === 'function' && WeakMap.prototype; -var weakMapHas = hasWeakMap ? WeakMap.prototype.has : null; -var hasWeakSet = typeof WeakSet === 'function' && WeakSet.prototype; -var weakSetHas = hasWeakSet ? WeakSet.prototype.has : null; -var hasWeakRef = typeof WeakRef === 'function' && WeakRef.prototype; -var weakRefDeref = hasWeakRef ? WeakRef.prototype.deref : null; -var booleanValueOf = Boolean.prototype.valueOf; -var objectToString = Object.prototype.toString; -var functionToString = Function.prototype.toString; -var $match = String.prototype.match; -var $slice = String.prototype.slice; -var $replace = String.prototype.replace; -var $toUpperCase = String.prototype.toUpperCase; -var $toLowerCase = String.prototype.toLowerCase; -var $test = RegExp.prototype.test; -var $concat = Array.prototype.concat; -var $join = Array.prototype.join; -var $arrSlice = Array.prototype.slice; -var $floor = Math.floor; -var bigIntValueOf = typeof BigInt === 'function' ? BigInt.prototype.valueOf : null; -var gOPS = Object.getOwnPropertySymbols; -var symToString = typeof Symbol === 'function' && typeof Symbol.iterator === 'symbol' ? Symbol.prototype.toString : null; -var hasShammedSymbols = typeof Symbol === 'function' && typeof Symbol.iterator === 'object'; // ie, `has-tostringtag/shams - -var toStringTag = typeof Symbol === 'function' && Symbol.toStringTag && (typeof Symbol.toStringTag === hasShammedSymbols ? 'object' : 'symbol') ? Symbol.toStringTag : null; -var isEnumerable = Object.prototype.propertyIsEnumerable; -var gPO = (typeof Reflect === 'function' ? Reflect.getPrototypeOf : Object.getPrototypeOf) || ([].__proto__ === Array.prototype // eslint-disable-line no-proto -? function (O) { - return O.__proto__; // eslint-disable-line no-proto -} : null); - -function addNumericSeparator(num, str) { - if (num === Infinity || num === -Infinity || num !== num || num && num > -1000 && num < 1000 || $test.call(/e/, str)) { - return str; - } - - var sepRegex = /[0-9](?=(?:[0-9]{3})+(?![0-9]))/g; - - if (typeof num === 'number') { - var int = num < 0 ? -$floor(-num) : $floor(num); // trunc(num) - - if (int !== num) { - var intStr = String(int); - var dec = $slice.call(str, intStr.length + 1); - return $replace.call(intStr, sepRegex, '$&_') + '.' + $replace.call($replace.call(dec, /([0-9]{3})/g, '$&_'), /_$/, ''); - } - } - - return $replace.call(str, sepRegex, '$&_'); -} - -var inspectCustom = __webpack_require__(/*! ./util.inspect */ "./node_modules/object-inspect/util.inspect.js").custom; - -var inspectSymbol = inspectCustom && isSymbol(inspectCustom) ? inspectCustom : null; - -module.exports = function inspect_(obj, options, depth, seen) { - var opts = options || {}; - - if (has(opts, 'quoteStyle') && opts.quoteStyle !== 'single' && opts.quoteStyle !== 'double') { - throw new TypeError('option "quoteStyle" must be "single" or "double"'); - } - - if (has(opts, 'maxStringLength') && (typeof opts.maxStringLength === 'number' ? opts.maxStringLength < 0 && opts.maxStringLength !== Infinity : opts.maxStringLength !== null)) { - throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`'); - } - - var customInspect = has(opts, 'customInspect') ? opts.customInspect : true; - - if (typeof customInspect !== 'boolean' && customInspect !== 'symbol') { - throw new TypeError('option "customInspect", if provided, must be `true`, `false`, or `\'symbol\'`'); - } - - if (has(opts, 'indent') && opts.indent !== null && opts.indent !== '\t' && !(parseInt(opts.indent, 10) === opts.indent && opts.indent > 0)) { - throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`'); - } - - if (has(opts, 'numericSeparator') && typeof opts.numericSeparator !== 'boolean') { - throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`'); - } - - var numericSeparator = opts.numericSeparator; - - if (typeof obj === 'undefined') { - return 'undefined'; - } - - if (obj === null) { - return 'null'; - } - - if (typeof obj === 'boolean') { - return obj ? 'true' : 'false'; - } - - if (typeof obj === 'string') { - return inspectString(obj, opts); - } - - if (typeof obj === 'number') { - if (obj === 0) { - return Infinity / obj > 0 ? '0' : '-0'; - } - - var str = String(obj); - return numericSeparator ? addNumericSeparator(obj, str) : str; - } - - if (typeof obj === 'bigint') { - var bigIntStr = String(obj) + 'n'; - return numericSeparator ? addNumericSeparator(obj, bigIntStr) : bigIntStr; - } - - var maxDepth = typeof opts.depth === 'undefined' ? 5 : opts.depth; - - if (typeof depth === 'undefined') { - depth = 0; - } - - if (depth >= maxDepth && maxDepth > 0 && typeof obj === 'object') { - return isArray(obj) ? '[Array]' : '[Object]'; - } - - var indent = getIndent(opts, depth); - - if (typeof seen === 'undefined') { - seen = []; - } else if (indexOf(seen, obj) >= 0) { - return '[Circular]'; - } - - function inspect(value, from, noIndent) { - if (from) { - seen = $arrSlice.call(seen); - seen.push(from); - } - - if (noIndent) { - var newOpts = { - depth: opts.depth - }; - - if (has(opts, 'quoteStyle')) { - newOpts.quoteStyle = opts.quoteStyle; - } - - return inspect_(value, newOpts, depth + 1, seen); - } - - return inspect_(value, opts, depth + 1, seen); - } - - if (typeof obj === 'function') { - var name = nameOf(obj); - var keys = arrObjKeys(obj, inspect); - return '[Function' + (name ? ': ' + name : ' (anonymous)') + ']' + (keys.length > 0 ? ' { ' + $join.call(keys, ', ') + ' }' : ''); - } - - if (isSymbol(obj)) { - var symString = hasShammedSymbols ? $replace.call(String(obj), /^(Symbol\(.*\))_[^)]*$/, '$1') : symToString.call(obj); - return typeof obj === 'object' && !hasShammedSymbols ? markBoxed(symString) : symString; - } - - if (isElement(obj)) { - var s = '<' + $toLowerCase.call(String(obj.nodeName)); - var attrs = obj.attributes || []; - - for (var i = 0; i < attrs.length; i++) { - s += ' ' + attrs[i].name + '=' + wrapQuotes(quote(attrs[i].value), 'double', opts); - } - - s += '>'; - - if (obj.childNodes && obj.childNodes.length) { - s += '...'; - } - - s += '</' + $toLowerCase.call(String(obj.nodeName)) + '>'; - return s; - } - - if (isArray(obj)) { - if (obj.length === 0) { - return '[]'; - } - - var xs = arrObjKeys(obj, inspect); - - if (indent && !singleLineValues(xs)) { - return '[' + indentedJoin(xs, indent) + ']'; - } - - return '[ ' + $join.call(xs, ', ') + ' ]'; - } - - if (isError(obj)) { - var parts = arrObjKeys(obj, inspect); - - if ('cause' in obj && !isEnumerable.call(obj, 'cause')) { - return '{ [' + String(obj) + '] ' + $join.call($concat.call('[cause]: ' + inspect(obj.cause), parts), ', ') + ' }'; - } - - if (parts.length === 0) { - return '[' + String(obj) + ']'; - } - - return '{ [' + String(obj) + '] ' + $join.call(parts, ', ') + ' }'; - } - - if (typeof obj === 'object' && customInspect) { - if (inspectSymbol && typeof obj[inspectSymbol] === 'function') { - return obj[inspectSymbol](); - } else if (customInspect !== 'symbol' && typeof obj.inspect === 'function') { - return obj.inspect(); - } - } - - if (isMap(obj)) { - var mapParts = []; - mapForEach.call(obj, function (value, key) { - mapParts.push(inspect(key, obj, true) + ' => ' + inspect(value, obj)); - }); - return collectionOf('Map', mapSize.call(obj), mapParts, indent); - } - - if (isSet(obj)) { - var setParts = []; - setForEach.call(obj, function (value) { - setParts.push(inspect(value, obj)); - }); - return collectionOf('Set', setSize.call(obj), setParts, indent); - } - - if (isWeakMap(obj)) { - return weakCollectionOf('WeakMap'); - } - - if (isWeakSet(obj)) { - return weakCollectionOf('WeakSet'); - } - - if (isWeakRef(obj)) { - return weakCollectionOf('WeakRef'); - } - - if (isNumber(obj)) { - return markBoxed(inspect(Number(obj))); - } - - if (isBigInt(obj)) { - return markBoxed(inspect(bigIntValueOf.call(obj))); - } - - if (isBoolean(obj)) { - return markBoxed(booleanValueOf.call(obj)); - } - - if (isString(obj)) { - return markBoxed(inspect(String(obj))); - } - - if (!isDate(obj) && !isRegExp(obj)) { - var ys = arrObjKeys(obj, inspect); - var isPlainObject = gPO ? gPO(obj) === Object.prototype : obj instanceof Object || obj.constructor === Object; - var protoTag = obj instanceof Object ? '' : 'null prototype'; - var stringTag = !isPlainObject && toStringTag && Object(obj) === obj && toStringTag in obj ? $slice.call(toStr(obj), 8, -1) : protoTag ? 'Object' : ''; - var constructorTag = isPlainObject || typeof obj.constructor !== 'function' ? '' : obj.constructor.name ? obj.constructor.name + ' ' : ''; - var tag = constructorTag + (stringTag || protoTag ? '[' + $join.call($concat.call([], stringTag || [], protoTag || []), ': ') + '] ' : ''); - - if (ys.length === 0) { - return tag + '{}'; - } - - if (indent) { - return tag + '{' + indentedJoin(ys, indent) + '}'; - } - - return tag + '{ ' + $join.call(ys, ', ') + ' }'; - } - - return String(obj); -}; - -function wrapQuotes(s, defaultStyle, opts) { - var quoteChar = (opts.quoteStyle || defaultStyle) === 'double' ? '"' : "'"; - return quoteChar + s + quoteChar; -} - -function quote(s) { - return $replace.call(String(s), /"/g, '"'); -} - -function isArray(obj) { - return toStr(obj) === '[object Array]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); -} - -function isDate(obj) { - return toStr(obj) === '[object Date]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); -} - -function isRegExp(obj) { - return toStr(obj) === '[object RegExp]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); -} - -function isError(obj) { - return toStr(obj) === '[object Error]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); -} - -function isString(obj) { - return toStr(obj) === '[object String]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); -} - -function isNumber(obj) { - return toStr(obj) === '[object Number]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); -} - -function isBoolean(obj) { - return toStr(obj) === '[object Boolean]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); -} // Symbol and BigInt do have Symbol.toStringTag by spec, so that can't be used to eliminate false positives - - -function isSymbol(obj) { - if (hasShammedSymbols) { - return obj && typeof obj === 'object' && obj instanceof Symbol; - } - - if (typeof obj === 'symbol') { - return true; - } - - if (!obj || typeof obj !== 'object' || !symToString) { - return false; - } - - try { - symToString.call(obj); - return true; - } catch (e) {} - - return false; -} - -function isBigInt(obj) { - if (!obj || typeof obj !== 'object' || !bigIntValueOf) { - return false; - } - - try { - bigIntValueOf.call(obj); - return true; - } catch (e) {} - - return false; -} - -var hasOwn = Object.prototype.hasOwnProperty || function (key) { - return key in this; -}; - -function has(obj, key) { - return hasOwn.call(obj, key); -} - -function toStr(obj) { - return objectToString.call(obj); -} - -function nameOf(f) { - if (f.name) { - return f.name; - } - - var m = $match.call(functionToString.call(f), /^function\s*([\w$]+)/); - - if (m) { - return m[1]; - } - - return null; -} - -function indexOf(xs, x) { - if (xs.indexOf) { - return xs.indexOf(x); - } - - for (var i = 0, l = xs.length; i < l; i++) { - if (xs[i] === x) { - return i; - } - } - - return -1; -} - -function isMap(x) { - if (!mapSize || !x || typeof x !== 'object') { - return false; - } - - try { - mapSize.call(x); - - try { - setSize.call(x); - } catch (s) { - return true; - } - - return x instanceof Map; // core-js workaround, pre-v2.5.0 - } catch (e) {} - - return false; -} - -function isWeakMap(x) { - if (!weakMapHas || !x || typeof x !== 'object') { - return false; - } - - try { - weakMapHas.call(x, weakMapHas); - - try { - weakSetHas.call(x, weakSetHas); - } catch (s) { - return true; - } - - return x instanceof WeakMap; // core-js workaround, pre-v2.5.0 - } catch (e) {} - - return false; -} - -function isWeakRef(x) { - if (!weakRefDeref || !x || typeof x !== 'object') { - return false; - } - - try { - weakRefDeref.call(x); - return true; - } catch (e) {} - - return false; -} - -function isSet(x) { - if (!setSize || !x || typeof x !== 'object') { - return false; - } - - try { - setSize.call(x); - - try { - mapSize.call(x); - } catch (m) { - return true; - } - - return x instanceof Set; // core-js workaround, pre-v2.5.0 - } catch (e) {} - - return false; -} - -function isWeakSet(x) { - if (!weakSetHas || !x || typeof x !== 'object') { - return false; - } - - try { - weakSetHas.call(x, weakSetHas); - - try { - weakMapHas.call(x, weakMapHas); - } catch (s) { - return true; - } - - return x instanceof WeakSet; // core-js workaround, pre-v2.5.0 - } catch (e) {} - - return false; -} - -function isElement(x) { - if (!x || typeof x !== 'object') { - return false; - } - - if (typeof HTMLElement !== 'undefined' && x instanceof HTMLElement) { - return true; - } - - return typeof x.nodeName === 'string' && typeof x.getAttribute === 'function'; -} - -function inspectString(str, opts) { - if (str.length > opts.maxStringLength) { - var remaining = str.length - opts.maxStringLength; - var trailer = '... ' + remaining + ' more character' + (remaining > 1 ? 's' : ''); - return inspectString($slice.call(str, 0, opts.maxStringLength), opts) + trailer; - } // eslint-disable-next-line no-control-regex - - - var s = $replace.call($replace.call(str, /(['\\])/g, '\\$1'), /[\x00-\x1f]/g, lowbyte); - return wrapQuotes(s, 'single', opts); -} - -function lowbyte(c) { - var n = c.charCodeAt(0); - var x = { - 8: 'b', - 9: 't', - 10: 'n', - 12: 'f', - 13: 'r' - }[n]; - - if (x) { - return '\\' + x; - } - - return '\\x' + (n < 0x10 ? '0' : '') + $toUpperCase.call(n.toString(16)); -} - -function markBoxed(str) { - return 'Object(' + str + ')'; -} - -function weakCollectionOf(type) { - return type + ' { ? }'; -} - -function collectionOf(type, size, entries, indent) { - var joinedEntries = indent ? indentedJoin(entries, indent) : $join.call(entries, ', '); - return type + ' (' + size + ') {' + joinedEntries + '}'; -} - -function singleLineValues(xs) { - for (var i = 0; i < xs.length; i++) { - if (indexOf(xs[i], '\n') >= 0) { - return false; - } - } - - return true; -} - -function getIndent(opts, depth) { - var baseIndent; - - if (opts.indent === '\t') { - baseIndent = '\t'; - } else if (typeof opts.indent === 'number' && opts.indent > 0) { - baseIndent = $join.call(Array(opts.indent + 1), ' '); - } else { - return null; - } - - return { - base: baseIndent, - prev: $join.call(Array(depth + 1), baseIndent) - }; -} - -function indentedJoin(xs, indent) { - if (xs.length === 0) { - return ''; - } - - var lineJoiner = '\n' + indent.prev + indent.base; - return lineJoiner + $join.call(xs, ',' + lineJoiner) + '\n' + indent.prev; -} - -function arrObjKeys(obj, inspect) { - var isArr = isArray(obj); - var xs = []; - - if (isArr) { - xs.length = obj.length; - - for (var i = 0; i < obj.length; i++) { - xs[i] = has(obj, i) ? inspect(obj[i], obj) : ''; - } - } - - var syms = typeof gOPS === 'function' ? gOPS(obj) : []; - var symMap; - - if (hasShammedSymbols) { - symMap = {}; - - for (var k = 0; k < syms.length; k++) { - symMap['$' + syms[k]] = syms[k]; - } - } - - for (var key in obj) { - // eslint-disable-line no-restricted-syntax - if (!has(obj, key)) { - continue; - } // eslint-disable-line no-restricted-syntax, no-continue - - - if (isArr && String(Number(key)) === key && key < obj.length) { - continue; - } // eslint-disable-line no-restricted-syntax, no-continue - - - if (hasShammedSymbols && symMap['$' + key] instanceof Symbol) { - // this is to prevent shammed Symbols, which are stored as strings, from being included in the string key section - continue; // eslint-disable-line no-restricted-syntax, no-continue - } else if ($test.call(/[^\w$]/, key)) { - xs.push(inspect(key, obj) + ': ' + inspect(obj[key], obj)); - } else { - xs.push(key + ': ' + inspect(obj[key], obj)); - } - } - - if (typeof gOPS === 'function') { - for (var j = 0; j < syms.length; j++) { - if (isEnumerable.call(obj, syms[j])) { - xs.push('[' + inspect(syms[j]) + ']: ' + inspect(obj[syms[j]], obj)); - } - } - } - - return xs; -} - -/***/ }), - -/***/ "./node_modules/object-inspect/util.inspect.js": -/*!*****************************************************!*\ - !*** ./node_modules/object-inspect/util.inspect.js ***! - \*****************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -module.exports = __webpack_require__(/*! util */ "util").inspect; - -/***/ }), - -/***/ "./node_modules/object-is/implementation.js": -/*!**************************************************!*\ - !*** ./node_modules/object-is/implementation.js ***! - \**************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var numberIsNaN = function (value) { - return value !== value; -}; - -module.exports = function is(a, b) { - if (a === 0 && b === 0) { - return 1 / a === 1 / b; - } - - if (a === b) { - return true; - } - - if (numberIsNaN(a) && numberIsNaN(b)) { - return true; - } - - return false; -}; - -/***/ }), - -/***/ "./node_modules/object-is/index.js": -/*!*****************************************!*\ - !*** ./node_modules/object-is/index.js ***! - \*****************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var define = __webpack_require__(/*! define-properties */ "./node_modules/define-properties/index.js"); - -var callBind = __webpack_require__(/*! call-bind */ "./node_modules/call-bind/index.js"); - -var implementation = __webpack_require__(/*! ./implementation */ "./node_modules/object-is/implementation.js"); - -var getPolyfill = __webpack_require__(/*! ./polyfill */ "./node_modules/object-is/polyfill.js"); - -var shim = __webpack_require__(/*! ./shim */ "./node_modules/object-is/shim.js"); - -var polyfill = callBind(getPolyfill(), Object); -define(polyfill, { - getPolyfill: getPolyfill, - implementation: implementation, - shim: shim -}); -module.exports = polyfill; - -/***/ }), - -/***/ "./node_modules/object-is/polyfill.js": -/*!********************************************!*\ - !*** ./node_modules/object-is/polyfill.js ***! - \********************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var implementation = __webpack_require__(/*! ./implementation */ "./node_modules/object-is/implementation.js"); - -module.exports = function getPolyfill() { - return typeof Object.is === 'function' ? Object.is : implementation; -}; - -/***/ }), - -/***/ "./node_modules/object-is/shim.js": -/*!****************************************!*\ - !*** ./node_modules/object-is/shim.js ***! - \****************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var getPolyfill = __webpack_require__(/*! ./polyfill */ "./node_modules/object-is/polyfill.js"); - -var define = __webpack_require__(/*! define-properties */ "./node_modules/define-properties/index.js"); - -module.exports = function shimObjectIs() { - var polyfill = getPolyfill(); - define(Object, { - is: polyfill - }, { - is: function testObjectIs() { - return Object.is !== polyfill; - } - }); - return polyfill; -}; - -/***/ }), - -/***/ "./node_modules/object-keys/implementation.js": -/*!****************************************************!*\ - !*** ./node_modules/object-keys/implementation.js ***! - \****************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var keysShim; - -if (!Object.keys) { - // modified from https://github.com/es-shims/es5-shim - var has = Object.prototype.hasOwnProperty; - var toStr = Object.prototype.toString; - - var isArgs = __webpack_require__(/*! ./isArguments */ "./node_modules/object-keys/isArguments.js"); // eslint-disable-line global-require - - - var isEnumerable = Object.prototype.propertyIsEnumerable; - var hasDontEnumBug = !isEnumerable.call({ - toString: null - }, 'toString'); - var hasProtoEnumBug = isEnumerable.call(function () {}, 'prototype'); - var dontEnums = ['toString', 'toLocaleString', 'valueOf', 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable', 'constructor']; - - var equalsConstructorPrototype = function (o) { - var ctor = o.constructor; - return ctor && ctor.prototype === o; - }; - - var excludedKeys = { - $applicationCache: true, - $console: true, - $external: true, - $frame: true, - $frameElement: true, - $frames: true, - $innerHeight: true, - $innerWidth: true, - $onmozfullscreenchange: true, - $onmozfullscreenerror: true, - $outerHeight: true, - $outerWidth: true, - $pageXOffset: true, - $pageYOffset: true, - $parent: true, - $scrollLeft: true, - $scrollTop: true, - $scrollX: true, - $scrollY: true, - $self: true, - $webkitIndexedDB: true, - $webkitStorageInfo: true, - $window: true - }; - - var hasAutomationEqualityBug = function () { - /* global window */ - if (typeof window === 'undefined') { - return false; - } - - for (var k in window) { - try { - if (!excludedKeys['$' + k] && has.call(window, k) && window[k] !== null && typeof window[k] === 'object') { - try { - equalsConstructorPrototype(window[k]); - } catch (e) { - return true; - } - } - } catch (e) { - return true; - } - } - - return false; - }(); - - var equalsConstructorPrototypeIfNotBuggy = function (o) { - /* global window */ - if (typeof window === 'undefined' || !hasAutomationEqualityBug) { - return equalsConstructorPrototype(o); - } - - try { - return equalsConstructorPrototype(o); - } catch (e) { - return false; - } - }; - - keysShim = function keys(object) { - var isObject = object !== null && typeof object === 'object'; - var isFunction = toStr.call(object) === '[object Function]'; - var isArguments = isArgs(object); - var isString = isObject && toStr.call(object) === '[object String]'; - var theKeys = []; - - if (!isObject && !isFunction && !isArguments) { - throw new TypeError('Object.keys called on a non-object'); - } - - var skipProto = hasProtoEnumBug && isFunction; - - if (isString && object.length > 0 && !has.call(object, 0)) { - for (var i = 0; i < object.length; ++i) { - theKeys.push(String(i)); - } - } - - if (isArguments && object.length > 0) { - for (var j = 0; j < object.length; ++j) { - theKeys.push(String(j)); - } - } else { - for (var name in object) { - if (!(skipProto && name === 'prototype') && has.call(object, name)) { - theKeys.push(String(name)); - } - } - } - - if (hasDontEnumBug) { - var skipConstructor = equalsConstructorPrototypeIfNotBuggy(object); - - for (var k = 0; k < dontEnums.length; ++k) { - if (!(skipConstructor && dontEnums[k] === 'constructor') && has.call(object, dontEnums[k])) { - theKeys.push(dontEnums[k]); - } - } - } - - return theKeys; - }; -} - -module.exports = keysShim; - -/***/ }), - -/***/ "./node_modules/object-keys/index.js": -/*!*******************************************!*\ - !*** ./node_modules/object-keys/index.js ***! - \*******************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var slice = Array.prototype.slice; - -var isArgs = __webpack_require__(/*! ./isArguments */ "./node_modules/object-keys/isArguments.js"); - -var origKeys = Object.keys; -var keysShim = origKeys ? function keys(o) { - return origKeys(o); -} : __webpack_require__(/*! ./implementation */ "./node_modules/object-keys/implementation.js"); -var originalKeys = Object.keys; - -keysShim.shim = function shimObjectKeys() { - if (Object.keys) { - var keysWorksWithArguments = function () { - // Safari 5.0 bug - var args = Object.keys(arguments); - return args && args.length === arguments.length; - }(1, 2); - - if (!keysWorksWithArguments) { - Object.keys = function keys(object) { - // eslint-disable-line func-name-matching - if (isArgs(object)) { - return originalKeys(slice.call(object)); - } - - return originalKeys(object); - }; - } - } else { - Object.keys = keysShim; - } - - return Object.keys || keysShim; -}; - -module.exports = keysShim; - -/***/ }), - -/***/ "./node_modules/object-keys/isArguments.js": -/*!*************************************************!*\ - !*** ./node_modules/object-keys/isArguments.js ***! - \*************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var toStr = Object.prototype.toString; - -module.exports = function isArguments(value) { - var str = toStr.call(value); - var isArgs = str === '[object Arguments]'; - - if (!isArgs) { - isArgs = str !== '[object Array]' && value !== null && typeof value === 'object' && typeof value.length === 'number' && value.length >= 0 && toStr.call(value.callee) === '[object Function]'; - } - - return isArgs; -}; - -/***/ }), - -/***/ "./node_modules/object.assign/implementation.js": -/*!******************************************************!*\ - !*** ./node_modules/object.assign/implementation.js ***! - \******************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - // modified from https://github.com/es-shims/es6-shim - -var keys = __webpack_require__(/*! object-keys */ "./node_modules/object-keys/index.js"); - -var canBeObject = function (obj) { - return typeof obj !== 'undefined' && obj !== null; -}; - -var hasSymbols = __webpack_require__(/*! has-symbols/shams */ "./node_modules/has-symbols/shams.js")(); - -var callBound = __webpack_require__(/*! call-bind/callBound */ "./node_modules/call-bind/callBound.js"); - -var toObject = Object; -var $push = callBound('Array.prototype.push'); -var $propIsEnumerable = callBound('Object.prototype.propertyIsEnumerable'); -var originalGetSymbols = hasSymbols ? Object.getOwnPropertySymbols : null; // eslint-disable-next-line no-unused-vars - -module.exports = function assign(target, source1) { - if (!canBeObject(target)) { - throw new TypeError('target must be an object'); - } - - var objTarget = toObject(target); - var s, source, i, props, syms, value, key; - - for (s = 1; s < arguments.length; ++s) { - source = toObject(arguments[s]); - props = keys(source); - var getSymbols = hasSymbols && (Object.getOwnPropertySymbols || originalGetSymbols); - - if (getSymbols) { - syms = getSymbols(source); - - for (i = 0; i < syms.length; ++i) { - key = syms[i]; - - if ($propIsEnumerable(source, key)) { - $push(props, key); - } - } - } - - for (i = 0; i < props.length; ++i) { - key = props[i]; - value = source[key]; - - if ($propIsEnumerable(source, key)) { - objTarget[key] = value; - } - } - } - - return objTarget; -}; - -/***/ }), - -/***/ "./node_modules/object.assign/index.js": -/*!*********************************************!*\ - !*** ./node_modules/object.assign/index.js ***! - \*********************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var defineProperties = __webpack_require__(/*! define-properties */ "./node_modules/define-properties/index.js"); - -var callBind = __webpack_require__(/*! call-bind */ "./node_modules/call-bind/index.js"); - -var implementation = __webpack_require__(/*! ./implementation */ "./node_modules/object.assign/implementation.js"); - -var getPolyfill = __webpack_require__(/*! ./polyfill */ "./node_modules/object.assign/polyfill.js"); - -var shim = __webpack_require__(/*! ./shim */ "./node_modules/object.assign/shim.js"); - -var polyfill = callBind.apply(getPolyfill()); // eslint-disable-next-line no-unused-vars - -var bound = function assign(target, source1) { - return polyfill(Object, arguments); -}; - -defineProperties(bound, { - getPolyfill: getPolyfill, - implementation: implementation, - shim: shim -}); -module.exports = bound; - -/***/ }), - -/***/ "./node_modules/object.assign/polyfill.js": -/*!************************************************!*\ - !*** ./node_modules/object.assign/polyfill.js ***! - \************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var implementation = __webpack_require__(/*! ./implementation */ "./node_modules/object.assign/implementation.js"); - -var lacksProperEnumerationOrder = function () { - if (!Object.assign) { - return false; - } - /* - * v8, specifically in node 4.x, has a bug with incorrect property enumeration order - * note: this does not detect the bug unless there's 20 characters - */ - - - var str = 'abcdefghijklmnopqrst'; - var letters = str.split(''); - var map = {}; - - for (var i = 0; i < letters.length; ++i) { - map[letters[i]] = letters[i]; - } - - var obj = Object.assign({}, map); - var actual = ''; - - for (var k in obj) { - actual += k; - } - - return str !== actual; -}; - -var assignHasPendingExceptions = function () { - if (!Object.assign || !Object.preventExtensions) { - return false; - } - /* - * Firefox 37 still has "pending exception" logic in its Object.assign implementation, - * which is 72% slower than our shim, and Firefox 40's native implementation. - */ - - - var thrower = Object.preventExtensions({ - 1: 2 - }); - - try { - Object.assign(thrower, 'xy'); - } catch (e) { - return thrower[1] === 'y'; - } - - return false; -}; - -module.exports = function getPolyfill() { - if (!Object.assign) { - return implementation; - } - - if (lacksProperEnumerationOrder()) { - return implementation; - } - - if (assignHasPendingExceptions()) { - return implementation; - } - - return Object.assign; -}; - -/***/ }), - -/***/ "./node_modules/object.assign/shim.js": -/*!********************************************!*\ - !*** ./node_modules/object.assign/shim.js ***! - \********************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var define = __webpack_require__(/*! define-properties */ "./node_modules/define-properties/index.js"); - -var getPolyfill = __webpack_require__(/*! ./polyfill */ "./node_modules/object.assign/polyfill.js"); - -module.exports = function shimAssign() { - var polyfill = getPolyfill(); - define(Object, { - assign: polyfill - }, { - assign: function () { - return Object.assign !== polyfill; - } - }); - return polyfill; -}; - -/***/ }), - -/***/ "./node_modules/regexp.prototype.flags/implementation.js": -/*!***************************************************************!*\ - !*** ./node_modules/regexp.prototype.flags/implementation.js ***! - \***************************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var $Object = Object; -var $TypeError = TypeError; - -module.exports = function flags() { - if (this != null && this !== $Object(this)) { - throw new $TypeError('RegExp.prototype.flags getter called on non-object'); - } - - var result = ''; - - if (this.hasIndices) { - result += 'd'; - } - - if (this.global) { - result += 'g'; - } - - if (this.ignoreCase) { - result += 'i'; - } - - if (this.multiline) { - result += 'm'; - } - - if (this.dotAll) { - result += 's'; - } - - if (this.unicode) { - result += 'u'; - } - - if (this.sticky) { - result += 'y'; - } - - return result; -}; - -/***/ }), - -/***/ "./node_modules/regexp.prototype.flags/index.js": -/*!******************************************************!*\ - !*** ./node_modules/regexp.prototype.flags/index.js ***! - \******************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var define = __webpack_require__(/*! define-properties */ "./node_modules/define-properties/index.js"); - -var callBind = __webpack_require__(/*! call-bind */ "./node_modules/call-bind/index.js"); - -var implementation = __webpack_require__(/*! ./implementation */ "./node_modules/regexp.prototype.flags/implementation.js"); - -var getPolyfill = __webpack_require__(/*! ./polyfill */ "./node_modules/regexp.prototype.flags/polyfill.js"); - -var shim = __webpack_require__(/*! ./shim */ "./node_modules/regexp.prototype.flags/shim.js"); - -var flagsBound = callBind(getPolyfill()); -define(flagsBound, { - getPolyfill: getPolyfill, - implementation: implementation, - shim: shim -}); -module.exports = flagsBound; - -/***/ }), - -/***/ "./node_modules/regexp.prototype.flags/polyfill.js": -/*!*********************************************************!*\ - !*** ./node_modules/regexp.prototype.flags/polyfill.js ***! - \*********************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var implementation = __webpack_require__(/*! ./implementation */ "./node_modules/regexp.prototype.flags/implementation.js"); - -var supportsDescriptors = __webpack_require__(/*! define-properties */ "./node_modules/define-properties/index.js").supportsDescriptors; - -var $gOPD = Object.getOwnPropertyDescriptor; - -module.exports = function getPolyfill() { - if (supportsDescriptors && /a/mig.flags === 'gim') { - var descriptor = $gOPD(RegExp.prototype, 'flags'); - - if (descriptor && typeof descriptor.get === 'function' && typeof /a/.dotAll === 'boolean') { - return descriptor.get; - } - } - - return implementation; -}; - -/***/ }), - -/***/ "./node_modules/regexp.prototype.flags/shim.js": -/*!*****************************************************!*\ - !*** ./node_modules/regexp.prototype.flags/shim.js ***! - \*****************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var supportsDescriptors = __webpack_require__(/*! define-properties */ "./node_modules/define-properties/index.js").supportsDescriptors; - -var getPolyfill = __webpack_require__(/*! ./polyfill */ "./node_modules/regexp.prototype.flags/polyfill.js"); - -var gOPD = Object.getOwnPropertyDescriptor; -var defineProperty = Object.defineProperty; -var TypeErr = TypeError; -var getProto = Object.getPrototypeOf; -var regex = /a/; - -module.exports = function shimFlags() { - if (!supportsDescriptors || !getProto) { - throw new TypeErr('RegExp.prototype.flags requires a true ES5 environment that supports property descriptors'); - } - - var polyfill = getPolyfill(); - var proto = getProto(regex); - var descriptor = gOPD(proto, 'flags'); - - if (!descriptor || descriptor.get !== polyfill) { - defineProperty(proto, 'flags', { - configurable: true, - enumerable: false, - get: polyfill - }); - } - - return polyfill; -}; - -/***/ }), - -/***/ "./node_modules/side-channel/index.js": -/*!********************************************!*\ - !*** ./node_modules/side-channel/index.js ***! - \********************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var GetIntrinsic = __webpack_require__(/*! get-intrinsic */ "./node_modules/get-intrinsic/index.js"); - -var callBound = __webpack_require__(/*! call-bind/callBound */ "./node_modules/call-bind/callBound.js"); - -var inspect = __webpack_require__(/*! object-inspect */ "./node_modules/object-inspect/index.js"); - -var $TypeError = GetIntrinsic('%TypeError%'); -var $WeakMap = GetIntrinsic('%WeakMap%', true); -var $Map = GetIntrinsic('%Map%', true); -var $weakMapGet = callBound('WeakMap.prototype.get', true); -var $weakMapSet = callBound('WeakMap.prototype.set', true); -var $weakMapHas = callBound('WeakMap.prototype.has', true); -var $mapGet = callBound('Map.prototype.get', true); -var $mapSet = callBound('Map.prototype.set', true); -var $mapHas = callBound('Map.prototype.has', true); -/* - * This function traverses the list returning the node corresponding to the - * given key. - * - * That node is also moved to the head of the list, so that if it's accessed - * again we don't need to traverse the whole list. By doing so, all the recently - * used nodes can be accessed relatively quickly. - */ - -var listGetNode = function (list, key) { - // eslint-disable-line consistent-return - for (var prev = list, curr; (curr = prev.next) !== null; prev = curr) { - if (curr.key === key) { - prev.next = curr.next; - curr.next = list.next; - list.next = curr; // eslint-disable-line no-param-reassign - - return curr; - } - } -}; - -var listGet = function (objects, key) { - var node = listGetNode(objects, key); - return node && node.value; -}; - -var listSet = function (objects, key, value) { - var node = listGetNode(objects, key); - - if (node) { - node.value = value; - } else { - // Prepend the new node to the beginning of the list - objects.next = { - // eslint-disable-line no-param-reassign - key: key, - next: objects.next, - value: value - }; - } -}; - -var listHas = function (objects, key) { - return !!listGetNode(objects, key); -}; - -module.exports = function getSideChannel() { - var $wm; - var $m; - var $o; - var channel = { - assert: function (key) { - if (!channel.has(key)) { - throw new $TypeError('Side channel does not contain ' + inspect(key)); - } - }, - get: function (key) { - // eslint-disable-line consistent-return - if ($WeakMap && key && (typeof key === 'object' || typeof key === 'function')) { - if ($wm) { - return $weakMapGet($wm, key); - } - } else if ($Map) { - if ($m) { - return $mapGet($m, key); - } - } else { - if ($o) { - // eslint-disable-line no-lonely-if - return listGet($o, key); - } - } - }, - has: function (key) { - if ($WeakMap && key && (typeof key === 'object' || typeof key === 'function')) { - if ($wm) { - return $weakMapHas($wm, key); - } - } else if ($Map) { - if ($m) { - return $mapHas($m, key); - } - } else { - if ($o) { - // eslint-disable-line no-lonely-if - return listHas($o, key); - } - } - - return false; - }, - set: function (key, value) { - if ($WeakMap && key && (typeof key === 'object' || typeof key === 'function')) { - if (!$wm) { - $wm = new $WeakMap(); - } - - $weakMapSet($wm, key, value); - } else if ($Map) { - if (!$m) { - $m = new $Map(); - } - - $mapSet($m, key, value); - } else { - if (!$o) { - /* - * Initialize the linked list as an empty node, so that we don't have - * to special-case handling of the first node: we can always refer to - * it as (previous node).next, instead of something like (list).head - */ - $o = { - key: {}, - next: null - }; - } - - listSet($o, key, value); - } - } - }; - return channel; -}; - -/***/ }), - -/***/ "./node_modules/slash/index.js": -/*!*************************************!*\ - !*** ./node_modules/slash/index.js ***! - \*************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -module.exports = path => { - const isExtendedLengthPath = /^\\\\\?\\/.test(path); - const hasNonAscii = /[^\u0000-\u0080]+/.test(path); // eslint-disable-line no-control-regex - - if (isExtendedLengthPath || hasNonAscii) { - return path; - } - - return path.replace(/\\/g, '/'); -}; - -/***/ }), - -/***/ "./node_modules/uuid/index.js": -/*!************************************!*\ - !*** ./node_modules/uuid/index.js ***! - \************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -var v1 = __webpack_require__(/*! ./v1 */ "./node_modules/uuid/v1.js"); - -var v4 = __webpack_require__(/*! ./v4 */ "./node_modules/uuid/v4.js"); - -var uuid = v4; -uuid.v1 = v1; -uuid.v4 = v4; -module.exports = uuid; - -/***/ }), - -/***/ "./node_modules/uuid/lib/bytesToUuid.js": -/*!**********************************************!*\ - !*** ./node_modules/uuid/lib/bytesToUuid.js ***! - \**********************************************/ -/*! no static exports found */ -/***/ (function(module, exports) { - -/** - * Convert array of 16 byte values to UUID string format of the form: - * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX - */ -var byteToHex = []; - -for (var i = 0; i < 256; ++i) { - byteToHex[i] = (i + 0x100).toString(16).substr(1); -} - -function bytesToUuid(buf, offset) { - var i = offset || 0; - var bth = byteToHex; // join used to fix memory issue caused by concatenation: https://bugs.chromium.org/p/v8/issues/detail?id=3175#c4 - - return [bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]]].join(''); -} - -module.exports = bytesToUuid; - -/***/ }), - -/***/ "./node_modules/uuid/lib/rng.js": -/*!**************************************!*\ - !*** ./node_modules/uuid/lib/rng.js ***! - \**************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -// Unique ID creation requires a high quality random # generator. In node.js -// this is pretty straight-forward - we use the crypto API. -var crypto = __webpack_require__(/*! crypto */ "crypto"); - -module.exports = function nodeRNG() { - return crypto.randomBytes(16); -}; - -/***/ }), - -/***/ "./node_modules/uuid/v1.js": -/*!*********************************!*\ - !*** ./node_modules/uuid/v1.js ***! - \*********************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -var rng = __webpack_require__(/*! ./lib/rng */ "./node_modules/uuid/lib/rng.js"); - -var bytesToUuid = __webpack_require__(/*! ./lib/bytesToUuid */ "./node_modules/uuid/lib/bytesToUuid.js"); // **`v1()` - Generate time-based UUID** -// -// Inspired by https://github.com/LiosK/UUID.js -// and http://docs.python.org/library/uuid.html - - -var _nodeId; - -var _clockseq; // Previous uuid creation time - - -var _lastMSecs = 0; -var _lastNSecs = 0; // See https://github.com/broofa/node-uuid for API details - -function v1(options, buf, offset) { - var i = buf && offset || 0; - var b = buf || []; - options = options || {}; - var node = options.node || _nodeId; - var clockseq = options.clockseq !== undefined ? options.clockseq : _clockseq; // node and clockseq need to be initialized to random values if they're not - // specified. We do this lazily to minimize issues related to insufficient - // system entropy. See #189 - - if (node == null || clockseq == null) { - var seedBytes = rng(); - - if (node == null) { - // Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1) - node = _nodeId = [seedBytes[0] | 0x01, seedBytes[1], seedBytes[2], seedBytes[3], seedBytes[4], seedBytes[5]]; - } - - if (clockseq == null) { - // Per 4.2.2, randomize (14 bit) clockseq - clockseq = _clockseq = (seedBytes[6] << 8 | seedBytes[7]) & 0x3fff; - } - } // UUID timestamps are 100 nano-second units since the Gregorian epoch, - // (1582-10-15 00:00). JSNumbers aren't precise enough for this, so - // time is handled internally as 'msecs' (integer milliseconds) and 'nsecs' - // (100-nanoseconds offset from msecs) since unix epoch, 1970-01-01 00:00. - - - var msecs = options.msecs !== undefined ? options.msecs : new Date().getTime(); // Per 4.2.1.2, use count of uuid's generated during the current clock - // cycle to simulate higher resolution clock - - var nsecs = options.nsecs !== undefined ? options.nsecs : _lastNSecs + 1; // Time since last uuid creation (in msecs) - - var dt = msecs - _lastMSecs + (nsecs - _lastNSecs) / 10000; // Per 4.2.1.2, Bump clockseq on clock regression - - if (dt < 0 && options.clockseq === undefined) { - clockseq = clockseq + 1 & 0x3fff; - } // Reset nsecs if clock regresses (new clockseq) or we've moved onto a new - // time interval - - - if ((dt < 0 || msecs > _lastMSecs) && options.nsecs === undefined) { - nsecs = 0; - } // Per 4.2.1.2 Throw error if too many uuids are requested - - - if (nsecs >= 10000) { - throw new Error('uuid.v1(): Can\'t create more than 10M uuids/sec'); - } - - _lastMSecs = msecs; - _lastNSecs = nsecs; - _clockseq = clockseq; // Per 4.1.4 - Convert from unix epoch to Gregorian epoch - - msecs += 12219292800000; // `time_low` - - var tl = ((msecs & 0xfffffff) * 10000 + nsecs) % 0x100000000; - b[i++] = tl >>> 24 & 0xff; - b[i++] = tl >>> 16 & 0xff; - b[i++] = tl >>> 8 & 0xff; - b[i++] = tl & 0xff; // `time_mid` - - var tmh = msecs / 0x100000000 * 10000 & 0xfffffff; - b[i++] = tmh >>> 8 & 0xff; - b[i++] = tmh & 0xff; // `time_high_and_version` - - b[i++] = tmh >>> 24 & 0xf | 0x10; // include version - - b[i++] = tmh >>> 16 & 0xff; // `clock_seq_hi_and_reserved` (Per 4.2.2 - include variant) - - b[i++] = clockseq >>> 8 | 0x80; // `clock_seq_low` - - b[i++] = clockseq & 0xff; // `node` - - for (var n = 0; n < 6; ++n) { - b[i + n] = node[n]; - } - - return buf ? buf : bytesToUuid(b); -} - -module.exports = v1; - -/***/ }), - -/***/ "./node_modules/uuid/v4.js": -/*!*********************************!*\ - !*** ./node_modules/uuid/v4.js ***! - \*********************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -var rng = __webpack_require__(/*! ./lib/rng */ "./node_modules/uuid/lib/rng.js"); - -var bytesToUuid = __webpack_require__(/*! ./lib/bytesToUuid */ "./node_modules/uuid/lib/bytesToUuid.js"); - -function v4(options, buf, offset) { - var i = buf && offset || 0; - - if (typeof options == 'string') { - buf = options === 'binary' ? new Array(16) : null; - options = null; - } - - options = options || {}; - var rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved` - - rnds[6] = rnds[6] & 0x0f | 0x40; - rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided - - if (buf) { - for (var ii = 0; ii < 16; ++ii) { - buf[i + ii] = rnds[ii]; - } - } - - return buf || bytesToUuid(rnds); -} - -module.exports = v4; - -/***/ }), - -/***/ "./node_modules/which-boxed-primitive/index.js": -/*!*****************************************************!*\ - !*** ./node_modules/which-boxed-primitive/index.js ***! - \*****************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var isString = __webpack_require__(/*! is-string */ "./node_modules/is-string/index.js"); - -var isNumber = __webpack_require__(/*! is-number-object */ "./node_modules/is-number-object/index.js"); - -var isBoolean = __webpack_require__(/*! is-boolean-object */ "./node_modules/is-boolean-object/index.js"); - -var isSymbol = __webpack_require__(/*! is-symbol */ "./node_modules/is-symbol/index.js"); - -var isBigInt = __webpack_require__(/*! is-bigint */ "./node_modules/is-bigint/index.js"); // eslint-disable-next-line consistent-return - - -module.exports = function whichBoxedPrimitive(value) { - // eslint-disable-next-line eqeqeq - if (value == null || typeof value !== 'object' && typeof value !== 'function') { - return null; - } - - if (isString(value)) { - return 'String'; - } - - if (isNumber(value)) { - return 'Number'; - } - - if (isBoolean(value)) { - return 'Boolean'; - } - - if (isSymbol(value)) { - return 'Symbol'; - } - - if (isBigInt(value)) { - return 'BigInt'; - } -}; - -/***/ }), - -/***/ "./node_modules/which-collection/index.js": -/*!************************************************!*\ - !*** ./node_modules/which-collection/index.js ***! - \************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var isMap = __webpack_require__(/*! is-map */ "./node_modules/is-map/index.js"); - -var isSet = __webpack_require__(/*! is-set */ "./node_modules/is-set/index.js"); - -var isWeakMap = __webpack_require__(/*! is-weakmap */ "./node_modules/is-weakmap/index.js"); - -var isWeakSet = __webpack_require__(/*! is-weakset */ "./node_modules/is-weakset/index.js"); - -module.exports = function whichCollection(value) { - if (value && typeof value === 'object') { - if (isMap(value)) { - return 'Map'; - } - - if (isSet(value)) { - return 'Set'; - } - - if (isWeakMap(value)) { - return 'WeakMap'; - } - - if (isWeakSet(value)) { - return 'WeakSet'; - } - } - - return false; -}; - -/***/ }), - -/***/ "./node_modules/which-typed-array/index.js": -/*!*************************************************!*\ - !*** ./node_modules/which-typed-array/index.js ***! - \*************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var forEach = __webpack_require__(/*! foreach */ "./node_modules/foreach/index.js"); - -var availableTypedArrays = __webpack_require__(/*! available-typed-arrays */ "./node_modules/available-typed-arrays/index.js"); - -var callBound = __webpack_require__(/*! call-bind/callBound */ "./node_modules/call-bind/callBound.js"); - -var $toString = callBound('Object.prototype.toString'); - -var hasToStringTag = __webpack_require__(/*! has-tostringtag/shams */ "./node_modules/has-tostringtag/shams.js")(); - -var g = typeof globalThis === 'undefined' ? global : globalThis; -var typedArrays = availableTypedArrays(); -var $slice = callBound('String.prototype.slice'); -var toStrTags = {}; - -var gOPD = __webpack_require__(/*! es-abstract/helpers/getOwnPropertyDescriptor */ "./node_modules/es-abstract/helpers/getOwnPropertyDescriptor.js"); - -var getPrototypeOf = Object.getPrototypeOf; // require('getprototypeof'); - -if (hasToStringTag && gOPD && getPrototypeOf) { - forEach(typedArrays, function (typedArray) { - if (typeof g[typedArray] === 'function') { - var arr = new g[typedArray](); - - if (Symbol.toStringTag in arr) { - var proto = getPrototypeOf(arr); - var descriptor = gOPD(proto, Symbol.toStringTag); - - if (!descriptor) { - var superProto = getPrototypeOf(proto); - descriptor = gOPD(superProto, Symbol.toStringTag); - } - - toStrTags[typedArray] = descriptor.get; - } - } - }); -} - -var tryTypedArrays = function tryAllTypedArrays(value) { - var foundName = false; - forEach(toStrTags, function (getter, typedArray) { - if (!foundName) { - try { - var name = getter.call(value); - - if (name === typedArray) { - foundName = name; - } - } catch (e) {} - } - }); - return foundName; -}; - -var isTypedArray = __webpack_require__(/*! is-typed-array */ "./node_modules/is-typed-array/index.js"); - -module.exports = function whichTypedArray(value) { - if (!isTypedArray(value)) { - return false; - } - - if (!hasToStringTag || !(Symbol.toStringTag in value)) { - return $slice($toString(value), 8, -1); - } - - return tryTypedArrays(value); -}; - -/***/ }), - -/***/ "./packages/api/app/query.js": -/*!***********************************!*\ - !*** ./packages/api/app/query.js ***! - \***********************************/ -/*! no static exports found */ -/***/ (function(module, exports) { - -function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } - -function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } - -function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } - -function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } - -function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_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 _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } - -function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } - -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } - -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; } - -class Query { - constructor(state) { - this.state = _objectSpread({ - filterExpressions: state.filterExpressions || [], - selectExpressions: state.selectExpressions || [], - groupExpressions: state.groupExpressions || [], - orderExpressions: state.orderExpressions || [], - calculation: false, - rawMode: false, - withDead: false, - validateRefs: true, - limit: null, - offset: null - }, state); - } - - filter(expr) { - return new Query(_objectSpread(_objectSpread({}, this.state), {}, { - filterExpressions: [...this.state.filterExpressions, expr] - })); - } - - unfilter(exprs) { - let exprSet = new Set(exprs); - return new Query(_objectSpread(_objectSpread({}, this.state), {}, { - filterExpressions: this.state.filterExpressions.filter(expr => !exprSet.has(Object.keys(expr)[0])) - })); - } - - select(exprs = []) { - if (!Array.isArray(exprs)) { - exprs = [exprs]; - } - - let query = new Query(_objectSpread(_objectSpread({}, this.state), {}, { - selectExpressions: exprs - })); - query.state.calculation = false; - return query; - } - - calculate(expr) { - let query = this.select({ - result: expr - }); - query.state.calculation = true; - return query; - } - - groupBy(exprs) { - if (!Array.isArray(exprs)) { - exprs = [exprs]; - } - - return new Query(_objectSpread(_objectSpread({}, this.state), {}, { - groupExpressions: [...this.state.groupExpressions, ...exprs] - })); - } - - orderBy(exprs) { - if (!Array.isArray(exprs)) { - exprs = [exprs]; - } - - return new Query(_objectSpread(_objectSpread({}, this.state), {}, { - orderExpressions: [...this.state.orderExpressions, ...exprs] - })); - } - - limit(num) { - return new Query(_objectSpread(_objectSpread({}, this.state), {}, { - limit: num - })); - } - - offset(num) { - return new Query(_objectSpread(_objectSpread({}, this.state), {}, { - offset: num - })); - } - - raw() { - return new Query(_objectSpread(_objectSpread({}, this.state), {}, { - rawMode: true - })); - } - - withDead() { - return new Query(_objectSpread(_objectSpread({}, this.state), {}, { - withDead: true - })); - } - - withoutValidatedRefs() { - return new Query(_objectSpread(_objectSpread({}, this.state), {}, { - validateRefs: false - })); - } - - options(opts) { - return new Query(_objectSpread(_objectSpread({}, this.state), {}, { - tableOptions: opts - })); - } - - serialize() { - return this.state; - } - -} - -function getPrimaryOrderBy(query, defaultOrderBy) { - let orderExprs = query.serialize().orderExpressions; - - if (orderExprs.length === 0) { - if (defaultOrderBy) { - return _objectSpread({ - order: 'asc' - }, defaultOrderBy); - } - - return null; - } - - let firstOrder = orderExprs[0]; - - if (typeof firstOrder === 'string') { - return { - field: firstOrder, - order: 'asc' - }; - } // Handle this form: { field: 'desc' } - - - let _Object$keys = Object.keys(firstOrder), - _Object$keys2 = _slicedToArray(_Object$keys, 1), - field = _Object$keys2[0]; - - return { - field, - order: firstOrder[field] - }; -} - -module.exports = function q(table) { - return new Query({ - table - }); -}; - -/***/ }), - -/***/ "./packages/api/injected.js": -/*!**********************************!*\ - !*** ./packages/api/injected.js ***! - \**********************************/ -/*! no static exports found */ -/***/ (function(module, exports) { - -// TODO: comment on why it works this way -let send; -module.exports = { - send -}; - -/***/ }), - -/***/ "./packages/api/methods.js": -/*!*********************************!*\ - !*** ./packages/api/methods.js ***! - \*********************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -const q = __webpack_require__(/*! ./app/query */ "./packages/api/app/query.js"); - -const injected = __webpack_require__(/*! ./injected */ "./packages/api/injected.js"); - -function send(name, args) { - return injected.send(name, args); -} - -async function runImport(name, func) { - await send('api/start-import', { - budgetName: name - }); - - try { - await func(); - } catch (e) { - await send('api/abort-import'); - throw e; - } - - await send('api/finish-import'); -} - -async function loadBudget(budgetId) { - return send('api/load-budget', { - id: budgetId - }); -} - -async function batchBudgetUpdates(func) { - await send('api/batch-budget-start'); - - try { - await func(); - } finally { - await send('api/batch-budget-end'); - } -} - -function runQuery(query) { - return send('api/query', { - query: query.serialize() - }); -} - -function getBudgetMonths() { - return send('api/budget-months'); -} - -function getBudgetMonth(month) { - return send('api/budget-month', { - month - }); -} - -function setBudgetAmount(month, categoryId, value) { - return send('api/budget-set-amount', { - month, - categoryId, - amount: value - }); -} - -function setBudgetCarryover(month, categoryId, flag) { - return send('api/budget-set-carryover', { - month, - categoryId, - flag - }); -} - -function addTransactions(accountId, transactions) { - return send('api/transactions-add', { - accountId, - transactions - }); -} - -function importTransactions(accountId, transactions) { - return send('api/transactions-import', { - accountId, - transactions - }); -} - -function getTransactions(accountId, startDate, endDate) { - return send('api/transactions-get', { - accountId, - startDate, - endDate - }); -} - -function filterTransactions(accountId, text) { - return send('api/transactions-filter', { - accountId, - text - }); -} - -function updateTransaction(id, fields) { - return send('api/transaction-update', { - id, - fields - }); -} - -function deleteTransaction(id) { - return send('api/transaction-delete', { - id - }); -} - -function getAccounts() { - return send('api/accounts-get'); -} - -function createAccount(account, initialBalance) { - return send('api/account-create', { - account, - initialBalance - }); -} - -function updateAccount(id, fields) { - return send('api/account-update', { - id, - fields - }); -} - -function closeAccount(id, transferAccountId, transferCategoryId) { - return send('api/account-close', { - id, - transferAccountId, - transferCategoryId - }); -} - -function reopenAccount(id) { - return send('api/account-reopen', { - id - }); -} - -function deleteAccount(id) { - return send('api/account-delete', { - id - }); -} - -function getCategoryGroups() { - return send('api/categories-get', { - grouped: true - }); -} - -function createCategoryGroup(group) { - return send('api/category-group-create', { - group - }); -} - -function updateCategoryGroup(id, fields) { - return send('api/category-group-update', { - id, - fields - }); -} - -function deleteCategoryGroup(id, transferCategoryId) { - return send('api/category-group-delete', { - id, - transferCategoryId - }); -} - -function getCategories() { - return send('api/categories-get', { - grouped: false - }); -} - -function createCategory(category) { - return send('api/category-create', { - category - }); -} - -function updateCategory(id, fields) { - return send('api/category-update', { - id, - fields - }); -} - -function deleteCategory(id, transferCategoryId) { - return send('api/category-delete', { - id, - transferCategoryId - }); -} - -function getPayees() { - return send('api/payees-get'); -} - -function createPayee(payee) { - return send('api/payee-create', { - payee - }); -} - -function updatePayee(id, fields) { - return send('api/payee-update', { - id, - fields - }); -} - -function deletePayee(id) { - return send('api/payee-delete', { - id - }); -} - -function getPayeeRules(payeeId) { - return send('api/payee-rules-get', { - payeeId - }); -} - -function createPayeeRule(payeeId, rule) { - return send('api/payee-rule-create', { - payee_id: payeeId, - rule - }); -} - -function updatePayeeRule(id, fields) { - return send('api/payee-rule-update', { - id, - fields - }); -} - -function deletePayeeRule(id) { - return send('api/payee-rule-delete', { - id - }); -} - -module.exports = { - runImport, - runQuery, - q, - loadBudget, - batchBudgetUpdates, - getBudgetMonths, - getBudgetMonth, - setBudgetAmount, - setBudgetCarryover, - addTransactions, - importTransactions, - filterTransactions, - getTransactions, - updateTransaction, - deleteTransaction, - getAccounts, - createAccount, - updateAccount, - closeAccount, - reopenAccount, - deleteAccount, - getCategories, - createCategoryGroup, - updateCategoryGroup, - deleteCategoryGroup, - createCategory, - updateCategory, - deleteCategory, - getPayees, - createPayee, - updatePayee, - deletePayee, - getPayeeRules, - createPayeeRule, - deletePayeeRule, - updatePayeeRule -}; - -/***/ }), - -/***/ "./packages/import-ynab4/importer.js": -/*!*******************************************!*\ - !*** ./packages/import-ynab4/importer.js ***! - \*******************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } - -function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } - -function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } - -function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } - -function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_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 _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } - -const d = __webpack_require__(/*! date-fns */ "./node_modules/date-fns/esm/index.js"); - -const normalizePathSep = __webpack_require__(/*! slash */ "./node_modules/slash/index.js"); - -const uuid = __webpack_require__(/*! uuid */ "./node_modules/uuid/index.js"); - -const AdmZip = __webpack_require__(/*! adm-zip */ "./node_modules/adm-zip/adm-zip.js"); - -const actual = __webpack_require__(/*! @actual-app/api/methods */ "./packages/api/methods.js"); - -const _require = __webpack_require__(/*! @actual-app/api/utils */ "./packages/import-ynab4/node_modules/@actual-app/api/utils.js"), - amountToInteger = _require.amountToInteger; // Utils - - -function mapAccountType(type) { - switch (type) { - case 'Cash': - case 'Checking': - return 'checking'; - - case 'CreditCard': - return 'credit'; - - case 'Savings': - return 'savings'; - - case 'InvestmentAccount': - return 'investment'; - - case 'Mortgage': - return 'mortgage'; - - default: - return 'other'; - } -} - -function sortByKey(arr, key) { - return [...arr].sort((item1, item2) => { - if (item1[key] < item2[key]) { - return -1; - } else if (item1[key] > item2[key]) { - return 1; - } - - return 0; - }); -} - -function groupBy(arr, keyName) { - return arr.reduce(function (obj, item) { - var key = item[keyName]; - - if (!obj.hasOwnProperty(key)) { - obj[key] = []; - } - - obj[key].push(item); - return obj; - }, {}); -} - -function _parse(value) { - if (typeof value === 'string') { - // We don't want parsing to take local timezone into account, - // which parsing a string does. Pass the integers manually to - // bypass it. - let _value$split = value.split('-'), - _value$split2 = _slicedToArray(_value$split, 3), - year = _value$split2[0], - month = _value$split2[1], - day = _value$split2[2]; - - if (day != null) { - return new Date(parseInt(year), parseInt(month) - 1, parseInt(day)); - } else if (month != null) { - return new Date(parseInt(year), parseInt(month) - 1, 1); - } else { - return new Date(parseInt(year), 0, 1); - } - } - - return value; -} - -function monthFromDate(date) { - return d.format(_parse(date), 'yyyy-MM'); -} - -function getCurrentMonth() { - return d.format(new Date(), 'yyyy-MM'); -} // Importer - - -async function importAccounts(data, entityIdMap) { - return Promise.all(data.accounts.map(async account => { - if (!account.isTombstone) { - const id = await actual.createAccount({ - type: mapAccountType(account.accountType), - name: account.accountName, - offbudget: account.onBudget ? false : true, - closed: account.hidden ? true : false - }); - entityIdMap.set(account.entityId, id); - } - })); -} - -async function importCategories(data, entityIdMap) { - const masterCategories = sortByKey(data.masterCategories, 'sortableIndex'); - await Promise.all(masterCategories.map(async masterCategory => { - if (masterCategory.type === 'OUTFLOW' && !masterCategory.isTombstone && masterCategory.subCategories && masterCategory.subCategories.some(cat => !cat.isTombstone) > 0) { - const id = await actual.createCategoryGroup({ - name: masterCategory.name, - is_income: false - }); - entityIdMap.set(masterCategory.entityId, id); - - if (masterCategory.subCategories) { - const subCategories = sortByKey(masterCategory.subCategories, 'sortableIndex'); - subCategories.reverse(); // This can't be done in parallel because sort order depends - // on insertion order - - for (let category of subCategories) { - if (!category.isTombstone) { - const id = await actual.createCategory({ - name: category.name, - group_id: entityIdMap.get(category.masterCategoryId) - }); - entityIdMap.set(category.entityId, id); - } - } - } - } - })); -} - -async function importPayees(data, entityIdMap) { - for (let payee of data.payees) { - if (!payee.isTombstone) { - let id = await actual.createPayee({ - name: payee.name, - category: entityIdMap.get(payee.autoFillCategoryId) || null, - transfer_acct: entityIdMap.get(payee.targetAccountId) || null - }); // TODO: import payee rules - - entityIdMap.set(payee.entityId, id); - } - } -} - -async function importTransactions(data, entityIdMap) { - const categories = await actual.getCategories(); - const incomeCategoryId = categories.find(cat => cat.name === 'Income').id; - const accounts = await actual.getAccounts(); - const payees = await actual.getPayees(); - - function getCategory(id) { - if (id == null || id === 'Category/__Split__') { - return null; - } else if (id === 'Category/__ImmediateIncome__' || id === 'Category/__DeferredIncome__') { - return incomeCategoryId; - } - - return entityIdMap.get(id); - } - - function isOffBudget(acctId) { - let acct = accounts.find(acct => acct.id === acctId); - - if (!acct) { - throw new Error('Could not find account for transaction when importing'); - } - - return acct.offbudget; - } // Go ahead and generate ids for all of the transactions so we can - // reliably resolve transfers - - - for (let transaction of data.transactions) { - entityIdMap.set(transaction.entityId, uuid.v4()); - } - - let sortOrder = 1; - let transactionsGrouped = groupBy(data.transactions, 'accountId'); - await Promise.all(Object.keys(transactionsGrouped).map(async accountId => { - let transactions = transactionsGrouped[accountId]; - let toImport = transactions.map(transaction => { - if (transaction.isTombstone) { - return; - } - - let id = entityIdMap.get(transaction.entityId); - let transferId = entityIdMap.get(transaction.transferTransactionId) || null; - let payee = null; - - if (transferId) { - payee = payees.find(p => p.transfer_acct === entityIdMap.get(transaction.targetAccountId)).id; - } else { - payee = entityIdMap.get(transaction.payeeId); - } - - let newTransaction = { - id, - amount: amountToInteger(transaction.amount), - category: isOffBudget(entityIdMap.get(accountId)) ? null : getCategory(transaction.categoryId), - date: transaction.date, - notes: transaction.memo || null, - payee, - transfer_id: transferId - }; - newTransaction.subtransactions = transaction.subTransactions && transaction.subTransactions.map((t, i) => { - return { - amount: amountToInteger(t.amount), - category: getCategory(t.categoryId) - }; - }); - return newTransaction; - }).filter(x => x); - await actual.addTransactions(entityIdMap.get(accountId), toImport); - })); -} - -function fillInBudgets(data, categoryBudgets) { - // YNAB only contains entries for categories that have been actually - // budgeted. That would be fine except that we need to set the - // "carryover" flag on each month when carrying debt across months. - // To make sure our system has a chance to set this flag on each - // category, make sure a budget exists for every category of every - // month. - const budgets = [...categoryBudgets]; - data.masterCategories.forEach(masterCategory => { - if (masterCategory.subCategories) { - masterCategory.subCategories.forEach(category => { - if (!budgets.find(b => b.categoryId === category.entityId)) { - budgets.push({ - budgeted: 0, - categoryId: category.entityId - }); - } - }); - } - }); - return budgets; -} - -async function importBudgets(data, entityIdMap) { - let budgets = sortByKey(data.monthlyBudgets, 'month'); - let earliestMonth = monthFromDate(budgets[0].month); - let currentMonth = getCurrentMonth(); - await actual.batchBudgetUpdates(async () => { - const carryoverFlags = {}; - - for (let budget of budgets) { - let filled = fillInBudgets(data, budget.monthlySubCategoryBudgets.filter(b => !b.isTombstone)); - await Promise.all(filled.map(async catBudget => { - let amount = amountToInteger(catBudget.budgeted); - let catId = entityIdMap.get(catBudget.categoryId); - let month = monthFromDate(budget.month); - - if (!catId) { - return; - } - - await actual.setBudgetAmount(month, catId, amount); - - if (catBudget.overspendingHandling === 'AffectsBuffer') { - // Turn off the carryover flag so it doesn't propagate - // to future months - carryoverFlags[catId] = false; - } else if (catBudget.overspendingHandling === 'Confined' || carryoverFlags[catId]) { - // Overspending has switched to carryover, set the - // flag so it propagates to future months - carryoverFlags[catId] = true; - await actual.setBudgetCarryover(month, catId, true); - } - })); - } - }); -} - -function estimateRecentness(str) { - // The "recentness" is the total amount of changes that this device - // is aware of, which is estimated by summing up all of the version - // numbers that its aware of. This works because version numbers are - // increasing integers. - return str.split(',').reduce((total, version) => { - const _version$split = version.split('-'), - _version$split2 = _slicedToArray(_version$split, 2), - _ = _version$split2[0], - number = _version$split2[1]; - - return total + parseInt(number); - }, 0); -} - -function findLatestDevice(zipped, entries) { - let devices = entries.map(entry => { - const contents = zipped.readFile(entry).toString('utf8'); - let data; - - try { - data = JSON.parse(contents); - } catch (e) { - return null; - } - - if (data.hasFullKnowledge) { - return { - deviceGUID: data.deviceGUID, - shortName: data.shortDeviceId, - recentness: estimateRecentness(data.knowledge) - }; - } - - return null; - }).filter(x => x); - devices = sortByKey(devices, 'recentness'); - return devices[devices.length - 1].deviceGUID; -} - -async function doImport(data) { - const entityIdMap = new Map(); - console.log('Importing Accounts...'); - await importAccounts(data, entityIdMap); - console.log('Importing Categories...'); - await importCategories(data, entityIdMap); - console.log('Importing Payees...'); - await importPayees(data, entityIdMap); - console.log('Importing Transactions...'); - await importTransactions(data, entityIdMap); - console.log('Importing Budgets...'); - await importBudgets(data, entityIdMap); - console.log('Setting up...'); -} - -function getBudgetName(filepath) { - let unixFilepath = normalizePathSep(filepath); - - if (!/\.zip/.test(unixFilepath)) { - return null; - } - - unixFilepath = unixFilepath.replace(/\.zip$/, '').replace(/.ynab4$/, ''); // Most budgets are named like "Budget~51938D82.ynab4" but sometimes - // they are only "Budget.ynab4". We only want to grab the name - // before the ~ if it exists. - - let m = unixFilepath.match(/([^/~]+)[^/]*$/); - - if (!m) { - return null; - } - - return m[1]; -} - -function getFile(entries, path) { - let files = entries.filter(e => e.entryName === path); - - if (files.length === 0) { - throw new Error('Could not find file: ' + path); - } - - if (files.length >= 2) { - throw new Error('File name matches multiple files: ' + path); - } - - return files[0]; -} - -function join(...paths) { - return paths.slice(1).reduce((full, path) => { - return full + '/' + path.replace(/^\//, ''); - }, paths[0].replace(/\/$/, '')); -} - -async function importBuffer(filepath, buffer) { - let budgetName = getBudgetName(filepath); - - if (!budgetName) { - throw new Error('Not a YNAB4 file: ' + filepath); - } - - let zipped = new AdmZip(buffer); - let entries = zipped.getEntries(); - let root = ''; - let dirMatch = entries[0].entryName.match(/([^/]*\.ynab4)/); - - if (dirMatch) { - root = dirMatch[1] + '/'; - } - - let metaStr = zipped.readFile(getFile(entries, root + 'Budget.ymeta')); - let meta = JSON.parse(metaStr.toString('utf8')); - let budgetPath = join(root, meta.relativeDataFolderName); - let deviceFiles = entries.filter(e => e.entryName.startsWith(join(budgetPath, 'devices'))); - let deviceGUID = findLatestDevice(zipped, deviceFiles); - const yfullPath = join(budgetPath, deviceGUID, 'Budget.yfull'); - let contents; - - try { - contents = zipped.readFile(getFile(entries, yfullPath)).toString('utf8'); - } catch (e) { - console.log(e); - throw new Error('Error reading Budget.yfull file'); - } - - let data; - - try { - data = JSON.parse(contents); - } catch (e) { - throw new Error('Error parsing Budget.yull file'); - } - - return actual.runImport(budgetName, () => doImport(data)); -} - -module.exports = { - importBuffer -}; - -/***/ }), - -/***/ "./packages/import-ynab4/node_modules/@actual-app/api/utils.js": -/*!*********************************************************************!*\ - !*** ./packages/import-ynab4/node_modules/@actual-app/api/utils.js ***! - \*********************************************************************/ -/*! no static exports found */ -/***/ (function(module, exports) { - -function amountToInteger(n) { - return Math.round(n * 100) | 0; -} - -function integerToAmount(n) { - return parseFloat((n / 100).toFixed(2)); -} - -module.exports = { - amountToInteger, - integerToAmount -}; - -/***/ }), - -/***/ "./packages/import-ynab5/importer.js": -/*!*******************************************!*\ - !*** ./packages/import-ynab5/importer.js ***! - \*******************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -const d = __webpack_require__(/*! date-fns */ "./node_modules/date-fns/esm/index.js"); - -const uuid = __webpack_require__(/*! uuid */ "./node_modules/uuid/index.js"); - -const actual = __webpack_require__(/*! @actual-app/api/methods */ "./packages/api/methods.js"); - -const _require = __webpack_require__(/*! @actual-app/api/utils */ "./packages/import-ynab5/node_modules/@actual-app/api/utils.js"), - amountToInteger = _require.amountToInteger; - -function amountFromYnab(amount) { - // ynabs multiplies amount by 1000 and actual by 100 - // so, this function divides by 10 - return Math.round(amount / 10); -} - -function monthFromDate(date) { - let parts = date.split('-'); - return parts[0] + '-' + parts[1]; -} - -function mapAccountType(type) { - switch (type) { - case 'cash': - case 'checking': - return 'checking'; - - case 'creditCard': - case 'lineOfCredit': - return 'credit'; - - case 'savings': - return 'savings'; - - case 'investmentAccount': - return 'investment'; - - case 'mortgage': - return 'mortgage'; - - default: - return 'other'; - } -} - -function sortByKey(arr, key) { - return [...arr].sort((item1, item2) => { - if (item1[key] < item2[key]) { - return -1; - } else if (item1[key] > item2[key]) { - return 1; - } - - return 0; - }); -} - -function groupBy(arr, keyName) { - return arr.reduce(function (obj, item) { - var key = item[keyName]; - - if (!obj.hasOwnProperty(key)) { - obj[key] = []; - } - - obj[key].push(item); - return obj; - }, {}); -} - -function importAccounts(data, entityIdMap) { - return Promise.all(data.accounts.map(async account => { - if (!account.deleted) { - let id = await actual.createAccount({ - type: mapAccountType(account.type), - name: account.name, - offbudget: account.on_budget ? false : true, - closed: account.closed - }); - entityIdMap.set(account.id, id); - } - })); -} - -async function importCategories(data, entityIdMap) { - // Hidden categories are put in its own group by YNAB, - // so it's already handled. - const categories = await actual.getCategories(); - const incomeCatId = categories.find(cat => cat.name === 'Income').id; - const ynabIncomeCategories = ['To be Budgeted', 'Inflow: Ready to Assign']; - - function checkSpecialCat(cat) { - if (cat.category_group_id === data.category_groups.find(group => group.name === 'Internal Master Category').id) { - if (ynabIncomeCategories.includes(cat.name)) { - return 'income'; - } else { - return 'internal'; - } - } else if (cat.category_group_id === data.category_groups.find(group => group.name === 'Credit Card Payments').id) { - return 'creditCard'; - } - } // Can't be done in parallel to have - // correct sort order. - - - for (let group of data.category_groups) { - if (!group.deleted) { - // Ignores internal category and credit cards - if (group.name !== 'Internal Master Category' && group.name !== 'Credit Card Payments') { - var groupId = await actual.createCategoryGroup({ - name: group.name, - is_income: false - }); - entityIdMap.set(group.id, groupId); - } - - let cats = data.categories.filter(cat => cat.category_group_id === group.id); - - for (let cat of cats.reverse()) { - if (!cat.deleted) { - let newCategory = {}; - newCategory.name = cat.name; // Handles special categories. Starting balance is a payee - // in YNAB so it's handled in importTransactions - - switch (checkSpecialCat(cat)) { - case 'income': - { - // doesn't create new category, only assigns id - let id = incomeCatId; - entityIdMap.set(cat.id, id); - break; - } - - case 'creditCard': // ignores it - - case 'internal': - // uncategorized is ignored too, handled by actual - break; - - default: - { - newCategory.group_id = groupId; - let id = await actual.createCategory(newCategory); - entityIdMap.set(cat.id, id); - break; - } - } - } - } - } - } -} - -function importPayees(data, entityIdMap) { - return Promise.all(data.payees.map(async payee => { - if (!payee.deleted) { - let id = await actual.createPayee({ - name: payee.name - }); - entityIdMap.set(payee.id, id); - } - })); -} - -async function importTransactions(data, entityIdMap) { - const payees = await actual.getPayees(); - const categories = await actual.getCategories(); - const incomeCatId = categories.find(cat => cat.name === 'Income').id; - const startingBalanceCatId = categories.find(cat => cat.name === 'Starting Balances').id; //better way to do it? - - const startingPayeeYNAB = data.payees.find(payee => payee.name === 'Starting Balance').id; - let transactionsGrouped = groupBy(data.transactions, 'account_id'); - let subtransactionsGrouped = groupBy(data.subtransactions, 'transaction_id'); // Go ahead and generate ids for all of the transactions so we can - // reliably resolve transfers - - for (let transaction of data.transactions) { - entityIdMap.set(transaction.id, uuid.v4()); - } - - await Promise.all(Object.keys(transactionsGrouped).map(async accountId => { - let transactions = transactionsGrouped[accountId]; - let toImport = transactions.map(transaction => { - if (transaction.deleted) { - return null; - } // Handle subtransactions - - - let subtransactions = subtransactionsGrouped[transaction.id]; - - if (subtransactions) { - subtransactions = subtransactions.map(subtrans => { - return { - amount: amountFromYnab(subtrans.amount), - category: entityIdMap.get(subtrans.category_id) || null, - notes: subtrans.memo - }; - }); - } // Add transaction - - - let newTransaction = { - id: entityIdMap.get(transaction.id), - account: entityIdMap.get(transaction.account_id), - date: transaction.date, - amount: amountFromYnab(transaction.amount), - category: entityIdMap.get(transaction.category_id) || null, - cleared: ['cleared', 'reconciled'].includes(transaction.cleared), - notes: transaction.memo || null, - imported_id: transaction.import_id || null, - transfer_id: entityIdMap.get(transaction.transfer_transaction_id) || null, - subtransactions: subtransactions - }; // Handle transfer payee - - if (transaction.transfer_account_id) { - newTransaction.payee = payees.find(p => p.transfer_acct === entityIdMap.get(transaction.transfer_account_id)).id; - } else { - newTransaction.payee = entityIdMap.get(transaction.payee_id); - } // Handle starting balances - - - if (transaction.payee_id === startingPayeeYNAB && entityIdMap.get(transaction.category_id) === incomeCatId) { - newTransaction.category = startingBalanceCatId; - newTransaction.payee = null; - } - - return newTransaction; - }).filter(x => x); - await actual.addTransactions(entityIdMap.get(accountId), toImport); - })); -} - -async function importBudgets(data, entityIdMap) { - // There should be info in the docs to deal with - // no credit card category and how YNAB and Actual - // handle differently the amount To be Budgeted - // i.e. Actual considers the cc debt while YNAB doesn't - // - // Also, there could be a way to set rollover using - // Deferred Income Subcat and Immediate Income Subcat - let budgets = sortByKey(data.months, 'month'); - const internalCatIdYnab = data.category_groups.find(group => group.name === 'Internal Master Category').id; - const creditcardCatIdYnab = data.category_groups.find(group => group.name === 'Credit Card Payments').id; - await actual.batchBudgetUpdates(async () => { - for (let budget of budgets) { - let month = monthFromDate(budget.month); - await Promise.all(budget.categories.map(async catBudget => { - let catId = entityIdMap.get(catBudget.id); - let amount = catBudget.budgeted / 10; - - if (!catId || catBudget.category_group_id === internalCatIdYnab || catBudget.category_group_id === creditcardCatIdYnab) { - return; - } - - await actual.setBudgetAmount(month, catId, amount); - })); - } - }); -} // Utils - - -async function doImport(data) { - const entityIdMap = new Map(); - console.log('Importing Accounts...'); - await importAccounts(data, entityIdMap); - console.log('Importing Categories...'); - await importCategories(data, entityIdMap); - console.log('Importing Payees...'); - await importPayees(data, entityIdMap); - console.log('Importing Transactions...'); - await importTransactions(data, entityIdMap); - console.log('Importing Budgets...'); - await importBudgets(data, entityIdMap); - console.log('Setting up...'); -} - -async function importYNAB5(data) { - if (data.data) { - data = data.data; - } - - return actual.runImport(data.budget.name, () => doImport(data.budget)); -} - -module.exports = { - importYNAB5 -}; - -/***/ }), - -/***/ "./packages/import-ynab5/node_modules/@actual-app/api/utils.js": -/*!*********************************************************************!*\ - !*** ./packages/import-ynab5/node_modules/@actual-app/api/utils.js ***! - \*********************************************************************/ -/*! no static exports found */ -/***/ (function(module, exports) { - -function amountToInteger(n) { - return Math.round(n * 100) | 0; -} - -function integerToAmount(n) { - return parseFloat((n / 100).toFixed(2)); -} - -module.exports = { - amountToInteger, - integerToAmount -}; - -/***/ }), - -/***/ "./packages/loot-core/migrations/1632571489012_remove_cache.js": -/*!*********************************************************************!*\ - !*** ./packages/loot-core/migrations/1632571489012_remove_cache.js ***! - \*********************************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return runMigration; }); -function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } - -function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } - -function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } - -function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } - -function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_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 _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } - -async function runMigration(db, uuid) { - function getValue(node) { - return node.expr != null ? node.expr : node.cachedValue; - } - - db.execQuery(` -CREATE TABLE zero_budget_months - (id TEXT PRIMARY KEY, - buffered INTEGER DEFAULT 0); - -CREATE TABLE zero_budgets - (id TEXT PRIMARY KEY, - month INTEGER, - category TEXT, - amount INTEGER DEFAULT 0, - carryover INTEGER DEFAULT 0); - -CREATE TABLE reflect_budgets - (id TEXT PRIMARY KEY, - month INTEGER, - category TEXT, - amount INTEGER DEFAULT 0, - carryover INTEGER DEFAULT 0); - -CREATE TABLE notes - (id TEXT PRIMARY KEY, - note TEXT); - -CREATE TABLE kvcache (key TEXT PRIMARY KEY, value TEXT); -CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL); -`); // Migrate budget amounts and carryover - - let budget = db.runQuery(`SELECT * FROM spreadsheet_cells WHERE name LIKE 'budget%!budget-%'`, [], true); - db.transaction(() => { - budget.map(monthBudget => { - let match = monthBudget.name.match(/^(budget-report|budget)(\d+)!budget-(.+)$/); - - if (match == null) { - console.log('Warning: invalid budget month name', monthBudget.name); - return; - } - - let type = match[1]; - let month = match[2].slice(0, 4) + '-' + match[2].slice(4); - let dbmonth = parseInt(match[2]); - let cat = match[3]; - let amount = parseInt(getValue(monthBudget)); - - if (isNaN(amount)) { - amount = 0; - } - - let sheetName = monthBudget.name.split('!')[0]; - let carryover = db.runQuery('SELECT * FROM spreadsheet_cells WHERE name = ?', [`${sheetName}!carryover-${cat}`], true); - let table = type === 'budget-report' ? 'reflect_budgets' : 'zero_budgets'; - db.runQuery(`INSERT INTO ${table} (id, month, category, amount, carryover) VALUES (?, ?, ?, ?, ?)`, [`${month}-${cat}`, dbmonth, cat, amount, carryover.length > 0 && getValue(carryover[0]) === 'true' ? 1 : 0]); - }); - }); // Migrate buffers - - let buffers = db.runQuery(`SELECT * FROM spreadsheet_cells WHERE name LIKE 'budget%!buffered'`, [], true); - db.transaction(() => { - buffers.map(buffer => { - let match = buffer.name.match(/^budget(\d+)!buffered$/); - - if (match) { - let month = match[1].slice(0, 4) + '-' + match[1].slice(4); - let amount = parseInt(getValue(buffer)); - - if (isNaN(amount)) { - amount = 0; - } - - db.runQuery(`INSERT INTO zero_budget_months (id, buffered) VALUES (?, ?)`, [month, amount]); - } - }); - }); // Migrate notes - - let notes = db.runQuery(`SELECT * FROM spreadsheet_cells WHERE name LIKE 'notes!%'`, [], true); - - let parseNote = str => { - try { - let value = JSON.parse(str); - return value && value !== '' ? value : null; - } catch (e) { - return null; - } - }; - - db.transaction(() => { - notes.forEach(note => { - let parsed = parseNote(getValue(note)); - - if (parsed) { - let _note$name$split = note.name.split('!'), - _note$name$split2 = _slicedToArray(_note$name$split, 2), - id = _note$name$split2[1]; - - db.runQuery(`INSERT INTO notes (id, note) VALUES (?, ?)`, [id, parsed]); - } - }); - }); - db.execQuery(` - DROP TABLE spreadsheet_cells; - ANALYZE; - VACUUM; - `); -} - -/***/ }), - -/***/ "./packages/loot-core/node_modules/adm-zip/adm-zip.js": -/*!************************************************************!*\ - !*** ./packages/loot-core/node_modules/adm-zip/adm-zip.js ***! - \************************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -var Utils = __webpack_require__(/*! ./util */ "./packages/loot-core/node_modules/adm-zip/util/index.js"); - -var fs = Utils.FileSystem.require(), - pth = __webpack_require__(/*! path */ "path"); - -fs.existsSync = fs.existsSync || pth.existsSync; - -var ZipEntry = __webpack_require__(/*! ./zipEntry */ "./packages/loot-core/node_modules/adm-zip/zipEntry.js"), - ZipFile = __webpack_require__(/*! ./zipFile */ "./packages/loot-core/node_modules/adm-zip/zipFile.js"); - -var isWin = /^win/.test(process.platform); - -module.exports = function ( -/*String*/ -input) { - var _zip = undefined, - _filename = ""; - - if (input && typeof input === "string") { - // load zip file - if (fs.existsSync(input)) { - _filename = input; - _zip = new ZipFile(input, Utils.Constants.FILE); - } else { - throw Utils.Errors.INVALID_FILENAME; - } - } else if (input && Buffer.isBuffer(input)) { - // load buffer - _zip = new ZipFile(input, Utils.Constants.BUFFER); - } else { - // create new zip file - _zip = new ZipFile(null, Utils.Constants.NONE); - } - - function sanitize(prefix, name) { - prefix = pth.resolve(pth.normalize(prefix)); - var parts = name.split('/'); - - for (var i = 0, l = parts.length; i < l; i++) { - var path = pth.normalize(pth.join(prefix, parts.slice(i, l).join(pth.sep))); - - if (path.indexOf(prefix) === 0) { - return path; - } - } - - return pth.normalize(pth.join(prefix, pth.basename(name))); - } - - function getEntry( - /*Object*/ - entry) { - if (entry && _zip) { - var item; // If entry was given as a file name - - if (typeof entry === "string") item = _zip.getEntry(entry); // if entry was given as a ZipEntry object - - if (typeof entry === "object" && typeof entry.entryName !== "undefined" && typeof entry.header !== "undefined") item = _zip.getEntry(entry.entryName); - - if (item) { - return item; - } - } - - return null; - } - - return { - /** - * Extracts the given entry from the archive and returns the content as a Buffer object - * @param entry ZipEntry object or String with the full path of the entry - * - * @return Buffer or Null in case of error - */ - readFile: function ( - /*Object*/ - entry) { - var item = getEntry(entry); - return item && item.getData() || null; - }, - - /** - * Asynchronous readFile - * @param entry ZipEntry object or String with the full path of the entry - * @param callback - * - * @return Buffer or Null in case of error - */ - readFileAsync: function ( - /*Object*/ - entry, - /*Function*/ - callback) { - var item = getEntry(entry); - - if (item) { - item.getDataAsync(callback); - } else { - callback(null, "getEntry failed for:" + entry); - } - }, - - /** - * Extracts the given entry from the archive and returns the content as plain text in the given encoding - * @param entry ZipEntry object or String with the full path of the entry - * @param encoding Optional. If no encoding is specified utf8 is used - * - * @return String - */ - readAsText: function ( - /*Object*/ - entry, - /*String - Optional*/ - encoding) { - var item = getEntry(entry); - - if (item) { - var data = item.getData(); - - if (data && data.length) { - return data.toString(encoding || "utf8"); - } - } - - return ""; - }, - - /** - * Asynchronous readAsText - * @param entry ZipEntry object or String with the full path of the entry - * @param callback - * @param encoding Optional. If no encoding is specified utf8 is used - * - * @return String - */ - readAsTextAsync: function ( - /*Object*/ - entry, - /*Function*/ - callback, - /*String - Optional*/ - encoding) { - var item = getEntry(entry); - - if (item) { - item.getDataAsync(function (data, err) { - if (err) { - callback(data, err); - return; - } - - if (data && data.length) { - callback(data.toString(encoding || "utf8")); - } else { - callback(""); - } - }); - } else { - callback(""); - } - }, - - /** - * Remove the entry from the file or the entry and all it's nested directories and files if the given entry is a directory - * - * @param entry - */ - deleteFile: function ( - /*Object*/ - entry) { - // @TODO: test deleteFile - var item = getEntry(entry); - - if (item) { - _zip.deleteEntry(item.entryName); - } - }, - - /** - * Adds a comment to the zip. The zip must be rewritten after adding the comment. - * - * @param comment - */ - addZipComment: function ( - /*String*/ - comment) { - // @TODO: test addZipComment - _zip.comment = comment; - }, - - /** - * Returns the zip comment - * - * @return String - */ - getZipComment: function () { - return _zip.comment || ''; - }, - - /** - * Adds a comment to a specified zipEntry. The zip must be rewritten after adding the comment - * The comment cannot exceed 65535 characters in length - * - * @param entry - * @param comment - */ - addZipEntryComment: function ( - /*Object*/ - entry, - /*String*/ - comment) { - var item = getEntry(entry); - - if (item) { - item.comment = comment; - } - }, - - /** - * Returns the comment of the specified entry - * - * @param entry - * @return String - */ - getZipEntryComment: function ( - /*Object*/ - entry) { - var item = getEntry(entry); - - if (item) { - return item.comment || ''; - } - - return ''; - }, - - /** - * Updates the content of an existing entry inside the archive. The zip must be rewritten after updating the content - * - * @param entry - * @param content - */ - updateFile: function ( - /*Object*/ - entry, - /*Buffer*/ - content) { - var item = getEntry(entry); - - if (item) { - item.setData(content); - } - }, - - /** - * Adds a file from the disk to the archive - * - * @param localPath File to add to zip - * @param zipPath Optional path inside the zip - * @param zipName Optional name for the file - */ - addLocalFile: function ( - /*String*/ - localPath, - /*String*/ - zipPath, - /*String*/ - zipName) { - if (fs.existsSync(localPath)) { - if (zipPath) { - zipPath = zipPath.split("\\").join("/"); - - if (zipPath.charAt(zipPath.length - 1) !== "/") { - zipPath += "/"; - } - } else { - zipPath = ""; - } - - var p = localPath.split("\\").join("/").split("/").pop(); - - if (zipName) { - this.addFile(zipPath + zipName, fs.readFileSync(localPath), "", 0); - } else { - this.addFile(zipPath + p, fs.readFileSync(localPath), "", 0); - } - } else { - throw Utils.Errors.FILE_NOT_FOUND.replace("%s", localPath); - } - }, - - /** - * Adds a local directory and all its nested files and directories to the archive - * - * @param localPath - * @param zipPath optional path inside zip - * @param filter optional RegExp or Function if files match will - * be included. - */ - addLocalFolder: function ( - /*String*/ - localPath, - /*String*/ - zipPath, - /*RegExp|Function*/ - filter) { - if (filter === undefined) { - filter = function () { - return true; - }; - } else if (filter instanceof RegExp) { - filter = function (filter) { - return function (filename) { - return filter.test(filename); - }; - }(filter); - } - - if (zipPath) { - zipPath = zipPath.split("\\").join("/"); - - if (zipPath.charAt(zipPath.length - 1) !== "/") { - zipPath += "/"; - } - } else { - zipPath = ""; - } // normalize the path first - - - localPath = pth.normalize(localPath); - localPath = localPath.split("\\").join("/"); //windows fix - - if (localPath.charAt(localPath.length - 1) !== "/") localPath += "/"; - - if (fs.existsSync(localPath)) { - var items = Utils.findFiles(localPath), - self = this; - - if (items.length) { - items.forEach(function (path) { - var p = path.split("\\").join("/").replace(new RegExp(localPath.replace(/(\(|\))/g, '\\$1'), 'i'), ""); //windows fix - - if (filter(p)) { - if (p.charAt(p.length - 1) !== "/") { - self.addFile(zipPath + p, fs.readFileSync(path), "", 0); - } else { - self.addFile(zipPath + p, Buffer.alloc(0), "", 0); - } - } - }); - } - } else { - throw Utils.Errors.FILE_NOT_FOUND.replace("%s", localPath); - } - }, - - /** - * Allows you to create a entry (file or directory) in the zip file. - * If you want to create a directory the entryName must end in / and a null buffer should be provided. - * Comment and attributes are optional - * - * @param entryName - * @param content - * @param comment - * @param attr - */ - addFile: function ( - /*String*/ - entryName, - /*Buffer*/ - content, - /*String*/ - comment, - /*Number*/ - attr) { - var entry = new ZipEntry(); - entry.entryName = entryName; - entry.comment = comment || ""; - - if (!attr) { - if (entry.isDirectory) { - attr = 0o40755 << 16 | 0x10; // (permissions drwxr-xr-x) + (MS-DOS directory flag) - } else { - attr = 0o644 << 16; // permissions -r-wr--r-- - } - } - - entry.attr = attr; - entry.setData(content); - - _zip.setEntry(entry); - }, - - /** - * Returns an array of ZipEntry objects representing the files and folders inside the archive - * - * @return Array - */ - getEntries: function () { - if (_zip) { - return _zip.entries; - } else { - return []; - } - }, - - /** - * Returns a ZipEntry object representing the file or folder specified by ``name``. - * - * @param name - * @return ZipEntry - */ - getEntry: function ( - /*String*/ - name) { - return getEntry(name); - }, - - /** - * Extracts the given entry to the given targetPath - * If the entry is a directory inside the archive, the entire directory and it's subdirectories will be extracted - * - * @param entry ZipEntry object or String with the full path of the entry - * @param targetPath Target folder where to write the file - * @param maintainEntryPath If maintainEntryPath is true and the entry is inside a folder, the entry folder - * will be created in targetPath as well. Default is TRUE - * @param overwrite If the file already exists at the target path, the file will be overwriten if this is true. - * Default is FALSE - * - * @return Boolean - */ - extractEntryTo: function ( - /*Object*/ - entry, - /*String*/ - targetPath, - /*Boolean*/ - maintainEntryPath, - /*Boolean*/ - overwrite) { - overwrite = overwrite || false; - maintainEntryPath = typeof maintainEntryPath === "undefined" ? true : maintainEntryPath; - var item = getEntry(entry); - - if (!item) { - throw Utils.Errors.NO_ENTRY; - } - - var entryName = item.entryName; - var target = sanitize(targetPath, maintainEntryPath ? entryName : pth.basename(entryName)); - - if (item.isDirectory) { - target = pth.resolve(target, ".."); - - var children = _zip.getEntryChildren(item); - - children.forEach(function (child) { - if (child.isDirectory) return; - var content = child.getData(); - - if (!content) { - throw Utils.Errors.CANT_EXTRACT_FILE; - } - - var childName = sanitize(targetPath, maintainEntryPath ? child.entryName : pth.basename(child.entryName)); - Utils.writeFileTo(childName, content, overwrite); - }); - return true; - } - - var content = item.getData(); - if (!content) throw Utils.Errors.CANT_EXTRACT_FILE; - - if (fs.existsSync(target) && !overwrite) { - throw Utils.Errors.CANT_OVERRIDE; - } - - Utils.writeFileTo(target, content, overwrite); - return true; - }, - - /** - * Test the archive - * - */ - test: function () { - if (!_zip) { - return false; - } - - for (var entry in _zip.entries) { - try { - if (entry.isDirectory) { - continue; - } - - var content = _zip.entries[entry].getData(); - - if (!content) { - return false; - } - } catch (err) { - return false; - } - } - - return true; - }, - - /** - * Extracts the entire archive to the given location - * - * @param targetPath Target location - * @param overwrite If the file already exists at the target path, the file will be overwriten if this is true. - * Default is FALSE - */ - extractAllTo: function ( - /*String*/ - targetPath, - /*Boolean*/ - overwrite) { - overwrite = overwrite || false; - - if (!_zip) { - throw Utils.Errors.NO_ZIP; - } - - _zip.entries.forEach(function (entry) { - var entryName = sanitize(targetPath, entry.entryName.toString()); - - if (entry.isDirectory) { - Utils.makeDir(entryName); - return; - } - - var content = entry.getData(); - - if (!content) { - throw Utils.Errors.CANT_EXTRACT_FILE; - } - - Utils.writeFileTo(entryName, content, overwrite); - - try { - fs.utimesSync(entryName, entry.header.time, entry.header.time); - } catch (err) { - throw Utils.Errors.CANT_EXTRACT_FILE; - } - }); - }, - - /** - * Asynchronous extractAllTo - * - * @param targetPath Target location - * @param overwrite If the file already exists at the target path, the file will be overwriten if this is true. - * Default is FALSE - * @param callback - */ - extractAllToAsync: function ( - /*String*/ - targetPath, - /*Boolean*/ - overwrite, - /*Function*/ - callback) { - if (!callback) { - callback = function () {}; - } - - overwrite = overwrite || false; - - if (!_zip) { - callback(new Error(Utils.Errors.NO_ZIP)); - return; - } - - var entries = _zip.entries; - var i = entries.length; - entries.forEach(function (entry) { - if (i <= 0) return; // Had an error already - - var entryName = pth.normalize(entry.entryName.toString()); - - if (entry.isDirectory) { - Utils.makeDir(sanitize(targetPath, entryName)); - if (--i === 0) callback(undefined); - return; - } - - entry.getDataAsync(function (content, err) { - if (i <= 0) return; - - if (err) { - callback(new Error(err)); - return; - } - - if (!content) { - i = 0; - callback(new Error(Utils.Errors.CANT_EXTRACT_FILE)); - return; - } - - Utils.writeFileToAsync(sanitize(targetPath, entryName), content, overwrite, function (succ) { - try { - fs.utimesSync(pth.resolve(targetPath, entryName), entry.header.time, entry.header.time); - } catch (err) { - callback(new Error('Unable to set utimes')); - } - - if (i <= 0) return; - - if (!succ) { - i = 0; - callback(new Error('Unable to write')); - return; - } - - if (--i === 0) callback(undefined); - }); - }); - }); - }, - - /** - * Writes the newly created zip file to disk at the specified location or if a zip was opened and no ``targetFileName`` is provided, it will overwrite the opened zip - * - * @param targetFileName - * @param callback - */ - writeZip: function ( - /*String*/ - targetFileName, - /*Function*/ - callback) { - if (arguments.length === 1) { - if (typeof targetFileName === "function") { - callback = targetFileName; - targetFileName = ""; - } - } - - if (!targetFileName && _filename) { - targetFileName = _filename; - } - - if (!targetFileName) return; - - var zipData = _zip.compressToBuffer(); - - if (zipData) { - var ok = Utils.writeFileTo(targetFileName, zipData, true); - if (typeof callback === 'function') callback(!ok ? new Error("failed") : null, ""); - } - }, - - /** - * Returns the content of the entire zip file as a Buffer object - * - * @return Buffer - */ - toBuffer: function ( - /*Function*/ - onSuccess, - /*Function*/ - onFail, - /*Function*/ - onItemStart, - /*Function*/ - onItemEnd) { - this.valueOf = 2; - - if (typeof onSuccess === "function") { - _zip.toAsyncBuffer(onSuccess, onFail, onItemStart, onItemEnd); - - return null; - } - - return _zip.compressToBuffer(); - } - }; -}; - -/***/ }), - -/***/ "./packages/loot-core/node_modules/adm-zip/headers/entryHeader.js": -/*!************************************************************************!*\ - !*** ./packages/loot-core/node_modules/adm-zip/headers/entryHeader.js ***! - \************************************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -var Utils = __webpack_require__(/*! ../util */ "./packages/loot-core/node_modules/adm-zip/util/index.js"), - Constants = Utils.Constants; -/* The central directory file header */ - - -module.exports = function () { - var _verMade = 0x0A, - _version = 0x0A, - _flags = 0, - _method = 0, - _time = 0, - _crc = 0, - _compressedSize = 0, - _size = 0, - _fnameLen = 0, - _extraLen = 0, - _comLen = 0, - _diskStart = 0, - _inattr = 0, - _attr = 0, - _offset = 0; - var _dataHeader = {}; - - function setTime(val) { - val = new Date(val); - _time = (val.getFullYear() - 1980 & 0x7f) << 25 // b09-16 years from 1980 - | val.getMonth() + 1 << 21 // b05-08 month - | val.getDate() << 16 // b00-04 hour - // 2 bytes time - | val.getHours() << 11 // b11-15 hour - | val.getMinutes() << 5 // b05-10 minute - | val.getSeconds() >> 1; // b00-04 seconds divided by 2 - } - - setTime(+new Date()); - return { - get made() { - return _verMade; - }, - - set made(val) { - _verMade = val; - }, - - get version() { - return _version; - }, - - set version(val) { - _version = val; - }, - - get flags() { - return _flags; - }, - - set flags(val) { - _flags = val; - }, - - get method() { - return _method; - }, - - set method(val) { - _method = val; - }, - - get time() { - return new Date((_time >> 25 & 0x7f) + 1980, (_time >> 21 & 0x0f) - 1, _time >> 16 & 0x1f, _time >> 11 & 0x1f, _time >> 5 & 0x3f, (_time & 0x1f) << 1); - }, - - set time(val) { - setTime(val); - }, - - get crc() { - return _crc; - }, - - set crc(val) { - _crc = val; - }, - - get compressedSize() { - return _compressedSize; - }, - - set compressedSize(val) { - _compressedSize = val; - }, - - get size() { - return _size; - }, - - set size(val) { - _size = val; - }, - - get fileNameLength() { - return _fnameLen; - }, - - set fileNameLength(val) { - _fnameLen = val; - }, - - get extraLength() { - return _extraLen; - }, - - set extraLength(val) { - _extraLen = val; - }, - - get commentLength() { - return _comLen; - }, - - set commentLength(val) { - _comLen = val; - }, - - get diskNumStart() { - return _diskStart; - }, - - set diskNumStart(val) { - _diskStart = val; - }, - - get inAttr() { - return _inattr; - }, - - set inAttr(val) { - _inattr = val; - }, - - get attr() { - return _attr; - }, - - set attr(val) { - _attr = val; - }, - - get offset() { - return _offset; - }, - - set offset(val) { - _offset = val; - }, - - get encripted() { - return (_flags & 1) === 1; - }, - - get entryHeaderSize() { - return Constants.CENHDR + _fnameLen + _extraLen + _comLen; - }, - - get realDataOffset() { - return _offset + Constants.LOCHDR + _dataHeader.fnameLen + _dataHeader.extraLen; - }, - - get dataHeader() { - return _dataHeader; - }, - - loadDataHeaderFromBinary: function ( - /*Buffer*/ - input) { - var data = input.slice(_offset, _offset + Constants.LOCHDR); // 30 bytes and should start with "PK\003\004" - - if (data.readUInt32LE(0) !== Constants.LOCSIG) { - throw Utils.Errors.INVALID_LOC; - } - - _dataHeader = { - // version needed to extract - version: data.readUInt16LE(Constants.LOCVER), - // general purpose bit flag - flags: data.readUInt16LE(Constants.LOCFLG), - // compression method - method: data.readUInt16LE(Constants.LOCHOW), - // modification time (2 bytes time, 2 bytes date) - time: data.readUInt32LE(Constants.LOCTIM), - // uncompressed file crc-32 value - crc: data.readUInt32LE(Constants.LOCCRC), - // compressed size - compressedSize: data.readUInt32LE(Constants.LOCSIZ), - // uncompressed size - size: data.readUInt32LE(Constants.LOCLEN), - // filename length - fnameLen: data.readUInt16LE(Constants.LOCNAM), - // extra field length - extraLen: data.readUInt16LE(Constants.LOCEXT) - }; - }, - loadFromBinary: function ( - /*Buffer*/ - data) { - // data should be 46 bytes and start with "PK 01 02" - if (data.length !== Constants.CENHDR || data.readUInt32LE(0) !== Constants.CENSIG) { - throw Utils.Errors.INVALID_CEN; - } // version made by - - - _verMade = data.readUInt16LE(Constants.CENVEM); // version needed to extract - - _version = data.readUInt16LE(Constants.CENVER); // encrypt, decrypt flags - - _flags = data.readUInt16LE(Constants.CENFLG); // compression method - - _method = data.readUInt16LE(Constants.CENHOW); // modification time (2 bytes time, 2 bytes date) - - _time = data.readUInt32LE(Constants.CENTIM); // uncompressed file crc-32 value - - _crc = data.readUInt32LE(Constants.CENCRC); // compressed size - - _compressedSize = data.readUInt32LE(Constants.CENSIZ); // uncompressed size - - _size = data.readUInt32LE(Constants.CENLEN); // filename length - - _fnameLen = data.readUInt16LE(Constants.CENNAM); // extra field length - - _extraLen = data.readUInt16LE(Constants.CENEXT); // file comment length - - _comLen = data.readUInt16LE(Constants.CENCOM); // volume number start - - _diskStart = data.readUInt16LE(Constants.CENDSK); // internal file attributes - - _inattr = data.readUInt16LE(Constants.CENATT); // external file attributes - - _attr = data.readUInt32LE(Constants.CENATX); // LOC header offset - - _offset = data.readUInt32LE(Constants.CENOFF); - }, - dataHeaderToBinary: function () { - // LOC header size (30 bytes) - var data = Buffer.alloc(Constants.LOCHDR); // "PK\003\004" - - data.writeUInt32LE(Constants.LOCSIG, 0); // version needed to extract - - data.writeUInt16LE(_version, Constants.LOCVER); // general purpose bit flag - - data.writeUInt16LE(_flags, Constants.LOCFLG); // compression method - - data.writeUInt16LE(_method, Constants.LOCHOW); // modification time (2 bytes time, 2 bytes date) - - data.writeUInt32LE(_time, Constants.LOCTIM); // uncompressed file crc-32 value - - data.writeUInt32LE(_crc, Constants.LOCCRC); // compressed size - - data.writeUInt32LE(_compressedSize, Constants.LOCSIZ); // uncompressed size - - data.writeUInt32LE(_size, Constants.LOCLEN); // filename length - - data.writeUInt16LE(_fnameLen, Constants.LOCNAM); // extra field length - - data.writeUInt16LE(_extraLen, Constants.LOCEXT); - return data; - }, - entryHeaderToBinary: function () { - // CEN header size (46 bytes) - var data = Buffer.alloc(Constants.CENHDR + _fnameLen + _extraLen + _comLen); // "PK\001\002" - - data.writeUInt32LE(Constants.CENSIG, 0); // version made by - - data.writeUInt16LE(_verMade, Constants.CENVEM); // version needed to extract - - data.writeUInt16LE(_version, Constants.CENVER); // encrypt, decrypt flags - - data.writeUInt16LE(_flags, Constants.CENFLG); // compression method - - data.writeUInt16LE(_method, Constants.CENHOW); // modification time (2 bytes time, 2 bytes date) - - data.writeUInt32LE(_time, Constants.CENTIM); // uncompressed file crc-32 value - - data.writeUInt32LE(_crc, Constants.CENCRC); // compressed size - - data.writeUInt32LE(_compressedSize, Constants.CENSIZ); // uncompressed size - - data.writeUInt32LE(_size, Constants.CENLEN); // filename length - - data.writeUInt16LE(_fnameLen, Constants.CENNAM); // extra field length - - data.writeUInt16LE(_extraLen, Constants.CENEXT); // file comment length - - data.writeUInt16LE(_comLen, Constants.CENCOM); // volume number start - - data.writeUInt16LE(_diskStart, Constants.CENDSK); // internal file attributes - - data.writeUInt16LE(_inattr, Constants.CENATT); // external file attributes - - data.writeUInt32LE(_attr, Constants.CENATX); // LOC header offset - - data.writeUInt32LE(_offset, Constants.CENOFF); // fill all with - - data.fill(0x00, Constants.CENHDR); - return data; - }, - toString: function () { - return '{\n' + '\t"made" : ' + _verMade + ",\n" + '\t"version" : ' + _version + ",\n" + '\t"flags" : ' + _flags + ",\n" + '\t"method" : ' + Utils.methodToString(_method) + ",\n" + '\t"time" : ' + this.time + ",\n" + '\t"crc" : 0x' + _crc.toString(16).toUpperCase() + ",\n" + '\t"compressedSize" : ' + _compressedSize + " bytes,\n" + '\t"size" : ' + _size + " bytes,\n" + '\t"fileNameLength" : ' + _fnameLen + ",\n" + '\t"extraLength" : ' + _extraLen + " bytes,\n" + '\t"commentLength" : ' + _comLen + " bytes,\n" + '\t"diskNumStart" : ' + _diskStart + ",\n" + '\t"inAttr" : ' + _inattr + ",\n" + '\t"attr" : ' + _attr + ",\n" + '\t"offset" : ' + _offset + ",\n" + '\t"entryHeaderSize" : ' + (Constants.CENHDR + _fnameLen + _extraLen + _comLen) + " bytes\n" + '}'; - } - }; -}; - -/***/ }), - -/***/ "./packages/loot-core/node_modules/adm-zip/headers/index.js": -/*!******************************************************************!*\ - !*** ./packages/loot-core/node_modules/adm-zip/headers/index.js ***! - \******************************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -exports.EntryHeader = __webpack_require__(/*! ./entryHeader */ "./packages/loot-core/node_modules/adm-zip/headers/entryHeader.js"); -exports.MainHeader = __webpack_require__(/*! ./mainHeader */ "./packages/loot-core/node_modules/adm-zip/headers/mainHeader.js"); - -/***/ }), - -/***/ "./packages/loot-core/node_modules/adm-zip/headers/mainHeader.js": -/*!***********************************************************************!*\ - !*** ./packages/loot-core/node_modules/adm-zip/headers/mainHeader.js ***! - \***********************************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -var Utils = __webpack_require__(/*! ../util */ "./packages/loot-core/node_modules/adm-zip/util/index.js"), - Constants = Utils.Constants; -/* The entries in the end of central directory */ - - -module.exports = function () { - var _volumeEntries = 0, - _totalEntries = 0, - _size = 0, - _offset = 0, - _commentLength = 0; - return { - get diskEntries() { - return _volumeEntries; - }, - - set diskEntries( - /*Number*/ - val) { - _volumeEntries = _totalEntries = val; - }, - - get totalEntries() { - return _totalEntries; - }, - - set totalEntries( - /*Number*/ - val) { - _totalEntries = _volumeEntries = val; - }, - - get size() { - return _size; - }, - - set size( - /*Number*/ - val) { - _size = val; - }, - - get offset() { - return _offset; - }, - - set offset( - /*Number*/ - val) { - _offset = val; - }, - - get commentLength() { - return _commentLength; - }, - - set commentLength( - /*Number*/ - val) { - _commentLength = val; - }, - - get mainHeaderSize() { - return Constants.ENDHDR + _commentLength; - }, - - loadFromBinary: function ( - /*Buffer*/ - data) { - // data should be 22 bytes and start with "PK 05 06" - if (data.length !== Constants.ENDHDR || data.readUInt32LE(0) !== Constants.ENDSIG) throw Utils.Errors.INVALID_END; // number of entries on this volume - - _volumeEntries = data.readUInt16LE(Constants.ENDSUB); // total number of entries - - _totalEntries = data.readUInt16LE(Constants.ENDTOT); // central directory size in bytes - - _size = data.readUInt32LE(Constants.ENDSIZ); // offset of first CEN header - - _offset = data.readUInt32LE(Constants.ENDOFF); // zip file comment length - - _commentLength = data.readUInt16LE(Constants.ENDCOM); - }, - toBinary: function () { - var b = Buffer.alloc(Constants.ENDHDR + _commentLength); // "PK 05 06" signature - - b.writeUInt32LE(Constants.ENDSIG, 0); - b.writeUInt32LE(0, 4); // number of entries on this volume - - b.writeUInt16LE(_volumeEntries, Constants.ENDSUB); // total number of entries - - b.writeUInt16LE(_totalEntries, Constants.ENDTOT); // central directory size in bytes - - b.writeUInt32LE(_size, Constants.ENDSIZ); // offset of first CEN header - - b.writeUInt32LE(_offset, Constants.ENDOFF); // zip file comment length - - b.writeUInt16LE(_commentLength, Constants.ENDCOM); // fill comment memory with spaces so no garbage is left there - - b.fill(" ", Constants.ENDHDR); - return b; - }, - toString: function () { - return '{\n' + '\t"diskEntries" : ' + _volumeEntries + ",\n" + '\t"totalEntries" : ' + _totalEntries + ",\n" + '\t"size" : ' + _size + " bytes,\n" + '\t"offset" : 0x' + _offset.toString(16).toUpperCase() + ",\n" + '\t"commentLength" : 0x' + _commentLength + "\n" + '}'; - } - }; -}; - -/***/ }), - -/***/ "./packages/loot-core/node_modules/adm-zip/methods/deflater.js": -/*!*********************************************************************!*\ - !*** ./packages/loot-core/node_modules/adm-zip/methods/deflater.js ***! - \*********************************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -module.exports = function ( -/*Buffer*/ -inbuf) { - var zlib = __webpack_require__(/*! zlib */ "zlib"); - - var opts = { - chunkSize: (parseInt(inbuf.length / 1024) + 1) * 1024 - }; - return { - deflate: function () { - return zlib.deflateRawSync(inbuf, opts); - }, - deflateAsync: function ( - /*Function*/ - callback) { - var tmp = zlib.createDeflateRaw(opts), - parts = [], - total = 0; - tmp.on('data', function (data) { - parts.push(data); - total += data.length; - }); - tmp.on('end', function () { - var buf = Buffer.alloc(total), - written = 0; - buf.fill(0); - - for (var i = 0; i < parts.length; i++) { - var part = parts[i]; - part.copy(buf, written); - written += part.length; - } - - callback && callback(buf); - }); - tmp.end(inbuf); - } - }; -}; - -/***/ }), - -/***/ "./packages/loot-core/node_modules/adm-zip/methods/index.js": -/*!******************************************************************!*\ - !*** ./packages/loot-core/node_modules/adm-zip/methods/index.js ***! - \******************************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -exports.Deflater = __webpack_require__(/*! ./deflater */ "./packages/loot-core/node_modules/adm-zip/methods/deflater.js"); -exports.Inflater = __webpack_require__(/*! ./inflater */ "./packages/loot-core/node_modules/adm-zip/methods/inflater.js"); - -/***/ }), - -/***/ "./packages/loot-core/node_modules/adm-zip/methods/inflater.js": -/*!*********************************************************************!*\ - !*** ./packages/loot-core/node_modules/adm-zip/methods/inflater.js ***! - \*********************************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -module.exports = function ( -/*Buffer*/ -inbuf) { - var zlib = __webpack_require__(/*! zlib */ "zlib"); - - return { - inflate: function () { - return zlib.inflateRawSync(inbuf); - }, - inflateAsync: function ( - /*Function*/ - callback) { - var tmp = zlib.createInflateRaw(), - parts = [], - total = 0; - tmp.on('data', function (data) { - parts.push(data); - total += data.length; - }); - tmp.on('end', function () { - var buf = Buffer.alloc(total), - written = 0; - buf.fill(0); - - for (var i = 0; i < parts.length; i++) { - var part = parts[i]; - part.copy(buf, written); - written += part.length; - } - - callback && callback(buf); - }); - tmp.end(inbuf); - } - }; -}; - -/***/ }), - -/***/ "./packages/loot-core/node_modules/adm-zip/util/constants.js": -/*!*******************************************************************!*\ - !*** ./packages/loot-core/node_modules/adm-zip/util/constants.js ***! - \*******************************************************************/ -/*! no static exports found */ -/***/ (function(module, exports) { - -module.exports = { - /* The local file header */ - LOCHDR: 30, - // LOC header size - LOCSIG: 0x04034b50, - // "PK\003\004" - LOCVER: 4, - // version needed to extract - LOCFLG: 6, - // general purpose bit flag - LOCHOW: 8, - // compression method - LOCTIM: 10, - // modification time (2 bytes time, 2 bytes date) - LOCCRC: 14, - // uncompressed file crc-32 value - LOCSIZ: 18, - // compressed size - LOCLEN: 22, - // uncompressed size - LOCNAM: 26, - // filename length - LOCEXT: 28, - // extra field length - - /* The Data descriptor */ - EXTSIG: 0x08074b50, - // "PK\007\008" - EXTHDR: 16, - // EXT header size - EXTCRC: 4, - // uncompressed file crc-32 value - EXTSIZ: 8, - // compressed size - EXTLEN: 12, - // uncompressed size - - /* The central directory file header */ - CENHDR: 46, - // CEN header size - CENSIG: 0x02014b50, - // "PK\001\002" - CENVEM: 4, - // version made by - CENVER: 6, - // version needed to extract - CENFLG: 8, - // encrypt, decrypt flags - CENHOW: 10, - // compression method - CENTIM: 12, - // modification time (2 bytes time, 2 bytes date) - CENCRC: 16, - // uncompressed file crc-32 value - CENSIZ: 20, - // compressed size - CENLEN: 24, - // uncompressed size - CENNAM: 28, - // filename length - CENEXT: 30, - // extra field length - CENCOM: 32, - // file comment length - CENDSK: 34, - // volume number start - CENATT: 36, - // internal file attributes - CENATX: 38, - // external file attributes (host system dependent) - CENOFF: 42, - // LOC header offset - - /* The entries in the end of central directory */ - ENDHDR: 22, - // END header size - ENDSIG: 0x06054b50, - // "PK\005\006" - ENDSUB: 8, - // number of entries on this disk - ENDTOT: 10, - // total number of entries - ENDSIZ: 12, - // central directory size in bytes - ENDOFF: 16, - // offset of first CEN header - ENDCOM: 20, - // zip file comment length - - /* Compression methods */ - STORED: 0, - // no compression - SHRUNK: 1, - // shrunk - REDUCED1: 2, - // reduced with compression factor 1 - REDUCED2: 3, - // reduced with compression factor 2 - REDUCED3: 4, - // reduced with compression factor 3 - REDUCED4: 5, - // reduced with compression factor 4 - IMPLODED: 6, - // imploded - // 7 reserved - DEFLATED: 8, - // deflated - ENHANCED_DEFLATED: 9, - // enhanced deflated - PKWARE: 10, - // PKWare DCL imploded - // 11 reserved - BZIP2: 12, - // compressed using BZIP2 - // 13 reserved - LZMA: 14, - // LZMA - // 15-17 reserved - IBM_TERSE: 18, - // compressed using IBM TERSE - IBM_LZ77: 19, - //IBM LZ77 z - - /* General purpose bit flag */ - FLG_ENC: 0, - // encripted file - FLG_COMP1: 1, - // compression option - FLG_COMP2: 2, - // compression option - FLG_DESC: 4, - // data descriptor - FLG_ENH: 8, - // enhanced deflation - FLG_STR: 16, - // strong encryption - FLG_LNG: 1024, - // language encoding - FLG_MSK: 4096, - // mask header values - - /* Load type */ - FILE: 0, - BUFFER: 1, - NONE: 2, - - /* 4.5 Extensible data fields */ - EF_ID: 0, - EF_SIZE: 2, - - /* Header IDs */ - ID_ZIP64: 0x0001, - ID_AVINFO: 0x0007, - ID_PFS: 0x0008, - ID_OS2: 0x0009, - ID_NTFS: 0x000a, - ID_OPENVMS: 0x000c, - ID_UNIX: 0x000d, - ID_FORK: 0x000e, - ID_PATCH: 0x000f, - ID_X509_PKCS7: 0x0014, - ID_X509_CERTID_F: 0x0015, - ID_X509_CERTID_C: 0x0016, - ID_STRONGENC: 0x0017, - ID_RECORD_MGT: 0x0018, - ID_X509_PKCS7_RL: 0x0019, - ID_IBM1: 0x0065, - ID_IBM2: 0x0066, - ID_POSZIP: 0x4690, - EF_ZIP64_OR_32: 0xffffffff, - EF_ZIP64_OR_16: 0xffff, - EF_ZIP64_SUNCOMP: 0, - EF_ZIP64_SCOMP: 8, - EF_ZIP64_RHO: 16, - EF_ZIP64_DSN: 24 -}; - -/***/ }), - -/***/ "./packages/loot-core/node_modules/adm-zip/util/errors.js": -/*!****************************************************************!*\ - !*** ./packages/loot-core/node_modules/adm-zip/util/errors.js ***! - \****************************************************************/ -/*! no static exports found */ -/***/ (function(module, exports) { - -module.exports = { - /* Header error messages */ - "INVALID_LOC": "Invalid LOC header (bad signature)", - "INVALID_CEN": "Invalid CEN header (bad signature)", - "INVALID_END": "Invalid END header (bad signature)", - - /* ZipEntry error messages*/ - "NO_DATA": "Nothing to decompress", - "BAD_CRC": "CRC32 checksum failed", - "FILE_IN_THE_WAY": "There is a file in the way: %s", - "UNKNOWN_METHOD": "Invalid/unsupported compression method", - - /* Inflater error messages */ - "AVAIL_DATA": "inflate::Available inflate data did not terminate", - "INVALID_DISTANCE": "inflate::Invalid literal/length or distance code in fixed or dynamic block", - "TO_MANY_CODES": "inflate::Dynamic block code description: too many length or distance codes", - "INVALID_REPEAT_LEN": "inflate::Dynamic block code description: repeat more than specified lengths", - "INVALID_REPEAT_FIRST": "inflate::Dynamic block code description: repeat lengths with no first length", - "INCOMPLETE_CODES": "inflate::Dynamic block code description: code lengths codes incomplete", - "INVALID_DYN_DISTANCE": "inflate::Dynamic block code description: invalid distance code lengths", - "INVALID_CODES_LEN": "inflate::Dynamic block code description: invalid literal/length code lengths", - "INVALID_STORE_BLOCK": "inflate::Stored block length did not match one's complement", - "INVALID_BLOCK_TYPE": "inflate::Invalid block type (type == 3)", - - /* ADM-ZIP error messages */ - "CANT_EXTRACT_FILE": "Could not extract the file", - "CANT_OVERRIDE": "Target file already exists", - "NO_ZIP": "No zip file was loaded", - "NO_ENTRY": "Entry doesn't exist", - "DIRECTORY_CONTENT_ERROR": "A directory cannot have content", - "FILE_NOT_FOUND": "File not found: %s", - "NOT_IMPLEMENTED": "Not implemented", - "INVALID_FILENAME": "Invalid filename", - "INVALID_FORMAT": "Invalid or unsupported zip format. No END header found" -}; - -/***/ }), - -/***/ "./packages/loot-core/node_modules/adm-zip/util/fattr.js": -/*!***************************************************************!*\ - !*** ./packages/loot-core/node_modules/adm-zip/util/fattr.js ***! - \***************************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -var fs = __webpack_require__(/*! ./fileSystem */ "./packages/loot-core/node_modules/adm-zip/util/fileSystem.js").require(), - pth = __webpack_require__(/*! path */ "path"); - -fs.existsSync = fs.existsSync || pth.existsSync; - -module.exports = function ( -/*String*/ -path) { - var _path = path || "", - _permissions = 0, - _obj = newAttr(), - _stat = null; - - function newAttr() { - return { - directory: false, - readonly: false, - hidden: false, - executable: false, - mtime: 0, - atime: 0 - }; - } - - if (_path && fs.existsSync(_path)) { - _stat = fs.statSync(_path); - _obj.directory = _stat.isDirectory(); - _obj.mtime = _stat.mtime; - _obj.atime = _stat.atime; - _obj.executable = !!(1 & parseInt((_stat.mode & parseInt("777", 8)).toString(8)[0])); - _obj.readonly = !!(2 & parseInt((_stat.mode & parseInt("777", 8)).toString(8)[0])); - _obj.hidden = pth.basename(_path)[0] === "."; - } else { - console.warn("Invalid path: " + _path); - } - - return { - get directory() { - return _obj.directory; - }, - - get readOnly() { - return _obj.readonly; - }, - - get hidden() { - return _obj.hidden; - }, - - get mtime() { - return _obj.mtime; - }, - - get atime() { - return _obj.atime; - }, - - get executable() { - return _obj.executable; - }, - - decodeAttributes: function (val) {}, - encodeAttributes: function (val) {}, - toString: function () { - return '{\n' + '\t"path" : "' + _path + ",\n" + '\t"isDirectory" : ' + _obj.directory + ",\n" + '\t"isReadOnly" : ' + _obj.readonly + ",\n" + '\t"isHidden" : ' + _obj.hidden + ",\n" + '\t"isExecutable" : ' + _obj.executable + ",\n" + '\t"mTime" : ' + _obj.mtime + "\n" + '\t"aTime" : ' + _obj.atime + "\n" + '}'; - } - }; -}; - -/***/ }), - -/***/ "./packages/loot-core/node_modules/adm-zip/util/fileSystem.js": -/*!********************************************************************!*\ - !*** ./packages/loot-core/node_modules/adm-zip/util/fileSystem.js ***! - \********************************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -exports.require = function () { - var fs = __webpack_require__(/*! fs */ "fs"); - - if (process.versions['electron']) { - try { - originalFs = __webpack_require__(!(function webpackMissingModule() { var e = new Error("Cannot find module 'original-fs'"); e.code = 'MODULE_NOT_FOUND'; throw e; }())); - - if (Object.keys(originalFs).length > 0) { - fs = originalFs; - } - } catch (e) {} - } - - return fs; -}; - -/***/ }), - -/***/ "./packages/loot-core/node_modules/adm-zip/util/index.js": -/*!***************************************************************!*\ - !*** ./packages/loot-core/node_modules/adm-zip/util/index.js ***! - \***************************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -module.exports = __webpack_require__(/*! ./utils */ "./packages/loot-core/node_modules/adm-zip/util/utils.js"); -module.exports.FileSystem = __webpack_require__(/*! ./fileSystem */ "./packages/loot-core/node_modules/adm-zip/util/fileSystem.js"); -module.exports.Constants = __webpack_require__(/*! ./constants */ "./packages/loot-core/node_modules/adm-zip/util/constants.js"); -module.exports.Errors = __webpack_require__(/*! ./errors */ "./packages/loot-core/node_modules/adm-zip/util/errors.js"); -module.exports.FileAttr = __webpack_require__(/*! ./fattr */ "./packages/loot-core/node_modules/adm-zip/util/fattr.js"); - -/***/ }), - -/***/ "./packages/loot-core/node_modules/adm-zip/util/utils.js": -/*!***************************************************************!*\ - !*** ./packages/loot-core/node_modules/adm-zip/util/utils.js ***! - \***************************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -var fs = __webpack_require__(/*! ./fileSystem */ "./packages/loot-core/node_modules/adm-zip/util/fileSystem.js").require(), - pth = __webpack_require__(/*! path */ "path"); - -fs.existsSync = fs.existsSync || pth.existsSync; - -module.exports = function () { - var crcTable = [], - Constants = __webpack_require__(/*! ./constants */ "./packages/loot-core/node_modules/adm-zip/util/constants.js"), - Errors = __webpack_require__(/*! ./errors */ "./packages/loot-core/node_modules/adm-zip/util/errors.js"), - PATH_SEPARATOR = pth.sep; - - function mkdirSync( - /*String*/ - path) { - var resolvedPath = path.split(PATH_SEPARATOR)[0]; - path.split(PATH_SEPARATOR).forEach(function (name) { - if (!name || name.substr(-1, 1) === ":") return; - resolvedPath += PATH_SEPARATOR + name; - var stat; - - try { - stat = fs.statSync(resolvedPath); - } catch (e) { - fs.mkdirSync(resolvedPath); - } - - if (stat && stat.isFile()) throw Errors.FILE_IN_THE_WAY.replace("%s", resolvedPath); - }); - } - - function findSync( - /*String*/ - dir, - /*RegExp*/ - pattern, - /*Boolean*/ - recoursive) { - if (typeof pattern === 'boolean') { - recoursive = pattern; - pattern = undefined; - } - - var files = []; - fs.readdirSync(dir).forEach(function (file) { - var path = pth.join(dir, file); - if (fs.statSync(path).isDirectory() && recoursive) files = files.concat(findSync(path, pattern, recoursive)); - - if (!pattern || pattern.test(path)) { - files.push(pth.normalize(path) + (fs.statSync(path).isDirectory() ? PATH_SEPARATOR : "")); - } - }); - return files; - } - - return { - makeDir: function ( - /*String*/ - path) { - mkdirSync(path); - }, - crc32: function (buf) { - if (typeof buf === 'string') { - buf = Buffer.alloc(buf.length, buf); - } - - var b = Buffer.alloc(4); - - if (!crcTable.length) { - for (var n = 0; n < 256; n++) { - var c = n; - - for (var k = 8; --k >= 0;) // - if ((c & 1) !== 0) { - c = 0xedb88320 ^ c >>> 1; - } else { - c = c >>> 1; - } - - if (c < 0) { - b.writeInt32LE(c, 0); - c = b.readUInt32LE(0); - } - - crcTable[n] = c; - } - } - - var crc = 0, - off = 0, - len = buf.length, - c1 = ~crc; - - while (--len >= 0) c1 = crcTable[(c1 ^ buf[off++]) & 0xff] ^ c1 >>> 8; - - crc = ~c1; - b.writeInt32LE(crc & 0xffffffff, 0); - return b.readUInt32LE(0); - }, - methodToString: function ( - /*Number*/ - method) { - switch (method) { - case Constants.STORED: - return 'STORED (' + method + ')'; - - case Constants.DEFLATED: - return 'DEFLATED (' + method + ')'; - - default: - return 'UNSUPPORTED (' + method + ')'; - } - }, - writeFileTo: function ( - /*String*/ - path, - /*Buffer*/ - content, - /*Boolean*/ - overwrite, - /*Number*/ - attr) { - if (fs.existsSync(path)) { - if (!overwrite) return false; // cannot overwrite - - var stat = fs.statSync(path); - - if (stat.isDirectory()) { - return false; - } - } - - var folder = pth.dirname(path); - - if (!fs.existsSync(folder)) { - mkdirSync(folder); - } - - var fd; - - try { - fd = fs.openSync(path, 'w', 438); // 0666 - } catch (e) { - fs.chmodSync(path, 438); - fd = fs.openSync(path, 'w', 438); - } - - if (fd) { - try { - fs.writeSync(fd, content, 0, content.length, 0); - } catch (e) { - throw e; - } finally { - fs.closeSync(fd); - } - } - - fs.chmodSync(path, attr || 438); - return true; - }, - writeFileToAsync: function ( - /*String*/ - path, - /*Buffer*/ - content, - /*Boolean*/ - overwrite, - /*Number*/ - attr, - /*Function*/ - callback) { - if (typeof attr === 'function') { - callback = attr; - attr = undefined; - } - - fs.exists(path, function (exists) { - if (exists && !overwrite) return callback(false); - fs.stat(path, function (err, stat) { - if (exists && stat.isDirectory()) { - return callback(false); - } - - var folder = pth.dirname(path); - fs.exists(folder, function (exists) { - if (!exists) mkdirSync(folder); - fs.open(path, 'w', 438, function (err, fd) { - if (err) { - fs.chmod(path, 438, function () { - fs.open(path, 'w', 438, function (err, fd) { - fs.write(fd, content, 0, content.length, 0, function () { - fs.close(fd, function () { - fs.chmod(path, attr || 438, function () { - callback(true); - }); - }); - }); - }); - }); - } else { - if (fd) { - fs.write(fd, content, 0, content.length, 0, function () { - fs.close(fd, function () { - fs.chmod(path, attr || 438, function () { - callback(true); - }); - }); - }); - } else { - fs.chmod(path, attr || 438, function () { - callback(true); - }); - } - } - }); - }); - }); - }); - }, - findFiles: function ( - /*String*/ - path) { - return findSync(path, true); - }, - getAttributes: function ( - /*String*/ - path) {}, - setAttributes: function ( - /*String*/ - path) {}, - toBuffer: function (input) { - if (Buffer.isBuffer(input)) { - return input; - } else { - if (input.length === 0) { - return Buffer.alloc(0); - } - - return Buffer.from(input, 'utf8'); - } - }, - Constants: Constants, - Errors: Errors - }; -}(); - -/***/ }), - -/***/ "./packages/loot-core/node_modules/adm-zip/zipEntry.js": -/*!*************************************************************!*\ - !*** ./packages/loot-core/node_modules/adm-zip/zipEntry.js ***! - \*************************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -var Utils = __webpack_require__(/*! ./util */ "./packages/loot-core/node_modules/adm-zip/util/index.js"), - Headers = __webpack_require__(/*! ./headers */ "./packages/loot-core/node_modules/adm-zip/headers/index.js"), - Constants = Utils.Constants, - Methods = __webpack_require__(/*! ./methods */ "./packages/loot-core/node_modules/adm-zip/methods/index.js"); - -module.exports = function ( -/*Buffer*/ -input) { - var _entryHeader = new Headers.EntryHeader(), - _entryName = Buffer.alloc(0), - _comment = Buffer.alloc(0), - _isDirectory = false, - uncompressedData = null, - _extra = Buffer.alloc(0); - - function getCompressedDataFromZip() { - if (!input || !Buffer.isBuffer(input)) { - return Buffer.alloc(0); - } - - _entryHeader.loadDataHeaderFromBinary(input); - - return input.slice(_entryHeader.realDataOffset, _entryHeader.realDataOffset + _entryHeader.compressedSize); - } - - function crc32OK(data) { - // if bit 3 (0x08) of the general-purpose flags field is set, then the CRC-32 and file sizes are not known when the header is written - if ((_entryHeader.flags & 0x8) !== 0x8) { - if (Utils.crc32(data) !== _entryHeader.dataHeader.crc) { - return false; - } - } else {// @TODO: load and check data descriptor header - // The fields in the local header are filled with zero, and the CRC-32 and size are appended in a 12-byte structure - // (optionally preceded by a 4-byte signature) immediately after the compressed data: - } - - return true; - } - - function decompress( - /*Boolean*/ - async, - /*Function*/ - callback, - /*String*/ - pass) { - if (typeof callback === 'undefined' && typeof async === 'string') { - pass = async; - async = void 0; - } - - if (_isDirectory) { - if (async && callback) { - callback(Buffer.alloc(0), Utils.Errors.DIRECTORY_CONTENT_ERROR); //si added error. - } - - return Buffer.alloc(0); - } - - var compressedData = getCompressedDataFromZip(); - - if (compressedData.length === 0) { - if (async && callback) callback(compressedData, Utils.Errors.NO_DATA); //si added error. - - return compressedData; - } - - var data = Buffer.alloc(_entryHeader.size); - - switch (_entryHeader.method) { - case Utils.Constants.STORED: - compressedData.copy(data); - - if (!crc32OK(data)) { - if (async && callback) callback(data, Utils.Errors.BAD_CRC); //si added error - - return Utils.Errors.BAD_CRC; - } else { - //si added otherwise did not seem to return data. - if (async && callback) callback(data); - return data; - } - - case Utils.Constants.DEFLATED: - var inflater = new Methods.Inflater(compressedData); - - if (!async) { - var result = inflater.inflate(data); - result.copy(data, 0); - - if (!crc32OK(data)) { - console.warn(Utils.Errors.BAD_CRC + " " + _entryName.toString()); - } - - return data; - } else { - inflater.inflateAsync(function (result) { - result.copy(data, 0); - - if (!crc32OK(data)) { - if (callback) callback(data, Utils.Errors.BAD_CRC); //si added error - } else { - //si added otherwise did not seem to return data. - if (callback) callback(data); - } - }); - } - - break; - - default: - if (async && callback) callback(Buffer.alloc(0), Utils.Errors.UNKNOWN_METHOD); - return Utils.Errors.UNKNOWN_METHOD; - } - } - - function compress( - /*Boolean*/ - async, - /*Function*/ - callback) { - if ((!uncompressedData || !uncompressedData.length) && Buffer.isBuffer(input)) { - // no data set or the data wasn't changed to require recompression - if (async && callback) callback(getCompressedDataFromZip()); - return getCompressedDataFromZip(); - } - - if (uncompressedData.length && !_isDirectory) { - var compressedData; // Local file header - - switch (_entryHeader.method) { - case Utils.Constants.STORED: - _entryHeader.compressedSize = _entryHeader.size; - compressedData = Buffer.alloc(uncompressedData.length); - uncompressedData.copy(compressedData); - if (async && callback) callback(compressedData); - return compressedData; - - default: - case Utils.Constants.DEFLATED: - var deflater = new Methods.Deflater(uncompressedData); - - if (!async) { - var deflated = deflater.deflate(); - _entryHeader.compressedSize = deflated.length; - return deflated; - } else { - deflater.deflateAsync(function (data) { - compressedData = Buffer.alloc(data.length); - _entryHeader.compressedSize = data.length; - data.copy(compressedData); - callback && callback(compressedData); - }); - } - - deflater = null; - break; - } - } else { - if (async && callback) { - callback(Buffer.alloc(0)); - } else { - return Buffer.alloc(0); - } - } - } - - function readUInt64LE(buffer, offset) { - return (buffer.readUInt32LE(offset + 4) << 4) + buffer.readUInt32LE(offset); - } - - function parseExtra(data) { - var offset = 0; - var signature, size, part; - - while (offset < data.length) { - signature = data.readUInt16LE(offset); - offset += 2; - size = data.readUInt16LE(offset); - offset += 2; - part = data.slice(offset, offset + size); - offset += size; - - if (Constants.ID_ZIP64 === signature) { - parseZip64ExtendedInformation(part); - } - } - } //Override header field values with values from the ZIP64 extra field - - - function parseZip64ExtendedInformation(data) { - var size, compressedSize, offset, diskNumStart; - - if (data.length >= Constants.EF_ZIP64_SCOMP) { - size = readUInt64LE(data, Constants.EF_ZIP64_SUNCOMP); - - if (_entryHeader.size === Constants.EF_ZIP64_OR_32) { - _entryHeader.size = size; - } - } - - if (data.length >= Constants.EF_ZIP64_RHO) { - compressedSize = readUInt64LE(data, Constants.EF_ZIP64_SCOMP); - - if (_entryHeader.compressedSize === Constants.EF_ZIP64_OR_32) { - _entryHeader.compressedSize = compressedSize; - } - } - - if (data.length >= Constants.EF_ZIP64_DSN) { - offset = readUInt64LE(data, Constants.EF_ZIP64_RHO); - - if (_entryHeader.offset === Constants.EF_ZIP64_OR_32) { - _entryHeader.offset = offset; - } - } - - if (data.length >= Constants.EF_ZIP64_DSN + 4) { - diskNumStart = data.readUInt32LE(Constants.EF_ZIP64_DSN); - - if (_entryHeader.diskNumStart === Constants.EF_ZIP64_OR_16) { - _entryHeader.diskNumStart = diskNumStart; - } - } - } - - return { - get entryName() { - return _entryName.toString(); - }, - - get rawEntryName() { - return _entryName; - }, - - set entryName(val) { - _entryName = Utils.toBuffer(val); - var lastChar = _entryName[_entryName.length - 1]; - _isDirectory = lastChar === 47 || lastChar === 92; - _entryHeader.fileNameLength = _entryName.length; - }, - - get extra() { - return _extra; - }, - - set extra(val) { - _extra = val; - _entryHeader.extraLength = val.length; - parseExtra(val); - }, - - get comment() { - return _comment.toString(); - }, - - set comment(val) { - _comment = Utils.toBuffer(val); - _entryHeader.commentLength = _comment.length; - }, - - get name() { - var n = _entryName.toString(); - - return _isDirectory ? n.substr(n.length - 1).split("/").pop() : n.split("/").pop(); - }, - - get isDirectory() { - return _isDirectory; - }, - - getCompressedData: function () { - return compress(false, null); - }, - getCompressedDataAsync: function ( - /*Function*/ - callback) { - compress(true, callback); - }, - setData: function (value) { - uncompressedData = Utils.toBuffer(value); - - if (!_isDirectory && uncompressedData.length) { - _entryHeader.size = uncompressedData.length; - _entryHeader.method = Utils.Constants.DEFLATED; - _entryHeader.crc = Utils.crc32(value); - _entryHeader.changed = true; - } else { - // folders and blank files should be stored - _entryHeader.method = Utils.Constants.STORED; - } - }, - getData: function (pass) { - if (_entryHeader.changed) { - return uncompressedData; - } else { - return decompress(false, null, pass); - } - }, - getDataAsync: function ( - /*Function*/ - callback, pass) { - if (_entryHeader.changed) { - callback(uncompressedData); - } else { - decompress(true, callback, pass); - } - }, - - set attr(attr) { - _entryHeader.attr = attr; - }, - - get attr() { - return _entryHeader.attr; - }, - - set header( - /*Buffer*/ - data) { - _entryHeader.loadFromBinary(data); - }, - - get header() { - return _entryHeader; - }, - - packHeader: function () { - var header = _entryHeader.entryHeaderToBinary(); // add - - - _entryName.copy(header, Utils.Constants.CENHDR); - - if (_entryHeader.extraLength) { - _extra.copy(header, Utils.Constants.CENHDR + _entryName.length); - } - - if (_entryHeader.commentLength) { - _comment.copy(header, Utils.Constants.CENHDR + _entryName.length + _entryHeader.extraLength, _comment.length); - } - - return header; - }, - toString: function () { - return '{\n' + '\t"entryName" : "' + _entryName.toString() + "\",\n" + '\t"name" : "' + (_isDirectory ? _entryName.toString().replace(/\/$/, '').split("/").pop() : _entryName.toString().split("/").pop()) + "\",\n" + '\t"comment" : "' + _comment.toString() + "\",\n" + '\t"isDirectory" : ' + _isDirectory + ",\n" + '\t"header" : ' + _entryHeader.toString().replace(/\t/mg, "\t\t").replace(/}/mg, "\t}") + ",\n" + '\t"compressedData" : <' + (input && input.length + " bytes buffer" || "null") + ">\n" + '\t"data" : <' + (uncompressedData && uncompressedData.length + " bytes buffer" || "null") + ">\n" + '}'; - } - }; -}; - -/***/ }), - -/***/ "./packages/loot-core/node_modules/adm-zip/zipFile.js": -/*!************************************************************!*\ - !*** ./packages/loot-core/node_modules/adm-zip/zipFile.js ***! - \************************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -var ZipEntry = __webpack_require__(/*! ./zipEntry */ "./packages/loot-core/node_modules/adm-zip/zipEntry.js"), - Headers = __webpack_require__(/*! ./headers */ "./packages/loot-core/node_modules/adm-zip/headers/index.js"), - Utils = __webpack_require__(/*! ./util */ "./packages/loot-core/node_modules/adm-zip/util/index.js"); - -module.exports = function ( -/*String|Buffer*/ -input, -/*Number*/ -inputType) { - var entryList = [], - entryTable = {}, - _comment = Buffer.alloc(0), - filename = "", - fs = Utils.FileSystem.require(), - inBuffer = null, - mainHeader = new Headers.MainHeader(); - - if (inputType === Utils.Constants.FILE) { - // is a filename - filename = input; - inBuffer = fs.readFileSync(filename); - readMainHeader(); - } else if (inputType === Utils.Constants.BUFFER) { - // is a memory buffer - inBuffer = input; - readMainHeader(); - } else {// none. is a new file - } - - function readEntries() { - entryTable = {}; - entryList = new Array(mainHeader.diskEntries); // total number of entries - - var index = mainHeader.offset; // offset of first CEN header - - for (var i = 0; i < entryList.length; i++) { - var tmp = index, - entry = new ZipEntry(inBuffer); - entry.header = inBuffer.slice(tmp, tmp += Utils.Constants.CENHDR); - entry.entryName = inBuffer.slice(tmp, tmp += entry.header.fileNameLength); - - if (entry.header.extraLength) { - entry.extra = inBuffer.slice(tmp, tmp += entry.header.extraLength); - } - - if (entry.header.commentLength) entry.comment = inBuffer.slice(tmp, tmp + entry.header.commentLength); - index += entry.header.entryHeaderSize; - entryList[i] = entry; - entryTable[entry.entryName] = entry; - } - } - - function readMainHeader() { - var i = inBuffer.length - Utils.Constants.ENDHDR, - // END header size - n = Math.max(0, i - 0xFFFF), - // 0xFFFF is the max zip file comment length - endOffset = -1; // Start offset of the END header - - for (i; i >= n; i--) { - if (inBuffer[i] !== 0x50) continue; // quick check that the byte is 'P' - - if (inBuffer.readUInt32LE(i) === Utils.Constants.ENDSIG) { - // "PK\005\006" - endOffset = i; - break; - } - } - - if (!~endOffset) throw Utils.Errors.INVALID_FORMAT; - mainHeader.loadFromBinary(inBuffer.slice(endOffset, endOffset + Utils.Constants.ENDHDR)); - - if (mainHeader.commentLength) { - _comment = inBuffer.slice(endOffset + Utils.Constants.ENDHDR); - } - - readEntries(); - } - - return { - /** - * Returns an array of ZipEntry objects existent in the current opened archive - * @return Array - */ - get entries() { - return entryList; - }, - - /** - * Archive comment - * @return {String} - */ - get comment() { - return _comment.toString(); - }, - - set comment(val) { - mainHeader.commentLength = val.length; - _comment = val; - }, - - /** - * Returns a reference to the entry with the given name or null if entry is inexistent - * - * @param entryName - * @return ZipEntry - */ - getEntry: function ( - /*String*/ - entryName) { - return entryTable[entryName] || null; - }, - - /** - * Adds the given entry to the entry list - * - * @param entry - */ - setEntry: function ( - /*ZipEntry*/ - entry) { - entryList.push(entry); - entryTable[entry.entryName] = entry; - mainHeader.totalEntries = entryList.length; - }, - - /** - * Removes the entry with the given name from the entry list. - * - * If the entry is a directory, then all nested files and directories will be removed - * @param entryName - */ - deleteEntry: function ( - /*String*/ - entryName) { - var entry = entryTable[entryName]; - - if (entry && entry.isDirectory) { - var _self = this; - - this.getEntryChildren(entry).forEach(function (child) { - if (child.entryName !== entryName) { - _self.deleteEntry(child.entryName); - } - }); - } - - entryList.splice(entryList.indexOf(entry), 1); - delete entryTable[entryName]; - mainHeader.totalEntries = entryList.length; - }, - - /** - * Iterates and returns all nested files and directories of the given entry - * - * @param entry - * @return Array - */ - getEntryChildren: function ( - /*ZipEntry*/ - entry) { - if (entry.isDirectory) { - var list = [], - name = entry.entryName, - len = name.length; - entryList.forEach(function (zipEntry) { - if (zipEntry.entryName.substr(0, len) === name) { - list.push(zipEntry); - } - }); - return list; - } - - return []; - }, - - /** - * Returns the zip file - * - * @return Buffer - */ - compressToBuffer: function () { - if (entryList.length > 1) { - entryList.sort(function (a, b) { - var nameA = a.entryName.toLowerCase(); - var nameB = b.entryName.toLowerCase(); - - if (nameA < nameB) { - return -1; - } - - if (nameA > nameB) { - return 1; - } - - return 0; - }); - } - - var totalSize = 0, - dataBlock = [], - entryHeaders = [], - dindex = 0; - mainHeader.size = 0; - mainHeader.offset = 0; - entryList.forEach(function (entry) { - // compress data and set local and entry header accordingly. Reason why is called first - var compressedData = entry.getCompressedData(); // data header - - entry.header.offset = dindex; - var dataHeader = entry.header.dataHeaderToBinary(); - var entryNameLen = entry.rawEntryName.length; - var extra = entry.extra.toString(); - var postHeader = Buffer.alloc(entryNameLen + extra.length); - entry.rawEntryName.copy(postHeader, 0); - postHeader.fill(extra, entryNameLen); - var dataLength = dataHeader.length + postHeader.length + compressedData.length; - dindex += dataLength; - dataBlock.push(dataHeader); - dataBlock.push(postHeader); - dataBlock.push(compressedData); - var entryHeader = entry.packHeader(); - entryHeaders.push(entryHeader); - mainHeader.size += entryHeader.length; - totalSize += dataLength + entryHeader.length; - }); - totalSize += mainHeader.mainHeaderSize; // also includes zip file comment length - // point to end of data and beginning of central directory first record - - mainHeader.offset = dindex; - dindex = 0; - var outBuffer = Buffer.alloc(totalSize); - dataBlock.forEach(function (content) { - content.copy(outBuffer, dindex); // write data blocks - - dindex += content.length; - }); - entryHeaders.forEach(function (content) { - content.copy(outBuffer, dindex); // write central directory entries - - dindex += content.length; - }); - var mh = mainHeader.toBinary(); - - if (_comment) { - _comment.copy(mh, Utils.Constants.ENDHDR); // add zip file comment - - } - - mh.copy(outBuffer, dindex); // write main header - - return outBuffer; - }, - toAsyncBuffer: function ( - /*Function*/ - onSuccess, - /*Function*/ - onFail, - /*Function*/ - onItemStart, - /*Function*/ - onItemEnd) { - if (entryList.length > 1) { - entryList.sort(function (a, b) { - var nameA = a.entryName.toLowerCase(); - var nameB = b.entryName.toLowerCase(); - - if (nameA > nameB) { - return -1; - } - - if (nameA < nameB) { - return 1; - } - - return 0; - }); - } - - var totalSize = 0, - dataBlock = [], - entryHeaders = [], - dindex = 0; - mainHeader.size = 0; - mainHeader.offset = 0; - - var compress = function (entryList) { - var self = arguments.callee; - - if (entryList.length) { - var entry = entryList.pop(); - var name = entry.entryName + entry.extra.toString(); - if (onItemStart) onItemStart(name); - entry.getCompressedDataAsync(function (compressedData) { - if (onItemEnd) onItemEnd(name); - entry.header.offset = dindex; // data header - - var dataHeader = entry.header.dataHeaderToBinary(); - var postHeader; - - try { - postHeader = Buffer.alloc(name.length, name); // using alloc will work on node 5.x+ - } catch (e) { - postHeader = new Buffer(name); // use deprecated method if alloc fails... - } - - var dataLength = dataHeader.length + postHeader.length + compressedData.length; - dindex += dataLength; - dataBlock.push(dataHeader); - dataBlock.push(postHeader); - dataBlock.push(compressedData); - var entryHeader = entry.packHeader(); - entryHeaders.push(entryHeader); - mainHeader.size += entryHeader.length; - totalSize += dataLength + entryHeader.length; - - if (entryList.length) { - self(entryList); - } else { - totalSize += mainHeader.mainHeaderSize; // also includes zip file comment length - // point to end of data and beginning of central directory first record - - mainHeader.offset = dindex; - dindex = 0; - var outBuffer = Buffer.alloc(totalSize); - dataBlock.forEach(function (content) { - content.copy(outBuffer, dindex); // write data blocks - - dindex += content.length; - }); - entryHeaders.forEach(function (content) { - content.copy(outBuffer, dindex); // write central directory entries - - dindex += content.length; - }); - var mh = mainHeader.toBinary(); - - if (_comment) { - _comment.copy(mh, Utils.Constants.ENDHDR); // add zip file comment - - } - - mh.copy(outBuffer, dindex); // write main header - - onSuccess(outBuffer); - } - }); - } - }; - - compress(entryList); - } - }; -}; - -/***/ }), - -/***/ "./packages/loot-core/node_modules/mitt/dist/mitt.es.js": -/*!**************************************************************!*\ - !*** ./packages/loot-core/node_modules/mitt/dist/mitt.es.js ***! - \**************************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony default export */ __webpack_exports__["default"] = (function (n) { - return { - all: n = n || new Map(), - on: function (t, e) { - var i = n.get(t); - i && i.push(e) || n.set(t, [e]); - }, - off: function (t, e) { - var i = n.get(t); - i && i.splice(i.indexOf(e) >>> 0, 1); - }, - emit: function (t, e) { - (n.get(t) || []).slice().map(function (n) { - n(e); - }), (n.get("*") || []).slice().map(function (n) { - n(t, e); - }); - } - }; -}); - -/***/ }), - -/***/ "./packages/loot-core/src/mocks/budget.js": -/*!************************************************!*\ - !*** ./packages/loot-core/src/mocks/budget.js ***! - \************************************************/ -/*! exports provided: createTestBudget */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createTestBudget", function() { return createTestBudget; }); -/* harmony import */ var _shared_months__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../shared/months */ "./packages/loot-core/src/shared/months.js"); -/* harmony import */ var _server_sheet__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../server/sheet */ "./packages/loot-core/src/server/sheet.js"); -/* harmony import */ var _server_budget_base__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../server/budget/base */ "./packages/loot-core/src/server/budget/base.js"); -/* harmony import */ var _server_db__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../server/db */ "./packages/loot-core/src/server/db/index.js"); -/* harmony import */ var _server_prefs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../server/prefs */ "./packages/loot-core/src/server/prefs.js"); -/* harmony import */ var _server_budget_actions__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../server/budget/actions */ "./packages/loot-core/src/server/budget/actions.js"); -/* harmony import */ var _server_aql_schema_run_query__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../server/aql/schema/run-query */ "./packages/loot-core/src/server/aql/schema/run-query.js"); -/* harmony import */ var _server_sync__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../server/sync */ "./packages/loot-core/src/server/sync/index.js"); -/* harmony import */ var _server_mutators__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../server/mutators */ "./packages/loot-core/src/server/mutators.js"); -/* harmony import */ var _server_accounts_sync__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../server/accounts/sync */ "./packages/loot-core/src/server/accounts/sync.js"); -/* harmony import */ var _shared_query__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../shared/query */ "./packages/loot-core/src/shared/query.js"); -function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } - -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } - -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 pickRandom(list) { - return list[(Math.random() * list.length | 0) % list.length]; -} - -function number(start, end) { - return start + (end - start) * Math.random(); -} - -function integer(start, end) { - return number(start, end) | 0; -} - -function findMin(items, field) { - let item = items[0]; - - for (let i = 0; i < items.length; i++) { - if (items[i][field] < item[field]) { - item = items[i]; - } - } - - return item; -} - -function getStartingBalanceCat(categories) { - return categories.find(c => c.name === 'Starting Balances').id; -} - -function extractCommonThings(payees, groups) { - let incomePayee = payees.find(p => p.name === 'Deposit'); - let expensePayees = payees.filter(p => p.name !== 'Deposit' && p.name !== 'Starting Balance'); - let expenseGroup = groups.find(g => g.is_income === 0); - let incomeGroup = groups.find(g => g.is_income === 1); - let categories = expenseGroup.categories.filter(c => ['Food', 'Restaurants', 'Entertainment', 'Clothing', 'General', 'Gift', 'Medical'].indexOf(c.name) !== -1); - return { - incomePayee, - expensePayees: expensePayees.filter(p => !p.bill), - incomeGroup, - expenseCategories: categories, - billCategories: groups.find(g => g.name === 'Bills').categories, - billPayees: expensePayees.filter(p => p.bill) - }; -} - -async function fillPrimaryChecking(handlers, account, payees, groups) { - let _extractCommonThings = extractCommonThings(payees, groups), - incomePayee = _extractCommonThings.incomePayee, - expensePayees = _extractCommonThings.expensePayees, - incomeGroup = _extractCommonThings.incomeGroup, - expenseCategories = _extractCommonThings.expenseCategories, - billCategories = _extractCommonThings.billCategories, - billPayees = _extractCommonThings.billPayees; - - let numTransactions = integer(100, 200); - let transactions = []; - - for (let i = 0; i < numTransactions; i++) { - let payee; - - if (Math.random() < 0.09) { - payee = incomePayee; - } else { - payee = pickRandom(expensePayees); - } - - let category; - - if (payee.name === 'Deposit') { - category = incomeGroup.categories.find(c => c.name === 'Income'); - } else { - category = pickRandom(expenseCategories); - } - - let amount; - - if (payee.name === 'Deposit') { - amount = integer(50000, 70000); - } else { - amount = integer(0, Math.random() < 0.05 ? -8000 : -700); - } - - let transaction = { - amount, - payee: payee.id, - account: account.id, - date: _shared_months__WEBPACK_IMPORTED_MODULE_0__["subDays"](_shared_months__WEBPACK_IMPORTED_MODULE_0__["currentDay"](), i / 3 | 0), - category: category.id - }; - transactions.push(transaction); - - if (Math.random() < 0.2) { - let a = transaction.amount / 3 | 0; - - let pick = () => payee === incomePayee ? incomeGroup.categories.find(c => c.name === 'Income').id : pickRandom(expenseCategories).id; - - transaction.subtransactions = [{ - amount: a, - category: pick() - }, { - amount: a, - category: pick() - }, { - amount: transaction.amount - a * 2, - category: pick() - }]; - } - } - - let earliestMonth = _shared_months__WEBPACK_IMPORTED_MODULE_0__["monthFromDate"](transactions[transactions.length - 1].date); - let months = _shared_months__WEBPACK_IMPORTED_MODULE_0__["rangeInclusive"](earliestMonth, _shared_months__WEBPACK_IMPORTED_MODULE_0__["currentMonth"]()); - let currentDay = _shared_months__WEBPACK_IMPORTED_MODULE_0__["currentDay"](); - - for (let month of months) { - let date = _shared_months__WEBPACK_IMPORTED_MODULE_0__["addDays"](month, '12'); - - if (_shared_months__WEBPACK_IMPORTED_MODULE_0__["isBefore"](date, currentDay)) { - transactions.push({ - amount: -10000, - payee: billPayees.find(p => p.name.toLowerCase().includes('power')).id, - account: account.id, - date, - category: billCategories.find(c => c.name === 'Power').id - }); - } - - date = _shared_months__WEBPACK_IMPORTED_MODULE_0__["addDays"](month, '18'); - - if (_shared_months__WEBPACK_IMPORTED_MODULE_0__["isBefore"](date, currentDay)) { - transactions.push({ - amount: -9000, - payee: billPayees.find(p => p.name.toLowerCase().includes('water')).id, - account: account.id, - date, - category: billCategories.find(c => c.name === 'Water').id - }); - } - - date = _shared_months__WEBPACK_IMPORTED_MODULE_0__["addDays"](month, '2'); - - if (_shared_months__WEBPACK_IMPORTED_MODULE_0__["isBefore"](date, currentDay)) { - transactions.push({ - amount: -120000, - payee: billPayees.find(p => p.name.toLowerCase().includes('housy')).id, - account: account.id, - date, - category: billCategories.find(c => c.name === 'Mortgage').id - }); - } - - date = _shared_months__WEBPACK_IMPORTED_MODULE_0__["addDays"](month, '20'); - - if (_shared_months__WEBPACK_IMPORTED_MODULE_0__["isBefore"](date, currentDay)) { - transactions.push({ - amount: -6000, - payee: billPayees.find(p => p.name.toLowerCase().includes('internet')).id, - account: account.id, - date, - category: billCategories.find(c => c.name === 'Internet').id - }); - } - - date = _shared_months__WEBPACK_IMPORTED_MODULE_0__["addDays"](month, '23'); - - if (_shared_months__WEBPACK_IMPORTED_MODULE_0__["isBefore"](date, currentDay)) { - transactions.push({ - amount: -7500, - payee: billPayees.find(p => p.name.toLowerCase().includes('t-mobile')).id, - account: account.id, - date, - category: billCategories.find(c => c.name === 'Cell').id - }); - } - } - - let earliestDate = null; - transactions.forEach(t => { - if (earliestDate == null || t.date < earliestDate) { - earliestDate = t.date; - } - }); - transactions.unshift({ - amount: 100000, - payee: payees.find(p => p.name === 'Starting Balance').id, - account: account.id, - date: earliestDate, - category: getStartingBalanceCat(incomeGroup.categories), - starting_balance_flag: true - }); - return Object(_server_accounts_sync__WEBPACK_IMPORTED_MODULE_9__["addTransactions"])(account.id, transactions); -} - -async function fillChecking(handlers, account, payees, groups) { - let _extractCommonThings2 = extractCommonThings(payees, groups), - incomePayee = _extractCommonThings2.incomePayee, - expensePayees = _extractCommonThings2.expensePayees, - incomeGroup = _extractCommonThings2.incomeGroup, - expenseCategories = _extractCommonThings2.expenseCategories; - - let numTransactions = integer(20, 40); - let transactions = []; - - for (let i = 0; i < numTransactions; i++) { - let payee; - - if (Math.random() < 0.04) { - payee = incomePayee; - } else { - payee = pickRandom(expensePayees); - } - - let category; - - if (payee.name === 'Deposit') { - category = incomeGroup.categories.find(c => c.name === 'Income'); - } else { - category = pickRandom(expenseCategories); - } - - let amount = payee.name === 'Deposit' ? integer(50000, 70000) : integer(0, -10000); - transactions.push({ - amount, - payee: payee.id, - account: account.id, - date: _shared_months__WEBPACK_IMPORTED_MODULE_0__["subDays"](_shared_months__WEBPACK_IMPORTED_MODULE_0__["currentDay"](), i * 2 | 0), - category: category.id - }); - } - - transactions.unshift({ - amount: integer(90000, 120000), - payee: payees.find(p => p.name === 'Starting Balance').id, - account: account.id, - date: transactions[transactions.length - 1].date, - category: getStartingBalanceCat(incomeGroup.categories), - starting_balance_flag: true - }); - await handlers['transactions-batch-update']({ - added: transactions, - fastMode: true - }); -} - -async function fillInvestment(handlers, account, payees, groups) { - let _extractCommonThings3 = extractCommonThings(payees, groups), - incomePayee = _extractCommonThings3.incomePayee, - expensePayees = _extractCommonThings3.expensePayees, - incomeGroup = _extractCommonThings3.incomeGroup, - expenseCategories = _extractCommonThings3.expenseCategories; - - let numTransactions = integer(10, 30); - let transactions = []; - - for (let i = 0; i < numTransactions; i++) { - let payee = incomePayee; - let category = incomeGroup.categories.find(c => c.name === 'Income'); - let amount = integer(10000, 20000); - transactions.push({ - amount, - payee: payee.id, - account: account.id, - date: _shared_months__WEBPACK_IMPORTED_MODULE_0__["subDays"](_shared_months__WEBPACK_IMPORTED_MODULE_0__["currentDay"](), integer(10, 360)), - category: category.id - }); - } - - transactions.unshift({ - amount: integer(10000, 20000), - payee: payees.find(p => p.name === 'Starting Balance').id, - account: account.id, - date: findMin(transactions, 'date').date, - category: getStartingBalanceCat(incomeGroup.categories), - starting_balance_flag: true - }); - await handlers['transactions-batch-update']({ - added: transactions, - fastMode: true - }); -} - -async function fillSavings(handlers, account, payees, groups) { - let _extractCommonThings4 = extractCommonThings(payees, groups), - incomePayee = _extractCommonThings4.incomePayee, - expensePayees = _extractCommonThings4.expensePayees, - incomeGroup = _extractCommonThings4.incomeGroup, - expenseCategories = _extractCommonThings4.expenseCategories; - - let numTransactions = integer(15, 40); - let transactions = []; - - for (let i = 0; i < numTransactions; i++) { - let payee; - - if (Math.random() < 0.3) { - payee = incomePayee; - } else { - payee = pickRandom(expensePayees); - } - - let category = payee === incomePayee ? incomeGroup.categories.find(c => c.name === 'Income') : pickRandom(expenseCategories); - let amount = payee === incomePayee ? integer(10000, 80000) : integer(-10000, -2000); - transactions.push({ - amount, - payee: payee.id, - account: account.id, - date: _shared_months__WEBPACK_IMPORTED_MODULE_0__["subDays"](_shared_months__WEBPACK_IMPORTED_MODULE_0__["currentDay"](), i * 5 | 0), - category: category.id - }); - } - - transactions.unshift({ - amount: 30000, - payee: payees.find(p => p.name === 'Starting Balance').id, - account: account.id, - date: transactions[transactions.length - 1].date, - category: getStartingBalanceCat(incomeGroup.categories), - starting_balance_flag: true - }); - await handlers['transactions-batch-update']({ - added: transactions, - fastMode: true - }); -} - -async function fillMortgage(handlers, account, payees, groups) { - let _extractCommonThings5 = extractCommonThings(payees, groups), - incomePayee = _extractCommonThings5.incomePayee, - expensePayees = _extractCommonThings5.expensePayees, - incomeGroup = _extractCommonThings5.incomeGroup, - expenseCategories = _extractCommonThings5.expenseCategories; - - let numTransactions = integer(7, 10); - let amount = integer(100000, 200000); - let category = incomeGroup.categories.find(c => c.name === 'Income'); - let transactions = [{ - amount: integer(-3000, -3500) * 100 * 100, - payee: payees.find(p => p.name === 'Starting Balance').id, - account: account.id, - date: _shared_months__WEBPACK_IMPORTED_MODULE_0__["subMonths"](_shared_months__WEBPACK_IMPORTED_MODULE_0__["currentDay"](), numTransactions) + '-02', - category: getStartingBalanceCat(incomeGroup.categories), - starting_balance_flag: true - }]; - - for (let i = 0; i < numTransactions; i++) { - let payee = incomePayee; - transactions.push({ - amount, - payee: payee.id, - account: account.id, - date: _shared_months__WEBPACK_IMPORTED_MODULE_0__["subMonths"](_shared_months__WEBPACK_IMPORTED_MODULE_0__["currentDay"](), i) + '-02', - category: category.id, - starting_balance_flag: true - }); - } - - await handlers['transactions-batch-update']({ - added: transactions, - fastMode: true - }); -} - -async function fillOther(handlers, account, payees, groups) { - let _extractCommonThings6 = extractCommonThings(payees, groups), - incomePayee = _extractCommonThings6.incomePayee, - expensePayees = _extractCommonThings6.expensePayees, - incomeGroup = _extractCommonThings6.incomeGroup, - expenseCategories = _extractCommonThings6.expenseCategories; - - let numTransactions = integer(3, 6); - let category = incomeGroup.categories.find(c => c.name === 'Income'); - let transactions = [{ - amount: integer(3250, 3700) * 100 * 100, - payee: payees.find(p => p.name === 'Starting Balance').id, - account: account.id, - date: _shared_months__WEBPACK_IMPORTED_MODULE_0__["subMonths"](_shared_months__WEBPACK_IMPORTED_MODULE_0__["currentDay"](), numTransactions) + '-02', - category: getStartingBalanceCat(incomeGroup.categories), - starting_balance_flag: true - }]; - - for (let i = 0; i < numTransactions; i++) { - let payee = incomePayee; - let amount = integer(4, 9) * 100 * 100; - transactions.push({ - amount, - payee: payee.id, - account: account.id, - date: _shared_months__WEBPACK_IMPORTED_MODULE_0__["subMonths"](_shared_months__WEBPACK_IMPORTED_MODULE_0__["currentDay"](), i) + '-02', - category: category.id - }); - } - - await handlers['transactions-batch-update']({ - added: transactions, - fastMode: true - }); -} - -async function createBudget(accounts, payees, groups) { - let primaryAccount = accounts.find(a => a.name = 'Bank of America'); - let earliestDate = (await _server_db__WEBPACK_IMPORTED_MODULE_3__["first"](`SELECT * FROM v_transactions t LEFT JOIN accounts a ON t.account = a.id - WHERE a.offbudget = 0 AND t.is_child = 0 ORDER BY date ASC LIMIT 1`)).date; - let earliestPrimaryDate = (await _server_db__WEBPACK_IMPORTED_MODULE_3__["first"](`SELECT * FROM v_transactions t LEFT JOIN accounts a ON t.account = a.id - WHERE a.id = ? AND a.offbudget = 0 AND t.is_child = 0 ORDER BY date ASC LIMIT 1`, [primaryAccount.id])).date; - let start = _shared_months__WEBPACK_IMPORTED_MODULE_0__["monthFromDate"](_server_db__WEBPACK_IMPORTED_MODULE_3__["fromDateRepr"](earliestDate)); - let end = _shared_months__WEBPACK_IMPORTED_MODULE_0__["currentMonth"](); - let months = _shared_months__WEBPACK_IMPORTED_MODULE_0__["rangeInclusive"](start, end); - - function category(name) { - for (let group of groups) { - let cat = group.categories.find(c => c.name === name); - - if (cat) { - return cat; - } - } - } - - function setBudget(month, category, amount) { - return _server_budget_actions__WEBPACK_IMPORTED_MODULE_5__["setBudget"]({ - month, - category: category.id, - amount - }); - } - - function setBudgetIfSpent(month, cat) { - let spent = _server_sheet__WEBPACK_IMPORTED_MODULE_1__["getCellValue"](_shared_months__WEBPACK_IMPORTED_MODULE_0__["sheetForMonth"](month), `sum-amount-${cat.id}`); - - if (spent < 0) { - setBudget(month, cat, -spent); - } - } - - await Object(_server_mutators__WEBPACK_IMPORTED_MODULE_8__["runMutator"])(() => Object(_server_sync__WEBPACK_IMPORTED_MODULE_7__["batchMessages"])(async () => { - for (let month of months) { - if (month >= _shared_months__WEBPACK_IMPORTED_MODULE_0__["monthFromDate"](_server_db__WEBPACK_IMPORTED_MODULE_3__["fromDateRepr"](earliestPrimaryDate))) { - setBudget(month, category('Food'), 40000); - setBudget(month, category('Restaurants'), 30000); - setBudget(month, category('Entertainment'), 10000); - setBudget(month, category('Clothing'), 3000); - setBudget(month, category('General'), 50000); - setBudget(month, category('Gift'), 7500); - setBudget(month, category('Medical'), 10000); - setBudget(month, category('Cell'), 7500); - setBudget(month, category('Internet'), 6000); - setBudget(month, category('Mortgage'), 120000); - setBudget(month, category('Water'), 9000); - setBudget(month, category('Power'), 10000); - } else { - setBudgetIfSpent(month, category('Food')); - setBudgetIfSpent(month, category('Restaurants')); - setBudgetIfSpent(month, category('Entertainment')); - setBudgetIfSpent(month, category('Clothing')); - setBudgetIfSpent(month, category('General')); - setBudgetIfSpent(month, category('Gift')); - setBudgetIfSpent(month, category('Medical')); - setBudgetIfSpent(month, category('Cell')); - setBudgetIfSpent(month, category('Internet')); - setBudgetIfSpent(month, category('Mortgage')); - setBudgetIfSpent(month, category('Water')); - setBudgetIfSpent(month, category('Power')); - } - } - })); - await _server_sheet__WEBPACK_IMPORTED_MODULE_1__["waitOnSpreadsheet"](); - await Object(_server_mutators__WEBPACK_IMPORTED_MODULE_8__["runMutator"])(() => Object(_server_sync__WEBPACK_IMPORTED_MODULE_7__["batchMessages"])(async () => { - let prevSaved = 0; - - for (let month of months) { - if (month >= _shared_months__WEBPACK_IMPORTED_MODULE_0__["monthFromDate"](_server_db__WEBPACK_IMPORTED_MODULE_3__["fromDateRepr"](earliestPrimaryDate)) && month <= _shared_months__WEBPACK_IMPORTED_MODULE_0__["currentMonth"]()) { - let sheetName = _shared_months__WEBPACK_IMPORTED_MODULE_0__["sheetForMonth"](month); - let toBudget = _server_sheet__WEBPACK_IMPORTED_MODULE_1__["getCellValue"](sheetName, 'to-budget'); - let available = toBudget - prevSaved; - - if (available - 403000 > 0) { - setBudget(month, category('Savings'), available - 403000); - _server_budget_actions__WEBPACK_IMPORTED_MODULE_5__["setBuffer"](month, 403000); - prevSaved += available - 403000; - } else if (available > 0) { - _server_budget_actions__WEBPACK_IMPORTED_MODULE_5__["setBuffer"](month, available); - } - } - } - })); - await _server_sheet__WEBPACK_IMPORTED_MODULE_1__["waitOnSpreadsheet"](); - let sheetName = _shared_months__WEBPACK_IMPORTED_MODULE_0__["sheetForMonth"](_shared_months__WEBPACK_IMPORTED_MODULE_0__["currentMonth"]()); - let toBudget = _server_sheet__WEBPACK_IMPORTED_MODULE_1__["getCellValue"](sheetName, 'to-budget'); - - if (toBudget < 0) { - await Object(_server_accounts_sync__WEBPACK_IMPORTED_MODULE_9__["addTransactions"])(primaryAccount.id, [{ - amount: -toBudget, - category: category('Income').id, - date: _shared_months__WEBPACK_IMPORTED_MODULE_0__["currentMonth"]() + '-01' - }]); - } // let sheetName = monthUtils.sheetForMonth(monthUtils.currentMonth()); - // let toBudget = sheet.getCellValue(sheetName, 'to-budget'); - // setBudget(monthUtils.currentMonth(), category('Savings'), toBudget); - - - await _server_sheet__WEBPACK_IMPORTED_MODULE_1__["waitOnSpreadsheet"](); -} - -async function createTestBudget(handlers) { - Object(_server_sync__WEBPACK_IMPORTED_MODULE_7__["setSyncingMode"])('import'); - await _server_db__WEBPACK_IMPORTED_MODULE_3__["execQuery"]('PRAGMA journal_mode = OFF'); // Clear out the default categories. This is fine to do without - // going through the sync system because we are in import mode and - // these aren't tracked through messages anyway. - - await _server_db__WEBPACK_IMPORTED_MODULE_3__["runQuery"]('DELETE FROM categories;'); - await _server_db__WEBPACK_IMPORTED_MODULE_3__["runQuery"]('DELETE FROM category_groups'); - let accounts = [{ - name: 'Bank of America', - type: 'checking' - }, { - name: 'Ally Savings', - type: 'savings' - }, { - name: 'Capital One Checking', - type: 'checking' - }, { - name: 'HSBC', - type: 'checking' - }, { - name: 'Vanguard 401k', - type: 'investment', - offBudget: 1 - }, { - name: 'Mortgage', - type: 'mortgage', - offBudget: 1 - }, { - name: 'House Asset', - type: 'other', - offBudget: 1 - }, { - name: 'Roth IRA', - type: 'investment', - offBudget: 1 - }]; - await Object(_server_mutators__WEBPACK_IMPORTED_MODULE_8__["runMutator"])(() => Object(_server_sync__WEBPACK_IMPORTED_MODULE_7__["batchMessages"])(async () => { - for (let account of accounts) { - account.id = await handlers['account-create'](account); - } - })); - let payees = [{ - name: 'Starting Balance' - }, { - name: 'Kroger' - }, { - name: 'Publix' - }, { - name: 'Home Depot' - }, { - name: 'Movies' - }, { - name: 'Online store' - }, { - name: 'Deposit' - }, { - name: 'Dominion Power', - bill: true - }, { - name: 'Extra Watery', - bill: true - }, { - name: 'Housy House', - bill: true - }, { - name: 'Fast Internet', - bill: true - }, { - name: 'T-mobile', - bill: true - }]; - await Object(_server_mutators__WEBPACK_IMPORTED_MODULE_8__["runMutator"])(() => Object(_server_sync__WEBPACK_IMPORTED_MODULE_7__["batchMessages"])(async () => { - for (let payee of payees) { - payee.id = await handlers['payee-create']({ - name: payee.name - }); - } - })); - let categoryGroups = [{ - name: 'Usual Expenses', - categories: [{ - name: 'Savings' - }, { - name: 'Medical' - }, { - name: 'Gift' - }, { - name: 'General' - }, { - name: 'Clothing' - }, { - name: 'Entertainment' - }, { - name: 'Restaurants' - }, { - name: 'Food' - }] - }, { - name: 'Bills', - categories: [{ - name: 'Power' - }, { - name: 'Water' - }, { - name: 'Mortgage' - }, { - name: 'Internet' - }, { - name: 'Cell' - }] - }, { - name: 'Income', - is_income: true, - categories: [{ - name: 'Income', - is_income: true - }, { - name: 'Misc', - is_income: true - }, { - name: 'Starting Balances', - is_income: true - }] - }]; - await Object(_server_mutators__WEBPACK_IMPORTED_MODULE_8__["runMutator"])(async () => { - for (let group of categoryGroups) { - group.id = await handlers['category-group-create']({ - name: group.name, - isIncome: group.is_income ? 1 : 0 - }); - - for (let category of group.categories) { - category.id = await handlers['category-create'](_objectSpread(_objectSpread({}, category), {}, { - isIncome: category.is_income ? 1 : 0, - groupId: group.id - })); - } - } - }); - let allGroups = (await Object(_server_mutators__WEBPACK_IMPORTED_MODULE_8__["runHandler"])(handlers['get-categories'])).grouped; - Object(_server_sync__WEBPACK_IMPORTED_MODULE_7__["setSyncingMode"])('import'); - await Object(_server_mutators__WEBPACK_IMPORTED_MODULE_8__["runMutator"])(() => Object(_server_sync__WEBPACK_IMPORTED_MODULE_7__["batchMessages"])(async () => { - for (let account of accounts) { - switch (account.type) { - case 'checking': - if (account.name === 'Bank of America') { - await fillPrimaryChecking(handlers, account, payees, allGroups); - } else { - await fillChecking(handlers, account, payees, allGroups); - } - - break; - - case 'investment': - await fillInvestment(handlers, account, payees, allGroups); - break; - - case 'savings': - await fillSavings(handlers, account, payees, allGroups); - break; - - case 'mortgage': - await fillMortgage(handlers, account, payees, allGroups); - break; - - case 'other': - if (account.name === 'House Asset') { - await fillOther(handlers, account, payees, allGroups); - } else { - await fillChecking(handlers, account, payees, allGroups); - } - - break; - - default: - } - } - })); - Object(_server_sync__WEBPACK_IMPORTED_MODULE_7__["setSyncingMode"])('import'); // This checks to see if the primary account is in the negative. - // This might happen depending on the transactions added, but we - // don't want to show that as it'd be weird. We modify the latest - // deposit transaction to force it to be positive - - let primaryAccount = accounts.find(a => a.name = 'Bank of America'); - - let _await$aqlQuery = await Object(_server_aql_schema_run_query__WEBPACK_IMPORTED_MODULE_6__["runQuery"])(Object(_shared_query__WEBPACK_IMPORTED_MODULE_10__["default"])('transactions').filter({ - account: primaryAccount.id - }).calculate({ - $sum: '$amount' - }).serialize()), - primaryBalance = _await$aqlQuery.data; - - if (primaryBalance < 0) { - let _await$aqlQuery2 = await Object(_server_aql_schema_run_query__WEBPACK_IMPORTED_MODULE_6__["runQuery"])(Object(_shared_query__WEBPACK_IMPORTED_MODULE_10__["default"])('transactions').filter({ - account: primaryAccount.id, - amount: { - $gt: 0 - } - }).limit(1).select(['id', 'amount']).serialize()), - results = _await$aqlQuery2.data; - - let lastDeposit = results[0]; - await Object(_server_mutators__WEBPACK_IMPORTED_MODULE_8__["runHandler"])(handlers['transaction-update'], _objectSpread(_objectSpread({}, lastDeposit), {}, { - amount: lastDeposit.amount + -primaryBalance + integer(10000, 20000) - })); - } // Bust the cache and reload the spreadsheet - - - Object(_server_sync__WEBPACK_IMPORTED_MODULE_7__["setSyncingMode"])('disabled'); - await _server_prefs__WEBPACK_IMPORTED_MODULE_4__["savePrefs"]({ - isCached: false - }); - await _server_sheet__WEBPACK_IMPORTED_MODULE_1__["reloadSpreadsheet"](_server_db__WEBPACK_IMPORTED_MODULE_3__); - await _server_budget_base__WEBPACK_IMPORTED_MODULE_2__["createAllBudgets"](); - await _server_sheet__WEBPACK_IMPORTED_MODULE_1__["waitOnSpreadsheet"](); // Create a budget - - await createBudget(accounts, payees, allGroups); -} - -/***/ }), - -/***/ "./packages/loot-core/src/platform/exceptions/index.electron.js": -/*!**********************************************************************!*\ - !*** ./packages/loot-core/src/platform/exceptions/index.electron.js ***! - \**********************************************************************/ -/*! exports provided: captureException, captureBreadcrumb */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "captureException", function() { return captureException; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "captureBreadcrumb", function() { return captureBreadcrumb; }); -function captureException(exc) { - console.log('[Exception]', exc); - - if (global.SentryClient) { - global.SentryClient.captureException(exc); - } -} -function captureBreadcrumb(breadcrumb) { - if (global.SentryClient) { - global.SentryClient.addBreadcrumb(breadcrumb); - } -} - -/***/ }), - -/***/ "./packages/loot-core/src/platform/server/asyncStorage/index.electron.js": -/*!*******************************************************************************!*\ - !*** ./packages/loot-core/src/platform/server/asyncStorage/index.electron.js ***! - \*******************************************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -const lootFs = __webpack_require__(/*! ../fs */ "./packages/loot-core/src/platform/server/fs/index.electron.js"); - -const fs = __webpack_require__(/*! fs */ "fs"); - -const _require = __webpack_require__(/*! path */ "path"), - join = _require.join; - -let getStorePath = () => join(lootFs.getDataDir(), 'global-store.json'); - -let store; -let persisted = true; - -function init({ - persist = true -} = {}) { - if (persist) { - try { - store = JSON.parse(fs.readFileSync(getStorePath(), 'utf8')); - } catch (e) { - store = {}; - } - } else { - store = {}; - } - - persisted = persist; -} - -function _saveStore() { - if (persisted) { - return new Promise(function (resolve, reject) { - fs.writeFile(getStorePath(), JSON.stringify(store), 'utf8', function (err, _) { - return err ? reject(err) : resolve(); - }); - }); - } -} - -function getItem(key) { - return new Promise(function (resolve) { - return resolve(store[key]); - }); -} - -function setItem(key, value) { - store[key] = value; - return _saveStore(); -} - -function removeItem(key) { - delete store[key]; - return _saveStore(); -} - -function multiGet(keys) { - return new Promise(function (resolve) { - return resolve(keys.map(function (key) { - return [key, store[key]]; - })); - }); -} - -function multiSet(keyValues) { - keyValues.forEach(function ([key, value]) { - store[key] = value; - }); - return _saveStore(); -} - -function multiRemove(keys) { - keys.forEach(function (key) { - delete store[key]; - }); - return _saveStore(); -} - -module.exports = { - init, - getItem, - setItem, - removeItem, - multiGet, - multiSet, - multiRemove -}; - -/***/ }), - -/***/ "./packages/loot-core/src/platform/server/connection/index.api.js": -/*!************************************************************************!*\ - !*** ./packages/loot-core/src/platform/server/connection/index.api.js ***! - \************************************************************************/ -/*! no static exports found */ -/***/ (function(module, exports) { - -function init() {} - -function send(type, args) {// Nothing -} - -module.exports = { - init, - send -}; - -/***/ }), - -/***/ "./packages/loot-core/src/platform/server/fetch/index.electron.js": -/*!************************************************************************!*\ - !*** ./packages/loot-core/src/platform/server/fetch/index.electron.js ***! - \************************************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -let fs = __webpack_require__(/*! fs */ "fs"); - -let fetch = __webpack_require__(/*! node-fetch */ "node-fetch"); - -async function fetchBinary(url, filepath) { - const res = await fetch(url); - return new Promise((resolve, reject) => { - const fileStream = fs.createWriteStream(filepath); - res.body.pipe(fileStream); - res.body.on('error', err => { - reject(err); - }); - fileStream.on('finish', function () { - resolve(); - }); - }); -} - -module.exports = { - fetch, - fetchBinary -}; - -/***/ }), - -/***/ "./packages/loot-core/src/platform/server/fs/index.electron.js": -/*!*********************************************************************!*\ - !*** ./packages/loot-core/src/platform/server/fs/index.electron.js ***! - \*********************************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -const fs = __webpack_require__(/*! fs */ "fs"); - -const path = __webpack_require__(/*! path */ "path"); - -let documentDir; -let rootPath = path.join(__dirname, '..', '..', '..', '..'); - -if (__filename.match('bundle')) { - // The file name is not our filename and indicates that we're in the - // bundled form. Because of this, the root path is different. - rootPath = path.join(__dirname, '..'); -} - -module.exports = { - init: () => {// Nothing to do - }, - getDataDir: () => { - if (!process.env.ACTUAL_DATA_DIR) { - throw new Error('ACTUAL_DATA_DIR env variable is required'); - } - - return process.env.ACTUAL_DATA_DIR; - }, - _setDocumentDir: dir => documentDir = dir, - getDocumentDir: () => { - if (!documentDir) { - throw new Error('Document directory is not set'); - } - - return documentDir; - }, - getBudgetDir: id => { - if (!id) { - throw new Error('getDocumentDir: id is falsy: ' + id); - } // TODO: This should be better - // - // A cheesy safe guard. The id is generated from the budget name, - // so it provides an entry point for the user to accidentally (or - // intentionally) access other parts of the system. Always - // restrict it to only access files within the budget directory by - // never allowing slashes. - - - if (id.match(/[^A-Za-z0-9\-_]/)) { - throw new Error(`Invalid budget id "${id}". Check the id of your budget in the "Advanced" section of the settings page.`); - } - - return path.join(module.exports.getDocumentDir(), id); - }, - bundledDatabasePath: path.join(rootPath, 'default-db.sqlite'), - migrationsPath: path.join(rootPath, 'migrations'), - demoBudgetPath: path.join(rootPath, 'demo-budget'), - join: path.join, - basename: filepath => path.basename(filepath), - listDir: filepath => new Promise((resolve, reject) => { - fs.readdir(filepath, (err, files) => { - if (err) { - reject(err); - } else { - resolve(files); - } - }); - }), - exists: filepath => new Promise(resolve => { - fs.access(filepath, fs.constants.F_OK, err => { - return resolve(!err); - }); - }), - mkdir: filepath => new Promise((resolve, reject) => { - fs.mkdir(filepath, err => { - if (err) { - reject(err); - } else { - resolve(); - } - }); - }), - size: filepath => new Promise((resolve, reject) => { - fs.stat(filepath, (err, stats) => { - if (err) { - reject(err); - } else { - resolve(stats.size); - } - }); - }), - copyFile: (frompath, topath) => { - return new Promise((resolve, reject) => { - const readStream = fs.createReadStream(frompath); - const writeStream = fs.createWriteStream(topath); - readStream.on('error', reject); - writeStream.on('error', reject); - writeStream.on('open', () => readStream.pipe(writeStream)); - writeStream.once('close', resolve); - }); - }, - readFile: (filepath, encoding = 'utf8') => { - if (encoding === 'binary') { - // `binary` is not actually a valid encoding, you pass `null` into node if - // you want a buffer - encoding = null; - } - - return new Promise((resolve, reject) => { - fs.readFile(filepath, encoding, (err, data) => { - if (err) { - reject(err); - } else { - resolve(data); - } - }); - }); - }, - writeFile: (filepath, contents) => { - return new Promise(function (resolve, reject) { - fs.writeFile(filepath, contents, 'utf8', function (err, _) { - return err ? reject(err) : resolve(); - }); - }); - }, - removeFile: filepath => { - return new Promise(function (resolve, reject) { - fs.unlink(filepath, err => { - return err ? reject(err) : resolve(); - }); - }); - }, - removeDir: dirpath => { - return new Promise(function (resolve, reject) { - fs.rmdir(dirpath, err => { - return err ? reject(err) : resolve(); - }); - }); - }, - removeDirRecursively: async dirpath => { - const f = module.exports; - - if (await f.exists(dirpath)) { - for (let file of await f.listDir(dirpath)) { - const fullpath = f.join(dirpath, file); - - if (fs.statSync(fullpath).isDirectory()) { - await f.removeDirRecursively(fullpath); - } else { - await f.removeFile(fullpath); - } - } - - await f.removeDir(dirpath); - } - }, - getModifiedTime: filepath => { - return new Promise(function (resolve, reject) { - fs.stat(filepath, (err, stats) => { - if (err) { - reject(err); - } else { - resolve(new Date(stats.mtime)); - } - }); - }); - } -}; - -/***/ }), - -/***/ "./packages/loot-core/src/platform/server/log/index.api.js": -/*!*****************************************************************!*\ - !*** ./packages/loot-core/src/platform/server/log/index.api.js ***! - \*****************************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony default export */ __webpack_exports__["default"] = ({ - info: (...args) => { - console.log(...args); - }, - warn: (...args) => { - console.warn(...args); - } -}); - -/***/ }), - -/***/ "./packages/loot-core/src/platform/server/sqlite/index.electron.js": -/*!*************************************************************************!*\ - !*** ./packages/loot-core/src/platform/server/sqlite/index.electron.js ***! - \*************************************************************************/ -/*! exports provided: init, prepare, runQuery, execQuery, transaction, asyncTransaction, openDatabase, closeDatabase, exportDatabase */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "init", function() { return init; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "prepare", function() { return prepare; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "runQuery", function() { return runQuery; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "execQuery", function() { return execQuery; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "transaction", function() { return transaction; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "asyncTransaction", function() { return asyncTransaction; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "openDatabase", function() { return openDatabase; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "closeDatabase", function() { return closeDatabase; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "exportDatabase", function() { return exportDatabase; }); -const Database = __webpack_require__(/*! better-sqlite3 */ "better-sqlite3"); - -function verifyParamTypes(sql, arr) { - arr.forEach(val => { - if (typeof val !== 'string' && typeof val !== 'number' && val !== null) { - console.log(sql, arr); - throw new Error('Invalid field type ' + val + ' for sql ' + sql); - } - }); -} - -async function init() {} -function prepare(db, sql) { - return db.prepare(sql); -} -function runQuery(db, sql, params = [], fetchAll) { - if (params) { - verifyParamTypes(sql, params); - } - - let stmt; - - try { - stmt = typeof sql === 'string' ? db.prepare(sql) : sql; - } catch (e) { - console.log('error', sql); - throw e; - } - - if (fetchAll) { - try { - let result = stmt.all(...params); - return result; - } catch (e) { - console.log('error', sql); - throw e; - } - } else { - try { - let info = stmt.run(...params); - return { - changes: info.changes, - insertId: info.lastInsertRowid - }; - } catch (e) { - // console.log('error', sql); - throw e; - } - } -} -function execQuery(db, sql) { - db.exec(sql); -} -function transaction(db, fn) { - db.transaction(fn)(); -} // **Important**: this is an unsafe function since sqlite executes -// executes statements sequentially. It would be easy for other code -// to run statements in between our transaction and get caught up in -// it. This is rarely used, and only needed for specific cases (like -// batch importing a bunch of data). Don't use this. - -let transactionDepth = 0; -async function asyncTransaction(db, fn) { - // Support nested transactions by "coalescing" them into the parent - // one if one is already started - if (transactionDepth === 0) { - db.exec('BEGIN TRANSACTION'); - } - - transactionDepth++; - - try { - await fn(); - } finally { - transactionDepth--; // We always commit because rollback is more dangerous - any - // queries that ran *in-between* this async function would be - // lost. Right now we are only using transactions for speed - // purposes unfortunately - - if (transactionDepth === 0) { - db.exec('COMMIT'); - } - } -} -function openDatabase(pathOrBuffer) { - return new Database(pathOrBuffer); -} -function closeDatabase(db) { - return db.close(); -} -function exportDatabase(db) { - return db.serialize(); -} - -/***/ }), - -/***/ "./packages/loot-core/src/platform/uuid/index.electron.js": -/*!****************************************************************!*\ - !*** ./packages/loot-core/src/platform/uuid/index.electron.js ***! - \****************************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -const uuid = __webpack_require__(/*! uuid */ "./node_modules/uuid/index.js"); - -module.exports = { - v4: function () { - return Promise.resolve(uuid.v4()); - }, - v4Sync: function () { - return uuid.v4(); - } -}; - -/***/ }), - -/***/ "./packages/loot-core/src/server/accounts/export-to-csv.js": -/*!*****************************************************************!*\ - !*** ./packages/loot-core/src/server/accounts/export-to-csv.js ***! - \*****************************************************************/ -/*! exports provided: exportToCSV, exportQueryToCSV */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "exportToCSV", function() { return exportToCSV; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "exportQueryToCSV", function() { return exportQueryToCSV; }); -/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! fs */ "fs"); -/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var csv_stringify_lib_sync__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! csv-stringify/lib/sync */ "./node_modules/csv-stringify/lib/sync.js"); -/* harmony import */ var csv_stringify_lib_sync__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(csv_stringify_lib_sync__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var _aql_schema_run_query__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../aql/schema/run-query */ "./packages/loot-core/src/server/aql/schema/run-query.js"); -/* harmony import */ var _shared_util__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../shared/util */ "./packages/loot-core/src/shared/util.js"); - - - - -async function exportToCSV(transactions, accounts, categoryGroups, payees) { - const accountNamesById = accounts.reduce((reduced, { - id, - name - }) => { - reduced[id] = name; - return reduced; - }, {}); - const categoryNamesById = categoryGroups.reduce((reduced, { - name, - categories: subCategories - }) => { - subCategories.forEach(subCategory => reduced[subCategory.id] = `${name}: ${subCategory.name}`); - return reduced; - }, {}); - const payeeNamesById = payees.reduce((reduced, { - id, - name - }) => { - reduced[id] = name; - return reduced; - }, {}); - const transactionsForExport = transactions.map(({ - account, - date, - payee, - notes, - category, - amount - }) => ({ - Account: accountNamesById[account], - Date: date, - Payee: payeeNamesById[payee], - Notes: notes, - Category: categoryNamesById[category], - Amount: amount == null ? 0 : Object(_shared_util__WEBPACK_IMPORTED_MODULE_3__["integerToAmount"])(amount) - })); - return csv_stringify_lib_sync__WEBPACK_IMPORTED_MODULE_1___default()(transactionsForExport, { - header: true - }); -} -async function exportQueryToCSV(query) { - let _await$aqlQuery = await Object(_aql_schema_run_query__WEBPACK_IMPORTED_MODULE_2__["runQuery"])(query.select([{ - Id: 'id' - }, { - Account: 'account.name' - }, { - Date: 'date' - }, { - Payee: 'payee.name' - }, { - ParentId: 'parent_id' - }, { - IsParent: 'is_parent' - }, { - Notes: 'notes' - }, { - Category: 'category.name' - }, { - Amount: 'amount' - }]).options({ - splits: 'all' - })), - transactions = _await$aqlQuery.data; - - let parentsPayees = new Map(); - - for (let trans of transactions) { - if (trans.IsParent) { - parentsPayees.set(trans.Id, trans.Payee); - } - } // filter out any parent transactions - - - let noParents = transactions.filter(t => !t.IsParent); // map final properties for export and grab the payee for splits from their parent transaction - - let transactionsForExport = noParents.map(trans => { - return { - Account: trans.Account, - Date: trans.Date, - Payee: trans.ParentId ? parentsPayees.get(trans.ParentId) : trans.Payee, - Notes: trans.Notes, - Category: trans.Category, - Amount: trans.Amount == null ? 0 : Object(_shared_util__WEBPACK_IMPORTED_MODULE_3__["integerToAmount"])(trans.Amount) - }; - }); - return csv_stringify_lib_sync__WEBPACK_IMPORTED_MODULE_1___default()(transactionsForExport, { - header: true - }); -} - -/***/ }), - -/***/ "./packages/loot-core/src/server/accounts/link.js": -/*!********************************************************!*\ - !*** ./packages/loot-core/src/server/accounts/link.js ***! - \********************************************************/ -/*! exports provided: handoffPublicToken, addAccounts */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "handoffPublicToken", function() { return handoffPublicToken; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addAccounts", function() { return addAccounts; }); -/* harmony import */ var _platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../platform/server/asyncStorage */ "./packages/loot-core/src/platform/server/asyncStorage/index.electron.js"); -/* harmony import */ var _platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _db__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../db */ "./packages/loot-core/src/server/db/index.js"); -/* harmony import */ var _server_config__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../server-config */ "./packages/loot-core/src/server/server-config.js"); -/* harmony import */ var _sync__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./sync */ "./packages/loot-core/src/server/accounts/sync.js"); -/* harmony import */ var _shared_accounts__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../shared/accounts */ "./packages/loot-core/src/shared/accounts.js"); -/* harmony import */ var _shared_util__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../shared/util */ "./packages/loot-core/src/shared/util.js"); -/* harmony import */ var _post__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../post */ "./packages/loot-core/src/server/post.js"); -/* harmony import */ var _mutators__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../mutators */ "./packages/loot-core/src/server/mutators.js"); -function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } - -function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } - -function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } - -function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } - -function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_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 _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } - - - - - - - - - - -const uuid = __webpack_require__(/*! ../../platform/uuid */ "./packages/loot-core/src/platform/uuid/index.electron.js"); - -async function handoffPublicToken(institution, publicToken) { - let _await$asyncStorage$m = await _platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_0___default.a.multiGet(['user-id', 'user-key']), - _await$asyncStorage$m2 = _slicedToArray(_await$asyncStorage$m, 2), - _await$asyncStorage$m3 = _slicedToArray(_await$asyncStorage$m2[0], 2), - userId = _await$asyncStorage$m3[1], - _await$asyncStorage$m4 = _slicedToArray(_await$asyncStorage$m2[1], 2), - key = _await$asyncStorage$m4[1]; - - if (institution == null || !institution.institution_id || !institution.name) { - throw new Error('Invalid institution object'); - } - - let id = uuid.v4Sync(); // Make sure to generate an access token first before inserting it - // into our local database in case it fails - - await Object(_post__WEBPACK_IMPORTED_MODULE_6__["post"])(Object(_server_config__WEBPACK_IMPORTED_MODULE_2__["getServer"])().PLAID_SERVER + '/handoff_public_token', { - userId, - key, - item_id: id, - public_token: publicToken - }); - await Object(_mutators__WEBPACK_IMPORTED_MODULE_7__["runMutator"])(() => _db__WEBPACK_IMPORTED_MODULE_1__["insertWithUUID"]('banks', { - id, - bank_id: institution.institution_id, - name: institution.name - })); - return id; -} -async function addAccounts(bankId, accountIds, offbudgetIds = []) { - let _await$asyncStorage$m5 = await _platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_0___default.a.multiGet(['user-id', 'user-key']), - _await$asyncStorage$m6 = _slicedToArray(_await$asyncStorage$m5, 2), - _await$asyncStorage$m7 = _slicedToArray(_await$asyncStorage$m6[0], 2), - userId = _await$asyncStorage$m7[1], - _await$asyncStorage$m8 = _slicedToArray(_await$asyncStorage$m6[1], 2), - userKey = _await$asyncStorage$m8[1]; // Get all the available accounts - - - let accounts = await _sync__WEBPACK_IMPORTED_MODULE_3__["getAccounts"](userId, userKey, bankId); // Only add the selected accounts - - accounts = accounts.filter(acct => accountIds.includes(acct.account_id)); - return Promise.all(accounts.map(async acct => { - let id = await Object(_mutators__WEBPACK_IMPORTED_MODULE_7__["runMutator"])(async () => { - let id = await _db__WEBPACK_IMPORTED_MODULE_1__["insertAccount"]({ - account_id: acct.account_id, - name: acct.name, - official_name: acct.official_name, - type: Object(_shared_accounts__WEBPACK_IMPORTED_MODULE_4__["fromPlaidAccountType"])(acct.type), - balance_current: Object(_shared_util__WEBPACK_IMPORTED_MODULE_5__["amountToInteger"])(acct.balances.current), - mask: acct.mask, - bank: bankId, - offbudget: offbudgetIds.includes(acct.account_id) ? 1 : 0 - }); // Create a transfer payee - - await _db__WEBPACK_IMPORTED_MODULE_1__["insertPayee"]({ - name: '', - transfer_acct: id - }); - return id; - }); // Do an initial sync - - await _sync__WEBPACK_IMPORTED_MODULE_3__["syncAccount"](userId, userKey, id, acct.account_id, bankId); - return id; - })); -} - -/***/ }), - -/***/ "./packages/loot-core/src/server/accounts/parse-file.js": -/*!**************************************************************!*\ - !*** ./packages/loot-core/src/server/accounts/parse-file.js ***! - \**************************************************************/ -/*! exports provided: parseFile */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "parseFile", function() { return parseFile; }); -/* harmony import */ var _platform_server_fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../platform/server/fs */ "./packages/loot-core/src/platform/server/fs/index.electron.js"); -/* harmony import */ var _platform_server_fs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_platform_server_fs__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _qif2json__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./qif2json */ "./packages/loot-core/src/server/accounts/qif2json.js"); -/* harmony import */ var csv_parse_lib_sync__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! csv-parse/lib/sync */ "./node_modules/csv-parse/lib/sync.js"); -/* harmony import */ var csv_parse_lib_sync__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(csv_parse_lib_sync__WEBPACK_IMPORTED_MODULE_2__); -/* harmony import */ var _shared_months__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../shared/months */ "./packages/loot-core/src/shared/months.js"); -/* harmony import */ var _shared_util__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../shared/util */ "./packages/loot-core/src/shared/util.js"); - - - - - -function parseFile(filepath, options) { - let errors = []; - let m = filepath.match(/\.[^.]*$/); - - if (m) { - let ext = m[0]; - - switch (ext.toLowerCase()) { - case '.qif': - return parseQIF(filepath); - - case '.csv': - return parseCSV(filepath, options); - - case '.ofx': - case '.qfx': - return parseOFX(filepath); - - default: - } - } - - errors.push({ - message: 'Invalid file type', - internal: '' - }); - return { - errors - }; -} - -async function parseCSV(filepath, options = {}) { - let errors = []; - let contents = await _platform_server_fs__WEBPACK_IMPORTED_MODULE_0___default.a.readFile(filepath); - let data; - - try { - data = csv_parse_lib_sync__WEBPACK_IMPORTED_MODULE_2___default()(contents, { - columns: true, - bom: true, - delimiter: options.delimiter || ',', - quote: '"', - trim: true, - relax_column_count: true - }); - } catch (err) { - errors.push({ - message: 'Failed parsing: ' + err.message, - internal: err.message - }); - return { - errors, - transactions: [] - }; - } - - return { - errors, - transactions: data - }; -} - -async function parseQIF(filepath) { - let errors = []; - let contents = await _platform_server_fs__WEBPACK_IMPORTED_MODULE_0___default.a.readFile(filepath); - let data; - - try { - data = Object(_qif2json__WEBPACK_IMPORTED_MODULE_1__["default"])(contents); - } catch (err) { - errors.push({ - message: "Failed parsing: doesn't look like a valid QIF file.", - internal: err.stack - }); - return { - errors, - transactions: [] - }; - } - - return { - errors, - transactions: data.transactions.map(trans => ({ - amount: trans.amount != null ? Object(_shared_util__WEBPACK_IMPORTED_MODULE_4__["looselyParseAmount"])(trans.amount) : null, - date: trans.date, - payee_name: trans.payee, - imported_payee: trans.payee, - notes: trans.memo || null - })) - }; -} - -async function parseOFX(filepath) { - let _await$import = await Promise.resolve(/*! import() */).then(__webpack_require__.t.bind(null, /*! node-libofx */ "node-libofx", 7)), - getOFXTransactions = _await$import.getOFXTransactions, - initModule = _await$import.initModule; - - await initModule(); - let errors = []; - let contents = await _platform_server_fs__WEBPACK_IMPORTED_MODULE_0___default.a.readFile(filepath); - let data; - - try { - data = getOFXTransactions(contents); - } catch (err) { - errors.push({ - message: 'Failed importing file', - internal: err.stack - }); - return { - errors - }; - } - - return { - errors, - transactions: data.map(trans => ({ - amount: trans.amount, - imported_id: trans.fi_id, - date: trans.date ? Object(_shared_months__WEBPACK_IMPORTED_MODULE_3__["dayFromDate"])(trans.date * 1000) : null, - payee_name: trans.name, - imported_payee: trans.name, - notes: trans.memo || null - })) - }; -} - -/***/ }), - -/***/ "./packages/loot-core/src/server/accounts/payees.js": -/*!**********************************************************!*\ - !*** ./packages/loot-core/src/server/accounts/payees.js ***! - \**********************************************************/ -/*! exports provided: createPayee, getStartingBalancePayee */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createPayee", function() { return createPayee; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getStartingBalancePayee", function() { return getStartingBalancePayee; }); -/* harmony import */ var _db__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../db */ "./packages/loot-core/src/server/db/index.js"); - -async function createPayee(description) { - // Check to make sure no payee already exists with exactly the same - // name - let row = await _db__WEBPACK_IMPORTED_MODULE_0__["first"](`SELECT id FROM payees WHERE LOWER(name) = ? AND tombstone = 0`, [description.toLowerCase()]); - - if (row) { - return row.id; - } else { - return _db__WEBPACK_IMPORTED_MODULE_0__["insertPayee"]({ - name: description - }); - } -} -async function getStartingBalancePayee() { - let category = await _db__WEBPACK_IMPORTED_MODULE_0__["first"](` - SELECT * FROM categories - WHERE is_income = 1 AND - LOWER(name) = 'starting balances' AND - tombstone = 0 - `); - - if (category === null) { - category = await _db__WEBPACK_IMPORTED_MODULE_0__["first"]('SELECT * FROM categories WHERE is_income = 1 AND tombstone = 0'); - } - - let id = await createPayee('Starting Balance'); - return { - id, - category: category ? category.id : null - }; -} - -/***/ }), - -/***/ "./packages/loot-core/src/server/accounts/qif2json.js": -/*!************************************************************!*\ - !*** ./packages/loot-core/src/server/accounts/qif2json.js ***! - \************************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return parse; }); -function parse(qif, options) { - var lines = qif.split('\n'), - line = lines.shift(), - type = /!Type:([^$]*)$/.exec(line.trim()), - data = {}, - transactions = data.transactions = [], - transaction = {}; - options = options || {}; - - if (!type || !type.length) { - throw new Error('File does not appear to be a valid qif file: ' + line); - } - - data.type = type[1]; - var division = {}; - - while (line = lines.shift()) { - line = line.trim(); - - if (line === '^') { - transactions.push(transaction); - transaction = {}; - continue; - } - - switch (line[0]) { - case 'D': - transaction.date = line.substring(1); - break; - - case 'T': - transaction.amount = line.substring(1); - break; - - case 'N': - transaction.number = line.substring(1); - break; - - case 'M': - transaction.memo = line.substring(1); - break; - - case 'A': - transaction.address = (transaction.address || []).concat(line.substring(1)); - break; - - case 'P': - transaction.payee = line.substring(1).replace(/&/g, '&'); - break; - - case 'L': - var lArray = line.substring(1).split(':'); - transaction.category = lArray[0]; - - if (lArray[1] !== undefined) { - transaction.subcategory = lArray[1]; - } - - break; - - case 'C': - transaction.clearedStatus = line.substring(1); - break; - - case 'S': - var sArray = line.substring(1).split(':'); - division.category = sArray[0]; - - if (sArray[1] !== undefined) { - division.subcategory = sArray[1]; - } - - break; - - case 'E': - division.description = line.substring(1); - break; - - case '$': - division.amount = parseFloat(line.substring(1)); - - if (!(transaction.division instanceof Array)) { - transaction.division = []; - } - - transaction.division.push(division); - division = {}; - break; - - default: - throw new Error('Unknown Detail Code: ' + line[0]); - } - } - - if (Object.keys(transaction).length) { - transactions.push(transaction); - } - - data.dateFormat = options.dateFormat; - return data; -} - -/***/ }), - -/***/ "./packages/loot-core/src/server/accounts/rules.js": -/*!*********************************************************!*\ - !*** ./packages/loot-core/src/server/accounts/rules.js ***! - \*********************************************************/ -/*! exports provided: parseRecurDate, parseDateString, parseBetweenAmount, Condition, Action, Rule, RuleIndexer, rankRules, migrateIds, iterateIds */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "parseRecurDate", function() { return parseRecurDate; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "parseDateString", function() { return parseDateString; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "parseBetweenAmount", function() { return parseBetweenAmount; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Condition", function() { return Condition; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Action", function() { return Action; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Rule", function() { return Rule; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RuleIndexer", function() { return RuleIndexer; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "rankRules", function() { return rankRules; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "migrateIds", function() { return migrateIds; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "iterateIds", function() { return iterateIds; }); -/* harmony import */ var _errors__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../errors */ "./packages/loot-core/src/server/errors.js"); -/* harmony import */ var date_fns__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! date-fns */ "./node_modules/date-fns/esm/index.js"); -/* harmony import */ var _shared_months__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../shared/months */ "./packages/loot-core/src/shared/months.js"); -/* harmony import */ var _shared_util__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../shared/util */ "./packages/loot-core/src/shared/util.js"); -/* harmony import */ var _shared_rules__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../shared/rules */ "./packages/loot-core/src/shared/rules.js"); -/* harmony import */ var _shared_schedules__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../shared/schedules */ "./packages/loot-core/src/shared/schedules.js"); -/* harmony import */ var _util_rschedule__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../util/rschedule */ "./packages/loot-core/src/server/util/rschedule.js"); -function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } - -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } - -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 _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } - -function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } - -function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } - -function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } - -function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_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 _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } - - - - - - - - - -function safeNumber(n) { - return isNaN(n) ? null : n; -} - -function safeParseInt(n) { - return safeNumber(parseInt(n)); -} - -function assert(test, type, msg) { - if (!test) { - throw new _errors__WEBPACK_IMPORTED_MODULE_0__["RuleError"](type, msg); - } -} - -function parseRecurDate(desc) { - try { - let rules = Object(_shared_schedules__WEBPACK_IMPORTED_MODULE_5__["recurConfigToRSchedule"])(desc); - return { - type: 'recur', - schedule: new _util_rschedule__WEBPACK_IMPORTED_MODULE_6__["Schedule"]({ - rrules: rules - }) - }; - } catch (e) { - throw new _errors__WEBPACK_IMPORTED_MODULE_0__["RuleError"]('parse-recur-date', e.message); - } -} -function parseDateString(str) { - if (typeof str !== 'string') { - return null; - } else if (str.length === 10) { - // YYYY-MM-DD - if (!date_fns__WEBPACK_IMPORTED_MODULE_1__["isValid"](date_fns__WEBPACK_IMPORTED_MODULE_1__["parseISO"](str))) { - return null; - } - - return { - type: 'date', - date: str - }; - } else if (str.length === 7) { - // YYYY-MM - if (!date_fns__WEBPACK_IMPORTED_MODULE_1__["isValid"](date_fns__WEBPACK_IMPORTED_MODULE_1__["parseISO"](str + '-01'))) { - return null; - } - - return { - type: 'month', - date: str - }; - } else if (str.length === 4) { - // YYYY - if (!date_fns__WEBPACK_IMPORTED_MODULE_1__["isValid"](date_fns__WEBPACK_IMPORTED_MODULE_1__["parseISO"](str + '-01-01'))) { - return null; - } - - return { - type: 'year', - date: str - }; - } - - return null; -} -function parseBetweenAmount(between) { - let num1 = between.num1, - num2 = between.num2; - - if (typeof num1 !== 'number' || typeof num2 !== 'number') { - return null; - } - - return { - type: 'between', - num1, - num2 - }; -} -let CONDITION_TYPES = { - date: { - ops: ['is', 'isapprox', 'gt', 'gte', 'lt', 'lte'], - nullable: false, - - parse(op, value, fieldName) { - let parsed = typeof value === 'string' ? parseDateString(value) : value.frequency != null ? parseRecurDate(value) : null; - assert(parsed, 'date-format', `Invalid date format (field: ${fieldName})`); // Approximate only works with exact & recurring dates - - if (op === 'isapprox') { - assert(parsed.type === 'date' || parsed.type === 'recur', 'date-format', `Invalid date value for "isapprox" (field: ${fieldName})`); - } // These only work with exact dates - else if (op === 'gt' || op === 'gte' || op === 'lt' || op === 'lte') { - assert(parsed.type === 'date', 'date-format', `Invalid date value for "${op}" (field: ${fieldName})`); - } - - return parsed; - } - - }, - id: { - ops: ['is', 'contains', 'oneOf'], - nullable: true, - - parse(op, value, fieldName) { - if (op === 'oneOf') { - assert(Array.isArray(value), 'no-empty-array', `oneOf must have an array value (field: ${fieldName})`); - return value; - } - - return value; - } - - }, - string: { - ops: ['is', 'contains', 'oneOf'], - nullable: false, - - parse(op, value, fieldName) { - if (op === 'oneOf') { - assert(Array.isArray(value), 'no-empty-array', `oneOf must have an array value (field: ${fieldName}): ${JSON.stringify(value)}`); - return value.filter(Boolean).map(val => val.toLowerCase()); - } - - if (op === 'contains') { - assert(typeof value === 'string' && value.length > 0, 'no-empty-string', `contains must have non-empty string (field: ${fieldName})`); - } - - return value.toLowerCase(); - } - - }, - number: { - ops: ['is', 'isapprox', 'isbetween', 'gt', 'gte', 'lt', 'lte'], - nullable: false, - - parse(op, value, fieldName) { - let parsed = typeof value === 'number' ? { - type: 'literal', - value - } : parseBetweenAmount(value); - assert(parsed != null, 'not-number', `Value must be a number or between amount: ${JSON.stringify(value)} (field: ${fieldName})`); - - if (op === 'isbetween') { - assert(parsed.type === 'between', 'number-format', `Invalid between value for "${op}" (field: ${fieldName})`); - } else { - assert(parsed.type === 'literal', 'number-format', `Invalid number value for "${op}" (field: ${fieldName})`); - } - - return parsed; - } - - }, - boolean: { - ops: ['is'], - nullable: false, - - parse(op, value, fieldName) { - assert(typeof value === 'boolean', 'not-boolean', `Value must be a boolean: ${value} (field: ${fieldName})`); - return value; - } - - } -}; -class Condition { - constructor(op, field, value, options, fieldTypes) { - let typeName = fieldTypes.get(field); - assert(typeName, 'internal', 'Invalid condition field: ' + field); - let type = CONDITION_TYPES[typeName]; // It's important to validate rules because a faulty rule might mess - // up the user's transaction (and be very confusing) - - assert(type, 'internal', `Invalid condition type: ${typeName} (field: ${field})`); - assert(type.ops.includes(op), 'internal', `Invalid condition operator: ${op} (type: ${typeName}, field: ${field})`); - - if (type.nullable !== true) { - assert(value != null, 'no-null', `Field cannot be empty: ${field}`); - } // For strings, an empty string is equal to null - - - if (typeName === 'string' && type.nullable !== true) { - assert(value !== '', 'no-null', `Field cannot be empty: ${field}`); - } - - this.rawValue = value; - this.unparsedValue = value; - this.op = op; - this.field = field; - this.value = type.parse ? type.parse(op, value, field) : value; - this.options = options; - this.type = typeName; - } - - eval(object) { - let fieldValue = object[this.field]; - - if (fieldValue === undefined) { - return false; - } - - if (typeof fieldValue === 'string') { - fieldValue = fieldValue.toLowerCase(); - } - - let type = this.type; - - if (type === 'number' && this.options) { - if (this.options.outflow) { - if (fieldValue > 0) { - return false; - } - - fieldValue = -fieldValue; - } else if (this.options.inflow) { - if (fieldValue < 0) { - return false; - } - } - } - - let extractValue = v => type === 'number' ? v.value : v; - - switch (this.op) { - case 'isapprox': - case 'is': - if (type === 'date') { - if (fieldValue == null) { - return false; - } - - if (this.value.type === 'recur') { - let schedule = this.value.schedule; - - if (this.op === 'isapprox') { - let fieldDate = Object(_shared_months__WEBPACK_IMPORTED_MODULE_2__["parseDate"])(fieldValue); - return schedule.occursBetween(date_fns__WEBPACK_IMPORTED_MODULE_1__["subDays"](fieldDate, 2), date_fns__WEBPACK_IMPORTED_MODULE_1__["addDays"](fieldDate, 2)); - } else { - return schedule.occursOn({ - date: Object(_shared_months__WEBPACK_IMPORTED_MODULE_2__["parseDate"])(fieldValue) - }); - } - } else { - let date = this.value.date; - - if (this.op === 'isapprox') { - let fullDate = Object(_shared_months__WEBPACK_IMPORTED_MODULE_2__["parseDate"])(date); - let high = Object(_shared_months__WEBPACK_IMPORTED_MODULE_2__["addDays"])(fullDate, 2); - let low = Object(_shared_months__WEBPACK_IMPORTED_MODULE_2__["subDays"])(fullDate, 2); - return fieldValue >= low && fieldValue <= high; - } else { - switch (this.value.type) { - case 'date': - return fieldValue === date; - - case 'month': - return Object(_shared_months__WEBPACK_IMPORTED_MODULE_2__["monthFromDate"])(fieldValue) === date; - - case 'year': - return Object(_shared_months__WEBPACK_IMPORTED_MODULE_2__["yearFromDate"])(fieldValue) === date; - - default: - } - } - } - } else if (type === 'number') { - let number = this.value.value; - - if (this.op === 'isapprox') { - let threshold = Object(_shared_rules__WEBPACK_IMPORTED_MODULE_4__["getApproxNumberThreshold"])(number); - return fieldValue >= number - threshold && fieldValue <= number + threshold; - } - - return fieldValue === number; - } - - return fieldValue === this.value; - - case 'isbetween': - { - // The parsing logic already checks that the value is of the - // right type (only numbers with high and low) - let _sortNumbers = Object(_shared_rules__WEBPACK_IMPORTED_MODULE_4__["sortNumbers"])(this.value.num1, this.value.num2), - _sortNumbers2 = _slicedToArray(_sortNumbers, 2), - low = _sortNumbers2[0], - high = _sortNumbers2[1]; - - return fieldValue >= low && fieldValue <= high; - } - - case 'contains': - if (fieldValue === null) { - return false; - } - - return fieldValue.indexOf(this.value) !== -1; - - case 'oneOf': - if (fieldValue === null) { - return false; - } - - return this.value.indexOf(fieldValue) !== -1; - - case 'gt': - if (fieldValue === null) { - return false; - } else if (type === 'date') { - return Object(_shared_months__WEBPACK_IMPORTED_MODULE_2__["isAfter"])(fieldValue, this.value.date); - } - - return fieldValue > extractValue(this.value); - - case 'gte': - if (fieldValue === null) { - return false; - } else if (type === 'date') { - return fieldValue === this.value.date || Object(_shared_months__WEBPACK_IMPORTED_MODULE_2__["isAfter"])(fieldValue, this.value.date); - } - - return fieldValue >= extractValue(this.value); - - case 'lt': - if (fieldValue === null) { - return false; - } else if (type === 'date') { - return Object(_shared_months__WEBPACK_IMPORTED_MODULE_2__["isBefore"])(fieldValue, this.value.date); - } - - return fieldValue < extractValue(this.value); - - case 'lte': - if (fieldValue === null) { - return false; - } else if (type === 'date') { - return fieldValue === this.value.date || Object(_shared_months__WEBPACK_IMPORTED_MODULE_2__["isBefore"])(fieldValue, this.value.date); - } - - return fieldValue <= extractValue(this.value); - - default: - } - - return false; - } - - getValue() { - return this.value; - } - - serialize() { - return _objectSpread({ - op: this.op, - field: this.field, - value: this.unparsedValue, - type: this.type - }, this.options ? { - options: this.options - } : null); - } - -} -let ACTION_OPS = ['set', 'link-schedule']; -class Action { - constructor(op, field, value, options, fieldTypes) { - assert(ACTION_OPS.includes(op), 'internal', `Invalid action operation: ${op}`); - - if (op === 'set') { - let typeName = fieldTypes.get(field); - assert(typeName, 'internal', `Invalid field for action: ${field}`); - this.field = field; - this.type = typeName; - } else if (op === 'link-schedule') { - this.field = null; - this.type = 'id'; - } - - this.op = op; - this.rawValue = value; - this.value = value; - this.options = options; - } - - exec(object) { - switch (this.op) { - case 'set': - object[this.field] = this.value; - break; - - case 'link-schedule': - object.schedule = this.value; - break; - - default: - } - } - - serialize() { - return _objectSpread({ - op: this.op, - field: this.field, - value: this.value, - type: this.type - }, this.options ? { - options: this.options - } : null); - } - -} -class Rule { - constructor({ - id, - stage, - conditions, - actions, - fieldTypes - }) { - this.id = id; - this.stage = stage; - this.conditions = conditions.map(c => new Condition(c.op, c.field, c.value, c.options, fieldTypes)); - this.actions = actions.map(a => new Action(a.op, a.field, a.value, a.options, fieldTypes)); - } - - evalConditions(object) { - if (this.conditions.length === 0) { - return false; - } - - return this.conditions.every(condition => { - return condition.eval(object); - }); - } - - execActions(object) { - let changes = {}; - this.actions.forEach(action => action.exec(changes)); - return changes; - } - - exec(object) { - if (this.evalConditions(object)) { - return this.execActions(object); - } - - return null; - } // Apply is similar to exec but applies the changes for you - - - apply(object) { - let changes = this.exec(object); - return Object.assign({}, object, changes); - } - - getId() { - return this.id; - } - - serialize() { - return { - id: this.id, - stage: this.stage, - conditions: this.conditions.map(c => c.serialize()), - actions: this.actions.map(a => a.serialize()) - }; - } - -} -class RuleIndexer { - constructor({ - field, - method - }) { - this.field = field; - this.method = method; - this.rules = new Map(); - } - - getIndex(key) { - if (!this.rules.has(key)) { - this.rules.set(key, new Set()); - } - - return this.rules.get(key); - } - - getIndexForValue(value) { - return this.getIndex(this.getKey(value) || '*'); - } - - getKey(value) { - if (typeof value === 'string' && value !== '') { - if (this.method === 'firstchar') { - return value[0].toLowerCase(); - } - - return value.toLowerCase(); - } - - return null; - } - - getIndexes(rule) { - let cond = rule.conditions.find(cond => cond.field === this.field); - let indexes = []; - - if (cond && (cond.op === 'oneOf' || cond.op === 'is')) { - if (cond.op === 'oneOf') { - cond.value.forEach(val => indexes.push(this.getIndexForValue(val))); - } else { - indexes.push(this.getIndexForValue(cond.value)); - } - } else { - indexes.push(this.getIndex('*')); - } - - return indexes; - } - - index(rule) { - let indexes = this.getIndexes(rule); - indexes.forEach(index => { - index.add(rule); - }); - } - - remove(rule) { - let indexes = this.getIndexes(rule); - indexes.forEach(index => { - index.delete(rule); - }); - } - - getApplicableRules(object) { - let indexedRules; - - if (this.field in object) { - let key = this.getKey(object[this.field]); - - if (key) { - indexedRules = this.rules.get(key); - } - } - - return Object(_shared_util__WEBPACK_IMPORTED_MODULE_3__["fastSetMerge"])(indexedRules || new Set(), this.rules.get('*') || new Set()); - } - -} -const OP_SCORES = { - is: 10, - oneOf: 9, - isapprox: 5, - isbetween: 5, - gt: 1, - gte: 1, - lt: 1, - lte: 1, - contains: 0 -}; - -function computeScore(rule) { - let initialScore = rule.conditions.reduce((score, condition) => { - if (OP_SCORES[condition.op] == null) { - console.log(`Found invalid operation while ranking: ${condition.op}`); - return 0; - } - - return score + OP_SCORES[condition.op]; - }, 0); - - if (rule.conditions.every(cond => cond.op === 'is' || cond.op === 'isapprox' || cond.op === 'oneOf')) { - return initialScore * 2; - } - - return initialScore; -} - -function _rankRules(rules) { - let scores = new Map(); - rules.forEach(rule => { - scores.set(rule, computeScore(rule)); - }); // No matter the order of rules, this must always return exactly the same - // order. That's why rules have ids: if two rules have the same score, it - // sorts by id - - return [...rules].sort((r1, r2) => { - let score1 = scores.get(r1); - let score2 = scores.get(r2); - - if (score1 < score2) { - return -1; - } else if (score1 > score2) { - return 1; - } else { - let id1 = r1.getId(); - let id2 = r2.getId(); - return id1 < id2 ? -1 : id1 > id2 ? 1 : 0; - } - }); -} - -function rankRules(rules) { - let pre = []; - let normal = []; - let post = []; - - for (let rule of rules) { - switch (rule.stage) { - case 'pre': - pre.push(rule); - break; - - case 'post': - post.push(rule); - break; - - default: - normal.push(rule); - } - } - - pre = _rankRules(pre); - normal = _rankRules(normal); - post = _rankRules(post); - return pre.concat(normal).concat(post); -} -function migrateIds(rule, mappings) { - // Go through the in-memory rules and patch up ids that have been - // "migrated" to other ids. This is a little tricky, but a lot - // easier than trying to keep an up-to-date mapping in the db. This - // is necessary because ids can be transparently mapped as items are - // merged/deleted in the system. - // - // It's very important here that we look at `rawValue` specifically, - // and only apply the patches to the other `value` fields. We always - // need to keep the original id around because undo can walk - // backwards, and we need to be able to consistently apply a - // "projection" of these mapped values. For example: if we have ids - // [1, 2] and applying mappings transforms it to [2, 2], if `1` gets - // mapped to something else there's no way to no to map *only* the - // first id back to make [1, 2]. Keeping the original value around - // solves this. - for (let ci = 0; ci < rule.conditions.length; ci++) { - let cond = rule.conditions[ci]; - - if (cond.type === 'id') { - switch (cond.op) { - case 'is': - cond.value = mappings.get(cond.rawValue) || cond.rawValue; - cond.unparsedValue = cond.value; - break; - - case 'oneOf': - cond.value = cond.rawValue.map(v => mappings.get(v) || v); - cond.unparsedValue = [...cond.value]; - break; - - default: - } - } - } - - for (let ai = 0; ai < rule.actions.length; ai++) { - let action = rule.actions[ai]; - - if (action.type === 'id') { - if (action.op === 'set') { - action.value = mappings.get(action.rawValue) || action.rawValue; - } - } - } -} // This finds all the rules that reference the `id` - -function iterateIds(rules, fieldName, func) { - let counts = {}; - let i; - - ruleiter: for (i = 0; i < rules.length; i++) { - let rule = rules[i]; - - for (let ci = 0; ci < rule.conditions.length; ci++) { - let cond = rule.conditions[ci]; - - if (cond.type === 'id' && cond.field === fieldName) { - switch (cond.op) { - case 'is': - if (func(rule, cond.value)) { - continue ruleiter; - } - - break; - - case 'oneOf': - for (let vi = 0; vi < cond.value.length; vi++) { - if (func(rule, cond.value[vi])) { - continue ruleiter; - } - } - - break; - - default: - } - } - } - - for (let ai = 0; ai < rule.actions.length; ai++) { - let action = rule.actions[ai]; - - if (action.type === 'id' && action.field === fieldName) { - // Currently `set` is the only op, but if we add more this - // will need to be extended - if (action.op === 'set') { - if (func(rule, action.value)) { - break; - } - } - } - } - } -} - -/***/ }), - -/***/ "./packages/loot-core/src/server/accounts/sync.js": -/*!********************************************************!*\ - !*** ./packages/loot-core/src/server/accounts/sync.js ***! - \********************************************************/ -/*! exports provided: getAccounts, fromPlaid, reconcileTransactions, addTransactions, syncAccount */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getAccounts", function() { return getAccounts; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fromPlaid", function() { return fromPlaid; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "reconcileTransactions", function() { return reconcileTransactions; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addTransactions", function() { return addTransactions; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "syncAccount", function() { return syncAccount; }); -/* harmony import */ var _title__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./title */ "./packages/loot-core/src/server/accounts/title/index.js"); -/* harmony import */ var _title__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_title__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _db__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../db */ "./packages/loot-core/src/server/db/index.js"); -/* harmony import */ var _shared_util__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../shared/util */ "./packages/loot-core/src/shared/util.js"); -/* harmony import */ var _shared_transactions__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../shared/transactions */ "./packages/loot-core/src/shared/transactions.js"); -/* harmony import */ var _shared_months__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../shared/months */ "./packages/loot-core/src/shared/months.js"); -/* harmony import */ var _api_models__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../api-models */ "./packages/loot-core/src/server/api-models.js"); -/* harmony import */ var _server_config__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../server-config */ "./packages/loot-core/src/server/server-config.js"); -/* harmony import */ var _sync__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../sync */ "./packages/loot-core/src/server/sync/index.js"); -/* harmony import */ var _mutators__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../mutators */ "./packages/loot-core/src/server/mutators.js"); -/* harmony import */ var _payees__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./payees */ "./packages/loot-core/src/server/accounts/payees.js"); -/* harmony import */ var _transfer__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./transfer */ "./packages/loot-core/src/server/accounts/transfer.js"); -/* harmony import */ var _errors__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../errors */ "./packages/loot-core/src/server/errors.js"); -/* harmony import */ var _transaction_rules__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./transaction-rules */ "./packages/loot-core/src/server/accounts/transaction-rules.js"); -/* harmony import */ var _transactions__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./transactions */ "./packages/loot-core/src/server/accounts/transactions.js"); -const _excluded = ["subtransactions"], - _excluded2 = ["payee_name", "subtransactions"]; - -function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } - -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } - -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 _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 _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; } - - - - - - - - - - - - - - - - -const dateFns = __webpack_require__(/*! date-fns */ "./node_modules/date-fns/esm/index.js"); - -const _require = __webpack_require__(/*! ../post */ "./packages/loot-core/src/server/post.js"), - post = _require.post; - -const levenshtein = __webpack_require__(/*! damerau-levenshtein */ "./node_modules/damerau-levenshtein/index.js"); - -const uuid = __webpack_require__(/*! ../../platform/uuid */ "./packages/loot-core/src/platform/uuid/index.electron.js"); // Plaid article about API options: -// https://support.plaid.com/customer/en/portal/articles/2612155-transactions-returned-per-request - - -function BankSyncError(type, code) { - return { - type: 'BankSyncError', - category: type, - code - }; -} - -function makeSplitTransaction(trans, subtransactions) { - // We need to calculate the final state of split transactions - let _recalculateSplit = Object(_shared_transactions__WEBPACK_IMPORTED_MODULE_3__["recalculateSplit"])(_objectSpread(_objectSpread({}, trans), {}, { - is_parent: true, - subtransactions: subtransactions.map((transaction, idx) => Object(_shared_transactions__WEBPACK_IMPORTED_MODULE_3__["makeChild"])(trans, _objectSpread(_objectSpread({}, transaction), {}, { - sort_order: 0 - idx - }))) - })), - sub = _recalculateSplit.subtransactions, - parent = _objectWithoutProperties(_recalculateSplit, _excluded); - - return [parent, ...sub]; -} - -function getAccountBalance(account) { - // Debt account types need their balance reversed - switch (account.type) { - case 'credit': - case 'loan': - return -account.balances.current; - - default: - return account.balances.current; - } -} - -async function updateAccountBalance(id, balance) { - await _db__WEBPACK_IMPORTED_MODULE_1__["runQuery"]('UPDATE accounts SET balance_current = ? WHERE id = ?', [Object(_shared_util__WEBPACK_IMPORTED_MODULE_2__["amountToInteger"])(balance), id]); -} - -async function getAccounts(userId, userKey, id) { - let res = await post(Object(_server_config__WEBPACK_IMPORTED_MODULE_6__["getServer"])().PLAID_SERVER + '/accounts', { - userId, - key: userKey, - item_id: id - }); - let accounts = res.accounts; - accounts.forEach(acct => { - acct.balances.current = getAccountBalance(acct); - }); - return accounts; -} -function fromPlaid(trans) { - return { - imported_id: trans.transaction_id, - payee_name: trans.name, - imported_payee: trans.name, - amount: -Object(_shared_util__WEBPACK_IMPORTED_MODULE_2__["amountToInteger"])(trans.amount), - date: trans.date - }; -} - -async function downloadTransactions(userId, userKey, acctId, bankId, since, count) { - let allTransactions = []; - let accountBalance = null; - let pageSize = 100; - let offset = 0; - let numDownloaded = 0; - - while (1) { - const endDate = _shared_months__WEBPACK_IMPORTED_MODULE_4__["currentDay"](); - const res = await post(Object(_server_config__WEBPACK_IMPORTED_MODULE_6__["getServer"])().PLAID_SERVER + '/transactions', { - userId: userId, - key: userKey, - item_id: '' + bankId, - account_id: acctId, - start_date: since, - end_date: endDate, - count: pageSize, - offset - }); - - if (res.error_code) { - throw BankSyncError(res.error_type, res.error_code); - } - - if (res.transactions.length === 0) { - break; - } - - numDownloaded += res.transactions.length; // Remove pending transactions for now - we will handle them in - // the future. - - allTransactions = allTransactions.concat(res.transactions.filter(t => !t.pending)); - accountBalance = getAccountBalance(res.accounts[0]); - - if (numDownloaded === res.total_transactions || count != null && allTransactions.length >= count) { - break; - } - - offset += pageSize; - } - - allTransactions = count != null ? allTransactions.slice(0, count) : allTransactions; - return { - transactions: allTransactions.map(fromPlaid), - accountBalance - }; -} - -async function resolvePayee(trans, payeeName, payeesToCreate) { - if (trans.payee == null && payeeName) { - // First check our registry of new payees (to avoid a db access) - // then check the db for existing payees - let payee = payeesToCreate.get(payeeName.toLowerCase()); - payee = payee || (await _db__WEBPACK_IMPORTED_MODULE_1__["getPayeeByName"](payeeName)); - - if (payee != null) { - return payee.id; - } else { - // Otherwise we're going to create a new one - let newPayee = { - id: uuid.v4Sync(), - name: payeeName - }; - payeesToCreate.set(payeeName.toLowerCase(), newPayee); - return newPayee.id; - } - } - - return trans.payee; -} - -async function normalizeTransactions(transactions, acctId, { - rawPayeeName -} = {}) { - let payeesToCreate = new Map(); - let normalized = []; - - for (let trans of transactions) { - // Validate the date because we do some stuff with it. The db - // layer does better validation, but this will give nicer errors - if (trans.date == null) { - throw new Error('`date` is required when adding a transaction'); - } // Strip off the irregular properties - - - let _trans = trans, - payee_name = _trans.payee_name, - subtransactions = _trans.subtransactions, - rest = _objectWithoutProperties(_trans, _excluded2); - - trans = rest; - - if (payee_name) { - let trimmed = payee_name.trim(); - - if (trimmed === '') { - payee_name = null; - } else { - payee_name = rawPayeeName ? trimmed : _title__WEBPACK_IMPORTED_MODULE_0___default()(trimmed); - } - } - - trans.imported_payee = trans.imported_payee || payee_name; - - if (trans.imported_payee) { - trans.imported_payee = trans.imported_payee.trim(); - } // It's important to resolve both the account and payee early so - // when rules are run, they have the right data. Resolving payees - // also simplifies the payee creation process - - - trans.account = acctId; - trans.payee = await resolvePayee(trans, payee_name, payeesToCreate); - normalized.push({ - payee_name, - subtransactions: subtransactions ? subtransactions.map(t => _objectSpread(_objectSpread({}, t), {}, { - account: acctId - })) : null, - trans - }); - } - - return { - normalized, - payeesToCreate - }; -} - -async function createNewPayees(payeesToCreate, addsAndUpdates) { - let usedPayeeIds = new Set(addsAndUpdates.map(t => t.payee)); - await Object(_sync__WEBPACK_IMPORTED_MODULE_7__["batchMessages"])(async () => { - for (let payee of payeesToCreate.values()) { - // Only create the payee if it ended up being used - if (usedPayeeIds.has(payee.id)) { - await _db__WEBPACK_IMPORTED_MODULE_1__["insertPayee"](payee); - } - } - }); -} - -async function reconcileTransactions(acctId, transactions) { - const hasMatched = new Set(); - const updated = []; - const added = []; - - let _await$normalizeTrans = await normalizeTransactions(transactions, acctId), - normalized = _await$normalizeTrans.normalized, - payeesToCreate = _await$normalizeTrans.payeesToCreate; // The first pass runs the rules, and preps data for fuzzy matching - - - let transactionsStep1 = []; - - for (let _ref of normalized) { - let payee_name = _ref.payee_name; - let trans = _ref.trans; - let subtransactions = _ref.subtransactions; - // Run the rules - trans = Object(_transaction_rules__WEBPACK_IMPORTED_MODULE_12__["runRules"])(trans); - let match = null; - let fuzzyDataset = null; // First, match with an existing transaction's imported_id. This - // is the highest fidelity match and should always be attempted - // first. - - if (trans.imported_id) { - match = await _db__WEBPACK_IMPORTED_MODULE_1__["first"]('SELECT * FROM v_transactions WHERE imported_id = ? AND account = ?', [trans.imported_id, acctId]); // TODO: Pending transactions - - if (match) { - hasMatched.add(match.id); - } - } // If it didn't match, query data needed for fuzzy matching - - - if (!match) { - // Look 1 day ahead and 4 days back when fuzzy matching. This - // needs to select all fields that need to be read from the - // matched transaction. See the final pass below for the needed - // fields. - fuzzyDataset = await _db__WEBPACK_IMPORTED_MODULE_1__["all"](`SELECT id, date, imported_id, payee, category, notes FROM v_transactions - WHERE date >= ? AND date <= ? AND amount = ? AND account = ? AND is_child = 0`, [_db__WEBPACK_IMPORTED_MODULE_1__["toDateRepr"](_shared_months__WEBPACK_IMPORTED_MODULE_4__["subDays"](trans.date, 4)), _db__WEBPACK_IMPORTED_MODULE_1__["toDateRepr"](_shared_months__WEBPACK_IMPORTED_MODULE_4__["addDays"](trans.date, 1)), trans.amount || 0, acctId]); - } - - transactionsStep1.push({ - payee_name, - trans, - subtransactions, - match, - fuzzyDataset - }); - } // Next, do the fuzzy matching. This first pass matches based on the - // payee id. We do this in multiple passes so that higher fidelity - // matching always happens first, i.e. a transaction should match - // match with low fidelity if a later transaction is going to match - // the same one with high fidelity. - - - let transactionsStep2 = transactionsStep1.map(data => { - if (!data.match && data.fuzzyDataset) { - // Try to find one where the payees match. - let match = data.fuzzyDataset.find(row => !hasMatched.has(row.id) && data.trans.payee === row.payee); - - if (match) { - hasMatched.add(match.id); - return _objectSpread(_objectSpread({}, data), {}, { - match - }); - } - } - - return data; - }); // The final fuzzy matching pass. This is the lowest fidelity - // matching: it just find the first transaction that hasn't been - // matched yet. Remember the the dataset only contains transactions - // around the same date with the same amount. - - let transactionsStep3 = transactionsStep2.map(data => { - if (!data.match && data.fuzzyDataset) { - let match = data.fuzzyDataset.find(row => !hasMatched.has(row.id)); - - if (match) { - hasMatched.add(match.id); - return _objectSpread(_objectSpread({}, data), {}, { - match - }); - } - } - - return data; - }); // Finally, generate & commit the changes - - for (let _ref2 of transactionsStep3) { - let payee_name = _ref2.payee_name; - let trans = _ref2.trans; - let subtransactions = _ref2.subtransactions; - let match = _ref2.match; - - if (match) { - // TODO: change the above sql query to use aql - let existing = _objectSpread(_objectSpread({}, match), {}, { - cleared: match.cleared === 1, - date: _db__WEBPACK_IMPORTED_MODULE_1__["fromDateRepr"](match.date) - }); // Update the transaction - - - const updates = { - date: trans.date, - imported_id: trans.imported_id || null, - payee: existing.payee || trans.payee || null, - category: existing.category || trans.category || null, - imported_payee: trans.imported_payee || null, - notes: existing.notes || trans.notes || null, - cleared: trans.cleared != null ? trans.cleared : true - }; - - if (Object(_shared_util__WEBPACK_IMPORTED_MODULE_2__["hasFieldsChanged"])(existing, updates, Object.keys(updates))) { - updated.push(_objectSpread({ - id: existing.id - }, updates)); - } - } else { - // Insert a new transaction - let finalTransaction = _objectSpread(_objectSpread({}, trans), {}, { - id: uuid.v4Sync(), - category: trans.category || null, - cleared: trans.cleared != null ? trans.cleared : true - }); - - if (subtransactions && subtransactions.length > 0) { - added.push(...makeSplitTransaction(finalTransaction, subtransactions)); - } else { - added.push(finalTransaction); - } - } - } - - await createNewPayees(payeesToCreate, [...added, ...updated]); - await Object(_transactions__WEBPACK_IMPORTED_MODULE_13__["batchUpdateTransactions"])({ - added, - updated - }); - return { - added: added.map(trans => trans.id), - updated: updated.map(trans => trans.id) - }; -} // This is similar to `reconcileTransactions` except much simpler: it -// does not try to match any transactions. It just adds them - -async function addTransactions(acctId, transactions, { - runTransfers = true -} = {}) { - const added = []; - - let _await$normalizeTrans2 = await normalizeTransactions(transactions, acctId, { - rawPayeeName: true - }), - normalized = _await$normalizeTrans2.normalized, - payeesToCreate = _await$normalizeTrans2.payeesToCreate; - - for (let _ref3 of normalized) { - let payee_name = _ref3.payee_name; - let trans = _ref3.trans; - let subtransactions = _ref3.subtransactions; - // Run the rules - trans = Object(_transaction_rules__WEBPACK_IMPORTED_MODULE_12__["runRules"])(trans); - - let finalTransaction = _objectSpread(_objectSpread({ - id: uuid.v4Sync() - }, trans), {}, { - account: acctId, - cleared: trans.cleared != null ? trans.cleared : true - }); // Add split transactions if they are given - - - if (subtransactions && subtransactions.length > 0) { - added.push(...makeSplitTransaction(finalTransaction, subtransactions)); - } else { - added.push(finalTransaction); - } - } - - await createNewPayees(payeesToCreate, added); - let newTransactions; - - if (runTransfers) { - let res = await Object(_transactions__WEBPACK_IMPORTED_MODULE_13__["batchUpdateTransactions"])({ - added - }); - newTransactions = res.added.map(t => t.id); - } else { - await Object(_sync__WEBPACK_IMPORTED_MODULE_7__["batchMessages"])(async () => { - newTransactions = await Promise.all(added.map(async trans => _db__WEBPACK_IMPORTED_MODULE_1__["insertTransaction"](trans))); - }); - } - - return newTransactions; -} -async function syncAccount(userId, userKey, id, acctId, bankId) { - // TODO: Handle the case where transactions exist in the future - // (that will make start date after end date) - const latestTransaction = await _db__WEBPACK_IMPORTED_MODULE_1__["first"]('SELECT * FROM v_transactions WHERE account = ? ORDER BY date DESC LIMIT 1', [id]); - - if (latestTransaction) { - const startingTransaction = await _db__WEBPACK_IMPORTED_MODULE_1__["first"]('SELECT date FROM v_transactions WHERE account = ? ORDER BY date ASC LIMIT 1', [id]); - const startingDate = _db__WEBPACK_IMPORTED_MODULE_1__["fromDateRepr"](startingTransaction.date); // assert(startingTransaction) - // Get all transactions since the latest transaction, plus any 5 - // days before the latest transaction. This gives us a chance to - // resolve any transactions that were entered manually. - // - // TODO: What this really should do is query the last imported_id - // and since then - - let date = _shared_months__WEBPACK_IMPORTED_MODULE_4__["subDays"](_db__WEBPACK_IMPORTED_MODULE_1__["fromDateRepr"](latestTransaction.date), 31); // Never download transactions before the starting date. This was - // when the account was added to the system. - - if (date < startingDate) { - date = startingDate; - } - - let _await$downloadTransa = await downloadTransactions(userId, userKey, acctId, bankId, date), - transactions = _await$downloadTransa.transactions, - accountBalance = _await$downloadTransa.accountBalance; - - if (transactions.length === 0) { - return { - added: [], - updated: [] - }; - } - - transactions = transactions.map(trans => _objectSpread(_objectSpread({}, trans), {}, { - account: id - })); - return Object(_mutators__WEBPACK_IMPORTED_MODULE_8__["runMutator"])(async () => { - const result = await reconcileTransactions(id, transactions); - await updateAccountBalance(id, accountBalance); - return result; - }); - } else { - const acctRow = await _db__WEBPACK_IMPORTED_MODULE_1__["select"]('accounts', id); // Otherwise, download transaction for the last few days if it's an - // on-budget account, or for the past 30 days if off-budget - - const startingDay = _shared_months__WEBPACK_IMPORTED_MODULE_4__["subDays"](_shared_months__WEBPACK_IMPORTED_MODULE_4__["currentDay"](), acctRow.offbudget === 0 ? 1 : 30); - - const _await$downloadTransa2 = await downloadTransactions(userId, userKey, acctId, bankId, dateFns.format(dateFns.parseISO(startingDay), 'yyyy-MM-dd')), - transactions = _await$downloadTransa2.transactions; // We need to add a transaction that represents the starting - // balance for everything to balance out. In order to get balance - // before the first imported transaction, we need to get the - // current balance from the accounts table and subtract all the - // imported transactions. - - - let currentBalance = acctRow.balance_current; - const previousBalance = transactions.reduce((total, trans) => { - return total - trans.amount; - }, currentBalance); - const oldestDate = transactions.length > 0 ? transactions[transactions.length - 1].date : _shared_months__WEBPACK_IMPORTED_MODULE_4__["currentDay"](); - let payee = await Object(_payees__WEBPACK_IMPORTED_MODULE_9__["getStartingBalancePayee"])(); - return Object(_mutators__WEBPACK_IMPORTED_MODULE_8__["runMutator"])(async () => { - let initialId = await _db__WEBPACK_IMPORTED_MODULE_1__["insertTransaction"]({ - account: id, - amount: previousBalance, - category: acctRow.offbudget === 0 ? payee.category : null, - payee: payee.id, - date: oldestDate, - cleared: true, - starting_balance_flag: true - }); - let result = await reconcileTransactions(id, transactions); - return _objectSpread(_objectSpread({}, result), {}, { - added: [initialId, ...result.added] - }); - }); - } -} - -/***/ }), - -/***/ "./packages/loot-core/src/server/accounts/title/index.js": -/*!***************************************************************!*\ - !*** ./packages/loot-core/src/server/accounts/title/index.js ***! - \***************************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -// Utilities -const lowerCase = __webpack_require__(/*! ./lower-case */ "./packages/loot-core/src/server/accounts/title/lower-case.js"); - -const specials = __webpack_require__(/*! ./specials */ "./packages/loot-core/src/server/accounts/title/specials.js"); - -let character = '[0-9\u0041-\u005A\u0061-\u007A\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376-\u0377\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u0523\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0621-\u064A\u066E-\u066F\u0671-\u06D3\u06D5\u06E5-\u06E6\u06EE-\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4-\u07F5\u07FA\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0972\u097B-\u097F\u0985-\u098C\u098F-\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC-\u09DD\u09DF-\u09E1\u09F0-\u09F1\u0A05-\u0A0A\u0A0F-\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32-\u0A33\u0A35-\u0A36\u0A38-\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2-\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0-\u0AE1\u0B05-\u0B0C\u0B0F-\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32-\u0B33\u0B35-\u0B39\u0B3D\u0B5C-\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99-\u0B9A\u0B9C\u0B9E-\u0B9F\u0BA3-\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D\u0C58-\u0C59\u0C60-\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0-\u0CE1\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D28\u0D2A-\u0D39\u0D3D\u0D60-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32-\u0E33\u0E40-\u0E46\u0E81-\u0E82\u0E84\u0E87-\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA-\u0EAB\u0EAD-\u0EB0\u0EB2-\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDD\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8B\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065-\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10D0-\u10FA\u10FC\u1100-\u1159\u115F-\u11A2\u11A8-\u11F9\u1200-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u1676\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F0\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u1900-\u191C\u1950-\u196D\u1970-\u1974\u1980-\u19A9\u19C1-\u19C7\u1A00-\u1A16\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE-\u1BAF\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u2094\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2C6F\u2C71-\u2C7D\u2C80-\u2CE4\u2D00-\u2D25\u2D30-\u2D65\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31B7\u31F0-\u31FF\u3400\u4DB5\u4E00\u9FC3\uA000-\uA48C\uA500-\uA60C\uA610-\uA61F\uA62A-\uA62B\uA640-\uA65F\uA662-\uA66E\uA67F-\uA697\uA717-\uA71F\uA722-\uA788\uA78B-\uA78C\uA7FB-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA90A-\uA925\uA930-\uA946\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAC00\uD7A3\uF900-\uFA2D\uFA30-\uFA6A\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40-\uFB41\uFB43-\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]'; -let regex = new RegExp(`(?:(?:(\\s?(?:^|[.\\(\\)!?;:"-])\\s*)(${character}))|(${character}))(${character}*[’']*${character}*)`, 'g'); - -let convertToRegExp = specials => specials.map(s => [new RegExp(`\\b${s}\\b`, 'gi'), s]); - -function parseMatch(match) { - const firstCharacter = match[0]; // test first character - - if (/\s/.test(firstCharacter)) { - // if whitespace - trim and return - return match.substr(1); - } - - if (/[()]/.test(firstCharacter)) { - // if parens - this shouldn't be replaced - return null; - } - - return match; -} - -module.exports = (str, options = {}) => { - str = str.toLowerCase().replace(regex, (m, lead = '', forced, lower, rest) => { - const parsedMatch = parseMatch(m); - - if (!parsedMatch) { - return m; - } - - if (!forced) { - const fullLower = lower + rest; - - if (lowerCase.has(fullLower)) { - return parsedMatch; - } - } - - return lead + (lower || forced).toUpperCase() + rest; - }); - const customSpecials = options.special || []; - const replace = [...specials, ...customSpecials]; - const replaceRegExp = convertToRegExp(replace); - replaceRegExp.forEach(([pattern, s]) => { - str = str.replace(pattern, s); - }); - return str; -}; - -/***/ }), - -/***/ "./packages/loot-core/src/server/accounts/title/lower-case.js": -/*!********************************************************************!*\ - !*** ./packages/loot-core/src/server/accounts/title/lower-case.js ***! - \********************************************************************/ -/*! no static exports found */ -/***/ (function(module, exports) { - -const conjunctions = ['for', 'and', 'nor', 'but', 'or', 'yet', 'so']; -const articles = ['a', 'an', 'the']; -const prepositions = ['aboard', 'about', 'above', 'across', 'after', 'against', 'along', 'amid', 'among', 'anti', 'around', 'as', 'at', 'before', 'behind', 'below', 'beneath', 'beside', 'besides', 'between', 'beyond', 'but', 'by', 'concerning', 'considering', 'despite', 'down', 'during', 'except', 'excepting', 'excluding', 'following', 'for', 'from', 'in', 'inside', 'into', 'like', 'minus', 'near', 'of', 'off', 'on', 'onto', 'opposite', 'over', 'past', 'per', 'plus', 'regarding', 'round', 'save', 'since', 'than', 'through', 'to', 'toward', 'towards', 'under', 'underneath', 'unlike', 'until', 'up', 'upon', 'versus', 'via', 'with', 'within', 'without']; -module.exports = new Set([...conjunctions, ...articles, ...prepositions]); - -/***/ }), - -/***/ "./packages/loot-core/src/server/accounts/title/specials.js": -/*!******************************************************************!*\ - !*** ./packages/loot-core/src/server/accounts/title/specials.js ***! - \******************************************************************/ -/*! no static exports found */ -/***/ (function(module, exports) { - -const intended = ['CLI', 'API', 'HTTP', 'HTTPS', 'JSX', 'DNS', 'URL', 'CI', 'CDN', 'GitHub', 'CSS', 'JS', 'JavaScript', 'TypeScript', 'HTML', 'WordPress', 'JavaScript', 'Next.js', 'Node.js']; -module.exports = intended; - -/***/ }), - -/***/ "./packages/loot-core/src/server/accounts/transaction-rules.js": -/*!*********************************************************************!*\ - !*** ./packages/loot-core/src/server/accounts/transaction-rules.js ***! - \*********************************************************************/ -/*! exports provided: iterateIds, resetState, ruleModel, makeRule, loadRules, getRules, insertRule, updateRule, deleteRule, runRules, conditionsToAQL, applyActions, getRulesForPayee, updatePayeeRenameRule, getProbableCategory, updateCategoryRules, migrateOldRules */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "resetState", function() { return resetState; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ruleModel", function() { return ruleModel; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "makeRule", function() { return makeRule; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "loadRules", function() { return loadRules; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getRules", function() { return getRules; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "insertRule", function() { return insertRule; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "updateRule", function() { return updateRule; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "deleteRule", function() { return deleteRule; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "runRules", function() { return runRules; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "conditionsToAQL", function() { return conditionsToAQL; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "applyActions", function() { return applyActions; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getRulesForPayee", function() { return getRulesForPayee; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "updatePayeeRenameRule", function() { return updatePayeeRenameRule; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getProbableCategory", function() { return getProbableCategory; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "updateCategoryRules", function() { return updateCategoryRules; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "migrateOldRules", function() { return migrateOldRules; }); -/* harmony import */ var _db__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../db */ "./packages/loot-core/src/server/db/index.js"); -/* harmony import */ var _rules__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./rules */ "./packages/loot-core/src/server/accounts/rules.js"); -/* harmony import */ var _db_mappings__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../db/mappings */ "./packages/loot-core/src/server/db/mappings.js"); -/* harmony import */ var _shared_months__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../shared/months */ "./packages/loot-core/src/shared/months.js"); -/* harmony import */ var _sync_index__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../sync/index */ "./packages/loot-core/src/server/sync/index.js"); -/* harmony import */ var _errors__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../errors */ "./packages/loot-core/src/server/errors.js"); -/* harmony import */ var _shared_rules__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../shared/rules */ "./packages/loot-core/src/shared/rules.js"); -/* harmony import */ var _shared_query__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../shared/query */ "./packages/loot-core/src/shared/query.js"); -/* harmony import */ var _models__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../models */ "./packages/loot-core/src/server/models.js"); -/* harmony import */ var _shared_util__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../shared/util */ "./packages/loot-core/src/shared/util.js"); -/* harmony import */ var _aql_schema__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../aql/schema */ "./packages/loot-core/src/server/aql/schema/index.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "iterateIds", function() { return _rules__WEBPACK_IMPORTED_MODULE_1__["iterateIds"]; }); - -function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } - -function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } - -function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } - -function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } - -function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_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 _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } - -function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } - -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } - -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; } - - - - - - - - - - - - - - - -const uuid = __webpack_require__(/*! ../../platform/uuid */ "./packages/loot-core/src/platform/uuid/index.electron.js"); // TODO: Detect if it looks like the user is creating a rename rule -// and prompt to create it in the pre phase instead -// * We could also make the "create rule" button a dropdown that -// provides different "templates" like "create renaming rule" - - - -let allRules; -let unlistenSync; -let firstcharIndexer; -let payeeIndexer; -function resetState() { - allRules = new Map(); - firstcharIndexer = new _rules__WEBPACK_IMPORTED_MODULE_1__["RuleIndexer"]({ - field: 'imported_payee', - method: 'firstchar' - }); - payeeIndexer = new _rules__WEBPACK_IMPORTED_MODULE_1__["RuleIndexer"]({ - field: 'payee' - }); -} // Database functions - -function invert(obj) { - return Object.fromEntries(Object.entries(obj).map(entry => { - return [entry[1], entry[0]]; - })); -} - -let internalFields = _aql_schema__WEBPACK_IMPORTED_MODULE_10__["schemaConfig"].views.transactions.fields; -let publicFields = invert(_aql_schema__WEBPACK_IMPORTED_MODULE_10__["schemaConfig"].views.transactions.fields); - -function fromInternalField(obj) { - return _objectSpread(_objectSpread({}, obj), {}, { - field: publicFields[obj.field] || obj.field - }); -} - -function toInternalField(obj) { - return _objectSpread(_objectSpread({}, obj), {}, { - field: internalFields[obj.field] || obj.field - }); -} - -const ruleModel = { - validate(rule, { - update - } = {}) { - Object(_models__WEBPACK_IMPORTED_MODULE_8__["requiredFields"])('rules', rule, ['conditions', 'actions'], update); - - if (!update || 'stage' in rule) { - if (rule.stage !== 'pre' && rule.stage !== 'post' && rule.stage !== null) { - throw new Error('Invalid rule stage: ' + rule.stage); - } - } - - return rule; - }, - - toJS(row) { - function parseArray(str) { - let value; - - try { - value = typeof str === 'string' ? JSON.parse(str) : str; - } catch (e) { - throw new _errors__WEBPACK_IMPORTED_MODULE_5__["RuleError"]('internal', 'Cannot parse rule json'); - } - - if (!Array.isArray(value)) { - throw new _errors__WEBPACK_IMPORTED_MODULE_5__["RuleError"]('internal', 'Rule json must be an array'); - } - - return value; - } - - let rule = _objectSpread({}, row); - - rule.conditions = rule.conditions ? parseArray(rule.conditions).map(cond => fromInternalField(cond)) : []; - rule.actions = rule.actions ? parseArray(rule.actions).map(action => fromInternalField(action)) : []; - return rule; - }, - - fromJS(rule) { - let row = _objectSpread({}, rule); - - if ('conditions' in row) { - let conditions = row.conditions.map(cond => toInternalField(cond)); - row.conditions = JSON.stringify(conditions); - } - - if ('actions' in row) { - let actions = row.actions.map(action => toInternalField(action)); - row.actions = JSON.stringify(actions); - } - - return row; - } - -}; -function makeRule(data) { - let rule; - - try { - rule = new _rules__WEBPACK_IMPORTED_MODULE_1__["Rule"](_objectSpread(_objectSpread({}, ruleModel.toJS(data)), {}, { - fieldTypes: _shared_rules__WEBPACK_IMPORTED_MODULE_6__["FIELD_TYPES"] - })); - } catch (e) { - console.warn('Invalid rule', e); - - if (e instanceof _errors__WEBPACK_IMPORTED_MODULE_5__["RuleError"]) { - return null; - } - - throw e; - } // This is needed because we map ids on the fly, and they might - // not be persisted into the db. Mappings allow items to - // transparently merge with other items - - - Object(_rules__WEBPACK_IMPORTED_MODULE_1__["migrateIds"])(rule, Object(_db_mappings__WEBPACK_IMPORTED_MODULE_2__["getMappings"])()); - return rule; -} -async function loadRules() { - resetState(); - let rules = await _db__WEBPACK_IMPORTED_MODULE_0__["all"](` - SELECT * FROM rules - WHERE conditions IS NOT NULL AND actions IS NOT NULL AND tombstone = 0 - `); - - for (let i = 0; i < rules.length; i++) { - let desc = rules[i]; // These are old stages, can be removed before release - - if (desc.stage === 'cleanup' || desc.stage === 'modify') { - desc.stage = 'pre'; - } - - let rule = makeRule(desc); - - if (rule) { - allRules.set(rule.id, rule); - firstcharIndexer.index(rule); - payeeIndexer.index(rule); - } - } - - if (unlistenSync) { - unlistenSync(); - } - - unlistenSync = Object(_sync_index__WEBPACK_IMPORTED_MODULE_4__["addSyncListener"])(onApplySync); -} -function getRules() { - // This can simply return the in-memory data - return [...allRules.values()]; -} -async function insertRule(rule) { - rule = ruleModel.validate(rule); - return _db__WEBPACK_IMPORTED_MODULE_0__["insertWithUUID"]('rules', ruleModel.fromJS(rule)); -} -async function updateRule(rule) { - rule = ruleModel.validate(rule, { - update: true - }); - return _db__WEBPACK_IMPORTED_MODULE_0__["update"]('rules', ruleModel.fromJS(rule)); -} -async function deleteRule(rule) { - let schedule = await _db__WEBPACK_IMPORTED_MODULE_0__["first"]('SELECT id FROM schedules WHERE rule = ?', [rule.id]); - - if (schedule) { - return false; - } - - return _db__WEBPACK_IMPORTED_MODULE_0__["delete_"]('rules', rule.id); -} // Sync projections - -function onApplySync(oldValues, newValues) { - newValues.forEach((items, table) => { - if (table === 'rules') { - items.forEach(newValue => { - let oldRule = allRules.get(newValue.id); - - if (newValue.tombstone === 1) { - // Deleted, need to remove it from in-memory - let rule = allRules.get(newValue.id); - - if (rule) { - allRules.delete(rule.getId()); - firstcharIndexer.remove(rule); - payeeIndexer.remove(rule); - } - } else { - // Inserted/updated - let rule = makeRule(newValue); - - if (rule) { - if (oldRule) { - firstcharIndexer.remove(oldRule); - payeeIndexer.remove(oldRule); - } - - allRules.set(newValue.id, rule); - firstcharIndexer.index(rule); - payeeIndexer.index(rule); - } - } - }); - } - }); // If any of the mapping tables have changed, we need to refresh the - // ids - - let tables = [...newValues.keys()]; - - if (tables.find(table => table.indexOf('mapping') !== -1)) { - getRules().forEach(rule => { - Object(_rules__WEBPACK_IMPORTED_MODULE_1__["migrateIds"])(rule, Object(_db_mappings__WEBPACK_IMPORTED_MODULE_2__["getMappings"])()); - }); - } -} // Runner - - -function runRules(trans) { - let finalTrans = _objectSpread({}, trans); - - let allChanges = {}; - let rules = Object(_rules__WEBPACK_IMPORTED_MODULE_1__["rankRules"])(Object(_shared_util__WEBPACK_IMPORTED_MODULE_9__["fastSetMerge"])(firstcharIndexer.getApplicableRules(trans), payeeIndexer.getApplicableRules(trans))); - - for (let i = 0; i < rules.length; i++) { - finalTrans = rules[i].apply(finalTrans); - } - - return finalTrans; -} // This does the inverse: finds all the transactions matching a rule - -function conditionsToAQL(conditions, { - recurDateBounds = 100 -} = {}) { - let errors = []; - conditions = conditions.map(cond => { - if (cond instanceof _rules__WEBPACK_IMPORTED_MODULE_1__["Condition"]) { - return cond; - } - - try { - return new _rules__WEBPACK_IMPORTED_MODULE_1__["Condition"](cond.op, cond.field, cond.value, cond.options, _shared_rules__WEBPACK_IMPORTED_MODULE_6__["FIELD_TYPES"]); - } catch (e) { - errors.push(e.type || 'internal'); - console.log('conditionsToAQL: invalid condition: ' + e.message); - return null; - } - }).filter(Boolean); // rule -> actualql - - let filters = conditions.map(cond => { - let type = cond.type, - field = cond.field, - op = cond.op, - value = cond.value, - options = cond.options; - - let getValue = value => { - if (type === 'number') { - return value.value; - } - - return value; - }; - - let apply = (field, op, value) => { - if (type === 'number') { - if (options) { - if (options.outflow) { - return { - $and: [{ - amount: { - $lt: 0 - } - }, { - [field]: { - $transform: '$neg', - [op]: value - } - }] - }; - } else if (options.inflow) { - return { - $and: [{ - amount: { - $gt: 0 - } - }, { - [field]: { - [op]: value - } - }] - }; - } - } - - return { - amount: { - [op]: value - } - }; - } else if (type === 'string') { - return { - [field]: { - $transform: '$lower', - [op]: value - } - }; - } else if (type === 'date') { - return { - [field]: { - [op]: value.date - } - }; - } - - return { - [field]: { - [op]: value - } - }; - }; - - switch (op) { - case 'isapprox': - case 'is': - if (type === 'date') { - if (value.type === 'recur') { - let dates = value.schedule.occurrences({ - take: recurDateBounds - }).toArray().map(d => Object(_shared_months__WEBPACK_IMPORTED_MODULE_3__["dayFromDate"])(d.date)); - - let compare = d => ({ - $eq: d - }); - - return { - $or: dates.map(d => { - if (op === 'isapprox') { - return { - $and: [{ - date: { - $gte: Object(_shared_months__WEBPACK_IMPORTED_MODULE_3__["subDays"])(d, 2) - } - }, { - date: { - $lte: Object(_shared_months__WEBPACK_IMPORTED_MODULE_3__["addDays"])(d, 2) - } - }] - }; - } - - return { - date: d - }; - }) - }; - } else { - let date = value.date; - - if (op === 'isapprox') { - let fullDate = Object(_shared_months__WEBPACK_IMPORTED_MODULE_3__["parseDate"])(value.date); - let high = Object(_shared_months__WEBPACK_IMPORTED_MODULE_3__["addDays"])(fullDate, 2); - let low = Object(_shared_months__WEBPACK_IMPORTED_MODULE_3__["subDays"])(fullDate, 2); - return { - $and: [{ - date: { - $gte: low - } - }, { - date: { - $lte: high - } - }] - }; - } else { - switch (value.type) { - case 'date': - return { - date: value.date - }; - - case 'month': - { - let low = value.date + '-00'; - let high = value.date + '-99'; - return { - $and: [{ - date: { - $gte: low - } - }, { - date: { - $lte: high - } - }] - }; - } - - case 'year': - { - let low = value.date + '-00-00'; - let high = value.date + '-99-99'; - return { - $and: [{ - date: { - $gte: low - } - }, { - date: { - $lte: high - } - }] - }; - } - - default: - } - } - } - } else if (type === 'number') { - let number = value.value; - - if (op === 'isapprox') { - let threshold = Object(_shared_rules__WEBPACK_IMPORTED_MODULE_6__["getApproxNumberThreshold"])(number); - return { - $and: [apply(field, '$gte', number - threshold), apply(field, '$lte', number + threshold)] - }; - } - - return apply(field, '$eq', number); - } - - return apply(field, '$eq', value); - - case 'isbetween': - // This operator is only applicable to the specific `between` - // number type so we don't use `apply` - let _sortNumbers = Object(_shared_rules__WEBPACK_IMPORTED_MODULE_6__["sortNumbers"])(value.num1, value.num2), - _sortNumbers2 = _slicedToArray(_sortNumbers, 2), - low = _sortNumbers2[0], - high = _sortNumbers2[1]; - - return { - [field]: [{ - $gte: low - }, { - $lte: high - }] - }; - - case 'contains': - // Running contains with id will automatically reach into - // the `name` of the referenced table and do a string match - return apply(type === 'id' ? field + '.name' : field, '$like', '%' + value + '%'); - - case 'oneOf': - let values = value; - - if (values.length === 0) { - // This forces it to match nothing - return { - id: null - }; - } - - return { - $or: values.map(v => apply(field, '$eq', v)) - }; - - case 'gt': - return apply(field, '$gt', getValue(value)); - - case 'gte': - return apply(field, '$gte', getValue(value)); - - case 'lt': - return apply(field, '$lt', getValue(value)); - - case 'lte': - return apply(field, '$lte', getValue(value)); - - case 'true': - return apply(field, '$eq', true); - - case 'false': - return apply(field, '$eq', false); - - default: - throw new Error('Unhandled operator: ' + op); - } - }); - return { - filters, - errors - }; -} -function applyActions(transactionIds, actions, handlers) { - let parsedActions = actions.map(action => { - if (action instanceof _rules__WEBPACK_IMPORTED_MODULE_1__["Action"]) { - return action; - } - - try { - return new _rules__WEBPACK_IMPORTED_MODULE_1__["Action"](action.op, action.field, action.value, action.options, _shared_rules__WEBPACK_IMPORTED_MODULE_6__["FIELD_TYPES"]); - } catch (e) { - console.log('Action error', e); - return null; - } - }).filter(Boolean); - - if (parsedActions.length !== actions.length) { - // An error happened while parsing - return null; - } - - let updated = transactionIds.map(id => { - let update = { - id - }; - - for (let action of parsedActions) { - action.exec(update); - } - - return update; - }); - return handlers['transactions-batch-update']({ - updated - }); -} -function getRulesForPayee(payeeId) { - let rules = new Set(); - Object(_rules__WEBPACK_IMPORTED_MODULE_1__["iterateIds"])(getRules(), 'payee', (rule, id) => { - if (id === payeeId) { - rules.add(rule); - } - }); - return Object(_rules__WEBPACK_IMPORTED_MODULE_1__["rankRules"])([...rules]); -} - -function* getIsSetterRules(stage, condField, actionField, { - condValue, - actionValue -}) { - let rules = getRules(); - - for (let i = 0; i < rules.length; i++) { - let rule = rules[i]; - - if (rule.stage === stage && rule.actions.length === 1 && rule.actions[0].op === 'set' && rule.actions[0].field === actionField && (actionValue === undefined || rule.actions[0].value === actionValue) && rule.conditions.length === 1 && rule.conditions[0].op === 'is' && rule.conditions[0].field === condField && (condValue === undefined || rule.conditions[0].value === condValue)) { - yield rule.serialize(); - } - } - - return null; -} - -function* getOneOfSetterRules(stage, condField, actionField, { - condValue, - actionValue -}) { - let rules = getRules(); - - for (let i = 0; i < rules.length; i++) { - let rule = rules[i]; - - if (rule.stage === stage && rule.actions.length === 1 && rule.actions[0].op === 'set' && rule.actions[0].field === actionField && (actionValue == null || rule.actions[0].value === actionValue) && rule.conditions.length === 1 && rule.conditions[0].op === 'oneOf' && rule.conditions[0].field === condField && (condValue == null || rule.conditions[0].value.indexOf(condValue) !== -1)) { - yield rule.serialize(); - } - } - - return null; -} - -async function updatePayeeRenameRule(fromNames, to) { - let renameRule = getOneOfSetterRules('pre', 'imported_payee', 'payee', { - actionValue: to - }).next().value; // Note that we don't check for existing rules that set this - // `imported_payee` to something else. It's important to do - // that for categories because categories will be changes frequently - // for the same payee, but renames won't be changed much. It's a use - // case we could improve in the future, but this is fine for now. - - if (renameRule) { - let condition = renameRule.conditions[0]; - let newValue = [...Object(_shared_util__WEBPACK_IMPORTED_MODULE_9__["fastSetMerge"])(new Set(condition.value), new Set(fromNames.filter(name => name !== '')))]; - - let rule = _objectSpread(_objectSpread({}, renameRule), {}, { - conditions: [_objectSpread(_objectSpread({}, condition), {}, { - value: newValue - })] - }); - - await updateRule(rule); - return renameRule.id; - } else { - let rule = new _rules__WEBPACK_IMPORTED_MODULE_1__["Rule"]({ - stage: 'pre', - conditions: [{ - op: 'oneOf', - field: 'imported_payee', - value: fromNames - }], - actions: [{ - op: 'set', - field: 'payee', - value: to - }], - fieldTypes: _shared_rules__WEBPACK_IMPORTED_MODULE_6__["FIELD_TYPES"] - }); - return insertRule(rule.serialize()); - } -} -function getProbableCategory(transactions) { - let scores = new Map(); - transactions.forEach(trans => { - if (trans.category) { - scores.set(trans.category, (scores.get(trans.category) || 0) + 1); - } - }); - let winner = transactions.reduce((winner, trans) => { - let score = scores.get(trans.category); - - if (!winner || score > winner.score) { - return { - score, - category: trans.category - }; - } - - return winner; - }, null); - return winner.score >= 3 ? winner.category : null; -} -async function updateCategoryRules(transactions) { - if (transactions.length === 0) { - return; - } - - let payeeIds = new Set(transactions.map(trans => trans.payee)); - let transIds = new Set(transactions.map(trans => trans.id)); // It's going to be quickest to get the oldest date and then query - // all transactions since then so we can work in memory - - let oldestDate = null; - - for (let i = 0; i < transactions.length; i++) { - if (oldestDate === null || transactions[i].date < oldestDate) { - oldestDate = transactions[i].date; - } - } // We look 6 months behind to include any other transaction. This - // makes it so we, 1. don't have to load in all transactions ever - // and 2. "forget" really old transactions which might be nice and - // 3. don't have to individually run a query for each payee - - - oldestDate = Object(_shared_months__WEBPACK_IMPORTED_MODULE_3__["subDays"])(oldestDate, 180); // Also look 180 days in the future to get any future transactions - // (this might change when we think about scheduled transactions) - - let register = await _db__WEBPACK_IMPORTED_MODULE_0__["all"](`SELECT t.* FROM v_transactions t - LEFT JOIN accounts a ON a.id = t.account - WHERE date >= ? AND date <= ? AND is_parent = 0 AND a.closed = 0`, [Object(_models__WEBPACK_IMPORTED_MODULE_8__["toDateRepr"])(oldestDate), Object(_models__WEBPACK_IMPORTED_MODULE_8__["toDateRepr"])(Object(_shared_months__WEBPACK_IMPORTED_MODULE_3__["addDays"])(Object(_shared_months__WEBPACK_IMPORTED_MODULE_3__["currentDay"])(), 180))]); - let allTransactions = Object(_shared_util__WEBPACK_IMPORTED_MODULE_9__["partitionByField"])(register, 'payee'); - let categoriesToSet = new Map(); - - for (let payeeId of payeeIds) { - // Don't do anything if payee is null - if (payeeId) { - let latestTrans = (allTransactions.get(payeeId) || []).slice(0, 5); // Check if one of the latest transactions was one that was - // updated. We only want to update anything if so. - - if (latestTrans.find(trans => transIds.has(trans.id))) { - let category = getProbableCategory(latestTrans); - - if (category) { - categoriesToSet.set(payeeId, category); - } - } - } - } - - await Object(_sync_index__WEBPACK_IMPORTED_MODULE_4__["batchMessages"])(async () => { - for (let _ref of categoriesToSet.entries()) { - var _ref2 = _slicedToArray(_ref, 2); - - let payeeId = _ref2[0]; - let category = _ref2[1]; - let ruleSetters = [...getIsSetterRules(null, 'payee', 'category', { - condValue: payeeId - })]; - - if (ruleSetters.length > 0) { - // If there are existing rules, change all of them to the new - // category (if they aren't already using it). We set all of - // them because it's possible that multiple rules exist - // because 2 clients made them independently. Not really a big - // deal, but to make sure our update gets applied set it to - // all of them - for (let rule of ruleSetters) { - let action = rule.actions[0]; - - if (action.value !== category) { - await updateRule(_objectSpread(_objectSpread({}, rule), {}, { - actions: [_objectSpread(_objectSpread({}, action), {}, { - value: category - })] - })); - } - } - } else { - // No existing rules, so create one - let newRule = new _rules__WEBPACK_IMPORTED_MODULE_1__["Rule"]({ - stage: null, - conditions: [{ - op: 'is', - field: 'payee', - value: payeeId - }], - actions: [{ - op: 'set', - field: 'category', - value: category - }], - fieldTypes: _shared_rules__WEBPACK_IMPORTED_MODULE_6__["FIELD_TYPES"] - }); - await insertRule(newRule.serialize()); - } - } - }); -} // This can be removed in the future - -async function migrateOldRules() { - let allPayees = await _db__WEBPACK_IMPORTED_MODULE_0__["all"](`SELECT p.*, c.id as category FROM payees p - LEFT JOIN category_mapping cm ON cm.id = p.category - LEFT JOIN categories c ON (c.id = cm.transferId AND c.tombstone = 0) - WHERE p.tombstone = 0 AND transfer_acct IS NULL`); - let allRules = await _db__WEBPACK_IMPORTED_MODULE_0__["all"](`SELECT pr.*, pm.targetId as payee_id FROM payee_rules pr - LEFT JOIN payee_mapping pm ON pm.id = pr.payee_id - WHERE pr.tombstone = 0`); - let payeesById = new Map(); - - for (let i = 0; i < allPayees.length; i++) { - payeesById.set(allPayees[i].id, allPayees[i]); - } - - let rulesByPayeeId = new Map(); - - for (let i = 0; i < allRules.length; i++) { - let item = allRules[i]; - let rules = rulesByPayeeId.get(item.payee_id) || []; - rules.push(item); - rulesByPayeeId.set(item.payee_id, rules); - } - - let rules = []; // Convert payee name rules - - for (let _ref3 of rulesByPayeeId.entries()) { - var _ref4 = _slicedToArray(_ref3, 2); - - let payeeId = _ref4[0]; - let payeeRules = _ref4[1]; - let equals = payeeRules.filter(r => { - let payee = payeesById.get(r.payee_id); - return (r.type === 'equals' || r.type == null) && (!payee || r.value.toLowerCase() !== payee.name.toLowerCase()); - }); - let contains = payeeRules.filter(r => r.type === 'contains'); - let actions = [{ - op: 'set', - field: 'payee', - value: payeeId - }]; - - if (equals.length > 0) { - rules.push({ - stage: null, - conditions: [{ - op: 'oneOf', - field: 'imported_payee', - value: equals.map(payeeRule => payeeRule.value) - }], - actions - }); - } - - if (contains.length > 0) { - rules = rules.concat(contains.map(payeeRule => ({ - stage: null, - conditions: [{ - op: 'contains', - field: 'imported_payee', - value: payeeRule.value - }], - actions - }))); - } - } // Convert category rules - - - let catRules = allPayees.filter(p => p.category).reduce((map, payee) => { - let ids = map.get(payee.category) || new Set(); - ids.add(payee.id); - map.set(payee.category, ids); - return map; - }, new Map()); - - for (let _ref5 of catRules) { - var _ref6 = _slicedToArray(_ref5, 2); - - let catId = _ref6[0]; - let payeeIds = _ref6[1]; - rules.push({ - stage: null, - conditions: [{ - op: 'oneOf', - field: 'payee', - value: [...payeeIds] - }], - actions: [{ - op: 'set', - field: 'category', - value: catId - }] - }); - } // Very important: we never want to sync migration changes, but it - // still has to run through the syncing layer to make sure - // projections are correct. This is only OK because we require a - // sync reset after this. - - - let prevMode = Object(_sync_index__WEBPACK_IMPORTED_MODULE_4__["setSyncingMode"])('disabled'); - await Object(_sync_index__WEBPACK_IMPORTED_MODULE_4__["batchMessages"])(async () => { - for (let rule of rules) { - await insertRule({ - stage: rule.stage, - conditions: rule.conditions, - actions: rule.actions - }); - } - - await _db__WEBPACK_IMPORTED_MODULE_0__["runQuery"]('DELETE FROM payee_rules', []); - }); - Object(_sync_index__WEBPACK_IMPORTED_MODULE_4__["setSyncingMode"])(prevMode); -} - -/***/ }), - -/***/ "./packages/loot-core/src/server/accounts/transactions.js": -/*!****************************************************************!*\ - !*** ./packages/loot-core/src/server/accounts/transactions.js ***! - \****************************************************************/ -/*! exports provided: batchUpdateTransactions */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "batchUpdateTransactions", function() { return batchUpdateTransactions; }); -/* harmony import */ var _sheet__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../sheet */ "./packages/loot-core/src/server/sheet.js"); -/* harmony import */ var _sync__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../sync */ "./packages/loot-core/src/server/sync/index.js"); -/* harmony import */ var _db__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../db */ "./packages/loot-core/src/server/db/index.js"); -/* harmony import */ var _db_util__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../db/util */ "./packages/loot-core/src/server/db/util.js"); -/* harmony import */ var _transfer__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./transfer */ "./packages/loot-core/src/server/accounts/transfer.js"); -/* harmony import */ var _transaction_rules__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./transaction-rules */ "./packages/loot-core/src/server/accounts/transaction-rules.js"); - - - - - - - -const connection = __webpack_require__(/*! ../../platform/server/connection */ "./packages/loot-core/src/platform/server/connection/index.api.js"); - -async function idsWithChildren(ids) { - let whereIds = Object(_db_util__WEBPACK_IMPORTED_MODULE_3__["whereIn"])(ids, 'parent_id'); - let rows = await _db__WEBPACK_IMPORTED_MODULE_2__["all"](`SELECT id FROM v_transactions_internal WHERE ${whereIds}`); - let set = new Set(ids); - - for (let row of rows) { - set.add(row.id); - } - - return [...set]; -} - -async function getTransactionsByIds(ids) { - // TODO: convert to whereIn - // - // or better yet, use ActualQL - return Object(_db_util__WEBPACK_IMPORTED_MODULE_3__["incrFetch"])((query, params) => _db__WEBPACK_IMPORTED_MODULE_2__["selectWithSchema"]('transactions', query, params), ids, id => `id = '${id}'`, where => `SELECT * FROM v_transactions_internal WHERE ${where}`); -} - -async function batchUpdateTransactions({ - added, - deleted, - updated, - learnCategories = false, - detectOrphanPayees = true -}) { - // Track the ids of each type of transaction change (see below for why) - let addedIds = []; - let updatedIds = updated ? updated.map(u => u.id) : []; - let deletedIds = deleted ? await idsWithChildren(deleted.map(d => d.id)) : []; - let oldPayees = new Set(); - let accounts = await _db__WEBPACK_IMPORTED_MODULE_2__["all"]('SELECT * FROM accounts WHERE tombstone = 0'); // We need to get all the payees of updated transactions _before_ - // making changes - - if (updated) { - let descUpdatedIds = updated.filter(update => update.payee).map(update => update.id); - let transactions = await getTransactionsByIds(descUpdatedIds); - - for (let i = 0; i < transactions.length; i++) { - oldPayees.add(transactions[i].payee); - } - } // Apply all the updates. We can batch this now! This is important - // and makes bulk updates much faster - - - await Object(_sync__WEBPACK_IMPORTED_MODULE_1__["batchMessages"])(async () => { - if (added) { - addedIds = await Promise.all(added.map(async t => _db__WEBPACK_IMPORTED_MODULE_2__["insertTransaction"](t))); - } - - if (deleted) { - await Promise.all( // It's important to use `deletedIds` and not `deleted` here - // because we've expanded it to include children above. The - // inconsistency of the delete APIs is annoying and should - // be fixed (it should only take an id) - deletedIds.map(async id => { - await _db__WEBPACK_IMPORTED_MODULE_2__["deleteTransaction"]({ - id - }); - })); - } - - if (updated) { - await Promise.all(updated.map(async t => { - if (t.account) { - // Moving transactions off budget should always clear the - // category - let account = accounts.find(acct => acct.id === t.account); - - if (account.offbudget === 1) { - t.category = null; - } - } - - await _db__WEBPACK_IMPORTED_MODULE_2__["updateTransaction"](t); - })); - } - }); // Get all of the full transactions that were changed. This is - // needed to run any cascading logic that depends on the full - // transaction. Things like transfers, analyzing rule updates, and - // more - - let allAdded = await getTransactionsByIds(addedIds); - let allUpdated = await getTransactionsByIds(updatedIds); - let allDeleted = await getTransactionsByIds(deletedIds); // Post-processing phase: first do any updates to transfers. - // Transfers update the transactions and we need to return updates - // to the client so that can apply them. Note that added - // transactions just return the full transaction. - - let resultAdded = allAdded; - let resultUpdated; - await Object(_sync__WEBPACK_IMPORTED_MODULE_1__["batchMessages"])(async () => { - await Promise.all(allAdded.map(t => _transfer__WEBPACK_IMPORTED_MODULE_4__["onInsert"](t))); // Return any updates from here - - resultUpdated = (await Promise.all(allUpdated.map(t => _transfer__WEBPACK_IMPORTED_MODULE_4__["onUpdate"](t)))).filter(Boolean); - await Promise.all(allDeleted.map(t => _transfer__WEBPACK_IMPORTED_MODULE_4__["onDelete"](t))); - }); - - if (learnCategories) { - // Analyze any updated categories and update rules to learn from - // the user's activity - let ids = new Set([...(added ? added.filter(add => add.category).map(add => add.id) : []), ...(updated ? updated.filter(update => update.category).map(update => update.id) : [])]); - await _transaction_rules__WEBPACK_IMPORTED_MODULE_5__["updateCategoryRules"](allAdded.concat(allUpdated).filter(trans => ids.has(trans.id))); - } - - if (detectOrphanPayees) { - // Look for any orphaned payees and notify the user about merging - // them - if (updated) { - let newPayeeIds = updated.map(u => u.payee).filter(Boolean); - - if (newPayeeIds.length > 0) { - let allOrphaned = new Set(await _db__WEBPACK_IMPORTED_MODULE_2__["getOrphanedPayees"]()); - let orphanedIds = [...oldPayees].filter(id => allOrphaned.has(id)); - - if (orphanedIds.length > 0) { - connection.send('orphaned-payees', { - orphanedIds, - updatedPayeeIds: newPayeeIds - }); - } - } - } - } - - return { - added: resultAdded, - updated: resultUpdated - }; -} - -/***/ }), - -/***/ "./packages/loot-core/src/server/accounts/transfer.js": -/*!************************************************************!*\ - !*** ./packages/loot-core/src/server/accounts/transfer.js ***! - \************************************************************/ -/*! exports provided: addTransfer, removeTransfer, updateTransfer, onInsert, onDelete, onUpdate */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addTransfer", function() { return addTransfer; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "removeTransfer", function() { return removeTransfer; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "updateTransfer", function() { return updateTransfer; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "onInsert", function() { return onInsert; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "onDelete", function() { return onDelete; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "onUpdate", function() { return onUpdate; }); -/* harmony import */ var _db__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../db */ "./packages/loot-core/src/server/db/index.js"); -function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } - -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } - -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; } - - - -async function getPayee(acct) { - return _db__WEBPACK_IMPORTED_MODULE_0__["first"]('SELECT * FROM payees WHERE transfer_acct = ?', [acct]); -} - -async function getTransferredAccount(transaction) { - if (transaction.payee) { - let _await$db$first = await _db__WEBPACK_IMPORTED_MODULE_0__["first"]('SELECT id, transfer_acct FROM v_payees WHERE id = ?', [transaction.payee]), - transfer_acct = _await$db$first.transfer_acct, - id = _await$db$first.id; - - return transfer_acct; - } - - return null; -} - -async function clearCategory(transaction, transferAcct) { - const _await$db$first2 = await _db__WEBPACK_IMPORTED_MODULE_0__["first"]('SELECT offbudget FROM accounts WHERE id = ?', [transaction.account]), - fromOffBudget = _await$db$first2.offbudget; - - const _await$db$first3 = await _db__WEBPACK_IMPORTED_MODULE_0__["first"]('SELECT offbudget FROM accounts WHERE id = ?', [transferAcct]), - toOffBudget = _await$db$first3.offbudget; // We should clear the category to make sure it's not being - // accounted for in the budget, unless it should be in the case of - // transferring from an on-budget to off-budget account - - - if (fromOffBudget === toOffBudget) { - await _db__WEBPACK_IMPORTED_MODULE_0__["updateTransaction"]({ - id: transaction.id, - category: null - }); - return true; - } - - return false; -} - -async function addTransfer(transaction, transferredAccount) { - let _await$db$first4 = await _db__WEBPACK_IMPORTED_MODULE_0__["first"]('SELECT id FROM payees WHERE transfer_acct = ?', [transaction.account]), - fromPayee = _await$db$first4.id; // We need to enforce certain constraints with child transaction transfers - - - if (transaction.parent_id) { - let row = await _db__WEBPACK_IMPORTED_MODULE_0__["first"](` - SELECT p.id, p.transfer_acct FROM v_transactions t - LEFT JOIN payees p ON p.id = t.payee - WHERE t.id = ? - `, [transaction.parent_id]); - - if (row.transfer_acct) { - if (row.id !== transaction.payee) { - // This child transaction is trying to use a transfer payee, - // but the parent is already using a different transfer payee. - // This is not allowed, so not only do we do nothing, we clear - // the payee of the child transaction to make it clear - await _db__WEBPACK_IMPORTED_MODULE_0__["updateTransaction"]({ - id: transaction.id, - payee: null - }); - return { - id: transaction.id, - payee: null - }; - } // The parent has the same transfer payee, so it "owns" the - // transfer logic - - - return null; - } - } - - const id = await _db__WEBPACK_IMPORTED_MODULE_0__["insertTransaction"]({ - account: transferredAccount, - amount: -transaction.amount, - payee: fromPayee, - date: transaction.date, - transfer_id: transaction.id, - notes: transaction.notes || null, - cleared: false - }); - await _db__WEBPACK_IMPORTED_MODULE_0__["updateTransaction"]({ - id: transaction.id, - transfer_id: id - }); - const categoryCleared = await clearCategory(transaction, transferredAccount); - return _objectSpread({ - id: transaction.id, - transfer_id: id - }, categoryCleared ? { - category: null - } : {}); -} -async function removeTransfer(transaction) { - let transferTrans = await _db__WEBPACK_IMPORTED_MODULE_0__["getTransaction"](transaction.transfer_id); - - if (transferTrans.is_child) { - // If it's a child transaction, we don't delete it because that - // would invalidate the whole split transaction. Instead of turn - // it into a normal transaction - await _db__WEBPACK_IMPORTED_MODULE_0__["updateTransaction"]({ - id: transaction.transfer_id, - transfer_id: null, - payee: null - }); - } else { - await _db__WEBPACK_IMPORTED_MODULE_0__["deleteTransaction"]({ - id: transaction.transfer_id - }); - } - - await _db__WEBPACK_IMPORTED_MODULE_0__["updateTransaction"]({ - id: transaction.id, - transfer_id: null - }); - return { - id: transaction.id, - transfer_id: null - }; -} -async function updateTransfer(transaction, transferredAccount) { - let payee = await getPayee(transaction.account); - await _db__WEBPACK_IMPORTED_MODULE_0__["updateTransaction"]({ - id: transaction.transfer_id, - account: transferredAccount, - // Make sure to update the payee on the other side in case the - // user moved this transaction into another account - payee: payee.id, - date: transaction.date, - notes: transaction.notes, - amount: -transaction.amount - }); - const categoryCleared = await clearCategory(transaction, transferredAccount); - - if (categoryCleared) { - return { - id: transaction.id, - category: null - }; - } -} -async function onInsert(transaction) { - let transferredAccount = await getTransferredAccount(transaction); - - if (transferredAccount) { - return addTransfer(transaction, transferredAccount); - } -} -async function onDelete(transaction) { - if (transaction.transfer_id) { - await removeTransfer(transaction); - } -} -async function onUpdate(transaction) { - const transferredAccount = await getTransferredAccount(transaction); - - if (transferredAccount && !transaction.transfer_id) { - return addTransfer(transaction, transferredAccount); - } - - if (!transferredAccount && transaction.transfer_id) { - return removeTransfer(transaction); - } - - if (transferredAccount && transaction.transfer_id) { - return updateTransfer(transaction, transferredAccount); - } -} - -/***/ }), - -/***/ "./packages/loot-core/src/server/api-models.js": -/*!*****************************************************!*\ - !*** ./packages/loot-core/src/server/api-models.js ***! - \*****************************************************/ -/*! exports provided: transactionModel, accountModel, categoryModel, categoryGroupModel, payeeModel, payeeRuleModel */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "transactionModel", function() { return transactionModel; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "accountModel", function() { return accountModel; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "categoryModel", function() { return categoryModel; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "categoryGroupModel", function() { return categoryGroupModel; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "payeeModel", function() { return payeeModel; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "payeeRuleModel", function() { return payeeRuleModel; }); -/* harmony import */ var _models__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./models */ "./packages/loot-core/src/server/models.js"); -const _excluded = ["group_id"], - _excluded2 = ["tombstone"]; - -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 _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 ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } - -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } - -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; } - - -const transactionModel = _objectSpread(_objectSpread({}, _models__WEBPACK_IMPORTED_MODULE_0__["transactionModel"]), {}, { - toExternal(transactions, idx, payees) { - return transactions; // function convert(t, payee) { - // return { - // id: t.id, - // account_id: t.acct, - // amount: t.amount, - // payee_id: payee ? payee.id : null, - // payee: payee ? payee.name : null, - // imported_payee: t.imported_description, - // category_id: t.category, - // date: t.date, - // notes: t.notes, - // imported_id: t.financial_id, - // transfer_id: t.transferred_id, - // cleared: t.cleared - // }; - // } - // let splits = getAllSplitTransactions(transactions, idx); - // if (splits) { - // let payee = - // splits.parent.description && payees[splits.parent.description]; - // return { - // ...convert(splits.parent, payee), - // subtransactions: splits.children.map(child => convert(child, payee)) - // }; - // } - // let transaction = transactions[idx]; - // let payee = transaction.description && payees[transaction.description]; - // return convert(transaction, payee); - }, - - fromExternal(transaction) { - let result = {}; - - if ('id' in transaction) { - result.id = transaction.id; - } - - if ('account_id' in transaction) { - result.acct = transaction.account_id; - } - - if ('amount' in transaction) { - result.amount = transaction.amount; - } - - if ('payee_id' in transaction) { - result.description = transaction.payee_id; - } - - if ('imported_payee' in transaction) { - result.imported_description = transaction.imported_payee; - } - - if ('category_id' in transaction) { - result.category = transaction.category_id; - } - - if ('date' in transaction) { - result.date = transaction.date; - } - - if ('notes' in transaction) { - result.notes = transaction.notes; - } - - if ('imported_id' in transaction) { - result.financial_id = transaction.imported_id; - } - - if ('transfer_id' in transaction) { - result.transferred_id = transaction.transfer_id; - } - - if ('cleared' in transaction) { - result.cleared = transaction.cleared; - } - - return result; - } - -}); -const accountModel = _objectSpread(_objectSpread({}, _models__WEBPACK_IMPORTED_MODULE_0__["accountModel"]), {}, { - toExternal(account) { - return { - id: account.id, - name: account.name, - type: account.type, - offbudget: account.offbudget ? true : false, - closed: account.closed ? true : false - }; - }, - - fromExternal(account) { - let result = _objectSpread({}, account); - - if ('offbudget' in account) { - result.offbudget = account.offbudget ? 1 : 0; - } - - if ('closed' in account) { - result.closed = account.closed ? 1 : 0; - } - - return result; - } - -}); -const categoryModel = _objectSpread(_objectSpread({}, _models__WEBPACK_IMPORTED_MODULE_0__["categoryModel"]), {}, { - toExternal(category) { - return { - id: category.id, - name: category.name, - is_income: category.is_income ? true : false, - group_id: category.cat_group - }; - }, - - fromExternal(category) { - let _ = category.group_id, - result = _objectWithoutProperties(category, _excluded); - - if ('is_income' in category) { - result.is_income = category.is_income ? 1 : 0; - } - - if ('group_id' in category) { - result.cat_group = category.group_id; - } - - return result; - } - -}); -const categoryGroupModel = _objectSpread(_objectSpread({}, _models__WEBPACK_IMPORTED_MODULE_0__["categoryGroupModel"]), {}, { - toExternal(group) { - return { - id: group.id, - name: group.name, - is_income: group.is_income ? true : false, - categories: group.categories.map(categoryModel.toExternal) - }; - }, - - fromExternal(group) { - let result = _objectSpread({}, group); - - if ('is_income' in group) { - result.is_income = group.is_income ? 1 : 0; - } - - if ('categories' in group) { - result.categories = group.categories.map(categoryModel.fromExternal); - } - - return result; - } - -}); -const payeeModel = _objectSpread(_objectSpread({}, _models__WEBPACK_IMPORTED_MODULE_0__["payeeModel"]), {}, { - toExternal(payee) { - return { - id: payee.id, - name: payee.name, - category: payee.category, - transfer_acct: payee.transfer_acct - }; - }, - - fromExternal(payee) { - // No translation is needed - return payee; - } - -}); -const payeeRuleModel = _objectSpread(_objectSpread({}, _models__WEBPACK_IMPORTED_MODULE_0__["payeeRuleModel"]), {}, { - toExternal(rule) { - let tombstone = rule.tombstone, - result = _objectWithoutProperties(rule, _excluded2); - - return result; - }, - - fromExternal(rule) { - return rule; - } - -}); - -/***/ }), - -/***/ "./packages/loot-core/src/server/api.js": -/*!**********************************************!*\ - !*** ./packages/loot-core/src/server/api.js ***! - \**********************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var _accounts_sync__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./accounts/sync */ "./packages/loot-core/src/server/accounts/sync.js"); -/* harmony import */ var _api_models__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./api-models */ "./packages/loot-core/src/server/api-models.js"); -/* harmony import */ var _shared_transactions__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../shared/transactions */ "./packages/loot-core/src/shared/transactions.js"); -/* harmony import */ var _db__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./db */ "./packages/loot-core/src/server/db/index.js"); -/* harmony import */ var _sheet__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./sheet */ "./packages/loot-core/src/server/sheet.js"); -/* harmony import */ var _prefs__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./prefs */ "./packages/loot-core/src/server/prefs.js"); -/* harmony import */ var _shared_months__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../shared/months */ "./packages/loot-core/src/shared/months.js"); -/* harmony import */ var _update__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./update */ "./packages/loot-core/src/server/update.js"); -/* harmony import */ var _cloud_storage__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./cloud-storage */ "./packages/loot-core/src/server/cloud-storage.js"); -/* harmony import */ var _sync__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./sync */ "./packages/loot-core/src/server/sync/index.js"); -/* harmony import */ var _shared_util__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../shared/util */ "./packages/loot-core/src/shared/util.js"); -/* harmony import */ var _timestamp__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./timestamp */ "./packages/loot-core/src/server/timestamp.js"); -/* harmony import */ var _mutators__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./mutators */ "./packages/loot-core/src/server/mutators.js"); -/* harmony import */ var _aql_schema_run_query__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./aql/schema/run-query */ "./packages/loot-core/src/server/aql/schema/run-query.js"); -/* harmony import */ var _shared_query__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../shared/query */ "./packages/loot-core/src/shared/query.js"); -function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } - -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } - -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; } - - - - - - - - - - - - - - - - - - -const _require = __webpack_require__(/*! ./spreadsheet/util */ "./packages/loot-core/src/server/spreadsheet/util.js"), - resolveName = _require.resolveName; - -const connection = __webpack_require__(/*! ../platform/server/connection */ "./packages/loot-core/src/platform/server/connection/index.api.js"); - -let IMPORT_MODE = false; // This is duplicate from main.js... - -function APIError(msg, meta) { - return { - type: 'APIError', - message: msg, - meta - }; -} // The API is different in two ways: we never want undo enabled, and -// we also need to notify the UI manually if stuff has changed (if -// they are connecting to an already running instance, the UI should -// update). The wrapper handles that. - - -function withMutation(handler) { - return args => { - return Object(_mutators__WEBPACK_IMPORTED_MODULE_12__["runMutator"])(async () => { - let latestTimestamp = Object(_timestamp__WEBPACK_IMPORTED_MODULE_11__["getClock"])().timestamp.toString(); - let result = await handler(args); - let rows = await _db__WEBPACK_IMPORTED_MODULE_3__["all"]('SELECT DISTINCT dataset FROM messages_crdt WHERE timestamp > ?', [latestTimestamp]); // Only send the sync event if anybody else is connected - - if (connection.getNumClients() > 1) { - connection.send('sync-event', { - type: 'success', - tables: rows.map(row => row.dataset) - }); - } - - return result; - }, { - undoDisabled: true - }); - }; -} - -let handlers = {}; - -async function validateMonth(month) { - if (!month.match(/^\d{4}-\d{2}$/)) { - throw APIError('Invalid month format, use YYYY-MM: ' + month); - } - - if (!IMPORT_MODE) { - let _await$handlers$getB = await handlers['get-budget-bounds'](), - start = _await$handlers$getB.start, - end = _await$handlers$getB.end; - - let range = _shared_months__WEBPACK_IMPORTED_MODULE_6__["range"](start, end); - - if (!range.includes(month)) { - throw APIError('No budget exists for month: ' + month); - } - } -} - -async function validateExpenseCategory(debug, id) { - if (id == null) { - throw APIError(`${debug}: category id is required`); - } - - let row = await _db__WEBPACK_IMPORTED_MODULE_3__["first"]('SELECT is_income FROM categories WHERE id = ?', [id]); - - if (!row) { - throw APIError(`${debug}: category "${id}" does not exist`); - } - - if (row.is_income !== 0) { - throw APIError(`${debug}: category "${id}" is not an expense category`); - } -} - -let batchPromise = null; - -handlers['api/batch-budget-start'] = async function () { - if (batchPromise) { - throw APIError('Cannot start a batch process: batch already started'); - } // If we are importing, all we need to do is start a raw database - // transaction. Updating spreadsheet cells doesn't go through the - // syncing layer in that case. - - - if (IMPORT_MODE) { - _db__WEBPACK_IMPORTED_MODULE_3__["asyncTransaction"](() => { - return new Promise((resolve, reject) => { - batchPromise = { - resolve, - reject - }; - }); - }); - } else { - Object(_sync__WEBPACK_IMPORTED_MODULE_9__["batchMessages"])(() => { - return new Promise((resolve, reject) => { - batchPromise = { - resolve, - reject - }; - }); - }); - } -}; - -handlers['api/batch-budget-end'] = async function () { - if (!batchPromise) { - throw APIError('Cannot end a batch process: no batch started'); - } - - batchPromise.resolve(); - batchPromise = null; -}; - -handlers['api/load-budget'] = async function ({ - id -}) { - let _ref = _prefs__WEBPACK_IMPORTED_MODULE_5__["getPrefs"]() || {}, - currentId = _ref.id; - - if (currentId !== id) { - connection.send('start-load'); - - let _await$handlers$load = await handlers['load-budget']({ - id - }), - error = _await$handlers$load.error; - - if (!error) { - connection.send('finish-load'); - } else { - connection.send('show-budgets'); - - if (error === 'out-of-sync-migrations' || error === 'out-of-sync-data') { - throw new Error('This budget cannot be loaded with this version of the app.'); - } else if (error === 'budget-not-found') { - throw new Error('Budget "' + id + '" not found. Check the id of your budget in the "Advanced" section of the settings page.'); - } else { - throw new Error('We had an unknown problem opening "' + id + '".'); - } - } - } -}; - -handlers['api/start-import'] = async function ({ - budgetName -}) { - // Notify UI to close budget - await handlers['close-budget'](); // Create the budget - - await handlers['create-budget']({ - budgetName, - avoidUpload: true - }); // Clear out the default expense categories - - await _db__WEBPACK_IMPORTED_MODULE_3__["runQuery"]('DELETE FROM categories WHERE is_income = 0'); - await _db__WEBPACK_IMPORTED_MODULE_3__["runQuery"]('DELETE FROM category_groups WHERE is_income = 0'); // Turn syncing off - - Object(_sync__WEBPACK_IMPORTED_MODULE_9__["setSyncingMode"])('import'); - connection.send('start-import'); - IMPORT_MODE = true; -}; - -handlers['api/finish-import'] = async function () { - _sheet__WEBPACK_IMPORTED_MODULE_4__["get"]().markCacheDirty(); // We always need to fully reload the app. Importing doesn't touch - // the spreadsheet, but we can't just recreate the spreadsheet - // either; there is other internal state that isn't created - - let _prefs$getPrefs = _prefs__WEBPACK_IMPORTED_MODULE_5__["getPrefs"](), - id = _prefs$getPrefs.id; - - await handlers['close-budget'](); - await handlers['load-budget']({ - id - }); - await handlers['get-budget-bounds'](); - await _sheet__WEBPACK_IMPORTED_MODULE_4__["waitOnSpreadsheet"](); - await _cloud_storage__WEBPACK_IMPORTED_MODULE_8__["upload"]().catch(err => {}); - connection.send('finish-import'); - IMPORT_MODE = false; -}; - -handlers['api/abort-import'] = async function () { - if (IMPORT_MODE) { - let _prefs$getPrefs2 = _prefs__WEBPACK_IMPORTED_MODULE_5__["getPrefs"](), - id = _prefs$getPrefs2.id; - - await handlers['close-budget'](); - await handlers['delete-budget']({ - id - }); - connection.send('show-budgets'); - } - - IMPORT_MODE = false; -}; - -handlers['api/query'] = async function ({ - query -}) { - return Object(_aql_schema_run_query__WEBPACK_IMPORTED_MODULE_13__["runQuery"])(query); -}; - -handlers['api/budget-months'] = async function () { - let _await$handlers$getB2 = await handlers['get-budget-bounds'](), - start = _await$handlers$getB2.start, - end = _await$handlers$getB2.end; - - return _shared_months__WEBPACK_IMPORTED_MODULE_6__["range"](start, end); -}; - -handlers['api/budget-month'] = async function ({ - month -}) { - await validateMonth(month); - let groups = await _db__WEBPACK_IMPORTED_MODULE_3__["getCategoriesGrouped"](); - let sheetName = _shared_months__WEBPACK_IMPORTED_MODULE_6__["sheetForMonth"](month); - - function value(name) { - let v = _sheet__WEBPACK_IMPORTED_MODULE_4__["get"]().getCellValue(sheetName, name); - return v === '' ? 0 : v; - } // This is duplicated from main.js because the return format is - // different (for now) - - - return { - month, - incomeAvailable: value('available-funds'), - lastMonthOverspent: value('last-month-overspent'), - forNextMonth: value('buffered'), - totalBudgeted: value('total-budgeted'), - toBudget: value('to-budget'), - fromLastMonth: value('from-last-month'), - totalIncome: value('total-income'), - totalSpent: value('total-spent'), - totalBalance: value('total-leftover'), - categoryGroups: groups.map(group => { - if (group.is_income) { - return _objectSpread(_objectSpread({}, _api_models__WEBPACK_IMPORTED_MODULE_1__["categoryGroupModel"].toExternal(group)), {}, { - received: value('total-income'), - categories: group.categories.map(cat => _objectSpread(_objectSpread({}, _api_models__WEBPACK_IMPORTED_MODULE_1__["categoryModel"].toExternal(cat)), {}, { - received: value(`sum-amount-${cat.id}`) - })) - }); - } - - return _objectSpread(_objectSpread({}, _api_models__WEBPACK_IMPORTED_MODULE_1__["categoryGroupModel"].toExternal(group)), {}, { - budgeted: value(`group-budget-${group.id}`), - spent: value(`group-sum-amount-${group.id}`), - balance: value(`group-leftover-${group.id}`), - categories: group.categories.map(cat => _objectSpread(_objectSpread({}, _api_models__WEBPACK_IMPORTED_MODULE_1__["categoryModel"].toExternal(cat)), {}, { - budgeted: value(`budget-${cat.id}`), - spent: value(`sum-amount-${cat.id}`), - balance: value(`leftover-${cat.id}`), - carryover: value(`carryover-${cat.id}`) - })) - }); - }) - }; -}; - -handlers['api/budget-set-amount'] = withMutation(async function ({ - month, - categoryId, - amount -}) { - return handlers['budget/budget-amount']({ - month, - category: categoryId, - amount - }); -}); -handlers['api/budget-set-carryover'] = withMutation(async function ({ - month, - categoryId, - flag -}) { - await validateMonth(month); - await validateExpenseCategory('budget-set-carryover', categoryId); - return handlers['budget/set-carryover']({ - startMonth: month, - category: categoryId, - flag - }); -}); - -handlers['api/transactions-export'] = async function ({ - transactions, - categoryGroups, - payees -}) { - return handlers['transactions-export']({ - transactions, - categoryGroups, - payees - }); -}; - -handlers['api/transactions-import'] = withMutation(async function ({ - accountId, - transactions -}) { - return handlers['transactions-import']({ - accountId, - transactions - }); -}); -handlers['api/transactions-add'] = withMutation(async function ({ - accountId, - transactions -}) { - await Object(_accounts_sync__WEBPACK_IMPORTED_MODULE_0__["addTransactions"])(accountId, transactions, { - runTransfers: false - }); - return 'ok'; -}); - -handlers['api/transactions-get'] = async function ({ - accountId, - startDate, - endDate -}) { - let _await$aqlQuery = await Object(_aql_schema_run_query__WEBPACK_IMPORTED_MODULE_13__["runQuery"])(Object(_shared_query__WEBPACK_IMPORTED_MODULE_14__["default"])('transactions').filter({ - $and: [accountId && { - account: accountId - }, startDate && { - date: { - $gte: startDate - } - }, endDate && { - date: { - $lte: endDate - } - }].filter(Boolean) - }).select('*').options({ - splits: 'grouped' - })), - data = _await$aqlQuery.data; - - return data; -}; - -handlers['api/transactions-filter'] = async function ({ - text, - accountId -}) { - throw new Error('`filterTransactions` is deprecated, use `runQuery` instead'); -}; - -handlers['api/transaction-update'] = withMutation(async function ({ - id, - fields -}) { - let _await$aqlQuery2 = await Object(_aql_schema_run_query__WEBPACK_IMPORTED_MODULE_13__["runQuery"])(Object(_shared_query__WEBPACK_IMPORTED_MODULE_14__["default"])('transactions').filter({ - id - }).select('*').options({ - splits: 'grouped' - })), - data = _await$aqlQuery2.data; - - let transactions = Object(_shared_transactions__WEBPACK_IMPORTED_MODULE_2__["ungroupTransactions"])(data); - - if (transactions.length === 0) { - return []; - } - - let _updateTransaction = Object(_shared_transactions__WEBPACK_IMPORTED_MODULE_2__["updateTransaction"])(transactions, fields), - diff = _updateTransaction.diff; - - return handlers['transactions-batch-update'](diff); -}); -handlers['api/transaction-delete'] = withMutation(async function ({ - id -}) { - let _await$aqlQuery3 = await Object(_aql_schema_run_query__WEBPACK_IMPORTED_MODULE_13__["runQuery"])(Object(_shared_query__WEBPACK_IMPORTED_MODULE_14__["default"])('transactions').filter({ - id - }).select('*').options({ - splits: 'grouped' - })), - data = _await$aqlQuery3.data; - - let transactions = Object(_shared_transactions__WEBPACK_IMPORTED_MODULE_2__["ungroupTransactions"])(data); - - if (transactions.length === 0) { - return []; - } - - let _deleteTransaction = Object(_shared_transactions__WEBPACK_IMPORTED_MODULE_2__["deleteTransaction"])(transactions, id), - diff = _deleteTransaction.diff; - - return handlers['transactions-batch-update'](diff); -}); - -handlers['api/accounts-get'] = async function () { - let accounts = await _db__WEBPACK_IMPORTED_MODULE_3__["getAccounts"](); - return accounts.map(account => _api_models__WEBPACK_IMPORTED_MODULE_1__["accountModel"].toExternal(account)); -}; - -handlers['api/account-create'] = withMutation(async function ({ - account, - initialBalance = null -}) { - return handlers['account-create']({ - name: account.name, - type: account.type, - offBudget: account.offbudget, - closed: account.closed, - // Current the API expects an amount but it really should expect - // an integer - balance: initialBalance != null ? Object(_shared_util__WEBPACK_IMPORTED_MODULE_10__["integerToAmount"])(initialBalance) : null - }); -}); -handlers['api/account-update'] = withMutation(async function ({ - id, - fields -}) { - return _db__WEBPACK_IMPORTED_MODULE_3__["updateAccount"](_objectSpread({ - id - }, _api_models__WEBPACK_IMPORTED_MODULE_1__["accountModel"].fromExternal(fields))); -}); -handlers['api/account-close'] = withMutation(async function ({ - id, - transferAccountId, - transferCategoryId -}) { - return handlers['account-close']({ - id, - transferAccountId, - categoryId: transferCategoryId - }); -}); -handlers['api/account-reopen'] = withMutation(async function ({ - id -}) { - return handlers['account-reopen']({ - id - }); -}); -handlers['api/account-delete'] = withMutation(async function ({ - id -}) { - return handlers['account-close']({ - id, - forced: true - }); -}); - -handlers['api/categories-get'] = async function ({ - grouped -} = {}) { - let result = await handlers['get-categories'](); - return grouped ? result.grouped.map(_api_models__WEBPACK_IMPORTED_MODULE_1__["categoryGroupModel"].toExternal) : result.list.map(_api_models__WEBPACK_IMPORTED_MODULE_1__["categoryModel"].toExternal); -}; - -handlers['api/category-group-create'] = withMutation(async function ({ - group -}) { - return handlers['category-group-create']({ - name: group.name - }); -}); -handlers['api/category-group-update'] = withMutation(async function ({ - id, - fields -}) { - return handlers['category-group-update'](_objectSpread({ - id - }, _api_models__WEBPACK_IMPORTED_MODULE_1__["categoryGroupModel"].fromExternal(fields))); -}); -handlers['api/category-group-delete'] = withMutation(async function ({ - id, - transferCategoryId -}) { - return handlers['category-group-delete']({ - id, - transferId: transferCategoryId - }); -}); -handlers['api/category-create'] = withMutation(async function ({ - category -}) { - return handlers['category-create']({ - name: category.name, - groupId: category.group_id, - isIncome: category.is_income - }); -}); -handlers['api/category-update'] = withMutation(async function ({ - id, - fields -}) { - return handlers['category-update'](_objectSpread({ - id - }, _api_models__WEBPACK_IMPORTED_MODULE_1__["categoryModel"].fromExternal(fields))); -}); -handlers['api/category-delete'] = withMutation(async function ({ - id, - transferCategoryId -}) { - return handlers['category-delete']({ - id, - transferId: transferCategoryId - }); -}); - -handlers['api/payees-get'] = async function () { - let payees = await handlers['payees-get'](); - return payees.map(_api_models__WEBPACK_IMPORTED_MODULE_1__["payeeModel"].toExternal); -}; - -handlers['api/payee-create'] = withMutation(async function ({ - payee -}) { - return handlers['payee-create']({ - name: payee.name - }); -}); -handlers['api/payee-update'] = withMutation(async function ({ - id, - fields -}) { - return handlers['payees-batch-change']({ - updated: [_objectSpread({ - id - }, _api_models__WEBPACK_IMPORTED_MODULE_1__["payeeModel"].fromExternal(fields))] - }); -}); -handlers['api/payee-delete'] = withMutation(async function ({ - id -}) { - return handlers['payees-batch-change']({ - deleted: [{ - id - }] - }); -}); - -handlers['api/payee-rules-get'] = async function ({ - payeeId -}) { - let rules = await handlers['payees-get-rules']({ - id: payeeId - }); - return rules.map(_api_models__WEBPACK_IMPORTED_MODULE_1__["payeeRuleModel"].toExternal); -}; - -handlers['api/payee-rule-create'] = withMutation(async function ({ - payee_id, - rule -}) { - return handlers['payees-add-rule']({ - payee_id, - type: rule.type, - value: rule.value || null - }); -}); -handlers['api/payee-rule-update'] = withMutation(async function ({ - id, - fields -}) { - return handlers['payees-update-rule'](_objectSpread({ - id - }, _api_models__WEBPACK_IMPORTED_MODULE_1__["payeeRuleModel"].fromExternal(fields))); -}); -handlers['api/payee-rule-delete'] = withMutation(async function ({ - id -}) { - return handlers['payees-delete-rule']({ - id - }); -}); -/* harmony default export */ __webpack_exports__["default"] = (function (serverHandlers) { - handlers = Object.assign({}, serverHandlers, handlers); - return handlers; -}); - -/***/ }), - -/***/ "./packages/loot-core/src/server/app.js": -/*!**********************************************!*\ - !*** ./packages/loot-core/src/server/app.js ***! - \**********************************************/ -/*! exports provided: createApp */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createApp", function() { return createApp; }); -/* harmony import */ var mitt__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! mitt */ "./packages/loot-core/node_modules/mitt/dist/mitt.es.js"); -/* harmony import */ var _platform_exceptions__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../platform/exceptions */ "./packages/loot-core/src/platform/exceptions/index.electron.js"); -function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } - -function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } - -function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } - -function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } - -function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_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 _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } - - - // This is a simple helper abstraction for defining methods exposed to -// the client. It doesn't do much, but checks for naming conflicts and -// makes it cleaner to combine methods. We call a group of related -// methods an "app". - -class App { - constructor() { - this.handlers = {}; - this.services = []; - this.events = Object(mitt__WEBPACK_IMPORTED_MODULE_0__["default"])(); - this.unlistenServices = []; - } - - method(name, func) { - if (this.handlers[name] != null) { - throw new Error('Conflicting method name, names must be globally unique: ' + name); - } - - this.handlers[name] = func; - } - - service(func) { - this.services.push(func); - } - - combine(...apps) { - for (let app of apps) { - Object.keys(app.handlers).forEach(name => { - this.method(name, app.handlers[name]); - }); - app.services.forEach(service => { - this.service(service); - }); - - for (let _ref of app.events.all.entries()) { - var _ref2 = _slicedToArray(_ref, 2); - - let name = _ref2[0]; - let listeners = _ref2[1]; - - for (let listener of listeners) { - this.events.on(name, listener); - } - } - } - } - - startServices() { - if (this.unlistenServices.length > 0) { - Object(_platform_exceptions__WEBPACK_IMPORTED_MODULE_1__["captureException"])(new Error('App: startServices called while services are already running')); - } - - this.unlistenServices = this.services.map(service => service()); - } - - stopServices() { - this.unlistenServices.forEach(unlisten => { - if (unlisten) { - unlisten(); - } - }); - this.unlistenServices = []; - } - -} - -function createApp() { - return new App(); -} - -/***/ }), - -/***/ "./packages/loot-core/src/server/aql/compiler.js": -/*!*******************************************************!*\ - !*** ./packages/loot-core/src/server/aql/compiler.js ***! - \*******************************************************/ -/*! exports provided: addTombstone, quoteAlias, isAggregateQuery, compileQuery, defaultConstructQuery, generateSQLWithState, generateSQL */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addTombstone", function() { return addTombstone; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "quoteAlias", function() { return quoteAlias; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isAggregateQuery", function() { return isAggregateQuery; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "compileQuery", function() { return compileQuery; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "defaultConstructQuery", function() { return defaultConstructQuery; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "generateSQLWithState", function() { return generateSQLWithState; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "generateSQL", function() { return generateSQL; }); -const _excluded = ["$transform"], - _excluded2 = ["$dir"]; - -function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } - -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } - -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 _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 _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 _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } - -function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } - -function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } - -function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } - -function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_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 _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } - -let _uid = 0; - -function resetUid() { - _uid = 0; -} - -function uid(tableName) { - _uid++; - return tableName + _uid; -} - -class CompileError extends Error {} - -function nativeDateToInt(date) { - let pad = x => (x < 10 ? '0' : '') + x; - - return date.getFullYear() + pad(date.getMonth() + 1) + pad(date.getDate()); -} - -function dateToInt(date) { - return parseInt(date.replace(/-/g, '')); -} - -function addTombstone(schema, tableName, tableId, whereStr) { - let hasTombstone = schema[tableName].tombstone != null; - return hasTombstone ? `${whereStr} AND ${tableId}.tombstone = 0` : whereStr; -} - -function popPath(path) { - let parts = path.split('.'); - return { - path: parts.slice(0, -1).join('.'), - field: parts[parts.length - 1] - }; -} - -function isKeyword(str) { - return str === 'group'; -} - -function quoteAlias(alias) { - return alias.indexOf('.') === -1 && !isKeyword(alias) ? alias : `"${alias}"`; -} - -function typed(value, type, { - literal = false -} = {}) { - return { - value, - type, - literal - }; -} - -function getFieldDescription(schema, tableName, field) { - if (schema[tableName] == null) { - throw new CompileError(`Table "${tableName}" does not exist in the schema`); - } - - let fieldDesc = schema[tableName][field]; - - if (fieldDesc == null) { - throw new CompileError(`Field "${field}" does not exist in table "${tableName}"`); - } - - return fieldDesc; -} - -function makePath(state, path) { - let schema = state.schema, - paths = state.paths; - let parts = path.split('.'); - - if (parts.length < 2) { - throw new CompileError('Invalid path: ' + path); - } - - let initialTable = parts[0]; - let tableName = parts.slice(1).reduce((tableName, field) => { - let table = schema[tableName]; - - if (table == null) { - throw new CompileError(`Path error: ${tableName} table does not exist`); - } - - if (!table[field] || table[field].ref == null) { - throw new CompileError(`Field not joinable on table ${tableName}: "${field}"`); - } - - return table[field].ref; - }, initialTable); - let joinTable; - let parentParts = parts.slice(0, -1); - - if (parentParts.length === 1) { - joinTable = parentParts[0]; - } else { - let parentPath = parentParts.join('.'); - let parentDesc = paths.get(parentPath); - - if (!parentDesc) { - throw new CompileError('Path does not exist: ' + parentPath); - } - - joinTable = parentDesc.tableId; - } - - return { - tableName: tableName, - tableId: uid(tableName), - joinField: parts[parts.length - 1], - joinTable - }; -} - -function resolvePath(state, path) { - let paths = path.split('.'); - let tableId; - paths = paths.reduce((acc, name) => { - let fullName = acc.context + '.' + name; - return { - context: fullName, - path: [...acc.path, fullName] - }; - }, { - context: state.implicitTableName, - path: [] - }).path; - paths.forEach(path => { - if (!state.paths.get(path)) { - state.paths.set(path, makePath(state, path)); - } - }); - let pathInfo = state.paths.get(paths[paths.length - 1]); - return pathInfo; -} - -function transformField(state, name) { - if (typeof name !== 'string') { - throw new CompileError('Invalid field name, must be a string'); - } - - let _popPath = popPath(name), - path = _popPath.path, - field = _popPath.field; - - let pathInfo; - - if (path === '') { - pathInfo = { - tableName: state.implicitTableName, - tableId: state.implicitTableId - }; - } else { - pathInfo = resolvePath(state, path); - } - - let fieldDesc = getFieldDescription(state.schema, pathInfo.tableName, field); // If this is a field that references an item in another table, that - // item could have been deleted. If that's the case, we want to - // return `null` instead of an id pointing to a deleted item. This - // converts an id reference into a path that pulls the id through a - // table join which will filter out dead items, resulting in a - // `null` id if the item is deleted - - if (state.validateRefs && fieldDesc.ref && fieldDesc.type === 'id' && field !== 'id') { - let refPath = state.implicitTableName + '.' + name; - let refPathInfo = state.paths.get(refPath); - - if (!refPathInfo) { - refPathInfo = makePath(state, refPath); - refPathInfo.noMapping = true; - state.paths.set(refPath, refPathInfo); - } - - field = 'id'; - pathInfo = refPathInfo; - } - - let fieldStr = pathInfo.tableId + '.' + field; - return typed(fieldStr, fieldDesc.type); -} - -function parseDate(str) { - let m = str.match(/^(\d{4}-\d{2}-\d{2})$/); - - if (m) { - return typed(dateToInt(m[1]), 'date', { - literal: true - }); - } - - return null; -} - -function parseMonth(str) { - let m = str.match(/^(\d{4}-\d{2})$/); - - if (m) { - return typed(dateToInt(m[1]), 'date', { - literal: true - }); - } - - return null; -} - -function parseYear(str) { - let m = str.match(/^(\d{4})$/); - - if (m) { - return typed(dateToInt(m[1]), 'date', { - literal: true - }); - } - - return null; -} - -function badDateFormat(str, type) { - throw new CompileError(`Bad ${type} format: ${str}`); -} - -function inferParam(param, type) { - let existingType = param.paramType; - - if (existingType) { - let casts = { - date: ['string'], - 'date-month': ['date'], - 'date-year': ['date', 'date-month'], - id: ['string'], - float: ['integer'] - }; - - if (existingType !== type && (!casts[type] || !casts[type].includes(existingType))) { - throw new Error(`Parameter "${name}" can't convert to ${type} (already inferred as ${existingType})`); - } - } else { - param.paramType = type; - } -} - -function castInput(state, expr, type) { - if (expr.type === type) { - return expr; - } else if (expr.type === 'param') { - inferParam(expr, type); - return typed(expr.value, type); - } else if (expr.type === 'null') { - if (!expr.literal) { - throw new CompileError("A non-literal null doesn't make sense"); - } - - if (type === 'boolean') { - return typed(0, 'boolean', { - literal: true - }); - } - - return expr; - } // These are all things that can be safely casted automatically - - - if (type === 'date') { - if (expr.type === 'string') { - if (expr.literal) { - return parseDate(expr.value) || badDateFormat(expr.value, 'date'); - } else { - throw new CompileError('Casting string fields to dates is not supported'); - } - } - - throw new CompileError(`Can't cast ${expr.type} to date`); - } else if (type === 'date-month') { - let expr2; - - if (expr.type === 'date') { - expr2 = expr; - } else if (expr.type === 'string' || expr.type === 'any') { - expr2 = parseMonth(expr.value) || parseDate(expr.value) || badDateFormat(expr.value, 'date-month'); - } else { - throw new CompileError(`Can't cast ${expr.type} to date-month`); - } - - if (expr2.literal) { - return typed(dateToInt(expr2.value.toString().slice(0, 6)), 'date-month', { - literal: true - }); - } else { - return typed(`CAST(SUBSTR(${expr2.value}, 1, 6) AS integer)`, 'date-month'); - } - } else if (type === 'date-year') { - let expr2; - - if (expr.type === 'date' || expr.type === 'date-month') { - expr2 = expr; - } else if (expr.type === 'string') { - expr2 = parseYear(expr.value) || parseMonth(expr.value) || parseDate(expr.value) || badDateFormat(expr.value, 'date-year'); - } else { - throw new CompileError(`Can't cast ${expr.type} to date-year`); - } - - if (expr2.literal) { - return typed(dateToInt(expr2.value.toString().slice(0, 4)), 'date-year', { - literal: true - }); - } else { - return typed(`CAST(SUBSTR(${expr2.value}, 1, 4) AS integer)`, 'date-year'); - } - } else if (type === 'id') { - if (expr.type === 'string') { - return typed(expr.value, 'id', { - literal: expr.literal - }); - } - } else if (type === 'float') { - if (expr.type === 'integer') { - return typed(expr.value, 'float', { - literal: expr.literal - }); - } - } - - if (expr.type === 'any') { - return typed(expr.value, type, { - literal: expr.literal - }); - } - - throw new CompileError(`Can't convert ${expr.type} to ${type}`); -} // TODO: remove state from these functions - - -function val(state, expr, type) { - let castedExpr = expr; // Cast the type if necessary - - if (type) { - castedExpr = castInput(state, expr, type); - } - - if (castedExpr.literal) { - if (castedExpr.type === 'id') { - return `'${castedExpr.value}'`; - } else if (castedExpr.type === 'string') { - // Escape quotes - let value = castedExpr.value.replace(/'/g, "''"); - return `'${value}'`; - } - } - - return castedExpr.value; -} - -function valArray(state, arr, types) { - return arr.map((value, idx) => val(state, value, types ? types[idx] : null)); -} - -function validateArgLength(arr, min, max) { - if (max == null) { - max = min; - } - - if (min != null && arr.length < min) { - throw new CompileError('Too few arguments'); - } - - if (max != null && arr.length > max) { - throw new CompileError('Too many arguments'); - } -} //// Nice errors - - -function saveStack(type, func) { - return (state, ...args) => { - if (state == null || state.compileStack == null) { - throw new CompileError('This function cannot track error data. ' + 'It needs to accept the compiler state as the first argument.'); - } - - state.compileStack.push({ - type, - args - }); - let ret = func(state, ...args); - state.compileStack.pop(); - return ret; - }; -} - -function prettyValue(value) { - if (typeof value === 'string') { - return value; - } else if (value === undefined) { - return 'undefined'; - } - - let str = JSON.stringify(value); - - if (str.length > 70) { - let expanded = JSON.stringify(value, null, 2); - return expanded.split('\n').join('\n '); - } - - return str; -} - -function getCompileError(error, stack) { - if (stack.length === 0) { - return error; - } - - let stackStr = stack.slice(1).reverse().map(entry => { - switch (entry.type) { - case 'expr': - case 'function': - return prettyValue(entry.args[0]); - - case 'op': - { - let _entry$args = _slicedToArray(entry.args, 2), - fieldRef = _entry$args[0], - opData = _entry$args[1]; - - return prettyValue({ - [fieldRef]: opData - }); - } - - case 'value': - return prettyValue(entry.value); - - default: - return ''; - } - }).map(str => '\n ' + str).join(''); - const rootMethod = stack[0].type; - const methodArgs = stack[0].args[0]; - stackStr += `\n ${rootMethod}(${prettyValue(methodArgs.length === 1 ? methodArgs[0] : methodArgs)})`; // In production, hide internal stack traces - - if (false) {} - - error.message = `${error.message}\n\nExpression stack:` + stackStr; - return error; -} //// Compiler - - -function compileLiteral(value) { - if (value === undefined) { - throw new CompileError('`undefined` is not a valid query value'); - } else if (value === null) { - return typed('NULL', 'null', { - literal: true - }); - } else if (value instanceof Date) { - return typed(nativeDateToInt(value), 'date', { - literal: true - }); - } else if (typeof value === 'string') { - // Allow user to escape $, and quote the string to make it a - // string literal in the output - value = value.replace(/\\\$/g, '$'); - return typed(value, 'string', { - literal: true - }); - } else if (typeof value === 'boolean') { - return typed(value ? 1 : 0, 'boolean', { - literal: true - }); - } else if (typeof value === 'number') { - return typed(value, (value | 0) === value ? 'integer' : 'float', { - literal: true - }); - } else if (Array.isArray(value)) { - return typed(value, 'array', { - literal: true - }); - } else { - throw new CompileError('Unsupported type of expression: ' + JSON.stringify(value)); - } -} - -const compileExpr = saveStack('expr', (state, expr) => { - if (typeof expr === 'string') { - // Field reference - if (expr[0] === '$') { - let fieldRef = expr === '$' ? state.implicitField : expr.slice(1); - - if (fieldRef == null || fieldRef === '') { - throw new CompileError('Invalid field reference: ' + expr); - } - - return transformField(state, fieldRef); - } // Named parameter - - - if (expr[0] === ':') { - let param = { - value: '?', - type: 'param', - paramName: expr.slice(1) - }; - state.namedParameters.push(param); - return param; - } - } - - if (expr !== null) { - if (Array.isArray(expr)) { - return compileLiteral(expr); - } else if (typeof expr === 'object' && Object.keys(expr).find(k => k[0] === '$')) { - // It's a function call - return compileFunction(state, expr); - } - } - - return compileLiteral(expr); -}); - -function assertType(name, data, acceptedTypes) { - if (acceptedTypes.indexOf(data.type) === -1) { - throw new CompileError(`Invalid type of expression to ${name}, must be one of ${JSON.stringify(acceptedTypes)}: ${JSON.stringify(data.value)}`); - } -} - -function assertArgLength(name, args, len) { - if (args.length !== len) { - throw new CompileError(`Invalid number of args to ${name}: expected ${len} but received ${args.length}`)(); - } -} - -const compileFunction = saveStack('function', (state, func) => { - let _Object$keys = Object.keys(func), - _Object$keys2 = _slicedToArray(_Object$keys, 1), - name = _Object$keys2[0]; - - let argExprs = func[name]; - - if (!Array.isArray(argExprs)) { - argExprs = [argExprs]; - } - - if (name[0] !== '$') { - throw new CompileError(`Unknown property "${name}". Did you mean to call a function? Try prefixing it with $`); - } - - let args = argExprs; // `$condition` is a special-case where it will be evaluated later - - if (name !== '$condition') { - args = argExprs.map(arg => compileExpr(state, arg)); - } - - switch (name) { - // aggregate functions - case '$sum': - { - validateArgLength(args, 1); - - let _valArray = valArray(state, args, ['float']), - _valArray2 = _slicedToArray(_valArray, 1), - arg1 = _valArray2[0]; - - return typed(`SUM(${arg1})`, args[0].type); - } - - case '$sumOver': - { - let _valArray3 = valArray(state, args, ['float']), - _valArray4 = _slicedToArray(_valArray3, 1), - arg1 = _valArray4[0]; - - let order = state.orders ? 'ORDER BY ' + compileOrderBy(state, state.orders) : ''; - return typed(`(SUM(${arg1}) OVER (${order} ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING))`, args[0].type); - } - - case '$count': - { - validateArgLength(args, 1); - - let _valArray5 = valArray(state, args), - _valArray6 = _slicedToArray(_valArray5, 1), - arg1 = _valArray6[0]; - - return typed(`COUNT(${arg1})`, 'integer'); - } - // string functions - - case '$substr': - { - validateArgLength(args, 2, 3); - - let _valArray7 = valArray(state, args, ['string', 'integer', 'integer']), - _valArray8 = _slicedToArray(_valArray7, 3), - arg1 = _valArray8[0], - arg2 = _valArray8[1], - arg3 = _valArray8[2]; - - return typed(`SUBSTR(${arg1}, ${arg2}, ${arg3})`, 'string'); - } - - case '$lower': - { - validateArgLength(args, 1); - - let _valArray9 = valArray(state, args, ['string']), - _valArray10 = _slicedToArray(_valArray9, 1), - arg1 = _valArray10[0]; - - return typed(`LOWER(${arg1})`, 'string'); - } - // integer/float functions - - case '$neg': - { - validateArgLength(args, 1); - - let _valArray11 = valArray(state, args, ['float']), - _valArray12 = _slicedToArray(_valArray11, 1), - arg1 = _valArray12[0]; - - return typed(`(-${val(state, args[0])})`, args[0].type); - } - - case '$abs': - { - validateArgLength(args, 1); - - let _valArray13 = valArray(state, args, ['float']), - _valArray14 = _slicedToArray(_valArray13, 1), - arg1 = _valArray14[0]; - - return typed(`ABS(${val(state, args[0])})`, args[0].type); - } - - case '$idiv': - { - validateArgLength(args, 2); - - let _valArray15 = valArray(state, args, ['integer', 'integer']), - _valArray16 = _slicedToArray(_valArray15, 2), - arg1 = _valArray16[0], - arg2 = _valArray16[1]; - - return typed(`(${val(state, args[0])} / ${val(state, args[1])})`, args[0].type); - } - // date functions - - case '$month': - { - validateArgLength(args, 1); - return castInput(state, args[0], 'date-month'); - } - - case '$year': - { - validateArgLength(args, 1); - return castInput(state, args[0], 'date-year'); - } - // various functions - - case '$condition': - validateArgLength(args, 1); - let conds = compileConditions(state, args[0]); - return typed(conds.join(' AND '), 'boolean'); - - case '$nocase': - validateArgLength(args, 1); - - let _valArray17 = valArray(state, args, ['string']), - _valArray18 = _slicedToArray(_valArray17, 1), - arg1 = _valArray18[0]; - - return typed(`${arg1} COLLATE NOCASE`, args[0].type); - - case '$literal': - { - validateArgLength(args, 1); - - if (!args[0].literal) { - throw new CompileError('Literal not passed to $literal'); - } - - return args[0]; - } - - default: - throw new CompileError(`Unknown function: ${name}`); - } -}); -const compileOp = saveStack('op', (state, fieldRef, opData) => { - let $transform = opData.$transform, - opExpr = _objectWithoutProperties(opData, _excluded); - - let _Object$keys3 = Object.keys(opExpr), - _Object$keys4 = _slicedToArray(_Object$keys3, 1), - op = _Object$keys4[0]; - - let rhs = compileExpr(state, opData[op]); - let lhs; - - if ($transform) { - lhs = compileFunction(_objectSpread(_objectSpread({}, state), {}, { - implicitField: fieldRef - }), typeof $transform === 'string' ? { - [$transform]: '$' - } : $transform); - } else { - lhs = compileExpr(state, '$' + fieldRef); - } - - switch (op) { - case '$gte': - { - let _valArray19 = valArray(state, [lhs, rhs], [null, lhs.type]), - _valArray20 = _slicedToArray(_valArray19, 2), - left = _valArray20[0], - right = _valArray20[1]; - - return `${left} >= ${right}`; - } - - case '$lte': - { - let _valArray21 = valArray(state, [lhs, rhs], [null, lhs.type]), - _valArray22 = _slicedToArray(_valArray21, 2), - left = _valArray22[0], - right = _valArray22[1]; - - return `${left} <= ${right}`; - } - - case '$gt': - { - let _valArray23 = valArray(state, [lhs, rhs], [null, lhs.type]), - _valArray24 = _slicedToArray(_valArray23, 2), - left = _valArray24[0], - right = _valArray24[1]; - - return `${left} > ${right}`; - } - - case '$lt': - { - let _valArray25 = valArray(state, [lhs, rhs], [null, lhs.type]), - _valArray26 = _slicedToArray(_valArray25, 2), - left = _valArray26[0], - right = _valArray26[1]; - - return `${left} < ${right}`; - } - - case '$eq': - { - if (castInput(state, rhs, lhs.type).type === 'null') { - return `${val(state, lhs)} IS NULL`; - } - - let _valArray27 = valArray(state, [lhs, rhs], [null, lhs.type]), - _valArray28 = _slicedToArray(_valArray27, 2), - left = _valArray28[0], - right = _valArray28[1]; - - if (rhs.type === 'param') { - let orders = state.namedParameters.map(param => { - return param === rhs || param === lhs ? [param, _objectSpread({}, param)] : param; - }); - state.namedParameters = [].concat.apply([], orders); - return `CASE - WHEN ${left} IS NULL THEN ${right} IS NULL - ELSE ${left} = ${right} - END`; - } - - return `${left} = ${right}`; - } - - case '$oneof': - { - let _valArray29 = valArray(state, [lhs, rhs], [null, 'array']), - _valArray30 = _slicedToArray(_valArray29, 2), - left = _valArray30[0], - right = _valArray30[1]; // Dedupe the ids - - - let ids = [...new Set(right)]; - return `${left} IN (` + ids.map(id => `'${id}'`).join(',') + ')'; - } - - case '$like': - { - let _valArray31 = valArray(state, [lhs, rhs], ['string', 'string']), - _valArray32 = _slicedToArray(_valArray31, 2), - left = _valArray32[0], - right = _valArray32[1]; - - return `${left} LIKE ${right}`; - } - - default: - throw new CompileError(`Unknown operator: ${op}`); - } -}); - -function compileConditions(state, conds) { - if (!Array.isArray(conds)) { - // Convert the object form `{foo: 1, bar:2}` into the array form - // `[{foo: 1}, {bar:2}]` - conds = Object.entries(conds).map(cond => { - return { - [cond[0]]: cond[1] - }; - }); - } - - return conds.filter(Boolean).reduce((res, condsObj) => { - let compiled = Object.entries(condsObj).map(([field, cond]) => { - // Allow a falsy value in the lhs of $and and $or to allow for - // quick forms like `$or: amount != 0 && ...` - if (field === '$and') { - if (!cond) { - return null; - } - - return compileAnd(state, cond); - } else if (field === '$or') { - if (!cond) { - return null; - } - - return compileOr(state, cond); - } - - if (typeof cond === 'string' || typeof cond === 'number' || typeof cond === 'boolean' || cond instanceof Date || cond == null) { - return compileOp(state, field, { - $eq: cond - }); - } - - if (Array.isArray(cond)) { - // An array of conditions for a field is implicitly an `and` - return cond.map(c => compileOp(state, field, c)).join(' AND '); - } - - return compileOp(state, field, cond); - }).filter(Boolean); - return [...res, ...compiled]; - }, []); -} - -function compileOr(state, conds) { - // Same as above - if (!conds) { - return '0'; - } - - let res = compileConditions(state, conds); - - if (res.length === 0) { - return '0'; - } - - return '(' + res.join('\n OR ') + ')'; -} - -function compileAnd(state, conds) { - // Same as above - if (!conds) { - return '1'; - } - - let res = compileConditions(state, conds); - - if (res.length === 0) { - return '1'; - } - - return '(' + res.join('\n AND ') + ')'; -} - -const compileWhere = saveStack('filter', (state, conds) => { - return compileAnd(state, conds); -}); - -function compileJoins(state, tableRef, internalTableFilters) { - let joins = []; - state.paths.forEach((desc, path) => { - let _state$paths$get = state.paths.get(path), - tableName = _state$paths$get.tableName, - tableId = _state$paths$get.tableId, - joinField = _state$paths$get.joinField, - joinTable = _state$paths$get.joinTable, - noMapping = _state$paths$get.noMapping; - - let on = `${tableId}.id = ${tableRef(joinTable)}.${quoteAlias(joinField)}`; - let filters = internalTableFilters(tableName); - - if (filters.length > 0) { - on += ' AND ' + compileAnd(_objectSpread(_objectSpread({}, state), {}, { - implicitTableName: tableName, - implicitTableId: tableId - }), filters); - } - - joins.push(`LEFT JOIN ${noMapping ? tableName : tableRef(tableName, true)} ${tableId} ON ${addTombstone(state.schema, tableName, tableId, on)}`); - - if (state.dependencies.indexOf(tableName) === -1) { - state.dependencies.push(tableName); - } - }); - return joins.join('\n'); -} - -function expandStar(state, expr) { - let path; - let pathInfo; - - if (expr === '*') { - pathInfo = { - tableName: state.implicitTableName, - tableId: state.implicitTableId - }; - } else if (expr.match(/\.\*$/)) { - let result = popPath(expr); - path = result.path; - pathInfo = resolvePath(state, result.path); - } - - let table = state.schema[pathInfo.tableName]; - - if (table == null) { - throw new Error(`Table "${pathInfo.tableName}" does not exist`); - } - - return Object.keys(table).map(field => path ? `${path}.${field}` : field); -} - -const compileSelect = saveStack('select', (state, exprs, isAggregate, orders) => { - // Always include the id if it's not an aggregate - if (!isAggregate && !exprs.includes('id') && !exprs.includes('*')) { - exprs = exprs.concat(['id']); - } - - let select = exprs.map(expr => { - if (typeof expr === 'string') { - if (expr.indexOf('*') !== -1) { - let fields = expandStar(state, expr); - return fields.map(field => { - let compiled = compileExpr(state, '$' + field); - state.outputTypes.set(field, compiled.type); - return compiled.value + ' AS ' + quoteAlias(field); - }).join(', '); - } - - let compiled = compileExpr(state, '$' + expr); - state.outputTypes.set(expr, compiled.type); - return compiled.value + ' AS ' + quoteAlias(expr); - } - - let _Object$entries$ = _slicedToArray(Object.entries(expr)[0], 2), - name = _Object$entries$[0], - value = _Object$entries$[1]; - - if (name[0] === '$') { - state.compileStack.push({ - type: 'value', - value: expr - }); - throw new CompileError(`Invalid field "${name}", are you trying to select a function? You need to name the expression`); - } - - if (typeof value === 'string') { - let compiled = compileExpr(state, '$' + value); - state.outputTypes.set(name, compiled.type); - return `${compiled.value} AS ${quoteAlias(name)}`; - } - - let compiled = compileFunction(_objectSpread(_objectSpread({}, state), {}, { - orders - }), value); - state.outputTypes.set(name, compiled.type); - return compiled.value + ` AS ${quoteAlias(name)}`; - }); - return select.join(', '); -}); -const compileGroupBy = saveStack('groupBy', (state, exprs) => { - let groupBy = exprs.map(expr => { - if (typeof expr === 'string') { - return compileExpr(state, '$' + expr).value; - } - - return compileFunction(state, expr).value; - }); - return groupBy.join(', '); -}); -const compileOrderBy = saveStack('orderBy', (state, exprs) => { - let orderBy = exprs.map(expr => { - let compiled; - let dir = null; - - if (typeof expr === 'string') { - compiled = compileExpr(state, '$' + expr).value; - } else { - let entries = Object.entries(expr); - let entry = entries[0]; // Check if this is a field reference - - if (entries.length === 1 && entry[0][0] !== '$') { - dir = entry[1]; - compiled = compileExpr(state, '$' + entry[0]).value; - } else { - // Otherwise it's a function - let $dir = expr.$dir, - func = _objectWithoutProperties(expr, _excluded2); - - dir = $dir; - compiled = compileFunction(state, func).value; - } - } - - if (dir != null) { - if (dir !== 'desc' && dir !== 'asc') { - throw new CompileError('Invalid order direction: ' + dir); - } - - return `${compiled} ${dir}`; - } - - return compiled; - }); - return orderBy.join(', '); -}); -let AGGREGATE_FUNCTIONS = ['$sum', '$count']; - -function isAggregateFunction(expr) { - if (typeof expr !== 'object' || Array.isArray(expr)) { - return false; - } - - let _Object$entries$2 = _slicedToArray(Object.entries(expr)[0], 2), - name = _Object$entries$2[0], - argExprs = _Object$entries$2[1]; - - if (!Array.isArray(argExprs)) { - argExprs = [argExprs]; - } - - if (AGGREGATE_FUNCTIONS.indexOf(name) !== -1) { - return true; - } - - return argExprs.find(ex => isAggregateFunction(ex)); -} - -function isAggregateQuery(queryState) { - // it's aggregate if: - // either an aggregate function is used in `select` - // or a `groupBy` exists - if (queryState.groupExpressions.length > 0) { - return true; - } - - return queryState.selectExpressions.find(expr => { - if (typeof expr !== 'string') { - let _Object$entries$3 = _slicedToArray(Object.entries(expr)[0], 2), - name = _Object$entries$3[0], - value = _Object$entries$3[1]; - - return isAggregateFunction(value); - } - - return false; - }); -} -function compileQuery(queryState, schema, schemaConfig = {}) { - let withDead = queryState.withDead, - _queryState$validateR = queryState.validateRefs, - validateRefs = _queryState$validateR === void 0 ? true : _queryState$validateR, - tableOptions = queryState.tableOptions, - rawMode = queryState.rawMode; - let _schemaConfig$tableVi = schemaConfig.tableViews, - tableViews = _schemaConfig$tableVi === void 0 ? {} : _schemaConfig$tableVi, - _schemaConfig$tableFi = schemaConfig.tableFilters, - tableFilters = _schemaConfig$tableFi === void 0 ? name => [] : _schemaConfig$tableFi, - _schemaConfig$customi = schemaConfig.customizeQuery, - customizeQuery = _schemaConfig$customi === void 0 ? queryState => queryState : _schemaConfig$customi; - - let internalTableFilters = name => { - let filters = tableFilters(name); // These filters cannot join tables and must be simple strings - - for (let filter of filters) { - if (Array.isArray(filter)) { - throw new CompileError('Invalid internal table filter: only object filters are supported'); - } - - if (Object.keys(filter)[0].indexOf('.') !== -1) { - throw new CompileError('Invalid internal table filter: field names cannot contain paths'); - } - } - - return filters; - }; - - let tableRef = (name, isJoin) => { - let view = typeof tableViews === 'function' ? tableViews(name, { - withDead, - isJoin, - tableOptions - }) : tableViews[name]; - return view || name; - }; - - let tableName = queryState.table; - - let _customizeQuery = customizeQuery(queryState), - filterExpressions = _customizeQuery.filterExpressions, - selectExpressions = _customizeQuery.selectExpressions, - groupExpressions = _customizeQuery.groupExpressions, - orderExpressions = _customizeQuery.orderExpressions, - limit = _customizeQuery.limit, - offset = _customizeQuery.offset, - calculation = _customizeQuery.calculation; - - let select = ''; - let where = ''; - let joins = ''; - let groupBy = ''; - let orderBy = ''; - let dependences = []; - let state = { - schema, - implicitTableName: tableName, - implicitTableId: tableRef(tableName), - paths: new Map(), - dependencies: [tableName], - compileStack: [], - outputTypes: new Map(), - validateRefs, - namedParameters: [] - }; - resetUid(); - - try { - select = compileSelect(state, selectExpressions, isAggregateQuery(queryState), orderExpressions); - - if (filterExpressions.length > 0) { - let result = compileWhere(state, filterExpressions); - where = 'WHERE ' + result; - } else { - where = 'WHERE 1'; - } - - if (!rawMode) { - let filters = internalTableFilters(tableName); - - if (filters.length > 0) { - where += ' AND ' + compileAnd(state, filters); - } - } - - if (groupExpressions.length > 0) { - let result = compileGroupBy(state, groupExpressions); - groupBy = 'GROUP BY ' + result; - } // Orders don't matter if doing a single calculation - - - if (orderExpressions.length > 0) { - let result = compileOrderBy(state, orderExpressions); - orderBy = 'ORDER BY ' + result; - } - - if (state.paths.size > 0) { - joins = compileJoins(state, tableRef, internalTableFilters); - } - } catch (e) { - if (e instanceof CompileError) { - throw getCompileError(e, state.compileStack); - } - - throw e; - } - - let sqlPieces = { - select, - from: tableRef(tableName), - joins, - where, - groupBy, - orderBy, - limit, - offset - }; - return { - sqlPieces, - state - }; -} -function defaultConstructQuery(queryState, state, sqlPieces) { - let s = sqlPieces; - let where = queryState.withDead ? s.where : addTombstone(state.schema, state.implicitTableName, state.implicitTableId, s.where); - return ` - SELECT ${s.select} FROM ${s.from} - ${s.joins} - ${where} - ${s.groupBy} - ${s.orderBy} - ${s.limit != null ? `LIMIT ${s.limit}` : ''} - ${s.offset != null ? `OFFSET ${s.offset}` : ''} - `; -} -function generateSQLWithState(queryState, schema, schemaConfig) { - let _compileQuery = compileQuery(queryState, schema, schemaConfig), - sqlPieces = _compileQuery.sqlPieces, - state = _compileQuery.state; - - return { - sql: defaultConstructQuery(queryState, state, sqlPieces), - state - }; -} -function generateSQL(queryState) { - return generateSQLWithState(queryState).sql; -} - -/***/ }), - -/***/ "./packages/loot-core/src/server/aql/exec.js": -/*!***************************************************!*\ - !*** ./packages/loot-core/src/server/aql/exec.js ***! - \***************************************************/ -/*! exports provided: execQuery, runCompiledQuery, runQuery */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "execQuery", function() { return execQuery; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "runCompiledQuery", function() { return runCompiledQuery; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "runQuery", function() { return runQuery; }); -/* harmony import */ var _db__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../db */ "./packages/loot-core/src/server/db/index.js"); -/* harmony import */ var _compiler__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./compiler */ "./packages/loot-core/src/server/aql/compiler.js"); -/* harmony import */ var _schema_helpers__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./schema-helpers */ "./packages/loot-core/src/server/aql/schema-helpers.js"); - - - // TODO (compiler): -// * Properly safeguard all inputs against SQL injection -// * Functions for incr/decr dates -// * Support HAVING -// * Allow creating in-memory tables to run queries against static -// data -// * For aggregate functions on selected ids, manually implement -// them only only support a specific few (sum amount / etc) -// * Select expressions should be evaluated first, and added to a -// global "field lookup" table that other filter/groupBy/etc -// expressions can reference - -function applyTypes(data, outputTypes) { - for (let i = 0; i < data.length; i++) { - let item = data[i]; - Object.keys(item).forEach(name => { - item[name] = Object(_schema_helpers__WEBPACK_IMPORTED_MODULE_2__["convertOutputType"])(item[name], outputTypes.get(name)); - }); - } -} - -async function execQuery(queryState, state, sqlPieces, params, outputTypes) { - let sql = Object(_compiler__WEBPACK_IMPORTED_MODULE_1__["defaultConstructQuery"])(queryState, state, sqlPieces); - let data = await _db__WEBPACK_IMPORTED_MODULE_0__["all"](sql, params); - applyTypes(data, outputTypes); - return data; -} -async function runCompiledQuery(query, pieces, state, { - params = {}, - executors = {} -} = {}) { - let paramArray = state.namedParameters.map(param => { - let name = param.paramName; - - if (params[name] === undefined) { - throw new Error(`Parameter ${name} not provided to query`); - } - - return Object(_schema_helpers__WEBPACK_IMPORTED_MODULE_2__["convertInputType"])(params[name], param.paramType); - }); - let data; - - if (executors[state.implicitTableName]) { - data = await executors[state.implicitTableName](state, query, pieces, paramArray, state.outputTypes); - } else { - data = await execQuery(query, state, pieces, paramArray, state.outputTypes); - } - - if (query.calculation) { - if (data.length > 0) { - let row = data[0]; - let k = Object.keys(row)[0]; // TODO: the function being run should be the one to - // determine the default value, not hardcoded as 0 - - data = row[k] || 0; - } else { - data = null; - } - } - - return data; -} -async function runQuery(schema, schemaConfig, query, options) { - let _compileQuery = Object(_compiler__WEBPACK_IMPORTED_MODULE_1__["compileQuery"])(query, schema, schemaConfig), - sqlPieces = _compileQuery.sqlPieces, - state = _compileQuery.state; - - let data = await runCompiledQuery(query, sqlPieces, state, options); - return { - data, - dependencies: state.dependencies - }; -} - -/***/ }), - -/***/ "./packages/loot-core/src/server/aql/schema-helpers.js": -/*!*************************************************************!*\ - !*** ./packages/loot-core/src/server/aql/schema-helpers.js ***! - \*************************************************************/ -/*! exports provided: convertInputType, convertOutputType, conform, convertForInsert, convertForUpdate, convertFromSelect */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "convertInputType", function() { return convertInputType; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "convertOutputType", function() { return convertOutputType; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "conform", function() { return conform; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "convertForInsert", function() { return convertForInsert; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "convertForUpdate", function() { return convertForUpdate; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "convertFromSelect", function() { return convertFromSelect; }); -/* harmony import */ var _models__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../models */ "./packages/loot-core/src/server/models.js"); -/* harmony import */ var _shared_months__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../shared/months */ "./packages/loot-core/src/shared/months.js"); -function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } - -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } - -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 isRequired(name, fieldDesc) { - return fieldDesc.required || name === 'id'; -} // TODO: All of the data type needs to check the input value. This -// doesn't just convert, it casts. See integer handling. - - -function convertInputType(value, type) { - if (value === undefined) { - throw new Error('Query value cannot be undefined'); - } else if (value === null) { - if (type === 'boolean') { - return 0; - } - - return null; - } - - switch (type) { - case 'date': - if (value instanceof Date) { - return Object(_models__WEBPACK_IMPORTED_MODULE_0__["toDateRepr"])(Object(_shared_months__WEBPACK_IMPORTED_MODULE_1__["dayFromDate"])(value)); - } else if (value.match(/^\d{4}-\d{2}-\d{2}$/) == null || value.date < '2000-01-01') { - throw new Error('Invalid date: ' + value); - } - - return Object(_models__WEBPACK_IMPORTED_MODULE_0__["toDateRepr"])(value); - - case 'date-month': - return Object(_models__WEBPACK_IMPORTED_MODULE_0__["toDateRepr"])(value.slice(0, 7)); - - case 'date-year': - return Object(_models__WEBPACK_IMPORTED_MODULE_0__["toDateRepr"])(value.slice(0, 4)); - - case 'boolean': - return value ? 1 : 0; - - case 'id': - if (typeof value !== 'string' && value !== null) { - throw new Error('Invalid id, must be string: ' + value); - } - - return value; - - case 'integer': - if (typeof value === 'number' && (value | 0) === value) { - return value; - } else { - throw new Error("Can't convert to integer: " + JSON.stringify(value)); - } - - case 'json': - return JSON.stringify(value); - - default: - } - - return value; -} -function convertOutputType(value, type) { - if (value === null) { - if (type === 'boolean') { - return false; - } - - return null; - } - - switch (type) { - case 'date': - return Object(_models__WEBPACK_IMPORTED_MODULE_0__["fromDateRepr"])(value); - - case 'date-month': - return Object(_models__WEBPACK_IMPORTED_MODULE_0__["fromDateRepr"])(value).slice(0, 7); - - case 'date-year': - return Object(_models__WEBPACK_IMPORTED_MODULE_0__["fromDateRepr"])(value).slice(0, 4); - - case 'boolean': - return value === 1; - - case 'json': - case 'json/fallback': - try { - return JSON.parse(value); - } catch (e) { - return type === 'json/fallback' ? value : null; - } - - default: - } - - return value; -} -function conform(schema, schemaConfig, table, obj, { - skipNull -} = {}) { - let tableSchema = schema[table]; - - if (tableSchema == null) { - throw new Error(`Table "${table}" does not exist`); - } - - let views = schemaConfig.views || {}; // Rename fields if necessary - - let fieldRef = field => { - if (views[table] && views[table].fields) { - return views[table].fields[field] || field; - } - - return field; - }; - - return Object.fromEntries(Object.keys(obj).map(field => { - // Fields that start with an underscore are ignored - if (field[0] === '_') { - return null; - } - - let fieldDesc = tableSchema[field]; - - if (fieldDesc == null) { - throw new Error(`Field "${field}" does not exist on table ${table}: ${JSON.stringify(obj)}`); - } - - if (isRequired(field, fieldDesc) && obj[field] == null) { - throw new Error(`"${field}" is required for table "${table}": ${JSON.stringify(obj)}`); - } // This option removes null values (see `convertForInsert`) - - - if (skipNull && obj[field] == null) { - return null; - } - - return [fieldRef(field), convertInputType(obj[field], fieldDesc.type)]; - }).filter(Boolean)); -} -function convertForInsert(schema, schemaConfig, table, rawObj) { - let obj = _objectSpread({}, rawObj); - - let tableSchema = schema[table]; - - if (tableSchema == null) { - throw new Error(`Error inserting: table "${table}" does not exist`); - } // Inserting checks all the fields in the table and adds any default - // values necessary - - - Object.keys(tableSchema).forEach(field => { - let fieldDesc = tableSchema[field]; - - if (obj[field] == null) { - if (fieldDesc.default !== undefined) { - obj[field] = typeof fieldDesc.default === 'function' ? fieldDesc.default() : fieldDesc.default; - } else if (isRequired(field, fieldDesc)) { - // Although this check is also done in `conform`, it only - // checks the fields in `obj`. For insert, we need to do it - // here to check that all required fields in the table exist - throw new Error(`"${field}" is required for table "${table}": ${JSON.stringify(obj)}`); - } - } - }); // We use `skipNull` to remove any null values. There's no need to - // set those when inserting, that will be the default and it reduces - // the amount of messages generated to sync - - return conform(schema, schemaConfig, table, obj, { - skipNull: true - }); -} -function convertForUpdate(schema, schemaConfig, table, rawObj) { - let obj = _objectSpread({}, rawObj); - - let tableSchema = schema[table]; - - if (tableSchema == null) { - throw new Error(`Error updating: table "${table}" does not exist`); - } - - return conform(schema, schemaConfig, table, obj); -} -function convertFromSelect(schema, schemaConfig, table, obj) { - let tableSchema = schema[table]; - - if (tableSchema == null) { - throw new Error(`Table "${table}" does not exist`); - } - - let fields = Object.keys(tableSchema); - let result = {}; - - for (let i = 0; i < fields.length; i++) { - let fieldName = fields[i]; - let fieldDesc = tableSchema[fieldName]; - result[fieldName] = convertOutputType(obj[fieldName], fieldDesc.type); - } - - return result; -} - -/***/ }), - -/***/ "./packages/loot-core/src/server/aql/schema/executors.js": -/*!***************************************************************!*\ - !*** ./packages/loot-core/src/server/aql/schema/executors.js ***! - \***************************************************************/ -/*! exports provided: toGroup, isHappyPathQuery, default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "toGroup", function() { return toGroup; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isHappyPathQuery", function() { return isHappyPathQuery; }); -/* harmony import */ var _db__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../db */ "./packages/loot-core/src/server/db/index.js"); -/* harmony import */ var _db_util__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../db/util */ "./packages/loot-core/src/server/db/util.js"); -/* harmony import */ var _shared_util__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../shared/util */ "./packages/loot-core/src/shared/util.js"); -/* harmony import */ var _compiler__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../compiler */ "./packages/loot-core/src/server/aql/compiler.js"); -/* harmony import */ var _schema_helpers__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../schema-helpers */ "./packages/loot-core/src/server/aql/schema-helpers.js"); -/* harmony import */ var _exec__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../exec */ "./packages/loot-core/src/server/aql/exec.js"); -function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } - -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } - -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; } - - - - - - - // Transactions executor - -function toGroup(parents, children, mapper = x => x) { - return parents.reduce((list, parent) => { - let childs = children.get(parent.id) || []; - list.push(_objectSpread(_objectSpread({}, mapper(parent)), {}, { - subtransactions: childs.map(mapper) - })); - return list; - }, []); -} // These two queries will return very different things: -// -// q('transactions').select({ $count: 'id' }) -// q('transactions', { splits: "grouped" }).select({ $count: 'id' }) -// -// The first will return the count of non-split and child -// transactions, and the second will return the count of all parent -// (or non-split) transactions - -function execTransactions(state, query, sql, params, outputTypes) { - let tableOptions = query.tableOptions || {}; - let splitType = tableOptions.splits || 'inline'; - - if (['all', 'inline', 'none', 'grouped'].indexOf(splitType) === -1) { - throw new Error(`Invalid "splits" option for transactions: "${splitType}"`); - } - - if (splitType === 'all' || splitType === 'inline' || splitType === 'none') { - return execTransactionsBasic(state, query, sql, params, splitType, outputTypes); - } else if (splitType === 'grouped') { - return execTransactionsGrouped(state, query, sql, params, splitType, outputTypes); - } -} - -function _isUnhappy(filter) { - // These fields can be filtered - all split transactions will - // still be returned regardless - for (let key of Object.keys(filter)) { - if (key === '$or' || key === '$and') { - if (filter[key] && _isUnhappy(filter[key])) { - return true; - } - } else if (!(key.indexOf('account') === 0 || key === 'date')) { - return true; - } - } - - return false; -} - -function isHappyPathQuery(queryState) { - return queryState.filterExpressions.find(_isUnhappy) == null; -} - -async function execTransactionsGrouped(state, queryState, sql, params, splitType, outputTypes) { - let tableName = queryState.table, - withDead = queryState.withDead; - let whereDead = withDead ? '' : `AND ${sql.from}.tombstone = 0`; - - if (Object(_compiler__WEBPACK_IMPORTED_MODULE_3__["isAggregateQuery"])(queryState)) { - let allSql = ` - SELECT ${sql.select} - FROM ${sql.from} - ${sql.joins} - ${sql.where} AND is_parent = 0 ${whereDead} - ${sql.groupBy} - ${sql.orderBy} - ${sql.limit != null ? `LIMIT ${sql.limit}` : ''} - ${sql.offset != null ? `OFFSET ${sql.offset}` : ''} - `; - return _db__WEBPACK_IMPORTED_MODULE_0__["all"](allSql); - } - - let rows; - let matched = null; - - if (isHappyPathQuery(queryState)) { - // This is just an optimization - we can just filter out children - // directly and only list parents - let rowSql = ` - SELECT ${sql.from}.id as group_id - FROM ${sql.from} - ${sql.joins} - ${sql.where} AND is_child = 0 ${whereDead} - ${sql.orderBy} - ${sql.limit != null ? `LIMIT ${sql.limit}` : ''} - ${sql.offset != null ? `OFFSET ${sql.offset}` : ''} - `; - rows = await _db__WEBPACK_IMPORTED_MODULE_0__["all"](rowSql, params); - } else { - // TODO: phew, what a doozy. write docs why it works this way - // - // prettier-ignore - let rowSql = ` - SELECT group_id, matched FROM ( - SELECT - group_id, - GROUP_CONCAT(id) as matched - FROM ( - SELECT ${sql.from}.id, IFNULL(${sql.from}.parent_id, ${sql.from}.id) as group_id - FROM ${sql.from} - LEFT JOIN transactions _t2 ON ${sql.from}.is_child = 1 AND _t2.id = ${sql.from}.parent_id - ${sql.joins} - ${sql.where} AND ${sql.from}.tombstone = 0 AND IFNULL(_t2.tombstone, 0) = 0 - ) - GROUP BY group_id - ) - LEFT JOIN ${sql.from} ON ${sql.from}.id = group_id - ${sql.joins} - ${sql.orderBy} - ${sql.limit != null ? `LIMIT ${sql.limit}` : ''} - ${sql.offset != null ? `OFFSET ${sql.offset}` : ''} - `; - rows = await _db__WEBPACK_IMPORTED_MODULE_0__["all"](rowSql, params); - matched = new Set([].concat.apply([], rows.map(row => row.matched.split(',')))); - } - - let where = Object(_db_util__WEBPACK_IMPORTED_MODULE_1__["whereIn"])(rows.map(row => row.group_id), `IFNULL(${sql.from}.parent_id, ${sql.from}.id)`); - let finalSql = ` - SELECT ${sql.select}, parent_id AS _parent_id FROM ${sql.from} - ${sql.joins} - WHERE ${where} ${whereDead} - ${sql.orderBy} - `; - let start = Date.now(); - let allRows = await _db__WEBPACK_IMPORTED_MODULE_0__["all"](finalSql); // Group the parents and children up - - let _allRows$reduce = allRows.reduce((acc, trans) => { - let pid = trans._parent_id; - delete trans._parent_id; - - if (pid == null) { - acc.parents.push(trans); - } else { - let arr = acc.children.get(pid) || []; - arr.push(trans); - acc.children.set(pid, arr); - } - - return acc; - }, { - parents: [], - children: new Map() - }), - parents = _allRows$reduce.parents, - children = _allRows$reduce.children; - - let mapper = trans => { - Object.keys(trans).forEach(name => { - trans[name] = Object(_schema_helpers__WEBPACK_IMPORTED_MODULE_4__["convertOutputType"])(trans[name], outputTypes.get(name)); - }); - - if (matched && !matched.has(trans.id)) { - trans._unmatched = true; - } - - return trans; - }; - - return toGroup(parents, children, mapper); -} - -async function execTransactionsBasic(state, queryState, sql, params, splitType, outputTypes) { - let s = _objectSpread({}, sql); - - if (splitType !== 'all') { - if (splitType === 'none') { - s.where = `${s.where} AND ${s.from}.parent_id IS NULL`; - } else { - s.where = `${s.where} AND ${s.from}.is_parent = 0`; - } - } - - return Object(_exec__WEBPACK_IMPORTED_MODULE_5__["execQuery"])(queryState, state, s, params, outputTypes); -} - -/* harmony default export */ __webpack_exports__["default"] = ({ - transactions: execTransactions -}); - -/***/ }), - -/***/ "./packages/loot-core/src/server/aql/schema/index.js": -/*!***********************************************************!*\ - !*** ./packages/loot-core/src/server/aql/schema/index.js ***! - \***********************************************************/ -/*! exports provided: schema, schemaConfig */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "schema", function() { return schema; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "schemaConfig", function() { return schemaConfig; }); -function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } - -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } - -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 f(type, opts) { - return _objectSpread({ - type - }, opts); -} // This is the table schema! -// -// The schema itself is the public API for querying and updating data. -// The schema config provides a lot of control over how queries are -// constructed other metadata used by the executors. The goal is to -// provide a simple interface to the app, but allow the backend to -// highly optimize how queries are run. -// -// A few notes: -// -// * `transactions` is a special table and is has a highly customized -// executor (see `executors.js`) for performace. It should mostly be -// transparent to you, but it's worth reading the comments in there if -// requirements change, especially regarding split transactions. -// -// * You should rarely change the schema and only add to it, but it is -// relatively safe to change if needed. The only problem is changing a -// public API, but that could be mitigated with an option in schema -// config to map field name for backwards compatibility. -// -// * It's important that the table names here in the schema map to the -// real tables in sqlite that are updated. Otherwise subscriptions -// might not work because the dependencies are wrong. If needed in the -// future, we can provide another option in the schema config to map a -// table name the internal table that is updated. - - -const schema = { - transactions: { - id: f('id'), - is_parent: f('boolean'), - is_child: f('boolean'), - parent_id: f('id'), - account: f('id', { - ref: 'accounts', - required: true - }), - category: f('id', { - ref: 'categories' - }), - amount: f('integer', { - default: 0, - required: true - }), - payee: f('id', { - ref: 'payees' - }), - notes: f('string'), - date: f('date', { - required: true - }), - imported_id: f('string'), - error: f('json'), - imported_payee: f('string'), - starting_balance_flag: f('boolean'), - transfer_id: f('id'), - sort_order: f('float', { - default: () => Date.now() - }), - cleared: f('boolean', { - default: true - }), - tombstone: f('boolean'), - schedule: f('id', { - ref: 'schedules' - }) // subtransactions is a special field added if the table has the - // `splits: grouped` option - - }, - payees: { - id: f('id'), - name: f('string', { - required: true - }), - transfer_acct: f('id', { - ref: 'accounts' - }), - tombstone: f('boolean') - }, - accounts: { - id: f('id'), - name: f('string', { - required: true - }), - // TODO: enum - type: f('string'), - offbudget: f('boolean'), - closed: f('boolean'), - sort_order: f('float'), - tombstone: f('boolean') - }, - categories: { - id: f('id'), - name: f('string'), - is_income: f('boolean'), - group: f('id', { - ref: 'category_groups' - }), - sort_order: f('float'), - tombstone: f('boolean') - }, - category_groups: { - id: f('id'), - name: f('string'), - is_income: f('boolean'), - sort_order: f('float'), - tombstone: f('boolean') - }, - schedules: { - id: f('id'), - rule: f('id', { - ref: 'rules', - required: true - }), - next_date: f('date'), - completed: f('boolean'), - posts_transaction: f('boolean'), - tombstone: f('boolean'), - // These are special fields that are actually pulled from the - // underlying rule - _payee: f('id', { - ref: 'payees' - }), - _account: f('id', { - ref: 'accounts' - }), - _amount: f('json/fallback'), - _amountOp: f('string'), - _date: f('json/fallback'), - _conditions: f('json'), - _actions: f('json') - }, - rules: { - id: f('id'), - stage: f('string'), - conditions: f('json'), - actions: f('json'), - tombstone: f('boolean') - }, - notes: { - id: f('id'), - note: f('string') - } -}; -const schemaConfig = { - // Note: these views *must* represent the underlying table that we - // are mapping here. The compiler makes optimizations with this - // assumption - tableViews(name, { - isJoin, - withDead, - tableOptions = {} - }) { - switch (name) { - case 'transactions': - { - // If joining, we always only show alive transactions. There's - // no way to configure join behavior yet - if (isJoin) { - return 'v_transactions_internal_alive'; - } - - let splitType = tableOptions.splits || 'inline'; // Use the view to exclude dead transactions if using `inline` or `none` - - if (!withDead && (splitType === 'inline' || splitType === 'none')) { - return 'v_transactions_internal_alive'; - } // Otherwse we disregard the `withDead` option here and handle - // that in the executors to improve performance - - - return 'v_transactions_internal'; - } - - case 'schedules': - return 'v_schedules'; - - case 'categories': - return 'v_categories'; - - case 'payees': - return 'v_payees'; - - default: - } - - return name; - }, - - customizeQuery(queryState) { - let tableName = queryState.table, - _queryState$tableOpti = queryState.tableOptions, - tableOptions = _queryState$tableOpti === void 0 ? {} : _queryState$tableOpti; - - function orderBy(orders) { - // If order was specified, always add id as the last sort to make - // it deterministic - if (orders.length > 0) { - return orders.concat(['id']); - } // Otherwise, these are the default orders for each table - - - switch (tableName) { - case 'transactions': - return [{ - date: 'desc' - }, 'starting_balance_flag', { - sort_order: 'desc' - }, 'id']; - - case 'payees': - return [{ - $condition: { - transfer_acct: null - }, - $dir: 'desc' - }, { - $nocase: '$name' - }]; - - case 'accounts': - return ['sort_order', 'name']; - - case 'schedules': - return [{ - $condition: { - completed: true - } - }, 'next_date']; - - default: - } - - return []; - } - - return _objectSpread(_objectSpread({}, queryState), {}, { - orderExpressions: orderBy(queryState.orderExpressions) - }); - }, - - views: { - payees: { - v_payees: internalFields => { - let fields = internalFields({ - name: 'COALESCE(__accounts.name, _.name)' - }); - return ` - SELECT ${fields} FROM payees _ - LEFT JOIN accounts __accounts ON (_.transfer_acct = __accounts.id AND __accounts.tombstone = 0) - -- We never want to show transfer payees that are pointing to deleted accounts. - -- Either this isn't a transfer payee, if the account exists - WHERE _.transfer_acct IS NULL OR __accounts.id IS NOT NULL - `; - } - }, - categories: { - fields: { - group: 'cat_group' - }, - v_categories: internalFields => { - let fields = internalFields({ - group: 'cat_group' - }); - return `SELECT ${fields} FROM categories _`; - } - }, - schedules: { - v_schedules: internalFields => { - let fields = internalFields({ - next_date: ` - CASE - WHEN _nd.local_next_date_ts = _nd.base_next_date_ts THEN _nd.local_next_date - ELSE _nd.base_next_date - END - `, - _payee: `pm.targetId`, - _account: `json_extract(_rules.conditions, _paths.account || '.value')`, - _amount: `json_extract(_rules.conditions, _paths.amount || '.value')`, - _amountOp: `json_extract(_rules.conditions, _paths.amount || '.op')`, - _date: `json_extract(_rules.conditions, _paths.date || '.value')`, - _conditions: '_rules.conditions', - _actions: '_rules.actions' - }); - return ` - SELECT ${fields} FROM schedules _ - LEFT JOIN schedules_next_date _nd ON _nd.schedule_id = _.id - LEFT JOIN schedules_json_paths _paths ON _paths.schedule_id = _.id - LEFT JOIN rules _rules ON _rules.id = _.rule - LEFT JOIN payee_mapping pm ON pm.id = json_extract(_rules.conditions, _paths.payee || '.value') - `; - } - }, - transactions: { - fields: { - is_parent: 'isParent', - is_child: 'isChild', - account: 'acct', - imported_id: 'financial_id', - imported_payee: 'imported_description', - transfer_id: 'transferred_id', - payee: 'description' - }, - v_transactions_internal: internalFields => { - // Override some fields to make custom stuff - let fields = internalFields({ - payee: 'pm.targetId', - category: `CASE WHEN _.isParent = 1 THEN NULL ELSE cm.transferId END`, - amount: `IFNULL(_.amount, 0)`, - parent_id: 'CASE WHEN _.isChild = 0 THEN NULL ELSE _.parent_id END' - }); - return ` - SELECT ${fields} FROM transactions _ - LEFT JOIN category_mapping cm ON cm.id = _.category - LEFT JOIN payee_mapping pm ON pm.id = _.description - WHERE - _.date IS NOT NULL AND - _.acct IS NOT NULL AND - (_.isChild = 0 OR _.parent_id IS NOT NULL) - `; - }, - // We join on t2 to only include valid child transactions. We - // want to only include ones with valid parents, which is when - // an alive parent transaction exists - v_transactions_internal_alive: ` - SELECT _.* FROM v_transactions_internal _ - LEFT JOIN transactions t2 ON (_.is_child = 1 AND t2.id = _.parent_id) - WHERE IFNULL(_.tombstone, 0) = 0 AND (_.is_child = 0 OR t2.tombstone = 0) - `, - v_transactions: (_, publicFields) => { - let fields = publicFields({ - payee: 'p.id', - category: 'c.id', - account: 'a.id' - }); // This adds an order, and also validates any id references by - // selecting the ids through a join which return null if they - // are dead - - return ` - SELECT ${fields} FROM v_transactions_internal_alive _ - LEFT JOIN payees p ON (p.id = _.payee AND p.tombstone = 0) - LEFT JOIN categories c ON (c.id = _.category AND c.tombstone = 0) - LEFT JOIN accounts a ON (a.id = _.account AND a.tombstone = 0) - ORDER BY _.date desc, _.starting_balance_flag, _.sort_order desc, _.id; - `; - } - } - } -}; - -/***/ }), - -/***/ "./packages/loot-core/src/server/aql/schema/run-query.js": -/*!***************************************************************!*\ - !*** ./packages/loot-core/src/server/aql/schema/run-query.js ***! - \***************************************************************/ -/*! exports provided: runCompiledQuery, runQuery */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "runCompiledQuery", function() { return runCompiledQuery; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "runQuery", function() { return runQuery; }); -/* harmony import */ var _index__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./index */ "./packages/loot-core/src/server/aql/schema/index.js"); -/* harmony import */ var _executors__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./executors */ "./packages/loot-core/src/server/aql/schema/executors.js"); -/* harmony import */ var _exec__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../exec */ "./packages/loot-core/src/server/aql/exec.js"); -/* harmony import */ var _shared_query__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../../shared/query */ "./packages/loot-core/src/shared/query.js"); - - - - -function runCompiledQuery(query, sqlPieces, state, params) { - return Object(_exec__WEBPACK_IMPORTED_MODULE_2__["runCompiledQuery"])(query, sqlPieces, state, { - params, - executors: _executors__WEBPACK_IMPORTED_MODULE_1__["default"] - }); -} -function runQuery(query, params) { - if (query instanceof _shared_query__WEBPACK_IMPORTED_MODULE_3__["Query"]) { - query = query.serialize(); - } - - return Object(_exec__WEBPACK_IMPORTED_MODULE_2__["runQuery"])(_index__WEBPACK_IMPORTED_MODULE_0__["schema"], _index__WEBPACK_IMPORTED_MODULE_0__["schemaConfig"], query, { - params, - executors: _executors__WEBPACK_IMPORTED_MODULE_1__["default"] - }); -} - -/***/ }), - -/***/ "./packages/loot-core/src/server/aql/views.js": -/*!****************************************************!*\ - !*** ./packages/loot-core/src/server/aql/views.js ***! - \****************************************************/ -/*! exports provided: makeViews */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "makeViews", function() { return makeViews; }); -/* harmony import */ var _compiler__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./compiler */ "./packages/loot-core/src/server/aql/compiler.js"); -const _excluded = ["fields"]; - -function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } - -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } - -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 _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 _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 selectFields(fields) { - return Object.keys(fields).map(as => { - let field = fields[as]; - let needsAs = field !== as; // If it's just an identifier, we automatically prefix it with - // `_.` which makes sure it references the root table - - if (!field.match(/[ .]/)) { - field = `_.${field}`; - } - - return needsAs ? `${field} AS ${Object(_compiler__WEBPACK_IMPORTED_MODULE_0__["quoteAlias"])(as)}` : `${field}`; - }).join(', '); -} - -function makeViews(schema, schemaConfig) { - let views = schemaConfig.views; - let viewStrs = []; - Object.keys(views).forEach(table => { - let _views$table = views[table], - _views$table$fields = _views$table.fields, - fieldMappings = _views$table$fields === void 0 ? {} : _views$table$fields, - tableViews = _objectWithoutProperties(_views$table, _excluded); - - let publicFields = Object.fromEntries(Object.keys(schema[table]).map(name => [name, name])); - - let internalFields = _objectSpread(_objectSpread({}, publicFields), fieldMappings); - - Object.keys(tableViews).forEach(viewName => { - let publicMaker = overrides => { - let fields = _objectSpread(_objectSpread({}, publicFields), overrides); - - return selectFields(fields); - }; - - let internalMaker = overrides => { - let fields = _objectSpread(_objectSpread({}, internalFields), overrides); - - return selectFields(fields); - }; - - let sql; - - if (typeof tableViews[viewName] === 'function') { - sql = tableViews[viewName](internalMaker, publicMaker); - } else { - sql = tableViews[viewName]; - } - - sql = sql.trim().replace(/;$/, ''); - viewStrs.push(` - DROP VIEW IF EXISTS ${viewName}; - CREATE VIEW ${viewName} AS ${sql}; - `); - }); - }); - return viewStrs.join('\n'); -} - -/***/ }), - -/***/ "./packages/loot-core/src/server/backups.js": -/*!**************************************************!*\ - !*** ./packages/loot-core/src/server/backups.js ***! - \**************************************************/ -/*! exports provided: getBackups, getLatestBackup, getAvailableBackups, updateBackups, makeBackup, loadBackup, startBackupService, stopBackupService */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getBackups", function() { return getBackups; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getLatestBackup", function() { return getLatestBackup; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getAvailableBackups", function() { return getAvailableBackups; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "updateBackups", function() { return updateBackups; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "makeBackup", function() { return makeBackup; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "loadBackup", function() { return loadBackup; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "startBackupService", function() { return startBackupService; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "stopBackupService", function() { return stopBackupService; }); -/* harmony import */ var _platform_server_fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../platform/server/fs */ "./packages/loot-core/src/platform/server/fs/index.electron.js"); -/* harmony import */ var _platform_server_fs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_platform_server_fs__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _shared_months__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../shared/months */ "./packages/loot-core/src/shared/months.js"); -/* harmony import */ var _platform_server_sqlite__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../platform/server/sqlite */ "./packages/loot-core/src/platform/server/sqlite/index.electron.js"); -/* harmony import */ var _prefs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./prefs */ "./packages/loot-core/src/server/prefs.js"); -/* harmony import */ var _cloud_storage__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./cloud-storage */ "./packages/loot-core/src/server/cloud-storage.js"); -function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } - -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } - -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; } - - - - - - - -const connection = __webpack_require__(/*! ../platform/server/connection */ "./packages/loot-core/src/platform/server/connection/index.api.js"); - -const uuid = __webpack_require__(/*! ../platform/uuid */ "./packages/loot-core/src/platform/uuid/index.electron.js"); - -const dateFns = __webpack_require__(/*! date-fns */ "./node_modules/date-fns/esm/index.js"); // A special backup that represents the latest version of the db that -// can be reverted to after loading a backup - - -const LATEST_BACKUP_FILENAME = 'db.latest.sqlite'; -let serviceInterval = null; -async function getBackups(id) { - const budgetDir = _platform_server_fs__WEBPACK_IMPORTED_MODULE_0___default.a.getBudgetDir(id); - const backupDir = _platform_server_fs__WEBPACK_IMPORTED_MODULE_0___default.a.join(budgetDir, 'backups'); - let paths = []; - - if (await _platform_server_fs__WEBPACK_IMPORTED_MODULE_0___default.a.exists(backupDir)) { - paths = await _platform_server_fs__WEBPACK_IMPORTED_MODULE_0___default.a.listDir(backupDir); - paths = paths.filter(file => file.match(/\.sqlite$/)); - } - - const backups = await Promise.all(paths.map(async path => { - const mtime = await _platform_server_fs__WEBPACK_IMPORTED_MODULE_0___default.a.getModifiedTime(_platform_server_fs__WEBPACK_IMPORTED_MODULE_0___default.a.join(backupDir, path)); - return { - id: path, - date: new Date(mtime) - }; - })); - backups.sort((b1, b2) => { - if (b1.date < b2.date) { - return 1; - } else if (b1.date > b2.date) { - return -1; - } - - return 0; - }); - return backups; -} -async function getLatestBackup(id) { - const budgetDir = _platform_server_fs__WEBPACK_IMPORTED_MODULE_0___default.a.getBudgetDir(id); - - if (await _platform_server_fs__WEBPACK_IMPORTED_MODULE_0___default.a.exists(_platform_server_fs__WEBPACK_IMPORTED_MODULE_0___default.a.join(budgetDir, LATEST_BACKUP_FILENAME))) { - return { - id: LATEST_BACKUP_FILENAME, - date: null, - isLatest: true - }; - } - - return null; -} -async function getAvailableBackups(id) { - let backups = await getBackups(id); - let latestBackup = await getLatestBackup(id); - - if (latestBackup) { - backups.unshift(latestBackup); - } - - backups = backups.map(backup => _objectSpread(_objectSpread({}, backup), {}, { - date: backup.date ? dateFns.format(backup.date, 'yyyy-MM-dd h:mm') : null - })); - return backups; -} -async function updateBackups(backups) { - const byDay = backups.reduce((groups, backup) => { - const day = dateFns.format(backup.date, 'yyyy-MM-dd'); - groups[day] = groups[day] || []; - groups[day].push(backup); - return groups; - }, {}); - const removed = []; - - for (let day of Object.keys(byDay)) { - const dayBackups = byDay[day]; - const isToday = day === _shared_months__WEBPACK_IMPORTED_MODULE_1__["currentDay"](); // Allow 3 backups of the current day (so fine-grained edits are - // kept around). Otherwise only keep around one backup per day. - // And only keep a total of 10 backups. - - for (let backup of dayBackups.slice(isToday ? 3 : 1)) { - removed.push(backup.id); - } - } // Get the list of remaining backups and only keep the latest 10 - - - const currentBackups = backups.filter(backup => !removed.includes(backup.id)); - return removed.concat(currentBackups.slice(10).map(backup => backup.id)); -} -async function makeBackup(id) { - const budgetDir = _platform_server_fs__WEBPACK_IMPORTED_MODULE_0___default.a.getBudgetDir(id); // When making a backup, we no longer consider the user to be - // viewing any backups. If there exists a "latest backup" we should - // delete it and consider whatever is current as the latest - - if (await _platform_server_fs__WEBPACK_IMPORTED_MODULE_0___default.a.exists(_platform_server_fs__WEBPACK_IMPORTED_MODULE_0___default.a.join(budgetDir, LATEST_BACKUP_FILENAME))) { - await _platform_server_fs__WEBPACK_IMPORTED_MODULE_0___default.a.removeFile(_platform_server_fs__WEBPACK_IMPORTED_MODULE_0___default.a.join(_platform_server_fs__WEBPACK_IMPORTED_MODULE_0___default.a.getBudgetDir(id), LATEST_BACKUP_FILENAME)); - } - - let backupId = `${uuid.v4Sync()}.sqlite`; - let backupPath = _platform_server_fs__WEBPACK_IMPORTED_MODULE_0___default.a.join(budgetDir, 'backups', backupId); - - if (!(await _platform_server_fs__WEBPACK_IMPORTED_MODULE_0___default.a.exists(_platform_server_fs__WEBPACK_IMPORTED_MODULE_0___default.a.join(budgetDir, 'backups')))) { - await _platform_server_fs__WEBPACK_IMPORTED_MODULE_0___default.a.mkdir(_platform_server_fs__WEBPACK_IMPORTED_MODULE_0___default.a.join(budgetDir, 'backups')); - } - - await _platform_server_fs__WEBPACK_IMPORTED_MODULE_0___default.a.copyFile(_platform_server_fs__WEBPACK_IMPORTED_MODULE_0___default.a.join(budgetDir, 'db.sqlite'), backupPath); // Remove all the messages from the backup - - const db = _platform_server_sqlite__WEBPACK_IMPORTED_MODULE_2__["openDatabase"](backupPath); - await _platform_server_sqlite__WEBPACK_IMPORTED_MODULE_2__["runQuery"](db, 'DELETE FROM messages_crdt'); - await _platform_server_sqlite__WEBPACK_IMPORTED_MODULE_2__["runQuery"](db, 'DELETE FROM messages_clock'); - _platform_server_sqlite__WEBPACK_IMPORTED_MODULE_2__["closeDatabase"](db); - const toRemove = await updateBackups(await getBackups(id)); - - for (let id of toRemove) { - await _platform_server_fs__WEBPACK_IMPORTED_MODULE_0___default.a.removeFile(_platform_server_fs__WEBPACK_IMPORTED_MODULE_0___default.a.join(budgetDir, 'backups', id)); - } - - connection.send('backups-updated', await getAvailableBackups(id)); -} -async function loadBackup(id, backupId) { - const budgetDir = _platform_server_fs__WEBPACK_IMPORTED_MODULE_0___default.a.getBudgetDir(id); - - if (!(await _platform_server_fs__WEBPACK_IMPORTED_MODULE_0___default.a.exists(_platform_server_fs__WEBPACK_IMPORTED_MODULE_0___default.a.join(budgetDir, LATEST_BACKUP_FILENAME)))) { - // If this is the first time we're loading a backup, save the - // current version so the user can easily revert back to it - await _platform_server_fs__WEBPACK_IMPORTED_MODULE_0___default.a.copyFile(_platform_server_fs__WEBPACK_IMPORTED_MODULE_0___default.a.join(budgetDir, 'db.sqlite'), _platform_server_fs__WEBPACK_IMPORTED_MODULE_0___default.a.join(budgetDir, LATEST_BACKUP_FILENAME)); - await _platform_server_fs__WEBPACK_IMPORTED_MODULE_0___default.a.copyFile(_platform_server_fs__WEBPACK_IMPORTED_MODULE_0___default.a.join(budgetDir, 'metadata.json'), _platform_server_fs__WEBPACK_IMPORTED_MODULE_0___default.a.join(budgetDir, 'metadata.latest.json')); // Restart the backup service to make sure the user has the full - // amount of time to figure out which one they want - - stopBackupService(); - startBackupService(id); - await _prefs__WEBPACK_IMPORTED_MODULE_3__["loadPrefs"](id); - } - - if (backupId === LATEST_BACKUP_FILENAME) { - console.log('Reverting backup'); // If reverting back to the latest, copy and delete the latest - // backup - - await _platform_server_fs__WEBPACK_IMPORTED_MODULE_0___default.a.copyFile(_platform_server_fs__WEBPACK_IMPORTED_MODULE_0___default.a.join(budgetDir, LATEST_BACKUP_FILENAME), _platform_server_fs__WEBPACK_IMPORTED_MODULE_0___default.a.join(budgetDir, 'db.sqlite')); - await _platform_server_fs__WEBPACK_IMPORTED_MODULE_0___default.a.copyFile(_platform_server_fs__WEBPACK_IMPORTED_MODULE_0___default.a.join(budgetDir, 'metadata.latest.json'), _platform_server_fs__WEBPACK_IMPORTED_MODULE_0___default.a.join(budgetDir, 'metadata.json')); - await _platform_server_fs__WEBPACK_IMPORTED_MODULE_0___default.a.removeFile(_platform_server_fs__WEBPACK_IMPORTED_MODULE_0___default.a.join(budgetDir, LATEST_BACKUP_FILENAME)); - await _platform_server_fs__WEBPACK_IMPORTED_MODULE_0___default.a.removeFile(_platform_server_fs__WEBPACK_IMPORTED_MODULE_0___default.a.join(budgetDir, 'metadata.latest.json')); // Re-upload the new file - - try { - await _cloud_storage__WEBPACK_IMPORTED_MODULE_4__["upload"](); - } catch (e) {} - - _prefs__WEBPACK_IMPORTED_MODULE_3__["unloadPrefs"](); - } else { - console.log('Loading backup', backupId); // This function is only ever called when a budget isn't loaded, - // so it's safe to load our prefs in. We need to forget about any - // syncing data if we are loading a backup (the current sync data - // will be restored if the user reverts to the original version) - - await _prefs__WEBPACK_IMPORTED_MODULE_3__["loadPrefs"](id); - await _prefs__WEBPACK_IMPORTED_MODULE_3__["savePrefs"]({ - groupId: null, - lastSyncedTimestamp: null, - lastUploaded: null - }); // Re-upload the new file - - try { - await _cloud_storage__WEBPACK_IMPORTED_MODULE_4__["upload"](); - } catch (e) {} - - _prefs__WEBPACK_IMPORTED_MODULE_3__["unloadPrefs"](); - await _platform_server_fs__WEBPACK_IMPORTED_MODULE_0___default.a.copyFile(_platform_server_fs__WEBPACK_IMPORTED_MODULE_0___default.a.join(budgetDir, 'backups', backupId), _platform_server_fs__WEBPACK_IMPORTED_MODULE_0___default.a.join(budgetDir, 'db.sqlite')); - } -} -function startBackupService(id) { - if (serviceInterval) { - clearInterval(serviceInterval); - } // Make a backup every 15 minutes - - - serviceInterval = setInterval(async () => { - console.log('Making backup'); - await makeBackup(id); - }, 1000 * 60 * 15); -} -function stopBackupService() { - clearInterval(serviceInterval); - serviceInterval = null; -} - -/***/ }), - -/***/ "./packages/loot-core/src/server/budget/actions.js": -/*!*********************************************************!*\ - !*** ./packages/loot-core/src/server/budget/actions.js ***! - \*********************************************************/ -/*! exports provided: getBudget, setBudget, setBuffer, copyPreviousMonth, setZero, set3MonthAvg, setAllFuture, holdForNextMonth, holdForFutureMonths, resetHold, coverOverspending, transferAvailable, transferCategory, setCategoryCarryover */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getBudget", function() { return getBudget; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setBudget", function() { return setBudget; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setBuffer", function() { return setBuffer; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "copyPreviousMonth", function() { return copyPreviousMonth; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setZero", function() { return setZero; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "set3MonthAvg", function() { return set3MonthAvg; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setAllFuture", function() { return setAllFuture; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "holdForNextMonth", function() { return holdForNextMonth; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "holdForFutureMonths", function() { return holdForFutureMonths; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "resetHold", function() { return resetHold; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "coverOverspending", function() { return coverOverspending; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "transferAvailable", function() { return transferAvailable; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "transferCategory", function() { return transferCategory; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setCategoryCarryover", function() { return setCategoryCarryover; }); -/* harmony import */ var _shared_months__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../shared/months */ "./packages/loot-core/src/shared/months.js"); -/* harmony import */ var _db__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../db */ "./packages/loot-core/src/server/db/index.js"); -/* harmony import */ var _sync__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../sync */ "./packages/loot-core/src/server/sync/index.js"); -/* harmony import */ var _shared_util__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../shared/util */ "./packages/loot-core/src/shared/util.js"); -/* harmony import */ var _prefs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../prefs */ "./packages/loot-core/src/server/prefs.js"); -/* harmony import */ var _sheet__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../sheet */ "./packages/loot-core/src/server/sheet.js"); - - - - - - - -async function getSheetValue(sheetName, cell) { - const node = await _sheet__WEBPACK_IMPORTED_MODULE_5__["getCell"](sheetName, cell); - return typeof node.value === 'number' ? node.value : 0; -} // We want to only allow the positive movement of money back and -// forth. buffered should never be allowed to go into the negative, -// and you shouldn't be allowed to pull non-existant money from -// leftover. - - -function calcBufferedAmount(toBudget, buffered, amount) { - amount = Math.min(Math.max(amount, -buffered), Math.max(toBudget, 0)); - return buffered + amount; -} - -function getBudgetTable() { - let _ref = _prefs__WEBPACK_IMPORTED_MODULE_4__["getPrefs"]() || {}, - budgetType = _ref.budgetType; - - return budgetType === 'report' ? 'reflect_budgets' : 'zero_budgets'; -} - -function isReflectBudget() { - let _prefs$getPrefs = _prefs__WEBPACK_IMPORTED_MODULE_4__["getPrefs"](), - budgetType = _prefs$getPrefs.budgetType; - - return budgetType === 'report'; -} - -function isZeroBudget() { - let _prefs$getPrefs2 = _prefs__WEBPACK_IMPORTED_MODULE_4__["getPrefs"](), - budgetType = _prefs$getPrefs2.budgetType; - - return budgetType === 'rollover'; -} - -function dbMonth(month) { - return parseInt(month.replace('-', '')); -} - -function getBudgetData(table, month) { - return _db__WEBPACK_IMPORTED_MODULE_1__["all"](` - SELECT b.*, c.is_income FROM v_categories c - LEFT JOIN ${table} b ON b.category = c.id - WHERE c.tombstone = 0 AND b.month = ? - `, [month]); -} - -function getAllMonths(startMonth) { - let _sheet$get$meta = _sheet__WEBPACK_IMPORTED_MODULE_5__["get"]().meta(), - createdMonths = _sheet$get$meta.createdMonths; - - let latest = null; - - for (let month of createdMonths) { - if (latest == null || month > latest) { - latest = month; - } - } - - return _shared_months__WEBPACK_IMPORTED_MODULE_0__["rangeInclusive"](startMonth, latest); -} // TODO: Valid month format in all the functions below - - -function getBudget({ - category, - month -}) { - let table = getBudgetTable(); - let existing = _db__WEBPACK_IMPORTED_MODULE_1__["firstSync"](`SELECT * FROM ${table} WHERE month = ? AND category = ?`, [dbMonth(month), category]); - return existing ? existing.amount || 0 : 0; -} -function setBudget({ - category, - month, - amount -}) { - if (typeof amount !== 'number') { - amount = 0; - } - - const table = getBudgetTable(); - let existing = _db__WEBPACK_IMPORTED_MODULE_1__["firstSync"](`SELECT id FROM ${table} WHERE month = ? AND category = ?`, [dbMonth(month), category]); - - if (existing) { - return _db__WEBPACK_IMPORTED_MODULE_1__["update"](table, { - id: existing.id, - amount - }); - } - - return _db__WEBPACK_IMPORTED_MODULE_1__["insert"](table, { - id: `${dbMonth(month)}-${category}`, - month: dbMonth(month), - category, - amount - }); -} -function setBuffer(month, amount) { - let existing = _db__WEBPACK_IMPORTED_MODULE_1__["firstSync"](`SELECT id FROM zero_budget_months WHERE id = ?`, [month]); - - if (existing) { - return _db__WEBPACK_IMPORTED_MODULE_1__["update"]('zero_budget_months', { - id: existing.id, - buffered: amount - }); - } - - return _db__WEBPACK_IMPORTED_MODULE_1__["insert"]('zero_budget_months', { - id: month, - buffered: amount - }); -} - -function setCarryover(table, category, month, flag) { - let existing = _db__WEBPACK_IMPORTED_MODULE_1__["firstSync"](`SELECT id FROM ${table} WHERE month = ? AND category = ?`, [month, category]); - - if (existing) { - return _db__WEBPACK_IMPORTED_MODULE_1__["update"](table, { - id: existing.id, - carryover: flag ? 1 : 0 - }); - } - - return _db__WEBPACK_IMPORTED_MODULE_1__["insert"](table, { - id: `${month}-${category}`, - month, - category, - carryover: flag ? 1 : 0 - }); -} // Actions - - -async function copyPreviousMonth({ - month -}) { - let prevMonth = dbMonth(_shared_months__WEBPACK_IMPORTED_MODULE_0__["prevMonth"](month)); - let table = getBudgetTable(); - let budgetData = await getBudgetData(table, prevMonth); - await Object(_sync__WEBPACK_IMPORTED_MODULE_2__["batchMessages"])(() => { - budgetData.forEach(prevBudget => { - if (prevBudget.is_income === 1 && !isReflectBudget()) { - return; - } - - setBudget({ - category: prevBudget.category, - month, - amount: prevBudget.amount - }); - }); - }); -} -async function setZero({ - month -}) { - let categories = await _db__WEBPACK_IMPORTED_MODULE_1__["all"]('SELECT * FROM v_categories WHERE tombstone = 0'); - await Object(_sync__WEBPACK_IMPORTED_MODULE_2__["batchMessages"])(() => { - categories.forEach(cat => { - if (cat.is_income === 1 && !isReflectBudget()) { - return; - } - - setBudget({ - category: cat.id, - month, - amount: 0 - }); - }); - }); -} -async function set3MonthAvg({ - month -}) { - let categories = await _db__WEBPACK_IMPORTED_MODULE_1__["all"]('SELECT * FROM v_categories WHERE tombstone = 0'); - let prevMonth1 = _shared_months__WEBPACK_IMPORTED_MODULE_0__["prevMonth"](month); - let prevMonth2 = _shared_months__WEBPACK_IMPORTED_MODULE_0__["prevMonth"](prevMonth1); - let prevMonth3 = _shared_months__WEBPACK_IMPORTED_MODULE_0__["prevMonth"](prevMonth2); - await Object(_sync__WEBPACK_IMPORTED_MODULE_2__["batchMessages"])(async () => { - for (let cat of categories) { - if (cat.is_income === 1 && !isReflectBudget()) { - continue; - } - - let spent1 = await getSheetValue(_shared_months__WEBPACK_IMPORTED_MODULE_0__["sheetForMonth"](prevMonth1), 'sum-amount-' + cat.id); - let spent2 = await getSheetValue(_shared_months__WEBPACK_IMPORTED_MODULE_0__["sheetForMonth"](prevMonth2), 'sum-amount-' + cat.id); - let spent3 = await getSheetValue(_shared_months__WEBPACK_IMPORTED_MODULE_0__["sheetForMonth"](prevMonth3), 'sum-amount-' + cat.id); - const avg = (spent1 + spent2 + spent3) / 3 | 0; - setBudget({ - category: cat.id, - month, - amount: -avg - }); - } - }); -} -async function setAllFuture({ - startMonth -}) { - if (!isReflectBudget()) { - throw new Error('setAllFuture only applies to report budget type'); - } - - let table = getBudgetTable(); - let budgetData = await getBudgetData(table, dbMonth(startMonth)); - let months = getAllMonths(_shared_months__WEBPACK_IMPORTED_MODULE_0__["addMonths"](startMonth, 1)); - Object(_sync__WEBPACK_IMPORTED_MODULE_2__["batchMessages"])(() => { - for (let month of months) { - budgetData.forEach(budget => { - if (budget.is_income === 1 && !isReflectBudget()) { - return; - } - - setBudget({ - category: budget.category, - month, - amount: budget.amount - }); - }); - } - }); -} -async function holdForNextMonth({ - month, - amount -}) { - let row = await _db__WEBPACK_IMPORTED_MODULE_1__["first"]('SELECT buffered FROM zero_budget_months WHERE id = ?', [month]); - let sheetName = _shared_months__WEBPACK_IMPORTED_MODULE_0__["sheetForMonth"](month); - let toBudget = await getSheetValue(sheetName, 'to-budget'); - - if (toBudget > 0) { - let bufferedAmount = calcBufferedAmount(toBudget, row && row.buffered || 0, amount); - await setBuffer(month, bufferedAmount); - return true; - } - - return false; -} -async function holdForFutureMonths({ - startMonth, - amount -}) { - let months = getAllMonths(startMonth); - await Object(_sync__WEBPACK_IMPORTED_MODULE_2__["batchMessages"])(async () => { - for (let month of months) { - if (!(await holdForNextMonth({ - month, - amount - }))) { - break; - } - } - }); -} -async function resetHold({ - month -}) { - await setBuffer(month, 0); -} -async function coverOverspending({ - month, - to, - from -}) { - let sheetName = _shared_months__WEBPACK_IMPORTED_MODULE_0__["sheetForMonth"](month); - let toBudgeted = await getSheetValue(sheetName, 'budget-' + to); - let leftover = await getSheetValue(sheetName, 'leftover-' + to); - let leftoverFrom = await getSheetValue(sheetName, from === 'to-be-budgeted' ? 'to-budget' : 'leftover-' + from); - - if (leftover >= 0 || leftoverFrom <= 0) { - return; - } - - let amountCovered = Math.min(-leftover, leftoverFrom); // If we are covering it from the to be budgeted amount, ignore this - - if (from !== 'to-be-budgeted') { - const fromBudgeted = await getSheetValue(sheetName, 'budget-' + from); - await setBudget({ - category: from, - month, - amount: fromBudgeted - amountCovered - }); - } - - await setBudget({ - category: to, - month, - amount: toBudgeted + amountCovered - }); -} -async function transferAvailable({ - month, - amount, - category -}) { - let sheetName = _shared_months__WEBPACK_IMPORTED_MODULE_0__["sheetForMonth"](month); - let leftover = await getSheetValue(sheetName, 'to-budget'); - amount = Math.max(Math.min(amount, leftover), 0); - let budgeted = await getSheetValue(sheetName, 'budget-' + category); - await setBudget({ - category, - month, - amount: budgeted + amount - }); -} -async function transferCategory({ - month, - amount, - from, - to -}) { - const sheetName = _shared_months__WEBPACK_IMPORTED_MODULE_0__["sheetForMonth"](month); - const fromBudgeted = await getSheetValue(sheetName, 'budget-' + from); - await setBudget({ - category: from, - month, - amount: fromBudgeted - amount - }); // If we are simply moving it back into available cash to budget, - // don't do anything else - - if (to !== 'to-be-budgeted') { - const toBudgeted = await getSheetValue(sheetName, 'budget-' + to); - await setBudget({ - category: to, - month, - amount: toBudgeted + amount - }); - } -} -async function setCategoryCarryover({ - startMonth, - category, - flag -}) { - let table = getBudgetTable(); - let months = getAllMonths(startMonth); - await Object(_sync__WEBPACK_IMPORTED_MODULE_2__["batchMessages"])(() => { - for (let month of months) { - setCarryover(table, category, dbMonth(month), flag); - } - }); -} - -/***/ }), - -/***/ "./packages/loot-core/src/server/budget/app.js": -/*!*****************************************************!*\ - !*** ./packages/loot-core/src/server/budget/app.js ***! - \*****************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var _app__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../app */ "./packages/loot-core/src/server/app.js"); -/* harmony import */ var _mutators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../mutators */ "./packages/loot-core/src/server/mutators.js"); -/* harmony import */ var _undo__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../undo */ "./packages/loot-core/src/server/undo.js"); -/* harmony import */ var _actions__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./actions */ "./packages/loot-core/src/server/budget/actions.js"); - - - - -let app = Object(_app__WEBPACK_IMPORTED_MODULE_0__["createApp"])(); -app.method('budget/budget-amount', Object(_mutators__WEBPACK_IMPORTED_MODULE_1__["mutator"])(Object(_undo__WEBPACK_IMPORTED_MODULE_2__["undoable"])(_actions__WEBPACK_IMPORTED_MODULE_3__["setBudget"]))); -app.method('budget/copy-previous-month', Object(_mutators__WEBPACK_IMPORTED_MODULE_1__["mutator"])(Object(_undo__WEBPACK_IMPORTED_MODULE_2__["undoable"])(_actions__WEBPACK_IMPORTED_MODULE_3__["copyPreviousMonth"]))); -app.method('budget/set-zero', Object(_mutators__WEBPACK_IMPORTED_MODULE_1__["mutator"])(Object(_undo__WEBPACK_IMPORTED_MODULE_2__["undoable"])(_actions__WEBPACK_IMPORTED_MODULE_3__["setZero"]))); -app.method('budget/set-3month-avg', Object(_mutators__WEBPACK_IMPORTED_MODULE_1__["mutator"])(Object(_undo__WEBPACK_IMPORTED_MODULE_2__["undoable"])(_actions__WEBPACK_IMPORTED_MODULE_3__["set3MonthAvg"]))); -app.method('budget/set-all-future', Object(_mutators__WEBPACK_IMPORTED_MODULE_1__["mutator"])(Object(_undo__WEBPACK_IMPORTED_MODULE_2__["undoable"])(_actions__WEBPACK_IMPORTED_MODULE_3__["setAllFuture"]))); -app.method('budget/hold-for-next-month', Object(_mutators__WEBPACK_IMPORTED_MODULE_1__["mutator"])(Object(_undo__WEBPACK_IMPORTED_MODULE_2__["undoable"])(_actions__WEBPACK_IMPORTED_MODULE_3__["holdForNextMonth"]))); -app.method('budget/hold-for-future-months', Object(_mutators__WEBPACK_IMPORTED_MODULE_1__["mutator"])(Object(_undo__WEBPACK_IMPORTED_MODULE_2__["undoable"])(_actions__WEBPACK_IMPORTED_MODULE_3__["holdForFutureMonths"]))); -app.method('budget/reset-hold', Object(_mutators__WEBPACK_IMPORTED_MODULE_1__["mutator"])(Object(_undo__WEBPACK_IMPORTED_MODULE_2__["undoable"])(_actions__WEBPACK_IMPORTED_MODULE_3__["resetHold"]))); -app.method('budget/cover-overspending', Object(_mutators__WEBPACK_IMPORTED_MODULE_1__["mutator"])(Object(_undo__WEBPACK_IMPORTED_MODULE_2__["undoable"])(_actions__WEBPACK_IMPORTED_MODULE_3__["coverOverspending"]))); -app.method('budget/transfer-available', Object(_mutators__WEBPACK_IMPORTED_MODULE_1__["mutator"])(Object(_undo__WEBPACK_IMPORTED_MODULE_2__["undoable"])(_actions__WEBPACK_IMPORTED_MODULE_3__["transferAvailable"]))); -app.method('budget/transfer-category', Object(_mutators__WEBPACK_IMPORTED_MODULE_1__["mutator"])(Object(_undo__WEBPACK_IMPORTED_MODULE_2__["undoable"])(_actions__WEBPACK_IMPORTED_MODULE_3__["transferCategory"]))); -app.method('budget/set-carryover', Object(_mutators__WEBPACK_IMPORTED_MODULE_1__["mutator"])(Object(_undo__WEBPACK_IMPORTED_MODULE_2__["undoable"])(_actions__WEBPACK_IMPORTED_MODULE_3__["setCategoryCarryover"]))); -/* harmony default export */ __webpack_exports__["default"] = (app); - -/***/ }), - -/***/ "./packages/loot-core/src/server/budget/base.js": -/*!******************************************************!*\ - !*** ./packages/loot-core/src/server/budget/base.js ***! - \******************************************************/ -/*! exports provided: getBudgetType, getBudgetRange, triggerBudgetChanges, doTransfer, createBudget, createAllBudgets, setType */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getBudgetType", function() { return getBudgetType; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getBudgetRange", function() { return getBudgetRange; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "triggerBudgetChanges", function() { return triggerBudgetChanges; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "doTransfer", function() { return doTransfer; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createBudget", function() { return createBudget; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createAllBudgets", function() { return createAllBudgets; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setType", function() { return setType; }); -/* harmony import */ var _sheet__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../sheet */ "./packages/loot-core/src/server/sheet.js"); -/* harmony import */ var _db__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../db */ "./packages/loot-core/src/server/db/index.js"); -/* harmony import */ var _shared_months__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../shared/months */ "./packages/loot-core/src/shared/months.js"); -/* harmony import */ var _shared_util__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../shared/util */ "./packages/loot-core/src/shared/util.js"); -/* harmony import */ var _spreadsheet_util__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../spreadsheet/util */ "./packages/loot-core/src/server/spreadsheet/util.js"); -/* harmony import */ var _spreadsheet_util__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_spreadsheet_util__WEBPACK_IMPORTED_MODULE_4__); -/* harmony import */ var _report__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./report */ "./packages/loot-core/src/server/budget/report.js"); -/* harmony import */ var _rollover__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./rollover */ "./packages/loot-core/src/server/budget/rollover.js"); -/* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./util */ "./packages/loot-core/src/server/budget/util.js"); -/* harmony import */ var _budget_actions__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../budget/actions */ "./packages/loot-core/src/server/budget/actions.js"); -function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } - -function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } - -function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } - -function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } - -function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_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 _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } - -function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } - -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } - -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 mergeUpdates(updates) { - const merged = {}; - updates.forEach(update => { - Object.keys(update).forEach(sheet => { - if (merged[sheet]) { - merged[sheet] = _objectSpread(_objectSpread({}, merged[sheet]), update[sheet]); - } else { - merged[sheet] = update[sheet]; - } - }); - }); - return merged; -} - -function getBudgetType() { - let meta = _sheet__WEBPACK_IMPORTED_MODULE_0__["get"]().meta(); - return meta.budgetType || 'rollover'; -} -function getBudgetRange(start, end) { - start = _shared_months__WEBPACK_IMPORTED_MODULE_2__["getMonth"](start); - end = _shared_months__WEBPACK_IMPORTED_MODULE_2__["getMonth"](end); // The start date should never be after the end date. If that - // happened, the month range might be a valid range and weird - // things happen - - if (start > end) { - start = end; - } // Budgets should exist 3 months before the earliest needed date - // (either the oldest transaction or the current month if no - // transactions yet), and a year from the current date. There's no - // need to ever have budgets outside that range. - - - start = _shared_months__WEBPACK_IMPORTED_MODULE_2__["subMonths"](start, 3); - end = _shared_months__WEBPACK_IMPORTED_MODULE_2__["addMonths"](end, 12); - return { - start, - end, - range: _shared_months__WEBPACK_IMPORTED_MODULE_2__["rangeInclusive"](start, end) - }; -} - -function createCategory(cat, sheetName, prevSheetName, start, end) { - _sheet__WEBPACK_IMPORTED_MODULE_0__["get"]().createDynamic(sheetName, 'sum-amount-' + cat.id, { - initialValue: 0, - run: () => { - // Making this sync is faster! - let rows = _db__WEBPACK_IMPORTED_MODULE_1__["runQuery"](`SELECT SUM(amount) as amount FROM v_transactions_internal_alive t - LEFT JOIN accounts a ON a.id = t.account - WHERE t.date >= ${start} AND t.date <= ${end} - AND category = '${cat.id}' AND a.offbudget = 0`, [], true); - let row = rows[0]; - let amount = row ? row.amount : 0; - return amount || 0; - } - }); - - if (getBudgetType() === 'rollover') { - _rollover__WEBPACK_IMPORTED_MODULE_6__["createCategory"](cat, sheetName, prevSheetName); - } else { - _report__WEBPACK_IMPORTED_MODULE_5__["createCategory"](cat, sheetName, prevSheetName); - } -} - -function createCategoryGroup(group, sheetName) { - _sheet__WEBPACK_IMPORTED_MODULE_0__["get"]().createDynamic(sheetName, 'group-sum-amount-' + group.id, { - initialValue: 0, - dependencies: group.categories.map(cat => `sum-amount-${cat.id}`), - run: _util__WEBPACK_IMPORTED_MODULE_7__["sumAmounts"] - }); - - if (!group.is_income || getBudgetType() !== 'rollover') { - _sheet__WEBPACK_IMPORTED_MODULE_0__["get"]().createDynamic(sheetName, 'group-budget-' + group.id, { - initialValue: 0, - dependencies: group.categories.map(cat => `budget-${cat.id}`), - run: _util__WEBPACK_IMPORTED_MODULE_7__["sumAmounts"] - }); - _sheet__WEBPACK_IMPORTED_MODULE_0__["get"]().createDynamic(sheetName, 'group-leftover-' + group.id, { - initialValue: 0, - dependencies: group.categories.map(cat => `leftover-${cat.id}`), - run: _util__WEBPACK_IMPORTED_MODULE_7__["sumAmounts"] - }); - } -} - -function handleAccountChange(months, oldValue, newValue) { - if (!oldValue || oldValue.offbudget !== newValue.offbudget) { - let rows = _db__WEBPACK_IMPORTED_MODULE_1__["runQuery"](` - SELECT DISTINCT(category) as category FROM transactions - WHERE acct = ? - `, [newValue.id], true); - months.forEach(month => { - let sheetName = _shared_months__WEBPACK_IMPORTED_MODULE_2__["sheetForMonth"](month, getBudgetType()); - rows.forEach(row => { - _sheet__WEBPACK_IMPORTED_MODULE_0__["get"]().recompute(Object(_spreadsheet_util__WEBPACK_IMPORTED_MODULE_4__["resolveName"])(sheetName, 'sum-amount-' + row.category)); - }); - }); - } -} - -function handleTransactionChange(transaction, changedFields) { - if ((changedFields.has('date') || changedFields.has('acct') || changedFields.has('amount') || changedFields.has('category') || changedFields.has('tombstone') || changedFields.has('isParent')) && transaction.date && transaction.category) { - let month = _shared_months__WEBPACK_IMPORTED_MODULE_2__["monthFromDate"](_db__WEBPACK_IMPORTED_MODULE_1__["fromDateRepr"](transaction.date)); - let sheetName = _shared_months__WEBPACK_IMPORTED_MODULE_2__["sheetForMonth"](month, getBudgetType()); - _sheet__WEBPACK_IMPORTED_MODULE_0__["get"]().recompute(Object(_spreadsheet_util__WEBPACK_IMPORTED_MODULE_4__["resolveName"])(sheetName, 'sum-amount-' + transaction.category)); - } -} - -function handleCategoryMappingChange(months, oldValue, newValue) { - months.forEach(month => { - let sheetName = _shared_months__WEBPACK_IMPORTED_MODULE_2__["sheetForMonth"](month, getBudgetType()); - - if (oldValue) { - _sheet__WEBPACK_IMPORTED_MODULE_0__["get"]().recompute(Object(_spreadsheet_util__WEBPACK_IMPORTED_MODULE_4__["resolveName"])(sheetName, 'sum-amount-' + oldValue.transferId)); - } - - _sheet__WEBPACK_IMPORTED_MODULE_0__["get"]().recompute(Object(_spreadsheet_util__WEBPACK_IMPORTED_MODULE_4__["resolveName"])(sheetName, 'sum-amount-' + newValue.transferId)); - }); -} - -function handleCategoryChange(months, oldValue, newValue) { - function addDeps(sheetName, groupId, catId) { - _sheet__WEBPACK_IMPORTED_MODULE_0__["get"]().addDependencies(sheetName, `group-sum-amount-${groupId}`, [`sum-amount-${catId}`]); - _sheet__WEBPACK_IMPORTED_MODULE_0__["get"]().addDependencies(sheetName, `group-budget-${groupId}`, [`budget-${catId}`]); - _sheet__WEBPACK_IMPORTED_MODULE_0__["get"]().addDependencies(sheetName, `group-leftover-${groupId}`, [`leftover-${catId}`]); - } - - function removeDeps(sheetName, groupId, catId) { - _sheet__WEBPACK_IMPORTED_MODULE_0__["get"]().removeDependencies(sheetName, `group-sum-amount-${groupId}`, [`sum-amount-${catId}`]); - _sheet__WEBPACK_IMPORTED_MODULE_0__["get"]().removeDependencies(sheetName, `group-budget-${groupId}`, [`budget-${catId}`]); - _sheet__WEBPACK_IMPORTED_MODULE_0__["get"]().removeDependencies(sheetName, `group-leftover-${groupId}`, [`leftover-${catId}`]); - } - - let budgetType = getBudgetType(); - - if (oldValue && oldValue.tombstone === 0 && newValue.tombstone === 1) { - let id = newValue.id; - let groupId = newValue.cat_group; - months.forEach(month => { - let sheetName = _shared_months__WEBPACK_IMPORTED_MODULE_2__["sheetForMonth"](month); - removeDeps(sheetName, groupId, id); - }); - } else if (newValue.tombstone === 0 && (!oldValue || oldValue.tombstone === 1)) { - if (budgetType === 'rollover') { - _rollover__WEBPACK_IMPORTED_MODULE_6__["createBlankCategory"](newValue, months); - } - - months.forEach(month => { - let prevMonth = _shared_months__WEBPACK_IMPORTED_MODULE_2__["prevMonth"](month); - let prevSheetName = _shared_months__WEBPACK_IMPORTED_MODULE_2__["sheetForMonth"](prevMonth, budgetType); - let sheetName = _shared_months__WEBPACK_IMPORTED_MODULE_2__["sheetForMonth"](month, budgetType); - - let _monthUtils$bounds = _shared_months__WEBPACK_IMPORTED_MODULE_2__["bounds"](month), - start = _monthUtils$bounds.start, - end = _monthUtils$bounds.end; - - createCategory(newValue, sheetName, prevSheetName, start, end); - let id = newValue.id; - let groupId = newValue.cat_group; - - if (getBudgetType() === 'rollover') { - _sheet__WEBPACK_IMPORTED_MODULE_0__["get"]().addDependencies(sheetName, 'last-month-overspent', [`${prevSheetName}!leftover-${id}`, `${prevSheetName}!carryover-${id}`]); - } - - addDeps(sheetName, groupId, id); - }); - } else if (oldValue && oldValue.cat_group !== newValue.cat_group) { - // The category moved so we need to update the dependencies - let id = newValue.id; - months.forEach(month => { - let sheetName = _shared_months__WEBPACK_IMPORTED_MODULE_2__["sheetForMonth"](month, budgetType); - removeDeps(sheetName, oldValue.cat_group, id); - addDeps(sheetName, newValue.cat_group, id); - }); - } -} - -function handleCategoryGroupChange(months, oldValue, newValue) { - let budgetType = getBudgetType(); - - function addDeps(sheetName, groupId) { - _sheet__WEBPACK_IMPORTED_MODULE_0__["get"]().addDependencies(sheetName, 'total-budgeted', [`group-budget-${groupId}`]); - _sheet__WEBPACK_IMPORTED_MODULE_0__["get"]().addDependencies(sheetName, 'total-spent', [`group-sum-amount-${groupId}`]); - _sheet__WEBPACK_IMPORTED_MODULE_0__["get"]().addDependencies(sheetName, 'total-leftover', [`group-leftover-${groupId}`]); - } - - function removeDeps(sheetName, groupId) { - _sheet__WEBPACK_IMPORTED_MODULE_0__["get"]().removeDependencies(sheetName, 'total-budgeted', [`group-budget-${groupId}`]); - _sheet__WEBPACK_IMPORTED_MODULE_0__["get"]().removeDependencies(sheetName, 'total-spent', [`group-sum-amount-${groupId}`]); - _sheet__WEBPACK_IMPORTED_MODULE_0__["get"]().removeDependencies(sheetName, 'total-leftover', [`group-leftover-${groupId}`]); - } - - if (newValue.tombstone === 1 && oldValue && oldValue.tombstone === 0) { - let id = newValue.id; - months.forEach(month => { - let sheetName = _shared_months__WEBPACK_IMPORTED_MODULE_2__["sheetForMonth"](month, budgetType); - removeDeps(sheetName, id); - }); - } else if (newValue.tombstone === 0 && (!oldValue || oldValue.tombstone === 1)) { - let group = newValue; - - if (!group.is_income || budgetType !== 'rollover') { - months.forEach(month => { - let sheetName = _shared_months__WEBPACK_IMPORTED_MODULE_2__["sheetForMonth"](month, budgetType); // Dirty, dirty hack. These functions should not be async, but this is - // OK because we're leveraging the sync nature of queries. Ideally we - // wouldn't be querying here. But I think we have to. At least for now - // we do - - let categories = _db__WEBPACK_IMPORTED_MODULE_1__["runQuery"]('SELECT * FROM categories WHERE tombstone = 0 AND cat_group = ?', [group.id], true); - createCategoryGroup(_objectSpread(_objectSpread({}, group), {}, { - categories - }), sheetName); - addDeps(sheetName, group.id); - }); - } - } -} - -function handleBudgetMonthChange(budget) { - let sheetName = _shared_months__WEBPACK_IMPORTED_MODULE_2__["sheetForMonth"](budget.id); - _sheet__WEBPACK_IMPORTED_MODULE_0__["get"]().set(`${sheetName}!buffered`, budget.buffered); -} - -function handleBudgetChange(budget) { - if (budget.category) { - let sheetName = _shared_months__WEBPACK_IMPORTED_MODULE_2__["sheetForMonth"](budget.month.toString()); - _sheet__WEBPACK_IMPORTED_MODULE_0__["get"]().set(`${sheetName}!budget-${budget.category}`, budget.amount || 0); - _sheet__WEBPACK_IMPORTED_MODULE_0__["get"]().set(`${sheetName}!carryover-${budget.category}`, budget.carryover === 1 ? true : false); - } -} - -function triggerBudgetChanges(oldValues, newValues) { - let _sheet$get$meta = _sheet__WEBPACK_IMPORTED_MODULE_0__["get"]().meta(), - _sheet$get$meta$creat = _sheet$get$meta.createdMonths, - createdMonths = _sheet$get$meta$creat === void 0 ? new Set() : _sheet$get$meta$creat; - - _sheet__WEBPACK_IMPORTED_MODULE_0__["startTransaction"](); - - try { - newValues.forEach((items, table) => { - let old = oldValues.get(table); - items.forEach(newValue => { - let oldValue = old && old.get(newValue.id); - - if (table === 'zero_budget_months') { - handleBudgetMonthChange(newValue); - } else if (table === 'zero_budgets' || table === 'reflect_budgets') { - handleBudgetChange(newValue); - } else if (table === 'transactions') { - let changed = new Set(Object.keys(Object(_shared_util__WEBPACK_IMPORTED_MODULE_3__["getChangedValues"])(oldValue || {}, newValue) || {})); - - if (oldValue) { - handleTransactionChange(oldValue, changed); - } - - handleTransactionChange(newValue, changed); - } else if (table === 'category_mapping') { - handleCategoryMappingChange(createdMonths, oldValue, newValue); - } else if (table === 'categories') { - handleCategoryChange(createdMonths, oldValue, newValue); - } else if (table === 'category_groups') { - handleCategoryGroupChange(createdMonths, oldValue, newValue); - } else if (table === 'accounts') { - handleAccountChange(createdMonths, oldValue, newValue); - } - }); - }); - } finally { - _sheet__WEBPACK_IMPORTED_MODULE_0__["endTransaction"](); - } -} -async function doTransfer(categoryIds, transferId) { - let _sheet$get$meta2 = _sheet__WEBPACK_IMPORTED_MODULE_0__["get"]().meta(), - months = _sheet$get$meta2.createdMonths; - - [...months].map(month => { - let totalValue = categoryIds.map(id => { - return _budget_actions__WEBPACK_IMPORTED_MODULE_8__["getBudget"]({ - month, - category: id - }); - }).reduce((total, value) => total + value, 0); - let transferValue = _budget_actions__WEBPACK_IMPORTED_MODULE_8__["getBudget"]({ - month, - category: transferId - }); - _budget_actions__WEBPACK_IMPORTED_MODULE_8__["setBudget"]({ - month, - category: transferId, - amount: totalValue + transferValue - }); - }); -} -async function createBudget(months) { - const categories = await _db__WEBPACK_IMPORTED_MODULE_1__["getCategories"](); - const groups = await _db__WEBPACK_IMPORTED_MODULE_1__["getCategoriesGrouped"](); - _sheet__WEBPACK_IMPORTED_MODULE_0__["startTransaction"](); - let meta = _sheet__WEBPACK_IMPORTED_MODULE_0__["get"]().meta(); - meta.createdMonths = meta.createdMonths || new Set(); - let budgetType = getBudgetType(); - - if (budgetType === 'rollover') { - _rollover__WEBPACK_IMPORTED_MODULE_6__["createBudget"](meta, categories, months); - } - - months.forEach(month => { - if (!meta.createdMonths.has(month)) { - let prevMonth = _shared_months__WEBPACK_IMPORTED_MODULE_2__["prevMonth"](month); - - let _monthUtils$bounds2 = _shared_months__WEBPACK_IMPORTED_MODULE_2__["bounds"](month), - start = _monthUtils$bounds2.start, - end = _monthUtils$bounds2.end; - - let sheetName = _shared_months__WEBPACK_IMPORTED_MODULE_2__["sheetForMonth"](month, budgetType); - let prevSheetName = _shared_months__WEBPACK_IMPORTED_MODULE_2__["sheetForMonth"](prevMonth, budgetType); - categories.forEach(cat => { - createCategory(cat, sheetName, prevSheetName, start, end); - }); - groups.forEach(group => { - createCategoryGroup(group, sheetName); - }); - - if (budgetType === 'rollover') { - _rollover__WEBPACK_IMPORTED_MODULE_6__["createSummary"](groups, categories, prevSheetName, sheetName); - } else { - _report__WEBPACK_IMPORTED_MODULE_5__["createSummary"](groups, categories, sheetName); - } - - meta.createdMonths.add(month); - } - }); - _sheet__WEBPACK_IMPORTED_MODULE_0__["get"]().setMeta(meta); - _sheet__WEBPACK_IMPORTED_MODULE_0__["endTransaction"](); // Wait for the spreadsheet to finish computing. Normally this won't - // do anything (as values are cached) but on first run this need to - // show the loading screen while it initially sets up. - - await _sheet__WEBPACK_IMPORTED_MODULE_0__["waitOnSpreadsheet"](); -} -async function createAllBudgets() { - let earliestTransaction = await _db__WEBPACK_IMPORTED_MODULE_1__["first"]('SELECT * FROM transactions WHERE isChild=0 AND date IS NOT NULL ORDER BY date ASC LIMIT 1'); - let earliestDate = earliestTransaction && _db__WEBPACK_IMPORTED_MODULE_1__["fromDateRepr"](earliestTransaction.date); - let currentMonth = _shared_months__WEBPACK_IMPORTED_MODULE_2__["currentMonth"](); // Get the range based off of the earliest transaction and the - // current month. If no transactions currently exist the current - // month is also used as the starting month - - let _getBudgetRange = getBudgetRange(earliestDate || currentMonth, currentMonth), - start = _getBudgetRange.start, - end = _getBudgetRange.end, - range = _getBudgetRange.range; - - let meta = _sheet__WEBPACK_IMPORTED_MODULE_0__["get"]().meta(); - let createdMonths = meta.createdMonths || new Set(); - let newMonths = range.filter(m => !createdMonths.has(m)); - - if (newMonths.length > 0) { - await createBudget(range); - } - - return { - start, - end - }; -} -async function setType(type) { - let meta = _sheet__WEBPACK_IMPORTED_MODULE_0__["get"]().meta(); - - if (type === meta.budgetType) { - return; - } - - meta.budgetType = type; - meta.createdMonths = new Set(); // Go through and force all the cells to be recomputed - - let nodes = _sheet__WEBPACK_IMPORTED_MODULE_0__["get"]().getNodes(); - _db__WEBPACK_IMPORTED_MODULE_1__["transaction"](() => { - for (let name of nodes.keys()) { - let _name$split = name.split('!'), - _name$split2 = _slicedToArray(_name$split, 2), - sheetName = _name$split2[0], - cellName = _name$split2[1]; - - if (sheetName.match(/^budget\d+/)) { - _sheet__WEBPACK_IMPORTED_MODULE_0__["get"]().deleteCell(sheetName, cellName); - } - } - }); - _sheet__WEBPACK_IMPORTED_MODULE_0__["get"]().startCacheBarrier(); - _sheet__WEBPACK_IMPORTED_MODULE_0__["loadUserBudgets"](_db__WEBPACK_IMPORTED_MODULE_1__); - let bounds = await createAllBudgets(); - _sheet__WEBPACK_IMPORTED_MODULE_0__["get"]().endCacheBarrier(); - return bounds; -} - -/***/ }), - -/***/ "./packages/loot-core/src/server/budget/report.js": -/*!********************************************************!*\ - !*** ./packages/loot-core/src/server/budget/report.js ***! - \********************************************************/ -/*! exports provided: createCategory, createSummary */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createCategory", function() { return createCategory; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createSummary", function() { return createSummary; }); -/* harmony import */ var _sheet__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../sheet */ "./packages/loot-core/src/server/sheet.js"); -/* harmony import */ var _shared_months__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../shared/months */ "./packages/loot-core/src/shared/months.js"); -/* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./util */ "./packages/loot-core/src/server/budget/util.js"); - - - - -const _require = __webpack_require__(/*! ../spreadsheet/util */ "./packages/loot-core/src/server/spreadsheet/util.js"), - resolveName = _require.resolveName; - -async function createCategory(cat, sheetName, prevSheetName) { - _sheet__WEBPACK_IMPORTED_MODULE_0__["get"]().createStatic(sheetName, `budget-${cat.id}`, 0); // This makes the app more robust by "fixing up" null budget values. - // Those should not be allowed, but in case somehow a null value - // ends up there, we are resilient to it. Preferrably the - // spreadsheet would have types and be more strict about what is - // allowed to be set. - - if (_sheet__WEBPACK_IMPORTED_MODULE_0__["get"]().getCellValue(sheetName, `budget-${cat.id}`) == null) { - _sheet__WEBPACK_IMPORTED_MODULE_0__["get"]().set(resolveName(sheetName, `budget-${cat.id}`), 0); - } - - _sheet__WEBPACK_IMPORTED_MODULE_0__["get"]().createDynamic(sheetName, `leftover-${cat.id}`, { - initialValue: 0, - dependencies: [`budget-${cat.id}`, `sum-amount-${cat.id}`, `${prevSheetName}!carryover-${cat.id}`, `${prevSheetName}!leftover-${cat.id}`], - run: (budgeted, sumAmount, prevCarryover, prevLeftover) => { - if (cat.is_income) { - return Object(_util__WEBPACK_IMPORTED_MODULE_2__["number"])(budgeted) - Object(_util__WEBPACK_IMPORTED_MODULE_2__["number"])(sumAmount) + (prevCarryover ? Object(_util__WEBPACK_IMPORTED_MODULE_2__["number"])(prevLeftover) : 0); - } - - return Object(_util__WEBPACK_IMPORTED_MODULE_2__["number"])(budgeted) + Object(_util__WEBPACK_IMPORTED_MODULE_2__["number"])(sumAmount) + (prevCarryover ? Object(_util__WEBPACK_IMPORTED_MODULE_2__["number"])(prevLeftover) : 0); - } - }); - _sheet__WEBPACK_IMPORTED_MODULE_0__["get"]().createDynamic(sheetName, `spent-with-carryover-${cat.id}`, { - initialValue: 0, - dependencies: [`budget-${cat.id}`, `sum-amount-${cat.id}`, `carryover-${cat.id}`], - // TODO: Why refresh?? - refresh: true, - run: (budgeted, sumAmount, carryover) => { - return carryover ? Math.max(0, Object(_util__WEBPACK_IMPORTED_MODULE_2__["number"])(budgeted) + Object(_util__WEBPACK_IMPORTED_MODULE_2__["number"])(sumAmount)) : sumAmount; - } - }); - _sheet__WEBPACK_IMPORTED_MODULE_0__["get"]().createStatic(sheetName, `carryover-${cat.id}`, false); -} -function createSummary(groups, categories, sheetName) { - let incomeGroup = groups.filter(group => group.is_income)[0]; - let expenseCategories = categories.filter(cat => !cat.is_income); - _sheet__WEBPACK_IMPORTED_MODULE_0__["get"]().createDynamic(sheetName, 'total-budgeted', { - initialValue: 0, - dependencies: groups.filter(group => !group.is_income).map(group => `group-budget-${group.id}`), - run: _util__WEBPACK_IMPORTED_MODULE_2__["sumAmounts"] - }); - _sheet__WEBPACK_IMPORTED_MODULE_0__["get"]().createDynamic(sheetName, 'total-spent', { - initialValue: 0, - refresh: true, - dependencies: expenseCategories.map(cat => `${sheetName}!spent-with-carryover-${cat.id}`), - run: _util__WEBPACK_IMPORTED_MODULE_2__["sumAmounts"] - }); - _sheet__WEBPACK_IMPORTED_MODULE_0__["get"]().createDynamic(sheetName, 'total-income', { - initialValue: 0, - dependencies: [`group-sum-amount-${incomeGroup.id}`], - run: amount => amount - }); - _sheet__WEBPACK_IMPORTED_MODULE_0__["get"]().createDynamic(sheetName, 'total-leftover', { - initialValue: 0, - dependencies: ['total-budgeted', 'total-spent'], - run: _util__WEBPACK_IMPORTED_MODULE_2__["sumAmounts"] - }); - _sheet__WEBPACK_IMPORTED_MODULE_0__["get"]().createDynamic(sheetName, 'total-budget-income', { - initialValue: 0, - dependencies: [`group-budget-${incomeGroup.id}`], - run: amount => amount - }); - _sheet__WEBPACK_IMPORTED_MODULE_0__["get"]().createDynamic(sheetName, 'total-saved', { - initialValue: 0, - dependencies: ['total-budget-income', 'total-budgeted'], - run: (income, budgeted) => { - return income - budgeted; - } - }); - _sheet__WEBPACK_IMPORTED_MODULE_0__["get"]().createDynamic(sheetName, 'real-saved', { - initialValue: 0, - dependencies: ['total-income', 'total-spent'], - run: (income, spent) => { - return income - -spent; - } - }); -} - -/***/ }), - -/***/ "./packages/loot-core/src/server/budget/rollover.js": -/*!**********************************************************!*\ - !*** ./packages/loot-core/src/server/budget/rollover.js ***! - \**********************************************************/ -/*! exports provided: createBlankCategory, createCategory, createSummary, createBudget */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createBlankCategory", function() { return createBlankCategory; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createCategory", function() { return createCategory; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createSummary", function() { return createSummary; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createBudget", function() { return createBudget; }); -/* harmony import */ var _sheet__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../sheet */ "./packages/loot-core/src/server/sheet.js"); -/* harmony import */ var _shared_months__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../shared/months */ "./packages/loot-core/src/shared/months.js"); -/* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./util */ "./packages/loot-core/src/server/budget/util.js"); - - - - -const _require = __webpack_require__(/*! ../spreadsheet/util */ "./packages/loot-core/src/server/spreadsheet/util.js"), - resolveName = _require.resolveName; - -function getBlankSheet(months) { - let blankMonth = _shared_months__WEBPACK_IMPORTED_MODULE_1__["prevMonth"](months[0]); - return _shared_months__WEBPACK_IMPORTED_MODULE_1__["sheetForMonth"](blankMonth, 'rollover'); -} - -function createBlankCategory(cat, months) { - if (months.length > 0) { - let sheetName = getBlankSheet(months); - _sheet__WEBPACK_IMPORTED_MODULE_0__["get"]().createStatic(sheetName, `carryover-${cat.id}`, false); - _sheet__WEBPACK_IMPORTED_MODULE_0__["get"]().createStatic(sheetName, `leftover-${cat.id}`, 0); - _sheet__WEBPACK_IMPORTED_MODULE_0__["get"]().createStatic(sheetName, `leftover-pos-${cat.id}`, 0); - } -} - -function createBlankMonth(categories, sheetName, months) { - _sheet__WEBPACK_IMPORTED_MODULE_0__["get"]().createStatic(sheetName, 'is-blank', true); - _sheet__WEBPACK_IMPORTED_MODULE_0__["get"]().createStatic(sheetName, 'to-budget', 0); - _sheet__WEBPACK_IMPORTED_MODULE_0__["get"]().createStatic(sheetName, 'buffered', 0); - categories.forEach(cat => createBlankCategory(cat, months)); -} - -function createCategory(cat, sheetName, prevSheetName) { - if (!cat.is_income) { - _sheet__WEBPACK_IMPORTED_MODULE_0__["get"]().createStatic(sheetName, `budget-${cat.id}`, 0); // This makes the app more robust by "fixing up" null budget values. - // Those should not be allowed, but in case somehow a null value - // ends up there, we are resilient to it. Preferrably the - // spreadsheet would have types and be more strict about what is - // allowed to be set. - - if (_sheet__WEBPACK_IMPORTED_MODULE_0__["get"]().getCellValue(sheetName, `budget-${cat.id}`) == null) { - _sheet__WEBPACK_IMPORTED_MODULE_0__["get"]().set(resolveName(sheetName, `budget-${cat.id}`), 0); - } - - _sheet__WEBPACK_IMPORTED_MODULE_0__["get"]().createStatic(sheetName, `carryover-${cat.id}`, false); - _sheet__WEBPACK_IMPORTED_MODULE_0__["get"]().createDynamic(sheetName, `leftover-${cat.id}`, { - initialValue: 0, - dependencies: [`budget-${cat.id}`, `sum-amount-${cat.id}`, `${prevSheetName}!carryover-${cat.id}`, `${prevSheetName}!leftover-${cat.id}`, `${prevSheetName}!leftover-pos-${cat.id}`], - run: (budgeted, spent, prevCarryover, prevLeftover, prevLeftoverPos) => { - return Object(_util__WEBPACK_IMPORTED_MODULE_2__["number"])(budgeted) + Object(_util__WEBPACK_IMPORTED_MODULE_2__["number"])(spent) + (prevCarryover ? Object(_util__WEBPACK_IMPORTED_MODULE_2__["number"])(prevLeftover) : Object(_util__WEBPACK_IMPORTED_MODULE_2__["number"])(prevLeftoverPos)); - } - }); - _sheet__WEBPACK_IMPORTED_MODULE_0__["get"]().createDynamic(sheetName, 'leftover-pos-' + cat.id, { - initialValue: 0, - dependencies: [`leftover-${cat.id}`], - run: leftover => { - return leftover < 0 ? 0 : leftover; - } - }); - } -} -function createSummary(groups, categories, prevSheetName, sheetName) { - let incomeGroup = groups.filter(group => group.is_income)[0]; - let expenseCategories = categories.filter(cat => !cat.is_income); - _sheet__WEBPACK_IMPORTED_MODULE_0__["get"]().createStatic(sheetName, 'buffered', 0); - _sheet__WEBPACK_IMPORTED_MODULE_0__["get"]().createDynamic(sheetName, 'from-last-month', { - initialValue: 0, - dependencies: [`${prevSheetName}!to-budget`, `${prevSheetName}!buffered`], - run: (toBudget, buffered) => Object(_util__WEBPACK_IMPORTED_MODULE_2__["number"])(toBudget) + Object(_util__WEBPACK_IMPORTED_MODULE_2__["number"])(buffered) - }); // Alias the group income total to `total-income` - - _sheet__WEBPACK_IMPORTED_MODULE_0__["get"]().createDynamic(sheetName, 'total-income', { - initialValue: 0, - dependencies: [`group-sum-amount-${incomeGroup.id}`], - run: amount => amount - }); - _sheet__WEBPACK_IMPORTED_MODULE_0__["get"]().createDynamic(sheetName, 'available-funds', { - initialValue: 0, - dependencies: ['total-income', 'from-last-month'], - run: (income, fromLastMonth) => Object(_util__WEBPACK_IMPORTED_MODULE_2__["number"])(income) + Object(_util__WEBPACK_IMPORTED_MODULE_2__["number"])(fromLastMonth) - }); - _sheet__WEBPACK_IMPORTED_MODULE_0__["get"]().createDynamic(sheetName, 'last-month-overspent', { - initialValue: 0, - dependencies: Object(_util__WEBPACK_IMPORTED_MODULE_2__["flatten2"])(expenseCategories.map(cat => [`${prevSheetName}!leftover-${cat.id}`, `${prevSheetName}!carryover-${cat.id}`])), - run: (...data) => { - data = Object(_util__WEBPACK_IMPORTED_MODULE_2__["unflatten2"])(data); - return data.reduce((total, [leftover, carryover]) => { - if (carryover) { - return total; - } - - return total + Math.min(0, Object(_util__WEBPACK_IMPORTED_MODULE_2__["number"])(leftover)); - }, 0); - } - }); - _sheet__WEBPACK_IMPORTED_MODULE_0__["get"]().createDynamic(sheetName, 'total-budgeted', { - initialValue: 0, - dependencies: groups.filter(group => !group.is_income).map(group => `group-budget-${group.id}`), - run: (...amounts) => { - // Negate budgeted amount - return -Object(_util__WEBPACK_IMPORTED_MODULE_2__["sumAmounts"])(...amounts); - } - }); - _sheet__WEBPACK_IMPORTED_MODULE_0__["get"]().createDynamic(sheetName, 'buffered', { - initialValue: 0 - }); - _sheet__WEBPACK_IMPORTED_MODULE_0__["get"]().createDynamic(sheetName, 'to-budget', { - initialValue: 0, - dependencies: ['available-funds', 'last-month-overspent', 'total-budgeted', 'buffered'], - run: (available, lastOverspent, totalBudgeted, buffered) => { - return Object(_util__WEBPACK_IMPORTED_MODULE_2__["number"])(available) + Object(_util__WEBPACK_IMPORTED_MODULE_2__["number"])(lastOverspent) + Object(_util__WEBPACK_IMPORTED_MODULE_2__["number"])(totalBudgeted) - Object(_util__WEBPACK_IMPORTED_MODULE_2__["number"])(buffered); - } - }); - _sheet__WEBPACK_IMPORTED_MODULE_0__["get"]().createDynamic(sheetName, 'total-spent', { - initialValue: 0, - dependencies: groups.filter(group => !group.is_income).map(group => `group-sum-amount-${group.id}`), - run: _util__WEBPACK_IMPORTED_MODULE_2__["sumAmounts"] - }); - _sheet__WEBPACK_IMPORTED_MODULE_0__["get"]().createDynamic(sheetName, 'total-leftover', { - initialValue: 0, - dependencies: groups.filter(group => !group.is_income).map(group => `group-leftover-${group.id}`), - run: _util__WEBPACK_IMPORTED_MODULE_2__["sumAmounts"] - }); -} -function createBudget(meta, categories, months) { - // The spreadsheet is now strict - so we need to fill in some - // default values for the month before the first month. Only do this - // if it doesn't already exist - let blankSheet = getBlankSheet(months); - - if (meta.blankSheet !== blankSheet) { - _sheet__WEBPACK_IMPORTED_MODULE_0__["get"]().clearSheet(meta.blankSheet); - createBlankMonth(categories, blankSheet, months); - meta.blankSheet = blankSheet; - } -} - -/***/ }), - -/***/ "./packages/loot-core/src/server/budget/util.js": -/*!******************************************************!*\ - !*** ./packages/loot-core/src/server/budget/util.js ***! - \******************************************************/ -/*! exports provided: number, sumAmounts, flatten2, unflatten2 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "sumAmounts", function() { return sumAmounts; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "flatten2", function() { return flatten2; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "unflatten2", function() { return unflatten2; }); -/* harmony import */ var _spreadsheet_globals__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../spreadsheet/globals */ "./packages/loot-core/src/server/spreadsheet/globals.js"); -/* harmony import */ var _spreadsheet_globals__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_spreadsheet_globals__WEBPACK_IMPORTED_MODULE_0__); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "number", function() { return _spreadsheet_globals__WEBPACK_IMPORTED_MODULE_0__["number"]; }); - - - -function sumAmounts(...amounts) { - return amounts.reduce((total, amount) => { - return total + Object(_spreadsheet_globals__WEBPACK_IMPORTED_MODULE_0__["number"])(amount); - }, 0); -} -function flatten2(arr) { - return Array.prototype.concat.apply([], arr); -} -function unflatten2(arr) { - let res = []; - - for (let i = 0; i < arr.length; i += 2) { - res.push([arr[i], arr[i + 1]]); - } - - return res; -} - -/***/ }), - -/***/ "./packages/loot-core/src/server/cloud-storage.js": -/*!********************************************************!*\ - !*** ./packages/loot-core/src/server/cloud-storage.js ***! - \********************************************************/ -/*! exports provided: checkKey, resetSyncState, exportBuffer, importBuffer, upload, possiblyUpload, removeFile, listRemoteFiles, download */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "checkKey", function() { return checkKey; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "resetSyncState", function() { return resetSyncState; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "exportBuffer", function() { return exportBuffer; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "importBuffer", function() { return importBuffer; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "upload", function() { return upload; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "possiblyUpload", function() { return possiblyUpload; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "removeFile", function() { return removeFile; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "listRemoteFiles", function() { return listRemoteFiles; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "download", function() { return download; }); -/* harmony import */ var _platform_server_fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../platform/server/fs */ "./packages/loot-core/src/platform/server/fs/index.electron.js"); -/* harmony import */ var _platform_server_fs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_platform_server_fs__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../platform/server/asyncStorage */ "./packages/loot-core/src/platform/server/asyncStorage/index.electron.js"); -/* harmony import */ var _platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var _platform_server_fetch__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../platform/server/fetch */ "./packages/loot-core/src/platform/server/fetch/index.electron.js"); -/* harmony import */ var _platform_server_fetch__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_platform_server_fetch__WEBPACK_IMPORTED_MODULE_2__); -/* harmony import */ var _shared_months__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../shared/months */ "./packages/loot-core/src/shared/months.js"); -/* harmony import */ var _platform_server_sqlite__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../platform/server/sqlite */ "./packages/loot-core/src/platform/server/sqlite/index.electron.js"); -/* harmony import */ var _prefs__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./prefs */ "./packages/loot-core/src/server/prefs.js"); -/* harmony import */ var _server_config__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./server-config */ "./packages/loot-core/src/server/server-config.js"); -/* harmony import */ var _mutators__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./mutators */ "./packages/loot-core/src/server/mutators.js"); -/* harmony import */ var _errors__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./errors */ "./packages/loot-core/src/server/errors.js"); -/* harmony import */ var _encryption__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./encryption */ "./packages/loot-core/src/server/encryption.js"); -/* harmony import */ var _post__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./post */ "./packages/loot-core/src/server/post.js"); -function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } - -function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } - -function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } - -function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } - -function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_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 _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } - -function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } - -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } - -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; } - - - - - - - - - - - - - -let uuid = __webpack_require__(/*! ../platform/uuid */ "./packages/loot-core/src/platform/uuid/index.electron.js"); - -let AdmZip = __webpack_require__(/*! adm-zip */ "./packages/loot-core/node_modules/adm-zip/adm-zip.js"); - -let UPLOAD_FREQUENCY_IN_DAYS = 7; - -async function checkHTTPStatus(res) { - if (res.status !== 200) { - return res.text().then(str => { - throw new _errors__WEBPACK_IMPORTED_MODULE_8__["HTTPError"](res.status, str); - }); - } else { - return res; - } -} - -async function fetchJSON(...args) { - let res = await Object(_platform_server_fetch__WEBPACK_IMPORTED_MODULE_2__["fetch"])(...args); - res = await checkHTTPStatus(res); - return res.json(); -} - -async function checkKey() { - let userToken = await _platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_1___default.a.getItem('user-token'); - - let _prefs$getPrefs = _prefs__WEBPACK_IMPORTED_MODULE_5__["getPrefs"](), - cloudFileId = _prefs$getPrefs.cloudFileId, - encryptKeyId = _prefs$getPrefs.encryptKeyId; - - let res; - - try { - res = await Object(_post__WEBPACK_IMPORTED_MODULE_10__["post"])(Object(_server_config__WEBPACK_IMPORTED_MODULE_6__["getServer"])().SYNC_SERVER + '/user-get-key', { - token: userToken, - fileId: cloudFileId - }); - } catch (e) { - console.log(e); - return { - error: { - reason: 'network' - } - }; - } // This == comparison is important, they could be null or undefined - // eslint-disable-next-line - - - return { - valid: res.id == encryptKeyId && ( // eslint-disable-line - encryptKeyId == null || _encryption__WEBPACK_IMPORTED_MODULE_9__["default"].hasKey(encryptKeyId)) - }; -} -async function resetSyncState(newKeyState) { - let userToken = await _platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_1___default.a.getItem('user-token'); - - let _prefs$getPrefs2 = _prefs__WEBPACK_IMPORTED_MODULE_5__["getPrefs"](), - cloudFileId = _prefs$getPrefs2.cloudFileId; - - if (process.env.IS_BETA) { - return { - error: { - reason: 'beta-version' - } - }; - } - - try { - await Object(_post__WEBPACK_IMPORTED_MODULE_10__["post"])(Object(_server_config__WEBPACK_IMPORTED_MODULE_6__["getServer"])().SYNC_SERVER + '/reset-user-file', { - token: userToken, - fileId: cloudFileId - }); - } catch (e) { - if (e instanceof _errors__WEBPACK_IMPORTED_MODULE_8__["PostError"]) { - return { - error: { - reason: e.reason === 'unauthorized' ? 'unauthorized' : 'network' - } - }; - } - - return { - error: { - reason: 'internal' - } - }; - } - - if (newKeyState) { - try { - await Object(_post__WEBPACK_IMPORTED_MODULE_10__["post"])(Object(_server_config__WEBPACK_IMPORTED_MODULE_6__["getServer"])().SYNC_SERVER + '/user-create-key', { - token: userToken, - fileId: cloudFileId, - keyId: newKeyState.key.getId(), - keySalt: newKeyState.salt, - testContent: newKeyState.testContent - }); - } catch (e) { - if (e instanceof _errors__WEBPACK_IMPORTED_MODULE_8__["PostError"]) { - return { - error: { - reason: 'network' - } - }; - } - - return { - error: { - reason: 'internal' - } - }; - } - } - - return {}; -} -async function exportBuffer() { - let _prefs$getPrefs3 = _prefs__WEBPACK_IMPORTED_MODULE_5__["getPrefs"](), - id = _prefs$getPrefs3.id, - budgetName = _prefs$getPrefs3.budgetName; - - if (!budgetName) { - return null; - } - - let budgetDir = _platform_server_fs__WEBPACK_IMPORTED_MODULE_0___default.a.getBudgetDir(id); // create zip - - let zipped = new AdmZip(); // We run this in a mutator even though its not mutating anything - // because we are reading the sqlite file from disk. We want to make - // sure that we get a valid snapshot of it so we want this to be - // serialized with all other mutations. - - await Object(_mutators__WEBPACK_IMPORTED_MODULE_7__["runMutator"])(async () => { - let rawDbContent = await _platform_server_fs__WEBPACK_IMPORTED_MODULE_0___default.a.readFile(_platform_server_fs__WEBPACK_IMPORTED_MODULE_0___default.a.join(budgetDir, 'db.sqlite'), 'binary'); // Do some post-processing of the database. We NEVER upload the cache with - // the database; this forces new downloads to always recompute everything - // which is not only safer, but reduces the filesize a lot. - - let memDb = await _platform_server_sqlite__WEBPACK_IMPORTED_MODULE_4__["openDatabase"](rawDbContent); - _platform_server_sqlite__WEBPACK_IMPORTED_MODULE_4__["execQuery"](memDb, ` - DELETE FROM kvcache; - DELETE FROM kvcache_key; - `); - let dbContent = _platform_server_sqlite__WEBPACK_IMPORTED_MODULE_4__["exportDatabase"](memDb); - _platform_server_sqlite__WEBPACK_IMPORTED_MODULE_4__["closeDatabase"](memDb); // mark it as a file that needs a new clock so when a new client - // downloads it, it'll get set to a unique node - - let meta = JSON.parse(await _platform_server_fs__WEBPACK_IMPORTED_MODULE_0___default.a.readFile(_platform_server_fs__WEBPACK_IMPORTED_MODULE_0___default.a.join(budgetDir, 'metadata.json'))); - meta.resetClock = true; - let metaContent = Buffer.from(JSON.stringify(meta), 'utf8'); - zipped.addFile('db.sqlite', dbContent); - zipped.addFile('metadata.json', metaContent); - }); - return Buffer.from(zipped.toBuffer()); -} -async function importBuffer(fileData, buffer) { - let zipped = new AdmZip(buffer); - let entries = zipped.getEntries(); - let dbEntry = entries.find(e => e.entryName.includes('db.sqlite')); - let metaEntry = entries.find(e => e.entryName.includes('metadata.json')); - - if (!dbEntry || !metaEntry) { - throw Object(_errors__WEBPACK_IMPORTED_MODULE_8__["FileDownloadError"])('invalid-zip-file'); - } - - let dbContent = zipped.readFile(dbEntry); - let metaContent = zipped.readFile(metaEntry); - let meta; - - try { - meta = JSON.parse(metaContent.toString('utf8')); - } catch (err) { - throw Object(_errors__WEBPACK_IMPORTED_MODULE_8__["FileDownloadError"])('invalid-meta-file'); - } // Update the metadata. The stored file on the server might be - // out-of-date with a few keys - - - meta = _objectSpread(_objectSpread({}, meta), {}, { - cloudFileId: fileData.fileId, - groupId: fileData.groupId, - lastUploaded: _shared_months__WEBPACK_IMPORTED_MODULE_3__["currentDay"](), - encryptKeyId: fileData.encryptMeta ? fileData.encryptMeta.keyId : null - }); - let budgetDir = _platform_server_fs__WEBPACK_IMPORTED_MODULE_0___default.a.getBudgetDir(meta.id); - - if (await _platform_server_fs__WEBPACK_IMPORTED_MODULE_0___default.a.exists(budgetDir)) { - // Don't remove the directory so that backups are retained - let dbFile = _platform_server_fs__WEBPACK_IMPORTED_MODULE_0___default.a.join(budgetDir, 'db.sqlite'); - let metaFile = _platform_server_fs__WEBPACK_IMPORTED_MODULE_0___default.a.join(budgetDir, 'metadata.json'); - - if (await _platform_server_fs__WEBPACK_IMPORTED_MODULE_0___default.a.exists(dbFile)) { - await _platform_server_fs__WEBPACK_IMPORTED_MODULE_0___default.a.removeFile(dbFile); - } - - if (await _platform_server_fs__WEBPACK_IMPORTED_MODULE_0___default.a.exists(metaFile)) { - await _platform_server_fs__WEBPACK_IMPORTED_MODULE_0___default.a.removeFile(metaFile); - } - } else { - await _platform_server_fs__WEBPACK_IMPORTED_MODULE_0___default.a.mkdir(budgetDir); - } - - await _platform_server_fs__WEBPACK_IMPORTED_MODULE_0___default.a.writeFile(_platform_server_fs__WEBPACK_IMPORTED_MODULE_0___default.a.join(budgetDir, 'db.sqlite'), dbContent); - await _platform_server_fs__WEBPACK_IMPORTED_MODULE_0___default.a.writeFile(_platform_server_fs__WEBPACK_IMPORTED_MODULE_0___default.a.join(budgetDir, 'metadata.json'), JSON.stringify(meta)); - return { - id: meta.id - }; -} -async function upload() { - let userToken = await _platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_1___default.a.getItem('user-token'); - - if (!userToken) { - throw Object(_errors__WEBPACK_IMPORTED_MODULE_8__["FileUploadError"])('unauthorized'); - } // We never change the server from the beta version - - - if (process.env.IS_BETA) { - throw Object(_errors__WEBPACK_IMPORTED_MODULE_8__["FileUploadError"])('beta-version'); - } - - let zipContent = await exportBuffer(); - - if (zipContent == null) { - return; - } - - let _prefs$getPrefs4 = _prefs__WEBPACK_IMPORTED_MODULE_5__["getPrefs"](), - id = _prefs$getPrefs4.id, - groupId = _prefs$getPrefs4.groupId, - budgetName = _prefs$getPrefs4.budgetName, - cloudFileId = _prefs$getPrefs4.cloudFileId, - encryptKeyId = _prefs$getPrefs4.encryptKeyId; - - let uploadContent = zipContent; - let uploadMeta = null; // The upload process encrypts with the key tagged in the prefs for - // the file. It will upload the file and the server is responsible - // for checking that the key is up-to-date and rejecting it if not - - if (encryptKeyId) { - let encrypted; - - try { - encrypted = await _encryption__WEBPACK_IMPORTED_MODULE_9__["default"].encrypt(zipContent, encryptKeyId); - } catch (e) { - throw Object(_errors__WEBPACK_IMPORTED_MODULE_8__["FileUploadError"])('encrypt-failure', { - isMissingKey: e.message === 'missing-key' - }); - } - - uploadContent = encrypted.value; - uploadMeta = encrypted.meta; - } - - if (!cloudFileId) { - cloudFileId = uuid.v4Sync(); - } - - let res; - - try { - res = await fetchJSON(Object(_server_config__WEBPACK_IMPORTED_MODULE_6__["getServer"])().SYNC_SERVER + '/upload-user-file', { - method: 'POST', - headers: _objectSpread(_objectSpread({ - 'Content-Length': uploadContent.length, - 'Content-Type': 'application/encrypted-file', - 'X-ACTUAL-TOKEN': userToken, - 'X-ACTUAL-FILE-ID': cloudFileId, - 'X-ACTUAL-NAME': encodeURIComponent(budgetName), - 'X-ACTUAL-FORMAT': 2 - }, uploadMeta ? { - 'X-ACTUAL-ENCRYPT-META': JSON.stringify(uploadMeta) - } : null), groupId ? { - 'X-ACTUAL-GROUP-ID': groupId - } : null), - body: uploadContent - }); - } catch (err) { - console.log('Upload failure', err); - let reason = err instanceof _errors__WEBPACK_IMPORTED_MODULE_8__["PostError"] ? err.reason : 'network'; - - if (err instanceof _errors__WEBPACK_IMPORTED_MODULE_8__["PostError"]) { - throw new _errors__WEBPACK_IMPORTED_MODULE_8__["FileUploadError"](err.reason === 'unauthorized' ? 'unauthorized' : err.reason || 'network'); - } - - throw Object(_errors__WEBPACK_IMPORTED_MODULE_8__["FileUploadError"])('internal'); - } - - if (res.status === 'ok') { - // Only save it if we are still working on the same file - if (_prefs__WEBPACK_IMPORTED_MODULE_5__["getPrefs"]() && _prefs__WEBPACK_IMPORTED_MODULE_5__["getPrefs"]().id === id) { - await _prefs__WEBPACK_IMPORTED_MODULE_5__["savePrefs"]({ - lastUploaded: _shared_months__WEBPACK_IMPORTED_MODULE_3__["currentDay"](), - cloudFileId, - groupId: res.groupId - }); - } - } else { - throw Object(_errors__WEBPACK_IMPORTED_MODULE_8__["FileUploadError"])('internal'); - } -} -async function possiblyUpload() { - let _prefs$getPrefs5 = _prefs__WEBPACK_IMPORTED_MODULE_5__["getPrefs"](), - cloudFileId = _prefs$getPrefs5.cloudFileId, - groupId = _prefs$getPrefs5.groupId, - lastUploaded = _prefs$getPrefs5.lastUploaded, - id = _prefs$getPrefs5.id; - - let threshold = lastUploaded && _shared_months__WEBPACK_IMPORTED_MODULE_3__["addDays"](lastUploaded, UPLOAD_FREQUENCY_IN_DAYS); - let currentDay = _shared_months__WEBPACK_IMPORTED_MODULE_3__["currentDay"](); // We only want to try to upload every UPLOAD_FREQUENCY_IN_DAYS days - - if (lastUploaded && currentDay < threshold) { - return; - } // We only want to upload existing cloud files that are part of a - // valid group - - - if (!cloudFileId || !groupId) { - return; - } // Don't block on uploading - - - upload().catch(err => {}); -} -async function removeFile(fileId) { - const _await$asyncStorage$m = await _platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_1___default.a.multiGet(['user-token']), - _await$asyncStorage$m2 = _slicedToArray(_await$asyncStorage$m, 1), - _await$asyncStorage$m3 = _slicedToArray(_await$asyncStorage$m2[0], 2), - userToken = _await$asyncStorage$m3[1]; - - await Object(_post__WEBPACK_IMPORTED_MODULE_10__["post"])(Object(_server_config__WEBPACK_IMPORTED_MODULE_6__["getServer"])().SYNC_SERVER + '/delete-user-file', { - token: userToken, - fileId - }); -} -async function listRemoteFiles() { - let userToken = await _platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_1___default.a.getItem('user-token'); - - if (!userToken) { - return null; - } - - let res; - - try { - res = await fetchJSON(Object(_server_config__WEBPACK_IMPORTED_MODULE_6__["getServer"])().SYNC_SERVER + '/list-user-files', { - headers: { - 'X-ACTUAL-TOKEN': userToken - } - }); - } catch (e) { - console.log('Error', e); - return null; - } - - if (res.status === 'error') { - return null; - } - - return res.data.map(file => _objectSpread(_objectSpread({}, file), {}, { - hasKey: _encryption__WEBPACK_IMPORTED_MODULE_9__["default"].hasKey(file.encryptKeyId) - })); -} -async function download(fileId, replace) { - let userToken = await _platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_1___default.a.getItem('user-token'); - let buffer; - - try { - buffer = await Object(_platform_server_fetch__WEBPACK_IMPORTED_MODULE_2__["fetch"])(Object(_server_config__WEBPACK_IMPORTED_MODULE_6__["getServer"])().SYNC_SERVER + '/download-user-file', { - headers: { - 'X-ACTUAL-TOKEN': userToken, - 'X-ACTUAL-FILE-ID': fileId - } - }).then(checkHTTPStatus).then(res => { - if (res.arrayBuffer) { - return res.arrayBuffer().then(ab => Buffer.from(ab)); - } - - return res.buffer(); - }); - } catch (err) { - console.log('Download failure', err); - throw Object(_errors__WEBPACK_IMPORTED_MODULE_8__["FileDownloadError"])('download-failure'); - } - - let res; - - try { - res = await fetchJSON(Object(_server_config__WEBPACK_IMPORTED_MODULE_6__["getServer"])().SYNC_SERVER + '/get-user-file-info', { - headers: { - 'X-ACTUAL-TOKEN': userToken, - 'X-ACTUAL-FILE-ID': fileId - } - }); - } catch (err) { - throw Object(_errors__WEBPACK_IMPORTED_MODULE_8__["FileDownloadError"])('internal', { - fileId - }); - } - - if (res.status !== 'ok') { - throw Object(_errors__WEBPACK_IMPORTED_MODULE_8__["FileDownloadError"])('internal', { - fileId - }); - } - - let fileData = res.data; // The download process checks if the server gave us decrypt - // information. It is assumed that this key has already been loaded - // in, which is done in a previous step - - if (fileData.encryptMeta) { - try { - buffer = await _encryption__WEBPACK_IMPORTED_MODULE_9__["default"].decrypt(buffer, fileData.encryptMeta); - } catch (e) { - throw Object(_errors__WEBPACK_IMPORTED_MODULE_8__["FileDownloadError"])('decrypt-failure', { - isMissingKey: e.message === 'missing-key' - }); - } - } - - return importBuffer(fileData, buffer, replace); -} - -/***/ }), - -/***/ "./packages/loot-core/src/server/db/index.js": -/*!***************************************************!*\ - !*** ./packages/loot-core/src/server/db/index.js ***! - \***************************************************/ -/*! exports provided: toDateRepr, fromDateRepr, getDatabasePath, openDatabase, reopenDatabase, closeDatabase, setDatabase, getDatabase, loadClock, runQuery, execQuery, cache, transaction, asyncTransaction, all, first, firstSync, run, select, update, insertWithUUID, insert, delete_, selectWithSchema, selectFirstWithSchema, insertWithSchema, updateWithSchema, getCategories, getCategoriesGrouped, insertCategoryGroup, updateCategoryGroup, moveCategoryGroup, deleteCategoryGroup, insertCategory, updateCategory, moveCategory, deleteCategory, getPayee, insertPayee, deletePayee, deleteTransferPayee, updatePayee, mergePayees, getPayees, getOrphanedPayees, getPayeeByName, insertPayeeRule, deletePayeeRule, updatePayeeRule, getPayeeRules, getAccounts, insertAccount, updateAccount, deleteAccount, moveAccount, getTransaction, getTransactionsByDate, getTransactions, insertTransaction, updateTransaction, deleteTransaction */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getDatabasePath", function() { return getDatabasePath; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "openDatabase", function() { return openDatabase; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "reopenDatabase", function() { return reopenDatabase; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "closeDatabase", function() { return closeDatabase; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setDatabase", function() { return setDatabase; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getDatabase", function() { return getDatabase; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "loadClock", function() { return loadClock; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "runQuery", function() { return runQuery; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "execQuery", function() { return execQuery; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "cache", function() { return cache; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "transaction", function() { return transaction; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "asyncTransaction", function() { return asyncTransaction; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "all", function() { return all; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "first", function() { return first; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "firstSync", function() { return firstSync; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "run", function() { return run; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "select", function() { return select; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "update", function() { return update; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "insertWithUUID", function() { return insertWithUUID; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "insert", function() { return insert; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "delete_", function() { return delete_; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "selectWithSchema", function() { return selectWithSchema; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "selectFirstWithSchema", function() { return selectFirstWithSchema; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "insertWithSchema", function() { return insertWithSchema; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "updateWithSchema", function() { return updateWithSchema; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getCategories", function() { return getCategories; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getCategoriesGrouped", function() { return getCategoriesGrouped; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "insertCategoryGroup", function() { return insertCategoryGroup; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "updateCategoryGroup", function() { return updateCategoryGroup; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "moveCategoryGroup", function() { return moveCategoryGroup; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "deleteCategoryGroup", function() { return deleteCategoryGroup; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "insertCategory", function() { return insertCategory; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "updateCategory", function() { return updateCategory; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "moveCategory", function() { return moveCategory; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "deleteCategory", function() { return deleteCategory; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getPayee", function() { return getPayee; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "insertPayee", function() { return insertPayee; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "deletePayee", function() { return deletePayee; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "deleteTransferPayee", function() { return deleteTransferPayee; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "updatePayee", function() { return updatePayee; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "mergePayees", function() { return mergePayees; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getPayees", function() { return getPayees; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getOrphanedPayees", function() { return getOrphanedPayees; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getPayeeByName", function() { return getPayeeByName; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "insertPayeeRule", function() { return insertPayeeRule; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "deletePayeeRule", function() { return deletePayeeRule; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "updatePayeeRule", function() { return updatePayeeRule; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getPayeeRules", function() { return getPayeeRules; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getAccounts", function() { return getAccounts; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "insertAccount", function() { return insertAccount; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "updateAccount", function() { return updateAccount; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "deleteAccount", function() { return deleteAccount; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "moveAccount", function() { return moveAccount; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getTransaction", function() { return getTransaction; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getTransactionsByDate", function() { return getTransactionsByDate; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getTransactions", function() { return getTransactions; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "insertTransaction", function() { return insertTransaction; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "updateTransaction", function() { return updateTransaction; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "deleteTransaction", function() { return deleteTransaction; }); -/* harmony import */ var lru_cache__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lru-cache */ "./node_modules/lru-cache/index.js"); -/* harmony import */ var lru_cache__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lru_cache__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _platform_server_sqlite__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../platform/server/sqlite */ "./packages/loot-core/src/platform/server/sqlite/index.electron.js"); -/* harmony import */ var _platform_server_fs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../platform/server/fs */ "./packages/loot-core/src/platform/server/fs/index.electron.js"); -/* harmony import */ var _platform_server_fs__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_platform_server_fs__WEBPACK_IMPORTED_MODULE_2__); -/* harmony import */ var _sync__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../sync */ "./packages/loot-core/src/server/sync/index.js"); -/* harmony import */ var _aql_schema__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../aql/schema */ "./packages/loot-core/src/server/aql/schema/index.js"); -/* harmony import */ var _models__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../models */ "./packages/loot-core/src/server/models.js"); -/* harmony import */ var _shared_util__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../shared/util */ "./packages/loot-core/src/shared/util.js"); -/* harmony import */ var _timestamp__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../timestamp */ "./packages/loot-core/src/server/timestamp.js"); -/* harmony import */ var _aql_schema_helpers__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../aql/schema-helpers */ "./packages/loot-core/src/server/aql/schema-helpers.js"); -/* harmony import */ var _sort__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./sort */ "./packages/loot-core/src/server/db/sort.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "toDateRepr", function() { return _models__WEBPACK_IMPORTED_MODULE_5__["toDateRepr"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "fromDateRepr", function() { return _models__WEBPACK_IMPORTED_MODULE_5__["fromDateRepr"]; }); - -function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } - -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } - -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; } - - - - - - - - - - - - - -const uuid = __webpack_require__(/*! ../../platform/uuid */ "./packages/loot-core/src/platform/uuid/index.electron.js"); - -let dbPath; -let db; // Util - -function getDatabasePath() { - return dbPath; -} -async function openDatabase(id) { - if (db) { - await _platform_server_sqlite__WEBPACK_IMPORTED_MODULE_1__["closeDatabase"](db); - } - - dbPath = _platform_server_fs__WEBPACK_IMPORTED_MODULE_2___default.a.join(_platform_server_fs__WEBPACK_IMPORTED_MODULE_2___default.a.getBudgetDir(id), 'db.sqlite'); - setDatabase(await _platform_server_sqlite__WEBPACK_IMPORTED_MODULE_1__["openDatabase"](dbPath)); // await execQuery('PRAGMA journal_mode = WAL'); -} -async function reopenDatabase() { - await _platform_server_sqlite__WEBPACK_IMPORTED_MODULE_1__["closeDatabase"](db); - setDatabase(await _platform_server_sqlite__WEBPACK_IMPORTED_MODULE_1__["openDatabase"](dbPath)); -} -async function closeDatabase() { - if (db) { - await _platform_server_sqlite__WEBPACK_IMPORTED_MODULE_1__["closeDatabase"](db); - setDatabase(null); - } -} -function setDatabase(db_) { - db = db_; - resetQueryCache(); -} -function getDatabase() { - return db; -} -async function loadClock() { - let row = await first('SELECT * FROM messages_clock'); - - if (row) { - let clock = Object(_timestamp__WEBPACK_IMPORTED_MODULE_7__["deserializeClock"])(row.clock); - Object(_timestamp__WEBPACK_IMPORTED_MODULE_7__["setClock"])(clock); - } else { - // No clock exists yet (first run of the app), so create a default - // one. - let timestamp = new _timestamp__WEBPACK_IMPORTED_MODULE_7__["default"](0, 0, Object(_timestamp__WEBPACK_IMPORTED_MODULE_7__["makeClientId"])()); - let clock = Object(_timestamp__WEBPACK_IMPORTED_MODULE_7__["makeClock"])(timestamp); - Object(_timestamp__WEBPACK_IMPORTED_MODULE_7__["setClock"])(clock); - await runQuery('INSERT INTO messages_clock (id, clock) VALUES (?, ?)', [1, Object(_timestamp__WEBPACK_IMPORTED_MODULE_7__["serializeClock"])(clock)]); - } -} // Functions - -function runQuery(sql, params, fetchAll) { - // const unrecord = perf.record('sqlite'); - const result = _platform_server_sqlite__WEBPACK_IMPORTED_MODULE_1__["runQuery"](db, sql, params, fetchAll); // unrecord(); - - return result; -} -function execQuery(sql) { - _platform_server_sqlite__WEBPACK_IMPORTED_MODULE_1__["execQuery"](db, sql); -} // This manages an LRU cache of prepared query statements. This is -// only needed in hot spots when you are running lots of queries. - -let _queryCache = new lru_cache__WEBPACK_IMPORTED_MODULE_0___default.a({ - max: 100 -}); - -function cache(sql) { - let cached = _queryCache.get(sql); - - if (cached) { - return cached; - } - - let prepared = _platform_server_sqlite__WEBPACK_IMPORTED_MODULE_1__["prepare"](db, sql); - - _queryCache.set(sql, prepared); - - return prepared; -} - -function resetQueryCache() { - _queryCache = new lru_cache__WEBPACK_IMPORTED_MODULE_0___default.a({ - max: 100 - }); -} - -function transaction(fn) { - return _platform_server_sqlite__WEBPACK_IMPORTED_MODULE_1__["transaction"](db, fn); -} -function asyncTransaction(fn) { - return _platform_server_sqlite__WEBPACK_IMPORTED_MODULE_1__["asyncTransaction"](db, fn); -} // This function is marked as async because `runQuery` is no longer -// async. We return a promise here until we've audited all the code to -// make sure nothing calls `.then` on this. - -async function all(sql, params) { - return runQuery(sql, params, true); -} -async function first(sql, params) { - const arr = await runQuery(sql, params, true); - return arr.length === 0 ? null : arr[0]; -} // The underlying sql system is now sync, but we can't update `first` yet -// without auditing all uses of it - -function firstSync(sql, params) { - const arr = runQuery(sql, params, true); - return arr.length === 0 ? null : arr[0]; -} // This function is marked as async because `runQuery` is no longer -// async. We return a promise here until we've audited all the code to -// make sure nothing calls `.then` on this. - -async function run(sql, params) { - return runQuery(sql, params); -} -async function select(table, id) { - const rows = await runQuery('SELECT * FROM ' + table + ' WHERE id = ?', [id], true); - return rows[0]; -} -async function update(table, params) { - let fields = Object.keys(params).filter(k => k !== 'id'); - - if (params.id == null) { - throw new Error('update: id is required'); - } - - await Object(_sync__WEBPACK_IMPORTED_MODULE_3__["sendMessages"])(fields.map(k => { - return { - dataset: table, - row: params.id, - column: k, - value: params[k], - timestamp: _timestamp__WEBPACK_IMPORTED_MODULE_7__["default"].send() - }; - })); -} -async function insertWithUUID(table, row) { - if (!row.id) { - row = _objectSpread(_objectSpread({}, row), {}, { - id: uuid.v4Sync() - }); - } - - await insert(table, row); // We can't rely on the return value of insert because if the - // primary key is text, sqlite returns the internal row id which we - // don't care about. We want to return the generated UUID. - - return row.id; -} -async function insert(table, row) { - let fields = Object.keys(row).filter(k => k !== 'id'); - - if (row.id == null) { - throw new Error('insert: id is required'); - } - - await Object(_sync__WEBPACK_IMPORTED_MODULE_3__["sendMessages"])(fields.map(k => { - return { - dataset: table, - row: row.id, - column: k, - value: row[k], - timestamp: _timestamp__WEBPACK_IMPORTED_MODULE_7__["default"].send() - }; - })); -} -async function delete_(table, id) { - await Object(_sync__WEBPACK_IMPORTED_MODULE_3__["sendMessages"])([{ - dataset: table, - row: id, - column: 'tombstone', - value: 1, - timestamp: _timestamp__WEBPACK_IMPORTED_MODULE_7__["default"].send() - }]); -} -async function selectWithSchema(table, sql, params) { - let rows = await runQuery(sql, params, true); - return rows.map(row => Object(_aql_schema_helpers__WEBPACK_IMPORTED_MODULE_8__["convertFromSelect"])(_aql_schema__WEBPACK_IMPORTED_MODULE_4__["schema"], _aql_schema__WEBPACK_IMPORTED_MODULE_4__["schemaConfig"], table, row)).filter(Boolean); -} -async function selectFirstWithSchema(table, sql, params) { - let rows = await selectWithSchema(table, sql, params); - return rows.length > 0 ? rows[0] : null; -} -function insertWithSchema(table, row) { - // Even though `insertWithUUID` does this, we need to do it here so - // the schema validation passes - if (!row.id) { - row = _objectSpread(_objectSpread({}, row), {}, { - id: uuid.v4Sync() - }); - } - - return insertWithUUID(table, Object(_aql_schema_helpers__WEBPACK_IMPORTED_MODULE_8__["convertForInsert"])(_aql_schema__WEBPACK_IMPORTED_MODULE_4__["schema"], _aql_schema__WEBPACK_IMPORTED_MODULE_4__["schemaConfig"], table, row)); -} -function updateWithSchema(table, fields) { - return update(table, Object(_aql_schema_helpers__WEBPACK_IMPORTED_MODULE_8__["convertForUpdate"])(_aql_schema__WEBPACK_IMPORTED_MODULE_4__["schema"], _aql_schema__WEBPACK_IMPORTED_MODULE_4__["schemaConfig"], table, fields)); -} // Data-specific functions. Ideally this would be split up into -// different files - -async function getCategories() { - return all(` - SELECT c.* FROM categories c - LEFT JOIN category_groups cg ON c.cat_group = cg.id - WHERE c.tombstone = 0 - ORDER BY cg.sort_order, cg.id, c.sort_order, c.id - `); -} -async function getCategoriesGrouped() { - const groups = await all('SELECT * FROM category_groups WHERE tombstone = 0 ORDER BY is_income, sort_order, id'); - const rows = await all(` - SELECT * FROM categories WHERE tombstone = 0 - ORDER BY sort_order, id - `); - return groups.map(group => { - return _objectSpread(_objectSpread({}, group), {}, { - categories: rows.filter(row => row.cat_group === group.id) - }); - }); -} -async function insertCategoryGroup(group) { - const lastGroup = await first(` - SELECT sort_order FROM category_groups WHERE tombstone = 0 ORDER BY sort_order DESC, id DESC LIMIT 1 - `); - const sort_order = (lastGroup ? lastGroup.sort_order : 0) + _sort__WEBPACK_IMPORTED_MODULE_9__["SORT_INCREMENT"]; - group = _objectSpread(_objectSpread({}, _models__WEBPACK_IMPORTED_MODULE_5__["categoryGroupModel"].validate(group)), {}, { - sort_order: sort_order - }); - return insertWithUUID('category_groups', group); -} -function updateCategoryGroup(group) { - group = _models__WEBPACK_IMPORTED_MODULE_5__["categoryGroupModel"].validate(group, { - update: true - }); - return update('category_groups', group); -} -async function moveCategoryGroup(id, targetId) { - const groups = await all(`SELECT id, sort_order FROM category_groups WHERE tombstone = 0 ORDER BY sort_order, id`); - - const _shoveSortOrders = Object(_sort__WEBPACK_IMPORTED_MODULE_9__["shoveSortOrders"])(groups, targetId), - updates = _shoveSortOrders.updates, - sort_order = _shoveSortOrders.sort_order; - - for (let info of updates) { - await update('category_groups', info); - } - - await update('category_groups', { - id, - sort_order - }); -} -async function deleteCategoryGroup(group, transferId) { - const categories = await all('SELECT * FROM categories WHERE cat_group = ?', [group.id]); // Delete all the categories within a group - - await Promise.all(categories.map(cat => deleteCategory(cat, transferId))); - await delete_('category_groups', group.id); -} -async function insertCategory(category, { - atEnd -} = {}) { - let sort_order; - let id_; - await Object(_sync__WEBPACK_IMPORTED_MODULE_3__["batchMessages"])(async () => { - if (atEnd) { - const lastCat = await first(` - SELECT sort_order FROM categories WHERE tombstone = 0 ORDER BY sort_order DESC, id DESC LIMIT 1 - `); - sort_order = (lastCat ? lastCat.sort_order : 0) + _sort__WEBPACK_IMPORTED_MODULE_9__["SORT_INCREMENT"]; - } else { - // Unfortunately since we insert at the beginning, we need to shove - // the sort orders to make sure there's room for it - const categories = await all(`SELECT id, sort_order FROM categories WHERE cat_group = ? AND tombstone = 0 ORDER BY sort_order, id`, [category.cat_group]); - - const _shoveSortOrders2 = Object(_sort__WEBPACK_IMPORTED_MODULE_9__["shoveSortOrders"])(categories, categories.length > 0 ? categories[0].id : null), - updates = _shoveSortOrders2.updates, - order = _shoveSortOrders2.sort_order; - - for (let info of updates) { - await update('categories', info); - } - - sort_order = order; - } - - category = _objectSpread(_objectSpread({}, _models__WEBPACK_IMPORTED_MODULE_5__["categoryModel"].validate(category)), {}, { - sort_order: sort_order - }); - const id = await insertWithUUID('categories', category); // Create an entry in the mapping table that points it to itself - - await insert('category_mapping', { - id, - transferId: id - }); - id_ = id; - }); - return id_; -} -function updateCategory(category) { - category = _models__WEBPACK_IMPORTED_MODULE_5__["categoryModel"].validate(category, { - update: true - }); - return update('categories', category); -} -async function moveCategory(id, groupId, targetId) { - if (!groupId) { - throw new Error('moveCategory: groupId is required'); - } - - const categories = await all(`SELECT id, sort_order FROM categories WHERE cat_group = ? AND tombstone = 0 ORDER BY sort_order, id`, [groupId]); - - const _shoveSortOrders3 = Object(_sort__WEBPACK_IMPORTED_MODULE_9__["shoveSortOrders"])(categories, targetId), - updates = _shoveSortOrders3.updates, - sort_order = _shoveSortOrders3.sort_order; - - for (let info of updates) { - await update('categories', info); - } - - await update('categories', { - id, - sort_order, - cat_group: groupId - }); -} -async function deleteCategory(category, transferId) { - if (transferId) { - // We need to update all the deleted categories that currently - // point to the one we're about to delete so they all are - // "forwarded" to the new transferred category. - const existingTransfers = await all('SELECT * FROM category_mapping WHERE transferId = ?', [category.id]); - - for (let mapping of existingTransfers) { - await update('category_mapping', { - id: mapping.id, - transferId - }); - } // Finally, map the category we're about to delete to the new one - - - await update('category_mapping', { - id: category.id, - transferId - }); - } - - return delete_('categories', category.id); -} -async function getPayee(id) { - return first(`SELECT * FROM payees WHERE id = ?`, [id]); -} -async function insertPayee(payee) { - payee = _models__WEBPACK_IMPORTED_MODULE_5__["payeeModel"].validate(payee); - let id; - await Object(_sync__WEBPACK_IMPORTED_MODULE_3__["batchMessages"])(async () => { - id = await insertWithUUID('payees', payee); - await insert('payee_mapping', { - id, - targetId: id - }); - }); - return id; -} -async function deletePayee(payee) { - let _await$first = await first('SELECT * FROM payees WHERE id = ?', [payee.id]), - transfer_acct = _await$first.transfer_acct; - - if (transfer_acct) { - // You should never be able to delete transfer payees - return; - } // let mappings = await all('SELECT id FROM payee_mapping WHERE targetId = ?', [ - // payee.id - // ]); - // await Promise.all( - // mappings.map(m => update('payee_mapping', { id: m.id, targetId: null })) - // ); - - - let rules = await all('SELECT * FROM payee_rules WHERE payee_id = ?', [payee.id]); - await Promise.all(rules.map(rule => deletePayeeRule({ - id: rule.id - }))); - return delete_('payees', payee.id); -} -async function deleteTransferPayee(payee) { - // This allows deleting transfer payees - return delete_('payees', payee.id); -} -function updatePayee(payee) { - payee = _models__WEBPACK_IMPORTED_MODULE_5__["payeeModel"].validate(payee, { - update: true - }); - return update('payees', payee); -} -async function mergePayees(target, ids) { - // Load in payees so we can check some stuff - let payees = Object(_shared_util__WEBPACK_IMPORTED_MODULE_6__["groupById"])(await all('SELECT * FROM payees')); // Filter out any transfer payees - - if (payees[target].transfer_acct != null) { - return; - } - - ids = ids.filter(id => payees[id].transfer_acct == null); - await Object(_sync__WEBPACK_IMPORTED_MODULE_3__["batchMessages"])(async () => { - await Promise.all(ids.map(async id => { - let mappings = await all('SELECT id FROM payee_mapping WHERE targetId = ?', [id]); - await Promise.all(mappings.map(m => update('payee_mapping', { - id: m.id, - targetId: target - }))); - })); - return Promise.all(ids.map(id => Promise.all([update('payee_mapping', { - id, - targetId: target - }), delete_('payees', id)]))); - }); -} -function getPayees() { - return all(` - SELECT p.*, COALESCE(a.name, p.name) AS name FROM payees p - LEFT JOIN accounts a ON (p.transfer_acct = a.id AND a.tombstone = 0) - WHERE p.tombstone = 0 AND (p.transfer_acct IS NULL OR a.id IS NOT NULL) - ORDER BY p.transfer_acct IS NULL DESC, p.name COLLATE NOCASE - `); -} -async function getOrphanedPayees() { - let rows = await all(` - SELECT p.id FROM payees p - LEFT JOIN payee_mapping pm ON pm.id = p.id - LEFT JOIN v_transactions_internal_alive t ON t.payee = pm.targetId - WHERE p.tombstone = 0 AND p.transfer_acct IS NULL AND t.id IS NULL - `); - return rows.map(row => row.id); -} -async function getPayeeByName(name) { - return first(`SELECT * FROM payees WHERE LOWER(name) = ? AND tombstone = 0`, [name.toLowerCase()]); -} -function insertPayeeRule(rule) { - rule = _models__WEBPACK_IMPORTED_MODULE_5__["payeeRuleModel"].validate(rule); - return insertWithUUID('payee_rules', rule); -} -function deletePayeeRule(rule) { - return delete_('payee_rules', rule.id); -} -function updatePayeeRule(rule) { - rule = _models__WEBPACK_IMPORTED_MODULE_5__["payeeModel"].validate(rule, { - update: true - }); - return update('payee_rules', rule); -} -function getPayeeRules(id) { - return all(`SELECT pr.* FROM payee_rules pr - LEFT JOIN payee_mapping pm ON pm.id = pr.payee_id - WHERE pm.targetId = ? AND pr.tombstone = 0`, [id]); -} -function getAccounts() { - return all(`SELECT a.*, b.name as bankName, b.id as bankId FROM accounts a - LEFT JOIN banks b ON a.bank = b.id - WHERE a.tombstone = 0 - ORDER BY sort_order, name`); -} -async function insertAccount(account) { - // Default to checking. Makes it a lot easier for tests and is - // generally harmless. - if (account.type === undefined) { - account = _objectSpread(_objectSpread({}, account), {}, { - type: 'checking' - }); - } - - const accounts = await all('SELECT * FROM accounts WHERE offbudget = ? ORDER BY sort_order, name', [account.offbudget != null ? account.offbudget : 0]); // Don't pass a target in, it will default to appending at the end - - let _shoveSortOrders4 = Object(_sort__WEBPACK_IMPORTED_MODULE_9__["shoveSortOrders"])(accounts), - sort_order = _shoveSortOrders4.sort_order; - - account = _models__WEBPACK_IMPORTED_MODULE_5__["accountModel"].validate(_objectSpread(_objectSpread({}, account), {}, { - sort_order - })); - return insertWithUUID('accounts', account); -} -function updateAccount(account) { - account = _models__WEBPACK_IMPORTED_MODULE_5__["accountModel"].validate(account, { - update: true - }); - return update('accounts', account); -} -function deleteAccount(account) { - return delete_('accounts', account.id); -} -async function moveAccount(id, targetId) { - let account = await first('SELECT * FROM accounts WHERE id = ?', [id]); - let accounts; - - if (account.closed) { - accounts = await all(`SELECT id, sort_order FROM accounts WHERE closed = 1 ORDER BY sort_order, name`); - } else { - accounts = await all(`SELECT id, sort_order FROM accounts WHERE tombstone = 0 AND offbudget = ? ORDER BY sort_order, name`, [account.offbudget]); - } - - const _shoveSortOrders5 = Object(_sort__WEBPACK_IMPORTED_MODULE_9__["shoveSortOrders"])(accounts, targetId), - updates = _shoveSortOrders5.updates, - sort_order = _shoveSortOrders5.sort_order; - - await Object(_sync__WEBPACK_IMPORTED_MODULE_3__["batchMessages"])(() => { - for (let info of updates) { - update('accounts', info); - } - - update('accounts', { - id, - sort_order - }); - }); -} -async function getTransaction(id) { - let rows = await selectWithSchema('transactions', 'SELECT * FROM v_transactions WHERE id = ?', [id]); - return rows[0]; -} - -function _addFragmentForAccount(accountId, addWhere, options = {}) { - let _options$showClosed = options.showClosed, - showClosed = _options$showClosed === void 0 ? false : _options$showClosed, - _options$showOffbudge = options.showOffbudget, - showOffbudget = _options$showOffbudge === void 0 ? true : _options$showOffbudge; - let fragment = addWhere ? ' WHERE (' : ' AND '; - let params = []; - - if (accountId) { - if (accountId === 'offbudget') { - fragment += 'a.closed = 0 AND a.offbudget = 1 '; - } else if (accountId === 'budgeted') { - fragment += 'a.closed = 0 AND a.offbudget = 0 '; - } else if (accountId === 'uncategorized') { - fragment += ` - t.category IS NULL AND a.offbudget = 0 AND isParent = 0 AND ( - ta.offbudget IS NULL OR ta.offbudget = 1 - ) - `; - } else { - fragment += 'a.id = ? '; - params.push(accountId); - } - } else { - fragment += showClosed ? '1' : 'a.closed = 0'; - - if (!showOffbudget) { - fragment += ' AND a.offbudget = 0'; - } - } - - return { - fragment, - params - }; -} - -async function getTransactionsByDate(accountId, startDate, endDate, options = {}) { - throw new Error('`getTransactionsByDate` is deprecated'); -} -async function getTransactions(accountId, arg2) { - if (arg2 !== undefined) { - throw new Error('`getTransactions` was given a second argument, it now only takes a single argument `accountId`'); - } - - return selectWithSchema('transactions', 'SELECT * FROM v_transactions WHERE account = ?', [accountId]); -} -function insertTransaction(transaction) { - return insertWithSchema('transactions', transaction); -} -function updateTransaction(transaction) { - return updateWithSchema('transactions', transaction); -} -async function deleteTransaction(transaction) { - return delete_('transactions', transaction.id); -} - -/***/ }), - -/***/ "./packages/loot-core/src/server/db/mappings.js": -/*!******************************************************!*\ - !*** ./packages/loot-core/src/server/db/mappings.js ***! - \******************************************************/ -/*! exports provided: loadMappings, getMappings, getMapping */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "loadMappings", function() { return loadMappings; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getMappings", function() { return getMappings; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getMapping", function() { return getMapping; }); -/* harmony import */ var _index__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./index */ "./packages/loot-core/src/server/db/index.js"); -/* harmony import */ var _sync_index__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../sync/index */ "./packages/loot-core/src/server/sync/index.js"); - - // This file keeps all the mappings in memory so we can access it -// synchronously. This is primarily used in the rules system, but -// there may be other uses in the future. You don't need to worry -// about this generally; if you are querying transactions, ids are -// transparently mapped for you. But if you are building something -// that stores ids and later uses them, you need to remember to map -// the ids. -// -// IMPORTANT: `loadMappings` must be called first before other modules -// that listen for sync changes. This must be the first sync listener -// to run in case other listeners use this mapping table; otherwise -// they might see stale mappings. - -let allMappings; -let unlistenSync; -async function loadMappings() { - // The mappings are separated into tables specific to the type of - // data. But you know, we really could keep a global mapping table. - let categories = (await _index__WEBPACK_IMPORTED_MODULE_0__["all"]('SELECT * FROM category_mapping')).map(r => [r.id, r.transferId]); - let payees = (await _index__WEBPACK_IMPORTED_MODULE_0__["all"]('SELECT * FROM payee_mapping')).map(r => [r.id, r.targetId]); // All ids are unique, so we can just keep a global table of mappings - - allMappings = new Map(categories.concat(payees)); - - if (unlistenSync) { - unlistenSync(); - } - - unlistenSync = Object(_sync_index__WEBPACK_IMPORTED_MODULE_1__["addSyncListener"])(onApplySync); -} - -function onApplySync(oldValues, newValues) { - newValues.forEach((items, table) => { - if (table.indexOf('mapping') !== -1) { - let field = table === 'category_mapping' ? 'transferId' : 'targetId'; - items.forEach(newValue => { - allMappings.set(newValue.id, newValue[field]); - }); - } - }); -} - -function getMappings() { - return allMappings; -} -function getMapping(id) { - return allMappings.get(id) || null; -} - -/***/ }), - -/***/ "./packages/loot-core/src/server/db/sort.js": -/*!**************************************************!*\ - !*** ./packages/loot-core/src/server/db/sort.js ***! - \**************************************************/ -/*! exports provided: SORT_INCREMENT, shoveSortOrders */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SORT_INCREMENT", function() { return SORT_INCREMENT; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "shoveSortOrders", function() { return shoveSortOrders; }); -const SORT_INCREMENT = 16384; - -function midpoint(items, to) { - const below = items[to - 1]; - const above = items[to]; - - if (!below) { - return above.sort_order / 2; - } else if (!above) { - return below.sort_order + SORT_INCREMENT; - } else { - return (below.sort_order + above.sort_order) / 2; - } -} - -function shoveSortOrders(items, targetId) { - const to = items.findIndex(item => item.id === targetId); - const target = items[to]; - const before = items[to - 1]; - let updates = []; // If no target is specified, append at the end - - if (!targetId || to === -1) { - let order; - - if (items.length > 0) { - // Add a new increment to whatever is the latest sort order - order = items[items.length - 1].sort_order + SORT_INCREMENT; - } else { - // If no items exist, the default is to use the first increment - order = SORT_INCREMENT; - } - - return { - updates, - sort_order: order - }; - } else { - if (target.sort_order - (before ? before.sort_order : 0) <= 2) { - let next = to; - let order = (items[next].sort_order | 0) + SORT_INCREMENT; - - while (next < items.length) { - // No need to update it if it's already greater than the current - // order. This can happen because there may already be large - // gaps - if (order <= items[next].sort_order) { - break; - } - - updates.push({ - id: items[next].id, - sort_order: order - }); - next++; - order += SORT_INCREMENT; - } - } - - return { - updates, - sort_order: midpoint(items, to) - }; - } -} - -/***/ }), - -/***/ "./packages/loot-core/src/server/db/util.js": -/*!**************************************************!*\ - !*** ./packages/loot-core/src/server/db/util.js ***! - \**************************************************/ -/*! exports provided: incrFetch, whereIn */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "incrFetch", function() { return incrFetch; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "whereIn", function() { return whereIn; }); -async function incrFetch(runQuery, terms, compare, makeQuery, params = []) { - let pageCount = 500; - let results = []; - let fetchedIds = new Set(); - - for (let i = 0; i < terms.length; i += pageCount) { - let slice = terms.slice(i, i + pageCount).filter(id => !fetchedIds.has(id)); - - if (slice.length > 0) { - let filter = slice.map(id => compare(id)).join(' OR '); - let query = makeQuery('(' + filter + ')'); - let rows = await runQuery(query, params, true); - fetchedIds = new Set([...fetchedIds, ...slice]); - results = results.concat(rows); - } - } - - return results; -} -function whereIn(ids, field) { - let ids2 = [...new Set(ids)]; - let filter = `${field} IN (` + ids2.map(id => `'${id}'`).join(',') + ')'; - return filter; -} - -/***/ }), - -/***/ "./packages/loot-core/src/server/encryption-internals.js": -/*!***************************************************************!*\ - !*** ./packages/loot-core/src/server/encryption-internals.js ***! - \***************************************************************/ -/*! exports provided: sha256String, randomBytes, encrypt, decrypt, createKey, importKey */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "sha256String", function() { return sha256String; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "randomBytes", function() { return randomBytes; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "encrypt", function() { return encrypt; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "decrypt", function() { return decrypt; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createKey", function() { return createKey; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "importKey", function() { return importKey; }); -let crypto = __webpack_require__(/*! crypto */ "crypto"); - -let ENCRYPTION_ALGORITHM = 'aes-256-gcm'; -async function sha256String(str) { - return crypto.createHash('sha256').update(str).digest('base64'); -} -function randomBytes(n) { - return crypto.randomBytes(n); -} -function encrypt(masterKey, value) { - let masterKeyBuffer = masterKey.getValue().raw; // let iv = createKeyBuffer({ numBytes: 12, secret: masterKeyBuffer }); - - let iv = crypto.randomBytes(12); - let cipher = crypto.createCipheriv(ENCRYPTION_ALGORITHM, masterKeyBuffer, iv); - let encrypted = cipher.update(value); - encrypted = Buffer.concat([encrypted, cipher.final()]); - let authTag = cipher.getAuthTag(); - return { - value: encrypted, - meta: { - keyId: masterKey.getId(), - algorithm: ENCRYPTION_ALGORITHM, - iv: iv.toString('base64'), - authTag: authTag.toString('base64') - } - }; -} -function decrypt(masterKey, encrypted, meta) { - let masterKeyBuffer = masterKey.getValue().raw; - let algorithm = meta.algorithm, - iv = meta.iv, - authTag = meta.authTag; - iv = Buffer.from(iv, 'base64'); - authTag = Buffer.from(authTag, 'base64'); - let decipher = crypto.createDecipheriv(algorithm, masterKeyBuffer, iv); - decipher.setAuthTag(authTag); - let decrypted = decipher.update(encrypted); - decrypted = Buffer.concat([decrypted, decipher.final()]); - return decrypted; -} -function createKey({ - secret, - salt -}) { - let buffer = createKeyBuffer({ - secret, - salt - }); - return { - raw: buffer, - base64: buffer.toString('base64') - }; -} -function importKey(str) { - return { - raw: Buffer.from(str, 'base64'), - base64: str - }; -} -/** - * Generates a Buffer of a desired byte length to be used as either an encryption key or an initialization vector. - * - * @private - * @param {Integer} [numBytes = 32] - Optional, number of bytes to fill the Buffer with. - * @param {String} [secret = <random bytes>] - Optional, a secret to use as a basis for the key generation algorithm. - * @returns {Buffer} - */ - -function createKeyBuffer({ - numBytes, - secret, - salt -}) { - return crypto.pbkdf2Sync(secret || crypto.randomBytes(128).toString('base64'), salt || crypto.randomBytes(32).toString('base64'), 10000, numBytes || 32, 'sha512'); -} - -/***/ }), - -/***/ "./packages/loot-core/src/server/encryption.js": -/*!*****************************************************!*\ - !*** ./packages/loot-core/src/server/encryption.js ***! - \*****************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var _encryption_internals__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./encryption-internals */ "./packages/loot-core/src/server/encryption-internals.js"); - - -let uuid = __webpack_require__(/*! ../platform/uuid/index.electron.js */ "./packages/loot-core/src/platform/uuid/index.electron.js"); // A map of all possible master encryption keys to use, keyed by -// unique id - - -let keys = {}; - -class Key { - constructor({ - id, - value - }) { - this.id = id || uuid.v4Sync(); - } - - async createFromPassword({ - password, - salt - }) { - this.value = await _encryption_internals__WEBPACK_IMPORTED_MODULE_0__["createKey"]({ - secret: password, - salt - }); - } - - async createFromBase64(str) { - this.value = await _encryption_internals__WEBPACK_IMPORTED_MODULE_0__["importKey"](str); - } - - getId() { - return this.id; - } - - getValue() { - return this.value; - } - - serialize() { - return { - id: this.id, - base64: this.value.base64 - }; - } - -} - -function getKey(keyId) { - if (keyId == null || keys[keyId] == null) { - throw new Error('missing-key'); - } - - return keys[keyId]; -} - -function hasKey(keyId) { - return keyId in keys; -} - -function encrypt(value, keyId) { - return _encryption_internals__WEBPACK_IMPORTED_MODULE_0__["encrypt"](getKey(keyId), value); -} - -function decrypt(encrypted, meta) { - return _encryption_internals__WEBPACK_IMPORTED_MODULE_0__["decrypt"](getKey(meta.keyId), encrypted, meta); -} - -function randomBytes(n) { - return _encryption_internals__WEBPACK_IMPORTED_MODULE_0__["randomBytes"](n); -} - -async function loadKey(key) { - let keyInstance; - - if (!(key instanceof Key)) { - keyInstance = new Key({ - id: key.id - }); - await keyInstance.createFromBase64(key.base64); - } else { - keyInstance = key; - } - - keys[keyInstance.getId()] = keyInstance; -} - -function unloadKey(key) { - delete keys[key.getId()]; -} - -function unloadAllKeys() { - keys = {}; -} - -async function createKey({ - id, - password, - salt -}) { - let key = new Key({ - id - }); - await key.createFromPassword({ - password, - salt - }); - return key; -} - -/* harmony default export */ __webpack_exports__["default"] = ({ - decrypt, - encrypt, - randomBytes, - createKey, - loadKey, - getKey, - hasKey, - unloadKey, - unloadAllKeys -}); - -/***/ }), - -/***/ "./packages/loot-core/src/server/errors.js": -/*!*************************************************!*\ - !*** ./packages/loot-core/src/server/errors.js ***! - \*************************************************/ -/*! exports provided: PostError, HTTPError, SyncError, TransactionError, RuleError, APIError, FileDownloadError, FileUploadError, isCodeError */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PostError", function() { return PostError; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HTTPError", function() { return HTTPError; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SyncError", function() { return SyncError; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TransactionError", function() { return TransactionError; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RuleError", function() { return RuleError; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "APIError", function() { return APIError; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FileDownloadError", function() { return FileDownloadError; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FileUploadError", function() { return FileUploadError; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isCodeError", function() { return isCodeError; }); -// TODO: normalize error types -class PostError extends Error { - constructor(reason, meta) { - super('PostError: ' + reason); - this.type = 'PostError'; - this.reason = reason; - this.meta = meta; - } - -} -class HTTPError extends Error { - constructor(code, body) { - super(`HTTPError: unsuccessful status code (${code}): ${body}`); - this.statusCode = code; - this.responseBody = body; - } - -} -class SyncError extends Error { - constructor(reason, meta) { - super('SyncError: ' + reason); - this.reason = reason; - this.meta = meta; - } - -} -class TransactionError extends Error { - // eslint-disable-next-line - constructor(message) { - super(message); - } - -} -class RuleError extends Error { - constructor(type, message) { - super('RuleError: ' + message); - this.type = type; - } - -} -function APIError(msg, meta) { - return { - type: 'APIError', - message: msg, - meta - }; -} -function FileDownloadError(reason, meta) { - return { - type: 'FileDownloadError', - reason, - meta - }; -} -function FileUploadError(reason, meta) { - return { - type: 'FileUploadError', - reason, - meta - }; -} -function isCodeError(err) { - return err instanceof ReferenceError || err instanceof SyntaxError; -} - -/***/ }), - -/***/ "./packages/loot-core/src/server/main-app.js": -/*!***************************************************!*\ - !*** ./packages/loot-core/src/server/main-app.js ***! - \***************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var _app__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./app */ "./packages/loot-core/src/server/app.js"); - - -const connection = __webpack_require__(/*! ../platform/server/connection */ "./packages/loot-core/src/platform/server/connection/index.api.js"); // Main app - - -const app = Object(_app__WEBPACK_IMPORTED_MODULE_0__["createApp"])(); -app.events.on('sync', info => { - connection.send('sync-event', info); -}); -/* harmony default export */ __webpack_exports__["default"] = (app); - -/***/ }), - -/***/ "./packages/loot-core/src/server/main.js": -/*!***********************************************!*\ - !*** ./packages/loot-core/src/server/main.js ***! - \***********************************************/ -/*! exports provided: handlers, initApp, init, lib */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "handlers", function() { return handlers; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "initApp", function() { return initApp; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "init", function() { return init; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "lib", function() { return lib; }); -/* harmony import */ var _polyfills__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./polyfills */ "./packages/loot-core/src/server/polyfills.js"); -/* harmony import */ var _polyfills__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_polyfills__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var date_fns__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! date-fns */ "./node_modules/date-fns/esm/index.js"); -/* harmony import */ var _platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../platform/server/asyncStorage */ "./packages/loot-core/src/platform/server/asyncStorage/index.electron.js"); -/* harmony import */ var _platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_2__); -/* harmony import */ var _platform_exceptions__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../platform/exceptions */ "./packages/loot-core/src/platform/exceptions/index.electron.js"); -/* harmony import */ var _prefs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./prefs */ "./packages/loot-core/src/server/prefs.js"); -/* harmony import */ var _platform_server_fs__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../platform/server/fs */ "./packages/loot-core/src/platform/server/fs/index.electron.js"); -/* harmony import */ var _platform_server_fs__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_platform_server_fs__WEBPACK_IMPORTED_MODULE_5__); -/* harmony import */ var _platform_server_sqlite__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../platform/server/sqlite */ "./packages/loot-core/src/platform/server/sqlite/index.electron.js"); -/* harmony import */ var _platform_server_log__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../platform/server/log */ "./packages/loot-core/src/platform/server/log/index.api.js"); -/* harmony import */ var _platform__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./platform */ "./packages/loot-core/src/server/platform.js"); -/* harmony import */ var _db__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./db */ "./packages/loot-core/src/server/db/index.js"); -/* harmony import */ var _sheet__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./sheet */ "./packages/loot-core/src/server/sheet.js"); -/* harmony import */ var _undo__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./undo */ "./packages/loot-core/src/server/undo.js"); -/* harmony import */ var _update__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./update */ "./packages/loot-core/src/server/update.js"); -/* harmony import */ var _accounts_rules__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./accounts/rules */ "./packages/loot-core/src/server/accounts/rules.js"); -/* harmony import */ var _accounts_transaction_rules__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./accounts/transaction-rules */ "./packages/loot-core/src/server/accounts/transaction-rules.js"); -/* harmony import */ var _db_mappings__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./db/mappings */ "./packages/loot-core/src/server/db/mappings.js"); -/* harmony import */ var _accounts_transactions__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./accounts/transactions */ "./packages/loot-core/src/server/accounts/transactions.js"); -/* harmony import */ var _shared_rules__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ../shared/rules */ "./packages/loot-core/src/shared/rules.js"); -/* harmony import */ var _backups__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./backups */ "./packages/loot-core/src/server/backups.js"); -/* harmony import */ var _shared_util__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ../shared/util */ "./packages/loot-core/src/shared/util.js"); -/* harmony import */ var _shared_months__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ../shared/months */ "./packages/loot-core/src/shared/months.js"); -/* harmony import */ var _shared_accounts__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ../shared/accounts */ "./packages/loot-core/src/shared/accounts.js"); -/* harmony import */ var _budget_base__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ./budget/base */ "./packages/loot-core/src/server/budget/base.js"); -/* harmony import */ var _accounts_sync__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ./accounts/sync */ "./packages/loot-core/src/server/accounts/sync.js"); -/* harmony import */ var _accounts_link__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! ./accounts/link */ "./packages/loot-core/src/server/accounts/link.js"); -/* harmony import */ var _util_budget_name__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(/*! ./util/budget-name */ "./packages/loot-core/src/server/util/budget-name.js"); -/* harmony import */ var _mutators__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(/*! ./mutators */ "./packages/loot-core/src/server/mutators.js"); -/* harmony import */ var _timestamp__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__(/*! ./timestamp */ "./packages/loot-core/src/server/timestamp.js"); -/* harmony import */ var _merkle__WEBPACK_IMPORTED_MODULE_28__ = __webpack_require__(/*! ./merkle */ "./packages/loot-core/src/server/merkle.js"); -/* harmony import */ var _sync__WEBPACK_IMPORTED_MODULE_29__ = __webpack_require__(/*! ./sync */ "./packages/loot-core/src/server/sync/index.js"); -/* harmony import */ var _sync_migrate__WEBPACK_IMPORTED_MODULE_30__ = __webpack_require__(/*! ./sync/migrate */ "./packages/loot-core/src/server/sync/migrate.js"); -/* harmony import */ var _accounts_payees__WEBPACK_IMPORTED_MODULE_31__ = __webpack_require__(/*! ./accounts/payees */ "./packages/loot-core/src/server/accounts/payees.js"); -/* harmony import */ var _accounts_parse_file__WEBPACK_IMPORTED_MODULE_32__ = __webpack_require__(/*! ./accounts/parse-file */ "./packages/loot-core/src/server/accounts/parse-file.js"); -/* harmony import */ var _accounts_export_to_csv__WEBPACK_IMPORTED_MODULE_33__ = __webpack_require__(/*! ./accounts/export-to-csv */ "./packages/loot-core/src/server/accounts/export-to-csv.js"); -/* harmony import */ var _server_config__WEBPACK_IMPORTED_MODULE_34__ = __webpack_require__(/*! ./server-config */ "./packages/loot-core/src/server/server-config.js"); -/* harmony import */ var _api__WEBPACK_IMPORTED_MODULE_35__ = __webpack_require__(/*! ./api */ "./packages/loot-core/src/server/api.js"); -/* harmony import */ var _actual_app_api_injected__WEBPACK_IMPORTED_MODULE_36__ = __webpack_require__(/*! @actual-app/api/injected */ "./packages/api/injected.js"); -/* harmony import */ var _actual_app_api_injected__WEBPACK_IMPORTED_MODULE_36___default = /*#__PURE__*/__webpack_require__.n(_actual_app_api_injected__WEBPACK_IMPORTED_MODULE_36__); -/* harmony import */ var _cloud_storage__WEBPACK_IMPORTED_MODULE_37__ = __webpack_require__(/*! ./cloud-storage */ "./packages/loot-core/src/server/cloud-storage.js"); -/* harmony import */ var _encryption__WEBPACK_IMPORTED_MODULE_38__ = __webpack_require__(/*! ./encryption */ "./packages/loot-core/src/server/encryption.js"); -/* harmony import */ var _tracking_events__WEBPACK_IMPORTED_MODULE_39__ = __webpack_require__(/*! ./tracking/events */ "./packages/loot-core/src/server/tracking/events.js"); -/* harmony import */ var _post__WEBPACK_IMPORTED_MODULE_40__ = __webpack_require__(/*! ./post */ "./packages/loot-core/src/server/post.js"); -/* harmony import */ var _errors__WEBPACK_IMPORTED_MODULE_41__ = __webpack_require__(/*! ./errors */ "./packages/loot-core/src/server/errors.js"); -/* harmony import */ var _mocks_budget__WEBPACK_IMPORTED_MODULE_42__ = __webpack_require__(/*! ../mocks/budget */ "./packages/loot-core/src/mocks/budget.js"); -/* harmony import */ var _aql_schema_run_query__WEBPACK_IMPORTED_MODULE_43__ = __webpack_require__(/*! ./aql/schema/run-query */ "./packages/loot-core/src/server/aql/schema/run-query.js"); -/* harmony import */ var _shared_query__WEBPACK_IMPORTED_MODULE_44__ = __webpack_require__(/*! ../shared/query */ "./packages/loot-core/src/shared/query.js"); -/* harmony import */ var _main_app__WEBPACK_IMPORTED_MODULE_45__ = __webpack_require__(/*! ./main-app */ "./packages/loot-core/src/server/main-app.js"); -/* harmony import */ var _schedules_app__WEBPACK_IMPORTED_MODULE_46__ = __webpack_require__(/*! ./schedules/app */ "./packages/loot-core/src/server/schedules/app.js"); -/* harmony import */ var _budget_app__WEBPACK_IMPORTED_MODULE_47__ = __webpack_require__(/*! ./budget/app */ "./packages/loot-core/src/server/budget/app.js"); -/* harmony import */ var _notes_app__WEBPACK_IMPORTED_MODULE_48__ = __webpack_require__(/*! ./notes/app */ "./packages/loot-core/src/server/notes/app.js"); -/* harmony import */ var _tools_app__WEBPACK_IMPORTED_MODULE_49__ = __webpack_require__(/*! ./tools/app */ "./packages/loot-core/src/server/tools/app.js"); -function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } - -function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } - -function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } - -function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } - -function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_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 _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } - -function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } - -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } - -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; } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // Apps - - - - - - -const YNAB4 = __webpack_require__(/*! @actual-app/import-ynab4/importer */ "./packages/import-ynab4/importer.js"); - -const YNAB5 = __webpack_require__(/*! @actual-app/import-ynab5/importer */ "./packages/import-ynab5/importer.js"); - -const uuid = __webpack_require__(/*! ../platform/uuid */ "./packages/loot-core/src/platform/uuid/index.electron.js"); - -const connection = __webpack_require__(/*! ../platform/server/connection */ "./packages/loot-core/src/platform/server/connection/index.api.js"); - -const _require = __webpack_require__(/*! ./spreadsheet/util */ "./packages/loot-core/src/server/spreadsheet/util.js"), - resolveName = _require.resolveName, - unresolveName = _require.unresolveName; - -const SyncPb = __webpack_require__(/*! ./sync/proto/sync_pb */ "./packages/loot-core/src/server/sync/proto/sync_pb.js"); // let indexeddb = require('../platform/server/indexeddb'); - - -let VERSION; -let DEMO_BUDGET_ID = '_demo-budget'; -let TEST_BUDGET_ID = '_test-budget'; -let UNCONFIGURED_SERVER = 'https://not-configured/'; // util - -function onSheetChange({ - names -}) { - const nodes = names.map(name => { - let node = _sheet__WEBPACK_IMPORTED_MODULE_10__["get"]()._getNode(name); - - return { - name: node.name, - value: node.value - }; - }); - connection.send('cells-changed', nodes); -} // handlers - - -let handlers = {}; -handlers['undo'] = Object(_mutators__WEBPACK_IMPORTED_MODULE_26__["mutator"])(async function () { - return Object(_undo__WEBPACK_IMPORTED_MODULE_11__["undo"])(); -}); -handlers['redo'] = Object(_mutators__WEBPACK_IMPORTED_MODULE_26__["mutator"])(function () { - return Object(_undo__WEBPACK_IMPORTED_MODULE_11__["redo"])(); -}); -handlers['transactions-batch-update'] = Object(_mutators__WEBPACK_IMPORTED_MODULE_26__["mutator"])(async function ({ - added, - deleted, - updated, - learnCategories -}) { - return Object(_undo__WEBPACK_IMPORTED_MODULE_11__["withUndo"])(async () => { - let result = await Object(_accounts_transactions__WEBPACK_IMPORTED_MODULE_16__["batchUpdateTransactions"])({ - added, - updated, - deleted, - learnCategories - }); // Return all data updates to the frontend - - return result.updated; - }); -}); -handlers['transaction-add'] = Object(_mutators__WEBPACK_IMPORTED_MODULE_26__["mutator"])(async function (transaction) { - await handlers['transactions-batch-update']({ - added: [transaction] - }); - return {}; -}); -handlers['transaction-update'] = Object(_mutators__WEBPACK_IMPORTED_MODULE_26__["mutator"])(async function (transaction) { - await handlers['transactions-batch-update']({ - updated: [transaction] - }); - return {}; -}); -handlers['transaction-delete'] = Object(_mutators__WEBPACK_IMPORTED_MODULE_26__["mutator"])(async function (transaction) { - await handlers['transactions-batch-update']({ - deleted: [transaction] - }); - return {}; -}); - -handlers['transactions-filter'] = async function ({ - term, - accountId, - latestDate, - count, - notPaged, - options = {} -}) { - return _db__WEBPACK_IMPORTED_MODULE_9__["getTransactions"](term, accountId, latestDate, notPaged ? null : count == null ? undefined : count, options); -}; - -handlers['transactions-parse-file'] = async function ({ - filepath, - options -}) { - return Object(_accounts_parse_file__WEBPACK_IMPORTED_MODULE_32__["parseFile"])(filepath, options); -}; - -handlers['transactions-export'] = async function ({ - transactions, - accounts, - categoryGroups, - payees -}) { - return Object(_accounts_export_to_csv__WEBPACK_IMPORTED_MODULE_33__["exportToCSV"])(transactions, accounts, categoryGroups, payees); -}; - -handlers['transactions-export-query'] = async function ({ - query: queryState -}) { - return Object(_accounts_export_to_csv__WEBPACK_IMPORTED_MODULE_33__["exportQueryToCSV"])(new _shared_query__WEBPACK_IMPORTED_MODULE_44__["Query"](queryState)); -}; - -handlers['get-categories'] = async function () { - return { - grouped: await _db__WEBPACK_IMPORTED_MODULE_9__["getCategoriesGrouped"](), - list: await _db__WEBPACK_IMPORTED_MODULE_9__["getCategories"]() - }; -}; - -handlers['get-earliest-transaction'] = async function () { - let _await$aqlQuery = await Object(_aql_schema_run_query__WEBPACK_IMPORTED_MODULE_43__["runQuery"])(Object(_shared_query__WEBPACK_IMPORTED_MODULE_44__["default"])('transactions').options({ - splits: 'none' - }).orderBy({ - date: 'asc' - }).select('*').limit(1)), - data = _await$aqlQuery.data; - - return data[0] || null; -}; - -handlers['get-budget-bounds'] = async function () { - return _budget_base__WEBPACK_IMPORTED_MODULE_22__["createAllBudgets"](); -}; - -handlers['rollover-budget-month'] = async function ({ - month -}) { - let groups = await _db__WEBPACK_IMPORTED_MODULE_9__["getCategoriesGrouped"](); - let sheetName = _shared_months__WEBPACK_IMPORTED_MODULE_20__["sheetForMonth"](month); - - function value(name) { - let v = _sheet__WEBPACK_IMPORTED_MODULE_10__["getCellValue"](sheetName, name); - return { - value: v === '' ? 0 : v, - name: resolveName(sheetName, name) - }; - } - - let values = [value('available-funds'), value('last-month-overspent'), value('buffered'), value('total-budgeted'), value('to-budget'), value('from-last-month'), value('total-income'), value('total-spent'), value('total-leftover')]; - - for (let group of groups) { - if (group.is_income) { - values.push(value('total-income')); - - for (let cat of group.categories) { - values.push(value(`sum-amount-${cat.id}`)); - } - } else { - values = values.concat([value(`group-budget-${group.id}`), value(`group-sum-amount-${group.id}`), value(`group-leftover-${group.id}`)]); - - for (let cat of group.categories) { - values = values.concat([value(`budget-${cat.id}`), value(`sum-amount-${cat.id}`), value(`leftover-${cat.id}`), value(`carryover-${cat.id}`)]); - } - } - } - - return values; -}; - -handlers['report-budget-month'] = async function ({ - month -}) { - let groups = await _db__WEBPACK_IMPORTED_MODULE_9__["getCategoriesGrouped"](); - let sheetName = _shared_months__WEBPACK_IMPORTED_MODULE_20__["sheetForMonth"](month); - - function value(name) { - let v = _sheet__WEBPACK_IMPORTED_MODULE_10__["getCellValue"](sheetName, name); - return { - value: v === '' ? 0 : v, - name: resolveName(sheetName, name) - }; - } - - let values = [value('total-budgeted'), value('total-budget-income'), value('total-saved'), value('total-income'), value('total-spent'), value('real-saved'), value('total-leftover')]; - - for (let group of groups) { - values = values.concat([value(`group-budget-${group.id}`), value(`group-sum-amount-${group.id}`), value(`group-leftover-${group.id}`)]); - - for (let cat of group.categories) { - values = values.concat([value(`budget-${cat.id}`), value(`sum-amount-${cat.id}`), value(`leftover-${cat.id}`)]); - - if (!group.is_income) { - values.push(value(`carryover-${cat.id}`)); - } - } - } - - return values; -}; - -handlers['budget-set-type'] = async function ({ - type -}) { - if (type !== 'rollover' && type !== 'report') { - throw new Error('Invalid budget type: ' + type); - } // It's already the same; don't do anything - - - if (type === _prefs__WEBPACK_IMPORTED_MODULE_4__["getPrefs"]().budgetType) { - return; - } // Save prefs - - - return _prefs__WEBPACK_IMPORTED_MODULE_4__["savePrefs"]({ - budgetType: type - }); -}; - -handlers['category-create'] = Object(_mutators__WEBPACK_IMPORTED_MODULE_26__["mutator"])(async function ({ - name, - groupId, - isIncome -}) { - return Object(_undo__WEBPACK_IMPORTED_MODULE_11__["withUndo"])(async () => { - if (!groupId) { - throw Object(_errors__WEBPACK_IMPORTED_MODULE_41__["APIError"])('Creating a category: groupId is required'); - } - - return _db__WEBPACK_IMPORTED_MODULE_9__["insertCategory"]({ - name, - cat_group: groupId, - is_income: isIncome ? 1 : 0 - }); - }); -}); -handlers['category-update'] = Object(_mutators__WEBPACK_IMPORTED_MODULE_26__["mutator"])(async function (category) { - return Object(_undo__WEBPACK_IMPORTED_MODULE_11__["withUndo"])(async () => { - try { - await _db__WEBPACK_IMPORTED_MODULE_9__["updateCategory"](category); - } catch (e) { - if (e.message.toLowerCase().includes('unique constraint')) { - return { - error: { - type: 'category-exists' - } - }; - } - - throw e; - } - - return {}; - }); -}); -handlers['category-move'] = Object(_mutators__WEBPACK_IMPORTED_MODULE_26__["mutator"])(async function ({ - id, - groupId, - targetId -}) { - return Object(_undo__WEBPACK_IMPORTED_MODULE_11__["withUndo"])(async () => { - await Object(_sync__WEBPACK_IMPORTED_MODULE_29__["batchMessages"])(async () => { - await _db__WEBPACK_IMPORTED_MODULE_9__["moveCategory"](id, groupId, targetId); - }); - return 'ok'; - }); -}); -handlers['category-delete'] = Object(_mutators__WEBPACK_IMPORTED_MODULE_26__["mutator"])(async function ({ - id, - transferId -}) { - return Object(_undo__WEBPACK_IMPORTED_MODULE_11__["withUndo"])(async () => { - let result = {}; - await Object(_sync__WEBPACK_IMPORTED_MODULE_29__["batchMessages"])(async () => { - let row = await _db__WEBPACK_IMPORTED_MODULE_9__["first"]('SELECT is_income FROM categories WHERE id = ?', [id]); - - if (!row) { - result = { - error: 'no-categories' - }; - return; - } - - let transfer = transferId && (await _db__WEBPACK_IMPORTED_MODULE_9__["first"]('SELECT is_income FROM categories WHERE id = ?', [transferId])); - - if (!row || transferId && !transfer) { - result = { - error: 'no-categories' - }; - return; - } else if (transferId && row.is_income !== transfer.is_income) { - result = { - error: 'category-type' - }; - return; - } // Update spreadsheet values if it's an expense category - // TODO: We should do this for income too if it's a reflect budget - - - if (row.is_income === 0) { - if (transferId) { - await _budget_base__WEBPACK_IMPORTED_MODULE_22__["doTransfer"]([id], transferId); - } - } - - await _db__WEBPACK_IMPORTED_MODULE_9__["deleteCategory"]({ - id - }, transferId); - }); - return result; - }); -}); -handlers['category-group-create'] = Object(_mutators__WEBPACK_IMPORTED_MODULE_26__["mutator"])(async function ({ - name, - isIncome -}) { - return Object(_undo__WEBPACK_IMPORTED_MODULE_11__["withUndo"])(async () => { - return _db__WEBPACK_IMPORTED_MODULE_9__["insertCategoryGroup"]({ - name, - is_income: isIncome ? 1 : 0 - }); - }); -}); -handlers['category-group-update'] = Object(_mutators__WEBPACK_IMPORTED_MODULE_26__["mutator"])(async function (group) { - return Object(_undo__WEBPACK_IMPORTED_MODULE_11__["withUndo"])(async () => { - return _db__WEBPACK_IMPORTED_MODULE_9__["updateCategoryGroup"](group); - }); -}); -handlers['category-group-move'] = Object(_mutators__WEBPACK_IMPORTED_MODULE_26__["mutator"])(async function ({ - id, - targetId -}) { - return Object(_undo__WEBPACK_IMPORTED_MODULE_11__["withUndo"])(async () => { - await Object(_sync__WEBPACK_IMPORTED_MODULE_29__["batchMessages"])(async () => { - await _db__WEBPACK_IMPORTED_MODULE_9__["moveCategoryGroup"](id, targetId); - }); - return 'ok'; - }); -}); -handlers['category-group-delete'] = Object(_mutators__WEBPACK_IMPORTED_MODULE_26__["mutator"])(async function ({ - id, - transferId -}) { - return Object(_undo__WEBPACK_IMPORTED_MODULE_11__["withUndo"])(async () => { - const groupCategories = await _db__WEBPACK_IMPORTED_MODULE_9__["all"]('SELECT id FROM categories WHERE cat_group = ? AND tombstone = 0', [id]); - return Object(_sync__WEBPACK_IMPORTED_MODULE_29__["batchMessages"])(async () => { - if (transferId) { - await _budget_base__WEBPACK_IMPORTED_MODULE_22__["doTransfer"](groupCategories.map(c => c.id), transferId); - } - - await _db__WEBPACK_IMPORTED_MODULE_9__["deleteCategoryGroup"]({ - id - }, transferId); - }); - }); -}); - -handlers['must-category-transfer'] = async function ({ - id -}) { - const res = await _db__WEBPACK_IMPORTED_MODULE_9__["runQuery"](`SELECT count(t.id) as count FROM transactions t - LEFT JOIN category_mapping cm ON cm.id = t.category - WHERE cm.transferId = ? AND t.tombstone = 0`, [id], true); // If there are transactions with this category, return early since - // we already know it needs to be tranferred - - if (res[0].count !== 0) { - return true; - } // If there are any non-zero budget values, also force the user to - // transfer the category. - - - return [..._sheet__WEBPACK_IMPORTED_MODULE_10__["get"]().meta().createdMonths].some(month => { - const sheetName = _shared_months__WEBPACK_IMPORTED_MODULE_20__["sheetForMonth"](month); - const value = _sheet__WEBPACK_IMPORTED_MODULE_10__["get"]().getCellValue(sheetName, 'budget-' + id); - return value !== 0; - }); -}; - -handlers['payee-create'] = Object(_mutators__WEBPACK_IMPORTED_MODULE_26__["mutator"])(async function ({ - name -}) { - return Object(_undo__WEBPACK_IMPORTED_MODULE_11__["withUndo"])(async () => { - return _db__WEBPACK_IMPORTED_MODULE_9__["insertPayee"]({ - name - }); - }); -}); - -handlers['payees-get'] = async function () { - return _db__WEBPACK_IMPORTED_MODULE_9__["getPayees"](); -}; - -handlers['payees-get-rule-counts'] = async function () { - let payeeCounts = {}; - let allRules = _accounts_transaction_rules__WEBPACK_IMPORTED_MODULE_14__["getRules"](); - _accounts_transaction_rules__WEBPACK_IMPORTED_MODULE_14__["iterateIds"](_accounts_transaction_rules__WEBPACK_IMPORTED_MODULE_14__["getRules"](), 'payee', (rule, id) => { - if (payeeCounts[id] == null) { - payeeCounts[id] = 0; - } - - payeeCounts[id]++; - }); - return payeeCounts; -}; - -handlers['payees-merge'] = Object(_mutators__WEBPACK_IMPORTED_MODULE_26__["mutator"])(async function ({ - targetId, - mergeIds -}) { - return Object(_undo__WEBPACK_IMPORTED_MODULE_11__["withUndo"])(async () => { - return _db__WEBPACK_IMPORTED_MODULE_9__["mergePayees"](targetId, mergeIds); - }, { - targetId, - mergeIds - }); -}); -handlers['payees-batch-change'] = Object(_mutators__WEBPACK_IMPORTED_MODULE_26__["mutator"])(async function ({ - added, - deleted, - updated -}) { - return Object(_undo__WEBPACK_IMPORTED_MODULE_11__["withUndo"])(async () => { - return Object(_sync__WEBPACK_IMPORTED_MODULE_29__["batchMessages"])(async () => { - if (deleted) { - await Promise.all(deleted.map(p => _db__WEBPACK_IMPORTED_MODULE_9__["deletePayee"](p))); - } - - if (added) { - await Promise.all(added.map(p => _db__WEBPACK_IMPORTED_MODULE_9__["insertPayee"](p))); - } - - if (updated) { - await Promise.all(updated.map(p => _db__WEBPACK_IMPORTED_MODULE_9__["updatePayee"](p))); - } - }); - }); -}); - -handlers['payees-check-orphaned'] = async function ({ - ids -}) { - let orphaned = new Set(await _db__WEBPACK_IMPORTED_MODULE_9__["getOrphanedPayees"]()); - return ids.filter(id => orphaned.has(id)); -}; - -handlers['payees-get-rules'] = async function ({ - id -}) { - return _accounts_transaction_rules__WEBPACK_IMPORTED_MODULE_14__["getRulesForPayee"](id).map(rule => rule.serialize()); -}; - -handlers['payees-delete-rule'] = Object(_mutators__WEBPACK_IMPORTED_MODULE_26__["mutator"])(async function ({ - id, - payee_id -}) { - return Object(_undo__WEBPACK_IMPORTED_MODULE_11__["withUndo"])(async () => { - return await _db__WEBPACK_IMPORTED_MODULE_9__["deletePayeeRule"]({ - id - }); - }, { - payeeId: payee_id - }); -}); -handlers['payees-update-rule'] = Object(_mutators__WEBPACK_IMPORTED_MODULE_26__["mutator"])(async function (rule) { - return Object(_undo__WEBPACK_IMPORTED_MODULE_11__["withUndo"])(async () => { - return await _db__WEBPACK_IMPORTED_MODULE_9__["updatePayeeRule"](rule); - }, { - payeeId: rule.payee_id - }); -}); -handlers['payees-add-rule'] = Object(_mutators__WEBPACK_IMPORTED_MODULE_26__["mutator"])(async function (rule) { - return Object(_undo__WEBPACK_IMPORTED_MODULE_11__["withUndo"])(async () => { - let id = await _db__WEBPACK_IMPORTED_MODULE_9__["insertPayeeRule"](rule); - return _objectSpread(_objectSpread({}, rule), {}, { - id - }); - }, { - payeeId: rule.payee_id - }); -}); - -function validateRule(rule) { - // Returns an array of errors, the array is the same link as the - // passed-in `array`, or null if there are no errors - function runValidation(array, validate) { - let result = array.map(item => { - try { - validate(item); - } catch (e) { - if (e instanceof _errors__WEBPACK_IMPORTED_MODULE_41__["RuleError"]) { - console.warn('Invalid rule', e); - return e.type; - } - - throw e; - } - - return null; - }); - return result.some(Boolean) ? result : null; - } - - let conditionErrors = runValidation(rule.conditions, cond => new _accounts_rules__WEBPACK_IMPORTED_MODULE_13__["Condition"](cond.op, cond.field, cond.value, cond.options, _shared_rules__WEBPACK_IMPORTED_MODULE_17__["FIELD_TYPES"])); - let actionErrors = runValidation(rule.actions, action => new _accounts_rules__WEBPACK_IMPORTED_MODULE_13__["Action"](action.op, action.field, action.value, action.options, _shared_rules__WEBPACK_IMPORTED_MODULE_17__["FIELD_TYPES"])); - - if (conditionErrors || actionErrors) { - return { - conditionErrors, - actionErrors - }; - } - - return null; -} - -handlers['rule-validate'] = async function (rule) { - let error = validateRule(rule); - return { - error - }; -}; - -handlers['rule-add'] = Object(_mutators__WEBPACK_IMPORTED_MODULE_26__["mutator"])(async function (rule) { - let error = validateRule(rule); - - if (error) { - return { - error - }; - } - - let id = await _accounts_transaction_rules__WEBPACK_IMPORTED_MODULE_14__["insertRule"](rule); - return { - id - }; -}); -handlers['rule-update'] = Object(_mutators__WEBPACK_IMPORTED_MODULE_26__["mutator"])(async function (rule) { - let error = validateRule(rule); - - if (error) { - return { - error - }; - } - - await _accounts_transaction_rules__WEBPACK_IMPORTED_MODULE_14__["updateRule"](rule); - return {}; -}); -handlers['rule-delete'] = Object(_mutators__WEBPACK_IMPORTED_MODULE_26__["mutator"])(async function (rule) { - return _accounts_transaction_rules__WEBPACK_IMPORTED_MODULE_14__["deleteRule"](rule); -}); -handlers['rule-delete-all'] = Object(_mutators__WEBPACK_IMPORTED_MODULE_26__["mutator"])(async function (ids) { - let someDeletionsFailed = false; - await Object(_sync__WEBPACK_IMPORTED_MODULE_29__["batchMessages"])(async () => { - for (let id of ids) { - let res = await _accounts_transaction_rules__WEBPACK_IMPORTED_MODULE_14__["deleteRule"]({ - id - }); - - if (res === false) { - someDeletionsFailed = true; - } - } - }); - return { - someDeletionsFailed - }; -}); -handlers['rule-apply-actions'] = Object(_mutators__WEBPACK_IMPORTED_MODULE_26__["mutator"])(async function ({ - transactionIds, - actions -}) { - return _accounts_transaction_rules__WEBPACK_IMPORTED_MODULE_14__["applyActions"](transactionIds, actions, handlers); -}); -handlers['rule-add-payee-rename'] = Object(_mutators__WEBPACK_IMPORTED_MODULE_26__["mutator"])(async function ({ - fromNames, - to -}) { - return _accounts_transaction_rules__WEBPACK_IMPORTED_MODULE_14__["updatePayeeRenameRule"](fromNames, to); -}); - -handlers['rules-get'] = async function () { - return Object(_accounts_rules__WEBPACK_IMPORTED_MODULE_13__["rankRules"])(_accounts_transaction_rules__WEBPACK_IMPORTED_MODULE_14__["getRules"]()).map(rule => rule.serialize()); -}; - -handlers['rule-get'] = async function ({ - id -}) { - let rule = _accounts_transaction_rules__WEBPACK_IMPORTED_MODULE_14__["getRules"]().find(rule => rule.id === id); - return rule ? rule.serialize() : null; -}; - -handlers['rules-run'] = async function ({ - transaction -}) { - return _accounts_transaction_rules__WEBPACK_IMPORTED_MODULE_14__["runRules"](transaction); -}; - -handlers['rules-migrate'] = async function () { - await _accounts_transaction_rules__WEBPACK_IMPORTED_MODULE_14__["migrateOldRules"](); -}; - -handlers['make-filters-from-conditions'] = async function ({ - conditions -}) { - return _accounts_transaction_rules__WEBPACK_IMPORTED_MODULE_14__["conditionsToAQL"](conditions); -}; - -handlers['getCell'] = async function ({ - sheetName, - name -}) { - // Fields is no longer used - hardcode - let fields = ['name', 'value']; - - let node = _sheet__WEBPACK_IMPORTED_MODULE_10__["get"]()._getNode(resolveName(sheetName, name)); - - if (fields) { - let res = {}; - fields.forEach(field => { - if (field === 'run') { - res[field] = node._run ? node._run.toString() : null; - } else { - res[field] = node[field]; - } - }); - return res; - } else { - return node; - } -}; - -handlers['getCells'] = async function ({ - names -}) { - return names.map(name => ({ - value: _sheet__WEBPACK_IMPORTED_MODULE_10__["get"]()._getNode(name).value - })); -}; - -handlers['getCellNamesInSheet'] = async function ({ - sheetName -}) { - let names = []; - - for (let name of _sheet__WEBPACK_IMPORTED_MODULE_10__["get"]().getNodes().keys()) { - let _unresolveName = unresolveName(name), - nodeSheet = _unresolveName.sheet, - nodeName = _unresolveName.name; - - if (nodeSheet === sheetName) { - names.push(nodeName); - } - } - - return names; -}; - -handlers['debugCell'] = async function ({ - sheetName, - name -}) { - let node = _sheet__WEBPACK_IMPORTED_MODULE_10__["get"]().getNode(resolveName(sheetName, name)); - return _objectSpread(_objectSpread({}, node), {}, { - _run: node._run && node._run.toString() - }); -}; - -handlers['create-query'] = async function ({ - sheetName, - name, - query -}) { - // Always run it regardless of cache. We don't know anything has changed - // between the cache value being saved and now - _sheet__WEBPACK_IMPORTED_MODULE_10__["get"]().createQuery(sheetName, name, query); - return 'ok'; -}; - -handlers['query'] = async function (query) { - if (query.table == null) { - throw new Error('query has no table, did you forgot to call `.serialize`?'); - } - - return Object(_aql_schema_run_query__WEBPACK_IMPORTED_MODULE_43__["runQuery"])(query); -}; - -handlers['bank-delete'] = async function ({ - id -}) { - const accts = await _db__WEBPACK_IMPORTED_MODULE_9__["runQuery"]('SELECT * FROM accounts WHERE bank = ?', [id], true); - await _db__WEBPACK_IMPORTED_MODULE_9__["delete_"]('banks', id); - await Promise.all(accts.map(async acct => { - // TODO: This will not sync across devices because we are bypassing - // the "recorded" functions - await _db__WEBPACK_IMPORTED_MODULE_9__["runQuery"]('DELETE FROM transactions WHERE acct = ?', [acct.id]); - await _db__WEBPACK_IMPORTED_MODULE_9__["delete_"]('accounts', acct.id); - })); - return 'ok'; -}; - -handlers['account-update'] = Object(_mutators__WEBPACK_IMPORTED_MODULE_26__["mutator"])(async function ({ - id, - name -}) { - return Object(_undo__WEBPACK_IMPORTED_MODULE_11__["withUndo"])(async () => { - await _db__WEBPACK_IMPORTED_MODULE_9__["update"]('accounts', { - id, - name - }); - return {}; - }); -}); - -handlers['accounts-get'] = async function () { - return _db__WEBPACK_IMPORTED_MODULE_9__["getAccounts"](); -}; - -handlers['account-properties'] = async function ({ - id -}) { - const _await$db$first = await _db__WEBPACK_IMPORTED_MODULE_9__["first"]('SELECT sum(amount) as balance FROM transactions WHERE acct = ? AND isParent = 0 AND tombstone = 0', [id]), - balance = _await$db$first.balance; - - const _await$db$first2 = await _db__WEBPACK_IMPORTED_MODULE_9__["first"]('SELECT count(id) as count FROM transactions WHERE acct = ? AND tombstone = 0', [id]), - count = _await$db$first2.count; - - return { - balance: balance || 0, - numTransactions: count - }; -}; - -handlers['accounts-link'] = async function ({ - institution, - publicToken, - accountId, - upgradingId -}) { - let bankId = await _accounts_link__WEBPACK_IMPORTED_MODULE_24__["handoffPublicToken"](institution, publicToken); - - let _await$asyncStorage$m = await _platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_2___default.a.multiGet(['user-id', 'user-key']), - _await$asyncStorage$m2 = _slicedToArray(_await$asyncStorage$m, 2), - _await$asyncStorage$m3 = _slicedToArray(_await$asyncStorage$m2[0], 2), - userId = _await$asyncStorage$m3[1], - _await$asyncStorage$m4 = _slicedToArray(_await$asyncStorage$m2[1], 2), - userKey = _await$asyncStorage$m4[1]; // Get all the available accounts and find the selected one - - - let accounts = await _accounts_sync__WEBPACK_IMPORTED_MODULE_23__["getAccounts"](userId, userKey, bankId); - let account = accounts.find(acct => acct.account_id === accountId); - await _db__WEBPACK_IMPORTED_MODULE_9__["update"]('accounts', { - id: upgradingId, - account_id: account.account_id, - official_name: account.official_name, - type: Object(_shared_accounts__WEBPACK_IMPORTED_MODULE_21__["fromPlaidAccountType"])(account.type), - balance_current: Object(_shared_util__WEBPACK_IMPORTED_MODULE_19__["amountToInteger"])(account.balances.current), - balance_available: Object(_shared_util__WEBPACK_IMPORTED_MODULE_19__["amountToInteger"])(account.balances.available), - balance_limit: Object(_shared_util__WEBPACK_IMPORTED_MODULE_19__["amountToInteger"])(account.balances.limit), - mask: account.mask, - bank: bankId - }); - await _accounts_sync__WEBPACK_IMPORTED_MODULE_23__["syncAccount"](userId, userKey, upgradingId, account.account_id, bankId); - connection.send('sync-event', { - type: 'success', - tables: ['transactions'] - }); - return 'ok'; -}; - -handlers['accounts-connect'] = async function ({ - institution, - publicToken, - accountIds, - offbudgetIds -}) { - let bankId = await _accounts_link__WEBPACK_IMPORTED_MODULE_24__["handoffPublicToken"](institution, publicToken); - let ids = await _accounts_link__WEBPACK_IMPORTED_MODULE_24__["addAccounts"](bankId, accountIds, offbudgetIds); - return ids; -}; - -handlers['account-create'] = Object(_mutators__WEBPACK_IMPORTED_MODULE_26__["mutator"])(async function ({ - name, - type, - balance, - offBudget, - closed -}) { - return Object(_undo__WEBPACK_IMPORTED_MODULE_11__["withUndo"])(async () => { - const id = await _db__WEBPACK_IMPORTED_MODULE_9__["insertAccount"]({ - name, - type, - offbudget: offBudget ? 1 : 0, - closed: closed ? 1 : 0 - }); - await _db__WEBPACK_IMPORTED_MODULE_9__["insertPayee"]({ - name: '', - transfer_acct: id - }); - - if (balance != null) { - let payee = await Object(_accounts_payees__WEBPACK_IMPORTED_MODULE_31__["getStartingBalancePayee"])(); - await _db__WEBPACK_IMPORTED_MODULE_9__["insertTransaction"]({ - account: id, - amount: Object(_shared_util__WEBPACK_IMPORTED_MODULE_19__["amountToInteger"])(balance), - category: offBudget ? null : payee.category, - payee: payee.id, - date: _shared_months__WEBPACK_IMPORTED_MODULE_20__["currentDay"](), - cleared: true, - starting_balance_flag: true - }); - } - - return id; - }); -}); -handlers['account-close'] = Object(_mutators__WEBPACK_IMPORTED_MODULE_26__["mutator"])(async function ({ - id, - transferAccountId, - categoryId, - forced -}) { - // Unlink the account if it's linked. This makes sure to remove it - // from Plaid. (This should not be undo-able, as it mutates the - // remote server and the user will have to link the account again) - await handlers['account-unlink']({ - id - }); - return Object(_undo__WEBPACK_IMPORTED_MODULE_11__["withUndo"])(async () => { - let account = await _db__WEBPACK_IMPORTED_MODULE_9__["first"]('SELECT * FROM accounts WHERE id = ? AND tombstone = 0', [id]); // Do nothing if the account doesn't exist or it's already been - // closed - - if (!account || account.closed === 1) { - return; - } - - const _await$handlers$accou = await handlers['account-properties']({ - id - }), - balance = _await$handlers$accou.balance, - numTransactions = _await$handlers$accou.numTransactions; // If there are no transactions, we can simply delete the account - - - if (numTransactions === 0) { - await _db__WEBPACK_IMPORTED_MODULE_9__["deleteAccount"]({ - id - }); - } else if (forced) { - let rows = await _db__WEBPACK_IMPORTED_MODULE_9__["runQuery"]('SELECT id, transfer_id FROM v_transactions WHERE account = ?', [id], true); - - let _await$db$first3 = await _db__WEBPACK_IMPORTED_MODULE_9__["first"]('SELECT id FROM payees WHERE transfer_acct = ?', [id]), - payeeId = _await$db$first3.id; - - await Object(_sync__WEBPACK_IMPORTED_MODULE_29__["batchMessages"])(() => { - // TODO: what this should really do is send a special message that - // automatically marks the tombstone value for all transactions - // within an account... or something? This is problematic - // because another client could easily add new data that - // should be marked as deleted. - rows.forEach(row => { - if (row.transfer_id) { - _db__WEBPACK_IMPORTED_MODULE_9__["updateTransaction"]({ - id: row.transfer_id, - payee: null, - transfer_id: null - }); - } - - _db__WEBPACK_IMPORTED_MODULE_9__["deleteTransaction"]({ - id: row.id - }); - }); - _db__WEBPACK_IMPORTED_MODULE_9__["deleteAccount"]({ - id - }); - _db__WEBPACK_IMPORTED_MODULE_9__["deleteTransferPayee"]({ - id: payeeId - }); - }); - } else { - if (balance !== 0 && transferAccountId == null) { - throw Object(_errors__WEBPACK_IMPORTED_MODULE_41__["APIError"])('balance is non-zero: transferAccountId is required'); - } - - await _db__WEBPACK_IMPORTED_MODULE_9__["update"]('accounts', { - id, - closed: 1 - }); // If there is a balance we need to transfer it to the specified - // account (and possibly categorize it) - - if (balance !== 0) { - let _await$db$first4 = await _db__WEBPACK_IMPORTED_MODULE_9__["first"]('SELECT id FROM payees WHERE transfer_acct = ?', [transferAccountId]), - payeeId = _await$db$first4.id; - - await handlers['transaction-add']({ - id: uuid.v4Sync(), - payee: payeeId, - amount: -balance, - account: id, - date: _shared_months__WEBPACK_IMPORTED_MODULE_20__["currentDay"](), - notes: 'Closing account', - category: categoryId || null - }); - } - } - }); -}); -handlers['account-reopen'] = Object(_mutators__WEBPACK_IMPORTED_MODULE_26__["mutator"])(async function ({ - id -}) { - return Object(_undo__WEBPACK_IMPORTED_MODULE_11__["withUndo"])(async () => { - await _db__WEBPACK_IMPORTED_MODULE_9__["update"]('accounts', { - id, - closed: 0 - }); - }); -}); -handlers['account-move'] = Object(_mutators__WEBPACK_IMPORTED_MODULE_26__["mutator"])(async function ({ - id, - targetId -}) { - return Object(_undo__WEBPACK_IMPORTED_MODULE_11__["withUndo"])(async () => { - await _db__WEBPACK_IMPORTED_MODULE_9__["moveAccount"](id, targetId); - }); -}); -let stopPolling = false; - -handlers['poll-web-token'] = async function ({ - token -}) { - let _await$asyncStorage$m5 = await _platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_2___default.a.multiGet(['user-id', 'user-key']), - _await$asyncStorage$m6 = _slicedToArray(_await$asyncStorage$m5, 2), - _await$asyncStorage$m7 = _slicedToArray(_await$asyncStorage$m6[0], 2), - userId = _await$asyncStorage$m7[1], - _await$asyncStorage$m8 = _slicedToArray(_await$asyncStorage$m6[1], 2), - key = _await$asyncStorage$m8[1]; - - let startTime = Date.now(); - stopPolling = false; - - async function getData(cb) { - if (stopPolling) { - return; - } - - if (Date.now() - startTime >= 1000 * 60 * 10) { - cb('timeout'); - return; - } - - let data = await Object(_post__WEBPACK_IMPORTED_MODULE_40__["post"])(Object(_server_config__WEBPACK_IMPORTED_MODULE_34__["getServer"])().PLAID_SERVER + '/get-web-token-contents', { - userId, - key, - token - }); - - if (data) { - if (data.error) { - cb('unknown'); - } else { - cb(null, data); - } - } else { - setTimeout(() => getData(cb), 3000); - } - } - - return new Promise(resolve => { - getData((error, data) => { - if (error) { - resolve({ - error - }); - } else { - resolve({ - data - }); - } - }); - }); -}; - -handlers['poll-web-token-stop'] = async function () { - stopPolling = true; - return 'ok'; -}; - -handlers['accounts-sync'] = async function ({ - id -}) { - let _await$asyncStorage$m9 = await _platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_2___default.a.multiGet(['user-id', 'user-key']), - _await$asyncStorage$m10 = _slicedToArray(_await$asyncStorage$m9, 2), - _await$asyncStorage$m11 = _slicedToArray(_await$asyncStorage$m10[0], 2), - userId = _await$asyncStorage$m11[1], - _await$asyncStorage$m12 = _slicedToArray(_await$asyncStorage$m10[1], 2), - userKey = _await$asyncStorage$m12[1]; - - let accounts = await _db__WEBPACK_IMPORTED_MODULE_9__["runQuery"](`SELECT a.*, b.id as bankId FROM accounts a - LEFT JOIN banks b ON a.bank = b.id - WHERE a.tombstone = 0 AND a.closed = 0`, [], true); - - if (id) { - accounts = accounts.filter(acct => acct.id === id); - } - - let errors = []; - let newTransactions = []; - let matchedTransactions = []; - let updatedAccounts = []; - - let _prefs$getPrefs = _prefs__WEBPACK_IMPORTED_MODULE_4__["getPrefs"](), - groupId = _prefs$getPrefs.groupId; - - for (var i = 0; i < accounts.length; i++) { - const acct = accounts[i]; - - if (acct.bankId) { - try { - const res = await _accounts_sync__WEBPACK_IMPORTED_MODULE_23__["syncAccount"](userId, userKey, acct.id, acct.account_id, acct.bankId); - let added = res.added, - updated = res.updated; - newTransactions = newTransactions.concat(added); - matchedTransactions = matchedTransactions.concat(updated); - - if (added.length > 0 || updated.length > 0) { - updatedAccounts = updatedAccounts.concat(acct.id); - } - } catch (err) { - if (err.type === 'BankSyncError') { - errors.push({ - type: 'SyncError', - accountId: acct.id, - message: 'Failed syncing account "' + acct.name + '".', - category: err.category, - code: err.code - }); - } else if (err instanceof _errors__WEBPACK_IMPORTED_MODULE_41__["PostError"] && err.reason !== 'internal') { - errors.push({ - accountId: acct.id, - message: `Account "${acct.name}" is not linked properly. Please link it again` - }); - } else { - errors.push({ - accountId: acct.id, - message: 'There was an internal error. Please email help@actualbudget.com for support.', - internal: err.stack - }); - err.message = 'Failed syncing account: ' + err.message; - Object(_platform_exceptions__WEBPACK_IMPORTED_MODULE_3__["captureException"])(err); - } - } - } - } - - if (updatedAccounts.length > 0) { - connection.send('sync-event', { - type: 'success', - tables: ['transactions'] - }); - } - - return { - errors, - newTransactions, - matchedTransactions, - updatedAccounts - }; -}; - -handlers['transactions-import'] = Object(_mutators__WEBPACK_IMPORTED_MODULE_26__["mutator"])(function ({ - accountId, - transactions -}) { - return Object(_undo__WEBPACK_IMPORTED_MODULE_11__["withUndo"])(async () => { - if (typeof accountId !== 'string') { - throw Object(_errors__WEBPACK_IMPORTED_MODULE_41__["APIError"])('transactions-import: accountId must be an id'); - } - - try { - return await _accounts_sync__WEBPACK_IMPORTED_MODULE_23__["reconcileTransactions"](accountId, transactions); - } catch (err) { - if (err instanceof _errors__WEBPACK_IMPORTED_MODULE_41__["TransactionError"]) { - return { - errors: [{ - message: err.message - }], - added: [], - updated: [] - }; - } - - throw err; - } - }); -}); -handlers['account-unlink'] = Object(_mutators__WEBPACK_IMPORTED_MODULE_26__["mutator"])(async function ({ - id -}) { - let _await$db$first5 = await _db__WEBPACK_IMPORTED_MODULE_9__["first"]('SELECT bank FROM accounts WHERE id = ?', [id]), - bankId = _await$db$first5.bank; - - if (!bankId) { - return 'ok'; - } - - await _db__WEBPACK_IMPORTED_MODULE_9__["updateAccount"]({ - id, - account_id: null, - bank: null, - balance_current: null, - balance_available: null, - balance_limit: null - }); - - let _await$db$first6 = await _db__WEBPACK_IMPORTED_MODULE_9__["first"]('SELECT COUNT(*) as count FROM accounts WHERE bank = ?', [bankId]), - count = _await$db$first6.count; - - if (count === 0) { - // No more accounts are associated with this bank. We can remove - // it from Plaid. - let _await$asyncStorage$m13 = await _platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_2___default.a.multiGet(['user-id', 'user-key']), - _await$asyncStorage$m14 = _slicedToArray(_await$asyncStorage$m13, 2), - _await$asyncStorage$m15 = _slicedToArray(_await$asyncStorage$m14[0], 2), - userId = _await$asyncStorage$m15[1], - _await$asyncStorage$m16 = _slicedToArray(_await$asyncStorage$m14[1], 2), - key = _await$asyncStorage$m16[1]; - - await Object(_post__WEBPACK_IMPORTED_MODULE_40__["post"])(Object(_server_config__WEBPACK_IMPORTED_MODULE_34__["getServer"])().PLAID_SERVER + '/remove-access-token', { - userId, - key, - item_id: bankId - }); - } - - return 'ok'; -}); - -handlers['make-plaid-public-token'] = async function ({ - bankId -}) { - let _await$asyncStorage$m17 = await _platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_2___default.a.multiGet(['user-id', 'user-key']), - _await$asyncStorage$m18 = _slicedToArray(_await$asyncStorage$m17, 2), - _await$asyncStorage$m19 = _slicedToArray(_await$asyncStorage$m18[0], 2), - userId = _await$asyncStorage$m19[1], - _await$asyncStorage$m20 = _slicedToArray(_await$asyncStorage$m18[1], 2), - userKey = _await$asyncStorage$m20[1]; - - let data = await Object(_post__WEBPACK_IMPORTED_MODULE_40__["post"])(Object(_server_config__WEBPACK_IMPORTED_MODULE_34__["getServer"])().PLAID_SERVER + '/make-public-token', { - userId: userId, - key: userKey, - item_id: '' + bankId - }); - - if (data.error_code) { - return { - error: '', - code: data.error_code, - type: data.error_type - }; - } - - return { - linkToken: data.link_token - }; -}; - -handlers['save-global-prefs'] = async function (prefs) { - if ('maxMonths' in prefs) { - await _platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_2___default.a.setItem('max-months', '' + prefs.maxMonths); - } - - if ('trackUsage' in prefs) { - _tracking_events__WEBPACK_IMPORTED_MODULE_39__["toggle"](prefs.trackUsage); - await _platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_2___default.a.setItem('track-usage', '' + prefs.trackUsage); - } - - if ('autoUpdate' in prefs) { - await _platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_2___default.a.setItem('auto-update', '' + prefs.autoUpdate); - process.send({ - type: 'shouldAutoUpdate', - flag: prefs.autoUpdate - }); - } - - if ('documentDir' in prefs) { - if (await _platform_server_fs__WEBPACK_IMPORTED_MODULE_5___default.a.exists(prefs.documentDir)) { - await _platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_2___default.a.setItem('document-dir', prefs.documentDir); - } - } - - if ('floatingSidebar' in prefs) { - await _platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_2___default.a.setItem('floating-sidebar', '' + prefs.floatingSidebar); - } - - return 'ok'; -}; - -handlers['load-global-prefs'] = async function () { - let _await$asyncStorage$m21 = await _platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_2___default.a.multiGet(['floating-sidebar', 'seen-tutorial', 'max-months', 'track-usage', 'auto-update', 'document-dir', 'encrypt-key']), - _await$asyncStorage$m22 = _slicedToArray(_await$asyncStorage$m21, 7), - _await$asyncStorage$m23 = _slicedToArray(_await$asyncStorage$m22[0], 2), - floatingSidebar = _await$asyncStorage$m23[1], - _await$asyncStorage$m24 = _slicedToArray(_await$asyncStorage$m22[1], 2), - seenTutorial = _await$asyncStorage$m24[1], - _await$asyncStorage$m25 = _slicedToArray(_await$asyncStorage$m22[2], 2), - maxMonths = _await$asyncStorage$m25[1], - _await$asyncStorage$m26 = _slicedToArray(_await$asyncStorage$m22[3], 2), - trackUsage = _await$asyncStorage$m26[1], - _await$asyncStorage$m27 = _slicedToArray(_await$asyncStorage$m22[4], 2), - autoUpdate = _await$asyncStorage$m27[1], - _await$asyncStorage$m28 = _slicedToArray(_await$asyncStorage$m22[5], 2), - documentDir = _await$asyncStorage$m28[1], - _await$asyncStorage$m29 = _slicedToArray(_await$asyncStorage$m22[6], 2), - encryptKey = _await$asyncStorage$m29[1]; - - return { - floatingSidebar: floatingSidebar === 'true' ? true : false, - seenTutorial: seenTutorial === 'true' ? true : false, - maxMonths: Object(_shared_util__WEBPACK_IMPORTED_MODULE_19__["stringToInteger"])(maxMonths || ''), - // Default to true - trackUsage: trackUsage == null || trackUsage === 'true' ? true : false, - autoUpdate: autoUpdate == null || autoUpdate === 'true' ? true : false, - documentDir: documentDir || getDefaultDocumentDir(), - keyId: encryptKey && JSON.parse(encryptKey).id - }; -}; - -handlers['save-prefs'] = async function (prefsToSet) { - let _prefs$getPrefs2 = _prefs__WEBPACK_IMPORTED_MODULE_4__["getPrefs"](), - cloudFileId = _prefs$getPrefs2.cloudFileId; // Need to sync the budget name on the server as well - - - if (prefsToSet.budgetName && cloudFileId) { - let userToken = await _platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_2___default.a.getItem('user-token'); - await Object(_post__WEBPACK_IMPORTED_MODULE_40__["post"])(Object(_server_config__WEBPACK_IMPORTED_MODULE_34__["getServer"])().SYNC_SERVER + '/update-user-filename', { - token: userToken, - fileId: cloudFileId, - name: prefsToSet.budgetName - }); - } - - await _prefs__WEBPACK_IMPORTED_MODULE_4__["savePrefs"](prefsToSet); - return 'ok'; -}; - -handlers['load-prefs'] = async function () { - return _prefs__WEBPACK_IMPORTED_MODULE_4__["getPrefs"](); -}; - -handlers['sync-reset'] = async function () { - return await Object(_sync__WEBPACK_IMPORTED_MODULE_29__["resetSync"])(); -}; - -handlers['sync-repair'] = async function () { - await Object(_sync__WEBPACK_IMPORTED_MODULE_29__["repairSync"])(); -}; // A user can only enable/change their key with the file loaded. This -// will change in the future: during onboarding the user should be -// able to enable encryption. (Imagine if they are importing data from -// another source, they should be able to encrypt first) - - -handlers['key-make'] = async function ({ - password -}) { - if (!_prefs__WEBPACK_IMPORTED_MODULE_4__["getPrefs"]()) { - throw new Error('user-set-key must be called with file loaded'); - } - - let cloudFileId = _prefs__WEBPACK_IMPORTED_MODULE_4__["getPrefs"]().cloudFileId; - let salt = _encryption__WEBPACK_IMPORTED_MODULE_38__["default"].randomBytes(32).toString('base64'); - let id = uuid.v4Sync(); - let key = await _encryption__WEBPACK_IMPORTED_MODULE_38__["default"].createKey({ - id, - password, - salt - }); // Load the key - - await _encryption__WEBPACK_IMPORTED_MODULE_38__["default"].loadKey(key); // Make some test data to use if the key is valid or not - - let testContent = await Object(_sync__WEBPACK_IMPORTED_MODULE_29__["makeTestMessage"])(key.getId()); // Changing your key necessitates a sync reset as well. This will - // clear all existing encrypted data from the server so you won't - // have a mix of data encrypted with different keys. - - return await Object(_sync__WEBPACK_IMPORTED_MODULE_29__["resetSync"])({ - key, - salt, - testContent: JSON.stringify(_objectSpread(_objectSpread({}, testContent), {}, { - value: testContent.value.toString('base64') - })) - }); -}; // This can be called both while a file is already loaded or not. This -// will see if a key is valid and if so save it off. - - -handlers['key-test'] = async function ({ - fileId, - password -}) { - let userToken = await _platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_2___default.a.getItem('user-token'); - - if (fileId == null) { - fileId = _prefs__WEBPACK_IMPORTED_MODULE_4__["getPrefs"]().cloudFileId; - } - - let res; - - try { - res = await Object(_post__WEBPACK_IMPORTED_MODULE_40__["post"])(Object(_server_config__WEBPACK_IMPORTED_MODULE_34__["getServer"])().SYNC_SERVER + '/user-get-key', { - token: userToken, - fileId - }); - } catch (e) { - console.log(e); - return { - error: { - reason: 'network' - } - }; - } - - let _res = res, - id = _res.id, - salt = _res.salt, - test = _res.test; - - if (test == null) { - return { - error: { - reason: 'old-key-style' - } - }; - } - - test = JSON.parse(test); - let key = await _encryption__WEBPACK_IMPORTED_MODULE_38__["default"].createKey({ - id, - password, - salt - }); - _encryption__WEBPACK_IMPORTED_MODULE_38__["default"].loadKey(key); - - try { - await _encryption__WEBPACK_IMPORTED_MODULE_38__["default"].decrypt(Buffer.from(test.value, 'base64'), test.meta); - } catch (e) { - console.log(e); // Unload the key, it's invalid - - _encryption__WEBPACK_IMPORTED_MODULE_38__["default"].unloadKey(key); - return { - error: { - reason: 'decrypt-failure' - } - }; - } // Persist key in async storage - - - let keys = JSON.parse((await _platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_2___default.a.getItem(`encrypt-keys`)) || '{}'); - keys[fileId] = key.serialize(); - await _platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_2___default.a.setItem('encrypt-keys', JSON.stringify(keys)); // Save the key id in prefs if the are loaded. If they aren't, we - // are testing a key to download a file and when the file is - // actually downloaded it will update the prefs with the latest key id - - if (_prefs__WEBPACK_IMPORTED_MODULE_4__["getPrefs"]()) { - await _prefs__WEBPACK_IMPORTED_MODULE_4__["savePrefs"]({ - encryptKeyId: key.getId() - }); - } - - return {}; -}; - -handlers['should-pitch-subscribe'] = async function () { - let seenSubscribe = await _platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_2___default.a.getItem('seenSubscribe'); - return seenSubscribe !== 'true'; -}; - -handlers['has-pitched-subscribe'] = async function () { - await _platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_2___default.a.setItem('seenSubscribe', 'true'); - return 'ok'; -}; - -handlers['subscribe-needs-bootstrap'] = async function ({ - url -} = {}) { - if (Object(_server_config__WEBPACK_IMPORTED_MODULE_34__["getServer"])(url).BASE_SERVER === UNCONFIGURED_SERVER) { - return { - bootstrapped: true - }; - } - - let res; - - try { - res = await Object(_post__WEBPACK_IMPORTED_MODULE_40__["get"])(Object(_server_config__WEBPACK_IMPORTED_MODULE_34__["getServer"])(url).SIGNUP_SERVER + '/needs-bootstrap'); - } catch (err) { - return { - error: 'network-failure' - }; - } - - try { - res = JSON.parse(res); - } catch (err) { - return { - error: 'parse-failure' - }; - } - - if (res.status === 'error') { - return { - error: res.reason - }; - } - - return { - bootstrapped: res.data.bootstrapped - }; -}; - -handlers['subscribe-bootstrap'] = async function ({ - password -}) { - let res; - - try { - res = await Object(_post__WEBPACK_IMPORTED_MODULE_40__["post"])(Object(_server_config__WEBPACK_IMPORTED_MODULE_34__["getServer"])().SIGNUP_SERVER + '/bootstrap', { - password - }); - } catch (err) { - return { - error: err.reason || 'network-failure' - }; - } - - if (res.token) { - await _platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_2___default.a.setItem('user-token', res.token); - return {}; - } - - return { - error: 'internal' - }; -}; - -handlers['subscribe-set-user'] = async function ({ - token -}) { - await _platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_2___default.a.setItem('user-token', token); -}; - -handlers['subscribe-get-user'] = async function () { - if (Object(_server_config__WEBPACK_IMPORTED_MODULE_34__["getServer"])() && Object(_server_config__WEBPACK_IMPORTED_MODULE_34__["getServer"])().BASE_SERVER === UNCONFIGURED_SERVER) { - return { - offline: false - }; - } - - let userToken = await _platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_2___default.a.getItem('user-token'); - - if (userToken) { - try { - let res = await Object(_post__WEBPACK_IMPORTED_MODULE_40__["get"])(Object(_server_config__WEBPACK_IMPORTED_MODULE_34__["getServer"])().SIGNUP_SERVER + '/validate', { - headers: { - 'X-ACTUAL-TOKEN': userToken - } - }); - res = JSON.parse(res); - - if (res.status === 'error') { - if (res.reason === 'unauthorized') { - return null; - } - - return { - offline: true - }; - } - - return { - offline: false - }; - } catch (e) { - console.log(e); - return { - offline: true - }; - } - } - - return null; -}; - -handlers['subscribe-change-password'] = async function ({ - password -}) { - let userToken = await _platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_2___default.a.getItem('user-token'); - let res; - - try { - res = await Object(_post__WEBPACK_IMPORTED_MODULE_40__["post"])(Object(_server_config__WEBPACK_IMPORTED_MODULE_34__["getServer"])().SIGNUP_SERVER + '/change-password', { - token: userToken, - password - }); - } catch (err) { - return { - error: err.reason || 'network-failure' - }; - } - - return {}; -}; - -handlers['subscribe-sign-in'] = async function ({ - password -}) { - let res = await Object(_post__WEBPACK_IMPORTED_MODULE_40__["post"])(Object(_server_config__WEBPACK_IMPORTED_MODULE_34__["getServer"])().SIGNUP_SERVER + '/login', { - password - }); - - if (res.token) { - await _platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_2___default.a.setItem('user-token', res.token); - return {}; - } - - return { - error: 'invalid-password' - }; -}; - -handlers['subscribe-sign-out'] = async function () { - _encryption__WEBPACK_IMPORTED_MODULE_38__["default"].unloadAllKeys(); - await _platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_2___default.a.multiRemove(['user-token', 'encrypt-keys', 'lastBudget', 'readOnly']); - return 'ok'; -}; - -handlers['get-server-url'] = async function () { - return Object(_server_config__WEBPACK_IMPORTED_MODULE_34__["getServer"])() && Object(_server_config__WEBPACK_IMPORTED_MODULE_34__["getServer"])().BASE_SERVER; -}; - -handlers['set-server-url'] = async function ({ - url -}) { - if (url != null) { - // Validate the server is running - let _await$runHandler = await Object(_mutators__WEBPACK_IMPORTED_MODULE_26__["runHandler"])(handlers['subscribe-needs-bootstrap'], { - url - }), - error = _await$runHandler.error; - - if (error) { - return { - error - }; - } - } else { - // When the server isn't configured, we just use a placeholder - url = UNCONFIGURED_SERVER; - } - - _platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_2___default.a.setItem('server-url', url); - Object(_server_config__WEBPACK_IMPORTED_MODULE_34__["setServer"])(url); - return {}; -}; - -handlers['sync'] = async function () { - return Object(_sync__WEBPACK_IMPORTED_MODULE_29__["fullSync"])(); -}; - -handlers['get-version'] = async function () { - return { - version: VERSION - }; -}; - -handlers['get-budgets'] = async function () { - const paths = await _platform_server_fs__WEBPACK_IMPORTED_MODULE_5___default.a.listDir(_platform_server_fs__WEBPACK_IMPORTED_MODULE_5___default.a.getDocumentDir()); - const budgets = (await Promise.all(paths.map(async name => { - const prefsPath = _platform_server_fs__WEBPACK_IMPORTED_MODULE_5___default.a.join(_platform_server_fs__WEBPACK_IMPORTED_MODULE_5___default.a.getDocumentDir(), name, 'metadata.json'); - - if (await _platform_server_fs__WEBPACK_IMPORTED_MODULE_5___default.a.exists(prefsPath)) { - let prefs; - - try { - prefs = JSON.parse(await _platform_server_fs__WEBPACK_IMPORTED_MODULE_5___default.a.readFile(prefsPath)); - } catch (e) { - console.log('Error parsing metadata:', e.stack); - return; - } // We treat the directory name as the canonical id so that if - // the user moves it around/renames/etc, nothing breaks. The - // id is stored in prefs just for convenience (and the prefs - // will always update to the latest given id) - - - if (name !== DEMO_BUDGET_ID) { - return { - id: name, - cloudFileId: prefs.cloudFileId, - groupId: prefs.groupId, - name: prefs.budgetName || '(no name)' - }; - } - } - - return null; - }))).filter(x => x); - return budgets; -}; - -handlers['get-ynab4-files'] = async function () { - return YNAB4.findBudgets(); -}; - -handlers['get-remote-files'] = async function () { - return _cloud_storage__WEBPACK_IMPORTED_MODULE_37__["listRemoteFiles"](); -}; - -handlers['reset-budget-cache'] = Object(_mutators__WEBPACK_IMPORTED_MODULE_26__["mutator"])(async function () { - // Recomputing everything will update the cache - await _sheet__WEBPACK_IMPORTED_MODULE_10__["loadUserBudgets"](_db__WEBPACK_IMPORTED_MODULE_9__); - _sheet__WEBPACK_IMPORTED_MODULE_10__["get"]().recomputeAll(); - await _sheet__WEBPACK_IMPORTED_MODULE_10__["waitOnSpreadsheet"](); -}); - -handlers['upload-budget'] = async function ({ - id -} = {}) { - if (id) { - if (_prefs__WEBPACK_IMPORTED_MODULE_4__["getPrefs"]()) { - throw new Error('upload-budget: id given but prefs already loaded'); - } - - await _prefs__WEBPACK_IMPORTED_MODULE_4__["loadPrefs"](id); - } - - try { - await _cloud_storage__WEBPACK_IMPORTED_MODULE_37__["upload"](); - } catch (e) { - console.log(e); - - if (e.type === 'FileUploadError') { - return { - error: e - }; - } - - Object(_platform_exceptions__WEBPACK_IMPORTED_MODULE_3__["captureException"])(e); - return { - error: { - reason: 'internal' - } - }; - } finally { - if (id) { - _prefs__WEBPACK_IMPORTED_MODULE_4__["unloadPrefs"](); - } - } - - return {}; -}; - -handlers['download-budget'] = async function ({ - fileId, - replace -}) { - let result; - - try { - result = await _cloud_storage__WEBPACK_IMPORTED_MODULE_37__["download"](fileId, replace); - } catch (e) { - if (e.type === 'FileDownloadError') { - if (e.reason === 'file-exists' && e.meta.id) { - await _prefs__WEBPACK_IMPORTED_MODULE_4__["loadPrefs"](e.meta.id); - let name = _prefs__WEBPACK_IMPORTED_MODULE_4__["getPrefs"]().budgetName; - _prefs__WEBPACK_IMPORTED_MODULE_4__["unloadPrefs"](); - e.meta = _objectSpread(_objectSpread({}, e.meta), {}, { - name - }); - } - - return { - error: e - }; - } else { - Object(_platform_exceptions__WEBPACK_IMPORTED_MODULE_3__["captureException"])(e); - return { - error: { - reason: 'internal' - } - }; - } - } - - let id = result.id; // Load the budget and do a full sync - - result = await loadBudget(result.id, VERSION, { - showUpdate: true - }); - - if (result.error) { - return { - error: { - reason: result.error - } - }; - } - - Object(_sync__WEBPACK_IMPORTED_MODULE_29__["setSyncingMode"])('enabled'); - await Object(_sync__WEBPACK_IMPORTED_MODULE_29__["initialFullSync"])(); - await handlers['close-budget'](); - return { - id - }; -}; - -handlers['load-budget'] = async function ({ - id -}) { - let currentPrefs = _prefs__WEBPACK_IMPORTED_MODULE_4__["getPrefs"](); - - if (currentPrefs) { - if (currentPrefs.id === id) { - // If it's already loaded, do nothing - return {}; - } else { - // Otherwise, close the currently loaded budget - await handlers['close-budget'](); - } - } - - let res = await loadBudget(id, VERSION, { - showUpdate: true - }); - - async function trackSizes() { - let getFileSize = async name => { - let dbFile = _platform_server_fs__WEBPACK_IMPORTED_MODULE_5___default.a.join(_platform_server_fs__WEBPACK_IMPORTED_MODULE_5___default.a.getBudgetDir(id), name); - - try { - return await _platform_server_fs__WEBPACK_IMPORTED_MODULE_5___default.a.size(dbFile); - } catch (err) { - return null; - } - }; - - try { - let dbSize = await getFileSize('db.sqlite'); - let cacheSize = await getFileSize('cache.sqlite'); - _tracking_events__WEBPACK_IMPORTED_MODULE_39__["track"]('app:load-budget', { - size: dbSize, - cacheSize - }); - } catch (err) { - console.warn(err); - } - } - - trackSizes(); - return res; -}; - -handlers['create-demo-budget'] = async function () { - // Make sure the read only flag isn't leftover (normally it's - // reset when signing in, but you don't have to sign in for the - // demo budget) - await _platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_2___default.a.setItem('readOnly', ''); - return handlers['create-budget']({ - budgetName: 'Demo Budget', - testMode: true, - testBudgetId: DEMO_BUDGET_ID - }); -}; - -handlers['close-budget'] = async function () { - Object(_platform_exceptions__WEBPACK_IMPORTED_MODULE_3__["captureBreadcrumb"])({ - message: 'Closing budget' - }); // The spreadsheet may be running, wait for it to complete - - await _sheet__WEBPACK_IMPORTED_MODULE_10__["waitOnSpreadsheet"](); - _sheet__WEBPACK_IMPORTED_MODULE_10__["unloadSpreadsheet"](); - Object(_sync__WEBPACK_IMPORTED_MODULE_29__["clearFullSyncTimeout"])(); - await _main_app__WEBPACK_IMPORTED_MODULE_45__["default"].stopServices(); - await _db__WEBPACK_IMPORTED_MODULE_9__["closeDatabase"](); - - try { - await _platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_2___default.a.setItem('lastBudget', ''); - } catch (e) {// This might fail if we are shutting down after failing to load a - // budget. We want to unload whatever has already been loaded but - // be resilient to anything failing - } - - _prefs__WEBPACK_IMPORTED_MODULE_4__["unloadPrefs"](); - Object(_backups__WEBPACK_IMPORTED_MODULE_18__["stopBackupService"])(); - return 'ok'; -}; - -handlers['delete-budget'] = async function ({ - id, - cloudFileId -}) { - // If it's a cloud file, you can delete it from the server by - // passing its cloud id - if (cloudFileId && !process.env.IS_BETA) { - await _cloud_storage__WEBPACK_IMPORTED_MODULE_37__["removeFile"](cloudFileId).catch(err => {}); - } // If a local file exists, you can delete it by passing its local id - - - if (id) { - let budgetDir = _platform_server_fs__WEBPACK_IMPORTED_MODULE_5___default.a.getBudgetDir(id); - await _platform_server_fs__WEBPACK_IMPORTED_MODULE_5___default.a.removeDirRecursively(budgetDir); - } - - return 'ok'; -}; - -handlers['create-budget'] = async function ({ - budgetName, - avoidUpload, - testMode, - testBudgetId -} = {}) { - let id; - - if (testMode) { - budgetName = budgetName || 'Test Budget'; - id = testBudgetId || TEST_BUDGET_ID; - - if (await _platform_server_fs__WEBPACK_IMPORTED_MODULE_5___default.a.exists(_platform_server_fs__WEBPACK_IMPORTED_MODULE_5___default.a.getBudgetDir(id))) { - await _platform_server_fs__WEBPACK_IMPORTED_MODULE_5___default.a.removeDirRecursively(_platform_server_fs__WEBPACK_IMPORTED_MODULE_5___default.a.getBudgetDir(id)); - } - } else { - // Generate budget name if not given - if (!budgetName) { - // Unfortunately we need to load all of the existing files first - // so we can detect conflicting names. - let files = await handlers['get-budgets'](); - budgetName = await Object(_util_budget_name__WEBPACK_IMPORTED_MODULE_25__["uniqueFileName"])(files); - } - - id = await Object(_util_budget_name__WEBPACK_IMPORTED_MODULE_25__["idFromFileName"])(budgetName); - } - - let budgetDir = _platform_server_fs__WEBPACK_IMPORTED_MODULE_5___default.a.getBudgetDir(id); - await _platform_server_fs__WEBPACK_IMPORTED_MODULE_5___default.a.mkdir(budgetDir); // Create the initial database - - await _platform_server_fs__WEBPACK_IMPORTED_MODULE_5___default.a.copyFile(_platform_server_fs__WEBPACK_IMPORTED_MODULE_5___default.a.bundledDatabasePath, _platform_server_fs__WEBPACK_IMPORTED_MODULE_5___default.a.join(budgetDir, 'db.sqlite')); // Create the initial prefs file - - await _platform_server_fs__WEBPACK_IMPORTED_MODULE_5___default.a.writeFile(_platform_server_fs__WEBPACK_IMPORTED_MODULE_5___default.a.join(budgetDir, 'metadata.json'), JSON.stringify(_prefs__WEBPACK_IMPORTED_MODULE_4__["getDefaultPrefs"](id, budgetName))); // Load it in - - let _await$loadBudget = await loadBudget(id, VERSION), - error = _await$loadBudget.error; - - if (error) { - console.log('Error creating budget: ' + error); - return { - error - }; - } - - if (!avoidUpload && !testMode) { - try { - await _cloud_storage__WEBPACK_IMPORTED_MODULE_37__["upload"](); - } catch (e) {// Ignore any errors uploading. If they are offline they should - // still be able to create files. - } - } - - if (testMode) { - await Object(_mocks_budget__WEBPACK_IMPORTED_MODULE_42__["createTestBudget"])(handlers); - } - - return {}; -}; - -handlers['set-tutorial-seen'] = async function () { - await _platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_2___default.a.setItem('seen-tutorial', 'true'); - return 'ok'; -}; - -handlers['import-budget'] = async function ({ - filepath, - type -}) { - try { - if (!(await _platform_server_fs__WEBPACK_IMPORTED_MODULE_5___default.a.exists(filepath))) { - throw new Error(`File not found at the provided path: ${filepath}`); - } - - let buffer = Buffer.from(await _platform_server_fs__WEBPACK_IMPORTED_MODULE_5___default.a.readFile(filepath, 'binary')); - - switch (type) { - case 'ynab4': - try { - await YNAB4.importBuffer(filepath, buffer); - } catch (e) { - let msg = e.message.toLowerCase(); - - if (msg.includes('not a ynab4') || msg.includes('could not find file')) { - return { - error: 'not-ynab4' - }; - } - } - - break; - - case 'ynab5': - let data; - - try { - data = JSON.parse(buffer.toString()); - } catch (e) { - return { - error: 'parse-error' - }; - } - - try { - await YNAB5.importYNAB5(data); - } catch (e) { - return { - error: 'not-ynab5' - }; - } - - break; - - case 'actual': - // We should pull out import/export into its own app so this - // can be abstracted out better. Importing Actual files is a - // special case because we can directly write down the files, - // but because it doesn't go through the API layer we need to - // duplicate some of the workflow - await handlers['close-budget'](); - - let _await$cloudStorage$i = await _cloud_storage__WEBPACK_IMPORTED_MODULE_37__["importBuffer"]({ - cloudFileId: null, - groupId: null - }, buffer), - id = _await$cloudStorage$i.id; // We never want to load cached data from imported files, so - // delete the cache - - - let sqliteDb = await _platform_server_sqlite__WEBPACK_IMPORTED_MODULE_6__["openDatabase"](_platform_server_fs__WEBPACK_IMPORTED_MODULE_5___default.a.join(_platform_server_fs__WEBPACK_IMPORTED_MODULE_5___default.a.getBudgetDir(id), 'db.sqlite')); - _platform_server_sqlite__WEBPACK_IMPORTED_MODULE_6__["execQuery"](sqliteDb, ` - DELETE FROM kvcache; - DELETE FROM kvcache_key; - `); - _platform_server_sqlite__WEBPACK_IMPORTED_MODULE_6__["closeDatabase"](sqliteDb); // Load the budget, force everything to be computed, and try - // to upload it as a cloud file - - await handlers['load-budget']({ - id - }); - await handlers['get-budget-bounds'](); - await _sheet__WEBPACK_IMPORTED_MODULE_10__["waitOnSpreadsheet"](); - await _cloud_storage__WEBPACK_IMPORTED_MODULE_37__["upload"]().catch(err => {}); - break; - - default: - } - } catch (err) { - err.message = 'Error importing budget: ' + err.message; - Object(_platform_exceptions__WEBPACK_IMPORTED_MODULE_3__["captureException"])(err); - return { - error: 'internal-error' - }; - } - - return {}; -}; - -handlers['export-budget'] = async function () { - return await _cloud_storage__WEBPACK_IMPORTED_MODULE_37__["exportBuffer"](); -}; - -async function loadBudget(id, appVersion, { - showUpdate -} = {}) { - let dir; - - try { - dir = _platform_server_fs__WEBPACK_IMPORTED_MODULE_5___default.a.getBudgetDir(id); - } catch (e) { - Object(_platform_exceptions__WEBPACK_IMPORTED_MODULE_3__["captureException"])(new Error('`getBudgetDir` failed in `loadBudget`: ' + e.message)); - return { - error: 'budget-not-found' - }; - } - - Object(_platform_exceptions__WEBPACK_IMPORTED_MODULE_3__["captureBreadcrumb"])({ - message: 'Loading budget ' + dir - }); - - if (!(await _platform_server_fs__WEBPACK_IMPORTED_MODULE_5___default.a.exists(dir))) { - Object(_platform_exceptions__WEBPACK_IMPORTED_MODULE_3__["captureException"])(new Error('budget directory does not exist')); - return { - error: 'budget-not-found' - }; - } - - try { - await _prefs__WEBPACK_IMPORTED_MODULE_4__["loadPrefs"](id); - await _db__WEBPACK_IMPORTED_MODULE_9__["openDatabase"](id); - } catch (e) { - Object(_platform_exceptions__WEBPACK_IMPORTED_MODULE_3__["captureBreadcrumb"])({ - message: 'Error loading budget ' + id - }); - Object(_platform_exceptions__WEBPACK_IMPORTED_MODULE_3__["captureException"])(e); - await handlers['close-budget'](); - return { - error: 'opening-budget' - }; - } // Older versions didn't tag the file with the current user, so do - // so now - - - if (!_prefs__WEBPACK_IMPORTED_MODULE_4__["getPrefs"]().userId) { - let _await$asyncStorage$m30 = await _platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_2___default.a.multiGet(['user-token']), - _await$asyncStorage$m31 = _slicedToArray(_await$asyncStorage$m30, 1), - _await$asyncStorage$m32 = _slicedToArray(_await$asyncStorage$m31[0], 2), - userId = _await$asyncStorage$m32[1]; - - _prefs__WEBPACK_IMPORTED_MODULE_4__["savePrefs"]({ - userId - }); - } - - let _prefs$getPrefs3 = _prefs__WEBPACK_IMPORTED_MODULE_4__["getPrefs"](), - budgetVersion = _prefs$getPrefs3.budgetVersion, - budgetId = _prefs$getPrefs3.budgetId; - - try { - await Object(_update__WEBPACK_IMPORTED_MODULE_12__["updateVersion"])(budgetVersion, showUpdate); - } catch (e) { - console.warn('Error updating', e); - let result; - - if (e.message.includes('out-of-sync-migrations')) { - result = { - error: 'out-of-sync-migrations' - }; - } else if (e.message.includes('out-of-sync-data')) { - result = { - error: 'out-of-sync-data' - }; - } else { - Object(_platform_exceptions__WEBPACK_IMPORTED_MODULE_3__["captureException"])(e); - _platform_server_log__WEBPACK_IMPORTED_MODULE_7__["default"].info('Error updating budget ' + id, e); - console.log('Error updating budget', e); - result = { - error: 'loading-budget' - }; - } - - await handlers['close-budget'](); - return result; - } - - await _db__WEBPACK_IMPORTED_MODULE_9__["loadClock"](); - - if (_prefs__WEBPACK_IMPORTED_MODULE_4__["getPrefs"]().resetClock) { - // If we need to generate a fresh clock, we need to generate a new - // client id. This happens when the database is transferred to a - // new device. - // - // TODO: The client id should be stored elsewhere. It shouldn't - // work this way, but it's fine for now. - _timestamp__WEBPACK_IMPORTED_MODULE_27__["getClock"]().timestamp.setNode(_timestamp__WEBPACK_IMPORTED_MODULE_27__["makeClientId"]()); - await _db__WEBPACK_IMPORTED_MODULE_9__["runQuery"]('INSERT OR REPLACE INTO messages_clock (id, clock) VALUES (1, ?)', [_timestamp__WEBPACK_IMPORTED_MODULE_27__["serializeClock"](_timestamp__WEBPACK_IMPORTED_MODULE_27__["getClock"]())]); - await _prefs__WEBPACK_IMPORTED_MODULE_4__["savePrefs"]({ - resetClock: false - }); - } - - if (!_platform__WEBPACK_IMPORTED_MODULE_8__["default"].isWeb && !_platform__WEBPACK_IMPORTED_MODULE_8__["default"].isMobile && !global.__TESTING__) { - Object(_backups__WEBPACK_IMPORTED_MODULE_18__["startBackupService"])(id); - } - - try { - await _sheet__WEBPACK_IMPORTED_MODULE_10__["loadSpreadsheet"](_db__WEBPACK_IMPORTED_MODULE_9__, onSheetChange); - } catch (e) { - Object(_platform_exceptions__WEBPACK_IMPORTED_MODULE_3__["captureException"])(e); - await handlers['close-budget'](); - return { - error: 'opening-budget' - }; - } // This is a bit leaky, but we need to set the initial budget type - - - _sheet__WEBPACK_IMPORTED_MODULE_10__["get"]().meta().budgetType = _prefs__WEBPACK_IMPORTED_MODULE_4__["getPrefs"]().budgetType; - await _budget_base__WEBPACK_IMPORTED_MODULE_22__["createAllBudgets"](); // Load all the in-memory state - - await _db_mappings__WEBPACK_IMPORTED_MODULE_15__["loadMappings"](); - await _accounts_transaction_rules__WEBPACK_IMPORTED_MODULE_14__["loadRules"](); - await _sync_migrate__WEBPACK_IMPORTED_MODULE_30__["listen"](); - await _main_app__WEBPACK_IMPORTED_MODULE_45__["default"].startServices(); - Object(_undo__WEBPACK_IMPORTED_MODULE_11__["clearUndo"])(); // Ensure that syncing is enabled - - if (!global.__TESTING__) { - if (process.env.IS_BETA || id === DEMO_BUDGET_ID) { - Object(_sync__WEBPACK_IMPORTED_MODULE_29__["setSyncingMode"])('disabled'); - } else if (id === TEST_BUDGET_ID) { - await _platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_2___default.a.setItem('lastBudget', id); - } else { - Object(_sync__WEBPACK_IMPORTED_MODULE_29__["setSyncingMode"])('enabled'); - await _platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_2___default.a.setItem('lastBudget', id); // Only upload periodically on desktop - - if (!_platform__WEBPACK_IMPORTED_MODULE_8__["default"].isMobile) { - await _cloud_storage__WEBPACK_IMPORTED_MODULE_37__["possiblyUpload"](); - } - } - } - - _main_app__WEBPACK_IMPORTED_MODULE_45__["default"].events.emit('load-budget', { - id - }); - return {}; -} - -handlers['get-upgrade-notifications'] = async function () { - let _prefs$getPrefs4 = _prefs__WEBPACK_IMPORTED_MODULE_4__["getPrefs"](), - id = _prefs$getPrefs4.id; - - if (id === TEST_BUDGET_ID || id === DEMO_BUDGET_ID) { - return []; - } - - let types = ['schedules', 'repair-splits']; - let unseen = []; - - for (let type of types) { - let key = `notifications.${type}`; - - if (_prefs__WEBPACK_IMPORTED_MODULE_4__["getPrefs"]()[key] == null) { - unseen.push(type); - } - } - - return unseen; -}; - -handlers['seen-upgrade-notification'] = async function ({ - type -}) { - let key = `notifications.${type}`; - _prefs__WEBPACK_IMPORTED_MODULE_4__["savePrefs"]({ - [key]: true - }); -}; - -handlers['upload-file-web'] = async function ({ - filename, - contents -}) { - if (!_platform__WEBPACK_IMPORTED_MODULE_8__["default"].isWeb) { - return null; - } - - await _platform_server_fs__WEBPACK_IMPORTED_MODULE_5___default.a.writeFile('/uploads/' + filename, contents); - return 'ok'; -}; - -handlers['backups-get'] = async function ({ - id -}) { - return Object(_backups__WEBPACK_IMPORTED_MODULE_18__["getAvailableBackups"])(id); -}; - -handlers['backup-load'] = async function ({ - id, - backupId -}) { - await Object(_backups__WEBPACK_IMPORTED_MODULE_18__["loadBackup"])(id, backupId); -}; - -handlers['backup-make'] = async function ({ - id -}) { - await Object(_backups__WEBPACK_IMPORTED_MODULE_18__["makeBackup"])(id); -}; - -handlers['get-last-opened-backup'] = async function () { - const id = await _platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_2___default.a.getItem('lastBudget'); - - if (id && id !== '') { - const budgetDir = _platform_server_fs__WEBPACK_IMPORTED_MODULE_5___default.a.getBudgetDir(id); // We never want to give back a budget that does not exist on the - // filesystem anymore, so first check that it exists - - if (await _platform_server_fs__WEBPACK_IMPORTED_MODULE_5___default.a.exists(budgetDir)) { - return id; - } - } - - return null; -}; - -handlers['app-focused'] = async function () { - if (_prefs__WEBPACK_IMPORTED_MODULE_4__["getPrefs"]() && _prefs__WEBPACK_IMPORTED_MODULE_4__["getPrefs"]().id) { - // First we sync - Object(_sync__WEBPACK_IMPORTED_MODULE_29__["fullSync"])(); - } -}; - -handlers['track'] = async function ({ - name, - props -}) { - _tracking_events__WEBPACK_IMPORTED_MODULE_39__["track"](name, props); -}; - -handlers = Object(_api__WEBPACK_IMPORTED_MODULE_35__["default"])(handlers); - -_actual_app_api_injected__WEBPACK_IMPORTED_MODULE_36___default.a.send = (name, args) => Object(_mutators__WEBPACK_IMPORTED_MODULE_26__["runHandler"])(_main_app__WEBPACK_IMPORTED_MODULE_45__["default"].handlers[name], args); // A hack for now until we clean up everything - - -_main_app__WEBPACK_IMPORTED_MODULE_45__["default"].handlers = handlers; -_main_app__WEBPACK_IMPORTED_MODULE_45__["default"].combine(_schedules_app__WEBPACK_IMPORTED_MODULE_46__["default"], _budget_app__WEBPACK_IMPORTED_MODULE_47__["default"], _notes_app__WEBPACK_IMPORTED_MODULE_48__["default"], _tools_app__WEBPACK_IMPORTED_MODULE_49__["default"]); - -function getDefaultDocumentDir() { - if (_platform__WEBPACK_IMPORTED_MODULE_8__["default"].isMobile) { - // On mobile, unfortunately we need to be backwards compatible - // with the old folder structure which does not store files inside - // of an `Actual` directory. In the future, if we really care, we - // can migrate them, but for now just return the documents dir - return process.env.ACTUAL_DOCUMENT_DIR; - } - - return _platform_server_fs__WEBPACK_IMPORTED_MODULE_5___default.a.join(process.env.ACTUAL_DOCUMENT_DIR, 'Actual'); -} - -async function setupDocumentsDir() { - async function ensureExists(dir) { - // Make sure the document folder exists - if (!(await _platform_server_fs__WEBPACK_IMPORTED_MODULE_5___default.a.exists(dir))) { - await _platform_server_fs__WEBPACK_IMPORTED_MODULE_5___default.a.mkdir(dir); - } - } - - let documentDir = await _platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_2___default.a.getItem('document-dir'); // Test the existing documents directory to make sure it's a valid - // path that exists, and if it errors fallback to the default one - - if (documentDir) { - try { - await ensureExists(documentDir); - } catch (e) { - documentDir = null; - } - } - - if (!documentDir) { - documentDir = getDefaultDocumentDir(); - } - - await ensureExists(documentDir); - - _platform_server_fs__WEBPACK_IMPORTED_MODULE_5___default.a._setDocumentDir(documentDir); -} - -async function initApp(version, isDev, socketName) { - VERSION = version; - await _platform_server_sqlite__WEBPACK_IMPORTED_MODULE_6__["init"](); - await Promise.all([_platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_2___default.a.init(), _platform_server_fs__WEBPACK_IMPORTED_MODULE_5___default.a.init()]); - await _tracking_events__WEBPACK_IMPORTED_MODULE_39__["init"](); - await setupDocumentsDir(); - let keysStr = await _platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_2___default.a.getItem('encrypt-keys'); - - if (keysStr) { - try { - let keys = JSON.parse(keysStr); // Load all the keys - - await Promise.all(Object.keys(keys).map(fileId => { - return _encryption__WEBPACK_IMPORTED_MODULE_38__["default"].loadKey(keys[fileId]); - })); - } catch (e) { - console.log('Error loading key', e); - throw new Error('load-key-error'); - } - } - - if (isDev) { - const lastBudget = await _platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_2___default.a.getItem('lastBudget'); // if (lastBudget) { - // loadBudget(lastBudget, VERSION); - // } - } - - const url = await _platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_2___default.a.getItem('server-url'); - - if (url) { - Object(_server_config__WEBPACK_IMPORTED_MODULE_34__["setServer"])(url); - } - - connection.init(socketName, _main_app__WEBPACK_IMPORTED_MODULE_45__["default"].handlers); - _tracking_events__WEBPACK_IMPORTED_MODULE_39__["track"]('app:init', { - platform: _platform__WEBPACK_IMPORTED_MODULE_8__["default"].isMobile ? 'mobile' : _platform__WEBPACK_IMPORTED_MODULE_8__["default"].isWeb ? 'web' : 'desktop' - }); - - if (!isDev && !_platform__WEBPACK_IMPORTED_MODULE_8__["default"].isMobile && !_platform__WEBPACK_IMPORTED_MODULE_8__["default"].isWeb) { - let autoUpdate = await _platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_2___default.a.getItem('auto-update'); - process.send({ - type: 'shouldAutoUpdate', - flag: autoUpdate == null || autoUpdate === 'true' - }); - } - - if (isDev || process.env.IS_BETA) { - global.$send = (name, args) => Object(_mutators__WEBPACK_IMPORTED_MODULE_26__["runHandler"])(_main_app__WEBPACK_IMPORTED_MODULE_45__["default"].handlers[name], args); - - global.$query = _aql_schema_run_query__WEBPACK_IMPORTED_MODULE_43__["runQuery"]; - global.$q = _shared_query__WEBPACK_IMPORTED_MODULE_44__["default"]; - global.$db = _db__WEBPACK_IMPORTED_MODULE_9__; - global.$setSyncingMode = _sync__WEBPACK_IMPORTED_MODULE_29__["setSyncingMode"]; - } -} -async function init({ - budgetId, - config -}) { - // Get from build - // eslint-disable-next-line - VERSION = "0.0.147"; - let dataDir, serverURL; - - if (config) { - dataDir = config.dataDir; - serverURL = config.serverURL; - } else { - dataDir = process.env.ACTUAL_DATA_DIR; - serverURL = process.env.ACTUAL_SERVER_URL; - } - - await _platform_server_sqlite__WEBPACK_IMPORTED_MODULE_6__["init"](); - await Promise.all([_platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_2___default.a.init({ - persist: false - }), _platform_server_fs__WEBPACK_IMPORTED_MODULE_5___default.a.init()]); - - _platform_server_fs__WEBPACK_IMPORTED_MODULE_5___default.a._setDocumentDir(dataDir || process.cwd()); - - if (serverURL) { - Object(_server_config__WEBPACK_IMPORTED_MODULE_34__["setServer"])(serverURL); - } else { - // This turns off all server URLs. In this mode we don't want any - // access to the server, we are doing things locally - Object(_server_config__WEBPACK_IMPORTED_MODULE_34__["setServer"])(null); - _main_app__WEBPACK_IMPORTED_MODULE_45__["default"].events.on('load-budget', () => { - Object(_sync__WEBPACK_IMPORTED_MODULE_29__["setSyncingMode"])('offline'); - }); - } - - if (budgetId) { - await Object(_mutators__WEBPACK_IMPORTED_MODULE_26__["runHandler"])(handlers['load-budget'], { - id: budgetId - }); - } - - return lib; -} // Export a few things required for the platform - -const lib = { - getDataDir: _platform_server_fs__WEBPACK_IMPORTED_MODULE_5___default.a.getDataDir, - sendMessage: (msg, args) => connection.send(msg, args), - send: async (name, args) => { - let res = await Object(_mutators__WEBPACK_IMPORTED_MODULE_26__["runHandler"])(_main_app__WEBPACK_IMPORTED_MODULE_45__["default"].handlers[name], args); - return res; - }, - on: (name, func) => _main_app__WEBPACK_IMPORTED_MODULE_45__["default"].events.on(name, func), - syncAndReceiveMessages: _sync__WEBPACK_IMPORTED_MODULE_29__["syncAndReceiveMessages"], - q: _shared_query__WEBPACK_IMPORTED_MODULE_44__["default"], - db: _db__WEBPACK_IMPORTED_MODULE_9__, - // Expose CRDT mechanisms so server can use them - merkle: _merkle__WEBPACK_IMPORTED_MODULE_28__, - timestamp: _timestamp__WEBPACK_IMPORTED_MODULE_27__, - SyncProtoBuf: SyncPb -}; - -if ( true && _platform__WEBPACK_IMPORTED_MODULE_8__["default"].isWeb) { - // Support reloading the backend - self.addEventListener('message', async e => { - if (e.data.type === '__actual:shutdown') { - await _sheet__WEBPACK_IMPORTED_MODULE_10__["waitOnSpreadsheet"](); - await _main_app__WEBPACK_IMPORTED_MODULE_45__["default"].stopServices(); - await _db__WEBPACK_IMPORTED_MODULE_9__["closeDatabase"](); - _platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_2___default.a.shutdown(); - _platform_server_fs__WEBPACK_IMPORTED_MODULE_5___default.a.shutdown(); - setTimeout(() => { - // Give everything else some time to process shutdown events - self.close(); - }, 100); - } - }); -} - -/***/ }), - -/***/ "./packages/loot-core/src/server/merkle.js": -/*!*************************************************!*\ - !*** ./packages/loot-core/src/server/merkle.js ***! - \*************************************************/ -/*! exports provided: getKeys, keyToTimestamp, insert, build, diff, prune, debug */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getKeys", function() { return getKeys; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "keyToTimestamp", function() { return keyToTimestamp; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "insert", function() { return insert; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "build", function() { return build; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "diff", function() { return diff; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "prune", function() { return prune; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "debug", function() { return debug; }); -// TODO: Ok, several problems: -// -// * If nothing matches between two merkle trees, we should fallback -// * to the last window instead the front one (use 0 instead of the -// * key) -// -// * Need to check to make sure if account exists when handling -// * transaction changes in syncing -function getKeys(trie) { - return Object.keys(trie).filter(x => x !== 'hash'); -} -function keyToTimestamp(key) { - // 16 is the length of the base 3 value of the current time in - // minutes. Ensure it's padded to create the full value - let fullkey = key + '0'.repeat(16 - key.length); // Parse the base 3 representation - - return parseInt(fullkey, 3) * 1000 * 60; -} -function insert(trie, timestamp) { - let hash = timestamp.hash(); - let key = Number(timestamp.millis() / 1000 / 60 | 0).toString(3); - trie = Object.assign({}, trie, { - hash: trie.hash ^ hash - }); - return insertKey(trie, key, hash); -} - -function insertKey(trie, key, hash) { - if (key.length === 0) { - return trie; - } - - const c = key[0]; - const n = trie[c] || {}; - return Object.assign({}, trie, { - [c]: Object.assign({}, n, insertKey(n, key.slice(1), hash), { - hash: n.hash ^ hash - }) - }); -} - -function build(timestamps) { - let trie = {}; - - for (let timestamp of timestamps) { - insert(trie, timestamp); - } - - return trie; -} -function diff(trie1, trie2) { - if (trie1.hash === trie2.hash) { - return null; - } - - let node1 = trie1; - let node2 = trie2; - let k = ''; // This loop will eventually stop when it traverses down to find - // where the hashes differ, or otherwise when there are no leaves - // left (this shouldn't happen, if that's the case the hash check at - // the top of this function should pass) - - while (1) { - let keyset = new Set([...getKeys(node1), ...getKeys(node2)]); - let keys = [...keyset.values()]; - keys.sort(); - let diffkey = null; // Traverse down the trie through keys that aren't the same. We - // traverse down the keys in order. Stop in two cases: either one - // of the nodes doesn't have the key, or a different key isn't - // found. For the former case, we have to that because pruning is - // lossy. We don't know if we've pruned off a changed key so we - // can't traverse down anymore. For the latter case, it means two - // things: either we've hit the bottom of the tree, or the changed - // key has been pruned off. In the latter case we have a "partial" - // key and will fill the rest with 0s. Note that if multiple older - // messages were added into one trie, it's possible we will - // generate a time that only encompasses *some* of the those - // messages. Pruning is lossy, and we traverse down the left-most - // changed time that we know of, because of pruning it might take - // multiple passes to sync up a trie. - - for (let i = 0; i < keys.length; i++) { - let key = keys[i]; - - if (!node1[key] || !node2[key]) { - break; - } - - let next1 = node1[key]; - let next2 = node2[key]; - - if (next1.hash !== next2.hash) { - diffkey = key; - break; - } - } - - if (!diffkey) { - return keyToTimestamp(k); - } - - k += diffkey; - node1 = node1[diffkey] || {}; - node2 = node2[diffkey] || {}; - } -} -function prune(trie, n = 2) { - // Do nothing if empty - if (!trie.hash) { - return trie; - } - - let keys = getKeys(trie); - keys.sort(); - let next = { - hash: trie.hash - }; - keys = keys.slice(-n).map(k => next[k] = prune(trie[k], n)); - return next; -} -function debug(trie, k = '', indent = 0) { - const str = ' '.repeat(indent) + (k !== '' ? `k: ${k} ` : '') + `hash: ${trie.hash || '(empty)'}\n`; - return str + getKeys(trie).map(key => { - return debug(trie[key], key, indent + 2); - }).join(''); -} - -/***/ }), - -/***/ "./packages/loot-core/src/server/migrate/migrations.js": -/*!*************************************************************!*\ - !*** ./packages/loot-core/src/server/migrate/migrations.js ***! - \*************************************************************/ -/*! exports provided: withMigrationsDir, getMigrationsDir, getUpMigration, getAppliedMigrations, getMigrationList, getPending, applyMigration, migrate */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "withMigrationsDir", function() { return withMigrationsDir; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getMigrationsDir", function() { return getMigrationsDir; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getUpMigration", function() { return getUpMigration; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getAppliedMigrations", function() { return getAppliedMigrations; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getMigrationList", function() { return getMigrationList; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getPending", function() { return getPending; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "applyMigration", function() { return applyMigration; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "migrate", function() { return migrate; }); -/* harmony import */ var _platform_server_fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../platform/server/fs */ "./packages/loot-core/src/platform/server/fs/index.electron.js"); -/* harmony import */ var _platform_server_fs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_platform_server_fs__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _platform_server_sqlite__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../platform/server/sqlite */ "./packages/loot-core/src/platform/server/sqlite/index.electron.js"); -/* harmony import */ var _migrations_1632571489012_remove_cache_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../migrations/1632571489012_remove_cache.js */ "./packages/loot-core/migrations/1632571489012_remove_cache.js"); - - // We have to bundle in JS migrations manually to avoid having to `eval` -// them which doesn't play well with CSP. There isn't great, and eventually -// we can remove this migration. - - - -const uuid = __webpack_require__(/*! ../../platform/uuid */ "./packages/loot-core/src/platform/uuid/index.electron.js"); - -let MIGRATIONS_DIR = _platform_server_fs__WEBPACK_IMPORTED_MODULE_0___default.a.migrationsPath; -let javascriptMigrations = { - 1632571489012: _migrations_1632571489012_remove_cache_js__WEBPACK_IMPORTED_MODULE_2__["default"] -}; -async function withMigrationsDir(dir, func) { - let oldDir = MIGRATIONS_DIR; - MIGRATIONS_DIR = dir; - await func(); - MIGRATIONS_DIR = oldDir; -} -function getMigrationsDir() { - return MIGRATIONS_DIR; -} - -function getMigrationId(name) { - return parseInt(name.match(/^(\d)+/)[0]); -} - -function getUpMigration(id, names) { - for (let m of names) { - if (getMigrationId(m) === id) { - return m; - } - } -} -async function getAppliedMigrations(db) { - const rows = await _platform_server_sqlite__WEBPACK_IMPORTED_MODULE_1__["runQuery"](db, 'SELECT * FROM __migrations__ ORDER BY id ASC', [], true); - return rows.map(row => row.id); -} -async function getMigrationList(migrationsDir) { - const files = await _platform_server_fs__WEBPACK_IMPORTED_MODULE_0___default.a.listDir(migrationsDir); - return files.filter(name => name.match(/(\.sql|\.js)$/)).sort((m1, m2) => { - const id1 = getMigrationId(m1); - const id2 = getMigrationId(m2); - - if (id1 < id2) { - return -1; - } else if (id1 > id2) { - return 1; - } - - return 0; - }); -} -function getPending(appliedIds, all) { - return all.filter(name => { - const id = getMigrationId(name); - return appliedIds.indexOf(id) === -1; - }); -} - -async function applyJavaScript(db, id) { - const dbInterface = { - runQuery: (query, params, fetchAll) => _platform_server_sqlite__WEBPACK_IMPORTED_MODULE_1__["runQuery"](db, query, params, fetchAll), - execQuery: query => _platform_server_sqlite__WEBPACK_IMPORTED_MODULE_1__["execQuery"](db, query), - transaction: func => _platform_server_sqlite__WEBPACK_IMPORTED_MODULE_1__["transaction"](db, func) - }; - - if (javascriptMigrations[id] == null) { - throw new Error('Could not find JS migration code to run for ' + id); - } - - let run = javascriptMigrations[id]; - return run(dbInterface, () => uuid.v4Sync()); -} - -async function applySql(db, sql) { - try { - await _platform_server_sqlite__WEBPACK_IMPORTED_MODULE_1__["execQuery"](db, sql); - } catch (e) { - console.log('Error applying sql:', sql); - throw e; - } -} - -async function applyMigration(db, name, migrationsDir) { - const code = await _platform_server_fs__WEBPACK_IMPORTED_MODULE_0___default.a.readFile(_platform_server_fs__WEBPACK_IMPORTED_MODULE_0___default.a.join(migrationsDir, name)); - - if (name.match(/\.js$/)) { - await applyJavaScript(db, getMigrationId(name)); - } else { - await applySql(db, code); - } - - await _platform_server_sqlite__WEBPACK_IMPORTED_MODULE_1__["runQuery"](db, 'INSERT INTO __migrations__ (id) VALUES (?)', [getMigrationId(name)]); -} - -function checkDatabaseValidity(appliedIds, available) { - for (let i = 0; i < appliedIds.length; i++) { - if (i >= available.length || appliedIds[i] !== getMigrationId(available[i])) { - throw new Error('out-of-sync-migrations'); - } - } -} - -async function migrate(db) { - let appliedIds = await getAppliedMigrations(db); - let available = await getMigrationList(MIGRATIONS_DIR); - checkDatabaseValidity(appliedIds, available); - const pending = getPending(appliedIds, available); - - for (let migration of pending) { - await applyMigration(db, migration, MIGRATIONS_DIR); - } - - return pending; -} - -/***/ }), - -/***/ "./packages/loot-core/src/server/models.js": -/*!*************************************************!*\ - !*** ./packages/loot-core/src/server/models.js ***! - \*************************************************/ -/*! exports provided: requiredFields, toDateRepr, fromDateRepr, accountModel, categoryModel, categoryGroupModel, payeeModel, payeeRuleModel, transactionModel */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "requiredFields", function() { return requiredFields; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "toDateRepr", function() { return toDateRepr; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fromDateRepr", function() { return fromDateRepr; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "accountModel", function() { return accountModel; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "categoryModel", function() { return categoryModel; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "categoryGroupModel", function() { return categoryGroupModel; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "payeeModel", function() { return payeeModel; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "payeeRuleModel", function() { return payeeRuleModel; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "transactionModel", function() { return transactionModel; }); -const _excluded = ["sort_order"], - _excluded2 = ["sort_order"]; - -function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } - -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } - -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 _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 _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 requiredFields(name, row, fields, update) { - fields.forEach(field => { - if (update) { - if (row.hasOwnProperty(field) && row[field] == null) { - throw new Error(`${name} is missing field ${field}`); - } - } else { - if (!row.hasOwnProperty(field) || row[field] == null) { - throw new Error(`${name} is missing field ${field}`); - } - } - }); -} -function toDateRepr(str) { - if (typeof str !== 'string') { - throw new Error('toDateRepr not passed a string: ' + str); - } - - return parseInt(str.replace(/-/g, '')); -} -function fromDateRepr(number) { - if (typeof number !== 'number') { - throw new Error('fromDateRepr not passed a number: ' + number); - } - - const dateString = number.toString(); - return dateString.slice(0, 4) + '-' + dateString.slice(4, 6) + '-' + dateString.slice(6); -} -const accountModel = { - validateAccountType(account) { - const type = account.type; - - if (type !== 'checking' && type !== 'savings' && type !== 'investment' && type !== 'credit' && type !== 'mortgage' && type !== 'debt' && type !== 'other') { - throw new Error('Invalid account type: ' + type); - } - }, - - validate(account, { - update - } = {}) { - if (!update || account.type != null) { - accountModel.validateAccountType(account); - } - - requiredFields('account', account, update ? ['name', 'type', 'offbudget', 'closed'] : ['name', 'type'], update); - return account; - } - -}; -const categoryModel = { - validate(category, { - update - } = {}) { - requiredFields('category', category, update ? ['name', 'is_income', 'cat_group'] : ['name', 'cat_group'], update); - - let sort_order = category.sort_order, - rest = _objectWithoutProperties(category, _excluded); - - return rest; - } - -}; -const categoryGroupModel = { - validate(categoryGroup, { - update - } = {}) { - requiredFields('categoryGroup', categoryGroup, update ? ['name', 'is_income'] : ['name'], update); - - let sort_order = categoryGroup.sort_order, - rest = _objectWithoutProperties(categoryGroup, _excluded2); - - return rest; - } - -}; -const payeeModel = { - validate(payee, { - update - } = {}) { - requiredFields('payee', payee, ['name'], update); - return payee; - } - -}; -const payeeRuleModel = { - validateType(rule) { - const type = rule.type; - - if (type !== 'equals' && type !== 'contains') { - throw new Error('Invalid rule type: ' + type); - } - }, - - validate(rule, { - update - } = {}) { - if (!update || 'type' in rule) { - payeeRuleModel.validateType(rule); - } - - requiredFields('payee_rules', rule, ['payee_id', 'type'], update); - return rule; - } - -}; -const transactionModel = { - validate(trans, { - update - } = {}) { - requiredFields('transaction', trans, ['date', 'acct'], update); - - if ('date' in trans) { - // Make sure it's the right format, and also do a sanity check. - // Really old dates can mess up the system and can happen by - // accident - if (trans.date.match(/^\d{4}-\d{2}-\d{2}$/) == null || trans.date < '2000-01-01') { - throw new Error('Invalid transaction date: ' + trans.date); - } - } - - return trans; - }, - - toJS(row) { - // Check a non-important field that typically wouldn't be passed in - // manually, and use it as a smoke test to see if this is a - // fully-formed transaction or not. - if (!('location' in row)) { - throw new Error('A full transaction is required to be passed to `toJS`. Instead got: ' + JSON.stringify(row)); - } - - let trans = _objectSpread({}, row); - - trans.error = row.error ? JSON.parse(row.error) : null; - trans.isParent = row.isParent === 1 ? true : false; - trans.isChild = row.isChild === 1 ? true : false; - trans.starting_balance_flag = row.starting_balance_flag === 1 ? true : false; - trans.cleared = row.cleared === 1 ? true : false; - trans.pending = row.pending === 1 ? true : false; - trans.date = trans.date && fromDateRepr(trans.date); - return trans; - }, - - fromJS(trans) { - let row = _objectSpread({}, trans); - - if ('error' in row) { - row.error = trans.error ? JSON.stringify(trans.error) : null; - } - - if ('isParent' in row) { - row.isParent = trans.isParent ? 1 : 0; - } - - if ('isChild' in row) { - row.isChild = trans.isChild ? 1 : 0; - } - - if ('cleared' in row) { - row.cleared = trans.cleared ? 1 : 0; - } - - if ('pending' in row) { - row.pending = trans.pending ? 1 : 0; - } - - if ('starting_balance_flag' in row) { - row.starting_balance_flag = trans.starting_balance_flag ? 1 : 0; - } - - if ('date' in row) { - row.date = toDateRepr(trans.date); - } - - return row; - } - -}; - -/***/ }), - -/***/ "./packages/loot-core/src/server/mutators.js": -/*!***************************************************!*\ - !*** ./packages/loot-core/src/server/mutators.js ***! - \***************************************************/ -/*! exports provided: mutator, isMutating, runHandler, enableGlobalMutations, disableGlobalMutations, runMutator, withMutatorContext, getMutatorContext */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "mutator", function() { return mutator; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isMutating", function() { return isMutating; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "runHandler", function() { return runHandler; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "enableGlobalMutations", function() { return enableGlobalMutations; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "disableGlobalMutations", function() { return disableGlobalMutations; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "runMutator", function() { return runMutator; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "withMutatorContext", function() { return withMutatorContext; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getMutatorContext", function() { return getMutatorContext; }); -/* harmony import */ var _shared_async__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../shared/async */ "./packages/loot-core/src/shared/async.js"); -/* harmony import */ var _platform_exceptions__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../platform/exceptions */ "./packages/loot-core/src/platform/exceptions/index.electron.js"); -function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } - -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } - -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; } - - - -let runningMethods = new Set(); -let currentContext = null; -let mutatingMethods = new WeakMap(); -let globalMutationsEnabled = false; -let _latestHandlerNames = []; -function mutator(handler) { - mutatingMethods.set(handler, true); - return handler; -} -function isMutating(handler) { - return mutatingMethods.has(handler); -} - -async function flushRunningMethods() { - // Give the client some time to invoke new requests - await wait(200); - - while (runningMethods.size > 0) { - // Wait for all of them - await Promise.all([...runningMethods.values()]); // We give clients more time to make other requests. This lets them continue - // to do an async workflow - - await wait(100); - } -} - -function wait(time) { - return new Promise(resolve => setTimeout(resolve, time)); -} - -async function runHandler(handler, args, { - undoTag, - name -} = {}) { - // For debug reasons, track the latest handlers that have been - // called - _latestHandlerNames.push(name); - - if (_latestHandlerNames.length > 5) { - _latestHandlerNames = _latestHandlerNames.slice(-5); - } - - if (mutatingMethods.has(handler)) { - return runMutator(() => handler(args), { - undoTag - }); - } // When closing a file, it clears out all global state for the file. That - // means any async workflows currently executed would be cut off. We handle - // this by letting all async workflows finish executing before closing the - // file - - - if (name === 'close-budget') { - await flushRunningMethods(); - } - - let promise = handler(args); - runningMethods.add(promise); - promise.then(() => { - runningMethods.delete(promise); - }); - return promise; -} // These are useful for tests. Only use them in tests. - -function enableGlobalMutations() { - if (global.__TESTING__) { - globalMutationsEnabled = true; - } -} -function disableGlobalMutations() { - if (global.__TESTING__) { - globalMutationsEnabled = false; - } -} -const runMutator = Object(_shared_async__WEBPACK_IMPORTED_MODULE_0__["sequential"])(async (func, initialContext = {}) => { - currentContext = initialContext; - return func().finally(() => { - currentContext = null; - }); -}); -function withMutatorContext(context, func) { - if (currentContext == null && !globalMutationsEnabled) { - Object(_platform_exceptions__WEBPACK_IMPORTED_MODULE_1__["captureBreadcrumb"])('Recent methods: ' + _latestHandlerNames.join(', ')); - Object(_platform_exceptions__WEBPACK_IMPORTED_MODULE_1__["captureException"])(new Error('withMutatorContext: mutator not running')); // See comment below. This is not an error right now, but it will - // be in the future. - - return func(); - } - - let prevContext = currentContext; - currentContext = _objectSpread(_objectSpread({}, currentContext), context); - return func().finally(() => { - currentContext = prevContext; - }); -} -function getMutatorContext() { - if (currentContext == null) { - Object(_platform_exceptions__WEBPACK_IMPORTED_MODULE_1__["captureBreadcrumb"])({ - category: 'server', - message: 'Recent methods: ' + _latestHandlerNames.join(', ') - }); // captureException(new Error('getMutatorContext: mutator not running')); - // For now, this is a non-fatal error. It will be in the future, - // but this is relatively non-critical (undo just won't work) so - // return an empty context. When we have more confidence that - // everything is running inside a mutator, throw an error. - - return {}; - } - - if (currentContext == null && globalMutationsEnabled) { - return {}; - } - - return currentContext; -} - -/***/ }), - -/***/ "./packages/loot-core/src/server/notes/app.js": -/*!****************************************************!*\ - !*** ./packages/loot-core/src/server/notes/app.js ***! - \****************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var _app__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../app */ "./packages/loot-core/src/server/app.js"); -/* harmony import */ var _db__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../db */ "./packages/loot-core/src/server/db/index.js"); - - -let app = Object(_app__WEBPACK_IMPORTED_MODULE_0__["createApp"])(); -app.method('notes-save', async ({ - id, - note -}) => { - await _db__WEBPACK_IMPORTED_MODULE_1__["update"]('notes', { - id, - note - }); -}); -/* harmony default export */ __webpack_exports__["default"] = (app); - -/***/ }), - -/***/ "./packages/loot-core/src/server/perf.js": -/*!***********************************************!*\ - !*** ./packages/loot-core/src/server/perf.js ***! - \***********************************************/ -/*! exports provided: reset, record, increment, start, stop */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "reset", function() { return reset; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "record", function() { return record; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "increment", function() { return increment; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "start", function() { return start; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "stop", function() { return stop; }); -let enabled = false; -let entries = {}; -let counters = {}; -function reset() { - entries = {}; - counters = {}; -} -function record(name) { - const start = Date.now(); - return () => unrecord(name, start); -} - -function unrecord(name, start) { - const end = Date.now(); - - if (enabled) { - if (entries[name] == null) { - entries[name] = []; - } - - entries[name].push(end - start); - } -} - -function increment(name) { - if (enabled) { - if (counters[name] == null) { - counters[name] = 0; - } - - counters[name]++; - } -} -function start() { - enabled = true; -} -function stop() { - enabled = false; - console.log('~~ PERFORMANCE REPORT ~~'); - - for (let name in entries) { - const records = entries[name]; - const total = records.reduce((total, n) => total + n / 1000, 0); - const avg = total / records.length; - console.log(`[${name}] count: ${records.length} total: ${total}s avg: ${avg}`); - } - - for (let name in counters) { - console.log(`[${name}] ${counters[name]}`); - } - - console.log('~~ END REPORT ~~'); - reset(); -} - -/***/ }), - -/***/ "./packages/loot-core/src/server/platform.js": -/*!***************************************************!*\ - !*** ./packages/loot-core/src/server/platform.js ***! - \***************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony default export */ __webpack_exports__["default"] = ({ - isMobile: false, - isWeb: false, - isDesktop: true -}); - -/***/ }), - -/***/ "./packages/loot-core/src/server/polyfills.js": -/*!****************************************************!*\ - !*** ./packages/loot-core/src/server/polyfills.js ***! - \****************************************************/ -/*! no static exports found */ -/***/ (function(module, exports) { - -// By default, no polyfills are installed - -/***/ }), - -/***/ "./packages/loot-core/src/server/post.js": -/*!***********************************************!*\ - !*** ./packages/loot-core/src/server/post.js ***! - \***********************************************/ -/*! exports provided: post, postBinary, get */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "post", function() { return post; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "postBinary", function() { return postBinary; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "get", function() { return get; }); -/* harmony import */ var _platform__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./platform */ "./packages/loot-core/src/server/platform.js"); -function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } - -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } - -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; } - - - -const _require = __webpack_require__(/*! ./errors */ "./packages/loot-core/src/server/errors.js"), - PostError = _require.PostError, - HTTPError = _require.HTTPError; - -const _require2 = __webpack_require__(/*! ../platform/server/fetch */ "./packages/loot-core/src/platform/server/fetch/index.electron.js"), - fetch = _require2.fetch; - -function throwIfNot200(res, text) { - if (res.status !== 200) { - if (res.status === 500) { - throw new PostError(res.status === 500 ? 'internal' : text); - } - - let contentType = res.headers.get('Content-Type'); - - if (contentType.toLowerCase().indexOf('application/json') !== -1) { - let json = JSON.parse(text); - throw new PostError(json.reason); - } - - throw new PostError(text); - } -} - -async function post(url, data) { - let text; - let res; - let s = new Error().stack; - - try { - res = await fetch(url, { - method: 'POST', - body: JSON.stringify(data), - headers: { - 'Content-Type': 'application/json' - } - }); - text = await res.text(); - } catch (err) { - throw new PostError('network-failure'); - } - - throwIfNot200(res, text); - - try { - res = JSON.parse(text); - } catch (err) { - // Something seriously went wrong. TODO handle errors - throw new PostError('parse-json', { - meta: text - }); - } - - if (res.status !== 'ok') { - console.log('API call failed: ' + url + '\nData: ' + JSON.stringify(data, null, 2) + '\nResponse: ' + JSON.stringify(res, null, 2)); - throw new PostError(res.description || res.reason || 'unknown'); - } - - return res.data; -} -async function postBinary(url, data, headers) { - let res; - - try { - res = await fetch(url, { - method: 'POST', - body: _platform__WEBPACK_IMPORTED_MODULE_0__["default"].isWeb ? data : Buffer.from(data), - headers: _objectSpread({ - 'Content-Length': data.length, - 'Content-Type': 'application/actual-sync' - }, headers) - }); - } catch (err) { - throw new PostError('network-failure'); - } - - let buffer; - - if (res.arrayBuffer) { - buffer = Buffer.from(await res.arrayBuffer()); - } else { - buffer = await res.buffer(); - } - - throwIfNot200(res, buffer.toString()); - return buffer; -} -function get(url, opts) { - return fetch(url, opts).then(res => res.text()); -} - -/***/ }), - -/***/ "./packages/loot-core/src/server/prefs.js": -/*!************************************************!*\ - !*** ./packages/loot-core/src/server/prefs.js ***! - \************************************************/ -/*! exports provided: loadPrefs, savePrefs, unloadPrefs, getPrefs, getDefaultPrefs, readPrefs */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "loadPrefs", function() { return loadPrefs; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "savePrefs", function() { return savePrefs; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "unloadPrefs", function() { return unloadPrefs; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getPrefs", function() { return getPrefs; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getDefaultPrefs", function() { return getDefaultPrefs; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "readPrefs", function() { return readPrefs; }); -/* harmony import */ var _sync__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./sync */ "./packages/loot-core/src/server/sync/index.js"); -/* harmony import */ var _timestamp__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./timestamp */ "./packages/loot-core/src/server/timestamp.js"); - - - -const fs = __webpack_require__(/*! ../platform/server/fs */ "./packages/loot-core/src/platform/server/fs/index.electron.js"); - -let prefs = null; -async function loadPrefs(id) { - if (global.__TESTING__ && !id) { - prefs = { - dummyTestPrefs: true - }; - return prefs; - } - - const fullpath = fs.join(fs.getBudgetDir(id), 'metadata.json'); - - try { - prefs = JSON.parse(await fs.readFile(fullpath)); - } catch (e) { - // If the user messed something up, be flexible and allow them to - // still load the budget database. Default the budget name to the - // id. - prefs = { - id, - budgetName: id - }; - } // No matter what is in `id` field, force it to be the current id. - // This makes it resilient to users moving around folders, etc - - - prefs.id = id; - return prefs; -} -async function savePrefs(prefsToSet, { - avoidSync = false -} = {}) { - Object.assign(prefs, prefsToSet); - - if (!avoidSync) { - // Sync whitelisted prefs - let messages = Object.keys(prefsToSet).map(key => { - if (key === 'budgetType' || key === 'budgetName') { - return { - dataset: 'prefs', - row: key, - column: 'value', - value: prefsToSet[key], - timestamp: _timestamp__WEBPACK_IMPORTED_MODULE_1__["default"].send() - }; - } - - return null; - }).filter(x => x); - - if (messages.length > 0) { - await Object(_sync__WEBPACK_IMPORTED_MODULE_0__["sendMessages"])(messages); - } - } - - if (!prefs.dummyTestPrefs) { - let prefsPath = fs.join(fs.getBudgetDir(prefs.id), 'metadata.json'); - await fs.writeFile(prefsPath, JSON.stringify(prefs)); - } -} -function unloadPrefs() { - prefs = null; -} -function getPrefs() { - return prefs; -} -function getDefaultPrefs(id, budgetName) { - // Add any notifications in here that new users shouldn't see. - // Without them, a popup will show to explain a new feature. - return { - id, - budgetName, - 'notifications.schedules': true, - 'notifications.repair-splits': true - }; -} -async function readPrefs(id) { - const fullpath = fs.join(fs.getBudgetDir(id), 'metadata.json'); - - try { - return JSON.parse(await fs.readFile(fullpath)); - } catch (e) { - return null; - } -} - -/***/ }), - -/***/ "./packages/loot-core/src/server/schedules/app.js": -/*!********************************************************!*\ - !*** ./packages/loot-core/src/server/schedules/app.js ***! - \********************************************************/ -/*! exports provided: updateConditions, getNextDate, getRuleForSchedule, fixRuleForSchedule, setNextDate, createSchedule, updateSchedule, deleteSchedule, skipNextDate, getPossibleTransactions, discoverSchedules, getUpcomingDates, advanceSchedulesService, default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "updateConditions", function() { return updateConditions; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getNextDate", function() { return getNextDate; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getRuleForSchedule", function() { return getRuleForSchedule; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fixRuleForSchedule", function() { return fixRuleForSchedule; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setNextDate", function() { return setNextDate; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createSchedule", function() { return createSchedule; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "updateSchedule", function() { return updateSchedule; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "deleteSchedule", function() { return deleteSchedule; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "skipNextDate", function() { return skipNextDate; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getPossibleTransactions", function() { return getPossibleTransactions; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "discoverSchedules", function() { return discoverSchedules; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getUpcomingDates", function() { return getUpcomingDates; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "advanceSchedulesService", function() { return advanceSchedulesService; }); -/* harmony import */ var deep_equal__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! deep-equal */ "./node_modules/deep-equal/index.js"); -/* harmony import */ var deep_equal__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(deep_equal__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var date_fns__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! date-fns */ "./node_modules/date-fns/esm/index.js"); -/* harmony import */ var _app__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../app */ "./packages/loot-core/src/server/app.js"); -/* harmony import */ var _db__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../db */ "./packages/loot-core/src/server/db/index.js"); -/* harmony import */ var _prefs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../prefs */ "./packages/loot-core/src/server/prefs.js"); -/* harmony import */ var _models__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../models */ "./packages/loot-core/src/server/models.js"); -/* harmony import */ var _aql_schema_run_query__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../aql/schema/run-query */ "./packages/loot-core/src/server/aql/schema/run-query.js"); -/* harmony import */ var _aql_compiler__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../aql/compiler */ "./packages/loot-core/src/server/aql/compiler.js"); -/* harmony import */ var _aql_schema__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../aql/schema */ "./packages/loot-core/src/server/aql/schema/index.js"); -/* harmony import */ var _shared_months__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../shared/months */ "./packages/loot-core/src/shared/months.js"); -/* harmony import */ var _shared_query__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../../shared/query */ "./packages/loot-core/src/shared/query.js"); -/* harmony import */ var _accounts_transaction_rules__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../accounts/transaction-rules */ "./packages/loot-core/src/server/accounts/transaction-rules.js"); -/* harmony import */ var _accounts_rules__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../accounts/rules */ "./packages/loot-core/src/server/accounts/rules.js"); -/* harmony import */ var _shared_schedules__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../../shared/schedules */ "./packages/loot-core/src/shared/schedules.js"); -/* harmony import */ var _mutators__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../mutators */ "./packages/loot-core/src/server/mutators.js"); -/* harmony import */ var _undo__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../undo */ "./packages/loot-core/src/server/undo.js"); -/* harmony import */ var _util_rschedule__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ../util/rschedule */ "./packages/loot-core/src/server/util/rschedule.js"); -/* harmony import */ var _sync__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ../sync */ "./packages/loot-core/src/server/sync/index.js"); -/* harmony import */ var _platform_exceptions__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ../../platform/exceptions */ "./packages/loot-core/src/platform/exceptions/index.electron.js"); -/* harmony import */ var _accounts_sync__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ../accounts/sync */ "./packages/loot-core/src/server/accounts/sync.js"); -/* harmony import */ var _find_schedules__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ./find-schedules */ "./packages/loot-core/src/server/schedules/find-schedules.js"); -const _excluded = ["type"]; - -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 _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 ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } - -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } - -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; } - - - - - - - - - - - - - - - - - - - - - - - -const connection = __webpack_require__(/*! ../../platform/server/connection */ "./packages/loot-core/src/platform/server/connection/index.api.js"); - -const uuid = __webpack_require__(/*! ../../platform/uuid */ "./packages/loot-core/src/platform/uuid/index.electron.js"); // Utilities - - -function zip(arr1, arr2) { - let result = []; - - for (let i = 0; i < arr1.length; i++) { - result.push([arr1[i], arr2[i]]); - } - - return result; -} - -function updateConditions(conditions, newConditions) { - let scheduleConds = Object(_shared_schedules__WEBPACK_IMPORTED_MODULE_13__["extractScheduleConds"])(conditions); - let newScheduleConds = Object(_shared_schedules__WEBPACK_IMPORTED_MODULE_13__["extractScheduleConds"])(newConditions); - let replacements = zip(Object.values(scheduleConds), Object.values(newScheduleConds)); - let updated = conditions.map(cond => { - let r = replacements.find(r => cond === r[0]); - return r && r[1] ? r[1] : cond; - }); - let added = replacements.filter(x => x[0] == null && x[1] != null).map(x => x[1]); - return updated.concat(added); -} -function getNextDate(dateCond, start = new Date()) { - start = date_fns__WEBPACK_IMPORTED_MODULE_1__["startOfDay"](start); - let cond = new _accounts_rules__WEBPACK_IMPORTED_MODULE_12__["Condition"](dateCond.op, 'date', dateCond.value, null, new Map(Object.entries({ - date: 'date' - }))); - let value = cond.getValue(); - - if (value.type === 'date') { - return value.date; - } else if (value.type === 'recur') { - let dates = value.schedule.occurrences({ - start, - take: 1 - }).toArray(); - - if (dates.length > 0) { - let date = dates[0].date; - return Object(_shared_months__WEBPACK_IMPORTED_MODULE_9__["dayFromDate"])(date); - } - } - - return null; -} -async function getRuleForSchedule(id) { - if (id == null) { - throw new Error('Schedule not attached to a rule'); - } - - let _await$aqlQuery = await Object(_aql_schema_run_query__WEBPACK_IMPORTED_MODULE_6__["runQuery"])(Object(_shared_query__WEBPACK_IMPORTED_MODULE_10__["default"])('schedules').filter({ - id - }).calculate('rule')), - ruleId = _await$aqlQuery.data; - - return Object(_accounts_transaction_rules__WEBPACK_IMPORTED_MODULE_11__["getRules"])().find(rule => rule.id === ruleId); -} -async function fixRuleForSchedule(id) { - let _await$aqlQuery2 = await Object(_aql_schema_run_query__WEBPACK_IMPORTED_MODULE_6__["runQuery"])(Object(_shared_query__WEBPACK_IMPORTED_MODULE_10__["default"])('schedules').filter({ - id - }).calculate('rule')), - ruleId = _await$aqlQuery2.data; - - if (ruleId) { - // Take the bad rule out of the system so it never causes problems - // in the future - await _db__WEBPACK_IMPORTED_MODULE_3__["delete_"]('rules', ruleId); - } - - let newId = await Object(_accounts_transaction_rules__WEBPACK_IMPORTED_MODULE_11__["insertRule"])({ - stage: null, - conditions: [{ - op: 'isapprox', - field: 'date', - value: Object(_shared_months__WEBPACK_IMPORTED_MODULE_9__["currentDay"])() - }, { - op: 'isapprox', - field: 'amount', - value: 0 - }], - actions: [{ - op: 'link-schedule', - value: id - }] - }); - await _db__WEBPACK_IMPORTED_MODULE_3__["updateWithSchema"]('schedules', { - id, - rule: newId - }); - return Object(_accounts_transaction_rules__WEBPACK_IMPORTED_MODULE_11__["getRules"])().find(rule => rule.id === newId); -} -async function setNextDate({ - id, - start, - conditions, - reset -}) { - if (conditions == null) { - let rule = await getRuleForSchedule(id); - - if (rule == null) { - throw new Error('No rule found for schedule'); - } - - conditions = rule.serialize().conditions; - } - - let _extractScheduleConds = Object(_shared_schedules__WEBPACK_IMPORTED_MODULE_13__["extractScheduleConds"])(conditions), - dateCond = _extractScheduleConds.date; - - let _await$aqlQuery3 = await Object(_aql_schema_run_query__WEBPACK_IMPORTED_MODULE_6__["runQuery"])(Object(_shared_query__WEBPACK_IMPORTED_MODULE_10__["default"])('schedules').filter({ - id - }).calculate('next_date')), - nextDate = _await$aqlQuery3.data; // Only do this if a date condition exists - - - if (dateCond) { - let newNextDate = getNextDate(dateCond, start ? start(nextDate) : new Date()); - - if (newNextDate !== nextDate) { - // Our `update` functon requires the id of the item and we don't - // have it, so we need to query it - let nd = await _db__WEBPACK_IMPORTED_MODULE_3__["first"]('SELECT id, base_next_date_ts FROM schedules_next_date WHERE schedule_id = ?', [id]); - await _db__WEBPACK_IMPORTED_MODULE_3__["update"]('schedules_next_date', reset ? { - id: nd.id, - base_next_date: Object(_models__WEBPACK_IMPORTED_MODULE_5__["toDateRepr"])(newNextDate), - base_next_date_ts: Date.now() - } : { - id: nd.id, - local_next_date: Object(_models__WEBPACK_IMPORTED_MODULE_5__["toDateRepr"])(newNextDate), - local_next_date_ts: nd.base_next_date_ts - }); - } - } -} // Methods - -async function createSchedule({ - schedule, - conditions = [] -} = {}) { - let scheduleId = schedule && schedule.id || uuid.v4Sync(); - - let _extractScheduleConds2 = Object(_shared_schedules__WEBPACK_IMPORTED_MODULE_13__["extractScheduleConds"])(conditions), - dateCond = _extractScheduleConds2.date; - - if (dateCond == null) { - throw new Error('A date condition is required to create a schedule'); - } - - if (dateCond.value == null) { - throw new Error('Date is required'); - } - - let nextDate = getNextDate(dateCond); - let nextDateRepr = nextDate ? Object(_models__WEBPACK_IMPORTED_MODULE_5__["toDateRepr"])(nextDate) : null; // Create the rule here based on the info - - let ruleId; - ruleId = await Object(_accounts_transaction_rules__WEBPACK_IMPORTED_MODULE_11__["insertRule"])({ - stage: null, - conditions, - actions: [{ - op: 'link-schedule', - value: scheduleId - }] - }); - let now = Date.now(); - let nextDateId = await _db__WEBPACK_IMPORTED_MODULE_3__["insertWithUUID"]('schedules_next_date', { - schedule_id: scheduleId, - local_next_date: nextDateRepr, - local_next_date_ts: now, - base_next_date: nextDateRepr, - base_next_date_ts: now - }); - let id = await _db__WEBPACK_IMPORTED_MODULE_3__["insertWithSchema"]('schedules', _objectSpread(_objectSpread({}, schedule), {}, { - id: scheduleId, - rule: ruleId - })); - return scheduleId; -} // TODO: don't allow deleting rules that link schedules - -async function updateSchedule({ - schedule, - conditions, - resetNextDate -}) { - if (schedule.rule) { - throw new Error('You cannot change the rule of a schedule'); - } // We need the rule if there are conditions - - - let rule; // This must be outside the `batchMessages` call because we change - // and then read data - - if (conditions) { - let _extractScheduleConds3 = Object(_shared_schedules__WEBPACK_IMPORTED_MODULE_13__["extractScheduleConds"])(conditions), - dateCond = _extractScheduleConds3.date; - - if (dateCond && dateCond.value == null) { - throw new Error('Date is required'); - } // We need to get the full rule to merge in the updated - // conditions - - - rule = await getRuleForSchedule(schedule.id); - - if (rule == null) { - // In the edge case that a rule gets corrupted (either by a bug in - // the system or user messing with their data), don't crash. We - // generate a new rule because schedules have to have a rule - // attached to them. - rule = await fixRuleForSchedule(schedule.id); - } - } - - await Object(_sync__WEBPACK_IMPORTED_MODULE_17__["batchMessages"])(async () => { - if (conditions) { - let oldConditions = rule.serialize().conditions; - let newConditions = updateConditions(oldConditions, conditions); - await Object(_accounts_transaction_rules__WEBPACK_IMPORTED_MODULE_11__["updateRule"])({ - id: rule.id, - conditions: newConditions - }); // Annoyingly, sometimes it has `type` and sometimes it doesn't - - let stripType = _ref => { - let type = _ref.type, - fields = _objectWithoutProperties(_ref, _excluded); - - return fields; - }; // Update `next_date` if the user forced it, or if the account - // or date changed. We check account because we don't update - // schedules automatically for closed account, and the user - // might switch accounts from a closed one - - - if (resetNextDate || !deep_equal__WEBPACK_IMPORTED_MODULE_0___default()(oldConditions.find(c => c.field === 'account'), oldConditions.find(c => c.field === 'account')) || !deep_equal__WEBPACK_IMPORTED_MODULE_0___default()(stripType(oldConditions.find(c => c.field === 'date')), stripType(newConditions.find(c => c.field === 'date')))) { - await setNextDate({ - id: schedule.id, - conditions: newConditions, - reset: true - }); - } - } else if (resetNextDate) { - await setNextDate({ - id: schedule.id, - reset: true - }); - } - - await _db__WEBPACK_IMPORTED_MODULE_3__["updateWithSchema"]('schedules', schedule); - }); -} -async function deleteSchedule({ - id -}) { - let _await$aqlQuery4 = await Object(_aql_schema_run_query__WEBPACK_IMPORTED_MODULE_6__["runQuery"])(Object(_shared_query__WEBPACK_IMPORTED_MODULE_10__["default"])('schedules').filter({ - id - }).calculate('rule')), - ruleId = _await$aqlQuery4.data; - - await Object(_sync__WEBPACK_IMPORTED_MODULE_17__["batchMessages"])(async () => { - await _db__WEBPACK_IMPORTED_MODULE_3__["delete_"]('rules', ruleId); - await _db__WEBPACK_IMPORTED_MODULE_3__["delete_"]('schedules', id); - }); -} -async function skipNextDate({ - id -}) { - return setNextDate({ - id, - start: nextDate => { - return date_fns__WEBPACK_IMPORTED_MODULE_1__["addDays"](Object(_shared_months__WEBPACK_IMPORTED_MODULE_9__["parseDate"])(nextDate), 1); - } - }); -} // `schedule` here might not be a saved schedule, so it might not have -// an id - -function getPossibleTransactions({ - schedule -}) {} -function discoverSchedules() { - return Object(_find_schedules__WEBPACK_IMPORTED_MODULE_20__["findSchedules"])(); -} -async function getUpcomingDates({ - config, - count -}) { - let rules = Object(_shared_schedules__WEBPACK_IMPORTED_MODULE_13__["recurConfigToRSchedule"])(config); - - try { - let schedule = new _util_rschedule__WEBPACK_IMPORTED_MODULE_16__["Schedule"]({ - rrules: rules - }); - return schedule.occurrences({ - start: date_fns__WEBPACK_IMPORTED_MODULE_1__["startOfDay"](new Date()), - take: count - }).toArray().map(date => Object(_shared_months__WEBPACK_IMPORTED_MODULE_9__["dayFromDate"])(date.date)); - } catch (err) { - Object(_platform_exceptions__WEBPACK_IMPORTED_MODULE_18__["captureBreadcrumb"])(config); - throw err; - } -} // Services - -function onRuleUpdate(rule) { - let _ref2 = rule instanceof _accounts_rules__WEBPACK_IMPORTED_MODULE_12__["Rule"] ? rule.serialize() : _accounts_transaction_rules__WEBPACK_IMPORTED_MODULE_11__["ruleModel"].toJS(rule), - actions = _ref2.actions, - conditions = _ref2.conditions; - - if (actions && actions.find(a => a.op === 'link-schedule')) { - let scheduleId = actions.find(a => a.op === 'link-schedule').value; - - if (scheduleId) { - let conds = Object(_shared_schedules__WEBPACK_IMPORTED_MODULE_13__["extractScheduleConds"])(conditions); - let payeeIdx = conditions.findIndex(c => c === conds.payee); - let accountIdx = conditions.findIndex(c => c === conds.account); - let amountIdx = conditions.findIndex(c => c === conds.amount); - let dateIdx = conditions.findIndex(c => c === conds.date); - _db__WEBPACK_IMPORTED_MODULE_3__["runQuery"]('INSERT OR REPLACE INTO schedules_json_paths (schedule_id, payee, account, amount, date) VALUES (?, ?, ?, ?, ?)', [scheduleId, payeeIdx === -1 ? null : `$[${payeeIdx}]`, accountIdx === -1 ? null : `$[${accountIdx}]`, amountIdx === -1 ? null : `$[${amountIdx}]`, dateIdx === -1 ? null : `$[${dateIdx}]`]); - } - } -} - -function trackJSONPaths() { - // Populate the table - _db__WEBPACK_IMPORTED_MODULE_3__["transaction"](() => { - Object(_accounts_transaction_rules__WEBPACK_IMPORTED_MODULE_11__["getRules"])().forEach(rule => { - onRuleUpdate(rule); - }); - }); - return Object(_sync__WEBPACK_IMPORTED_MODULE_17__["addSyncListener"])(onApplySync); -} - -function onApplySync(oldValues, newValues) { - let found = false; - newValues.forEach((items, table) => { - if (table === 'rules') { - found = true; - items.forEach(newValue => { - onRuleUpdate(newValue); - }); - } - }); -} // This is the service that move schedules forward automatically and -// posts transactions - - -async function postTransactionForSchedule({ - id -}) { - let _await$aqlQuery5 = await Object(_aql_schema_run_query__WEBPACK_IMPORTED_MODULE_6__["runQuery"])(Object(_shared_query__WEBPACK_IMPORTED_MODULE_10__["default"])('schedules').filter({ - id - }).select('*')), - data = _await$aqlQuery5.data; - - let schedule = data[0]; - - if (schedule == null || schedule._account == null) { - return; - } - - let transaction = { - payee: schedule._payee, - account: schedule._account, - amount: Object(_shared_schedules__WEBPACK_IMPORTED_MODULE_13__["getScheduledAmount"])(schedule._amount), - date: schedule.next_date, - schedule: schedule.id, - cleared: false - }; - - if (transaction.account) { - await Object(_accounts_sync__WEBPACK_IMPORTED_MODULE_19__["addTransactions"])(transaction.account, [transaction]); - } -} // TODO: make this sequential - - -async function advanceSchedulesService(syncSuccess) { - // Move all paid schedules - let _await$aqlQuery6 = await Object(_aql_schema_run_query__WEBPACK_IMPORTED_MODULE_6__["runQuery"])(Object(_shared_query__WEBPACK_IMPORTED_MODULE_10__["default"])('schedules').filter({ - completed: false, - '_account.closed': false - }).select('*')), - schedules = _await$aqlQuery6.data; - - let _await$aqlQuery7 = await Object(_aql_schema_run_query__WEBPACK_IMPORTED_MODULE_6__["runQuery"])(Object(_shared_schedules__WEBPACK_IMPORTED_MODULE_13__["getHasTransactionsQuery"])(schedules)), - hasTransData = _await$aqlQuery7.data; - - let hasTrans = new Set(hasTransData.filter(Boolean).map(row => row.schedule)); - let failedToPost = []; - let didPost = false; - - for (let schedule of schedules) { - let status = Object(_shared_schedules__WEBPACK_IMPORTED_MODULE_13__["getStatus"])(schedule.next_date, schedule.completed, hasTrans.has(schedule.id)); - - if (status === 'paid') { - if (schedule._date) { - // Move forward recurring schedules - if (schedule._date.frequency) { - try { - await setNextDate({ - id: schedule.id - }); - } catch (err) {// This might error if the rule is corrupted and it can't - // find the rule - } - } else { - if (schedule._date < Object(_shared_months__WEBPACK_IMPORTED_MODULE_9__["currentDay"])()) { - // Complete any single schedules - await updateSchedule({ - schedule: { - id: schedule.id, - completed: true - } - }); - } - } - } - } else if ((status === 'due' || status === 'missed') && schedule.posts_transaction && schedule._account) { - // Automatically create a transaction for due schedules - if (syncSuccess) { - await postTransactionForSchedule({ - id: schedule.id - }); - didPost = true; - } else { - failedToPost.push(schedule._payee); - } - } - } - - if (failedToPost.length > 0) { - connection.send('schedules-offline', { - payees: failedToPost - }); - } else if (didPost) { - // This forces a full refresh of transactions because it - // simulates them coming in from a full sync. This not a - // great API right now, but I think generally the approach - // is sane to treat them as external sync events. - connection.send('sync-event', { - type: 'success', - tables: ['transactions'], - syncDisabled: 'false' - }); - } -} // Expose functions to the client - -let app = Object(_app__WEBPACK_IMPORTED_MODULE_2__["createApp"])(); -app.method('schedule/create', Object(_mutators__WEBPACK_IMPORTED_MODULE_14__["mutator"])(Object(_undo__WEBPACK_IMPORTED_MODULE_15__["undoable"])(createSchedule))); -app.method('schedule/update', Object(_mutators__WEBPACK_IMPORTED_MODULE_14__["mutator"])(Object(_undo__WEBPACK_IMPORTED_MODULE_15__["undoable"])(updateSchedule))); -app.method('schedule/delete', Object(_mutators__WEBPACK_IMPORTED_MODULE_14__["mutator"])(Object(_undo__WEBPACK_IMPORTED_MODULE_15__["undoable"])(deleteSchedule))); -app.method('schedule/skip-next-date', Object(_mutators__WEBPACK_IMPORTED_MODULE_14__["mutator"])(Object(_undo__WEBPACK_IMPORTED_MODULE_15__["undoable"])(skipNextDate))); -app.method('schedule/post-transaction', Object(_mutators__WEBPACK_IMPORTED_MODULE_14__["mutator"])(Object(_undo__WEBPACK_IMPORTED_MODULE_15__["undoable"])(postTransactionForSchedule))); -app.method('schedule/force-run-service', Object(_mutators__WEBPACK_IMPORTED_MODULE_14__["mutator"])(() => advanceSchedulesService(true))); -app.method('schedule/get-possible-transactions', getPossibleTransactions); -app.method('schedule/discover', discoverSchedules); -app.method('schedule/get-upcoming-dates', getUpcomingDates); -app.service(trackJSONPaths); -app.events.on('sync', ({ - type, - subtype -}) => { - let completeEvent = type === 'success' || type === 'error' || type === 'unauthorized'; - - if (completeEvent && _prefs__WEBPACK_IMPORTED_MODULE_4__["getPrefs"]()) { - let _prefs$getPrefs = _prefs__WEBPACK_IMPORTED_MODULE_4__["getPrefs"](), - lastScheduleRun = _prefs$getPrefs.lastScheduleRun; - - if (lastScheduleRun !== Object(_shared_months__WEBPACK_IMPORTED_MODULE_9__["currentDay"])()) { - Object(_mutators__WEBPACK_IMPORTED_MODULE_14__["runMutator"])(() => advanceSchedulesService(type === 'success')); - _prefs__WEBPACK_IMPORTED_MODULE_4__["savePrefs"]({ - lastScheduleRun: Object(_shared_months__WEBPACK_IMPORTED_MODULE_9__["currentDay"])() - }); - } - } -}); -/* harmony default export */ __webpack_exports__["default"] = (app); - -/***/ }), - -/***/ "./packages/loot-core/src/server/schedules/find-schedules.js": -/*!*******************************************************************!*\ - !*** ./packages/loot-core/src/server/schedules/find-schedules.js ***! - \*******************************************************************/ -/*! exports provided: matchSchedules, findSchedules */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "matchSchedules", function() { return matchSchedules; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "findSchedules", function() { return findSchedules; }); -/* harmony import */ var date_fns__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! date-fns */ "./node_modules/date-fns/esm/index.js"); -/* harmony import */ var _db__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../db */ "./packages/loot-core/src/server/db/index.js"); -/* harmony import */ var _util_rschedule__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../util/rschedule */ "./packages/loot-core/src/server/util/rschedule.js"); -/* harmony import */ var _shared_util__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../shared/util */ "./packages/loot-core/src/shared/util.js"); -/* harmony import */ var _models__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../models */ "./packages/loot-core/src/server/models.js"); -/* harmony import */ var _aql_schema_run_query__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../aql/schema/run-query */ "./packages/loot-core/src/server/aql/schema/run-query.js"); -/* harmony import */ var _shared_query__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../shared/query */ "./packages/loot-core/src/shared/query.js"); -/* harmony import */ var _shared_rules__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../shared/rules */ "./packages/loot-core/src/shared/rules.js"); -/* harmony import */ var _shared_schedules__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../shared/schedules */ "./packages/loot-core/src/shared/schedules.js"); -/* harmony import */ var _shared_months__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../shared/months */ "./packages/loot-core/src/shared/months.js"); -/* harmony import */ var _accounts_transaction_rules__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../accounts/transaction-rules */ "./packages/loot-core/src/server/accounts/transaction-rules.js"); -function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } - -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } - -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; } - - - - - - - - - - - - - -const uuid = __webpack_require__(/*! ../../platform/uuid */ "./packages/loot-core/src/platform/uuid/index.electron.js"); - -function takeDates(config) { - let schedule = new _util_rschedule__WEBPACK_IMPORTED_MODULE_2__["Schedule"]({ - rrules: Object(_shared_schedules__WEBPACK_IMPORTED_MODULE_8__["recurConfigToRSchedule"])(config) - }); - return schedule.occurrences({ - take: 3 - }).toArray().map(d => d.date); -} - -async function getTransactions(date, account) { - let _await$aqlQuery = await Object(_aql_schema_run_query__WEBPACK_IMPORTED_MODULE_5__["runQuery"])(Object(_shared_query__WEBPACK_IMPORTED_MODULE_6__["default"])('transactions').filter({ - account, - schedule: null, - // Don't match transfers - 'payee.transfer_acct': null, - $and: [{ - date: { - $gte: date_fns__WEBPACK_IMPORTED_MODULE_0__["subDays"](date, 2) - } - }, { - date: { - $lte: date_fns__WEBPACK_IMPORTED_MODULE_0__["addDays"](date, 2) - } - }] - }).select('*').options({ - splits: 'none' - })), - data = _await$aqlQuery.data; - - return data; -} - -function getRank(day1, day2) { - let dayDiff = Math.abs(date_fns__WEBPACK_IMPORTED_MODULE_0__["differenceInDays"](Object(_shared_months__WEBPACK_IMPORTED_MODULE_9__["parseDate"])(day1), Object(_shared_months__WEBPACK_IMPORTED_MODULE_9__["parseDate"])(day2))); // The amount of days off determines the rank: exact same day - // is highest rank 1, 1 day off is .5, etc. This will find the - // best start date that matches all the dates the closest - - return 1 / (dayDiff + 1); -} - -function matchSchedules(allOccurs, config, partialMatchRank = 0.5) { - allOccurs = [...allOccurs].reverse(); - let baseOccur = allOccurs[0]; - let occurs = allOccurs.slice(1); - let schedules = []; - - for (let trans of baseOccur.transactions) { - let threshold = Object(_shared_rules__WEBPACK_IMPORTED_MODULE_7__["getApproxNumberThreshold"])(trans.amount); - let payee = trans.payee; - let account = trans.account; - let found = occurs.map(occur => { - let matched = occur.transactions.find(t => t.amount >= trans.amount - threshold && t.amount <= trans.amount + threshold); - matched = matched && matched.payee === payee ? matched : null; - - if (matched) { - return { - trans: matched, - rank: getRank(occur.date, matched.date) - }; - } - - return null; - }); - - if (found.indexOf(null) !== -1) { - continue; - } - - let rank = found.reduce((total, match) => total + match.rank, getRank(baseOccur.date, trans.date)); - let exactAmount = found.reduce((exact, match) => exact && match.trans.amount === trans.amount, true); - schedules.push({ - rank, - amount: trans.amount, - account: trans.account, - payee: trans.payee, - date: config, - // Exact dates rank as 1, so all of them matches exactly it - // would equal the number of `allOccurs` - exactDate: rank === allOccurs.length, - exactAmount - }); - } - - return schedules; -} - -async function schedulesForPattern(baseStart, numDays, baseConfig, accountId, partialMatchRank) { - let schedules = []; - let i = 0; - - for (let i = 0; i < numDays; i++) { - let start = date_fns__WEBPACK_IMPORTED_MODULE_0__["addDays"](baseStart, i); - let config; - - if (typeof baseConfig === 'function') { - config = baseConfig(start); - - if (config === false) { - // Skip this one - continue; - } - } else { - config = _objectSpread(_objectSpread({}, baseConfig), {}, { - start - }); - } // Our recur config expects a day string, not a native date format - - - config.start = Object(_shared_months__WEBPACK_IMPORTED_MODULE_9__["dayFromDate"])(config.start); - let data = []; - let dates = takeDates(config); - - for (let date of dates) { - data.push({ - date: Object(_shared_months__WEBPACK_IMPORTED_MODULE_9__["dayFromDate"])(date), - transactions: await getTransactions(date, accountId) - }); - } - - schedules = schedules.concat(matchSchedules(data, config, partialMatchRank)); - } - - return schedules; -} - -async function weekly(startDate, accountId) { - return schedulesForPattern(date_fns__WEBPACK_IMPORTED_MODULE_0__["subWeeks"](Object(_shared_months__WEBPACK_IMPORTED_MODULE_9__["parseDate"])(startDate), 4), 7 * 2, { - frequency: 'weekly' - }, accountId); -} - -async function every2weeks(startDate, accountId) { - return schedulesForPattern( // 6 weeks would cover 3 instances, but we also scan an addition - // week back - date_fns__WEBPACK_IMPORTED_MODULE_0__["subWeeks"](Object(_shared_months__WEBPACK_IMPORTED_MODULE_9__["parseDate"])(startDate), 7), 7 * 2, { - frequency: 'weekly', - interval: 2 - }, accountId); -} - -async function monthly(startDate, accountId) { - return schedulesForPattern(date_fns__WEBPACK_IMPORTED_MODULE_0__["subMonths"](Object(_shared_months__WEBPACK_IMPORTED_MODULE_9__["parseDate"])(startDate), 4), 31 * 2, start => { - // 28 is the max number of days that all months are guaranteed - // to have. We don't want to go any higher than that because - // we'll end up skipping months that don't have that day. - // The use cases of end of month days will be covered with the - // `monthlyLastDay` pattern; - if (date_fns__WEBPACK_IMPORTED_MODULE_0__["getDate"](start) > 28) { - return false; - } - - return { - start, - frequency: 'monthly' - }; - }, accountId); -} - -async function monthlyLastDay(startDate, accountId) { - // We do two separate calls because this pattern doesn't fit into - // how `schedulesForPattern` works - let s1 = await schedulesForPattern(date_fns__WEBPACK_IMPORTED_MODULE_0__["subMonths"](Object(_shared_months__WEBPACK_IMPORTED_MODULE_9__["parseDate"])(startDate), 3), 1, { - frequency: 'monthly', - patterns: [{ - type: 'day', - value: -1 - }] - }, accountId, // Last day patterns should win over day-specific ones that just - // happen to match - 0.75); - let s2 = await schedulesForPattern(date_fns__WEBPACK_IMPORTED_MODULE_0__["subMonths"](Object(_shared_months__WEBPACK_IMPORTED_MODULE_9__["parseDate"])(startDate), 4), 1, { - frequency: 'monthly', - patterns: [{ - type: 'day', - value: -1 - }] - }, accountId, 0.75); - return s1.concat(s2); -} - -async function monthly1stor3rd(startDate, accountId) { - return schedulesForPattern(date_fns__WEBPACK_IMPORTED_MODULE_0__["subWeeks"](Object(_shared_months__WEBPACK_IMPORTED_MODULE_9__["parseDate"])(startDate), 8), 14, start => { - let day = date_fns__WEBPACK_IMPORTED_MODULE_0__["format"](new Date(), 'iiii'); - let dayValue = day.slice(0, 2).toUpperCase(); - return { - start, - frequency: 'monthly', - patterns: [{ - type: dayValue, - value: 1 - }, { - type: dayValue, - value: 3 - }] - }; - }, accountId); -} - -async function monthly2ndor4th(startDate, accountId) { - return schedulesForPattern(date_fns__WEBPACK_IMPORTED_MODULE_0__["subMonths"](Object(_shared_months__WEBPACK_IMPORTED_MODULE_9__["parseDate"])(startDate), 8), 14, start => { - let day = date_fns__WEBPACK_IMPORTED_MODULE_0__["format"](new Date(), 'iiii'); - let dayValue = day.slice(0, 2).toUpperCase(); - return { - start, - frequency: 'monthly', - patterns: [{ - type: dayValue, - value: 2 - }, { - type: dayValue, - value: 4 - }] - }; - }, accountId); -} - -async function findStartDate(schedule) { - let conditions = schedule._conditions; - let dateCond = conditions.find(c => c.field === 'date'); - let currentConfig = dateCond.value; - - while (1) { - let prevConfig = currentConfig; - currentConfig = _objectSpread({}, prevConfig); - - switch (currentConfig.frequency) { - case 'weekly': - currentConfig.start = Object(_shared_months__WEBPACK_IMPORTED_MODULE_9__["dayFromDate"])(date_fns__WEBPACK_IMPORTED_MODULE_0__["subWeeks"](Object(_shared_months__WEBPACK_IMPORTED_MODULE_9__["parseDate"])(currentConfig.start), currentConfig.interval || 1)); - break; - - case 'monthly': - currentConfig.start = Object(_shared_months__WEBPACK_IMPORTED_MODULE_9__["dayFromDate"])(date_fns__WEBPACK_IMPORTED_MODULE_0__["subMonths"](Object(_shared_months__WEBPACK_IMPORTED_MODULE_9__["parseDate"])(currentConfig.start), currentConfig.interval || 1)); - break; - - case 'yearly': - currentConfig.start = Object(_shared_months__WEBPACK_IMPORTED_MODULE_9__["dayFromDate"])(date_fns__WEBPACK_IMPORTED_MODULE_0__["subYears"](Object(_shared_months__WEBPACK_IMPORTED_MODULE_9__["parseDate"])(currentConfig.start), currentConfig.interval || 1)); - break; - - default: - throw new Error('findStartDate: invalid frequency'); - } - - let newConditions = conditions.map(c => c.field === 'date' ? _objectSpread(_objectSpread({}, c), {}, { - value: currentConfig - }) : c); - - let _conditionsToAQL = Object(_accounts_transaction_rules__WEBPACK_IMPORTED_MODULE_10__["conditionsToAQL"])(newConditions, { - recurDateBounds: 1 - }), - filters = _conditionsToAQL.filters, - errors = _conditionsToAQL.errors; - - if (errors.length > 0) { - // Somehow we generated an invalid config. Abort the whole - // process and don't change the date at all - currentConfig = null; - break; - } - - let _await$aqlQuery2 = await Object(_aql_schema_run_query__WEBPACK_IMPORTED_MODULE_5__["runQuery"])(Object(_shared_query__WEBPACK_IMPORTED_MODULE_6__["default"])('transactions').filter({ - $and: filters - }).select('*')), - data = _await$aqlQuery2.data; - - if (data.length === 0) { - // No data, revert back to the last valid value and stop - currentConfig = prevConfig; - break; - } - } - - if (currentConfig) { - return _objectSpread(_objectSpread({}, schedule), {}, { - date: currentConfig, - _conditions: conditions.map(c => c.field === 'date' ? _objectSpread(_objectSpread({}, c), {}, { - value: currentConfig - }) : c) - }); - } - - return schedule; -} - -async function findSchedules() { - // Patterns to look for: - // * Weekly - // * Every two weeks - // * Monthly on day X - // * Monthly on every 1st or 3rd day - // * Monthly on every 2nd or 4th day - // - // Search for them approx (+- 2 days) but track which transactions - // and find the best one... - let _await$aqlQuery3 = await Object(_aql_schema_run_query__WEBPACK_IMPORTED_MODULE_5__["runQuery"])(Object(_shared_query__WEBPACK_IMPORTED_MODULE_6__["default"])('accounts').filter({ - closed: false - }).select('*')), - accounts = _await$aqlQuery3.data; - - let allSchedules = []; - - for (let account of accounts) { - // Find latest transaction-ish to start with - let latestTrans = await _db__WEBPACK_IMPORTED_MODULE_1__["first"]('SELECT * FROM v_transactions WHERE account = ? AND parent_id IS NULL ORDER BY date DESC LIMIT 1', [account.id]); - - if (latestTrans) { - let latestDate = Object(_models__WEBPACK_IMPORTED_MODULE_4__["fromDateRepr"])(latestTrans.date); - allSchedules = allSchedules.concat(await weekly(latestDate, account.id), await every2weeks(latestDate, account.id), await monthly(latestDate, account.id), await monthlyLastDay(latestDate, account.id), await monthly1stor3rd(latestDate, account.id), await monthly2ndor4th(latestDate, account.id)); - } - } - - let schedules = [...Object(_shared_util__WEBPACK_IMPORTED_MODULE_3__["groupBy"])(allSchedules, 'payee').entries()].map(([payeeId, schedules]) => { - schedules.sort((s1, s2) => s2.rank - s1.rank); - let winner = schedules[0]; // Convert to schedule and return it - - return { - id: uuid.v4Sync(), - account: winner.account, - payee: winner.payee, - date: winner.date, - amount: winner.amount, - _conditions: [{ - op: 'is', - field: 'account', - value: winner.account - }, { - op: 'is', - field: 'payee', - value: winner.payee - }, { - op: winner.exactDate ? 'is' : 'isapprox', - field: 'date', - value: winner.date - }, { - op: winner.exactAmount ? 'is' : 'isapprox', - field: 'amount', - value: winner.amount - }] - }; - }); - let finalized = []; - - for (let schedule of schedules) { - finalized.push(await findStartDate(schedule)); - } - - return finalized; -} - -/***/ }), - -/***/ "./packages/loot-core/src/server/server-config.js": -/*!********************************************************!*\ - !*** ./packages/loot-core/src/server/server-config.js ***! - \********************************************************/ -/*! exports provided: setServer, getServer */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setServer", function() { return setServer; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getServer", function() { return getServer; }); -/* harmony import */ var _platform_server_fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../platform/server/fs */ "./packages/loot-core/src/platform/server/fs/index.electron.js"); -/* harmony import */ var _platform_server_fs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_platform_server_fs__WEBPACK_IMPORTED_MODULE_0__); - -let config = null; - -function joinURL(base, ...paths) { - let url = new URL(base); - url.pathname = _platform_server_fs__WEBPACK_IMPORTED_MODULE_0___default.a.join(...paths); - return url.toString(); -} - -function setServer(url) { - if (url == null) { - config = null; - } else { - config = getServer(url); - } -} // `url` is optional; if not given it will provide the global config - -function getServer(url) { - if (url) { - return { - BASE_SERVER: url, - SYNC_SERVER: joinURL(url, '/sync'), - SIGNUP_SERVER: joinURL(url, '/account'), - PLAID_SERVER: joinURL(url, '/plaid') - }; - } - - return config; -} - -/***/ }), - -/***/ "./packages/loot-core/src/server/sheet.js": -/*!************************************************!*\ - !*** ./packages/loot-core/src/server/sheet.js ***! - \************************************************/ -/*! exports provided: get, loadSpreadsheet, unloadSpreadsheet, reloadSpreadsheet, loadUserBudgets, getCell, getCellValue, startTransaction, endTransaction, waitOnSpreadsheet */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "get", function() { return get; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "loadSpreadsheet", function() { return loadSpreadsheet; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "unloadSpreadsheet", function() { return unloadSpreadsheet; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "reloadSpreadsheet", function() { return reloadSpreadsheet; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "loadUserBudgets", function() { return loadUserBudgets; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getCell", function() { return getCell; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getCellValue", function() { return getCellValue; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "startTransaction", function() { return startTransaction; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "endTransaction", function() { return endTransaction; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "waitOnSpreadsheet", function() { return waitOnSpreadsheet; }); -/* harmony import */ var _spreadsheet_spreadsheet__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./spreadsheet/spreadsheet */ "./packages/loot-core/src/server/spreadsheet/spreadsheet.js"); -/* harmony import */ var _prefs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./prefs */ "./packages/loot-core/src/server/prefs.js"); -/* harmony import */ var _platform_exceptions__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../platform/exceptions */ "./packages/loot-core/src/platform/exceptions/index.electron.js"); -/* harmony import */ var _platform_server_sqlite__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../platform/server/sqlite */ "./packages/loot-core/src/platform/server/sqlite/index.electron.js"); -/* harmony import */ var _shared_months__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../shared/months */ "./packages/loot-core/src/shared/months.js"); -/* harmony import */ var _platform__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./platform */ "./packages/loot-core/src/server/platform.js"); - - - - - - - -const _require = __webpack_require__(/*! ./spreadsheet/util */ "./packages/loot-core/src/server/spreadsheet/util.js"), - resolveName = _require.resolveName; - -let globalSheet, globalOnChange; -let globalCacheDb; -function get() { - return globalSheet; -} - -async function updateSpreadsheetCache(rawDb, names) { - await _platform_server_sqlite__WEBPACK_IMPORTED_MODULE_3__["transaction"](rawDb, () => { - names.forEach(name => { - const node = globalSheet._getNode(name); // Don't cache query nodes yet - - - if (node.sql == null) { - _platform_server_sqlite__WEBPACK_IMPORTED_MODULE_3__["runQuery"](rawDb, 'INSERT OR REPLACE INTO kvcache (key, value) VALUES (?, ?)', [name, JSON.stringify(node.value)]); - } - }); - }); -} - -function setCacheStatus(mainDb, cacheDb, { - clean -}) { - if (clean) { - // Generate random number and stick in both places - let num = Math.random() * 10000000; - _platform_server_sqlite__WEBPACK_IMPORTED_MODULE_3__["runQuery"](cacheDb, 'INSERT OR REPLACE INTO kvcache_key (id, key) VALUES (1, ?)', [num]); - - if (mainDb) { - _platform_server_sqlite__WEBPACK_IMPORTED_MODULE_3__["runQuery"](mainDb, 'INSERT OR REPLACE INTO kvcache_key (id, key) VALUES (1, ?)', [num]); - } - } else { - _platform_server_sqlite__WEBPACK_IMPORTED_MODULE_3__["runQuery"](cacheDb, 'DELETE FROM kvcache_key'); - } -} - -function isCacheDirty(mainDb, cacheDb) { - let rows = _platform_server_sqlite__WEBPACK_IMPORTED_MODULE_3__["runQuery"](cacheDb, 'SELECT key FROM kvcache_key WHERE id = 1', [], true); - let num = rows.length === 0 ? null : rows[0].key; - - if (num == null) { - return true; - } - - if (mainDb) { - let rows = _platform_server_sqlite__WEBPACK_IMPORTED_MODULE_3__["runQuery"](mainDb, 'SELECT key FROM kvcache_key WHERE id = 1', [], true); - - if (rows.length === 0 || rows[0].key !== num) { - return true; - } - } // Always also check if there is anything in `kvcache`. We ask for one item; - // if we didn't get back anything it's empty so there is no cache - - - rows = _platform_server_sqlite__WEBPACK_IMPORTED_MODULE_3__["runQuery"](cacheDb, 'SELECT * FROM kvcache LIMIT 1', [], true); - return rows.length === 0; -} - -async function loadSpreadsheet(db, onSheetChange) { - let cacheEnabled = !global.__TESTING__; - let mainDb = db.getDatabase(); - let cacheDb; - - if (_platform__WEBPACK_IMPORTED_MODULE_5__["default"].isDesktop && cacheEnabled) { - // Desktop apps use a separate database for the cache. This is because it is - // much more likely to directly work with files on desktop, and this makes - // it a lot clearer what the true filesize of the main db is (and avoid - // copying the cache data around). - let cachePath = db.getDatabasePath().replace(/db\.sqlite$/, 'cache.sqlite'); - globalCacheDb = cacheDb = _platform_server_sqlite__WEBPACK_IMPORTED_MODULE_3__["openDatabase"](cachePath); - _platform_server_sqlite__WEBPACK_IMPORTED_MODULE_3__["execQuery"](cacheDb, ` - CREATE TABLE IF NOT EXISTS kvcache (key TEXT PRIMARY KEY, value TEXT); - CREATE TABLE IF NOT EXISTS kvcache_key (id INTEGER PRIMARY KEY, key REAL) - `); - } else { - // All other platforms use the same database for cache - cacheDb = mainDb; - } - - let sheet; - - if (cacheEnabled) { - sheet = new _spreadsheet_spreadsheet__WEBPACK_IMPORTED_MODULE_0__["default"](updateSpreadsheetCache.bind(null, cacheDb), setCacheStatus.bind(null, mainDb, cacheDb)); - } else { - sheet = new _spreadsheet_spreadsheet__WEBPACK_IMPORTED_MODULE_0__["default"](); - } - - Object(_platform_exceptions__WEBPACK_IMPORTED_MODULE_2__["captureBreadcrumb"])({ - message: 'loading spreaadsheet', - category: 'server' - }); - globalSheet = sheet; - globalOnChange = onSheetChange; - - if (onSheetChange) { - sheet.addEventListener('change', onSheetChange); - } - - if (cacheEnabled && !isCacheDirty(mainDb, cacheDb)) { - let cachedRows = await _platform_server_sqlite__WEBPACK_IMPORTED_MODULE_3__["runQuery"](cacheDb, 'SELECT * FROM kvcache', [], true); - console.log(`Loaded spreadsheet from cache (${cachedRows.length} items)`); - - for (let row of cachedRows) { - let parsed = JSON.parse(row.value); - sheet.load(row.key, parsed); - } - } else { - console.log('Loading fresh spreadsheet'); - await loadUserBudgets(db); - } - - Object(_platform_exceptions__WEBPACK_IMPORTED_MODULE_2__["captureBreadcrumb"])({ - message: 'loaded spreaadsheet', - category: 'server' - }); - return sheet; -} -function unloadSpreadsheet() { - if (globalSheet) { - // TODO: Should wait for the sheet to finish - globalSheet.unload(); - globalSheet = null; - } - - if (globalCacheDb) { - _platform_server_sqlite__WEBPACK_IMPORTED_MODULE_3__["closeDatabase"](globalCacheDb); - globalCacheDb = null; - } -} -async function reloadSpreadsheet(db) { - if (globalSheet) { - unloadSpreadsheet(); - return loadSpreadsheet(db, globalOnChange); - } -} -async function loadUserBudgets(db) { - let sheet = globalSheet; // TODO: Clear out the cache here so make sure future loads of the app - // don't load any extra values that aren't set here - - let _ref = _prefs__WEBPACK_IMPORTED_MODULE_1__["getPrefs"]() || {}, - budgetType = _ref.budgetType; - - let table = budgetType === 'report' ? 'reflect_budgets' : 'zero_budgets'; - let budgets = await db.all(` - SELECT * FROM ${table} b - LEFT JOIN categories c ON c.id = b.category - WHERE c.tombstone = 0 - `); - sheet.startTransaction(); // Load all the budget amounts and carryover values - - for (let budget of budgets) { - if (budget.month && budget.category) { - let sheetName = `budget${budget.month}`; - sheet.set(`${sheetName}!budget-${budget.category}`, budget.amount); - sheet.set(`${sheetName}!carryover-${budget.category}`, budget.carryover === 1 ? true : false); - } - } // For zero-based budgets, load the buffered amounts - - - if (budgetType !== 'report') { - let budgetMonths = await db.all('SELECT * FROM zero_budget_months'); - - for (let budgetMonth of budgetMonths) { - let sheetName = Object(_shared_months__WEBPACK_IMPORTED_MODULE_4__["sheetForMonth"])(budgetMonth.id); - sheet.set(`${sheetName}!buffered`, budgetMonth.buffered); - } - } - - sheet.endTransaction(); -} -function getCell(sheet, name) { - return globalSheet._getNode(resolveName(sheet, name)); -} -function getCellValue(sheet, name) { - return globalSheet.getValue(resolveName(sheet, name)); -} -function startTransaction() { - if (globalSheet) { - globalSheet.startTransaction(); - } -} -function endTransaction() { - if (globalSheet) { - globalSheet.endTransaction(); - } -} -function waitOnSpreadsheet() { - return new Promise(resolve => { - if (globalSheet) { - globalSheet.onFinish(resolve); - } else { - resolve(); - } - }); -} - -/***/ }), - -/***/ "./packages/loot-core/src/server/spreadsheet/globals.js": -/*!**************************************************************!*\ - !*** ./packages/loot-core/src/server/spreadsheet/globals.js ***! - \**************************************************************/ -/*! no static exports found */ -/***/ (function(module, exports) { - -function first(arr) { - return arr[0]; -} - -function firstValue(arr) { - const keys = Object.keys(arr[0]); - return arr[0][keys[0]]; -} - -function number(v) { - if (typeof v === 'number') { - return v; - } else if (typeof v === 'string') { - const parsed = parseFloat(v); - - if (isNaN(parsed)) { - return 0; - } - - return parsed; - } - - return 0; -} - -function min(x, y) { - return Math.min(x, y); -} - -function max(x, y) { - return Math.max(x, y); -} - -module.exports = { - first, - firstValue, - number, - min, - max -}; - -/***/ }), - -/***/ "./packages/loot-core/src/server/spreadsheet/graph-data-structure.js": -/*!***************************************************************************!*\ - !*** ./packages/loot-core/src/server/spreadsheet/graph-data-structure.js ***! - \***************************************************************************/ -/*! no static exports found */ -/***/ (function(module, exports) { - -function Graph(serialized) { - var graph = { - addNode, - removeNode, - adjacent, - adjacentIncoming, - addEdge, - removeEdge, - removeIncomingEdges, - topologicalSort, - generateDOT, - getEdges - }; - var edges = new Map(); - var incomingEdges = new Map(); - - function getEdges() { - return { - edges, - incomingEdges - }; - } - - function addNode(node) { - edges.set(node, adjacent(node)); - incomingEdges.set(node, adjacentIncoming(node)); - return graph; - } - - function removeIncomingEdges(node) { - const incoming = adjacentIncoming(node); - incomingEdges.set(node, new Set()); - let iter = incoming.values(); - let cur = iter.next(); - - while (!cur.done) { - removeEdge(cur.value, node); - cur = iter.next(); - } - } - - function removeNode(node) { - removeIncomingEdges(node); - edges.delete(node); - incomingEdges.delete(node); - } - - function adjacent(node) { - return edges.get(node) || new Set(); - } - - function adjacentIncoming(node) { - return incomingEdges.get(node) || new Set(); - } // Adds an edge from node u to node v. - // Implicitly adds the nodes if they were not already added. - - - function addEdge(node1, node2) { - addNode(node1); - addNode(node2); - adjacent(node1).add(node2); - adjacentIncoming(node2).add(node1); - return graph; - } // Removes the edge from node u to node v. - // Does not remove the nodes. - // Does nothing if the edge does not exist. - - - function removeEdge(node1, node2) { - if (edges.has(node1)) { - adjacent(node1).delete(node2); - } - - if (incomingEdges.has(node2)) { - adjacentIncoming(node2).delete(node1); - } - - return graph; - } - - function topologicalSortUntil(name, visited, sorted) { - visited.add(name); - let iter = adjacent(name).values(); - let cur = iter.next(); - - while (!cur.done) { - if (!visited.has(cur.value)) { - topologicalSortUntil(cur.value, visited, sorted); - } - - cur = iter.next(); - } - - sorted.unshift(name); - } - - function topologicalSort(sourceNodes) { - const visited = new Set(); - const sorted = []; - sourceNodes.forEach(name => { - if (!visited.has(name)) { - topologicalSortUntil(name, visited, sorted); - } - }); - return sorted; - } - - function generateDOT() { - let edgeStrings = []; - edges.forEach(function (adj, edge) { - if (adj.length !== 0) { - edgeStrings.push(`${edge} -> {${adj.join(',')}}`); - } - }); - return ` - digraph G { - ${edgeStrings.join('\n').replace(/!/g, '_')} - } - `; - } - - return graph; -} - -module.exports = Graph; - -/***/ }), - -/***/ "./packages/loot-core/src/server/spreadsheet/spreadsheet.js": -/*!******************************************************************!*\ - !*** ./packages/loot-core/src/server/spreadsheet/spreadsheet.js ***! - \******************************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return Spreadsheet; }); -/* harmony import */ var mitt__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! mitt */ "./packages/loot-core/node_modules/mitt/dist/mitt.es.js"); -/* harmony import */ var _aql_schema__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../aql/schema */ "./packages/loot-core/src/server/aql/schema/index.js"); -/* harmony import */ var _aql_compiler__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../aql/compiler */ "./packages/loot-core/src/server/aql/compiler.js"); -/* harmony import */ var _aql_schema_run_query__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../aql/schema/run-query */ "./packages/loot-core/src/server/aql/schema/run-query.js"); -function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } - -function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } - -function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } - -function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } - -function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_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 _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } - - - - - - -const Graph = __webpack_require__(/*! ./graph-data-structure */ "./packages/loot-core/src/server/spreadsheet/graph-data-structure.js"); - -const _require = __webpack_require__(/*! ./util */ "./packages/loot-core/src/server/spreadsheet/util.js"), - unresolveName = _require.unresolveName, - resolveName = _require.resolveName; - -class Spreadsheet { - constructor(saveCache, setCacheStatus) { - this.graph = new Graph(); - this.nodes = new Map(); - this.transactionDepth = 0; - this.saveCache = saveCache; - this.setCacheStatus = setCacheStatus; - this.dirtyCells = []; - this.computeQueue = []; - this.events = Object(mitt__WEBPACK_IMPORTED_MODULE_0__["default"])(); - this._meta = { - createdMonths: new Set() - }; - } - - meta() { - return this._meta; - } - - setMeta(meta) { - this._meta = meta; - } // Spreadsheet interface - - - _getNode(name) { - const _unresolveName = unresolveName(name), - sheet = _unresolveName.sheet; - - if (!this.nodes.has(name)) { - this.nodes.set(name, { - name, - expr: null, - value: null, - sheet: sheet - }); - } - - return this.nodes.get(name); - } - - getNode(name) { - return this._getNode(name); - } - - hasCell(name) { - return this.nodes.has(name); - } - - add(name, expr, value) { - this.set(name, expr); - } - - getNodes() { - return this.nodes; - } - - serialize() { - return { - graph: this.graph.getEdges(), - nodes: [...this.nodes.entries()] - }; - } - - transaction(func) { - this.startTransaction(); - - try { - func(); - } catch (e) { - console.log(e); - } - - return this.endTransaction(); - } - - startTransaction() { - this.transactionDepth++; - } - - endTransaction() { - this.transactionDepth--; - - if (this.transactionDepth === 0) { - const cells = this.dirtyCells; - this.dirtyCells = []; - this.queueComputation(this.graph.topologicalSort(cells)); - } - - return []; - } - - queueComputation(cellNames) { - // TODO: Formally write out the different cases when the existing - // queue is not empty. There should be cases where we can easily - // optimize this by skipping computations if we know they are - // going to be computed again. The hard thing is to ensure that - // the order of computations stays correct - this.computeQueue = this.computeQueue.concat(cellNames); // Begin running on the next tick so we guarantee that it doesn't finish - // within the same tick. Since some computations are async, this makes it - // consistent (otherwise it would only sometimes finish sync) - - Promise.resolve().then(() => { - if (!this.running) { - this.runComputations(); - } - }); - } - - runComputations(idx = 0) { - this.running = true; - - while (idx < this.computeQueue.length) { - let name = this.computeQueue[idx]; - let node; - let result; - - try { - node = this.getNode(name); - - if (node._run) { - let args = node._dependencies.map(dep => { - return this.getNode(dep).value; - }); - - result = node._run(...args); - - if (result instanceof Promise) { - console.warn('dynamic cell returned a promise! this is discouraged because errors are not handled properly'); - } - } else if (node.sql) { - result = Object(_aql_schema_run_query__WEBPACK_IMPORTED_MODULE_3__["runCompiledQuery"])(node.query, node.sql.sqlPieces, node.sql.state); - } else { - idx++; - continue; - } - } catch (e) { - console.log('Error while evaluating ' + name + ':', e); // If an error happens, bail on the rest of the computations - - this.running = false; - this.computeQueue = []; - return; - } - - if (result instanceof Promise) { - // When the cell is finished computing, finish computing the - // rest - result.then(value => { - node.value = value; - this.runComputations(idx + 1); - }, err => { - // TODO: use captureException here - console.warn(`Failed running ${node.name}!`, err); - this.runComputations(idx + 1); - }); - return; - } else { - node.value = result; - } - - idx++; - } // If everything computed in one loop (no async operations) notify - // the user and empty the queue - - - if (idx === this.computeQueue.length) { - this.events.emit('change', { - names: this.computeQueue - }); // Cache the updated cells - - if (this.saveCache) { - this.saveCache(this.computeQueue); - } - - this.markCacheSafe(); - this.running = false; - this.computeQueue = []; - } - } - - markCacheSafe() { - if (!this.cacheBarrier) { - if (this.setCacheStatus) { - this.setCacheStatus({ - clean: true - }); - } - } - } - - markCacheDirty() { - if (this.setCacheStatus) { - this.setCacheStatus({ - clean: false - }); - } - } - - startCacheBarrier() { - this.cacheBarrier = true; - this.markCacheDirty(); - } - - endCacheBarrier() { - this.cacheBarrier = false; - let pendingChange = this.running || this.computeQueue.length > 0; - - if (!pendingChange) { - this.markCacheSafe(); - } - } - - addEventListener(name, func) { - this.events.on(name, func); - return () => this.events.off(name, func); - } - - onFinish(func) { - if (this.transactionDepth !== 0) { - throw new Error('onFinish called while inside a spreadsheet transaction. This is not allowed as it will lead to race conditions'); - } - - if (!this.running && this.computeQueue.length === 0) { - func([]); // The remove function does nothing - - return () => {}; - } - - let remove = this.addEventListener('change', (...args) => { - remove(); - return func(...args); - }); - return remove; - } - - unload() { - this.events.all.clear(); - } - - getValue(name) { - return this.getNode(name).value; - } - - getExpr(name) { - return this.getNode(name).expr; - } - - getCellValue(sheet, name) { - return this.getNode(resolveName(sheet, name)).value; - } - - getCellExpr(sheet, name) { - return this.getNode(resolveName(sheet, name)).expr; - } - - getCellValueLoose(sheetName, cellName) { - let name = resolveName(sheetName, cellName); - - if (this.nodes.has(name)) { - return this.getNode(name).value; - } - - return null; - } - - bootup(onReady) { - this.onFinish(() => { - onReady(); - }); - } - - load(name, value) { - const node = this._getNode(name); - - node.expr = value; - node.value = value; - } - - create(name, value) { - return this.transaction(() => { - const node = this._getNode(name); - - node.expr = value; - node.value = value; - - this._markDirty(name); - }); - } - - set(name, value) { - this.create(name, value); - } - - recompute(name) { - this.transaction(() => { - this.dirtyCells.push(name); - }); - } - - recomputeAll() { - // Recompute everything! - this.transaction(() => { - this.dirtyCells = [...this.nodes.keys()]; - }); - } - - createQuery(sheetName, cellName, query) { - let name = resolveName(sheetName, cellName); - - let node = this._getNode(name); - - if (node.query !== query) { - node.query = query; - - let _compileQuery = Object(_aql_compiler__WEBPACK_IMPORTED_MODULE_2__["compileQuery"])(node.query, _aql_schema__WEBPACK_IMPORTED_MODULE_1__["schema"], _aql_schema__WEBPACK_IMPORTED_MODULE_1__["schemaConfig"]), - sqlPieces = _compileQuery.sqlPieces, - state = _compileQuery.state; - - node.sql = { - sqlPieces, - state - }; - this.transaction(() => { - this._markDirty(name); - }); - } - } - - createStatic(sheetName, cellName, initialValue) { - let name = resolveName(sheetName, cellName); - let exists = this.nodes.has(name); - - if (!exists) { - this.create(name, initialValue); - } - } - - createDynamic(sheetName, cellName, { - dependencies = [], - run, - initialValue, - refresh - }) { - let name = resolveName(sheetName, cellName); - - let node = this._getNode(name); - - if (node.dynamic) { - // If it already exists, do nothing - return; - } - - node.dynamic = true; - node._run = run; - dependencies = dependencies.map(dep => { - let resolved; - - if (!unresolveName(dep).sheet) { - resolved = resolveName(sheetName, dep); - } else { - resolved = dep; - } - - return resolved; - }); - node._dependencies = dependencies; // TODO: diff these - - this.graph.removeIncomingEdges(name); - dependencies.forEach(dep => { - this.graph.addEdge(dep, name); - }); - - if (node.value == null || refresh) { - this.transaction(() => { - node.value = initialValue; - - this._markDirty(name); - }); - } - } - - clearSheet(sheetName) { - for (let _ref of this.nodes.entries()) { - var _ref2 = _slicedToArray(_ref, 2); - - let name = _ref2[0]; - let node = _ref2[1]; - - if (node.sheet === sheetName) { - this.nodes.delete(name); - } - } - } - - voidCell(sheetName, name, voidValue = null) { - let node = this.getNode(resolveName(sheetName, name)); - node._run = null; - node.dynamic = false; - node.value = voidValue; - } - - deleteCell(sheetName, name) { - this.voidCell(sheetName, name); - this.nodes.delete(resolveName(sheetName, name)); - } - - addDependencies(sheetName, cellName, deps) { - let name = resolveName(sheetName, cellName); - deps = deps.map(dep => { - if (!unresolveName(dep).sheet) { - return resolveName(sheetName, dep); - } - - return dep; - }); - let node = this.getNode(name); - let newDeps = deps.filter(dep => (node._dependencies || []).indexOf(dep) === -1); - - if (newDeps.length > 0) { - node._dependencies = (node._dependencies || []).concat(newDeps); - newDeps.forEach(dep => { - this.graph.addEdge(dep, name); - }); - this.recompute(name); - } - } - - removeDependencies(sheetName, cellName, deps) { - let name = resolveName(sheetName, cellName); - deps = deps.map(dep => { - if (!unresolveName(dep).sheet) { - return resolveName(sheetName, dep); - } - - return dep; - }); - let node = this.getNode(name); - node._dependencies = (node._dependencies || []).filter(dep => deps.indexOf(dep) === -1); - deps.forEach(dep => { - this.graph.removeEdge(dep, name); - }); - this.recompute(name); - } - - _markDirty(name) { - this.dirtyCells.push(name); - } - - triggerDatabaseChanges(oldValues, newValues) { - let tables = new Set([...oldValues.keys(), ...newValues.keys()]); - this.startTransaction(); // TODO: Create an index of deps so we don't have to iterate - // across all nodes - - this.nodes.forEach(node => { - if (node.sql && node.sql.state.dependencies.some(dep => tables.has(dep))) { - this._markDirty(node.name); - } - }); - this.endTransaction(); - } - -} - -/***/ }), - -/***/ "./packages/loot-core/src/server/spreadsheet/util.js": -/*!***********************************************************!*\ - !*** ./packages/loot-core/src/server/spreadsheet/util.js ***! - \***********************************************************/ -/*! no static exports found */ -/***/ (function(module, exports) { - -function unresolveName(name) { - let idx = name.indexOf('!'); - - if (idx !== -1) { - return { - sheet: name.slice(0, idx), - name: name.slice(idx + 1) - }; - } - - return { - sheet: null, - name - }; -} - -function resolveName(sheet, name) { - return sheet + '!' + name; -} - -function resolveNamesAsObjects(sheets) { - const cells = {}; - Object.keys(sheets).forEach(sheetName => { - const sheet = sheets[sheetName]; - Object.keys(sheet).forEach(name => { - const expr = sheet[name]; - cells[resolveName(sheetName, name)] = expr; - }); - }); - return cells; -} - -function resolveNamesAsArrays(sheets) { - const cells = []; - Object.keys(sheets).forEach(sheetName => { - const sheet = sheets[sheetName]; - sheet.forEach(name => { - const expr = sheet[name]; - cells.push(resolveName(sheetName, name)); - }); - }); - return cells; -} - -module.exports = { - unresolveName, - resolveName, - resolveNamesAsObjects, - resolveNamesAsArrays -}; - -/***/ }), - -/***/ "./packages/loot-core/src/server/sync/encoder.js": -/*!*******************************************************!*\ - !*** ./packages/loot-core/src/server/sync/encoder.js ***! - \*******************************************************/ -/*! exports provided: encode, decode */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "encode", function() { return encode; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "decode", function() { return decode; }); -/* harmony import */ var _encryption__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../encryption */ "./packages/loot-core/src/server/encryption.js"); -/* harmony import */ var _prefs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../prefs */ "./packages/loot-core/src/server/prefs.js"); - - - -let _require = __webpack_require__(/*! ../errors */ "./packages/loot-core/src/server/errors.js"), - SyncError = _require.SyncError; - -let SyncPb = __webpack_require__(/*! ./proto/sync_pb */ "./packages/loot-core/src/server/sync/proto/sync_pb.js"); - -function coerceBuffer(value) { - // The web encryption APIs give us back raw Uint8Array... but our - // encryption code assumes we can work with it as a buffer. This is - // a leaky abstraction and ideally the our abstraction over the web - // encryption APIs should do this. - if (!Buffer.isBuffer(value)) { - return Buffer.from(value); - } - - return value; -} - -async function encode(groupId, fileId, since, messages) { - let _prefs$getPrefs = _prefs__WEBPACK_IMPORTED_MODULE_1__["getPrefs"](), - encryptKeyId = _prefs$getPrefs.encryptKeyId; - - let requestPb = new SyncPb.SyncRequest(); - - for (let i = 0; i < messages.length; i++) { - let msg = messages[i]; - let envelopePb = new SyncPb.MessageEnvelope(); - envelopePb.setTimestamp(msg.timestamp); - let messagePb = new SyncPb.Message(); - messagePb.setDataset(msg.dataset); - messagePb.setRow(msg.row); - messagePb.setColumn(msg.column); - messagePb.setValue(msg.value); - let binaryMsg = messagePb.serializeBinary(); - - if (encryptKeyId) { - let encrypted = new SyncPb.EncryptedData(); - let result; - - try { - result = await _encryption__WEBPACK_IMPORTED_MODULE_0__["default"].encrypt(binaryMsg, encryptKeyId); - } catch (e) { - throw new SyncError('encrypt-failure', { - isMissingKey: e.message === 'missing-key' - }); - } - - encrypted.setData(result.value); - encrypted.setIv(Buffer.from(result.meta.iv, 'base64')); - encrypted.setAuthtag(Buffer.from(result.meta.authTag, 'base64')); - envelopePb.setContent(encrypted.serializeBinary()); - envelopePb.setIsencrypted(true); - } else { - envelopePb.setContent(binaryMsg); - } - - requestPb.addMessages(envelopePb); - } - - requestPb.setGroupid(groupId); - requestPb.setFileid(fileId); - requestPb.setKeyid(encryptKeyId); - requestPb.setSince(since); - return requestPb.serializeBinary(); -} -async function decode(data) { - let _prefs$getPrefs2 = _prefs__WEBPACK_IMPORTED_MODULE_1__["getPrefs"](), - encryptKeyId = _prefs$getPrefs2.encryptKeyId; - - let responsePb = SyncPb.SyncResponse.deserializeBinary(data); - let merkle = JSON.parse(responsePb.getMerkle()); - let list = responsePb.getMessagesList(); - let messages = []; - - for (let i = 0; i < list.length; i++) { - let envelopePb = list[i]; - let timestamp = envelopePb.getTimestamp(); - let encrypted = envelopePb.getIsencrypted(); - let msg; - - if (encrypted) { - let binary = SyncPb.EncryptedData.deserializeBinary(envelopePb.getContent()); - let decrypted; - - try { - decrypted = await _encryption__WEBPACK_IMPORTED_MODULE_0__["default"].decrypt(coerceBuffer(binary.getData()), { - keyId: encryptKeyId, - algorithm: 'aes-256-gcm', - iv: coerceBuffer(binary.getIv()), - authTag: coerceBuffer(binary.getAuthtag()) - }); - } catch (e) { - console.log(e); - throw new SyncError('decrypt-failure', { - isMissingKey: e.message === 'missing-key' - }); - } - - msg = SyncPb.Message.deserializeBinary(decrypted); - } else { - msg = SyncPb.Message.deserializeBinary(envelopePb.getContent()); - } - - messages.push({ - timestamp: timestamp, - dataset: msg.getDataset(), - row: msg.getRow(), - column: msg.getColumn(), - value: msg.getValue() - }); - } - - return { - messages, - merkle - }; -} - -/***/ }), - -/***/ "./packages/loot-core/src/server/sync/index.js": -/*!*****************************************************!*\ - !*** ./packages/loot-core/src/server/sync/index.js ***! - \*****************************************************/ -/*! exports provided: setSyncingMode, checkSyncingMode, makeTestMessage, resetSync, repairSync, serializeValue, deserializeValue, addSyncListener, applyMessages, receiveMessages, batchMessages, sendMessages, getMessagesSince, syncAndReceiveMessages, clearFullSyncTimeout, scheduleFullSync, initialFullSync, fullSync */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setSyncingMode", function() { return setSyncingMode; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "checkSyncingMode", function() { return checkSyncingMode; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "serializeValue", function() { return serializeValue; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "deserializeValue", function() { return deserializeValue; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addSyncListener", function() { return addSyncListener; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "applyMessages", function() { return applyMessages; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "receiveMessages", function() { return receiveMessages; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "batchMessages", function() { return batchMessages; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "sendMessages", function() { return sendMessages; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getMessagesSince", function() { return getMessagesSince; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "syncAndReceiveMessages", function() { return syncAndReceiveMessages; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "clearFullSyncTimeout", function() { return clearFullSyncTimeout; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "scheduleFullSync", function() { return scheduleFullSync; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "initialFullSync", function() { return initialFullSync; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fullSync", function() { return fullSync; }); -/* harmony import */ var _shared_async__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../shared/async */ "./packages/loot-core/src/shared/async.js"); -/* harmony import */ var _perf__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../perf */ "./packages/loot-core/src/server/perf.js"); -/* harmony import */ var _prefs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../prefs */ "./packages/loot-core/src/server/prefs.js"); -/* harmony import */ var _main_app__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../main-app */ "./packages/loot-core/src/server/main-app.js"); -/* harmony import */ var _platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../platform/server/asyncStorage */ "./packages/loot-core/src/platform/server/asyncStorage/index.electron.js"); -/* harmony import */ var _platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_4__); -/* harmony import */ var _platform_exceptions__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../platform/exceptions */ "./packages/loot-core/src/platform/exceptions/index.electron.js"); -/* harmony import */ var _platform_server_log__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../platform/server/log */ "./packages/loot-core/src/platform/server/log/index.api.js"); -/* harmony import */ var _post__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../post */ "./packages/loot-core/src/server/post.js"); -/* harmony import */ var _db__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../db */ "./packages/loot-core/src/server/db/index.js"); -/* harmony import */ var _sheet__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../sheet */ "./packages/loot-core/src/server/sheet.js"); -/* harmony import */ var _budget_base__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../budget/base */ "./packages/loot-core/src/server/budget/base.js"); -/* harmony import */ var _undo__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../undo */ "./packages/loot-core/src/server/undo.js"); -/* harmony import */ var _mutators__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../mutators */ "./packages/loot-core/src/server/mutators.js"); -/* harmony import */ var _shared_util__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../../shared/util */ "./packages/loot-core/src/shared/util.js"); -/* harmony import */ var _timestamp__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../timestamp */ "./packages/loot-core/src/server/timestamp.js"); -/* harmony import */ var _merkle__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../merkle */ "./packages/loot-core/src/server/merkle.js"); -/* harmony import */ var _encoder__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./encoder */ "./packages/loot-core/src/server/sync/encoder.js"); -/* harmony import */ var _server_config__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ../server-config */ "./packages/loot-core/src/server/server-config.js"); -/* harmony import */ var _repair__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./repair */ "./packages/loot-core/src/server/sync/repair.js"); -/* harmony import */ var _make_test_message__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./make-test-message */ "./packages/loot-core/src/server/sync/make-test-message.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "makeTestMessage", function() { return _make_test_message__WEBPACK_IMPORTED_MODULE_19__["default"]; }); - -/* harmony import */ var _reset__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ./reset */ "./packages/loot-core/src/server/sync/reset.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "resetSync", function() { return _reset__WEBPACK_IMPORTED_MODULE_20__["default"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "repairSync", function() { return _repair__WEBPACK_IMPORTED_MODULE_18__["default"]; }); - -function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } - -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } - -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; } - - - - - - - - - - - - - - - - - - - - - -const _require = __webpack_require__(/*! ../errors */ "./packages/loot-core/src/server/errors.js"), - PostError = _require.PostError, - SyncError = _require.SyncError; - -const connection = __webpack_require__(/*! ../../platform/server/connection */ "./packages/loot-core/src/platform/server/connection/index.api.js"); - -let FULL_SYNC_DELAY = 1000; -let SYNCING_MODE = 'enabled'; -function setSyncingMode(mode) { - let prevMode = SYNCING_MODE; - - switch (mode) { - case 'enabled': - SYNCING_MODE = 'enabled'; - break; - - case 'offline': - SYNCING_MODE = 'offline'; - break; - - case 'disabled': - SYNCING_MODE = 'disabled'; - break; - - case 'import': - SYNCING_MODE = 'import'; - break; - - default: - throw new Error('setSyncingMode: invalid mode: ' + mode); - } - - return prevMode; -} -function checkSyncingMode(mode) { - switch (mode) { - case 'enabled': - return SYNCING_MODE === 'enabled' || SYNCING_MODE === 'offline'; - - case 'disabled': - return SYNCING_MODE === 'disabled' || SYNCING_MODE === 'import'; - - case 'offline': - return SYNCING_MODE === 'offline'; - - case 'import': - return SYNCING_MODE === 'import'; - - default: - throw new Error('checkSyncingMode: invalid mode: ' + mode); - } -} - - - - - - - -function apply(msg, prev) { - let dataset = msg.dataset, - row = msg.row, - column = msg.column, - value = msg.value; - - if (dataset === 'prefs') {// Do nothing, it doesn't exist in the db - } else { - try { - let query; - - if (prev) { - query = { - sql: _db__WEBPACK_IMPORTED_MODULE_8__["cache"](`UPDATE ${dataset} SET ${column} = ? WHERE id = ?`), - params: [value, row] - }; - } else { - query = { - sql: _db__WEBPACK_IMPORTED_MODULE_8__["cache"](`INSERT INTO ${dataset} (id, ${column}) VALUES (?, ?)`), - params: [row, value] - }; - } - - _db__WEBPACK_IMPORTED_MODULE_8__["runQuery"](query.sql, query.params); - } catch (e) { - //console.log(e); - throw new SyncError('invalid-schema'); - } - } -} - -async function fetchAll(table, ids) { - let results = []; // TODO: convert to `whereIn` - - for (let i = 0; i < ids.length; i += 500) { - let partIds = ids.slice(i, i + 500); - let sql; - let column = `${table}.id`; // We have to provide *mapped* data so the spreadsheet works. The functions - // which trigger budget changes based on data changes assumes data has been - // mapped. The only mapped data that the budget is concerned about is - // categories. This is kind of annoying, but we manually map it here - - if (table === 'transactions') { - sql = ` - SELECT t.*, c.transferId AS category - FROM transactions t - LEFT JOIN category_mapping c ON c.id = t.category - `; - column = 't.id'; - } else { - sql = `SELECT * FROM ${table}`; - } - - sql += ` WHERE `; - sql += partIds.map(id => `${column} = ?`).join(' OR '); - - try { - let rows = await _db__WEBPACK_IMPORTED_MODULE_8__["runQuery"](sql, partIds, true); - results = results.concat(rows); - } catch (e) { - throw new SyncError('invalid-schema'); - } - } - - return results; -} - -function serializeValue(value) { - if (value === null) { - return '0:'; - } else if (typeof value === 'number') { - return 'N:' + value; - } else if (typeof value === 'string') { - return 'S:' + value; - } - - throw new Error('Unserializable value type: ' + JSON.stringify(value)); -} -function deserializeValue(value) { - const type = value[0]; - - switch (type) { - case '0': - return null; - - case 'N': - return parseFloat(value.slice(2)); - - case 'S': - return value.slice(2); - - default: - } - - throw new Error('Invalid type key for value: ' + value); -} -let _syncListeners = []; -function addSyncListener(func) { - _syncListeners.push(func); - - return () => { - _syncListeners = _syncListeners.filter(f => f !== func); - }; -} - -async function compareMessages(messages) { - let newMessages = []; - - for (let i = 0; i < messages.length; i++) { - let message = messages[i]; - let dataset = message.dataset, - row = message.row, - column = message.column, - timestamp = message.timestamp; - let timestampStr = timestamp.toString(); - let res = _db__WEBPACK_IMPORTED_MODULE_8__["runQuery"](_db__WEBPACK_IMPORTED_MODULE_8__["cache"]('SELECT timestamp FROM messages_crdt WHERE dataset = ? AND row = ? AND column = ? AND timestamp >= ?'), [dataset, row, column, timestampStr], true); // Returned message is any one that is "later" than this message, - // meaning if the result exists this message is an old one - - if (res.length === 0) { - newMessages.push(message); - } else if (res[0].timestamp !== timestampStr) { - newMessages.push(_objectSpread(_objectSpread({}, message), {}, { - old: true - })); - } - } - - return newMessages; -} // This is the fast path `apply` function when in "import" mode. -// There's no need to run through the whole sync system when -// importing, but **there is a caveat**: because we don't run sync -// listeners importers should not rely on any functions that use any -// projected state (like rules). We can't fire those because they -// depend on having both old and new data which we don't quere here - - -function applyMessagesForImport(messages) { - _db__WEBPACK_IMPORTED_MODULE_8__["transaction"](() => { - for (let i = 0; i < messages.length; i++) { - let msg = messages[i]; - let dataset = msg.dataset, - row = msg.row, - column = msg.column, - timestamp = msg.timestamp, - value = msg.value; - - if (!msg.old) { - try { - apply(msg); - } catch (e) { - apply(msg, true); - } - - if (dataset === 'prefs') { - throw new Error('Cannot set prefs while importing'); - } - } - } - }); -} - -const applyMessages = Object(_shared_async__WEBPACK_IMPORTED_MODULE_0__["sequential"])(async messages => { - if (checkSyncingMode('import')) { - return applyMessagesForImport(messages); - } else if (checkSyncingMode('enabled')) { - // Compare the messages with the existing crdt. This filters out - // already applied messages and determines if a message is old or - // not. An "old" message doesn't need to be applied, but it still - // needs to be put into the merkle trie to maintain the hash. - messages = await compareMessages(messages); - } - - messages = [...messages].sort((m1, m2) => { - let t1 = m1.timestamp ? m1.timestamp.toString() : ''; - let t2 = m2.timestamp ? m2.timestamp.toString() : ''; - - if (t1 < t2) { - return -1; - } else if (t1 > t2) { - return 1; - } - - return 0; - }); - let idsPerTable = {}; - messages.forEach(msg => { - if (msg.dataset === 'prefs') { - return; - } - - if (idsPerTable[msg.dataset] == null) { - idsPerTable[msg.dataset] = []; - } - - idsPerTable[msg.dataset].push(msg.row); - }); - - async function fetchData() { - let data = new Map(); - - for (let table of Object.keys(idsPerTable)) { - const rows = await fetchAll(table, idsPerTable[table]); - - for (let i = 0; i < rows.length; i++) { - let row = rows[i]; - Object(_shared_util__WEBPACK_IMPORTED_MODULE_13__["setIn"])(data, [table, row.id], row); - } - } - - return data; - } - - let prefsToSet = {}; - let oldData = await fetchData(); - _undo__WEBPACK_IMPORTED_MODULE_11__["appendMessages"](messages, oldData); // It's important to not mutate the clock while processing the - // messages. We only want to mutate it if the transaction succeeds. - // The merkle variable will be updated while applying the messages and - // we'll apply it afterwards. - - let clock; - let currentMerkle; - - if (checkSyncingMode('enabled')) { - clock = Object(_timestamp__WEBPACK_IMPORTED_MODULE_14__["getClock"])(); - currentMerkle = clock.merkle; - } - - if (_sheet__WEBPACK_IMPORTED_MODULE_9__["get"]()) { - _sheet__WEBPACK_IMPORTED_MODULE_9__["get"]().startCacheBarrier(); - } // Now that we have all of the data, go through and apply the - // messages carefully. This transaction is **crucial**: it - // guarantees that everything is atomically committed to the - // database, and if any part of it fails everything aborts and - // nothing is changed. This is critical to maintain consistency. We - // also avoid any side effects to in-memory objects, and apply them - // after this succeeds. - - - _db__WEBPACK_IMPORTED_MODULE_8__["transaction"](() => { - let added = new Set(); - - for (let i = 0; i < messages.length; i++) { - let msg = messages[i]; - let dataset = msg.dataset, - row = msg.row, - column = msg.column, - timestamp = msg.timestamp, - value = msg.value; - - if (!msg.old) { - apply(msg, Object(_shared_util__WEBPACK_IMPORTED_MODULE_13__["getIn"])(oldData, [dataset, row]) || added.has(dataset + row)); - - if (dataset === 'prefs') { - prefsToSet[row] = value; - } else { - // Keep track of which items have been added it in this sync - // so it knows whether they already exist in the db or not. We - // ignore any changes to the spreadsheet. - added.add(dataset + row); - } - } - - if (checkSyncingMode('enabled')) { - _db__WEBPACK_IMPORTED_MODULE_8__["runQuery"](_db__WEBPACK_IMPORTED_MODULE_8__["cache"](`INSERT INTO messages_crdt (timestamp, dataset, row, column, value) - VALUES (?, ?, ?, ?, ?)`), [timestamp.toString(), dataset, row, column, serializeValue(value)]); - currentMerkle = _merkle__WEBPACK_IMPORTED_MODULE_15__["insert"](currentMerkle, msg.timestamp); - } - } - - if (checkSyncingMode('enabled')) { - currentMerkle = _merkle__WEBPACK_IMPORTED_MODULE_15__["prune"](currentMerkle); // Save the clock in the db first (queries might throw - // exceptions) - - _db__WEBPACK_IMPORTED_MODULE_8__["runQuery"](_db__WEBPACK_IMPORTED_MODULE_8__["cache"]('INSERT OR REPLACE INTO messages_clock (id, clock) VALUES (1, ?)'), [Object(_timestamp__WEBPACK_IMPORTED_MODULE_14__["serializeClock"])(_objectSpread(_objectSpread({}, clock), {}, { - merkle: currentMerkle - }))]); - } - }); - - if (checkSyncingMode('enabled')) { - // The transaction succeeded, so we can update in-memory objects - // now. Update the in-memory clock. - clock.merkle = currentMerkle; - } // Save any synced prefs - - - if (Object.keys(prefsToSet).length > 0) { - _prefs__WEBPACK_IMPORTED_MODULE_2__["savePrefs"](prefsToSet, { - avoidSync: true - }); - - if (prefsToSet.budgetType) { - Object(_budget_base__WEBPACK_IMPORTED_MODULE_10__["setType"])(prefsToSet.budgetType); - } - - connection.send('prefs-updated'); - } - - let newData = await fetchData(); // In testing, sometimes the spreadsheet isn't loaded, and that's ok - - if (_sheet__WEBPACK_IMPORTED_MODULE_9__["get"]()) { - // Need to clean up these APIs and make them consistent - _sheet__WEBPACK_IMPORTED_MODULE_9__["startTransaction"](); - Object(_budget_base__WEBPACK_IMPORTED_MODULE_10__["triggerBudgetChanges"])(oldData, newData); - _sheet__WEBPACK_IMPORTED_MODULE_9__["get"]().triggerDatabaseChanges(oldData, newData); - _sheet__WEBPACK_IMPORTED_MODULE_9__["endTransaction"](); // Allow the cache to be used in the future. At this point it's guaranteed - // to be up-to-date because we are done mutating any other data - - _sheet__WEBPACK_IMPORTED_MODULE_9__["get"]().endCacheBarrier(); - } - - _syncListeners.forEach(func => func(oldData, newData)); - - let tables = getTablesFromMessages(messages.filter(msg => !msg.old)); - _main_app__WEBPACK_IMPORTED_MODULE_3__["default"].events.emit('sync', { - type: 'applied', - tables, - data: newData, - prevData: oldData - }); - return messages; -}); -function receiveMessages(messages) { - messages.forEach(msg => { - _timestamp__WEBPACK_IMPORTED_MODULE_14__["default"].recv(msg.timestamp); - }); - return Object(_mutators__WEBPACK_IMPORTED_MODULE_12__["runMutator"])(() => applyMessages(messages)); -} - -async function _sendMessages(messages) { - try { - await applyMessages(messages); - } catch (e) { - if (e instanceof SyncError) { - if (e.reason === 'invalid-schema') { - // We know this message came from a local modification, and it - // couldn't apply, which doesn't make any sense. Must be a bug - // in the code. Send a specific error type for it for a custom - // message. - _main_app__WEBPACK_IMPORTED_MODULE_3__["default"].events.emit('sync', { - type: 'error', - subtype: 'apply-failure' - }); - } else { - _main_app__WEBPACK_IMPORTED_MODULE_3__["default"].events.emit('sync', { - type: 'error' - }); - } - } - - throw e; - } - - await scheduleFullSync(); -} - -let IS_BATCHING = false; -let _BATCHED = []; -async function batchMessages(func) { - if (IS_BATCHING) { - await func(); - return; - } - - IS_BATCHING = true; - let batched = []; - - try { - await func(); // TODO: if it fails, it shouldn't apply them? - } finally { - IS_BATCHING = false; - batched = _BATCHED; - _BATCHED = []; - } - - if (batched.length > 0) { - await _sendMessages(batched); - } -} -async function sendMessages(messages) { - if (IS_BATCHING) { - _BATCHED = _BATCHED.concat(messages); - } else { - return _sendMessages(messages); - } -} -function getMessagesSince(since) { - return _db__WEBPACK_IMPORTED_MODULE_8__["runQuery"]('SELECT timestamp, dataset, row, column, value FROM messages_crdt WHERE timestamp > ?', [since], true); -} -async function syncAndReceiveMessages(messages, since) { - let localMessages = await getMessagesSince(since); - await receiveMessages(messages.map(msg => _objectSpread(_objectSpread({}, msg), {}, { - value: deserializeValue(msg.value), - timestamp: _timestamp__WEBPACK_IMPORTED_MODULE_14__["default"].parse(msg.timestamp) - }))); - return localMessages; -} -function clearFullSyncTimeout() { - if (syncTimeout) { - clearTimeout(syncTimeout); - syncTimeout = null; - } -} -let syncTimeout = null; -function scheduleFullSync() { - clearFullSyncTimeout(); - - if (checkSyncingMode('enabled') && !checkSyncingMode('offline')) { - if (global.__TESTING__) { - return fullSync().then(res => { - if (res.error) { - throw res.error; - } - - return res; - }); - } else { - syncTimeout = setTimeout(fullSync, FULL_SYNC_DELAY); - } - } -} - -function getTablesFromMessages(messages) { - return messages.reduce((acc, message) => { - let dataset = message.dataset === 'schedules_next_date' ? 'schedules' : message.dataset; - - if (!acc.includes(dataset)) { - acc.push(dataset); - } - - return acc; - }, []); -} // This is different than `fullSync` because it waits for the -// spreadsheet to finish any processing. This is useful if we want to -// perform a full sync and wait for everything to finish, usually if -// you're doing an initial sync before working with a file. - - -async function initialFullSync() { - let result = await fullSync(); - - if (!result.error) { - // Make sure to wait for anything in the spreadsheet to process - await _sheet__WEBPACK_IMPORTED_MODULE_9__["waitOnSpreadsheet"](); - } -} -const fullSync = Object(_shared_async__WEBPACK_IMPORTED_MODULE_0__["once"])(async function () { - _main_app__WEBPACK_IMPORTED_MODULE_3__["default"].events.emit('sync', { - type: 'start' - }); - let messages; - - try { - messages = await _fullSync(null, 0, null); - } catch (e) { - console.log(e); - - if (e instanceof SyncError) { - if (e.reason === 'out-of-sync') { - Object(_platform_exceptions__WEBPACK_IMPORTED_MODULE_5__["captureException"])(e); - _main_app__WEBPACK_IMPORTED_MODULE_3__["default"].events.emit('sync', { - type: 'error', - subtype: 'out-of-sync' - }); - } else if (e.reason === 'invalid-schema') { - _main_app__WEBPACK_IMPORTED_MODULE_3__["default"].events.emit('sync', { - type: 'error', - subtype: 'invalid-schema' - }); - } else if (e.reason === 'decrypt-failure' || e.reason === 'encrypt-failure') { - _main_app__WEBPACK_IMPORTED_MODULE_3__["default"].events.emit('sync', { - type: 'error', - subtype: e.reason, - meta: e.meta - }); - } else if (e.reason === 'beta-version') { - _main_app__WEBPACK_IMPORTED_MODULE_3__["default"].events.emit('sync', { - type: 'error', - subtype: e.reason - }); - } else { - _main_app__WEBPACK_IMPORTED_MODULE_3__["default"].events.emit('sync', { - type: 'error' - }); - } - } else if (e instanceof PostError) { - console.log(e); - - if (e.reason === 'unauthorized') { - _main_app__WEBPACK_IMPORTED_MODULE_3__["default"].events.emit('sync', { - type: 'unauthorized' - }); // Set the user into read-only mode - - _platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_4___default.a.setItem('readOnly', 'true'); - } else if (e.reason === 'network-failure') { - _main_app__WEBPACK_IMPORTED_MODULE_3__["default"].events.emit('sync', { - type: 'error', - subtype: 'network' - }); - } else { - _main_app__WEBPACK_IMPORTED_MODULE_3__["default"].events.emit('sync', { - type: 'error', - subtype: e.reason - }); - } - } else { - Object(_platform_exceptions__WEBPACK_IMPORTED_MODULE_5__["captureException"])(e); // TODO: Send the message to the client and allow them to expand & view it - - _main_app__WEBPACK_IMPORTED_MODULE_3__["default"].events.emit('sync', { - type: 'error' - }); - } - - return { - error: { - message: e.message, - reason: e.reason, - meta: e.meta - } - }; - } - - let tables = getTablesFromMessages(messages); - _main_app__WEBPACK_IMPORTED_MODULE_3__["default"].events.emit('sync', { - type: 'success', - tables, - syncDisabled: checkSyncingMode('disabled') - }); - return { - messages - }; -}); - -async function _fullSync(sinceTimestamp, count, prevDiffTime) { - let _ref = _prefs__WEBPACK_IMPORTED_MODULE_2__["getPrefs"]() || {}, - cloudFileId = _ref.cloudFileId, - groupId = _ref.groupId, - lastSyncedTimestamp = _ref.lastSyncedTimestamp; - - clearFullSyncTimeout(); - - if (checkSyncingMode('disabled') || checkSyncingMode('offline')) { - return []; - } // Snapshot the point at which we are currently syncing - - - let currentTime = Object(_timestamp__WEBPACK_IMPORTED_MODULE_14__["getClock"])().timestamp.toString(); - let since = sinceTimestamp || lastSyncedTimestamp || // Default to 5 minutes ago - new _timestamp__WEBPACK_IMPORTED_MODULE_14__["default"](Date.now() - 5 * 60 * 1000, 0, '0').toString(); - let messages = getMessagesSince(since); - let userToken = await _platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_4___default.a.getItem('user-token'); - _platform_server_log__WEBPACK_IMPORTED_MODULE_6__["default"].info('Syncing since', since, messages.length, '(attempt: ' + count + ')'); - let buffer = await _encoder__WEBPACK_IMPORTED_MODULE_16__["encode"](groupId, cloudFileId, since, messages); // TODO: There a limit on how many messages we can send because of - // the payload size. Right now it's at 20MB on the server. We should - // check the worst case here and make multiple requests if it's - // really large. - - let resBuffer = await Object(_post__WEBPACK_IMPORTED_MODULE_7__["postBinary"])(Object(_server_config__WEBPACK_IMPORTED_MODULE_17__["getServer"])().SYNC_SERVER + '/sync', buffer, { - 'X-ACTUAL-TOKEN': userToken - }); // Abort if the file is either no longer loaded, the group id has - // changed because of a sync reset - - if (!_prefs__WEBPACK_IMPORTED_MODULE_2__["getPrefs"]() || _prefs__WEBPACK_IMPORTED_MODULE_2__["getPrefs"]().groupId !== groupId) { - return []; - } - - let res = await _encoder__WEBPACK_IMPORTED_MODULE_16__["decode"](resBuffer); - _platform_server_log__WEBPACK_IMPORTED_MODULE_6__["default"].info('Got messages from server', res.messages.length); - let localTimeChanged = Object(_timestamp__WEBPACK_IMPORTED_MODULE_14__["getClock"])().timestamp.toString() !== currentTime; // Apply the new messages - - let receivedMessages = []; - - if (res.messages.length > 0) { - receivedMessages = await receiveMessages(res.messages.map(msg => _objectSpread(_objectSpread({}, msg), {}, { - value: deserializeValue(msg.value), - timestamp: _timestamp__WEBPACK_IMPORTED_MODULE_14__["default"].parse(msg.timestamp) - }))); - } - - let diffTime = _merkle__WEBPACK_IMPORTED_MODULE_15__["diff"](res.merkle, Object(_timestamp__WEBPACK_IMPORTED_MODULE_14__["getClock"])().merkle); - let result = res.messages; - - if (diffTime !== null) { - // This is a bit wonky, but we loop until we are in sync with the - // server. While syncing, either the client or server could change - // out from under us, so it might take a couple passes to - // completely sync up. This is a check that stops the loop in case - // we are corrupted and can't sync up. We try 10 times if we keep - // getting the same diff time, and add a upper limit of 300 no - // matter what (just to stop this from ever being an infinite - // loop). - // - // It's slightly possible for the user to add more messages while we - // are in `receiveMessages`, but `localTimeChanged` would still be - // false. In that case, we don't reset the counter but it should be - // very unlikely that this happens enough to hit the loop limit. - if (count >= 10 && diffTime === prevDiffTime || count >= 100) { - _platform_server_log__WEBPACK_IMPORTED_MODULE_6__["default"].info('SENT -------'); - _platform_server_log__WEBPACK_IMPORTED_MODULE_6__["default"].info(JSON.stringify(messages)); - _platform_server_log__WEBPACK_IMPORTED_MODULE_6__["default"].info('RECEIVED -------'); - _platform_server_log__WEBPACK_IMPORTED_MODULE_6__["default"].info(JSON.stringify(res.messages)); - let rebuiltMerkle = Object(_repair__WEBPACK_IMPORTED_MODULE_18__["rebuildMerkleHash"])(); - console.log(count, 'messages:', messages.length, messages.length > 0 ? messages[0] : null, 'res.messages:', res.messages.length, res.messages.length > 0 ? res.messages[0] : null, 'clientId', Object(_timestamp__WEBPACK_IMPORTED_MODULE_14__["getClock"])().timestamp.node(), 'groupId', groupId, 'diffTime:', diffTime, diffTime === prevDiffTime, 'local clock:', Object(_timestamp__WEBPACK_IMPORTED_MODULE_14__["getClock"])().timestamp.toString(), Object(_timestamp__WEBPACK_IMPORTED_MODULE_14__["getClock"])().merkle.hash, 'rebuilt hash:', rebuiltMerkle.numMessages, rebuiltMerkle.trie.hash, 'server hash:', res.merkle.hash, 'localTimeChanged:', localTimeChanged); - - if (rebuiltMerkle.trie.hash === res.merkle.hash) { - // Rebuilding the merkle worked... but why? - let clocks = await _db__WEBPACK_IMPORTED_MODULE_8__["all"]('SELECT * FROM messages_clock'); - - if (clocks.length !== 1) { - console.log('Bad number of clocks:', clocks.length); - } - - let hash = Object(_timestamp__WEBPACK_IMPORTED_MODULE_14__["deserializeClock"])(clocks[0]).merkle.hash; - console.log('Merkle hash in db:', hash); - } - - throw new SyncError('out-of-sync'); - } - - receivedMessages = receivedMessages.concat(await _fullSync(new _timestamp__WEBPACK_IMPORTED_MODULE_14__["default"](diffTime, 0, '0').toString(), // If something local changed while we were syncing, always - // reset, token the counter. We never want to think syncing failed - // because we tried to syncing many times and couldn't sync, - // but it was because the user kept changing stuff in the - // middle of syncing. - localTimeChanged ? 0 : count + 1, diffTime)); - } else { - // All synced up, store the current time as a simple optimization - // for the next sync - await _prefs__WEBPACK_IMPORTED_MODULE_2__["savePrefs"]({ - lastSyncedTimestamp: Object(_timestamp__WEBPACK_IMPORTED_MODULE_14__["getClock"])().timestamp.toString() - }); - } - - return receivedMessages; -} - -/***/ }), - -/***/ "./packages/loot-core/src/server/sync/make-test-message.js": -/*!*****************************************************************!*\ - !*** ./packages/loot-core/src/server/sync/make-test-message.js ***! - \*****************************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return makeTestMessage; }); -/* harmony import */ var _encryption__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../encryption */ "./packages/loot-core/src/server/encryption.js"); - - -let SyncPb = __webpack_require__(/*! ./proto/sync_pb */ "./packages/loot-core/src/server/sync/proto/sync_pb.js"); - -async function randomString() { - return (await _encryption__WEBPACK_IMPORTED_MODULE_0__["default"].randomBytes(12)).toString(); -} - -async function makeTestMessage(keyId) { - let messagePb = new SyncPb.Message(); - messagePb.setDataset(await randomString()); - messagePb.setRow(await randomString()); - messagePb.setColumn(await randomString()); - messagePb.setValue(await randomString()); - let binaryMsg = messagePb.serializeBinary(); - return await _encryption__WEBPACK_IMPORTED_MODULE_0__["default"].encrypt(binaryMsg, keyId); -} - -/***/ }), - -/***/ "./packages/loot-core/src/server/sync/migrate.js": -/*!*******************************************************!*\ - !*** ./packages/loot-core/src/server/sync/migrate.js ***! - \*******************************************************/ -/*! exports provided: listen, unlisten */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "listen", function() { return listen; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "unlisten", function() { return unlisten; }); -/* harmony import */ var _index__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./index */ "./packages/loot-core/src/server/sync/index.js"); -/* harmony import */ var _timestamp__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../timestamp */ "./packages/loot-core/src/server/timestamp.js"); - - - -function migrateParentIds(oldValues, newValues) { - newValues.forEach((items, table) => { - if (table === 'transactions') { - let old = oldValues.get(table); - let toApply = []; - items.forEach(newValue => { - if (newValue.isChild === 1 && newValue.parent_id == null && newValue.id.includes('/')) { - let parentId = newValue.id.split('/')[0]; - toApply.push({ - dataset: 'transactions', - row: newValue.id, - column: 'parent_id', - value: parentId, - timestamp: _timestamp__WEBPACK_IMPORTED_MODULE_1__["default"].send() - }); - } - }); - - if (toApply.length > 0) { - Object(_index__WEBPACK_IMPORTED_MODULE_0__["applyMessages"])(toApply); - } - } - }); -} - -let _unlisten = null; -function listen() { - unlisten(); - _unlisten = Object(_index__WEBPACK_IMPORTED_MODULE_0__["addSyncListener"])(migrateParentIds); -} -function unlisten() { - if (_unlisten) { - _unlisten(); - - _unlisten = null; - } -} - -/***/ }), - -/***/ "./packages/loot-core/src/server/sync/proto/sync_pb.js": -/*!*************************************************************!*\ - !*** ./packages/loot-core/src/server/sync/proto/sync_pb.js ***! - \*************************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -// source: sync.proto - -/** - * @fileoverview - * @enhanceable - * @suppress {messageConventions} JS Compiler reports an error if a variable or - * field starts with 'MSG_' and isn't a translatable message. - * @public - */ -// GENERATED CODE -- DO NOT EDIT! -var jspb = __webpack_require__(/*! google-protobuf */ "./node_modules/google-protobuf/google-protobuf.js"); - -var goog = jspb; -var global = globalThis; -goog.exportSymbol('proto.EncryptedData', null, global); -goog.exportSymbol('proto.Message', null, global); -goog.exportSymbol('proto.MessageEnvelope', null, global); -goog.exportSymbol('proto.SyncRequest', null, global); -goog.exportSymbol('proto.SyncResponse', null, global); -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ - -proto.EncryptedData = function (opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; - -goog.inherits(proto.EncryptedData, jspb.Message); - -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.EncryptedData.displayName = 'proto.EncryptedData'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ - - -proto.Message = function (opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; - -goog.inherits(proto.Message, jspb.Message); - -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.Message.displayName = 'proto.Message'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ - - -proto.MessageEnvelope = function (opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; - -goog.inherits(proto.MessageEnvelope, jspb.Message); - -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.MessageEnvelope.displayName = 'proto.MessageEnvelope'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ - - -proto.SyncRequest = function (opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, proto.SyncRequest.repeatedFields_, null); -}; - -goog.inherits(proto.SyncRequest, jspb.Message); - -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.SyncRequest.displayName = 'proto.SyncRequest'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ - - -proto.SyncResponse = function (opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, proto.SyncResponse.repeatedFields_, null); -}; - -goog.inherits(proto.SyncResponse, jspb.Message); - -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.SyncResponse.displayName = 'proto.SyncResponse'; -} - -if (jspb.Message.GENERATE_TO_OBJECT) { - /** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ - proto.EncryptedData.prototype.toObject = function (opt_includeInstance) { - return proto.EncryptedData.toObject(opt_includeInstance, this); - }; - /** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.EncryptedData} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ - - - proto.EncryptedData.toObject = function (includeInstance, msg) { - var f, - obj = { - iv: msg.getIv_asB64(), - authtag: msg.getAuthtag_asB64(), - data: msg.getData_asB64() - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - - return obj; - }; -} -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.EncryptedData} - */ - - -proto.EncryptedData.deserializeBinary = function (bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.EncryptedData(); - return proto.EncryptedData.deserializeBinaryFromReader(msg, reader); -}; -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.EncryptedData} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.EncryptedData} - */ - - -proto.EncryptedData.deserializeBinaryFromReader = function (msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - - var field = reader.getFieldNumber(); - - switch (field) { - case 1: - var value = - /** @type {!Uint8Array} */ - reader.readBytes(); - msg.setIv(value); - break; - - case 2: - var value = - /** @type {!Uint8Array} */ - reader.readBytes(); - msg.setAuthtag(value); - break; - - case 3: - var value = - /** @type {!Uint8Array} */ - reader.readBytes(); - msg.setData(value); - break; - - default: - reader.skipField(); - break; - } - } - - return msg; -}; -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ - - -proto.EncryptedData.prototype.serializeBinary = function () { - var writer = new jspb.BinaryWriter(); - proto.EncryptedData.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.EncryptedData} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ - - -proto.EncryptedData.serializeBinaryToWriter = function (message, writer) { - var f = undefined; - f = message.getIv_asU8(); - - if (f.length > 0) { - writer.writeBytes(1, f); - } - - f = message.getAuthtag_asU8(); - - if (f.length > 0) { - writer.writeBytes(2, f); - } - - f = message.getData_asU8(); - - if (f.length > 0) { - writer.writeBytes(3, f); - } -}; -/** - * optional bytes iv = 1; - * @return {!(string|Uint8Array)} - */ - - -proto.EncryptedData.prototype.getIv = function () { - return ( - /** @type {!(string|Uint8Array)} */ - jspb.Message.getFieldWithDefault(this, 1, "") - ); -}; -/** - * optional bytes iv = 1; - * This is a type-conversion wrapper around `getIv()` - * @return {string} - */ - - -proto.EncryptedData.prototype.getIv_asB64 = function () { - return ( - /** @type {string} */ - jspb.Message.bytesAsB64(this.getIv()) - ); -}; -/** - * optional bytes iv = 1; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getIv()` - * @return {!Uint8Array} - */ - - -proto.EncryptedData.prototype.getIv_asU8 = function () { - return ( - /** @type {!Uint8Array} */ - jspb.Message.bytesAsU8(this.getIv()) - ); -}; -/** - * @param {!(string|Uint8Array)} value - * @return {!proto.EncryptedData} returns this - */ - - -proto.EncryptedData.prototype.setIv = function (value) { - return jspb.Message.setProto3BytesField(this, 1, value); -}; -/** - * optional bytes authTag = 2; - * @return {!(string|Uint8Array)} - */ - - -proto.EncryptedData.prototype.getAuthtag = function () { - return ( - /** @type {!(string|Uint8Array)} */ - jspb.Message.getFieldWithDefault(this, 2, "") - ); -}; -/** - * optional bytes authTag = 2; - * This is a type-conversion wrapper around `getAuthtag()` - * @return {string} - */ - - -proto.EncryptedData.prototype.getAuthtag_asB64 = function () { - return ( - /** @type {string} */ - jspb.Message.bytesAsB64(this.getAuthtag()) - ); -}; -/** - * optional bytes authTag = 2; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getAuthtag()` - * @return {!Uint8Array} - */ - - -proto.EncryptedData.prototype.getAuthtag_asU8 = function () { - return ( - /** @type {!Uint8Array} */ - jspb.Message.bytesAsU8(this.getAuthtag()) - ); -}; -/** - * @param {!(string|Uint8Array)} value - * @return {!proto.EncryptedData} returns this - */ - - -proto.EncryptedData.prototype.setAuthtag = function (value) { - return jspb.Message.setProto3BytesField(this, 2, value); -}; -/** - * optional bytes data = 3; - * @return {!(string|Uint8Array)} - */ - - -proto.EncryptedData.prototype.getData = function () { - return ( - /** @type {!(string|Uint8Array)} */ - jspb.Message.getFieldWithDefault(this, 3, "") - ); -}; -/** - * optional bytes data = 3; - * This is a type-conversion wrapper around `getData()` - * @return {string} - */ - - -proto.EncryptedData.prototype.getData_asB64 = function () { - return ( - /** @type {string} */ - jspb.Message.bytesAsB64(this.getData()) - ); -}; -/** - * optional bytes data = 3; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getData()` - * @return {!Uint8Array} - */ - - -proto.EncryptedData.prototype.getData_asU8 = function () { - return ( - /** @type {!Uint8Array} */ - jspb.Message.bytesAsU8(this.getData()) - ); -}; -/** - * @param {!(string|Uint8Array)} value - * @return {!proto.EncryptedData} returns this - */ - - -proto.EncryptedData.prototype.setData = function (value) { - return jspb.Message.setProto3BytesField(this, 3, value); -}; - -if (jspb.Message.GENERATE_TO_OBJECT) { - /** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ - proto.Message.prototype.toObject = function (opt_includeInstance) { - return proto.Message.toObject(opt_includeInstance, this); - }; - /** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.Message} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ - - - proto.Message.toObject = function (includeInstance, msg) { - var f, - obj = { - dataset: jspb.Message.getFieldWithDefault(msg, 1, ""), - row: jspb.Message.getFieldWithDefault(msg, 2, ""), - column: jspb.Message.getFieldWithDefault(msg, 3, ""), - value: jspb.Message.getFieldWithDefault(msg, 4, "") - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - - return obj; - }; -} -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.Message} - */ - - -proto.Message.deserializeBinary = function (bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.Message(); - return proto.Message.deserializeBinaryFromReader(msg, reader); -}; -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.Message} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.Message} - */ - - -proto.Message.deserializeBinaryFromReader = function (msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - - var field = reader.getFieldNumber(); - - switch (field) { - case 1: - var value = - /** @type {string} */ - reader.readString(); - msg.setDataset(value); - break; - - case 2: - var value = - /** @type {string} */ - reader.readString(); - msg.setRow(value); - break; - - case 3: - var value = - /** @type {string} */ - reader.readString(); - msg.setColumn(value); - break; - - case 4: - var value = - /** @type {string} */ - reader.readString(); - msg.setValue(value); - break; - - default: - reader.skipField(); - break; - } - } - - return msg; -}; -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ - - -proto.Message.prototype.serializeBinary = function () { - var writer = new jspb.BinaryWriter(); - proto.Message.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.Message} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ - - -proto.Message.serializeBinaryToWriter = function (message, writer) { - var f = undefined; - f = message.getDataset(); - - if (f.length > 0) { - writer.writeString(1, f); - } - - f = message.getRow(); - - if (f.length > 0) { - writer.writeString(2, f); - } - - f = message.getColumn(); - - if (f.length > 0) { - writer.writeString(3, f); - } - - f = message.getValue(); - - if (f.length > 0) { - writer.writeString(4, f); - } -}; -/** - * optional string dataset = 1; - * @return {string} - */ - - -proto.Message.prototype.getDataset = function () { - return ( - /** @type {string} */ - jspb.Message.getFieldWithDefault(this, 1, "") - ); -}; -/** - * @param {string} value - * @return {!proto.Message} returns this - */ - - -proto.Message.prototype.setDataset = function (value) { - return jspb.Message.setProto3StringField(this, 1, value); -}; -/** - * optional string row = 2; - * @return {string} - */ - - -proto.Message.prototype.getRow = function () { - return ( - /** @type {string} */ - jspb.Message.getFieldWithDefault(this, 2, "") - ); -}; -/** - * @param {string} value - * @return {!proto.Message} returns this - */ - - -proto.Message.prototype.setRow = function (value) { - return jspb.Message.setProto3StringField(this, 2, value); -}; -/** - * optional string column = 3; - * @return {string} - */ - - -proto.Message.prototype.getColumn = function () { - return ( - /** @type {string} */ - jspb.Message.getFieldWithDefault(this, 3, "") - ); -}; -/** - * @param {string} value - * @return {!proto.Message} returns this - */ - - -proto.Message.prototype.setColumn = function (value) { - return jspb.Message.setProto3StringField(this, 3, value); -}; -/** - * optional string value = 4; - * @return {string} - */ - - -proto.Message.prototype.getValue = function () { - return ( - /** @type {string} */ - jspb.Message.getFieldWithDefault(this, 4, "") - ); -}; -/** - * @param {string} value - * @return {!proto.Message} returns this - */ - - -proto.Message.prototype.setValue = function (value) { - return jspb.Message.setProto3StringField(this, 4, value); -}; - -if (jspb.Message.GENERATE_TO_OBJECT) { - /** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ - proto.MessageEnvelope.prototype.toObject = function (opt_includeInstance) { - return proto.MessageEnvelope.toObject(opt_includeInstance, this); - }; - /** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.MessageEnvelope} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ - - - proto.MessageEnvelope.toObject = function (includeInstance, msg) { - var f, - obj = { - timestamp: jspb.Message.getFieldWithDefault(msg, 1, ""), - isencrypted: jspb.Message.getBooleanFieldWithDefault(msg, 2, false), - content: msg.getContent_asB64() - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - - return obj; - }; -} -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.MessageEnvelope} - */ - - -proto.MessageEnvelope.deserializeBinary = function (bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.MessageEnvelope(); - return proto.MessageEnvelope.deserializeBinaryFromReader(msg, reader); -}; -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.MessageEnvelope} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.MessageEnvelope} - */ - - -proto.MessageEnvelope.deserializeBinaryFromReader = function (msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - - var field = reader.getFieldNumber(); - - switch (field) { - case 1: - var value = - /** @type {string} */ - reader.readString(); - msg.setTimestamp(value); - break; - - case 2: - var value = - /** @type {boolean} */ - reader.readBool(); - msg.setIsencrypted(value); - break; - - case 3: - var value = - /** @type {!Uint8Array} */ - reader.readBytes(); - msg.setContent(value); - break; - - default: - reader.skipField(); - break; - } - } - - return msg; -}; -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ - - -proto.MessageEnvelope.prototype.serializeBinary = function () { - var writer = new jspb.BinaryWriter(); - proto.MessageEnvelope.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.MessageEnvelope} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ - - -proto.MessageEnvelope.serializeBinaryToWriter = function (message, writer) { - var f = undefined; - f = message.getTimestamp(); - - if (f.length > 0) { - writer.writeString(1, f); - } - - f = message.getIsencrypted(); - - if (f) { - writer.writeBool(2, f); - } - - f = message.getContent_asU8(); - - if (f.length > 0) { - writer.writeBytes(3, f); - } -}; -/** - * optional string timestamp = 1; - * @return {string} - */ - - -proto.MessageEnvelope.prototype.getTimestamp = function () { - return ( - /** @type {string} */ - jspb.Message.getFieldWithDefault(this, 1, "") - ); -}; -/** - * @param {string} value - * @return {!proto.MessageEnvelope} returns this - */ - - -proto.MessageEnvelope.prototype.setTimestamp = function (value) { - return jspb.Message.setProto3StringField(this, 1, value); -}; -/** - * optional bool isEncrypted = 2; - * @return {boolean} - */ - - -proto.MessageEnvelope.prototype.getIsencrypted = function () { - return ( - /** @type {boolean} */ - jspb.Message.getBooleanFieldWithDefault(this, 2, false) - ); -}; -/** - * @param {boolean} value - * @return {!proto.MessageEnvelope} returns this - */ - - -proto.MessageEnvelope.prototype.setIsencrypted = function (value) { - return jspb.Message.setProto3BooleanField(this, 2, value); -}; -/** - * optional bytes content = 3; - * @return {!(string|Uint8Array)} - */ - - -proto.MessageEnvelope.prototype.getContent = function () { - return ( - /** @type {!(string|Uint8Array)} */ - jspb.Message.getFieldWithDefault(this, 3, "") - ); -}; -/** - * optional bytes content = 3; - * This is a type-conversion wrapper around `getContent()` - * @return {string} - */ - - -proto.MessageEnvelope.prototype.getContent_asB64 = function () { - return ( - /** @type {string} */ - jspb.Message.bytesAsB64(this.getContent()) - ); -}; -/** - * optional bytes content = 3; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getContent()` - * @return {!Uint8Array} - */ - - -proto.MessageEnvelope.prototype.getContent_asU8 = function () { - return ( - /** @type {!Uint8Array} */ - jspb.Message.bytesAsU8(this.getContent()) - ); -}; -/** - * @param {!(string|Uint8Array)} value - * @return {!proto.MessageEnvelope} returns this - */ - - -proto.MessageEnvelope.prototype.setContent = function (value) { - return jspb.Message.setProto3BytesField(this, 3, value); -}; -/** - * List of repeated fields within this message type. - * @private {!Array<number>} - * @const - */ - - -proto.SyncRequest.repeatedFields_ = [1]; - -if (jspb.Message.GENERATE_TO_OBJECT) { - /** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ - proto.SyncRequest.prototype.toObject = function (opt_includeInstance) { - return proto.SyncRequest.toObject(opt_includeInstance, this); - }; - /** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.SyncRequest} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ - - - proto.SyncRequest.toObject = function (includeInstance, msg) { - var f, - obj = { - messagesList: jspb.Message.toObjectList(msg.getMessagesList(), proto.MessageEnvelope.toObject, includeInstance), - fileid: jspb.Message.getFieldWithDefault(msg, 2, ""), - groupid: jspb.Message.getFieldWithDefault(msg, 3, ""), - keyid: jspb.Message.getFieldWithDefault(msg, 5, ""), - since: jspb.Message.getFieldWithDefault(msg, 6, "") - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - - return obj; - }; -} -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.SyncRequest} - */ - - -proto.SyncRequest.deserializeBinary = function (bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.SyncRequest(); - return proto.SyncRequest.deserializeBinaryFromReader(msg, reader); -}; -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.SyncRequest} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.SyncRequest} - */ - - -proto.SyncRequest.deserializeBinaryFromReader = function (msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - - var field = reader.getFieldNumber(); - - switch (field) { - case 1: - var value = new proto.MessageEnvelope(); - reader.readMessage(value, proto.MessageEnvelope.deserializeBinaryFromReader); - msg.addMessages(value); - break; - - case 2: - var value = - /** @type {string} */ - reader.readString(); - msg.setFileid(value); - break; - - case 3: - var value = - /** @type {string} */ - reader.readString(); - msg.setGroupid(value); - break; - - case 5: - var value = - /** @type {string} */ - reader.readString(); - msg.setKeyid(value); - break; - - case 6: - var value = - /** @type {string} */ - reader.readString(); - msg.setSince(value); - break; - - default: - reader.skipField(); - break; - } - } - - return msg; -}; -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ - - -proto.SyncRequest.prototype.serializeBinary = function () { - var writer = new jspb.BinaryWriter(); - proto.SyncRequest.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.SyncRequest} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ - - -proto.SyncRequest.serializeBinaryToWriter = function (message, writer) { - var f = undefined; - f = message.getMessagesList(); - - if (f.length > 0) { - writer.writeRepeatedMessage(1, f, proto.MessageEnvelope.serializeBinaryToWriter); - } - - f = message.getFileid(); - - if (f.length > 0) { - writer.writeString(2, f); - } - - f = message.getGroupid(); - - if (f.length > 0) { - writer.writeString(3, f); - } - - f = message.getKeyid(); - - if (f.length > 0) { - writer.writeString(5, f); - } - - f = message.getSince(); - - if (f.length > 0) { - writer.writeString(6, f); - } -}; -/** - * repeated MessageEnvelope messages = 1; - * @return {!Array<!proto.MessageEnvelope>} - */ - - -proto.SyncRequest.prototype.getMessagesList = function () { - return ( - /** @type{!Array<!proto.MessageEnvelope>} */ - jspb.Message.getRepeatedWrapperField(this, proto.MessageEnvelope, 1) - ); -}; -/** - * @param {!Array<!proto.MessageEnvelope>} value - * @return {!proto.SyncRequest} returns this -*/ - - -proto.SyncRequest.prototype.setMessagesList = function (value) { - return jspb.Message.setRepeatedWrapperField(this, 1, value); -}; -/** - * @param {!proto.MessageEnvelope=} opt_value - * @param {number=} opt_index - * @return {!proto.MessageEnvelope} - */ - - -proto.SyncRequest.prototype.addMessages = function (opt_value, opt_index) { - return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.MessageEnvelope, opt_index); -}; -/** - * Clears the list making it empty but non-null. - * @return {!proto.SyncRequest} returns this - */ - - -proto.SyncRequest.prototype.clearMessagesList = function () { - return this.setMessagesList([]); -}; -/** - * optional string fileId = 2; - * @return {string} - */ - - -proto.SyncRequest.prototype.getFileid = function () { - return ( - /** @type {string} */ - jspb.Message.getFieldWithDefault(this, 2, "") - ); -}; -/** - * @param {string} value - * @return {!proto.SyncRequest} returns this - */ - - -proto.SyncRequest.prototype.setFileid = function (value) { - return jspb.Message.setProto3StringField(this, 2, value); -}; -/** - * optional string groupId = 3; - * @return {string} - */ - - -proto.SyncRequest.prototype.getGroupid = function () { - return ( - /** @type {string} */ - jspb.Message.getFieldWithDefault(this, 3, "") - ); -}; -/** - * @param {string} value - * @return {!proto.SyncRequest} returns this - */ - - -proto.SyncRequest.prototype.setGroupid = function (value) { - return jspb.Message.setProto3StringField(this, 3, value); -}; -/** - * optional string keyId = 5; - * @return {string} - */ - - -proto.SyncRequest.prototype.getKeyid = function () { - return ( - /** @type {string} */ - jspb.Message.getFieldWithDefault(this, 5, "") - ); -}; -/** - * @param {string} value - * @return {!proto.SyncRequest} returns this - */ - - -proto.SyncRequest.prototype.setKeyid = function (value) { - return jspb.Message.setProto3StringField(this, 5, value); -}; -/** - * optional string since = 6; - * @return {string} - */ - - -proto.SyncRequest.prototype.getSince = function () { - return ( - /** @type {string} */ - jspb.Message.getFieldWithDefault(this, 6, "") - ); -}; -/** - * @param {string} value - * @return {!proto.SyncRequest} returns this - */ - - -proto.SyncRequest.prototype.setSince = function (value) { - return jspb.Message.setProto3StringField(this, 6, value); -}; -/** - * List of repeated fields within this message type. - * @private {!Array<number>} - * @const - */ - - -proto.SyncResponse.repeatedFields_ = [1]; - -if (jspb.Message.GENERATE_TO_OBJECT) { - /** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ - proto.SyncResponse.prototype.toObject = function (opt_includeInstance) { - return proto.SyncResponse.toObject(opt_includeInstance, this); - }; - /** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.SyncResponse} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ - - - proto.SyncResponse.toObject = function (includeInstance, msg) { - var f, - obj = { - messagesList: jspb.Message.toObjectList(msg.getMessagesList(), proto.MessageEnvelope.toObject, includeInstance), - merkle: jspb.Message.getFieldWithDefault(msg, 2, "") - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - - return obj; - }; -} -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.SyncResponse} - */ - - -proto.SyncResponse.deserializeBinary = function (bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.SyncResponse(); - return proto.SyncResponse.deserializeBinaryFromReader(msg, reader); -}; -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.SyncResponse} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.SyncResponse} - */ - - -proto.SyncResponse.deserializeBinaryFromReader = function (msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - - var field = reader.getFieldNumber(); - - switch (field) { - case 1: - var value = new proto.MessageEnvelope(); - reader.readMessage(value, proto.MessageEnvelope.deserializeBinaryFromReader); - msg.addMessages(value); - break; - - case 2: - var value = - /** @type {string} */ - reader.readString(); - msg.setMerkle(value); - break; - - default: - reader.skipField(); - break; - } - } - - return msg; -}; -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ - - -proto.SyncResponse.prototype.serializeBinary = function () { - var writer = new jspb.BinaryWriter(); - proto.SyncResponse.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.SyncResponse} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ - - -proto.SyncResponse.serializeBinaryToWriter = function (message, writer) { - var f = undefined; - f = message.getMessagesList(); - - if (f.length > 0) { - writer.writeRepeatedMessage(1, f, proto.MessageEnvelope.serializeBinaryToWriter); - } - - f = message.getMerkle(); - - if (f.length > 0) { - writer.writeString(2, f); - } -}; -/** - * repeated MessageEnvelope messages = 1; - * @return {!Array<!proto.MessageEnvelope>} - */ - - -proto.SyncResponse.prototype.getMessagesList = function () { - return ( - /** @type{!Array<!proto.MessageEnvelope>} */ - jspb.Message.getRepeatedWrapperField(this, proto.MessageEnvelope, 1) - ); -}; -/** - * @param {!Array<!proto.MessageEnvelope>} value - * @return {!proto.SyncResponse} returns this -*/ - - -proto.SyncResponse.prototype.setMessagesList = function (value) { - return jspb.Message.setRepeatedWrapperField(this, 1, value); -}; -/** - * @param {!proto.MessageEnvelope=} opt_value - * @param {number=} opt_index - * @return {!proto.MessageEnvelope} - */ - - -proto.SyncResponse.prototype.addMessages = function (opt_value, opt_index) { - return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.MessageEnvelope, opt_index); -}; -/** - * Clears the list making it empty but non-null. - * @return {!proto.SyncResponse} returns this - */ - - -proto.SyncResponse.prototype.clearMessagesList = function () { - return this.setMessagesList([]); -}; -/** - * optional string merkle = 2; - * @return {string} - */ - - -proto.SyncResponse.prototype.getMerkle = function () { - return ( - /** @type {string} */ - jspb.Message.getFieldWithDefault(this, 2, "") - ); -}; -/** - * @param {string} value - * @return {!proto.SyncResponse} returns this - */ - - -proto.SyncResponse.prototype.setMerkle = function (value) { - return jspb.Message.setProto3StringField(this, 2, value); -}; - -goog.object.extend(exports, proto); - -/***/ }), - -/***/ "./packages/loot-core/src/server/sync/repair.js": -/*!******************************************************!*\ - !*** ./packages/loot-core/src/server/sync/repair.js ***! - \******************************************************/ -/*! exports provided: rebuildMerkleHash, default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "rebuildMerkleHash", function() { return rebuildMerkleHash; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return repairSync; }); -/* harmony import */ var _db__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../db */ "./packages/loot-core/src/server/db/index.js"); -/* harmony import */ var _timestamp__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../timestamp */ "./packages/loot-core/src/server/timestamp.js"); -/* harmony import */ var _merkle__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../merkle */ "./packages/loot-core/src/server/merkle.js"); - - - -function rebuildMerkleHash() { - let rows = _db__WEBPACK_IMPORTED_MODULE_0__["runQuery"]('SELECT timestamp FROM messages_crdt', [], true); - let trie = {}; - - for (let i = 0; i < rows.length; i++) { - trie = _merkle__WEBPACK_IMPORTED_MODULE_2__["insert"](trie, _timestamp__WEBPACK_IMPORTED_MODULE_1__["default"].parse(rows[i].timestamp)); - } - - return { - numMessages: rows.length, - trie: trie - }; -} -async function repairSync() { - let rebuilt = rebuildMerkleHash(); - let clock = Object(_timestamp__WEBPACK_IMPORTED_MODULE_1__["getClock"])(); // Save it locally - - clock.merkle = rebuilt.trie; // Persist it in the db - - _db__WEBPACK_IMPORTED_MODULE_0__["runQuery"](_db__WEBPACK_IMPORTED_MODULE_0__["cache"]('INSERT OR REPLACE INTO messages_clock (id, clock) VALUES (1, ?)'), [Object(_timestamp__WEBPACK_IMPORTED_MODULE_1__["serializeClock"])(clock)]); -} - -/***/ }), - -/***/ "./packages/loot-core/src/server/sync/reset.js": -/*!*****************************************************!*\ - !*** ./packages/loot-core/src/server/sync/reset.js ***! - \*****************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return resetSync; }); -/* harmony import */ var _cloud_storage__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../cloud-storage */ "./packages/loot-core/src/server/cloud-storage.js"); -/* harmony import */ var _db__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../db */ "./packages/loot-core/src/server/db/index.js"); -/* harmony import */ var _prefs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../prefs */ "./packages/loot-core/src/server/prefs.js"); -/* harmony import */ var _platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../platform/server/asyncStorage */ "./packages/loot-core/src/platform/server/asyncStorage/index.electron.js"); -/* harmony import */ var _platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_3__); -/* harmony import */ var _platform_exceptions__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../platform/exceptions */ "./packages/loot-core/src/platform/exceptions/index.electron.js"); -/* harmony import */ var _mutators__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../mutators */ "./packages/loot-core/src/server/mutators.js"); - - - - - - - -const connection = __webpack_require__(/*! ../../platform/server/connection */ "./packages/loot-core/src/platform/server/connection/index.api.js"); - -async function resetSync(keyState) { - if (!keyState) { - // If we aren't resetting the key, make sure our key is up-to-date - // so we don't accidentally upload a file encrypted with the wrong - // key (or not encrypted at all) - let _await$cloudStorage$c = await _cloud_storage__WEBPACK_IMPORTED_MODULE_0__["checkKey"](), - valid = _await$cloudStorage$c.valid, - error = _await$cloudStorage$c.error; - - if (error) { - return { - error - }; - } else if (!valid) { - return { - error: { - reason: 'file-has-new-key' - } - }; - } - } - - let _await$cloudStorage$r = await _cloud_storage__WEBPACK_IMPORTED_MODULE_0__["resetSyncState"](keyState), - error = _await$cloudStorage$r.error; - - if (error) { - return { - error - }; - } - - await Object(_mutators__WEBPACK_IMPORTED_MODULE_5__["runMutator"])(async () => { - // TOOD: We could automatically generate the list of tables to - // cleanup by looking at the schema - // - // Be VERY careful here since we are bulk deleting data. It should - // never delete any data that doesn't have `tombstone = 1` - await _db__WEBPACK_IMPORTED_MODULE_1__["execQuery"](` - DELETE FROM messages_crdt; - DELETE FROM messages_clock; - DELETE FROM transactions WHERE tombstone = 1; - DELETE FROM accounts WHERE tombstone = 1; - DELETE FROM payees WHERE tombstone = 1; - DELETE FROM categories WHERE tombstone = 1; - DELETE FROM category_groups WHERE tombstone = 1; - DELETE FROM schedules WHERE tombstone = 1; - DELETE FROM rules WHERE tombstone = 1; - ANALYZE; - VACUUM; - `); - await _db__WEBPACK_IMPORTED_MODULE_1__["loadClock"](); - }); - await _prefs__WEBPACK_IMPORTED_MODULE_2__["savePrefs"]({ - groupId: null, - lastSyncedTimestamp: null, - lastUploaded: null - }); - - if (keyState) { - let key = keyState.key; - - let _prefs$getPrefs = _prefs__WEBPACK_IMPORTED_MODULE_2__["getPrefs"](), - cloudFileId = _prefs$getPrefs.cloudFileId; // The key has changed, we need to update our local data to - // store the new key - // Persist key in async storage - - - let keys = JSON.parse((await _platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_3___default.a.getItem(`encrypt-keys`)) || '{}'); - keys[cloudFileId] = key.serialize(); - await _platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_3___default.a.setItem('encrypt-keys', JSON.stringify(keys)); // Save the key id in prefs - - await _prefs__WEBPACK_IMPORTED_MODULE_2__["savePrefs"]({ - encryptKeyId: key.getId() - }); - } // Finally, upload the file to make it the "true" version that all - // other clients need to pull down to get back in sync - - - try { - await _cloud_storage__WEBPACK_IMPORTED_MODULE_0__["upload"](); - } catch (e) { - if (e.reason) { - return { - error: e - }; - } - - Object(_platform_exceptions__WEBPACK_IMPORTED_MODULE_4__["captureException"])(e); - return { - error: { - reason: 'upload-failure' - } - }; - } finally { - connection.send('prefs-updated'); - } - - return {}; -} - -/***/ }), - -/***/ "./packages/loot-core/src/server/timestamp.js": -/*!****************************************************!*\ - !*** ./packages/loot-core/src/server/timestamp.js ***! - \****************************************************/ -/*! exports provided: setClock, getClock, makeClock, serializeClock, deserializeClock, makeClientId, default, MutableTimestamp */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setClock", function() { return setClock; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getClock", function() { return getClock; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "makeClock", function() { return makeClock; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "serializeClock", function() { return serializeClock; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "deserializeClock", function() { return deserializeClock; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "makeClientId", function() { return makeClientId; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return Timestamp; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MutableTimestamp", function() { return MutableTimestamp; }); -/* harmony import */ var murmurhash__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! murmurhash */ "./node_modules/murmurhash/murmurhash.js"); -/* harmony import */ var murmurhash__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(murmurhash__WEBPACK_IMPORTED_MODULE_0__); - - -const uuid = __webpack_require__(/*! ../platform/uuid */ "./packages/loot-core/src/platform/uuid/index.electron.js"); -/** - * Hybrid Unique Logical Clock (HULC) timestamp generator - * - * Globally-unique, monotonic timestamps are generated from the - * combination of the unreliable system time, a counter, and an - * identifier for the current node (instance, machine, process, etc.). - * These timestamps can accommodate clock stuttering (duplicate values), - * regression, and node differences within the configured maximum drift. - * - * In order to generate timestamps locally or for transmission to another - * node, use the send() method. For global causality, timestamps must - * be included in each message processed by the system. Whenever a - * message is received, its timestamp must be passed to the recv() - * method. - * - * Timestamps serialize into a 46-character collatable string - * example: 2015-04-24T22:23:42.123Z-1000-0123456789ABCDEF - * example: 2015-04-24T22:23:42.123Z-1000-A219E7A71CC18912 - * - * The 64-bit hybrid clock is based on the HLC specification, - * http://www.cse.buffalo.edu/tech-reports/2014-04.pdf - */ -// A mutable global clock - - -let clock = null; -function setClock(clock_) { - clock = clock_; -} -function getClock() { - return clock; -} -function makeClock(timestamp, merkle = {}) { - return { - timestamp: MutableTimestamp.from(timestamp), - merkle - }; -} -function serializeClock(clock) { - return JSON.stringify({ - timestamp: clock.timestamp.toString(), - merkle: clock.merkle - }); -} -function deserializeClock(clock) { - let data; - - try { - data = JSON.parse(clock); - } catch (e) { - data = { - timestamp: '1970-01-01T00:00:00.000Z-0000-' + makeClientId(), - merkle: {} - }; - } - - return { - timestamp: MutableTimestamp.from(Timestamp.parse(data.timestamp)), - merkle: data.merkle - }; -} -function makeClientId() { - return uuid.v4Sync().replace(/-/g, '').slice(-16); -} -var config = { - // Allow 5 minutes of clock drift - maxDrift: 5 * 60 * 1000 -}; -/** - * timestamp instance class - */ - -class Timestamp { - constructor(millis, counter, node) { - this._state = { - millis: millis, - counter: counter, - node: node - }; - } - - valueOf() { - return this.toString(); - } - - toString() { - return [new Date(this.millis()).toISOString(), ('0000' + this.counter().toString(16).toUpperCase()).slice(-4), ('0000000000000000' + this.node()).slice(-16)].join('-'); - } - - millis() { - return this._state.millis; - } - - counter() { - return this._state.counter; - } - - node() { - return this._state.node; - } - - hash() { - return murmurhash__WEBPACK_IMPORTED_MODULE_0___default.a.v3(this.toString()); - } - -} -class MutableTimestamp extends Timestamp { - setMillis(n) { - this._state.millis = n; - } - - setCounter(n) { - this._state.counter = n; - } - - setNode(n) { - this._state.node = n; - } - -} - -MutableTimestamp.from = timestamp => { - return new MutableTimestamp(timestamp.millis(), timestamp.counter(), timestamp.node()); -}; // Timestamp generator initialization -// * sets the node ID to an arbitrary value -// * useful for mocking/unit testing - - -Timestamp.init = function (options = {}) { - if (options.maxDrift) { - config.maxDrift = options.maxDrift; - } - - setClock(makeClock(new Timestamp(0, 0, options.node ? ('0000000000000000' + options.node).toString().slice(-16) : '')), null); -}; -/** - * Timestamp send. Generates a unique, monotonic timestamp suitable - * for transmission to another system in string format - */ - - -Timestamp.send = function () { - if (!clock) { - return null; - } // retrieve the local wall time - - - var phys = Date.now(); // unpack the clock.timestamp logical time and counter - - var lOld = clock.timestamp.millis(); - var cOld = clock.timestamp.counter(); // calculate the next logical time and counter - // * ensure that the logical time never goes backward - // * increment the counter if phys time does not advance - - var lNew = Math.max(lOld, phys); - var cNew = lOld === lNew ? cOld + 1 : 0; // check the result for drift and counter overflow - - if (lNew - phys > config.maxDrift) { - throw new Timestamp.ClockDriftError(lNew, phys, config.maxDrift); - } - - if (cNew > 65535) { - throw new Timestamp.OverflowError(); - } // repack the logical time/counter - - - clock.timestamp.setMillis(lNew); - clock.timestamp.setCounter(cNew); - return new Timestamp(clock.timestamp.millis(), clock.timestamp.counter(), clock.timestamp.node()); -}; // Timestamp receive. Parses and merges a timestamp from a remote -// system with the local timeglobal uniqueness and monotonicity are -// preserved - - -Timestamp.recv = function (msg) { - if (!clock) { - return null; - } // retrieve the local wall time - - - var phys = Date.now(); // unpack the message wall time/counter - - var lMsg = msg.millis(); - var cMsg = msg.counter(); // assert the node id and remote clock drift - // if (msg.node() === clock.timestamp.node()) { - // throw new Timestamp.DuplicateNodeError(clock.timestamp.node()); - // } - - if (lMsg - phys > config.maxDrift) { - throw new Timestamp.ClockDriftError(); - } // unpack the clock.timestamp logical time and counter - - - var lOld = clock.timestamp.millis(); - var cOld = clock.timestamp.counter(); // calculate the next logical time and counter - // . ensure that the logical time never goes backward - // . if all logical clocks are equal, increment the max counter - // . if max = old > message, increment local counter - // . if max = messsage > old, increment message counter - // . otherwise, clocks are monotonic, reset counter - - var lNew = Math.max(Math.max(lOld, phys), lMsg); - var cNew = lNew === lOld && lNew === lMsg ? Math.max(cOld, cMsg) + 1 : lNew === lOld ? cOld + 1 : lNew === lMsg ? cMsg + 1 : 0; // check the result for drift and counter overflow - - if (lNew - phys > config.maxDrift) { - throw new Timestamp.ClockDriftError(); - } - - if (cNew > 65535) { - throw new Timestamp.OverflowError(); - } // repack the logical time/counter - - - clock.timestamp.setMillis(lNew); - clock.timestamp.setCounter(cNew); - return new Timestamp(clock.timestamp.millis(), clock.timestamp.counter(), clock.timestamp.node()); -}; -/** - * timestamp parsing - * converts a fixed-length string timestamp to the structured value - */ - - -Timestamp.parse = function (timestamp) { - if (typeof timestamp === 'string') { - var parts = timestamp.split('-'); - - if (parts && parts.length === 5) { - var millis = Date.parse(parts.slice(0, 3).join('-')).valueOf(); - var counter = parseInt(parts[3], 16); - var node = parts[4]; - if (!isNaN(millis) && !isNaN(counter)) return new Timestamp(millis, counter, node); - } - } - - return null; -}; -/** - * zero/minimum timestamp - */ - - -var zero = Timestamp.parse('1970-01-01T00:00:00.000Z-0000-0000000000000000'); - -Timestamp.zero = function () { - return zero; -}; -/** - * maximum timestamp - */ - - -var max = Timestamp.parse('9999-12-31T23:59:59.999Z-FFFF-FFFFFFFFFFFFFFFF'); - -Timestamp.max = function () { - return max; -}; - -Timestamp.since = isoString => { - return isoString + '-0000-0000000000000000'; -}; -/** - * error classes - */ - - -Timestamp.DuplicateNodeError = class extends Error { - constructor(node) { - super(); - this.type = 'DuplicateNodeError'; - this.message = 'duplicate node identifier ' + node; - } - -}; -Timestamp.ClockDriftError = class extends Error { - constructor(...args) { - super(); - this.type = 'ClockDriftError'; - this.message = ['maximum clock drift exceeded'].concat(args).join(' '); - } - -}; -Timestamp.OverflowError = class extends Error { - constructor() { - super(); - this.type = 'OverflowError'; - this.message = 'timestamp counter overflow'; - } - -}; - -/***/ }), - -/***/ "./packages/loot-core/src/server/tools/app.js": -/*!****************************************************!*\ - !*** ./packages/loot-core/src/server/tools/app.js ***! - \****************************************************/ -/*! exports provided: default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var _sync__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../sync */ "./packages/loot-core/src/server/sync/index.js"); -/* harmony import */ var _mutators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../mutators */ "./packages/loot-core/src/server/mutators.js"); -/* harmony import */ var _app__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../app */ "./packages/loot-core/src/server/app.js"); -/* harmony import */ var _db__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../db */ "./packages/loot-core/src/server/db/index.js"); -/* harmony import */ var _accounts_transactions__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../accounts/transactions */ "./packages/loot-core/src/server/accounts/transactions.js"); - - - - - -let app = Object(_app__WEBPACK_IMPORTED_MODULE_2__["createApp"])(); -app.method('tools/fix-split-transactions', async () => { - // 1. Check for child transactions that have a blank payee, and set - // the payee to whatever the parent has - let blankPayeeRows = await _db__WEBPACK_IMPORTED_MODULE_3__["all"](` - SELECT t.*, p.payee AS parentPayee FROM v_transactions_internal t - LEFT JOIN v_transactions_internal p ON t.parent_id = p.id - WHERE t.is_child = 1 AND t.payee IS NULL AND p.payee IS NOT NULL - `); - await Object(_mutators__WEBPACK_IMPORTED_MODULE_1__["runMutator"])(async () => { - let updated = blankPayeeRows.map(row => ({ - id: row.id, - payee: row.parentPayee - })); - await Object(_accounts_transactions__WEBPACK_IMPORTED_MODULE_4__["batchUpdateTransactions"])({ - updated - }); - }); // 2. Make sure the "cleared" flag is synced up with the parent - // transactions - - let clearedRows = await _db__WEBPACK_IMPORTED_MODULE_3__["all"](` - SELECT t.id, p.cleared FROM v_transactions_internal t - LEFT JOIN v_transactions_internal p ON t.parent_id = p.id - WHERE t.is_child = 1 AND t.cleared != p.cleared - `); - await Object(_mutators__WEBPACK_IMPORTED_MODULE_1__["runMutator"])(async () => { - let updated = clearedRows.map(row => ({ - id: row.id, - cleared: row.cleared === 1 - })); - await Object(_accounts_transactions__WEBPACK_IMPORTED_MODULE_4__["batchUpdateTransactions"])({ - updated - }); - }); // 3. Mark the `tombstone` field as true on any child transactions - // that have a dead parent - - let deletedRows = await _db__WEBPACK_IMPORTED_MODULE_3__["all"](` - SELECT t.* FROM v_transactions_internal t - LEFT JOIN v_transactions_internal p ON t.parent_id = p.id - WHERE t.is_child = 1 AND t.tombstone = 0 AND (p.tombstone = 1 OR p.id IS NULL) - `); - await Object(_mutators__WEBPACK_IMPORTED_MODULE_1__["runMutator"])(async () => { - let updated = deletedRows.map(row => ({ - id: row.id, - tombstone: 1 - })); - await Object(_accounts_transactions__WEBPACK_IMPORTED_MODULE_4__["batchUpdateTransactions"])({ - updated - }); - }); - return { - numBlankPayees: blankPayeeRows.length, - numCleared: clearedRows.length, - numDeleted: deletedRows.length - }; -}); -/* harmony default export */ __webpack_exports__["default"] = (app); - -/***/ }), - -/***/ "./packages/loot-core/src/server/tracking/events.js": -/*!**********************************************************!*\ - !*** ./packages/loot-core/src/server/tracking/events.js ***! - \**********************************************************/ -/*! exports provided: toggle, init, login, track, setProfile */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "toggle", function() { return toggle; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "init", function() { return init; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "login", function() { return login; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "track", function() { return track; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setProfile", function() { return setProfile; }); -/* harmony import */ var _platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../platform/server/asyncStorage */ "./packages/loot-core/src/platform/server/asyncStorage/index.electron.js"); -/* harmony import */ var _platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _encryption_internals__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../encryption-internals */ "./packages/loot-core/src/server/encryption-internals.js"); - - - -let uuid = __webpack_require__(/*! ../../platform/uuid */ "./packages/loot-core/src/platform/uuid/index.electron.js"); - -let currentUniqueId; -let mixpanel; -let isEnabled = true; -function toggle(trackUsage) { - isEnabled = trackUsage == null || trackUsage === 'true' ? true : false; -} // TODO: Figure out location, send to EU data centers if in EU -// { -// host: "api-eu.mixpanel.com", -// }, -// This must stay up-to-date with all apps that hit mixpanel! That includes the -// website and server. If changing this, make sure to change it everywhere - -async function hash(userId) { - let hashed = await Object(_encryption_internals__WEBPACK_IMPORTED_MODULE_1__["sha256String"])(userId); - return `user-${hashed.replace(/[=/]/g, '')}`; -} - -function isAnonymous(id) { - return !id.startsWith('user-'); -} - -async function init() {} -async function login(userId) {} -let BUFFERING = false; -let BUFFER = []; - -function startBuffering() { - BUFFERING = true; - BUFFER = []; -} - -function stopBuffering() { - for (let call of BUFFER) { - call[0](...call[1]); - } - - BUFFERING = false; - BUFFER = []; -} - -function buffered(func) { - return (...args) => { - if (false) {} - }; -} - -const track = buffered((distinct_id, name, props) => {}); -const setProfile = buffered((distinct_id, props) => {}); - -/***/ }), - -/***/ "./packages/loot-core/src/server/undo.js": -/*!***********************************************!*\ - !*** ./packages/loot-core/src/server/undo.js ***! - \***********************************************/ -/*! exports provided: appendMessages, clearUndo, withUndo, undoable, undo, redo */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "appendMessages", function() { return appendMessages; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "clearUndo", function() { return clearUndo; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "withUndo", function() { return withUndo; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "undoable", function() { return undoable; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "undo", function() { return undo; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "redo", function() { return redo; }); -/* harmony import */ var _sync__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./sync */ "./packages/loot-core/src/server/sync/index.js"); -/* harmony import */ var _shared_util__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../shared/util */ "./packages/loot-core/src/shared/util.js"); -/* harmony import */ var _timestamp__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./timestamp */ "./packages/loot-core/src/server/timestamp.js"); -/* harmony import */ var _mutators__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./mutators */ "./packages/loot-core/src/server/mutators.js"); -function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } - -function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } - -function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } - -function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } - -function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_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 _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } - -function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } - -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } - -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; } - - - - - - -const connection = __webpack_require__(/*! ../platform/server/connection */ "./packages/loot-core/src/platform/server/connection/index.api.js"); // A marker always sits as the first entry to simplify logic - - -let MESSAGE_HISTORY = [{ - type: 'marker' -}]; -let CURSOR = 0; -let HISTORY_SIZE = 20; - -function trimHistory() { - MESSAGE_HISTORY = MESSAGE_HISTORY.slice(0, CURSOR + 1); - let markers = MESSAGE_HISTORY.filter(item => item.type === 'marker'); - - if (markers.length > HISTORY_SIZE) { - let slice = markers.slice(-HISTORY_SIZE); - let cutoff = MESSAGE_HISTORY.indexOf(slice[0]); - MESSAGE_HISTORY = MESSAGE_HISTORY.slice(cutoff); - CURSOR = MESSAGE_HISTORY.length - 1; - } -} - -function appendMessages(messages, oldData) { - let context = Object(_mutators__WEBPACK_IMPORTED_MODULE_3__["getMutatorContext"])(); - - if (context.undoListening && messages.length > 0) { - trimHistory(); - let undoTag = context.undoTag; - MESSAGE_HISTORY.push({ - type: 'messages', - messages, - oldData, - undoTag - }); - CURSOR++; - } -} -function clearUndo() { - MESSAGE_HISTORY = [{ - type: 'marker' - }]; - CURSOR = 0; -} -function withUndo(func, meta) { - let context = Object(_mutators__WEBPACK_IMPORTED_MODULE_3__["getMutatorContext"])(); - - if (context.undoDisabled || context.undoListening) { - return func(); - } - - MESSAGE_HISTORY = MESSAGE_HISTORY.slice(0, CURSOR + 1); - let marker = { - type: 'marker', - meta - }; - - if (MESSAGE_HISTORY[MESSAGE_HISTORY.length - 1].type === 'marker') { - MESSAGE_HISTORY[MESSAGE_HISTORY.length - 1] = marker; - } else { - MESSAGE_HISTORY.push(marker); - CURSOR++; - } - - return Object(_mutators__WEBPACK_IMPORTED_MODULE_3__["withMutatorContext"])({ - undoListening: true, - undoTag: context.undoTag - }, func); -} -function undoable(func) { - return (...args) => { - return withUndo(() => { - return func(...args); - }); - }; -} - -async function applyUndoAction(messages, meta, undoTag) { - await Object(_mutators__WEBPACK_IMPORTED_MODULE_3__["withMutatorContext"])({ - undoListening: false - }, () => { - return Object(_sync__WEBPACK_IMPORTED_MODULE_0__["sendMessages"])(messages.map(msg => _objectSpread(_objectSpread({}, msg), {}, { - timestamp: _timestamp__WEBPACK_IMPORTED_MODULE_2__["default"].send() - }))); - }); - const tables = messages.reduce((acc, message) => { - if (!acc.includes(message.dataset)) { - acc.push(message.dataset); - } - - return acc; - }, []); - connection.send('undo-event', { - messages, - tables, - meta, - undoTag - }); -} - -async function undo() { - let end = CURSOR; - CURSOR = Math.max(CURSOR - 1, 0); // Walk back to the nearest marker - - while (CURSOR > 0 && MESSAGE_HISTORY[CURSOR].type !== 'marker') { - CURSOR--; - } - - let meta = MESSAGE_HISTORY[CURSOR].meta; - let start = Math.max(CURSOR, 0); - let entries = MESSAGE_HISTORY.slice(start, end + 1).filter(entry => entry.type === 'messages'); - - if (entries.length > 0) { - let toApply = entries.reduce((acc, entry) => { - return acc.concat(entry.messages.map(message => undoMessage(message, entry.oldData)).filter(x => x)); - }, []).reverse(); - await applyUndoAction(toApply, meta, entries[0].undoTag); - } -} - -function undoMessage(message, oldData) { - let oldItem = Object(_shared_util__WEBPACK_IMPORTED_MODULE_1__["getIn"])(oldData, [message.dataset, message.row]); - - if (oldItem) { - let column = message.column; - - if (message.dataset === 'spreadsheet_cells') { - // The spreadsheet messages use the `expr` column, but only as a - // placeholder. We actually want to read the `cachedValue` prop - // from the old item. - column = 'cachedValue'; - } - - return _objectSpread(_objectSpread({}, message), {}, { - value: oldItem[column] - }); - } else { - if (message.dataset === 'spreadsheet_cells') { - if (message.column === 'expr') { - return _objectSpread(_objectSpread({}, message), {}, { - value: null - }); - } - - return message; - } else if ( // The mapping fields aren't ever deleted... this should be - // harmless since all they are is meta information. Maybe we - // should fix this though. - message.dataset !== 'category_mapping' && message.dataset !== 'payee_mapping') { - if (message.dataset === 'zero_budget_months' || message.dataset === 'zero_budgets' || message.dataset === 'reflect_budgets') { - // Only these fields are reversable - if (['buffered', 'amount', 'carryover'].includes(message.column)) { - return _objectSpread(_objectSpread({}, message), {}, { - value: 0 - }); - } - - return null; - } else if (message.dataset === 'notes') { - return _objectSpread(_objectSpread({}, message), {}, { - value: null - }); - } - - return _objectSpread(_objectSpread({}, message), {}, { - column: 'tombstone', - value: 1 - }); - } - } - - return null; -} - -async function redo() { - let meta = MESSAGE_HISTORY[CURSOR].type === 'marker' ? MESSAGE_HISTORY[CURSOR].meta : null; - let start = CURSOR; - CURSOR = Math.min(CURSOR + 1, MESSAGE_HISTORY.length - 1); // Walk forward to the nearest marker - - while (CURSOR < MESSAGE_HISTORY.length - 1 && MESSAGE_HISTORY[CURSOR].type !== 'marker') { - CURSOR++; - } - - let end = CURSOR; - let entries = MESSAGE_HISTORY.slice(start + 1, end + 1).filter(entry => entry.type === 'messages'); - - if (entries.length > 0) { - let toApply = entries.reduce((acc, entry) => { - return acc.concat(entry.messages).concat(redoResurrections(entry.messages, entry.oldData)); - }, []); - await applyUndoAction(toApply, meta, entries[entries.length - 1].undoTag); - } -} - -function redoResurrections(messages, oldData) { - let resurrect = new Set(); - messages.forEach(message => { - // If any of the ids didn't exist before, we need to "resurrect" - // them by resetting their tombstones to 0 - let oldItem = Object(_shared_util__WEBPACK_IMPORTED_MODULE_1__["getIn"])(oldData, [message.dataset, message.row]); - - if (!oldItem && !['zero_budget_months', 'zero_budgets', 'reflect_budgets', 'notes', 'category_mapping', 'payee_mapping'].includes(message.dataset)) { - resurrect.add(message.dataset + '.' + message.row); - } - }); - return [...resurrect].map(desc => { - let _desc$split = desc.split('.'), - _desc$split2 = _slicedToArray(_desc$split, 2), - table = _desc$split2[0], - row = _desc$split2[1]; - - return { - dataset: table, - row, - column: 'tombstone', - value: 0, - timestamp: _timestamp__WEBPACK_IMPORTED_MODULE_2__["default"].send() - }; - }); -} - -/***/ }), - -/***/ "./packages/loot-core/src/server/update.js": -/*!*************************************************!*\ - !*** ./packages/loot-core/src/server/update.js ***! - \*************************************************/ -/*! exports provided: updateViews, updateVersion */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "updateViews", function() { return updateViews; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "updateVersion", function() { return updateVersion; }); -/* harmony import */ var md5__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! md5 */ "./node_modules/md5/md5.js"); -/* harmony import */ var md5__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(md5__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _migrate_migrations__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./migrate/migrations */ "./packages/loot-core/src/server/migrate/migrations.js"); -/* harmony import */ var _db__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./db */ "./packages/loot-core/src/server/db/index.js"); -/* harmony import */ var _aql_schema__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./aql/schema */ "./packages/loot-core/src/server/aql/schema/index.js"); -/* harmony import */ var _aql_views__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./aql/views */ "./packages/loot-core/src/server/aql/views.js"); - - - - - // Managing the init/update process - -async function runMigrations() { - await _migrate_migrations__WEBPACK_IMPORTED_MODULE_1__["migrate"](_db__WEBPACK_IMPORTED_MODULE_2__["getDatabase"]()); -} - -async function updateViews() { - let hashKey = 'view-hash'; - let row = await _db__WEBPACK_IMPORTED_MODULE_2__["first"]('SELECT value FROM __meta__ WHERE key = ?', [hashKey]); - - let _ref = row || {}, - hash = _ref.value; - - let views = Object(_aql_views__WEBPACK_IMPORTED_MODULE_4__["makeViews"])(_aql_schema__WEBPACK_IMPORTED_MODULE_3__["schema"], _aql_schema__WEBPACK_IMPORTED_MODULE_3__["schemaConfig"]); - let currentHash = md5__WEBPACK_IMPORTED_MODULE_0___default()(views); - - if (hash !== currentHash) { - await _db__WEBPACK_IMPORTED_MODULE_2__["execQuery"](views); - await _db__WEBPACK_IMPORTED_MODULE_2__["runQuery"]('INSERT OR REPLACE INTO __meta__ (key, value) VALUES (?, ?)', [hashKey, currentHash]); - } -} -async function updateVersion() { - await runMigrations(); - await updateViews(); -} - -/***/ }), - -/***/ "./packages/loot-core/src/server/util/budget-name.js": -/*!***********************************************************!*\ - !*** ./packages/loot-core/src/server/util/budget-name.js ***! - \***********************************************************/ -/*! exports provided: uniqueFileName, idFromFileName */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "uniqueFileName", function() { return uniqueFileName; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "idFromFileName", function() { return idFromFileName; }); -/* harmony import */ var _platform_server_fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../platform/server/fs */ "./packages/loot-core/src/platform/server/fs/index.electron.js"); -/* harmony import */ var _platform_server_fs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_platform_server_fs__WEBPACK_IMPORTED_MODULE_0__); - - -const uuid = __webpack_require__(/*! ../../platform/uuid */ "./packages/loot-core/src/platform/uuid/index.electron.js"); - -async function uniqueFileName(existingFiles) { - let initialName = 'My Finances'; - let idx = 1; // If there is a conflict, keep appending an index until there is no - // conflict and we have a unique name - - let newName = initialName; - - while (existingFiles.find(file => file.name === newName)) { - newName = `${initialName} ${idx}`; - idx++; - } - - return newName; -} -async function idFromFileName(name) { - let id = name.replace(/( |[^A-Za-z0-9])/g, '-') + '-' + uuid.v4Sync().slice(0, 7); // Make sure the id is unique. There's a chance one could already - // exist (although very unlikely now that we append unique - // characters onto the id) - - let index = 0; - let budgetDir = _platform_server_fs__WEBPACK_IMPORTED_MODULE_0___default.a.getBudgetDir(id); - - while (await _platform_server_fs__WEBPACK_IMPORTED_MODULE_0___default.a.exists(budgetDir)) { - index++; - budgetDir = _platform_server_fs__WEBPACK_IMPORTED_MODULE_0___default.a.getBudgetDir(id + index.toString()); - } // If a suffix was added, update the id - - - if (index > 0) { - id = id + index.toString(); - } - - return id; -} - -/***/ }), - -/***/ "./packages/loot-core/src/server/util/rschedule.js": -/*!*********************************************************!*\ - !*** ./packages/loot-core/src/server/util/rschedule.js ***! - \*********************************************************/ -/*! exports provided: StandardDateAdapter, ArgumentError, DateAdapter, DateAdapterBase, DateTime, InfiniteLoopError, InvalidDateAdapterError, InvalidDateTime, InvalidDateTimeError, RecurrenceRuleError, RecurrenceRulesIterator, RuleOptionError, ValidDateTime, cloneJSON, cloneRuleOptions, dateInputToDateAdapter, dateInputToDateTime, dateTimeSortComparer, freqToGranularity, getDaysInYear, getDifferenceBetweenWeekdays, isLeapYear, normalizeDateTimeTimezone, normalizeRuleOptions, numberSortComparer, orderedWeekdays, recurrenceRulesReducer, uniqDateTimes, AddOperator, Calendar, Collection, CollectionIterator, Dates, IntersectionOperator, MergeDurationOperator, MergeDurationOperatorError, OccurrenceGenerator, OccurrenceIterator, Operator, Rule, RuleBase, Schedule, ScheduleBase, SplitDurationOperator, SplitDurationOperatorError, SubtractOperator, UniqueOperator, add, intersection, mergeDuration, splitDuration, subtract, unique */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var _rschedule_standard_date_adapter_setup__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @rschedule/standard-date-adapter/setup */ "./node_modules/@rschedule/standard-date-adapter/es2015/setup.js"); -/* harmony import */ var _rschedule_json_tools_Schedule__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @rschedule/json-tools/Schedule */ "./node_modules/@rschedule/json-tools/es2015/Schedule.js"); -/* harmony import */ var _rschedule_standard_date_adapter__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @rschedule/standard-date-adapter */ "./node_modules/@rschedule/standard-date-adapter/es2015/main.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "StandardDateAdapter", function() { return _rschedule_standard_date_adapter__WEBPACK_IMPORTED_MODULE_2__["StandardDateAdapter"]; }); - -/* harmony import */ var _rschedule_core__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @rschedule/core */ "./node_modules/@rschedule/core/es2015/main.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ArgumentError", function() { return _rschedule_core__WEBPACK_IMPORTED_MODULE_3__["ArgumentError"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "DateAdapter", function() { return _rschedule_core__WEBPACK_IMPORTED_MODULE_3__["DateAdapter"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "DateAdapterBase", function() { return _rschedule_core__WEBPACK_IMPORTED_MODULE_3__["DateAdapterBase"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "DateTime", function() { return _rschedule_core__WEBPACK_IMPORTED_MODULE_3__["DateTime"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "InfiniteLoopError", function() { return _rschedule_core__WEBPACK_IMPORTED_MODULE_3__["InfiniteLoopError"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "InvalidDateAdapterError", function() { return _rschedule_core__WEBPACK_IMPORTED_MODULE_3__["InvalidDateAdapterError"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "InvalidDateTime", function() { return _rschedule_core__WEBPACK_IMPORTED_MODULE_3__["InvalidDateTime"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "InvalidDateTimeError", function() { return _rschedule_core__WEBPACK_IMPORTED_MODULE_3__["InvalidDateTimeError"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "RecurrenceRuleError", function() { return _rschedule_core__WEBPACK_IMPORTED_MODULE_3__["RecurrenceRuleError"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "RecurrenceRulesIterator", function() { return _rschedule_core__WEBPACK_IMPORTED_MODULE_3__["RecurrenceRulesIterator"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "RuleOptionError", function() { return _rschedule_core__WEBPACK_IMPORTED_MODULE_3__["RuleOptionError"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ValidDateTime", function() { return _rschedule_core__WEBPACK_IMPORTED_MODULE_3__["ValidDateTime"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "cloneJSON", function() { return _rschedule_core__WEBPACK_IMPORTED_MODULE_3__["cloneJSON"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "cloneRuleOptions", function() { return _rschedule_core__WEBPACK_IMPORTED_MODULE_3__["cloneRuleOptions"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "dateInputToDateAdapter", function() { return _rschedule_core__WEBPACK_IMPORTED_MODULE_3__["dateInputToDateAdapter"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "dateInputToDateTime", function() { return _rschedule_core__WEBPACK_IMPORTED_MODULE_3__["dateInputToDateTime"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "dateTimeSortComparer", function() { return _rschedule_core__WEBPACK_IMPORTED_MODULE_3__["dateTimeSortComparer"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "freqToGranularity", function() { return _rschedule_core__WEBPACK_IMPORTED_MODULE_3__["freqToGranularity"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getDaysInYear", function() { return _rschedule_core__WEBPACK_IMPORTED_MODULE_3__["getDaysInYear"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getDifferenceBetweenWeekdays", function() { return _rschedule_core__WEBPACK_IMPORTED_MODULE_3__["getDifferenceBetweenWeekdays"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isLeapYear", function() { return _rschedule_core__WEBPACK_IMPORTED_MODULE_3__["isLeapYear"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "normalizeDateTimeTimezone", function() { return _rschedule_core__WEBPACK_IMPORTED_MODULE_3__["normalizeDateTimeTimezone"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "normalizeRuleOptions", function() { return _rschedule_core__WEBPACK_IMPORTED_MODULE_3__["normalizeRuleOptions"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "numberSortComparer", function() { return _rschedule_core__WEBPACK_IMPORTED_MODULE_3__["numberSortComparer"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "orderedWeekdays", function() { return _rschedule_core__WEBPACK_IMPORTED_MODULE_3__["orderedWeekdays"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "recurrenceRulesReducer", function() { return _rschedule_core__WEBPACK_IMPORTED_MODULE_3__["recurrenceRulesReducer"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "uniqDateTimes", function() { return _rschedule_core__WEBPACK_IMPORTED_MODULE_3__["uniqDateTimes"]; }); - -/* harmony import */ var _rschedule_core_generators__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @rschedule/core/generators */ "./node_modules/@rschedule/core/es2015/generators.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "AddOperator", function() { return _rschedule_core_generators__WEBPACK_IMPORTED_MODULE_4__["AddOperator"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Calendar", function() { return _rschedule_core_generators__WEBPACK_IMPORTED_MODULE_4__["Calendar"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Collection", function() { return _rschedule_core_generators__WEBPACK_IMPORTED_MODULE_4__["Collection"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "CollectionIterator", function() { return _rschedule_core_generators__WEBPACK_IMPORTED_MODULE_4__["CollectionIterator"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Dates", function() { return _rschedule_core_generators__WEBPACK_IMPORTED_MODULE_4__["Dates"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "IntersectionOperator", function() { return _rschedule_core_generators__WEBPACK_IMPORTED_MODULE_4__["IntersectionOperator"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MergeDurationOperator", function() { return _rschedule_core_generators__WEBPACK_IMPORTED_MODULE_4__["MergeDurationOperator"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MergeDurationOperatorError", function() { return _rschedule_core_generators__WEBPACK_IMPORTED_MODULE_4__["MergeDurationOperatorError"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "OccurrenceGenerator", function() { return _rschedule_core_generators__WEBPACK_IMPORTED_MODULE_4__["OccurrenceGenerator"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "OccurrenceIterator", function() { return _rschedule_core_generators__WEBPACK_IMPORTED_MODULE_4__["OccurrenceIterator"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Operator", function() { return _rschedule_core_generators__WEBPACK_IMPORTED_MODULE_4__["Operator"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Rule", function() { return _rschedule_core_generators__WEBPACK_IMPORTED_MODULE_4__["Rule"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "RuleBase", function() { return _rschedule_core_generators__WEBPACK_IMPORTED_MODULE_4__["RuleBase"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Schedule", function() { return _rschedule_core_generators__WEBPACK_IMPORTED_MODULE_4__["Schedule"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ScheduleBase", function() { return _rschedule_core_generators__WEBPACK_IMPORTED_MODULE_4__["ScheduleBase"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "SplitDurationOperator", function() { return _rschedule_core_generators__WEBPACK_IMPORTED_MODULE_4__["SplitDurationOperator"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "SplitDurationOperatorError", function() { return _rschedule_core_generators__WEBPACK_IMPORTED_MODULE_4__["SplitDurationOperatorError"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "SubtractOperator", function() { return _rschedule_core_generators__WEBPACK_IMPORTED_MODULE_4__["SubtractOperator"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "UniqueOperator", function() { return _rschedule_core_generators__WEBPACK_IMPORTED_MODULE_4__["UniqueOperator"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "add", function() { return _rschedule_core_generators__WEBPACK_IMPORTED_MODULE_4__["add"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "intersection", function() { return _rschedule_core_generators__WEBPACK_IMPORTED_MODULE_4__["intersection"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "mergeDuration", function() { return _rschedule_core_generators__WEBPACK_IMPORTED_MODULE_4__["mergeDuration"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "splitDuration", function() { return _rschedule_core_generators__WEBPACK_IMPORTED_MODULE_4__["splitDuration"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "subtract", function() { return _rschedule_core_generators__WEBPACK_IMPORTED_MODULE_4__["subtract"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "unique", function() { return _rschedule_core_generators__WEBPACK_IMPORTED_MODULE_4__["unique"]; }); - - - - - - - -/***/ }), - -/***/ "./packages/loot-core/src/shared/accounts.js": -/*!***************************************************!*\ - !*** ./packages/loot-core/src/shared/accounts.js ***! - \***************************************************/ -/*! exports provided: fromPlaidAccountType, prettyAccountType, determineOffBudget */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fromPlaidAccountType", function() { return fromPlaidAccountType; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "prettyAccountType", function() { return prettyAccountType; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "determineOffBudget", function() { return determineOffBudget; }); -function fromPlaidAccountType(type, subtype) { - switch (type) { - case 'brokerage': - case 'investment': - return 'investment'; - - case 'credit': - return 'credit'; - - case 'loan': - return 'debt'; - - case 'other': - return 'other'; - - case 'depository': - default: - switch (subtype) { - case 'money market': - case 'savings': - return 'savings'; - - case 'cd': - return 'cd'; - - default: - return 'checking'; - } - - } -} -function prettyAccountType(type) { - switch (type) { - case 'checking': - return 'Checking'; - - case 'savings': - return 'Savings'; - - case 'cd': - return 'CD'; - - case 'investment': - return 'Investment'; - - case 'credit': - return 'Credit Card'; - - case 'mortgage': - return 'Mortgage'; - - case 'debt': - return 'Debt'; - - case 'other': - default: - return 'Other'; - } -} -function determineOffBudget(type) { - switch (type) { - case 'investment': - case 'mortgage': - case 'debt': - case 'other': - return true; - - default: - } - - return false; -} - -/***/ }), - -/***/ "./packages/loot-core/src/shared/async.js": -/*!************************************************!*\ - !*** ./packages/loot-core/src/shared/async.js ***! - \************************************************/ -/*! exports provided: sequential, once */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "sequential", function() { return sequential; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "once", function() { return once; }); -function sequential(fn) { - let sequenceState = { - running: null, - queue: [] - }; - - function pump() { - if (sequenceState.queue.length > 0) { - const next = sequenceState.queue.shift(); - run(next.args, next.resolve, next.reject); - } else { - sequenceState.running = null; - } - } - - function run(args, resolve, reject) { - sequenceState.running = fn(...args); - sequenceState.running.then(val => { - pump(); - resolve(val); - }, err => { - pump(); - reject(err); - }); - } - - return (...args) => { - if (!sequenceState.running) { - return new Promise((resolve, reject) => { - return run(args, resolve, reject); - }); - } else { - return new Promise((resolve, reject) => { - sequenceState.queue.push({ - resolve, - reject, - args - }); - }); - } - }; -} -function once(fn) { - let promise = null; - - let onceFn = (...args) => { - if (!promise) { - promise = fn(...args).finally(() => { - promise = null; - }); - return promise; - } - - return promise; - }; - - return onceFn; -} - -/***/ }), - -/***/ "./packages/loot-core/src/shared/months.js": -/*!*************************************************!*\ - !*** ./packages/loot-core/src/shared/months.js ***! - \*************************************************/ -/*! exports provided: parseDate, yearFromDate, monthFromDate, dayFromDate, currentMonth, currentDay, nextMonth, prevMonth, addMonths, subMonths, addDays, subDays, isBefore, isAfter, bounds, _range, range, rangeInclusive, _dayRange, dayRange, dayRangeInclusive, getMonthIndex, getYear, getMonth, getYearStart, getYearEnd, sheetForMonth, nameForMonth, format, getDateFormatRegex, getDayMonthFormat, getDayMonthRegex, getMonthYearFormat, getMonthYearRegex, getShortYearFormat, getShortYearRegex */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "parseDate", function() { return parseDate; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "yearFromDate", function() { return yearFromDate; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "monthFromDate", function() { return monthFromDate; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "dayFromDate", function() { return dayFromDate; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "currentMonth", function() { return currentMonth; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "currentDay", function() { return currentDay; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "nextMonth", function() { return nextMonth; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "prevMonth", function() { return prevMonth; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addMonths", function() { return addMonths; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "subMonths", function() { return subMonths; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addDays", function() { return addDays; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "subDays", function() { return subDays; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isBefore", function() { return isBefore; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isAfter", function() { return isAfter; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "bounds", function() { return bounds; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_range", function() { return _range; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "range", function() { return range; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "rangeInclusive", function() { return rangeInclusive; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_dayRange", function() { return _dayRange; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "dayRange", function() { return dayRange; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "dayRangeInclusive", function() { return dayRangeInclusive; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getMonthIndex", function() { return getMonthIndex; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getYear", function() { return getYear; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getMonth", function() { return getMonth; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getYearStart", function() { return getYearStart; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getYearEnd", function() { return getYearEnd; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "sheetForMonth", function() { return sheetForMonth; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "nameForMonth", function() { return nameForMonth; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "format", function() { return format; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getDateFormatRegex", function() { return getDateFormatRegex; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getDayMonthFormat", function() { return getDayMonthFormat; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getDayMonthRegex", function() { return getDayMonthRegex; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getMonthYearFormat", function() { return getMonthYearFormat; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getMonthYearRegex", function() { return getMonthYearRegex; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getShortYearFormat", function() { return getShortYearFormat; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getShortYearRegex", function() { return getShortYearRegex; }); -/* harmony import */ var date_fns__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! date-fns */ "./node_modules/date-fns/esm/index.js"); -/* harmony import */ var memoize_one__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! memoize-one */ "./node_modules/memoize-one/dist/memoize-one.esm.js"); -function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } - -function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } - -function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } - -function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } - -function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_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 _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } - - - - -function _parse(value) { - if (typeof value === 'string') { - // Dates are hard. We just want to deal with months in the format - // 2020-01 and days in the format 2020-01-01, but life is never - // simple. We want to rely on native dates for date logic because - // days are complicated (leap years, etc). But relying on native - // dates mean we're exposed to craziness. - // - // The biggest problem is that JS dates work with local time by - // default. We could try to only work with UTC, but there's not an - // easy way to make `format` avoid local time, and not sure if we - // want that anyway (`currentMonth` should surely print the local - // time). We need to embrace local time, and as long as inputs to - // date logic and outputs from format are local time, it should - // work. - // - // To make sure we're in local time, always give Date integer - // values. If you pass in a string to parse, different string - // formats produce different results. - // - // A big problem is daylight savings, however. Usually, when - // giving the time to the Date constructor, you get back a date - // specifically for that time in your local timezone. However, if - // daylight savings occurs on that exact time, you will get back - // something different: - // - // This is fine: - // > new Date(2017, 2, 12, 1).toString() - // > 'Sun Mar 12 2017 01:00:00 GMT-0500 (Eastern Standard Time)' - // - // But wait, we got back a different time (3AM instead of 2AM): - // > new Date(2017, 2, 12, 2).toString() - // > 'Sun Mar 12 2017 03:00:00 GMT-0400 (Eastern Daylight Time)' - // - // The time is "correctly" adjusted via DST, but we _really_ - // wanted 2AM. The problem is that time simply doesn't exist. - // - // Why is this a problem? Well, consider a case where the DST - // shift happens *at midnight* and it goes back an hour. You think - // you have a date object for the next day, but when formatted it - // actually shows the previous day. A more likely scenario: buggy - // timezone data makes JS dates do this shift when it shouldn't, - // so using midnight at the time for date logic gives back the - // last day. See the time range of Sep 30 15:00 - Oct 1 1:00 for - // the AEST timezone when nodejs-mobile incorrectly gives you back - // a time an hour *before* you specified. Since this happens on - // Oct 1, doing `addMonths(September, 1)` still gives you back - // September. Issue here: - // https://github.com/JaneaSystems/nodejs-mobile/issues/251 - // - // The fix is simple once you understand this. Always use the 12th - // hour of the day. That's it. There is no DST that shifts more - // than 12 hours (god let's hope not) so no matter how far DST has - // shifted backwards or forwards, doing date logic will stay - // within the day we want. - let _value$split = value.split('-'), - _value$split2 = _slicedToArray(_value$split, 3), - year = _value$split2[0], - month = _value$split2[1], - day = _value$split2[2]; - - if (day != null) { - return new Date(parseInt(year), parseInt(month) - 1, parseInt(day), 12); - } else if (month != null) { - return new Date(parseInt(year), parseInt(month) - 1, 1, 12); - } else { - return new Date(parseInt(year), 0, 1, 12); - } - } - - return value; -} - -const parseDate = _parse; -function yearFromDate(date) { - return date_fns__WEBPACK_IMPORTED_MODULE_0__["format"](_parse(date), 'yyyy'); -} -function monthFromDate(date) { - return date_fns__WEBPACK_IMPORTED_MODULE_0__["format"](_parse(date), 'yyyy-MM'); -} -function dayFromDate(date) { - return date_fns__WEBPACK_IMPORTED_MODULE_0__["format"](_parse(date), 'yyyy-MM-dd'); -} -function currentMonth() { - if (global.IS_TESTING) { - return '2017-01'; - } else { - return date_fns__WEBPACK_IMPORTED_MODULE_0__["format"](new Date(), 'yyyy-MM'); - } -} -function currentDay() { - if (global.IS_TESTING) { - return '2017-01-01'; - } else { - return date_fns__WEBPACK_IMPORTED_MODULE_0__["format"](new Date(), 'yyyy-MM-dd'); - } -} -function nextMonth(month) { - return date_fns__WEBPACK_IMPORTED_MODULE_0__["format"](date_fns__WEBPACK_IMPORTED_MODULE_0__["addMonths"](_parse(month), 1), 'yyyy-MM'); -} -function prevMonth(month) { - return date_fns__WEBPACK_IMPORTED_MODULE_0__["format"](date_fns__WEBPACK_IMPORTED_MODULE_0__["subMonths"](_parse(month), 1), 'yyyy-MM'); -} -function addMonths(month, n) { - return date_fns__WEBPACK_IMPORTED_MODULE_0__["format"](date_fns__WEBPACK_IMPORTED_MODULE_0__["addMonths"](_parse(month), n), 'yyyy-MM'); -} -function subMonths(month, n) { - return date_fns__WEBPACK_IMPORTED_MODULE_0__["format"](date_fns__WEBPACK_IMPORTED_MODULE_0__["subMonths"](_parse(month), n), 'yyyy-MM'); -} -function addDays(day, n) { - return date_fns__WEBPACK_IMPORTED_MODULE_0__["format"](date_fns__WEBPACK_IMPORTED_MODULE_0__["addDays"](_parse(day), n), 'yyyy-MM-dd'); -} -function subDays(day, n) { - return date_fns__WEBPACK_IMPORTED_MODULE_0__["format"](date_fns__WEBPACK_IMPORTED_MODULE_0__["subDays"](_parse(day), n), 'yyyy-MM-dd'); -} -function isBefore(month1, month2) { - return date_fns__WEBPACK_IMPORTED_MODULE_0__["isBefore"](_parse(month1), _parse(month2)); -} -function isAfter(month1, month2) { - return date_fns__WEBPACK_IMPORTED_MODULE_0__["isAfter"](_parse(month1), _parse(month2)); -} // TODO: This doesn't really fit in this module anymore, should -// probably live elsewhere - -function bounds(month) { - return { - start: parseInt(date_fns__WEBPACK_IMPORTED_MODULE_0__["format"](date_fns__WEBPACK_IMPORTED_MODULE_0__["startOfMonth"](_parse(month)), 'yyyyMMdd')), - end: parseInt(date_fns__WEBPACK_IMPORTED_MODULE_0__["format"](date_fns__WEBPACK_IMPORTED_MODULE_0__["endOfMonth"](_parse(month)), 'yyyyMMdd')) - }; -} -function _range(start, end, inclusive) { - const months = []; - let month = monthFromDate(start); - - while (date_fns__WEBPACK_IMPORTED_MODULE_0__["isBefore"](_parse(month), _parse(end))) { - months.push(month); - month = addMonths(month, 1); - } - - if (inclusive) { - months.push(month); - } - - return months; -} -function range(start, end) { - return _range(start, end); -} -function rangeInclusive(start, end) { - return _range(start, end, true); -} -function _dayRange(start, end, inclusive) { - const days = []; - let day = start; - - while (date_fns__WEBPACK_IMPORTED_MODULE_0__["isBefore"](_parse(day), _parse(end))) { - days.push(day); - day = addDays(day, 1); - } - - if (inclusive) { - days.push(day); - } - - return days; -} -function dayRange(start, end) { - return _dayRange(start, end); -} -function dayRangeInclusive(start, end) { - return _dayRange(start, end, true); -} -function getMonthIndex(month) { - return parseInt(month.slice(5, 7)) - 1; -} -function getYear(month) { - return month.slice(0, 4); -} -function getMonth(day) { - return day.slice(0, 7); -} -function getYearStart(month) { - return getYear(month) + '-01'; -} -function getYearEnd(month) { - return getYear(month) + '-12'; -} -function sheetForMonth(month) { - return 'budget' + month.replace('-', ''); -} -function nameForMonth(month) { - return date_fns__WEBPACK_IMPORTED_MODULE_0__["format"](_parse(month), "MMMM 'yy"); -} -function format(month, str) { - return date_fns__WEBPACK_IMPORTED_MODULE_0__["format"](_parse(month), str); -} -const getDateFormatRegex = Object(memoize_one__WEBPACK_IMPORTED_MODULE_1__["default"])(format => { - return new RegExp(format.replace(/d+/g, '\\d{1,2}').replace(/M+/g, '\\d{1,2}').replace(/y+/g, '\\d{4}')); -}); -const getDayMonthFormat = Object(memoize_one__WEBPACK_IMPORTED_MODULE_1__["default"])(format => { - return format.replace(/y+/g, '').replace(/[^\w]$/, '').replace(/^[^\w]/, ''); -}); -const getDayMonthRegex = Object(memoize_one__WEBPACK_IMPORTED_MODULE_1__["default"])(format => { - let regex = format.replace(/y+/g, '').replace(/[^\w]$/, '').replace(/^[^\w]/, '').replace(/d+/g, '\\d{1,2}').replace(/M+/g, '\\d{1,2}'); - return new RegExp('^' + regex + '$'); -}); -const getMonthYearFormat = Object(memoize_one__WEBPACK_IMPORTED_MODULE_1__["default"])(format => { - return format.replace(/d+/g, '').replace(/[^\w]$/, '').replace(/^[^\w]/, '').replace(/\/\//, '/').replace(/\.\./, '.').replace(/--/, '-'); -}); -const getMonthYearRegex = Object(memoize_one__WEBPACK_IMPORTED_MODULE_1__["default"])(format => { - let regex = format.replace(/d+/g, '').replace(/[^\w]$/, '').replace(/^[^\w]/, '').replace(/\/\//, '/').replace(/M+/g, '\\d{1,2}').replace(/y+/g, '\\d{2,4}'); - return new RegExp('^' + regex + '$'); -}); -const getShortYearFormat = Object(memoize_one__WEBPACK_IMPORTED_MODULE_1__["default"])(format => { - return format.replace(/y+/g, 'yy'); -}); -const getShortYearRegex = Object(memoize_one__WEBPACK_IMPORTED_MODULE_1__["default"])(format => { - let regex = format.replace(/[^\w]$/, '').replace(/^[^\w]/, '').replace(/d+/g, '\\d{1,2}').replace(/M+/g, '\\d{1,2}').replace(/y+/g, '\\d{2}'); - return new RegExp('^' + regex + '$'); -}); - -/***/ }), - -/***/ "./packages/loot-core/src/shared/query.js": -/*!************************************************!*\ - !*** ./packages/loot-core/src/shared/query.js ***! - \************************************************/ -/*! exports provided: Query, getPrimaryOrderBy, default */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Query", function() { return Query; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getPrimaryOrderBy", function() { return getPrimaryOrderBy; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return q; }); -function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } - -function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } - -function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } - -function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } - -function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_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 _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } - -function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } - -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } - -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; } - -class Query { - constructor(state) { - this.state = _objectSpread({ - filterExpressions: state.filterExpressions || [], - selectExpressions: state.selectExpressions || [], - groupExpressions: state.groupExpressions || [], - orderExpressions: state.orderExpressions || [], - calculation: false, - rawMode: false, - withDead: false, - validateRefs: true, - limit: null, - offset: null - }, state); - } - - filter(expr) { - return new Query(_objectSpread(_objectSpread({}, this.state), {}, { - filterExpressions: [...this.state.filterExpressions, expr] - })); - } - - unfilter(exprs) { - let exprSet = new Set(exprs); - return new Query(_objectSpread(_objectSpread({}, this.state), {}, { - filterExpressions: this.state.filterExpressions.filter(expr => !exprSet.has(Object.keys(expr)[0])) - })); - } - - select(exprs = []) { - if (!Array.isArray(exprs)) { - exprs = [exprs]; - } - - let query = new Query(_objectSpread(_objectSpread({}, this.state), {}, { - selectExpressions: exprs - })); - query.state.calculation = false; - return query; - } - - calculate(expr) { - let query = this.select({ - result: expr - }); - query.state.calculation = true; - return query; - } - - groupBy(exprs) { - if (!Array.isArray(exprs)) { - exprs = [exprs]; - } - - return new Query(_objectSpread(_objectSpread({}, this.state), {}, { - groupExpressions: [...this.state.groupExpressions, ...exprs] - })); - } - - orderBy(exprs) { - if (!Array.isArray(exprs)) { - exprs = [exprs]; - } - - return new Query(_objectSpread(_objectSpread({}, this.state), {}, { - orderExpressions: [...this.state.orderExpressions, ...exprs] - })); - } - - limit(num) { - return new Query(_objectSpread(_objectSpread({}, this.state), {}, { - limit: num - })); - } - - offset(num) { - return new Query(_objectSpread(_objectSpread({}, this.state), {}, { - offset: num - })); - } - - raw() { - return new Query(_objectSpread(_objectSpread({}, this.state), {}, { - rawMode: true - })); - } - - withDead() { - return new Query(_objectSpread(_objectSpread({}, this.state), {}, { - withDead: true - })); - } - - withoutValidatedRefs() { - return new Query(_objectSpread(_objectSpread({}, this.state), {}, { - validateRefs: false - })); - } - - options(opts) { - return new Query(_objectSpread(_objectSpread({}, this.state), {}, { - tableOptions: opts - })); - } - - serialize() { - return this.state; - } - -} -function getPrimaryOrderBy(query, defaultOrderBy) { - let orderExprs = query.serialize().orderExpressions; - - if (orderExprs.length === 0) { - if (defaultOrderBy) { - return _objectSpread({ - order: 'asc' - }, defaultOrderBy); - } - - return null; - } - - let firstOrder = orderExprs[0]; - - if (typeof firstOrder === 'string') { - return { - field: firstOrder, - order: 'asc' - }; - } // Handle this form: { field: 'desc' } - - - let _Object$keys = Object.keys(firstOrder), - _Object$keys2 = _slicedToArray(_Object$keys, 1), - field = _Object$keys2[0]; - - return { - field, - order: firstOrder[field] - }; -} -function q(table) { - return new Query({ - table - }); -} - -/***/ }), - -/***/ "./packages/loot-core/src/shared/rules.js": -/*!************************************************!*\ - !*** ./packages/loot-core/src/shared/rules.js ***! - \************************************************/ -/*! exports provided: TYPE_INFO, FIELD_TYPES, mapField, friendlyOp, deserializeField, getFieldError, sortNumbers, parse, unparse, makeValue, getApproxNumberThreshold */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TYPE_INFO", function() { return TYPE_INFO; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FIELD_TYPES", function() { return FIELD_TYPES; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "mapField", function() { return mapField; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "friendlyOp", function() { return friendlyOp; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "deserializeField", function() { return deserializeField; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getFieldError", function() { return getFieldError; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "sortNumbers", function() { return sortNumbers; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "parse", function() { return parse; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "unparse", function() { return unparse; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "makeValue", function() { return makeValue; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getApproxNumberThreshold", function() { return getApproxNumberThreshold; }); -/* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./util */ "./packages/loot-core/src/shared/util.js"); -const _excluded = ["error", "inputKey"]; - -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 _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 ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } - -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } - -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; } - - // For now, this info is duplicated from the backend. Figure out how -// to share it later. - -const TYPE_INFO = { - date: { - ops: ['is', 'isapprox', 'gt', 'gte', 'lt', 'lte'], - nullable: false - }, - id: { - ops: ['is', 'contains', 'oneOf'], - nullable: true - }, - string: { - ops: ['is', 'contains', 'oneOf'], - nullable: false - }, - number: { - ops: ['is', 'isapprox', 'isbetween', 'gt', 'gte', 'lt', 'lte'], - nullable: false - }, - boolean: { - ops: ['is'], - nullable: false - } -}; -const FIELD_TYPES = new Map(Object.entries({ - imported_payee: 'string', - payee: 'id', - date: 'date', - notes: 'string', - amount: 'number', - amountInflow: 'number', - amountOutfow: 'number', - category: 'id', - account: 'id', - cleared: 'boolean' -})); -function mapField(field, opts) { - opts = opts || {}; - - switch (field) { - case 'imported_payee': - return 'imported payee'; - - case 'amount': - if (opts.inflow) { - return 'amount (inflow)'; - } else if (opts.outflow) { - return 'amount (outflow)'; - } - - return 'amount'; - - case 'amount-inflow': - return 'amount (inflow)'; - - case 'amount-outflow': - return 'amount (outflow)'; - - default: - return field; - } -} -function friendlyOp(op, type) { - switch (op) { - case 'oneOf': - return 'one of'; - - case 'is': - return 'is'; - - case 'isapprox': - return 'is approx'; - - case 'isbetween': - return 'is between'; - - case 'contains': - return 'contains'; - - case 'gt': - if (type === 'date') { - return 'is after'; - } - - return 'is greater than'; - - case 'gte': - if (type === 'date') { - return 'is after or equals'; - } - - return 'is greater than or equals'; - - case 'lt': - if (type === 'date') { - return 'is before'; - } - - return 'is less than'; - - case 'lte': - if (type === 'date') { - return 'is before or equals'; - } - - return 'is less than or equals'; - - case 'true': - return 'is true'; - - case 'false': - return 'is false'; - - case 'set': - return 'set'; - - case 'link-schedule': - return 'link schedule'; - - default: - return ''; - } -} -function deserializeField(field) { - if (field === 'amount-inflow') { - return { - field: 'amount', - options: { - inflow: true - } - }; - } else if (field === 'amount-outflow') { - return { - field: 'amount', - options: { - outflow: true - } - }; - } else { - return { - field - }; - } -} -function getFieldError(type) { - switch (type) { - case 'date-format': - return 'Invalid date format'; - - case 'no-null': - case 'no-empty-array': - case 'no-empty-string': - return 'Value cannot be empty'; - - case 'not-number': - return 'Value must be a number'; - - case 'invalid-field': - return 'Please choose a valid field for this type of rule'; - - default: - return 'Internal error, sorry! Contact help@actualbudget.com'; - } -} -function sortNumbers(num1, num2) { - if (num1 < num2) { - return [num1, num2]; - } - - return [num2, num1]; -} -function parse(item) { - switch (item.type) { - case 'number': - { - let parsed = item.value; - - if (item.field === 'amount' && item.op !== 'isbetween') { - parsed = Object(_util__WEBPACK_IMPORTED_MODULE_0__["integerToAmount"])(parsed); - } - - return _objectSpread(_objectSpread({}, item), {}, { - value: parsed - }); - } - - case 'string': - { - let parsed = item.value == null ? '' : item.value; - return _objectSpread(_objectSpread({}, item), {}, { - value: parsed - }); - } - - default: - } - - return _objectSpread(_objectSpread({}, item), {}, { - error: null - }); -} -function unparse(_ref) { - let error = _ref.error, - inputKey = _ref.inputKey, - item = _objectWithoutProperties(_ref, _excluded); - - switch (item.type) { - case 'number': - { - let unparsed = item.value; - - if (item.field === 'amount' && item.op !== 'isbetween') { - unparsed = Object(_util__WEBPACK_IMPORTED_MODULE_0__["amountToInteger"])(unparsed); - } - - return _objectSpread(_objectSpread({}, item), {}, { - value: unparsed - }); - } - - case 'string': - { - let unparsed = item.value == null ? '' : item.value; - return _objectSpread(_objectSpread({}, item), {}, { - value: unparsed - }); - } - - default: - } - - return item; -} -function makeValue(value, cond) { - switch (cond.type) { - case 'number': - { - if (cond.op !== 'isbetween') { - return _objectSpread(_objectSpread({}, cond), {}, { - error: null, - value: value ? Object(_util__WEBPACK_IMPORTED_MODULE_0__["currencyToAmount"])(value) || 0 : 0 - }); - } - - break; - } - - default: - } - - return _objectSpread(_objectSpread({}, cond), {}, { - error: null, - value - }); -} -function getApproxNumberThreshold(number) { - return Math.abs(number) * 0.075 | 0; -} - -/***/ }), - -/***/ "./packages/loot-core/src/shared/schedules.js": -/*!****************************************************!*\ - !*** ./packages/loot-core/src/shared/schedules.js ***! - \****************************************************/ -/*! exports provided: getStatus, getHasTransactionsQuery, getRecurringDescription, recurConfigToRSchedule, extractScheduleConds, getScheduledAmount */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getStatus", function() { return getStatus; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getHasTransactionsQuery", function() { return getHasTransactionsQuery; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getRecurringDescription", function() { return getRecurringDescription; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "recurConfigToRSchedule", function() { return recurConfigToRSchedule; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "extractScheduleConds", function() { return extractScheduleConds; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getScheduledAmount", function() { return getScheduledAmount; }); -/* harmony import */ var _months__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./months */ "./packages/loot-core/src/shared/months.js"); -/* harmony import */ var _query__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./query */ "./packages/loot-core/src/shared/query.js"); -function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } - -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } - -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 getStatus(nextDate, completed, hasTrans) { - let today = _months__WEBPACK_IMPORTED_MODULE_0__["currentDay"](); - - if (completed) { - return 'completed'; - } else if (hasTrans) { - return 'paid'; - } else if (nextDate === today) { - return 'due'; - } else if (nextDate > today && nextDate <= _months__WEBPACK_IMPORTED_MODULE_0__["addDays"](today, 7)) { - return 'upcoming'; - } else if (nextDate < today) { - return 'missed'; - } else { - return 'scheduled'; - } -} -function getHasTransactionsQuery(schedules) { - let filters = schedules.map(schedule => { - let dateCond = schedule._conditions.find(c => c.field === 'date'); - - return { - $and: { - schedule: schedule.id, - date: { - $gte: dateCond && dateCond.op === 'is' ? schedule.next_date : _months__WEBPACK_IMPORTED_MODULE_0__["subDays"](schedule.next_date, 2) - } - } - }; - }); - return Object(_query__WEBPACK_IMPORTED_MODULE_1__["default"])('transactions').filter({ - $or: filters - }).orderBy({ - date: 'desc' - }).groupBy('schedule').select(['schedule', 'date']); -} - -function makeNumberSuffix(num) { - // Slight abuse of date-fns to turn a number like "1" into the full - // form "1st" but formatting a date with that number - return _months__WEBPACK_IMPORTED_MODULE_0__["format"](new Date(2020, 0, num, 12), 'do'); -} - -function prettyDayName(day) { - let days = { - SU: 'Sunday', - MO: 'Monday', - TU: 'Tuesday', - WE: 'Wednesday', - TH: 'Thursday', - FR: 'Friday', - SA: 'Saturday' - }; - return days[day]; -} - -function getRecurringDescription(config) { - let interval = config.interval || 1; - - switch (config.frequency) { - case 'weekly': - { - let desc = 'Every '; - desc += interval !== 1 ? `${interval} weeks` : 'week'; - desc += ' on ' + _months__WEBPACK_IMPORTED_MODULE_0__["format"](config.start, 'EEEE'); - return desc; - } - - case 'monthly': - { - let desc = 'Every '; - desc += interval !== 1 ? `${interval} months` : 'month'; - - if (config.patterns && config.patterns.length > 0) { - // Sort the days ascending. We filter out -1 because that - // represents "last days" and should always be last, but this - // sort would put them first - let patterns = [...config.patterns].sort((p1, p2) => { - let typeOrder = (p1.type === 'day' ? 1 : 0) - (p2.type === 'day' ? 1 : 0); - let valOrder = p1.value - p2.value; - - if (typeOrder === 0) { - return valOrder; - } - - return typeOrder; - }).filter(p => p.value !== -1); // Add on all -1 values to the end - - patterns = patterns.concat(config.patterns.filter(p => p.value === -1)); - desc += ' on the '; - let strs = []; - let uniqueDays = new Set(patterns.map(p => p.type)); - let isSameDay = uniqueDays.length === 1 && !uniqueDays.has('day'); - - for (let pattern of patterns) { - if (pattern.type === 'day') { - if (pattern.value === -1) { - strs.push('last day'); - } else { - // Example: 15th day - strs.push(makeNumberSuffix(pattern.value)); - } - } else { - let dayName = isSameDay ? '' : ' ' + prettyDayName(pattern.type); - - if (pattern.value === -1) { - // Example: last Monday - strs.push('last' + dayName); - } else { - // Example: 3rd Monday - strs.push(makeNumberSuffix(pattern.value) + dayName); - } - } - } - - if (strs.length > 2) { - desc += strs.slice(0, strs.length - 1).join(', '); - desc += ', and '; - desc += strs[strs.length - 1]; - } else { - desc += strs.join(' and '); - } - - if (isSameDay) { - desc += ' ' + prettyDayName(patterns[0].type); - } - } else { - desc += ' on the ' + _months__WEBPACK_IMPORTED_MODULE_0__["format"](config.start, 'do'); - } - - return desc; - } - - case 'yearly': - { - let desc = 'Every '; - desc += interval !== 1 ? `${interval} years` : 'year'; - desc += ' on ' + _months__WEBPACK_IMPORTED_MODULE_0__["format"](config.start, 'LLL do'); - return desc; - } - - default: - return 'Recurring error'; - } -} -function recurConfigToRSchedule(config) { - let base = { - start: _months__WEBPACK_IMPORTED_MODULE_0__["parseDate"](config.start), - frequency: config.frequency.toUpperCase(), - byHourOfDay: [12] - }; - - if (config.interval) { - base.interval = config.interval; - } - - let abbrevDay = name => name.slice(0, 2).toUpperCase(); - - switch (config.frequency) { - case 'weekly': - // Nothing to do - return [base]; - - case 'monthly': - if (config.patterns && config.patterns.length > 0) { - let days = config.patterns.filter(p => p.type === 'day'); - let dayNames = config.patterns.filter(p => p.type !== 'day'); - return [days.length > 0 && _objectSpread(_objectSpread({}, base), {}, { - byDayOfMonth: days.map(p => p.value) - }), dayNames.length > 0 && _objectSpread(_objectSpread({}, base), {}, { - byDayOfWeek: dayNames.map(p => [abbrevDay(p.type), p.value]) - })].filter(Boolean); - } else { - // Nothing to do - return [base]; - } - - case 'yearly': - return [base]; - - default: - throw new Error('Invalid recurring date config'); - } -} -function extractScheduleConds(conditions) { - return { - payee: conditions.find(cond => cond.op === 'is' && cond.field === 'payee') || conditions.find(cond => cond.op === 'is' && cond.field === 'description') || null, - account: conditions.find(cond => cond.op === 'is' && cond.field === 'account') || conditions.find(cond => cond.op === 'is' && cond.field === 'acct') || null, - amount: conditions.find(cond => (cond.op === 'is' || cond.op === 'isapprox' || cond.op === 'isbetween') && cond.field === 'amount') || null, - date: conditions.find(cond => (cond.op === 'is' || cond.op === 'isapprox') && cond.field === 'date') || null - }; -} -function getScheduledAmount(amount) { - if (amount && typeof amount !== 'number') { - return (amount.num1 + amount.num2) / 2 | 0; - } - - return amount; -} - -/***/ }), - -/***/ "./packages/loot-core/src/shared/transactions.js": -/*!*******************************************************!*\ - !*** ./packages/loot-core/src/shared/transactions.js ***! - \*******************************************************/ -/*! exports provided: makeChild, recalculateSplit, findParentIndex, getSplit, ungroupTransactions, groupTransaction, ungroupTransaction, applyTransactionDiff, replaceTransactions, addSplitTransaction, updateTransaction, deleteTransaction, splitTransaction, realizeTempTransactions */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "makeChild", function() { return makeChild; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "recalculateSplit", function() { return recalculateSplit; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "findParentIndex", function() { return findParentIndex; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getSplit", function() { return getSplit; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ungroupTransactions", function() { return ungroupTransactions; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "groupTransaction", function() { return groupTransaction; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ungroupTransaction", function() { return ungroupTransaction; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "applyTransactionDiff", function() { return applyTransactionDiff; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "replaceTransactions", function() { return replaceTransactions; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addSplitTransaction", function() { return addSplitTransaction; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "updateTransaction", function() { return updateTransaction; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "deleteTransaction", function() { return deleteTransaction; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "splitTransaction", function() { return splitTransaction; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "realizeTempTransactions", function() { return realizeTempTransactions; }); -/* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./util */ "./packages/loot-core/src/shared/util.js"); -const _excluded = ["subtransactions"]; - -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 _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 ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } - -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } - -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; } - - - -const uuid = __webpack_require__(/*! ../platform/uuid */ "./packages/loot-core/src/platform/uuid/index.electron.js"); // The amount might be null when adding a new transaction - - -function num(n) { - return typeof n === 'number' ? n : 0; -} - -function SplitTransactionError(total, parent) { - let difference = num(parent.amount) - total; - return { - type: 'SplitTransactionError', - version: 1, - difference - }; -} - -function makeChild(parent, data) { - let prefix = parent.id === 'temp' ? 'temp' : ''; - return _objectSpread(_objectSpread({ - amount: 0 - }, data), {}, { - payee: data.payee || parent.payee, - id: data.id ? data.id : prefix + uuid.v4Sync(), - account: parent.account, - date: parent.date, - cleared: parent.cleared != null ? parent.cleared : null, - starting_balance_flag: parent.starting_balance_flag != null ? parent.starting_balance_flag : null, - is_child: true, - parent_id: parent.id, - error: null - }); -} -function recalculateSplit(trans) { - // Calculate the new total of split transactions and make sure - // that it equals the parent amount - const total = trans.subtransactions.reduce((acc, t) => acc + num(t.amount), 0); - return _objectSpread(_objectSpread({}, trans), {}, { - error: total === num(trans.amount) ? null : SplitTransactionError(total, trans) - }); -} -function findParentIndex(transactions, idx) { - // This relies on transactions being sorted in a way where parents - // are always before children, which is enforced in the db layer. - // Walk backwards and find the last parent; - while (idx >= 0) { - let trans = transactions[idx]; - - if (trans.is_parent) { - return idx; - } - - idx--; - } - - return null; -} -function getSplit(transactions, parentIndex) { - let split = [transactions[parentIndex]]; - let curr = parentIndex + 1; - - while (curr < transactions.length && transactions[curr].is_child) { - split.push(transactions[curr]); - curr++; - } - - return split; -} -function ungroupTransactions(transactions) { - let x = transactions.reduce((list, parent) => { - let subtransactions = parent.subtransactions, - trans = _objectWithoutProperties(parent, _excluded); - - subtransactions = subtransactions || []; - list.push(trans); - - for (let i = 0; i < subtransactions.length; i++) { - list.push(subtransactions[i]); - } - - return list; - }, []); - return x; -} -function groupTransaction(split) { - return _objectSpread(_objectSpread({}, split[0]), {}, { - subtransactions: split.slice(1) - }); -} -function ungroupTransaction(split) { - if (split == null) { - return null; - } - - return ungroupTransactions([split]); -} -function applyTransactionDiff(groupedTrans, diff) { - return groupTransaction(Object(_util__WEBPACK_IMPORTED_MODULE_0__["applyChanges"])(diff, ungroupTransaction(groupedTrans))); -} -function replaceTransactions(transactions, id, func) { - let idx = transactions.findIndex(t => t.id === id); - let trans = transactions[idx]; - let transactionsCopy = [...transactions]; - - if (idx === -1) { - throw new Error('Tried to edit unknown transaction id: ' + id); - } - - if (trans.is_parent || trans.is_child) { - let parentIndex = findParentIndex(transactions, idx); - - if (parentIndex == null) { - console.log('Cannot find parent index'); - return { - diff: { - deleted: [], - updated: [] - } - }; - } - - let split = getSplit(transactions, parentIndex); - let grouped = func(groupTransaction(split)); - let newSplit = ungroupTransaction(grouped); - let diff; - - if (newSplit == null) { - // If everything was deleted, just delete the parent which will - // delete everything - diff = { - deleted: [{ - id: split[0].id - }], - updated: [] - }; - grouped = { - id: split[0].id, - _deleted: true - }; - transactionsCopy.splice(parentIndex, split.length); - } else { - diff = Object(_util__WEBPACK_IMPORTED_MODULE_0__["diffItems"])(split, newSplit); - transactionsCopy.splice(parentIndex, split.length, ...newSplit); - } - - return { - data: transactionsCopy, - newTransaction: grouped, - diff - }; - } else { - let grouped = func(trans); - let newTrans = ungroupTransaction(grouped) || []; - - if (grouped) { - grouped.subtransactions = grouped.subtransactions || []; - } - - transactionsCopy.splice(idx, 1, ...newTrans); - return { - data: transactionsCopy, - newTransaction: grouped || { - id: trans.id, - _deleted: true - }, - diff: Object(_util__WEBPACK_IMPORTED_MODULE_0__["diffItems"])([trans], newTrans) - }; - } -} -function addSplitTransaction(transactions, id) { - return replaceTransactions(transactions, id, trans => { - if (!trans.is_parent) { - return trans; - } - - let prevSub = Object(_util__WEBPACK_IMPORTED_MODULE_0__["last"])(trans.subtransactions); - trans.subtransactions.push(makeChild(trans, { - amount: 0, - sort_order: num(prevSub && prevSub.sort_order) - 1 - })); - return trans; - }); -} -function updateTransaction(transactions, transaction) { - return replaceTransactions(transactions, transaction.id, trans => { - if (trans.is_parent) { - let parent = trans.id === transaction.id ? transaction : trans; - let sub = trans.subtransactions.map(t => { - // Make sure to update the children to reflect the updated - // properties (if the parent updated) - let child = t; - - if (trans.id === transaction.id) { - child = _objectSpread(_objectSpread({}, t), {}, { - payee: t.payee === trans.payee ? transaction.payee : t.payee - }); - } else if (t.id === transaction.id) { - child = transaction; - } - - return makeChild(parent, child); - }); - return recalculateSplit(_objectSpread(_objectSpread({}, parent), {}, { - subtransactions: sub - })); - } else { - return transaction; - } - }); -} -function deleteTransaction(transactions, id) { - return replaceTransactions(transactions, id, trans => { - if (trans.is_parent) { - if (trans.id === id) { - return null; - } else if (trans.subtransactions.length === 1) { - return _objectSpread(_objectSpread({}, trans), {}, { - subtransactions: null, - is_parent: false, - error: null - }); - } else { - let sub = trans.subtransactions.filter(t => t.id !== id); - return recalculateSplit(_objectSpread(_objectSpread({}, trans), {}, { - subtransactions: sub - })); - } - } else { - return null; - } - }); -} -function splitTransaction(transactions, id) { - return replaceTransactions(transactions, id, trans => { - if (trans.is_parent || trans.is_child) { - return trans; - } - - return _objectSpread(_objectSpread({}, trans), {}, { - is_parent: true, - error: num(trans.amount) === 0 ? null : SplitTransactionError(0, trans), - subtransactions: [makeChild(trans, { - amount: 0, - sort_order: -1 - })] - }); - }); -} -function realizeTempTransactions(transactions) { - let parent = transactions.find(t => !t.is_child); - parent = _objectSpread(_objectSpread({}, parent), {}, { - id: uuid.v4Sync() - }); - let children = transactions.filter(t => t.is_child); - return [parent, ...children.map(child => _objectSpread(_objectSpread({}, child), {}, { - id: uuid.v4Sync(), - parent_id: parent.id - }))]; -} - -/***/ }), - -/***/ "./packages/loot-core/src/shared/util.js": -/*!***********************************************!*\ - !*** ./packages/loot-core/src/shared/util.js ***! - \***********************************************/ -/*! exports provided: cleanUUID, last, mergeObjects, composeCellChanges, flattenArray, shallowEqual, getChangedValues, hasFieldsChanged, applyChanges, partitionByField, groupBy, groupBySingle, diffItems, groupById, debugMemoFailure, setIn, getIn, throwError, fastSetMerge, titleFirst, numberFormats, setNumberFormat, getNumberFormat, toRelaxedNumber, toRelaxedInteger, integerToCurrency, amountToCurrency, amountToPrettyCurrency, currencyToAmount, currencyToInteger, stringToInteger, amountToInteger, integerToAmount, looselyParseAmount, semverToNumber */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "cleanUUID", function() { return cleanUUID; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "last", function() { return last; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "mergeObjects", function() { return mergeObjects; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "composeCellChanges", function() { return composeCellChanges; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "flattenArray", function() { return flattenArray; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "shallowEqual", function() { return shallowEqual; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getChangedValues", function() { return getChangedValues; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "hasFieldsChanged", function() { return hasFieldsChanged; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "applyChanges", function() { return applyChanges; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "partitionByField", function() { return partitionByField; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "groupBy", function() { return groupBy; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "groupBySingle", function() { return groupBySingle; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "diffItems", function() { return diffItems; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "groupById", function() { return groupById; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "debugMemoFailure", function() { return debugMemoFailure; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setIn", function() { return setIn; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getIn", function() { return getIn; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "throwError", function() { return throwError; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fastSetMerge", function() { return fastSetMerge; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "titleFirst", function() { return titleFirst; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "numberFormats", function() { return numberFormats; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setNumberFormat", function() { return setNumberFormat; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getNumberFormat", function() { return getNumberFormat; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "toRelaxedNumber", function() { return toRelaxedNumber; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "toRelaxedInteger", function() { return toRelaxedInteger; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "integerToCurrency", function() { return integerToCurrency; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "amountToCurrency", function() { return amountToCurrency; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "amountToPrettyCurrency", function() { return amountToPrettyCurrency; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "currencyToAmount", function() { return currencyToAmount; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "currencyToInteger", function() { return currencyToInteger; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "stringToInteger", function() { return stringToInteger; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "amountToInteger", function() { return amountToInteger; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "integerToAmount", function() { return integerToAmount; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "looselyParseAmount", function() { return looselyParseAmount; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "semverToNumber", function() { return semverToNumber; }); -const _excluded = ["id"]; - -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 _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 ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } - -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } - -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; } - -let currencyFormatter = __webpack_require__(/*! currency-formatter */ "./node_modules/currency-formatter/index.js"); - -function cleanUUID(uuid) { - return uuid.replace(/-/g, ''); -} -function last(arr) { - return arr[arr.length - 1]; -} -function mergeObjects(objects) { - return Object.assign.apply(null, [{}, ...objects]); -} -function composeCellChanges(objects) { - const merged = {}; - Object.keys(objects).forEach(key => { - if (merged[key]) { - merged[key] = _objectSpread(_objectSpread({}, merged[key]), objects[key]); - } else { - merged[key] = objects[key]; - } - }); -} -function flattenArray(arrays) { - return Array.prototype.concat.apply([], arrays); -} -function shallowEqual(a, b) { - if (a === b) { - return true; - } - - var numKeysA = 0, - numKeysB = 0, - key; - - for (key in b) { - numKeysB++; - - if (!a.hasOwnProperty(key) || a[key] !== b[key]) { - return false; - } - } - - for (key in a) { - numKeysA++; - } - - return numKeysA === numKeysB; -} -function getChangedValues(obj1, obj2) { - // Keep the id field because this is mostly used to diff database - // objects - const diff = obj1.id ? { - id: obj1.id - } : {}; - const keys = Object.keys(obj2); - let hasChanged = false; - - for (let i = 0; i < keys.length; i++) { - let key = keys[i]; - - if (obj1[key] !== obj2[key]) { - diff[key] = obj2[key]; - hasChanged = true; - } - } - - return hasChanged ? diff : null; -} -function hasFieldsChanged(obj1, obj2, fields) { - let changed = false; - - for (var i = 0; i < fields.length; i++) { - let field = fields[i]; - - if (obj1[field] !== obj2[field]) { - changed = true; - break; - } - } - - return changed; -} -function applyChanges(changes, items) { - items = [...items]; - - if (changes.added) { - changes.added.forEach(add => { - items.push(add); - }); - } - - if (changes.updated) { - changes.updated.forEach(_ref => { - let id = _ref.id, - fields = _objectWithoutProperties(_ref, _excluded); - - const idx = items.findIndex(t => t.id === id); - items[idx] = _objectSpread(_objectSpread({}, items[idx]), fields); - }); - } - - if (changes.deleted) { - changes.deleted.forEach(t => { - const idx = items.findIndex(t2 => t.id === t2.id); - - if (idx !== -1) { - items.splice(idx, 1); - } - }); - } - - return items; -} -function partitionByField(data, field) { - let res = new Map(); - - for (let i = 0; i < data.length; i++) { - let item = data[i]; - let key = item[field]; - let items = res.get(key) || []; - items.push(item); - res.set(key, items); - } - - return res; -} -function groupBy(data, field, mapper) { - let res = new Map(); - - for (let i = 0; i < data.length; i++) { - let item = data[i]; - let key = item[field]; - let existing = res.get(key) || []; - res.set(key, existing.concat([mapper ? mapper(item) : data[i]])); - } - - return res; -} -function groupBySingle(data, field, mapper) { - let res = new Map(); - - for (let i = 0; i < data.length; i++) { - let item = data[i]; - let key = item[field]; - - if (res.has(key)) { - throw new Error('groupBySingle found conflicting key: ' + key); - } - - res.set(key, mapper ? mapper(item) : data[i]); - } - - return res; -} // This should replace the existing `groupById` function, since a -// `Map` is better, but we can't swap it out because `Map` has a -// different API and we need to go through and update everywhere that -// uses it. - -function _groupById(data) { - let res = new Map(); - - for (let i = 0; i < data.length; i++) { - let item = data[i]; - res.set(item.id, item); - } - - return res; -} - -function diffItems(items, newItems) { - let grouped = _groupById(items); - - let newGrouped = _groupById(newItems); - - let added = []; - let updated = []; - let deleted = items.filter(item => !newGrouped.has(item.id)).map(item => ({ - id: item.id - })); - newItems.forEach(newItem => { - let item = grouped.get(newItem.id); - - if (!item) { - added.push(newItem); - } else { - const changes = getChangedValues(item, newItem); - - if (changes) { - updated.push(changes); - } - } - }); - return { - added, - updated, - deleted - }; -} -function groupById(data) { - let res = {}; - - for (let i = 0; i < data.length; i++) { - let item = data[i]; - res[item.id] = item; - } - - return res; -} -function debugMemoFailure(prevProps, nextProps) { - let changed = getChangedValues(prevProps, nextProps); - - if (changed !== null) { - console.log(changed); - } - - return changed === null; -} -function setIn(map, keys, item) { - for (let i = 0; i < keys.length; i++) { - let key = keys[i]; - - if (i === keys.length - 1) { - map.set(key, item); - } else { - if (!map.has(key)) { - map.set(key, new Map()); - } - - map = map.get(key); - } - } -} -function getIn(map, keys) { - let item = map; - - for (let i = 0; i < keys.length; i++) { - item = item.get(keys[i]); - - if (item == null) { - return item; - } - } - - return item; -} // Useful for throwing exception from expressions - -function throwError(err) { - throw err; -} -function fastSetMerge(set1, set2) { - let finalSet = new Set(set1); - let iter = set2.values(); - let value = iter.next(); - - while (!value.done) { - finalSet.add(value.value); - value = iter.next(); - } - - return finalSet; -} -function titleFirst(str) { - return str[0].toUpperCase() + str.slice(1); -} -let numberFormats = [{ - value: 'comma-dot', - label: '1,000.33' -}, { - value: 'dot-comma', - label: '1.000,33' -}, { - value: 'space-comma', - label: '1 000,33' -}]; -let numberFormat = { - value: null, - formatter: null, - regex: null -}; -function setNumberFormat(format) { - let locale, regex, separator; - - switch (format) { - case 'space-comma': - locale = 'za-ZA'; - regex = /[^-0-9,]/g; - separator = ','; - break; - - case 'dot-comma': - locale = 'de-DE'; - regex = /[^-0-9,]/g; - separator = ','; - break; - - case 'comma-dot': - default: - locale = 'en-US'; - regex = /[^-0-9.]/g; - separator = '.'; - } - - numberFormat = { - value: format, - separator, - // This is the keep in line with the Intl API which we might - // switch to when it's available on all mobile platforms - formatter: { - format: number => currencyFormatter.format(number, { - locale, - format: '%v' - }) - }, - regex - }; -} -function getNumberFormat() { - return numberFormat; -} -setNumberFormat('1,000.33'); -function toRelaxedNumber(value) { - return integerToAmount(currencyToInteger(value) || 0); -} -function toRelaxedInteger(value) { - return stringToInteger(value) || 0; -} -function integerToCurrency(n) { - // Awesome - return numberFormat.formatter.format(n / 100); -} -function amountToCurrency(n) { - return numberFormat.formatter.format(n); -} -function amountToPrettyCurrency(n, code) { - return currencyFormatter.format(n, { - code - }); -} -function currencyToAmount(str) { - let amount = parseFloat(str.replace(numberFormat.regex, '').replace(numberFormat.separator, '.')); - return isNaN(amount) ? null : amount; -} -function currencyToInteger(str) { - let amount = currencyToAmount(str); - return amount ? amountToInteger(amount) : null; -} -function stringToInteger(str) { - let amount = parseInt(str.replace(/[^-0-9.,]/g, '')); - - if (!isNaN(amount)) { - return amount; - } - - return null; -} -function amountToInteger(n) { - return Math.round(n * 100); -} -function integerToAmount(n) { - return parseFloat((n / 100).toFixed(2)); -} // This is used when the input format could be anything (from -// financial files and we don't want to parse based on the user's -// number format, because the user could be importing from many -// currencies. We extract out the numbers and just ignore separators. - -function looselyParseAmount(amount) { - function safeNumber(v) { - return isNaN(v) ? null : v; - } - - let m = amount.match(/[.,][^.,]*$/); - - if (!m || m.index === 0) { - return safeNumber(parseFloat(amount)); - } - - let left = amount.slice(0, m.index); - let right = amount.slice(m.index + 1); - return safeNumber(parseFloat(left.replace(/[^0-9-]/g, '') + '.' + right)); -} -function semverToNumber(str) { - return parseInt('1' + str.split('.').map(x => { - return ('000' + x.replace(/[^0-9]/g, '')).slice(-3); - }).join('')); -} - -/***/ }), - -/***/ "better-sqlite3": -/*!*********************************!*\ - !*** external "better-sqlite3" ***! - \*********************************/ -/*! no static exports found */ -/***/ (function(module, exports) { - -module.exports = require("better-sqlite3"); - -/***/ }), - -/***/ "crypto": -/*!*************************!*\ - !*** external "crypto" ***! - \*************************/ -/*! no static exports found */ -/***/ (function(module, exports) { - -module.exports = require("crypto"); - -/***/ }), - -/***/ "fs": -/*!*********************!*\ - !*** external "fs" ***! - \*********************/ -/*! no static exports found */ -/***/ (function(module, exports) { - -module.exports = require("fs"); - -/***/ }), - -/***/ "node-fetch": -/*!*****************************!*\ - !*** external "node-fetch" ***! - \*****************************/ -/*! no static exports found */ -/***/ (function(module, exports) { - -module.exports = require("node-fetch"); - -/***/ }), - -/***/ "node-libofx": -/*!******************************!*\ - !*** external "node-libofx" ***! - \******************************/ -/*! no static exports found */ -/***/ (function(module, exports) { - -module.exports = require("node-libofx"); - -/***/ }), - -/***/ "path": -/*!***********************!*\ - !*** external "path" ***! - \***********************/ -/*! no static exports found */ -/***/ (function(module, exports) { - -module.exports = require("path"); - -/***/ }), - -/***/ "stream": -/*!*************************!*\ - !*** external "stream" ***! - \*************************/ -/*! no static exports found */ -/***/ (function(module, exports) { - -module.exports = require("stream"); - -/***/ }), - -/***/ "string_decoder": -/*!*********************************!*\ - !*** external "string_decoder" ***! - \*********************************/ -/*! no static exports found */ -/***/ (function(module, exports) { - -module.exports = require("string_decoder"); - -/***/ }), - -/***/ "util": -/*!***********************!*\ - !*** external "util" ***! - \***********************/ -/*! no static exports found */ -/***/ (function(module, exports) { - -module.exports = require("util"); - -/***/ }), - -/***/ "zlib": -/*!***********************!*\ - !*** external "zlib" ***! - \***********************/ -/*! no static exports found */ -/***/ (function(module, exports) { - -module.exports = require("zlib"); - -/***/ }) - -/******/ }); -//# sourceMappingURL=bundle.api.js.map \ No newline at end of file diff --git a/packages/api/app/bundle.api.js.map b/packages/api/app/bundle.api.js.map deleted file mode 100644 index 33f713ed38b545012d4fc60907d978e10b250a3f..0000000000000000000000000000000000000000 --- a/packages/api/app/bundle.api.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./node_modules/@rschedule/core/es2015/generators.js","webpack:///./node_modules/@rschedule/core/es2015/main.js","webpack:///./node_modules/@rschedule/core/es2015/rules.js","webpack:///./node_modules/@rschedule/json-tools/es2015/Schedule.js","webpack:///./node_modules/@rschedule/json-tools/es2015/main.js","webpack:///./node_modules/@rschedule/standard-date-adapter/es2015/main.js","webpack:///./node_modules/@rschedule/standard-date-adapter/es2015/setup.js","webpack:///./node_modules/accounting/accounting.js","webpack:///./node_modules/adm-zip/adm-zip.js","webpack:///./node_modules/adm-zip/headers/entryHeader.js","webpack:///./node_modules/adm-zip/headers/index.js","webpack:///./node_modules/adm-zip/headers/mainHeader.js","webpack:///./node_modules/adm-zip/methods/deflater.js","webpack:///./node_modules/adm-zip/methods/index.js","webpack:///./node_modules/adm-zip/methods/inflater.js","webpack:///./node_modules/adm-zip/methods/zipcrypto.js","webpack:///./node_modules/adm-zip/util/constants.js","webpack:///./node_modules/adm-zip/util/errors.js","webpack:///./node_modules/adm-zip/util/fattr.js","webpack:///./node_modules/adm-zip/util/fileSystem.js","webpack:///./node_modules/adm-zip/util/index.js","webpack:///./node_modules/adm-zip/util/utils.js","webpack:///./node_modules/adm-zip/zipEntry.js","webpack:///./node_modules/adm-zip/zipFile.js","webpack:///./node_modules/available-typed-arrays/index.js","webpack:///./node_modules/call-bind/callBound.js","webpack:///./node_modules/call-bind/index.js","webpack:///./node_modules/charenc/charenc.js","webpack:///./node_modules/crypt/crypt.js","webpack:///./node_modules/csv-parse/lib/ResizeableBuffer.js","webpack:///./node_modules/csv-parse/lib/index.js","webpack:///./node_modules/csv-parse/lib/sync.js","webpack:///./node_modules/csv-stringify/lib/index.js","webpack:///./node_modules/csv-stringify/lib/sync.js","webpack:///./node_modules/currency-formatter/index.js","webpack:///./node_modules/damerau-levenshtein/index.js","webpack:///./node_modules/date-fns/esm/_lib/addLeadingZeros/index.js","webpack:///./node_modules/date-fns/esm/_lib/assign/index.js","webpack:///./node_modules/date-fns/esm/_lib/cloneObject/index.js","webpack:///./node_modules/date-fns/esm/_lib/format/formatters/index.js","webpack:///./node_modules/date-fns/esm/_lib/format/lightFormatters/index.js","webpack:///./node_modules/date-fns/esm/_lib/format/longFormatters/index.js","webpack:///./node_modules/date-fns/esm/_lib/getTimezoneOffsetInMilliseconds/index.js","webpack:///./node_modules/date-fns/esm/_lib/getUTCDayOfYear/index.js","webpack:///./node_modules/date-fns/esm/_lib/getUTCISOWeek/index.js","webpack:///./node_modules/date-fns/esm/_lib/getUTCISOWeekYear/index.js","webpack:///./node_modules/date-fns/esm/_lib/getUTCWeek/index.js","webpack:///./node_modules/date-fns/esm/_lib/getUTCWeekYear/index.js","webpack:///./node_modules/date-fns/esm/_lib/protectedTokens/index.js","webpack:///./node_modules/date-fns/esm/_lib/setUTCDay/index.js","webpack:///./node_modules/date-fns/esm/_lib/setUTCISODay/index.js","webpack:///./node_modules/date-fns/esm/_lib/setUTCISOWeek/index.js","webpack:///./node_modules/date-fns/esm/_lib/setUTCWeek/index.js","webpack:///./node_modules/date-fns/esm/_lib/startOfUTCISOWeek/index.js","webpack:///./node_modules/date-fns/esm/_lib/startOfUTCISOWeekYear/index.js","webpack:///./node_modules/date-fns/esm/_lib/startOfUTCWeek/index.js","webpack:///./node_modules/date-fns/esm/_lib/startOfUTCWeekYear/index.js","webpack:///./node_modules/date-fns/esm/_lib/toInteger/index.js","webpack:///./node_modules/date-fns/esm/addDays/index.js","webpack:///./node_modules/date-fns/esm/addHours/index.js","webpack:///./node_modules/date-fns/esm/addISOWeekYears/index.js","webpack:///./node_modules/date-fns/esm/addMilliseconds/index.js","webpack:///./node_modules/date-fns/esm/addMinutes/index.js","webpack:///./node_modules/date-fns/esm/addMonths/index.js","webpack:///./node_modules/date-fns/esm/addQuarters/index.js","webpack:///./node_modules/date-fns/esm/addSeconds/index.js","webpack:///./node_modules/date-fns/esm/addWeeks/index.js","webpack:///./node_modules/date-fns/esm/addYears/index.js","webpack:///./node_modules/date-fns/esm/areIntervalsOverlapping/index.js","webpack:///./node_modules/date-fns/esm/closestIndexTo/index.js","webpack:///./node_modules/date-fns/esm/closestTo/index.js","webpack:///./node_modules/date-fns/esm/compareAsc/index.js","webpack:///./node_modules/date-fns/esm/compareDesc/index.js","webpack:///./node_modules/date-fns/esm/differenceInCalendarDays/index.js","webpack:///./node_modules/date-fns/esm/differenceInCalendarISOWeekYears/index.js","webpack:///./node_modules/date-fns/esm/differenceInCalendarISOWeeks/index.js","webpack:///./node_modules/date-fns/esm/differenceInCalendarMonths/index.js","webpack:///./node_modules/date-fns/esm/differenceInCalendarQuarters/index.js","webpack:///./node_modules/date-fns/esm/differenceInCalendarWeeks/index.js","webpack:///./node_modules/date-fns/esm/differenceInCalendarYears/index.js","webpack:///./node_modules/date-fns/esm/differenceInDays/index.js","webpack:///./node_modules/date-fns/esm/differenceInHours/index.js","webpack:///./node_modules/date-fns/esm/differenceInISOWeekYears/index.js","webpack:///./node_modules/date-fns/esm/differenceInMilliseconds/index.js","webpack:///./node_modules/date-fns/esm/differenceInMinutes/index.js","webpack:///./node_modules/date-fns/esm/differenceInMonths/index.js","webpack:///./node_modules/date-fns/esm/differenceInQuarters/index.js","webpack:///./node_modules/date-fns/esm/differenceInSeconds/index.js","webpack:///./node_modules/date-fns/esm/differenceInWeeks/index.js","webpack:///./node_modules/date-fns/esm/differenceInYears/index.js","webpack:///./node_modules/date-fns/esm/eachDayOfInterval/index.js","webpack:///./node_modules/date-fns/esm/eachWeekOfInterval/index.js","webpack:///./node_modules/date-fns/esm/eachWeekendOfInterval/index.js","webpack:///./node_modules/date-fns/esm/eachWeekendOfMonth/index.js","webpack:///./node_modules/date-fns/esm/eachWeekendOfYear/index.js","webpack:///./node_modules/date-fns/esm/endOfDay/index.js","webpack:///./node_modules/date-fns/esm/endOfDecade/index.js","webpack:///./node_modules/date-fns/esm/endOfHour/index.js","webpack:///./node_modules/date-fns/esm/endOfISOWeek/index.js","webpack:///./node_modules/date-fns/esm/endOfISOWeekYear/index.js","webpack:///./node_modules/date-fns/esm/endOfMinute/index.js","webpack:///./node_modules/date-fns/esm/endOfMonth/index.js","webpack:///./node_modules/date-fns/esm/endOfQuarter/index.js","webpack:///./node_modules/date-fns/esm/endOfSecond/index.js","webpack:///./node_modules/date-fns/esm/endOfWeek/index.js","webpack:///./node_modules/date-fns/esm/endOfYear/index.js","webpack:///./node_modules/date-fns/esm/format/index.js","webpack:///./node_modules/date-fns/esm/formatDistance/index.js","webpack:///./node_modules/date-fns/esm/formatDistanceStrict/index.js","webpack:///./node_modules/date-fns/esm/formatRelative/index.js","webpack:///./node_modules/date-fns/esm/fromUnixTime/index.js","webpack:///./node_modules/date-fns/esm/getDate/index.js","webpack:///./node_modules/date-fns/esm/getDay/index.js","webpack:///./node_modules/date-fns/esm/getDayOfYear/index.js","webpack:///./node_modules/date-fns/esm/getDaysInMonth/index.js","webpack:///./node_modules/date-fns/esm/getDaysInYear/index.js","webpack:///./node_modules/date-fns/esm/getDecade/index.js","webpack:///./node_modules/date-fns/esm/getHours/index.js","webpack:///./node_modules/date-fns/esm/getISODay/index.js","webpack:///./node_modules/date-fns/esm/getISOWeek/index.js","webpack:///./node_modules/date-fns/esm/getISOWeekYear/index.js","webpack:///./node_modules/date-fns/esm/getISOWeeksInYear/index.js","webpack:///./node_modules/date-fns/esm/getMilliseconds/index.js","webpack:///./node_modules/date-fns/esm/getMinutes/index.js","webpack:///./node_modules/date-fns/esm/getMonth/index.js","webpack:///./node_modules/date-fns/esm/getOverlappingDaysInIntervals/index.js","webpack:///./node_modules/date-fns/esm/getQuarter/index.js","webpack:///./node_modules/date-fns/esm/getSeconds/index.js","webpack:///./node_modules/date-fns/esm/getTime/index.js","webpack:///./node_modules/date-fns/esm/getUnixTime/index.js","webpack:///./node_modules/date-fns/esm/getWeek/index.js","webpack:///./node_modules/date-fns/esm/getWeekOfMonth/index.js","webpack:///./node_modules/date-fns/esm/getWeekYear/index.js","webpack:///./node_modules/date-fns/esm/getWeeksInMonth/index.js","webpack:///./node_modules/date-fns/esm/getYear/index.js","webpack:///./node_modules/date-fns/esm/index.js","webpack:///./node_modules/date-fns/esm/isAfter/index.js","webpack:///./node_modules/date-fns/esm/isBefore/index.js","webpack:///./node_modules/date-fns/esm/isDate/index.js","webpack:///./node_modules/date-fns/esm/isEqual/index.js","webpack:///./node_modules/date-fns/esm/isFirstDayOfMonth/index.js","webpack:///./node_modules/date-fns/esm/isFriday/index.js","webpack:///./node_modules/date-fns/esm/isLastDayOfMonth/index.js","webpack:///./node_modules/date-fns/esm/isLeapYear/index.js","webpack:///./node_modules/date-fns/esm/isMonday/index.js","webpack:///./node_modules/date-fns/esm/isSameDay/index.js","webpack:///./node_modules/date-fns/esm/isSameHour/index.js","webpack:///./node_modules/date-fns/esm/isSameISOWeek/index.js","webpack:///./node_modules/date-fns/esm/isSameISOWeekYear/index.js","webpack:///./node_modules/date-fns/esm/isSameMinute/index.js","webpack:///./node_modules/date-fns/esm/isSameMonth/index.js","webpack:///./node_modules/date-fns/esm/isSameQuarter/index.js","webpack:///./node_modules/date-fns/esm/isSameSecond/index.js","webpack:///./node_modules/date-fns/esm/isSameWeek/index.js","webpack:///./node_modules/date-fns/esm/isSameYear/index.js","webpack:///./node_modules/date-fns/esm/isSaturday/index.js","webpack:///./node_modules/date-fns/esm/isSunday/index.js","webpack:///./node_modules/date-fns/esm/isThursday/index.js","webpack:///./node_modules/date-fns/esm/isTuesday/index.js","webpack:///./node_modules/date-fns/esm/isValid/index.js","webpack:///./node_modules/date-fns/esm/isWednesday/index.js","webpack:///./node_modules/date-fns/esm/isWeekend/index.js","webpack:///./node_modules/date-fns/esm/isWithinInterval/index.js","webpack:///./node_modules/date-fns/esm/lastDayOfDecade/index.js","webpack:///./node_modules/date-fns/esm/lastDayOfISOWeek/index.js","webpack:///./node_modules/date-fns/esm/lastDayOfISOWeekYear/index.js","webpack:///./node_modules/date-fns/esm/lastDayOfMonth/index.js","webpack:///./node_modules/date-fns/esm/lastDayOfQuarter/index.js","webpack:///./node_modules/date-fns/esm/lastDayOfWeek/index.js","webpack:///./node_modules/date-fns/esm/lastDayOfYear/index.js","webpack:///./node_modules/date-fns/esm/lightFormat/index.js","webpack:///./node_modules/date-fns/esm/locale/_lib/buildFormatLongFn/index.js","webpack:///./node_modules/date-fns/esm/locale/_lib/buildLocalizeFn/index.js","webpack:///./node_modules/date-fns/esm/locale/_lib/buildMatchFn/index.js","webpack:///./node_modules/date-fns/esm/locale/_lib/buildMatchPatternFn/index.js","webpack:///./node_modules/date-fns/esm/locale/en-US/_lib/formatDistance/index.js","webpack:///./node_modules/date-fns/esm/locale/en-US/_lib/formatLong/index.js","webpack:///./node_modules/date-fns/esm/locale/en-US/_lib/formatRelative/index.js","webpack:///./node_modules/date-fns/esm/locale/en-US/_lib/localize/index.js","webpack:///./node_modules/date-fns/esm/locale/en-US/_lib/match/index.js","webpack:///./node_modules/date-fns/esm/locale/en-US/index.js","webpack:///./node_modules/date-fns/esm/max/index.js","webpack:///./node_modules/date-fns/esm/min/index.js","webpack:///./node_modules/date-fns/esm/parse/_lib/parsers/index.js","webpack:///./node_modules/date-fns/esm/parse/index.js","webpack:///./node_modules/date-fns/esm/parseISO/index.js","webpack:///./node_modules/date-fns/esm/roundToNearestMinutes/index.js","webpack:///./node_modules/date-fns/esm/setDate/index.js","webpack:///./node_modules/date-fns/esm/setDay/index.js","webpack:///./node_modules/date-fns/esm/setDayOfYear/index.js","webpack:///./node_modules/date-fns/esm/setHours/index.js","webpack:///./node_modules/date-fns/esm/setISODay/index.js","webpack:///./node_modules/date-fns/esm/setISOWeek/index.js","webpack:///./node_modules/date-fns/esm/setISOWeekYear/index.js","webpack:///./node_modules/date-fns/esm/setMilliseconds/index.js","webpack:///./node_modules/date-fns/esm/setMinutes/index.js","webpack:///./node_modules/date-fns/esm/setMonth/index.js","webpack:///./node_modules/date-fns/esm/setQuarter/index.js","webpack:///./node_modules/date-fns/esm/setSeconds/index.js","webpack:///./node_modules/date-fns/esm/setWeek/index.js","webpack:///./node_modules/date-fns/esm/setWeekYear/index.js","webpack:///./node_modules/date-fns/esm/setYear/index.js","webpack:///./node_modules/date-fns/esm/startOfDay/index.js","webpack:///./node_modules/date-fns/esm/startOfDecade/index.js","webpack:///./node_modules/date-fns/esm/startOfHour/index.js","webpack:///./node_modules/date-fns/esm/startOfISOWeek/index.js","webpack:///./node_modules/date-fns/esm/startOfISOWeekYear/index.js","webpack:///./node_modules/date-fns/esm/startOfMinute/index.js","webpack:///./node_modules/date-fns/esm/startOfMonth/index.js","webpack:///./node_modules/date-fns/esm/startOfQuarter/index.js","webpack:///./node_modules/date-fns/esm/startOfSecond/index.js","webpack:///./node_modules/date-fns/esm/startOfWeek/index.js","webpack:///./node_modules/date-fns/esm/startOfWeekYear/index.js","webpack:///./node_modules/date-fns/esm/startOfYear/index.js","webpack:///./node_modules/date-fns/esm/subDays/index.js","webpack:///./node_modules/date-fns/esm/subHours/index.js","webpack:///./node_modules/date-fns/esm/subISOWeekYears/index.js","webpack:///./node_modules/date-fns/esm/subMilliseconds/index.js","webpack:///./node_modules/date-fns/esm/subMinutes/index.js","webpack:///./node_modules/date-fns/esm/subMonths/index.js","webpack:///./node_modules/date-fns/esm/subQuarters/index.js","webpack:///./node_modules/date-fns/esm/subSeconds/index.js","webpack:///./node_modules/date-fns/esm/subWeeks/index.js","webpack:///./node_modules/date-fns/esm/subYears/index.js","webpack:///./node_modules/date-fns/esm/toDate/index.js","webpack:///./node_modules/deep-equal/index.js","webpack:///./node_modules/deep-equal/node_modules/isarray/index.js","webpack:///./node_modules/define-properties/index.js","webpack:///./node_modules/es-abstract/helpers/getOwnPropertyDescriptor.js","webpack:///./node_modules/es-get-iterator/index.js","webpack:///./node_modules/es-get-iterator/node_modules/isarray/index.js","webpack:///./node_modules/foreach/index.js","webpack:///./node_modules/function-bind/implementation.js","webpack:///./node_modules/function-bind/index.js","webpack:///./node_modules/get-intrinsic/index.js","webpack:///./node_modules/google-protobuf/google-protobuf.js","webpack:///./node_modules/has-bigints/index.js","webpack:///./node_modules/has-symbols/index.js","webpack:///./node_modules/has-symbols/shams.js","webpack:///./node_modules/has-tostringtag/shams.js","webpack:///./node_modules/has/src/index.js","webpack:///./node_modules/is-arguments/index.js","webpack:///./node_modules/is-bigint/index.js","webpack:///./node_modules/is-boolean-object/index.js","webpack:///./node_modules/is-buffer/index.js","webpack:///./node_modules/is-date-object/index.js","webpack:///./node_modules/is-map/index.js","webpack:///./node_modules/is-number-object/index.js","webpack:///./node_modules/is-regex/index.js","webpack:///./node_modules/is-set/index.js","webpack:///./node_modules/is-string/index.js","webpack:///./node_modules/is-symbol/index.js","webpack:///./node_modules/is-typed-array/index.js","webpack:///./node_modules/is-weakmap/index.js","webpack:///./node_modules/is-weakset/index.js","webpack:///./node_modules/locale-currency/index.js","webpack:///./node_modules/locale-currency/map.js","webpack:///./node_modules/lru-cache/index.js","webpack:///./node_modules/lru-cache/node_modules/yallist/iterator.js","webpack:///./node_modules/lru-cache/node_modules/yallist/yallist.js","webpack:///./node_modules/md5/md5.js","webpack:///./node_modules/memoize-one/dist/memoize-one.esm.js","webpack:///./node_modules/murmurhash/murmurhash.js","webpack:///./node_modules/object-assign/index.js","webpack:///./node_modules/object-inspect/index.js","webpack:///./node_modules/object-inspect/util.inspect.js","webpack:///./node_modules/object-is/implementation.js","webpack:///./node_modules/object-is/index.js","webpack:///./node_modules/object-is/polyfill.js","webpack:///./node_modules/object-is/shim.js","webpack:///./node_modules/object-keys/implementation.js","webpack:///./node_modules/object-keys/index.js","webpack:///./node_modules/object-keys/isArguments.js","webpack:///./node_modules/object.assign/implementation.js","webpack:///./node_modules/object.assign/index.js","webpack:///./node_modules/object.assign/polyfill.js","webpack:///./node_modules/object.assign/shim.js","webpack:///./node_modules/regexp.prototype.flags/implementation.js","webpack:///./node_modules/regexp.prototype.flags/index.js","webpack:///./node_modules/regexp.prototype.flags/polyfill.js","webpack:///./node_modules/regexp.prototype.flags/shim.js","webpack:///./node_modules/side-channel/index.js","webpack:///./node_modules/slash/index.js","webpack:///./node_modules/uuid/index.js","webpack:///./node_modules/uuid/lib/bytesToUuid.js","webpack:///./node_modules/uuid/lib/rng.js","webpack:///./node_modules/uuid/v1.js","webpack:///./node_modules/uuid/v4.js","webpack:///./node_modules/which-boxed-primitive/index.js","webpack:///./node_modules/which-collection/index.js","webpack:///./node_modules/which-typed-array/index.js","webpack:///./packages/api/app/query.js","webpack:///./packages/api/injected.js","webpack:///./packages/api/methods.js","webpack:///./packages/import-ynab4/importer.js","webpack:///./packages/import-ynab4/node_modules/@actual-app/api/utils.js","webpack:///./packages/import-ynab5/importer.js","webpack:///./packages/import-ynab5/node_modules/@actual-app/api/utils.js","webpack:///./packages/loot-core/migrations/1632571489012_remove_cache.js","webpack:///./packages/loot-core/node_modules/adm-zip/adm-zip.js","webpack:///./packages/loot-core/node_modules/adm-zip/headers/entryHeader.js","webpack:///./packages/loot-core/node_modules/adm-zip/headers/index.js","webpack:///./packages/loot-core/node_modules/adm-zip/headers/mainHeader.js","webpack:///./packages/loot-core/node_modules/adm-zip/methods/deflater.js","webpack:///./packages/loot-core/node_modules/adm-zip/methods/index.js","webpack:///./packages/loot-core/node_modules/adm-zip/methods/inflater.js","webpack:///./packages/loot-core/node_modules/adm-zip/util/constants.js","webpack:///./packages/loot-core/node_modules/adm-zip/util/errors.js","webpack:///./packages/loot-core/node_modules/adm-zip/util/fattr.js","webpack:///./packages/loot-core/node_modules/adm-zip/util/fileSystem.js","webpack:///./packages/loot-core/node_modules/adm-zip/util/index.js","webpack:///./packages/loot-core/node_modules/adm-zip/util/utils.js","webpack:///./packages/loot-core/node_modules/adm-zip/zipEntry.js","webpack:///./packages/loot-core/node_modules/adm-zip/zipFile.js","webpack:///../src/index.ts","webpack:///./packages/loot-core/src/mocks/budget.js","webpack:///./packages/loot-core/src/platform/exceptions/index.electron.js","webpack:///./packages/loot-core/src/platform/server/asyncStorage/index.electron.js","webpack:///./packages/loot-core/src/platform/server/connection/index.api.js","webpack:///./packages/loot-core/src/platform/server/fetch/index.electron.js","webpack:///./packages/loot-core/src/platform/server/fs/index.electron.js","webpack:///./packages/loot-core/src/platform/server/log/index.api.js","webpack:///./packages/loot-core/src/platform/server/sqlite/index.electron.js","webpack:///./packages/loot-core/src/platform/uuid/index.electron.js","webpack:///./packages/loot-core/src/server/accounts/export-to-csv.js","webpack:///./packages/loot-core/src/server/accounts/link.js","webpack:///./packages/loot-core/src/server/accounts/parse-file.js","webpack:///./packages/loot-core/src/server/accounts/payees.js","webpack:///./packages/loot-core/src/server/accounts/qif2json.js","webpack:///./packages/loot-core/src/server/accounts/rules.js","webpack:///./packages/loot-core/src/server/accounts/sync.js","webpack:///./packages/loot-core/src/server/accounts/title/index.js","webpack:///./packages/loot-core/src/server/accounts/title/lower-case.js","webpack:///./packages/loot-core/src/server/accounts/title/specials.js","webpack:///./packages/loot-core/src/server/accounts/transaction-rules.js","webpack:///./packages/loot-core/src/server/accounts/transactions.js","webpack:///./packages/loot-core/src/server/accounts/transfer.js","webpack:///./packages/loot-core/src/server/api-models.js","webpack:///./packages/loot-core/src/server/api.js","webpack:///./packages/loot-core/src/server/app.js","webpack:///./packages/loot-core/src/server/aql/compiler.js","webpack:///./packages/loot-core/src/server/aql/exec.js","webpack:///./packages/loot-core/src/server/aql/schema-helpers.js","webpack:///./packages/loot-core/src/server/aql/schema/executors.js","webpack:///./packages/loot-core/src/server/aql/schema/index.js","webpack:///./packages/loot-core/src/server/aql/schema/run-query.js","webpack:///./packages/loot-core/src/server/aql/views.js","webpack:///./packages/loot-core/src/server/backups.js","webpack:///./packages/loot-core/src/server/budget/actions.js","webpack:///./packages/loot-core/src/server/budget/app.js","webpack:///./packages/loot-core/src/server/budget/base.js","webpack:///./packages/loot-core/src/server/budget/report.js","webpack:///./packages/loot-core/src/server/budget/rollover.js","webpack:///./packages/loot-core/src/server/budget/util.js","webpack:///./packages/loot-core/src/server/cloud-storage.js","webpack:///./packages/loot-core/src/server/db/index.js","webpack:///./packages/loot-core/src/server/db/mappings.js","webpack:///./packages/loot-core/src/server/db/sort.js","webpack:///./packages/loot-core/src/server/db/util.js","webpack:///./packages/loot-core/src/server/encryption-internals.js","webpack:///./packages/loot-core/src/server/encryption.js","webpack:///./packages/loot-core/src/server/errors.js","webpack:///./packages/loot-core/src/server/main-app.js","webpack:///./packages/loot-core/src/server/main.js","webpack:///./packages/loot-core/src/server/merkle.js","webpack:///./packages/loot-core/src/server/migrate/migrations.js","webpack:///./packages/loot-core/src/server/models.js","webpack:///./packages/loot-core/src/server/mutators.js","webpack:///./packages/loot-core/src/server/notes/app.js","webpack:///./packages/loot-core/src/server/perf.js","webpack:///./packages/loot-core/src/server/platform.js","webpack:///./packages/loot-core/src/server/polyfills.js","webpack:///./packages/loot-core/src/server/post.js","webpack:///./packages/loot-core/src/server/prefs.js","webpack:///./packages/loot-core/src/server/schedules/app.js","webpack:///./packages/loot-core/src/server/schedules/find-schedules.js","webpack:///./packages/loot-core/src/server/server-config.js","webpack:///./packages/loot-core/src/server/sheet.js","webpack:///./packages/loot-core/src/server/spreadsheet/globals.js","webpack:///./packages/loot-core/src/server/spreadsheet/graph-data-structure.js","webpack:///./packages/loot-core/src/server/spreadsheet/spreadsheet.js","webpack:///./packages/loot-core/src/server/spreadsheet/util.js","webpack:///./packages/loot-core/src/server/sync/encoder.js","webpack:///./packages/loot-core/src/server/sync/index.js","webpack:///./packages/loot-core/src/server/sync/make-test-message.js","webpack:///./packages/loot-core/src/server/sync/migrate.js","webpack:///./packages/loot-core/src/server/sync/proto/sync_pb.js","webpack:///./packages/loot-core/src/server/sync/repair.js","webpack:///./packages/loot-core/src/server/sync/reset.js","webpack:///./packages/loot-core/src/server/timestamp.js","webpack:///./packages/loot-core/src/server/tools/app.js","webpack:///./packages/loot-core/src/server/tracking/events.js","webpack:///./packages/loot-core/src/server/undo.js","webpack:///./packages/loot-core/src/server/update.js","webpack:///./packages/loot-core/src/server/util/budget-name.js","webpack:///./packages/loot-core/src/server/util/rschedule.js","webpack:///./packages/loot-core/src/shared/accounts.js","webpack:///./packages/loot-core/src/shared/async.js","webpack:///./packages/loot-core/src/shared/months.js","webpack:///./packages/loot-core/src/shared/query.js","webpack:///./packages/loot-core/src/shared/rules.js","webpack:///./packages/loot-core/src/shared/schedules.js","webpack:///./packages/loot-core/src/shared/transactions.js","webpack:///./packages/loot-core/src/shared/util.js","webpack:///external \"better-sqlite3\"","webpack:///external \"crypto\"","webpack:///external \"fs\"","webpack:///external \"node-fetch\"","webpack:///external \"node-libofx\"","webpack:///external \"path\"","webpack:///external \"stream\"","webpack:///external \"string_decoder\"","webpack:///external \"util\"","webpack:///external \"zlib\""],"names":["OccurrenceGenerator","constructor","args","timezone","undefined","maxDuration","firstDate","_firstDate","start","_run","next","value","dateAdapter","fromDateTime","lastDate","_lastDate","isInfinite","end","reverse","pipe","operators","reduce","prev","curr","base","occurrences","OccurrenceIterator","normalizeOccurrencesArgs","collections","CollectionIterator","normalizeCollectionsArgs","occursBetween","startInput","endInput","options","normalizeDateInput","hasDuration","excludeEnds","getMaxDuration","iterator","subtract","day","isBefore","isEqual","occursOn","rawArgs","normalizeOccursOnArgs","weekday","before","ArgumentError","after","add","date","get","skipToDate","getDifferenceBetweenWeekdays","granularity","isAfter","occursAfter","adapter","excludeStart","occursBefore","isAfterOrEqual","DateAdapterBase$1","Object","assign","excludeDates","map","normalizeRunArgs","dateInputToDateTime","normalizeDateInputToAdapter","dateInputToDateAdapter","normalizeRunOutput","normalizeDateTimeTimezone$1","method","Number","isInteger","iterable","Symbol","occurrenceIterator","toArray","take","Array","from","InfiniteLoopError","yieldArgs","normalizeDateOutput","Collection","dates","periodStart","periodEnd","weekStart","Error","getPeriod","startDate","collectionIterator","collection","push","period","index","isBeforeOrEqual","skipEmptyPeriods","incrementPeriod","endGranularity","Operator","streams","config","stream","set","calculateIsInfinite","calculateHasDuration","IterableWrapper","generator","runArgs","done","processYieldArgs","length","every","s","streamsComparer","a","b","streamsReverseComparer","selectNextIterable","sort","filter","shift","selectLastIterable","pop","AddOperator","_","wrappedStreams","input","some","streamsDuration","Calendar","schedules","data","isArray","schedule","prop","count","Dates","adapters","datetimes","duration","toDateTime","remove","slice","findIndex","valueOf","splice","keepLocalTime","json","toJSON","fromJSON","fn","dateTimeSortComparer","dateCache","InvalidDateAdapterError","dateAdapterConfig","DateAdapterBase","_date","generators","name","isDate","_object","unimplementedError","fromDate","_options","_json","_datetime","toISOString","DateTime","hasTimezoneSupport","DateAdapter","WEEKDAYS","MILLISECONDS_IN_SECOND","MILLISECONDS_IN_MINUTE","MILLISECONDS_IN_HOUR","MILLISECONDS_IN_DAY","MILLISECONDS_IN_WEEK","InvalidDateTimeError","Date","assertIsValid","UTC","year","month","hour","minute","second","millisecond","fromDateAdapter","_end","object","assertSameTimeZone","isOccurring","amount","unit","unshift","forkDateTime","addUTCYears","addUTCMonths","addUTCWeeks","addUTCDays","addUTCHours","addUTCMinutes","addUTCSeconds","addUTCMilliseconds","subUTCYears","subUTCMonths","subUTCWeeks","subUTCDays","subUTCHours","subUTCMinutes","subUTCSeconds","subUTCMilliseconds","getUTCFullYear","getUTCMonth","getUTCYearDay","getUTCDay","getUTCDate","getUTCHours","getUTCMinutes","getUTCSeconds","getUTCMilliseconds","setUTCFullYear","monthLength","setUTCDate","setUTCMonth","setUTCHours","setUTCMinutes","setUTCSeconds","setUTCMilliseconds","opt","setDateToStartOfWeek","setDateToEndOfWeek","isNaN","x","y","JSON","stringify","wkst","orderedWeekdays","indexOf","wkdays","shiftArray","array","block","getDaysInFebruary","isLeapYear","now","diff","Math","floor","toInteger","NaN","int","ceil","addMilliseconds","dirtyDate","dirtyAmount","arguments","TypeError","timestamp","desiredMonth","dateWithDesiredMonth","daysInMonth","min","days","getTime","normalizeDateTimeTimezone","RuleBase","recurrenceRules","cloneRuleOptions","normOptions","normalizeRuleOptions","RecurrenceRulesIterator","recurrenceRulesReducer","Rule","tzoptions","DateTime$1","ScheduleBase","occurrenceStream","SubtractOperator","inclusion","exclusion","cycleStreams","iterateExclusion","unique","UniqueOperator","lastValue","Schedule","rrules","exrules","arg","ruleArgs","rule","rdates","exdates","intersection","IntersectionOperator","maxFailedIterations","defaultMaxFailedIterations","hasEndDate","cycleStreams$1","iteration","maxIterations","lastValidDate","last","forEach","DurationIterableWrapper","workingValue","MergeDurationOperatorError","mergeDuration","MergeDurationOperator","reverseRun","forwardRun","checkFromStart","checkFromEnd","SplitDurationOperatorError","splitDuration","SplitDurationOperator","splitFn","datesBucket","splitDate","selectedDate","bucketIndex","selectedBucketIndex","dateIndex","selectedDateIndex","bucket","dateShouldComeNext","datePastEnd","datePastSkipToDate","valid","uniqDateTimes","Map","values","result","abs","getDaysInYear","numberSortComparer","freqToGranularity","freq","cloneJSON","parse","RuleOptionError","normalizeDefaultOptions","recurrenceModules","startOptions","mod","normalizeOptions","keys","key","obj","RecurrenceRuleError","ValidDateTime","InvalidDateTime","rules","iterate","iterateWithReverseCount","iterateWithCount","normalizeDateTimeArgs","startingDate","nextDate","runRules","isDatePastEnd","run","RecurrenceRule","processor","FrequencyRule","initDate","intervalUnit","frequency","firstIntervalStartDate","normalizedStartDate","intervalStartDate","intervalEndDate","normalizedEndDate","skipToInterval","validateDate","dateIsWithinInterval","setToCurrentInterval","intervalDifference","intervalDifferenceBetweenDates","first","interval","direction","difference","intervalDuration","months","RevFrequencyRule","FREQUENCIES","FrequencyRuleModule","byMillisecondOfSecond","norm","includes","deps","ruleOptionFilled","option","freqCache","WeakMap","RecurrenceRuleBase","has","RevRecurrenceRuleBase","RevByTimeOfUnitRule","currentTime","time","baseGranularity","RevByMillisecondOfSecondRule","ByTimeOfUnitRule","ByMillisecondOfSecondRule","ByMillisecondOfSecondRuleModule","num","RevBySecondOfMinuteRule","bySecondOfMinute","BySecondOfMinuteRule","BySecondOfMinuteRuleModule","RevByMinuteOfHourRule","byMinuteOfHour","ByMinuteOfHourRule","ByMinuteOfHourRuleModule","RevByHourOfDayRule","byHourOfDay","ByHourOfDayRule","ByHourOfDayRuleModule","getNextWeekday","getNthWeekdayOfMonth","nth","ByDayOfMonthRule","normalizedByDayOfMonth","normalizeByDayOfMonth","byDayOfMonth","byDayOfWeek","currentDay","nextMonth","lengthOfMonth","filteredByDayOfMonth","entry","nthWeekdayOfMonth","Set","RevByDayOfMonthRule","ByDayOfMonthRuleModule","byDayOfYear","getNthWeekdayOfYear","getPreviousWeekday","RevByDayOfWeekRule","byMonthOfYear","expandYearly","expandMonthly","expand","getPrevWeekdaysOfYear","getPrevWeekdaysOfMonth","normalizedNthWeekdaysOfYear","normalizedNextWeekdays","normalizedNthWeekdaysOfMonth","ByDayOfWeekRule","getNextWeekdaysOfYear","getNextWeekdaysOfMonth","ByDayOfWeekRuleModule","invalidWeeday","find","RevByMonthOfYearRule","currentMonth","ByMonthOfYearRule","ByMonthOfYearRuleModule","ICAL_RULES","prototype","serialize","opts","type","nested","serializeDataToJSON","ParseJSONError","registerJSONSerializerFn","SerializeJSONError","JSON_FN_MAP","gen","StandardDateAdapter","toString","call","datetime","getFullYear","getMonth","getDate","getHours","getMinutes","getSeconds","getMilliseconds","root","lib","version","settings","currency","symbol","format","decimal","thousand","precision","grouping","number","nativeMap","nativeIsArray","isString","charCodeAt","substr","isObject","defaults","defs","hasOwnProperty","context","results","i","j","checkPrecision","val","round","checkCurrencyFormat","match","pos","neg","replace","zero","unformat","regex","RegExp","unformatted","parseFloat","toFixed","exponentialForm","rounded","finalResult","formatNumber","usePrecision","negative","parseInt","split","formatMoney","formats","useFormat","formatColumn","list","padAfterSymbol","maxLength","formatted","fVal","join","module","exports","accounting","Utils","require","pth","ZipEntry","ZipFile","get_Bool","def","get_Str","defaultOptions","noSort","readEntries","Constants","NONE","fs","inBuffer","create","Uint8Array","Buffer","isBuffer","BUFFER","filetools","existsSync","FILE","filename","readFileSync","Errors","INVALID_FILENAME","_zip","canonical","sanitize","getEntry","item","entryName","header","fixPath","zipPath","posix","normalize","sep","readFile","pass","getData","readFileAsync","callback","getDataAsync","readAsText","encoding","readAsTextAsync","err","deleteFile","deleteEntry","addZipComment","comment","getZipComment","addZipEntryComment","getZipEntryComment","updateFile","content","setData","addLocalFile","localPath","zipName","p","_attr","statSync","addFile","FILE_NOT_FOUND","addLocalFolder","rx","test","items","findFiles","self","filepath","relative","stats","isFile","alloc","addLocalFolderAsync","open","code","stat","er0","er1","addLocalFolderPromise","props","Promise","resolve","reject","attr","update","isStat","Stats","mtime","fileattr","isDirectory","isWin","unix","mode","setEntry","getEntries","entries","getEntryCount","extractEntryTo","targetPath","maintainEntryPath","overwrite","keepOriginalPermission","outFileName","NO_ENTRY","target","basename","children","getEntryChildren","child","CANT_EXTRACT_FILE","childName","fileAttr","writeFileTo","CANT_OVERRIDE","extractAllTo","NO_ZIP","makeDir","utimesSync","extractAllToAsync","getPath","getError","msg","file","dirEntries","fileEntries","e","dirPath","dirAttr","chmodSync","er","size","filePath","err_1","writeFileToAsync","succ","utimes","err_2","delete","writeZip","targetFileName","zipData","compressToBuffer","ok","writeZipPromise","perm","toBufferPromise","then","ret","toAsyncBuffer","toBuffer","onSuccess","onFail","onItemStart","onItemEnd","_verMade","_version","_flags","_method","_time","_crc","_compressedSize","_size","_fnameLen","_extraLen","_comLen","_diskStart","_inattr","_offset","FLG_EFS","_dataHeader","setTime","made","flags","STORED","DEFLATED","crc","max","compressedSize","fileNameLength","extraLength","commentLength","diskNumStart","inAttr","offset","encripted","entryHeaderSize","CENHDR","realDataOffset","LOCHDR","fnameLen","extraLen","dataHeader","loadDataHeaderFromBinary","readUInt32LE","LOCSIG","INVALID_LOC","readUInt16LE","LOCVER","LOCFLG","LOCHOW","LOCTIM","LOCCRC","LOCSIZ","LOCLEN","LOCNAM","LOCEXT","loadFromBinary","CENSIG","INVALID_CEN","CENVEM","CENVER","CENFLG","CENHOW","CENTIM","CENCRC","CENSIZ","CENLEN","CENNAM","CENEXT","CENCOM","CENDSK","CENATT","CENATX","CENOFF","dataHeaderToBinary","writeUInt32LE","writeUInt16LE","entryHeaderToBinary","fill","bytes","nr","methodToString","toUpperCase","EntryHeader","MainHeader","_volumeEntries","_totalEntries","_commentLength","diskEntries","totalEntries","mainHeaderSize","ENDHDR","ENDSIG","ZIP64HDR","ZIP64SIG","INVALID_END","ENDSUB","ENDTOT","ENDSIZ","ENDOFF","ENDCOM","readBigUInt64LE","ZIP64SUB","ZIP64TOT","ZIP64SIZ","ZIP64OFF","toBinary","len","offs","inbuf","zlib","chunkSize","deflate","deflateRawSync","deflateAsync","tmp","createDeflateRaw","parts","total","on","buf","written","part","copy","Deflater","Inflater","ZipCrypto","inflate","inflateRawSync","inflateAsync","createInflateRaw","randomFillSync","crctable","Uint32Array","t","uMul","imul","crc32update","pCrc32","bval","genSalt","node","salt","random","Initkeys","pw","updateKeys","byteValue","k","make_decrypter","pwd","c","make_encrypter","decrypt","decrypter","_salter","encrypt","oldlike","encrypter","EXTSIG","EXTHDR","EXTCRC","EXTSIZ","EXTLEN","END64HDR","END64SIG","END64START","END64OFF","END64NUMDISKS","ZIP64LEAD","ZIP64SIZE","ZIP64VEM","ZIP64VER","ZIP64DSK","ZIP64DSKDIR","ZIP64SIZB","ZIP64EXTRA","SHRUNK","REDUCED1","REDUCED2","REDUCED3","REDUCED4","IMPLODED","ENHANCED_DEFLATED","PKWARE","BZIP2","LZMA","IBM_TERSE","IBM_LZ77","AES_ENCRYPT","FLG_ENC","FLG_COMP1","FLG_COMP2","FLG_DESC","FLG_ENH","FLG_PATCH","FLG_STR","FLG_MSK","EF_ID","EF_SIZE","ID_ZIP64","ID_AVINFO","ID_PFS","ID_OS2","ID_NTFS","ID_OPENVMS","ID_UNIX","ID_FORK","ID_PATCH","ID_X509_PKCS7","ID_X509_CERTID_F","ID_X509_CERTID_C","ID_STRONGENC","ID_RECORD_MGT","ID_X509_PKCS7_RL","ID_IBM1","ID_IBM2","ID_POSZIP","EF_ZIP64_OR_32","EF_ZIP64_OR_16","EF_ZIP64_SUNCOMP","EF_ZIP64_SCOMP","EF_ZIP64_RHO","EF_ZIP64_DSN","NO_DATA","BAD_CRC","FILE_IN_THE_WAY","UNKNOWN_METHOD","AVAIL_DATA","INVALID_DISTANCE","TO_MANY_CODES","INVALID_REPEAT_LEN","INVALID_REPEAT_FIRST","INCOMPLETE_CODES","INVALID_DYN_DISTANCE","INVALID_CODES_LEN","INVALID_STORE_BLOCK","INVALID_BLOCK_TYPE","DIRECTORY_CONTENT_ERROR","NOT_IMPLEMENTED","INVALID_FORMAT","path","_path","_obj","newAttr","_stat","directory","readonly","hidden","executable","atime","console","warn","readOnly","decodeAttributes","encodeAttributes","isReadOnly","isHidden","isExecutable","mTime","aTime","process","versions","originalFs","FileAttr","fsystem","platform","is_Obj","crcTable","folder","mkdirSync","fpath","resolvedPath","dirname","fd","openSync","writeSync","closeSync","exists","exist","chmod","write","close","findSync","dir","pattern","recursive","files","readdirSync","concat","getAttributes","setAttributes","byte","crc32","genCRCTable","off","safeSuffix","prefix","l","buffer","swap64","Headers","Methods","_entryHeader","_entryName","_comment","_isDirectory","uncompressedData","_extra","getCompressedDataFromZip","crc32OK","decompress","async","compressedData","inflater","compress","deflater","deflated","readUInt64LE","parseExtra","signature","parseZip64ExtendedInformation","rawEntryName","lastChar","extra","n","getCompressedData","getCompressedDataAsync","changed","packHeader","addpos","entryList","entryTable","mainHeader","loadedEntries","readMainHeader","iterateEntries","readNow","endStart","endOffset","commentEnd","sortEntries","toLowerCase","localeCompare","_self","zipEntry","dataBlock","entryHeaders","totalSize","dindex","entryNameLen","postHeader","dataLength","entryHeader","outBuffer","mh","compress2Buffer","entryLists","possibleNames","g","globalThis","global","availableTypedArrays","out","GetIntrinsic","callBind","$indexOf","callBoundIntrinsic","allowMissing","intrinsic","bind","$apply","$call","$reflectApply","$gOPD","$defineProperty","$max","originalFunction","func","desc","configurable","applyBind","apply","charenc","utf8","stringToBytes","str","bin","unescape","encodeURIComponent","bytesToString","decodeURIComponent","escape","String","fromCharCode","base64map","crypt","rotl","rotr","endian","randomBytes","bytesToWords","words","wordsToBytes","bytesToHex","hex","hexToBytes","bytesToBase64","base64","triplet","charAt","base64ToBytes","imod4","pow","ResizeableBuffer","prepend","resize","clone","append","reset","Transform","tab","nl","np","cr","space","boms","Parser","readableObjectMode","__originalOptions","__normalizeOptions","underscore","CsvError","bom","fnCastField","cast","cast_date","fnFirstLineToHeaders","columns","normalizeColumnsArray","columns_duplicates_to_array","delimiter_json","delimiter","from_line","ignore_last_delimiters","info","max_record_size","objname","on_record","quote","raw","record_delimiter","rd","relax","relax_column_count","relax_column_count_less","relax_column_count_more","skip_empty_lines","skip_lines_with_empty_values","skip_lines_with_error","rtrim","ltrim","trim","to","to_line","comment_lines","empty_lines","invalid_field_length","lines","records","state","bomSkipped","bufBytesStart","castField","commenting","error","enabled","escaping","escapeIsQuote","compare","expectedRecordLength","field","firstLineToHeaders","needMoreDataSize","previousBuf","quoting","stop","rawBuffer","record","recordHasError","record_length","recordDelimiterMaxLength","v","trimChars","wasQuoting","wasRowDelimiter","_transform","__parse","_flush","nextBuf","bomLength","bufLen","__needMoreData","record_delimiterCount","__autoDiscoverRecordDelimiter","chr","__isEscape","__isQuote","nextChr","isNextChrTrimable","__isCharTrimable","isNextChrComment","__compareBytes","isNextChrDelimiter","__isDelimiter","isNextChrRecordDelimiter","__isRecordDelimiter","__error","__infoField","recordDelimiterLength","skipCommentLine","__resetField","__resetRecord","errField","__onField","errRecord","__onRecord","commentCount","delimiterLength","lappend","rappend","recordLength","isRecordEmpty","__firstLineToColumns","finalErr","disabled","__push","__infoRecord","headers","normalizedHeaders","trimRight","__cast","f","isColumns","__isFloat","sourceBuf","targetBuf","targetPos","firstByte","sourceLength","numOfCharLeft","requiredLength","loop1","del","rdLength","emit","__infoDataSet","column","argument","parser","read","setImmediate","message","contexts","captureStackTrace","normalizedColumns","err1","err2","bom_utf8","Stringifier","writableObjectMode","quoted","quoted_empty","quoted_match","isRegExp","quoted_string","eof","normalize_columns","bigint","boolean","string","chunk","chunk_string","chunkIsHeader","csvrecord","containsdelimiter","containsQuote","containsEscape","containsRecordDelimiter","quotedString","quotedMatch","shouldQuote","regexp","newcolumns","stringifier","chunks","charCodeOfDot","reEscapeChar","rePropName","reIsDeepProp","reIsPlainProp","getTag","isKey","isSymbol","stringToPath","expression","subString","castPath","toKey","INFINITY","StringDecoder","decoder","onData","localeCurrency","currencies","localeFormats","defaultCurrency","thousandsSeparator","decimalSeparator","symbolOnLeft","spaceBetweenAmountAndSymbol","decimalDigits","defaultLocaleFormat","formatMapping","locale","getCurrency","localeMatch","exec","language","region","localeFormat","findCurrency","isUndefined","currencyCode","__this","that","limit","thisLength","thatLength","matrix","prepare","this_i","that_j","cost","steps","similarity","addLeadingZeros","targetLength","sign","output","dirtyObject","property","cloneObject","dayPeriodEnum","am","pm","midnight","noon","morning","afternoon","evening","night","formatters","G","token","localize","era","width","signedYear","ordinalNumber","lightFormatters","Y","signedWeekYear","getUTCWeekYear","weekYear","twoDigitYear","R","isoWeekYear","getUTCISOWeekYear","u","Q","quarter","q","M","L","w","week","getUTCWeek","I","isoWeek","getUTCISOWeek","d","D","dayOfYear","getUTCDayOfYear","E","dayOfWeek","localDayOfWeek","weekStartsOn","isoDayOfWeek","hours","dayPeriodEnumValue","dayPeriod","B","h","H","K","m","S","numberOfDigits","milliseconds","fractionalSeconds","X","_localize","originalDate","_originalDate","timezoneOffset","getTimezoneOffset","formatTimezoneWithOptionalMinutes","formatTimezone","O","formatTimezoneShort","z","T","dirtyDelimiter","absOffset","minutes","dateLongFormatter","formatLong","timeLongFormatter","dateTimeLongFormatter","matchResult","datePattern","timePattern","dateTimeFormat","dateTime","longFormatters","P","getTimezoneOffsetInMilliseconds","baseTimezoneOffset","setSeconds","millisecondsPartOfTimezoneOffset","toDate","startOfYearTimestamp","startOfUTCISOWeek","startOfUTCISOWeekYear","fourthOfJanuaryOfNextYear","startOfNextYear","fourthOfJanuaryOfThisYear","startOfThisYear","startOfUTCWeek","startOfUTCWeekYear","dirtyOptions","localeFirstWeekContainsDate","firstWeekContainsDate","defaultFirstWeekContainsDate","RangeError","firstWeekOfNextYear","firstWeekOfThisYear","protectedTokens","isProtectedToken","throwProtectedError","setUTCDay","dirtyDay","localeWeekStartsOn","defaultWeekStartsOn","remainder","dayIndex","setUTCISODay","setUTCISOWeek","dirtyISOWeek","setUTCWeek","dirtyWeek","fourthOfJanuary","firstWeek","dirtyNumber","addDays","setDate","addHours","addISOWeekYears","setISOWeekYear","getISOWeekYear","addMinutes","addMonths","setFullYear","setHours","getDaysInMonth","setMonth","addQuarters","addSeconds","addWeeks","addYears","areIntervalsOverlapping","dirtyIntervalLeft","dirtyIntervalRight","intervalLeft","intervalRight","leftStartTime","leftEndTime","rightStartTime","rightEndTime","closestIndexTo","dirtyDateToCompare","dirtyDatesArray","dateToCompare","timeToCompare","datesArray","minDistance","currentDate","distance","closestTo","compareAsc","dirtyDateLeft","dirtyDateRight","dateLeft","dateRight","compareDesc","differenceInCalendarDays","startOfDayLeft","startOfDay","startOfDayRight","timestampLeft","timestampRight","differenceInCalendarISOWeekYears","differenceInCalendarISOWeeks","startOfISOWeekLeft","startOfISOWeek","startOfISOWeekRight","differenceInCalendarMonths","yearDiff","monthDiff","differenceInCalendarQuarters","quarterDiff","getQuarter","differenceInCalendarWeeks","startOfWeekLeft","startOfWeek","startOfWeekRight","differenceInCalendarYears","differenceInDays","isLastDayNotFull","differenceInHours","differenceInMilliseconds","differenceInISOWeekYears","subISOWeekYears","isLastISOWeekYearNotFull","differenceInMinutes","differenceInMonths","isLastMonthNotFull","differenceInQuarters","differenceInSeconds","differenceInWeeks","differenceInYears","isLastYearNotFull","eachDayOfInterval","dirtyInterval","endDate","endTime","step","eachWeekOfInterval","startDateWeek","endDateWeek","weeks","currentWeek","eachWeekendOfInterval","dateInterval","weekends","isWeekend","isSunday","eachWeekendOfMonth","startOfMonth","endOfMonth","eachWeekendOfYear","startOfYear","endOfYear","endOfDay","endOfDecade","decade","endOfHour","setMinutes","endOfISOWeek","endOfWeek","endOfISOWeekYear","setMilliseconds","endOfMinute","endOfQuarter","endOfSecond","getDay","formattingTokensRegExp","longFormattingTokensRegExp","escapedStringRegExp","doubleQuoteRegExp","dirtyFormatStr","formatStr","defaultLocale","isValid","utcDate","subMilliseconds","formatterOptions","substring","firstCharacter","longFormatter","cleanEscapedString","formatter","awareOfUnicodeTokens","MINUTES_IN_DAY","MINUTES_IN_ALMOST_TWO_DAYS","MINUTES_IN_MONTH","MINUTES_IN_TWO_MONTHS","formatDistance","dirtyBaseDate","comparison","localizeOptions","addSuffix","Boolean","seconds","offsetInSeconds","includeSeconds","nearestMonth","monthsSinceStartOfYear","years","MINUTES_IN_YEAR","formatDistanceStrict","roundingMethod","roundingMethodFn","formatRelative","baseDate","utcBaseDate","fromUnixTime","dirtyUnixTime","unixTime","dayOfMonth","getDayOfYear","monthIndex","lastDayOfMonth","getDecade","getISODay","getISOWeek","startOfISOWeekYear","getISOWeeksInYear","thisYear","nextYear","getOverlappingDaysInIntervals","isOverlapping","overlapStartDate","overlapEndDate","differenceInMs","getUnixTime","getWeek","startOfWeekYear","getWeekOfMonth","startWeekDay","currentWeekDay","startWeekDayWithOptions","getWeekYear","getWeeksInMonth","getYear","dirtyLeftDate","dirtyRightDate","isFirstDayOfMonth","isFriday","isLastDayOfMonth","isMonday","isSameDay","dateLeftStartOfDay","dateRightStartOfDay","isSameHour","dateLeftStartOfHour","startOfHour","dateRightStartOfHour","isSameISOWeek","isSameWeek","isSameISOWeekYear","dateLeftStartOfYear","dateRightStartOfYear","isSameMinute","dateLeftStartOfMinute","startOfMinute","dateRightStartOfMinute","isSameMonth","isSameQuarter","dateLeftStartOfQuarter","startOfQuarter","dateRightStartOfQuarter","isSameSecond","dateLeftStartOfSecond","startOfSecond","dateRightStartOfSecond","dateLeftStartOfWeek","dateRightStartOfWeek","isSameYear","isSaturday","isThursday","isTuesday","isWednesday","isWithinInterval","startTime","lastDayOfDecade","lastDayOfISOWeek","lastDayOfWeek","lastDayOfISOWeekYear","lastDayOfQuarter","lastDayOfYear","lightFormat","buildFormatLongFn","defaultWidth","buildLocalizeFn","dirtyIndex","valuesArray","formattingValues","defaultFormattingWidth","argumentCallback","buildMatchFn","dirtyString","matchPattern","matchPatterns","defaultMatchWidth","matchedString","parsePatterns","defaultParseWidth","findKey","valueCallback","rest","predicate","buildMatchPatternFn","parseResult","parsePattern","formatDistanceLocale","lessThanXSeconds","one","other","xSeconds","halfAMinute","lessThanXMinutes","xMinutes","aboutXHours","xHours","xDays","aboutXMonths","xMonths","aboutXYears","xYears","overXYears","almostXYears","dateFormats","full","long","medium","short","timeFormats","dateTimeFormats","formatRelativeLocale","lastWeek","yesterday","today","tomorrow","nextWeek","eraValues","narrow","abbreviated","wide","quarterValues","monthValues","dayValues","dayPeriodValues","formattingDayPeriodValues","rem100","matchOrdinalNumberPattern","parseOrdinalNumberPattern","matchEraPatterns","parseEraPatterns","any","matchQuarterPatterns","parseQuarterPatterns","matchMonthPatterns","parseMonthPatterns","matchDayPatterns","parseDayPatterns","matchDayPeriodPatterns","parseDayPeriodPatterns","numericPatterns","hour23h","hour24h","hour11h","hour12h","singleDigit","twoDigits","threeDigits","fourDigits","anyDigitsSigned","singleDigitSigned","twoDigitsSigned","threeDigitsSigned","fourDigitsSigned","timezonePatterns","basicOptionalMinutes","basic","basicOptionalSeconds","extended","extendedOptionalSeconds","parseNumericPattern","parseTimezonePattern","parseAnyDigitsSigned","parseNDigits","parseNDigitsSigned","dayPeriodEnumToHours","enumValue","normalizeTwoDigitYear","currentYear","isCommonEra","absCurrentYear","rangeEnd","rangeEndCentury","isPreviousCentury","DAYS_IN_MONTH","DAYS_IN_MONTH_LEAP_YEAR","isLeapYearIndex","parsers","priority","isTwoDigitYear","validate","normalizedTwoDigitYear","firstWeekOfYear","wholeWeekDays","isPM","timestampIsSet","TIMEZONE_UNIT_PRIORITY","notWhitespaceRegExp","dirtyDateString","dirtyFormatString","dateString","formatString","subFnOptions","setters","dateToSystemTimezone","tokens","uniquePrioritySetters","setter","setterArray","convertedDate","DEFAULT_ADDITIONAL_DIGITS","patterns","dateTimeDelimiter","timeZoneDelimiter","dateRegex","timeRegex","timezoneRegex","parseISO","additionalDigits","dateStrings","splitDateString","parseYearResult","parseYear","parseDate","restDateString","parseTime","parseTimezone","fullTime","fullTimeDate","fullTimeDateNextDay","offsetDiff","timeString","captures","century","isWeekDate","parseDateUnit","validateWeekDate","dayOfISOWeekYear","validateDayOfYearDate","parseTimeUnit","validateTime","timezoneString","validateTimezone","fourthOfJanuaryDay","daysInMonths","_year","_hours","roundToNearestMinutes","nearestTo","roundedMinutes","remainderMinutes","addedMinutes","dirtyDayOfMonth","setDay","setDayOfYear","dirtyDayOfYear","dirtyHours","setISODay","setISOWeek","dirtyISOWeekYear","dirtyMilliseconds","dirtyMinutes","dirtyMonth","setQuarter","dirtyQuarter","oldQuarter","dirtySeconds","setWeek","setWeekYear","dirtyWeekYear","setYear","dirtyYear","startOfDecade","cleanDate","subDays","subHours","subMinutes","subMonths","subQuarters","subSeconds","subWeeks","subYears","argStr","stack","objectKeys","isArguments","is","isRegex","whichBoxedPrimitive","callBound","whichCollection","getIterator","getSideChannel","whichTypedArray","$getTime","gPO","getPrototypeOf","$objToString","$Set","$mapHas","$mapGet","$mapSize","$setAdd","$setDelete","$setHas","$setSize","setHasEqualElement","val1","channel","internalDeepEqual","findLooseMatchingPrimitives","prim","mapMightHaveLoosePrim","altValue","curB","looseOpts","strict","setMightHaveLoosePrim","mapHasEqualEntry","key1","item1","key2","actual","expected","actualBoxed","expectedBoxed","hasActual","hasExpected","sentinel","objEquiv","setEquiv","iA","iB","resultA","resultB","mapEquiv","item2","aIsArray","bIsArray","aIsError","bIsError","aIsRegex","bIsRegex","source","aIsDate","bIsDate","aIsBuffer","bIsBuffer","ka","kb","aCollection","bCollection","deepEqual","arr","hasSymbols","toStr","origDefineProperty","defineProperty","isFunction","arePropertyDescriptorsSupported","enumerable","supportsDescriptors","writable","defineProperties","predicates","getOwnPropertySymbols","$iterator","$Map","$arrayPush","$charCodeAt","$stringSlice","advanceStringIndex","getArrayIterator","arraylike","getNonCollectionIterator","noPrimordialCollections","nextIndex","isMap","isSet","$mapForEach","$setForEach","$mapIterator","$setIterator","getStopIterationIterator","$mapAtAtIterator","$setAtAtIterator","getCollectionIterator","hasOwn","ctx","ERROR_MESSAGE","funcType","bound","binder","boundLength","boundArgs","Function","Empty","implementation","$SyntaxError","SyntaxError","$Function","$TypeError","getEvalledConstructor","expressionSyntax","getOwnPropertyDescriptor","throwTypeError","ThrowTypeError","callee","calleeThrows","gOPDthrows","getProto","__proto__","needsEval","TypedArray","INTRINSICS","AggregateError","ArrayBuffer","Atomics","BigInt","DataView","decodeURI","encodeURI","eval","EvalError","Float32Array","Float64Array","FinalizationRegistry","Int8Array","Int16Array","Int32Array","isFinite","Proxy","ReferenceError","Reflect","SharedArrayBuffer","Uint8ClampedArray","Uint16Array","URIError","WeakRef","WeakSet","doEval","LEGACY_ALIASES","$concat","$spliceApply","$replace","$strSlice","getBaseIntrinsic","intrinsicName","alias","intrinsicBaseName","intrinsicRealName","skipFurtherCaching","isOwn","$jscomp","scope","findInternal","ASSUME_ES5","ASSUME_NO_NATIVE_MAP","ASSUME_NO_NATIVE_SET","SIMPLE_FROUND_POLYFILL","getGlobal","window","polyfill","checkStringArgs","COMPILED","goog","isDef","isBoolean","isNumber","exportPath_","execScript","define","CLOSURE_UNCOMPILED_DEFINES","CLOSURE_DEFINES","nodeType","FEATURESET_YEAR","DEBUG","LOCALE","TRUSTED_SITE","STRICT_MODE_COMPATIBLE","DISALLOW_TEST_ONLY_CODE","ENABLE_CHROME_APP_SAFE_SCRIPT_LOADING","provide","isInModuleLoader_","isProvided_","constructNamespace_","implicitNamespaces_","lastIndexOf","getObjectByName","getScriptNonce","getScriptNonce_","document","cspNonce_","NONCE_PATTERN_","querySelector","nonce","getAttribute","VALID_MODULE_RE_","search","isInGoogModuleLoader_","moduleLoaderState_","moduleName","getInternal_","loadedModules_","ModuleType","ES6","GOOG","isInEs6ModuleLoader_","getCurrentModulePath","declareLegacyNamespace","declareModuleId","moduleId","setTestOnly","forwardDeclare","isDefAndNotNull","globalize","addDependency","DEPENDENCIES_ENABLED","debugLoader_","ENABLE_DEBUG_LOADER","logToConsole_","requested","load_","requireType","basePath","nullFunction","abstractMethod","addSingletonGetter","instance_","getInstance","instantiatedSingletons_","LOAD_MODULE_USING_EVAL","SEAL_MODULE_EXPORTS","TRANSPILE","ASSUME_ES_MODULES_TRANSPILED","TRANSPILE_TO_LANGUAGE","TRANSPILER","hasBadLetScoping","useSafari10Workaround","workaroundSafari10EvalBug","loadModule","loadModuleFromSource_","seal","normalizePath_","loadFileSync_","CLOSURE_LOAD_FILE_SYNC","XMLHttpRequest","send","status","responseText","transpile_","transpile","$gwtExport","typeOf","propertyIsEnumerable","isNull","isArrayLike","isDateLike","getUid","UID_PROPERTY_","uidCounter_","hasUid","removeUid","removeAttribute","getHashCode","removeHashCode","bindNative_","bindJs_","partial","mixin","globalEval","evalWorksForGlobals_","_evalTest_","createElement","defer","appendChild","createTextNode","head","removeChild","getCssName","cssNameMapping_","cssNameMappingStyle_","CLOSURE_CSS_NAME_MAP_FN","setCssNameMapping","CLOSURE_CSS_NAME_MAPPING","getMsg","html","getMsgWithFallback","exportSymbol","exportProperty","inherits","superClass_","caller","defineClass","statics","createSealingConstructor_","applyProperties_","SEAL_CLASS_INSTANCES","isUnsealable_","UNSEALABLE_CONSTRUCTOR_PROPERTY_","OBJECT_PROTOTYPE_FIELDS_","tagUnsealableClass","inHtmlDocument_","isDocumentLoading_","attachEvent","readyState","findBasePath_","CLOSURE_BASE_PATH","currentScript","getElementsByTagName","src","Transpiler","requiresTranspilation_","transpilationTarget_","createRequiresTranspilation_","es3","navigator","userAgent","needsTranspile","transpiler_","protectScriptTag_","DebugLoader_","dependencies_","idToPath_","written_","loadingDeps_","depsToLoad_","paused_","factory_","DependencyFactory","deferredCallbacks_","deferredQueue_","bootstrap","setTimeout","getPathFromDeps_","onLoad","loadClosureDeps","createDependency","loadDeps_","areDepsLoaded_","requires","setDependencyFactory","loading_","pause","resume","resume_","loaded","loaded_","pending","setModuleState","registerEs6ModuleExports","registerGoogModuleExports","clearModuleState","defer_","areDepsLoaded","load","pause_","LoadController","Dependency","relativePath","provides","loadFlags","loadCallbacks_","getPathName","callbackMap_","registerCallback_","unregisterCallback_","callback_","CLOSURE_IMPORT_SCRIPT","IS_OLD_IE_","TRUSTED_TYPES_POLICY_","createHTML","setAttribute","onreadystatechange","onload","createScriptURL","Es6ModuleDependency","textContent","createScript","TransformedDependency","contents_","lazyFetch_","transform","ensure","TranspiledDependency","transpiler","PreTranspiledEs6ModuleDependency","GoogModuleDependency","needsTranspile_","atob","all","lang","CLOSURE_NO_DEPS","TRUSTED_TYPES_POLICY_NAME","identity_","createTrustedTypesPolicy","TrustedTypes","createPolicy","createURL","getCount","getAnyKey","getAnyValue","contains","containsValue","getValues","getKeys","getValueByKeys","containsKey","findValue","isEmpty","clear","setIfUndefined","setWithReturnValueIfNotSet","equals","unsafeClone","transpose","PROTOTYPE_FIELDS_","extend","createSet","createImmutableView","isFrozen","freeze","isImmutableView","getAllPropertyNames","getOwnPropertyNames","getSuperClass","debug","reportErrorToServer","dom","NodeType","ELEMENT","ATTRIBUTE","TEXT","CDATA_SECTION","ENTITY_REFERENCE","ENTITY","PROCESSING_INSTRUCTION","COMMENT","DOCUMENT","DOCUMENT_TYPE","DOCUMENT_FRAGMENT","NOTATION","asserts","ENABLE_ASSERTS","AssertionError","subs_","messagePattern","DEFAULT_ERROR_HANDLER","errorHandler_","doAssertFailure_","setErrorHandler","assert","assertExists","fail","assertNumber","assertString","assertFunction","assertObject","assertArray","assertBoolean","assertElement","assertInstanceof","getType_","assertFinite","assertObjectPrototypeIsIntact","displayName","jspb","BinaryConstants","ConstBinaryMessage","BinaryMessage","FieldType","INVALID","DOUBLE","FLOAT","INT64","UINT64","INT32","FIXED64","FIXED32","BOOL","STRING","GROUP","MESSAGE","BYTES","UINT32","ENUM","SFIXED32","SFIXED64","SINT32","SINT64","FHASH64","VHASH64","WireType","VARINT","DELIMITED","START_GROUP","END_GROUP","FieldTypeToWireType","INVALID_FIELD_NUMBER","FLOAT32_EPS","FLOAT32_MIN","FLOAT32_MAX","FLOAT64_EPS","FLOAT64_MIN","FLOAT64_MAX","TWO_TO_20","TWO_TO_23","TWO_TO_31","TWO_TO_32","TWO_TO_52","TWO_TO_63","TWO_TO_64","ZERO_HASH","NATIVE_ARRAY_PROTOTYPES","ASSUME_NATIVE_FUNCTIONS","peek","forEachRight","reduceRight","findRight","findIndexRight","insert","insertAt","insertArrayAt","insertBefore","removeAt","removeLast","removeIf","removeAllIf","removeDuplicates","binarySearch","binarySearch_","defaultCompare","binarySelect","stableSort","sortByKey","sortObjectsByKey","isSorted","defaultCompareEquality","compare3","inverseDefaultCompare","binaryInsert","binaryRemove","toObject","range","repeat","flatten","rotate","moveItem","zip","shuffle","copyByIndex","concatMap","stringToByteArray","byteArrayToString","byteArrayToHex","hexToByteArray","stringToUtf8ByteArray","utf8ByteArrayToString","xorByteArray","assertIsLocation","getWindow_","Location","Element","debugStringForType_","assertIsElementType_","assertIsHTMLAnchorElement","assertIsHTMLButtonElement","assertIsHTMLLinkElement","assertIsHTMLImageElement","assertIsHTMLAudioElement","assertIsHTMLVideoElement","assertIsHTMLInputElement","assertIsHTMLTextAreaElement","assertIsHTMLCanvasElement","assertIsHTMLEmbedElement","assertIsHTMLFormElement","assertIsHTMLFrameElement","assertIsHTMLIFrameElement","assertIsHTMLObjectElement","assertIsHTMLScriptElement","ownerDocument","defaultView","parentWindow","functions","constant","FALSE","TRUE","NULL","identity","lock","partialRight","withReturnValue","sequence","equalTo","compose","and","or","not","CACHE_RETURN_VALUE","cacheReturnValue","once","debounce","clearTimeout","throttle","rateLimit","HtmlElement","TagName","tagName_","A","ABBR","ACRONYM","ADDRESS","APPLET","AREA","ARTICLE","ASIDE","AUDIO","BASE","BASEFONT","BDI","BDO","BIG","BLOCKQUOTE","BODY","BR","BUTTON","CANVAS","CAPTION","CENTER","CITE","CODE","COL","COLGROUP","COMMAND","DATA","DATALIST","DD","DEL","DETAILS","DFN","DIALOG","DIR","DIV","DL","DT","EM","EMBED","FIELDSET","FIGCAPTION","FIGURE","FONT","FOOTER","FORM","FRAME","FRAMESET","H1","H2","H3","H4","H5","H6","HEAD","HEADER","HGROUP","HR","HTML","IFRAME","IMG","INPUT","INS","ISINDEX","KBD","KEYGEN","LABEL","LEGEND","LI","LINK","MAIN","MAP","MARK","MATH","MENU","MENUITEM","META","METER","NAV","NOFRAMES","NOSCRIPT","OBJECT","OL","OPTGROUP","OPTION","OUTPUT","PARAM","PICTURE","PRE","PROGRESS","RP","RT","RTC","RUBY","SAMP","SCRIPT","SECTION","SELECT","SMALL","SOURCE","SPAN","STRIKE","STRONG","STYLE","SUB","SUMMARY","SUP","SVG","TABLE","TBODY","TD","TEMPLATE","TEXTAREA","TFOOT","TH","THEAD","TIME","TITLE","TR","TRACK","TT","U","UL","VAR","VIDEO","WBR","tags","VOID_TAGS_","area","br","col","command","embed","hr","img","keygen","link","meta","param","track","wbr","isVoidTag","trustedtypes","PRIVATE_DO_NOT_ACCESS_OR_ELSE_POLICY","TypedString","Const","stringConstValueWithSecurityContract__googStringSecurityPrivate_","GOOG_STRING_CONSTRUCTOR_TOKEN_PRIVATE_","STRING_CONST_TYPE_MARKER__GOOG_STRING_SECURITY_PRIVATE_","TYPE_MARKER_","implementsGoogStringTypedString","getTypedStringValue","unwrap","EMPTY","SafeScript","privateDoNotAccessOrElseSafeScriptWrappedValue_","SAFE_SCRIPT_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_","TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_","fromConstant","createSafeScriptSecurityPrivateDoNotAccessOrElse","fromConstantAndArgs","stringify_","fromJson","unwrapTrustedScript","initSecurityPrivateDoNotAccessOrElse_","url","createObjectUrl","getUrlObject_","createObjectURL","revokeObjectUrl","revokeObjectURL","findUrlObject_","URL","webkitURL","browserSupportsObjectUrls","i18n","bidi","FORCE_RTL","IS_RTL","Format","LRE","RLE","PDF","LRM","RLM","Dir","LTR","RTL","NEUTRAL","RIGHT","LEFT","I18N_RIGHT","I18N_LEFT","toDir","ltrChars_","rtlChars_","htmlSkipReg_","stripHtmlIfNeeded_","rtlCharReg_","ltrCharReg_","hasAnyRtl","hasRtlChar","hasAnyLtr","ltrRe_","rtlRe_","isRtlChar","isLtrChar","isNeutralChar","ltrDirCheckRe_","rtlDirCheckRe_","startsWithRtl","isRtlText","startsWithLtr","isLtrText","isRequiredLtrRe_","isNeutralText","ltrExitDirCheckRe_","rtlExitDirCheckRe_","endsWithLtr","isLtrExitText","endsWithRtl","isRtlExitText","rtlLocalesRe_","isRtlLanguage","bracketGuardTextRe_","guardBracketInText","enforceRtlInHtml","enforceRtlInText","enforceLtrInHtml","enforceLtrInText","dimensionsRe_","leftRe_","rightRe_","tempRe_","mirrorCSS","doubleQuoteSubstituteRe_","singleQuoteSubstituteRe_","normalizeHebrewQuote","wordSeparatorRe_","hasNumeralsRe_","rtlDetectionThreshold_","estimateDirection","detectRtlDirectionality","setElementDirAndAlign","style","textAlign","setElementDirByTextDirectionality","DirectionalString","TrustedResourceUrl","privateDoNotAccessOrElseTrustedResourceUrlWrappedValue_","trustedURL_","TRUSTED_RESOURCE_URL_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_","implementsGoogI18nBidiDirectionalString","getDirection","cloneWithParams","URL_PARAM_PARSER_","createTrustedResourceUrlSecurityPrivateDoNotAccessOrElse","stringifyParams_","unwrapTrustedScriptURL","unwrapTrustedURL","BASE_URL_","FORMAT_MARKER_","formatWithParams","fromConstants","internal","startsWith","endsWith","caseInsensitiveStartsWith","caseInsensitiveCompare","caseInsensitiveEndsWith","caseInsensitiveEquals","isEmptyOrWhitespace","newLineToBr","htmlEscape","AMP_RE_","LT_RE_","GT_RE_","QUOT_RE_","SINGLE_QUOTE_RE_","NULL_RE_","ALL_RE_","whitespaceEscape","caseInsensitiveContains","compareVersions","compareElements_","SafeUrl","privateDoNotAccessOrElseSafeUrlWrappedValue_","SAFE_URL_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_","INNOCUOUS_STRING","createSafeUrlSecurityPrivateDoNotAccessOrElse","SAFE_MIME_TYPE_PATTERN_","isSafeMimeType","fromBlob","DATA_URL_PATTERN_","fromDataUrl","fromTelUrl","SIP_URL_PATTERN_","fromSipUrl","fromFacebookMessengerUrl","fromWhatsAppUrl","fromSmsUrl","isSmsUrlBodyValid_","fromSshUrl","sanitizeChromeExtensionUrl","sanitizeExtensionUrl_","sanitizeFirefoxExtensionUrl","sanitizeEdgeExtensionUrl","fromTrustedResourceUrl","SAFE_URL_PATTERN_","SAFE_URL_PATTERN","sanitizeAssertUnchanged","ABOUT_BLANK","SafeStyle","privateDoNotAccessOrElseSafeStyleWrappedValue_","SAFE_STYLE_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_","createSafeStyleSecurityPrivateDoNotAccessOrElse","sanitizePropertyValue_","sanitizePropertyValueString_","FUNCTIONS_RE_","URL_RE_","VALUE_RE_","COMMENT_RE_","hasBalancedQuotes_","hasBalancedSquareBrackets_","VALUE_ALLOWED_CHARS_","sanitizeUrl_","SafeStyleSheet","privateDoNotAccessOrElseSafeStyleSheetWrappedValue_","SAFE_STYLE_SHEET_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_","createRule","hasBalancedBrackets_","createSafeStyleSheetSecurityPrivateDoNotAccessOrElse","labs","util","getNativeUserAgentString_","getNavigator_","userAgent_","setUserAgent","getUserAgent","matchUserAgent","matchUserAgentIgnoreCase","extractVersionTuples","browser","matchOpera_","matchIE_","matchEdgeHtml_","matchEdgeChromium_","matchOperaChromium_","matchFirefox_","matchSafari_","matchChrome_","matchCoast_","isSilk","matchIosWebview_","matchAndroidBrowser_","isChrome","isFirefox","isOpera","isIE","isEdge","isEdgeChromium","isOperaChromium","isSafari","isCoast","isIosWebview","isAndroidBrowser","getVersion","getIEVersion_","isVersionOrHigher","SafeHtml","privateDoNotAccessOrElseSafeHtmlWrappedValue_","SAFE_HTML_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_","dir_","unwrapTrustedHTML","createSafeHtmlSecurityPrivateDoNotAccessOrElse","htmlEscapePreservingNewlines","htmlEscapePreservingNewlinesAndSpaces","VALID_NAMES_IN_TAG_","URL_ATTRIBUTES_","action","cite","formaction","href","manifest","poster","NOT_ALLOWED_TAG_NAMES_","verifyTagName","createSafeHtmlTagSecurityPrivateDoNotAccessOrElse","createIframe","srcdoc","combineAttributes","sandbox","createSandboxIframe","canUseSandboxIframe","HTMLIFrameElement","createScriptSrc","createStyle","createMetaRefresh","getAttrNameAndValue_","getStyleValue_","createWithDir","concatWithDir","stringifyAttributes","DOCTYPE_HTML","uncheckedconversions","safeHtmlFromStringKnownToSatisfyTypeContract","safeScriptFromStringKnownToSatisfyTypeContract","safeStyleFromStringKnownToSatisfyTypeContract","safeStyleSheetFromStringKnownToSatisfyTypeContract","safeUrlFromStringKnownToSatisfyTypeContract","trustedResourceUrlFromStringKnownToSatisfyTypeContract","safe","InsertAdjacentHtmlPosition","AFTERBEGIN","AFTEREND","BEFOREBEGIN","BEFOREEND","insertAdjacentHtml","insertAdjacentHTML","SET_INNER_HTML_DISALLOWED_TAGS_","isInnerHtmlCleanupRecursive_","firstChild","innerHTML","parentElement","unsafeSetInnerHtmlDoNotUseOrElse","lastChild","setInnerHtml","tagName","setOuterHtml","outerHTML","setFormElementAction","setButtonFormAction","formAction","setInputFormAction","setStyle","cssText","documentWrite","setAnchorHref","setImageSrc","setAudioSrc","setVideoSrc","setEmbedSrc","setFrameSrc","setIframeSrc","setIframeSrcdoc","setLinkHrefAndRel","rel","setObjectData","setScriptSrc","setScriptContent","text","setLocationHref","assignLocation","replaceLocation","openInWindow","parseFromStringHtml","parseFromString","createImageFromBlob","Image","DETECT_DOUBLE_ESCAPING","FORCE_NON_DOM_HTML_UNESCAPING","Unicode","NBSP","subs","collapseWhitespace","isEmptyString","isEmptyOrWhitespaceSafe","makeSafe","isEmptySafe","isBreakingWhitespace","isAlpha","isNumeric","isAlphaNumeric","isSpace","isUnicodeChar","stripNewlines","canonicalizeNewlines","normalizeWhitespace","normalizeSpaces","collapseBreakingSpaces","trimLeft","numberAwareCompare_","intAwareCompare","floatAwareCompare","numerateCompare","urlEncode","urlDecode","E_RE_","unescapeEntities","unescapeEntitiesUsingDom_","unescapePureXmlEntities_","unescapeEntitiesWithDocument","HTML_ENTITY_PATTERN_","nodeValue","preserveSpaces","stripQuotes","truncate","truncateMiddle","specialEscapeChars_","jsEscapeCache_","escapeChar","escapeString","countOf","removeAll","regExpEscape","replaceAll","padNumber","buildString","getRandomString","hashCode","uniqueStringCounter_","createUniqueString","toNumber","isLowerCamelCase","isUpperCamelCase","toCamelCase","toSelectorCase","toTitleCase","capitalize","splitLimit","lastComponent","editDistance","engine","isPresto","isTrident","isWebKit","isGecko","getEngineTuple_","getVersionForKey_","isAndroid","isIpod","isIphone","isIpad","isIos","isMacintosh","isLinux","isWindows","isChromeOS","isChromecast","isKaiOS","isGo2Phone","reflect","objectProperty","sinkValue","canAccessProperty","cache","ASSUME_IE","ASSUME_EDGE","ASSUME_GECKO","ASSUME_WEBKIT","ASSUME_MOBILE_WEBKIT","ASSUME_OPERA","ASSUME_ANY_VERSION","BROWSER_KNOWN_","getUserAgentString","getNavigatorTyped","getNavigator","OPERA","IE","EDGE","EDGE_OR_IE","GECKO","WEBKIT","isMobile_","MOBILE","SAFARI","determinePlatform_","PLATFORM","ASSUME_MAC","ASSUME_WINDOWS","ASSUME_LINUX","ASSUME_X11","ASSUME_ANDROID","ASSUME_IPHONE","ASSUME_IPAD","ASSUME_IPOD","ASSUME_KAIOS","ASSUME_GO2PHONE","PLATFORM_KNOWN_","MAC","WINDOWS","isLegacyLinux_","LINUX","isX11_","appVersion","X11","ANDROID","IPHONE","IPAD","IPOD","IOS","KAIOS","GO2PHONE","determineVersion_","getVersionRegexResult_","getDocumentMode_","documentMode","VERSION","isVersionOrHigherCache_","isVersion","isDocumentModeOrHigher","DOCUMENT_MODE","isDocumentMode","product","ASSUME_FIREFOX","ASSUME_CHROME","ASSUME_SAFARI","PRODUCT_KNOWN_","FIREFOX","isIphoneOrIpod_","CHROME","isSafariDesktop_","DEFAULT_ALPHABET_COMMON_","ENCODED_VALS","ENCODED_VALS_WEBSAFE","Alphabet","DEFAULT","NO_PADDING","WEBSAFE","WEBSAFE_DOT_PADDING","WEBSAFE_NO_PADDING","paddingChars_","isPadding_","byteToCharMaps_","charToByteMap_","ASSUME_NATIVE_SUPPORT_","HAS_NATIVE_ENCODE_","btoa","HAS_NATIVE_DECODE_","encodeByteArray","init_","encodeString","decodeString","decodeStringInternal_","decodeStringToByteArray","decodeStringToUint8Array","subarray","utils","split64Low","split64High","splitUint64","splitInt64","splitZigzag64","splitFloat32","log","LN2","splitFloat64","splitHash64","joinUint64","joinInt64","toZigzag64","joinZigzag64","fromZigzag64","joinFloat32","Infinity","joinFloat64","joinHash64","DIGITS","ZERO_CHAR_CODE_","A_CHAR_CODE_","joinUnsignedDecimalString","joinSignedDecimalString","hash64ToDecimalString","hash64ArrayToDecimalStrings","decimalStringToHash64","splitDecimalString","toHexDigit_","fromHexCharCode_","hash64ToHexString","hexStringToHash64","hash64ToNumber","numberToHash64","countVarints","countVarintFields","countFixedFields_","countFixed32Fields","countFixed64Fields","countDelimitedFields","debugBytesToTextFormat","byteSourceToUint8Array","debugScalarToTextFormat","BinaryDecoder","bytes_","cursor_","end_","start_","error_","setBlock","instanceCache_","free","getBuffer","getEnd","setEnd","getCursor","setCursor","advance","atEnd","pastEnd","readSplitVarint64","readSplitZigzagVarint64","readSplitFixed64","skipVarint","unskipVarint","readUnsignedVarint32","readSignedVarint32","readUnsignedVarint32String","readSignedVarint32String","readZigzagVarint32","readUnsignedVarint64","readUnsignedVarint64String","readSignedVarint64","readSignedVarint64String","readZigzagVarint64","readZigzagVarintHash64","readZigzagVarint64String","readUint8","readUint16","readUint32","readUint64","readUint64String","readInt8","readInt16","readInt32","readInt64","readInt64String","readFloat","readDouble","readBool","readEnum","readString","readStringWithLength","readBytes","readVarintHash64","readFixedHash64","BinaryReader","decoder_","fieldCursor_","nextField_","nextWireType_","readCallbacks_","getFieldCursor","getFieldNumber","getWireType","isDelimited","isEndGroup","nextField","unskipHeader","skipMatchingFields","skipField","skipVarintField","skipDelimitedField","skipFixed32Field","skipFixed64Field","skipGroup","registerReadCallback","runReadCallback","readAny","readFixed64","readFixed32","readSfixed32","readSfixed64","readSint32","readSint64","readMessage","readGroup","getFieldDecoder","readInt32String","readUint32String","readSint64String","readFixed64String","readSfixed32String","readSfixed64String","readSintHash64","readPackedField_","readPackedInt32","readPackedInt32String","readPackedInt64","readPackedInt64String","readPackedUint32","readPackedUint32String","readPackedUint64","readPackedUint64String","readPackedSint32","readPackedSint64","readPackedSint64String","readPackedFixed32","readPackedFixed64","readPackedFixed64String","readPackedSfixed32","readPackedSfixed64","readPackedSfixed64String","readPackedFloat","readPackedDouble","readPackedBool","readPackedEnum","readPackedVarintHash64","readPackedFixedHash64","BinaryEncoder","buffer_","writeSplitVarint64","writeSplitFixed64","writeUint32","writeUnsignedVarint32","writeSignedVarint32","writeUnsignedVarint64","writeSignedVarint64","writeZigzagVarint32","writeZigzagVarint64","writeZigzagVarint64String","writeZigzagVarintHash64","writeUint8","writeUint16","writeUint64","writeInt8","writeInt16","writeInt32","writeInt64","writeInt64String","writeFloat","writeDouble","writeBool","writeEnum","writeBytes","writeVarintHash64","writeFixedHash64","writeString","arith","UInt64","lo","hi","cmp","rightShift","leftShift","msb","lsb","sub","mul32x32","mul","div","fromString","Int64","BinaryWriter","blocks_","totalLength_","encoder_","bookmarks_","appendUint8Array_","beginDelimited_","writeFieldHeader_","endDelimited_","writeSerializedMessage","maybeWriteSerializedMessage","getResultBuffer","getResultBase64String","beginSubMessage","endSubMessage","writeAny","writeFixed64","writeFixed32","writeSfixed32","writeSfixed64","writeSint32","writeSint64","writeUnsignedVarint32_","writeSignedVarint32_","writeUnsignedVarint64_","writeSignedVarint64_","writeZigzagVarint32_","writeZigzagVarint64_","writeZigzagVarint64String_","writeZigzagVarintHash64_","writeInt32String","writeUint32String","writeUint64String","writeSintHash64","writeSint64String","writeFixed64String","writeSfixed64String","writeMessage","writeMessageSet","writeGroup","writeSplitZigzagVarint64","writeRepeatedInt32","writeRepeatedInt32String","writeRepeatedInt64","writeRepeatedSplitFixed64","writeRepeatedSplitVarint64","writeRepeatedSplitZigzagVarint64","writeRepeatedInt64String","writeRepeatedUint32","writeRepeatedUint32String","writeRepeatedUint64","writeRepeatedUint64String","writeRepeatedSint32","writeRepeatedSint64","writeRepeatedSint64String","writeRepeatedSintHash64","writeRepeatedFixed32","writeRepeatedFixed64","writeRepeatedFixed64String","writeRepeatedSfixed32","writeRepeatedSfixed64","writeRepeatedSfixed64String","writeRepeatedFloat","writeRepeatedDouble","writeRepeatedBool","writeRepeatedEnum","writeRepeatedString","writeRepeatedBytes","writeRepeatedMessage","writeRepeatedGroup","writeRepeatedFixedHash64","writeRepeatedVarintHash64","writePackedInt32","writePackedInt32String","writePackedInt64","writePackedSplitFixed64","writePackedSplitVarint64","writePackedSplitZigzagVarint64","writePackedInt64String","writePackedUint32","writePackedUint32String","writePackedUint64","writePackedUint64String","writePackedSint32","writePackedSint64","writePackedSint64String","writePackedSintHash64","writePackedFixed32","writePackedFixed64","writePackedFixed64String","writePackedSfixed32","writePackedSfixed64","writePackedSfixed64String","writePackedFloat","writePackedDouble","writePackedBool","writePackedEnum","writePackedFixedHash64","writePackedVarintHash64","arr_","valueCtor_","map_","arrClean","loadFromArray_","Entry_","valueWrapper","stringKeys_","wrapEntry_","fromObject","ArrayIteratorIterable_","idx_","getLength","getEntryList","serializeBinary","deserializeBinary","ExtensionFieldInfo","fieldIndex","fieldName","ctor","toObjectFn","isRepeated","ExtensionFieldBinaryInfo","fieldInfo","binaryReaderFn","binaryWriterFn","binaryMessageSerializeFn","binaryMessageDeserializeFn","isPacked","isMessageType","Message","GENERATE_TO_OBJECT","GENERATE_FROM_OBJECT","GENERATE_TO_STRING","ASSUME_LOCAL_ARRAYS","SERIALIZE_EMPTY_TRAILING_FIELDS","SUPPORTS_UINT8ARRAY_","getJsPbMessageId","messageId_","getIndex_","arrayIndexOffset_","hiddenES6Property_","getFieldNumber_","initialize","wrappers_","initPivotAndExtensionObject_","convertedPrimitiveFields_","repeatedFields","pivot_","EMPTY_LIST_SENTINEL_","maybeInitEmptyExtensionObject_","extensionObject_","computeOneofCase","isArray_","isExtensionObject_","MAX_VALUE","toObjectList","toObjectExtension","serializeBinaryExtensions","readBinaryExtension","getField","getRepeatedField","getOptionalFloatingPointField","getBooleanField","getRepeatedFloatingPointField","getRepeatedBooleanField","bytesAsB64","bytesAsU8","bytesListAsB64","assertConsistentTypes_","bytesListAsU8","getFieldWithDefault","getBooleanFieldWithDefault","getFloatingPointFieldWithDefault","getFieldProto3","getMapField","setField","setProto3IntField","setFieldIgnoringDefault_","setProto3FloatField","setProto3BooleanField","setProto3StringField","setProto3BytesField","setProto3EnumField","setProto3StringIntField","addToRepeatedField","setOneofField","getWrapperField","getRepeatedWrapperField","wrapRepeatedField_","setWrapperField","setOneofWrapperField","setRepeatedWrapperField","addToRepeatedWrapperField","toMap","syncMapFields_","getExtension","setExtension","compareFields","compareExtensions","cloneMessage","clone_","copyInto","registerMessageType","messageId","messageSetExtensions","messageSetExtensionsBinary","Export","$BigInt","hasNativeBigInts","origSymbol","hasSymbolSham","hasNativeSymbols","sym","symObj","symVal","syms","descriptor","hasToStringTagShams","toStringTag","hasToStringTag","$toString","isStandardArguments","isLegacyArguments","supportsStandardArguments","hasBigInts","bigIntValueOf","tryBigInt","tryBigIntObject","isBigInt","$boolToStr","tryBooleanObject","booleanBrandCheck","boolClass","isSlowBuffer","_isBuffer","readFloatLE","tryDateObject","tryDateGetDayCall","dateClass","isDateObject","exported","numToStr","tryNumberObject","numClass","isNumberObject","$exec","isRegexMarker","badStringifier","throwRegexMarker","toPrimitive","gOPD","regexClass","hasLastIndexDataProperty","strValue","tryStringObject","strClass","symToStr","symStringRegex","isSymbolObject","isRealSymbolObject","typedArrays","$slice","toStrTags","typedArray","proto","superProto","tryTypedArrays","tryAllTypedArrays","anyTrue","getter","isTypedArray","tag","$WeakMap","$WeakSet","isWeakMap","isWeakSet","getCountryCode","localeString","components","countryCode","getLocales","locales","AD","AE","AF","AG","AI","AL","AM","AN","AO","AR","AS","AT","AU","AW","AX","AZ","BA","BB","BD","BE","BF","BG","BH","BI","BJ","BL","BM","BN","BO","BQ","BS","BT","BV","BW","BY","BZ","CA","CC","CD","CF","CG","CH","CI","CK","CL","CM","CN","CO","CR","CU","CV","CW","CX","CY","CZ","DE","DJ","DK","DM","DO","DZ","EC","EE","EG","EH","ER","ES","ET","FI","FJ","FK","FM","FO","FR","GA","GB","GD","GE","GF","GG","GH","GI","GL","GM","GN","GP","GQ","GR","GS","GT","GU","GW","GY","HK","HM","HN","HT","HU","ID","IL","IM","IN","IO","IQ","IR","IS","IT","JE","JM","JO","JP","KE","KG","KH","KI","KM","KN","KP","KR","KW","KY","KZ","LA","LB","LC","LK","LR","LS","LT","LU","LV","LY","MA","MC","MD","ME","MF","MG","MH","MK","ML","MM","MN","MO","MP","MQ","MR","MS","MT","MU","MV","MW","MX","MY","MZ","NA","NC","NE","NF","NG","NI","NL","NO","NP","NR","NU","NZ","OM","PA","PE","PF","PG","PH","PK","PL","PM","PN","PR","PS","PT","PW","PY","QA","RE","RO","RS","RU","RW","SA","SB","SC","SD","SE","SG","SH","SI","SJ","SK","SL","SM","SN","SO","SR","ST","SV","SX","SY","SZ","TC","TF","TG","TJ","TK","TL","TM","TN","TO","TV","TW","TZ","UA","UG","UM","US","UY","UZ","VA","VC","VE","VG","VI","VN","VU","WF","WS","YE","YT","ZA","ZM","ZW","Yallist","MAX","LENGTH","LENGTH_CALCULATOR","ALLOW_STALE","MAX_AGE","DISPOSE","NO_DISPOSE_ON_SET","LRU_LIST","CACHE","UPDATE_AGE_ON_GET","naiveLength","LRUCache","lc","stale","maxAge","dispose","noDisposeOnSet","updateAgeOnGet","mL","allowStale","mA","lengthCalculator","lC","hit","itemCount","rforEach","thisp","walker","tail","forEachStep","dump","isStale","dumpLru","Entry","expiresAt","prune","doUse","unshiftNode","removeNode","Node","pushNode","res","forEachReverse","getReverse","mapReverse","initial","acc","reduceReverse","toArrayReverse","sliceReverse","deleteCount","inserted","md5","FF","_ff","_gg","HH","_hh","II","_ii","aa","bb","cc","dd","_blocksize","_digestsize","digestbytes","asBytes","asString","simpleIsEqual","resultFn","lastThis","lastArgs","lastResult","calledOnce","isNewArgEqualToLast","newArg","_len","newArgs","_key","_global","MurmurHashV2","seed","MurmurHashV3","h1","h1b","c1","c1b","c2","c2b","k1","murmur","v2","v3","propIsEnumerable","shouldUseNative","test1","test2","order2","test3","letter","symbols","hasMap","mapSizeDescriptor","mapSize","mapForEach","hasSet","setSizeDescriptor","setSize","setForEach","hasWeakMap","weakMapHas","hasWeakSet","weakSetHas","hasWeakRef","weakRefDeref","deref","booleanValueOf","objectToString","functionToString","$match","$toUpperCase","$toLowerCase","$test","$join","$arrSlice","$floor","gOPS","symToString","hasShammedSymbols","isEnumerable","addNumericSeparator","sepRegex","intStr","dec","inspectCustom","custom","inspectSymbol","inspect_","depth","seen","quoteStyle","maxStringLength","customInspect","indent","numericSeparator","inspectString","bigIntStr","maxDepth","getIndent","inspect","noIndent","newOpts","nameOf","arrObjKeys","symString","markBoxed","isElement","nodeName","attrs","attributes","wrapQuotes","childNodes","xs","singleLineValues","indentedJoin","isError","cause","mapParts","collectionOf","setParts","weakCollectionOf","isWeakRef","ys","isPlainObject","protoTag","stringTag","constructorTag","defaultStyle","quoteChar","HTMLElement","remaining","trailer","lowbyte","joinedEntries","baseIndent","lineJoiner","isArr","symMap","numberIsNaN","getPolyfill","shim","shimObjectIs","testObjectIs","keysShim","isArgs","hasDontEnumBug","hasProtoEnumBug","dontEnums","equalsConstructorPrototype","o","excludedKeys","$applicationCache","$console","$external","$frame","$frameElement","$frames","$innerHeight","$innerWidth","$onmozfullscreenchange","$onmozfullscreenerror","$outerHeight","$outerWidth","$pageXOffset","$pageYOffset","$parent","$scrollLeft","$scrollTop","$scrollX","$scrollY","$self","$webkitIndexedDB","$webkitStorageInfo","$window","hasAutomationEqualityBug","equalsConstructorPrototypeIfNotBuggy","theKeys","skipProto","skipConstructor","origKeys","originalKeys","shimObjectKeys","keysWorksWithArguments","canBeObject","$push","$propIsEnumerable","originalGetSymbols","source1","objTarget","getSymbols","lacksProperEnumerationOrder","letters","assignHasPendingExceptions","preventExtensions","thrower","shimAssign","$Object","hasIndices","ignoreCase","multiline","dotAll","unicode","sticky","flagsBound","TypeErr","shimFlags","$weakMapGet","$weakMapSet","$weakMapHas","$mapSet","listGetNode","listGet","objects","listSet","listHas","$wm","$m","$o","isExtendedLengthPath","hasNonAscii","v1","v4","uuid","byteToHex","bytesToUuid","bth","crypto","nodeRNG","rng","_nodeId","_clockseq","_lastMSecs","_lastNSecs","clockseq","seedBytes","msecs","nsecs","dt","tl","tmh","rnds","ii","foundName","Query","filterExpressions","selectExpressions","groupExpressions","orderExpressions","calculation","rawMode","withDead","validateRefs","expr","unfilter","exprs","exprSet","select","query","calculate","groupBy","orderBy","withoutValidatedRefs","tableOptions","getPrimaryOrderBy","defaultOrderBy","orderExprs","order","firstOrder","table","injected","runImport","budgetName","loadBudget","budgetId","id","batchBudgetUpdates","runQuery","getBudgetMonths","getBudgetMonth","setBudgetAmount","categoryId","setBudgetCarryover","flag","addTransactions","accountId","transactions","importTransactions","getTransactions","filterTransactions","updateTransaction","fields","deleteTransaction","getAccounts","createAccount","account","initialBalance","updateAccount","closeAccount","transferAccountId","transferCategoryId","reopenAccount","deleteAccount","getCategoryGroups","grouped","createCategoryGroup","group","updateCategoryGroup","deleteCategoryGroup","getCategories","createCategory","category","updateCategory","deleteCategory","getPayees","createPayee","payee","updatePayee","deletePayee","getPayeeRules","payeeId","createPayeeRule","payee_id","updatePayeeRule","deletePayeeRule","normalizePathSep","AdmZip","amountToInteger","mapAccountType","keyName","_parse","monthFromDate","getCurrentMonth","importAccounts","entityIdMap","accounts","isTombstone","accountType","accountName","offbudget","onBudget","closed","entityId","importCategories","masterCategories","masterCategory","subCategories","cat","is_income","group_id","masterCategoryId","importPayees","payees","autoFillCategoryId","transfer_acct","targetAccountId","categories","incomeCategoryId","getCategory","isOffBudget","acctId","acct","transaction","sortOrder","transactionsGrouped","toImport","transferId","transferTransactionId","newTransaction","notes","memo","transfer_id","subtransactions","subTransactions","fillInBudgets","categoryBudgets","budgets","budgeted","importBudgets","monthlyBudgets","earliestMonth","carryoverFlags","budget","filled","monthlySubCategoryBudgets","catBudget","catId","overspendingHandling","estimateRecentness","findLatestDevice","zipped","devices","contents","hasFullKnowledge","deviceGUID","shortName","shortDeviceId","recentness","knowledge","doImport","getBudgetName","unixFilepath","getFile","paths","importBuffer","dirMatch","metaStr","budgetPath","relativeDataFolderName","deviceFiles","yfullPath","integerToAmount","amountFromYnab","deleted","on_budget","incomeCatId","ynabIncomeCategories","checkSpecialCat","category_group_id","category_groups","groupId","cats","newCategory","startingBalanceCatId","startingPayeeYNAB","subtransactionsGrouped","subtrans","category_id","account_id","cleared","imported_id","import_id","transfer_transaction_id","transfer_account_id","internalCatIdYnab","creditcardCatIdYnab","importYNAB5","runMigration","db","getValue","cachedValue","execQuery","monthBudget","dbmonth","sheetName","carryover","buffers","parseNote","note","parsed","FileSystem","_filename","FLG_LNG","_permissions","PATH_SEPARATOR","recoursive","writeInt32LE","inputType","nameA","nameB","handler","handlers","evt","pickRandom","integer","findMin","getStartingBalanceCat","extractCommonThings","groups","incomePayee","expensePayees","expenseGroup","incomeGroup","bill","expenseCategories","billCategories","billPayees","fillPrimaryChecking","numTransactions","monthUtils","pick","earliestDate","starting_balance_flag","fillChecking","added","fastMode","fillInvestment","fillSavings","fillMortgage","fillOther","createBudget","primaryAccount","earliestPrimaryDate","setBudget","budgetActions","setBudgetIfSpent","spent","sheet","runMutator","batchMessages","prevSaved","toBudget","available","createTestBudget","setSyncingMode","offBudget","categoryGroups","isIncome","allGroups","runHandler","aqlQuery","$sum","primaryBalance","$gt","lastDeposit","prefs","isCached","captureException","exc","SentryClient","captureBreadcrumb","breadcrumb","addBreadcrumb","lootFs","getStorePath","getDataDir","store","persisted","init","persist","_saveStore","writeFile","getItem","setItem","removeItem","multiGet","multiSet","keyValues","multiRemove","fetch","fetchBinary","fileStream","createWriteStream","body","documentDir","rootPath","__dirname","__filename","env","ACTUAL_DATA_DIR","_setDocumentDir","getDocumentDir","getBudgetDir","bundledDatabasePath","migrationsPath","demoBudgetPath","listDir","readdir","access","constants","F_OK","mkdir","copyFile","frompath","topath","readStream","createReadStream","writeStream","removeFile","unlink","removeDir","dirpath","rmdir","removeDirRecursively","fullpath","getModifiedTime","Database","verifyParamTypes","sql","params","fetchAll","stmt","changes","insertId","lastInsertRowid","transactionDepth","asyncTransaction","openDatabase","pathOrBuffer","closeDatabase","exportDatabase","v4Sync","exportToCSV","accountNamesById","reduced","categoryNamesById","subCategory","payeeNamesById","transactionsForExport","Account","Payee","Notes","Category","Amount","csvStringify","exportQueryToCSV","Id","ParentId","IsParent","splits","parentsPayees","trans","noParents","handoffPublicToken","institution","publicToken","asyncStorage","userId","institution_id","post","getServer","PLAID_SERVER","item_id","public_token","bank_id","addAccounts","bankId","accountIds","offbudgetIds","userKey","bankSync","official_name","fromPlaidAccountType","balance_current","balances","current","mask","bank","parseFile","errors","ext","parseQIF","parseCSV","parseOFX","csv2json","qif2json","looselyParseAmount","payee_name","imported_payee","getOFXTransactions","initModule","fi_id","dayFromDate","description","row","getStartingBalancePayee","qif","line","division","address","lArray","subcategory","clearedStatus","sArray","dateFormat","safeNumber","safeParseInt","RuleError","parseRecurDate","recurConfigToRSchedule","RSchedule","parseDateString","dateFns","parseBetweenAmount","between","num1","num2","CONDITION_TYPES","ops","nullable","op","Condition","fieldTypes","typeName","rawValue","unparsedValue","fieldValue","outflow","inflow","extractValue","fieldDate","fullDate","high","low","yearFromDate","threshold","getApproxNumberThreshold","sortNumbers","ACTION_OPS","Action","stage","conditions","actions","evalConditions","condition","execActions","getId","RuleIndexer","getIndex","getIndexForValue","getKey","getIndexes","cond","indexes","getApplicableRules","indexedRules","fastSetMerge","OP_SCORES","oneOf","isapprox","isbetween","gt","gte","lt","lte","computeScore","initialScore","score","_rankRules","scores","r1","r2","score1","score2","id1","id2","rankRules","pre","normal","migrateIds","mappings","ci","ai","iterateIds","counts","ruleiter","vi","levenshtein","BankSyncError","makeSplitTransaction","recalculateSplit","is_parent","idx","makeChildTransaction","sort_order","parent","getAccountBalance","updateAccountBalance","balance","fromPlaid","transaction_id","downloadTransactions","since","allTransactions","accountBalance","pageSize","numDownloaded","start_date","end_date","error_code","error_type","total_transactions","resolvePayee","payeeName","payeesToCreate","newPayee","normalizeTransactions","rawPayeeName","normalized","trimmed","title","createNewPayees","addsAndUpdates","usedPayeeIds","reconcileTransactions","hasMatched","updated","transactionsStep1","fuzzyDataset","transactionsStep2","transactionsStep3","existing","updates","hasFieldsChanged","finalTransaction","batchUpdateTransactions","runTransfers","newTransactions","syncAccount","latestTransaction","startingTransaction","acctRow","startingDay","currentBalance","previousBalance","oldestDate","initialId","lowerCase","specials","character","convertToRegExp","parseMatch","lead","forced","lower","parsedMatch","fullLower","customSpecials","special","replaceRegExp","conjunctions","articles","prepositions","intended","allRules","unlistenSync","firstcharIndexer","payeeIndexer","resetState","invert","fromEntries","internalFields","schemaConfig","views","publicFields","fromInternalField","toInternalField","ruleModel","requiredFields","toJS","parseArray","fromJS","makeRule","FIELD_TYPES","getMappings","loadRules","addSyncListener","onApplySync","getRules","insertRule","updateRule","deleteRule","oldValues","newValues","newValue","oldRule","tombstone","tables","finalTrans","allChanges","conditionsToAQL","recurDateBounds","filters","$and","$lt","$transform","$eq","$or","$gte","$lte","applyActions","transactionIds","parsedActions","getRulesForPayee","getIsSetterRules","condField","actionField","condValue","actionValue","getOneOfSetterRules","updatePayeeRenameRule","fromNames","renameRule","getProbableCategory","winner","updateCategoryRules","payeeIds","transIds","register","toDateRepr","partitionByField","categoriesToSet","latestTrans","ruleSetters","newRule","migrateOldRules","allPayees","payeesById","rulesByPayeeId","payeeRules","r","payeeRule","catRules","ids","prevMode","connection","idsWithChildren","whereIds","whereIn","rows","getTransactionsByIds","incrFetch","where","learnCategories","detectOrphanPayees","addedIds","updatedIds","deletedIds","oldPayees","descUpdatedIds","allAdded","allUpdated","allDeleted","resultAdded","resultUpdated","transfer","newPayeeIds","allOrphaned","orphanedIds","updatedPayeeIds","getPayee","getTransferredAccount","clearCategory","transferAcct","fromOffBudget","toOffBudget","addTransfer","transferredAccount","fromPayee","parent_id","categoryCleared","removeTransfer","transferTrans","is_child","updateTransfer","onInsert","onDelete","onUpdate","transactionModel","models","toExternal","fromExternal","imported_description","financial_id","transferred_id","accountModel","categoryModel","cat_group","categoryGroupModel","payeeModel","payeeRuleModel","resolveName","IMPORT_MODE","APIError","withMutation","latestTimestamp","getClock","getNumClients","dataset","undoDisabled","validateMonth","validateExpenseCategory","batchPromise","currentId","avoidUpload","markCacheDirty","cloudStorage","catch","getCellValue","incomeAvailable","lastMonthOverspent","forNextMonth","totalBudgeted","fromLastMonth","totalIncome","totalSpent","totalBalance","received","startMonth","ungroupTransactions","serverHandlers","App","services","events","mitt","unlistenServices","service","combine","apps","app","listeners","listener","startServices","stopServices","unlisten","createApp","_uid","resetUid","uid","tableName","CompileError","nativeDateToInt","pad","dateToInt","addTombstone","schema","tableId","whereStr","hasTombstone","popPath","isKeyword","quoteAlias","typed","literal","getFieldDescription","fieldDesc","makePath","initialTable","ref","joinTable","parentParts","parentPath","parentDesc","joinField","resolvePath","fullName","implicitTableName","pathInfo","transformField","implicitTableId","refPath","refPathInfo","noMapping","fieldStr","parseMonth","badDateFormat","inferParam","existingType","paramType","casts","float","castInput","expr2","castedExpr","valArray","types","validateArgLength","saveStack","compileStack","prettyValue","expanded","getCompileError","stackStr","fieldRef","opData","rootMethod","methodArgs","compileLiteral","compileExpr","implicitField","paramName","namedParameters","compileFunction","assertType","acceptedTypes","assertArgLength","argExprs","arg1","orders","compileOrderBy","arg2","arg3","conds","compileConditions","compileOp","opExpr","rhs","lhs","left","right","condsObj","compiled","compileAnd","compileOr","compileWhere","compileJoins","tableRef","internalTableFilters","joins","dependencies","expandStar","compileSelect","isAggregate","outputTypes","compileGroupBy","$dir","AGGREGATE_FUNCTIONS","isAggregateFunction","ex","isAggregateQuery","queryState","compileQuery","tableViews","tableFilters","customizeQuery","isJoin","view","dependences","sqlPieces","defaultConstructQuery","generateSQLWithState","generateSQL","applyTypes","convertOutputType","runCompiledQuery","pieces","executors","paramArray","convertInputType","isRequired","required","fromDateRepr","conform","skipNull","tableSchema","convertForInsert","rawObj","default","convertForUpdate","convertFromSelect","toGroup","parents","mapper","childs","execTransactions","splitType","execTransactionsBasic","execTransactionsGrouped","_isUnhappy","isHappyPathQuery","whereDead","allSql","matched","rowSql","finalSql","allRows","pid","_parent_id","_unmatched","next_date","completed","posts_transaction","_payee","_account","_amount","_amountOp","_conditions","_actions","$condition","$nocase","v_payees","v_categories","v_schedules","v_transactions_internal","v_transactions_internal_alive","v_transactions","_runCompiledQuery","schemaExecutors","_runQuery","selectFields","as","needsAs","makeViews","viewStrs","fieldMappings","viewName","publicMaker","overrides","internalMaker","LATEST_BACKUP_FILENAME","serviceInterval","getBackups","budgetDir","backupDir","backups","b1","b2","getLatestBackup","isLatest","getAvailableBackups","latestBackup","backup","updateBackups","byDay","removed","dayBackups","isToday","currentBackups","makeBackup","backupId","backupPath","sqlite","toRemove","loadBackup","stopBackupService","startBackupService","lastSyncedTimestamp","lastUploaded","clearInterval","setInterval","getSheetValue","cell","calcBufferedAmount","buffered","getBudgetTable","budgetType","isReflectBudget","isZeroBudget","dbMonth","getBudgetData","getAllMonths","createdMonths","latest","getBudget","setBuffer","setCarryover","copyPreviousMonth","prevMonth","budgetData","prevBudget","setZero","set3MonthAvg","prevMonth1","prevMonth2","prevMonth3","spent1","spent2","spent3","avg","setAllFuture","holdForNextMonth","bufferedAmount","holdForFutureMonths","resetHold","coverOverspending","toBudgeted","leftover","leftoverFrom","amountCovered","fromBudgeted","transferAvailable","transferCategory","setCategoryCarryover","mutator","undoable","mergeUpdates","merged","getBudgetType","getBudgetRange","prevSheetName","createDynamic","initialValue","rollover","report","sumAmounts","handleAccountChange","oldValue","recompute","handleTransactionChange","changedFields","handleCategoryMappingChange","handleCategoryChange","addDeps","addDependencies","removeDeps","removeDependencies","handleCategoryGroupChange","handleBudgetMonthChange","handleBudgetChange","triggerBudgetChanges","old","getChangedValues","doTransfer","categoryIds","totalValue","transferValue","setMeta","createAllBudgets","earliestTransaction","newMonths","setType","nodes","getNodes","cellName","deleteCell","startCacheBarrier","bounds","endCacheBarrier","createStatic","sumAmount","prevCarryover","prevLeftover","refresh","createSummary","income","getBlankSheet","blankMonth","createBlankCategory","createBlankMonth","prevLeftoverPos","flatten2","unflatten2","amounts","lastOverspent","blankSheet","clearSheet","UPLOAD_FREQUENCY_IN_DAYS","checkHTTPStatus","HTTPError","fetchJSON","checkKey","userToken","cloudFileId","encryptKeyId","SYNC_SERVER","fileId","reason","encryption","hasKey","resetSyncState","newKeyState","IS_BETA","PostError","keyId","keySalt","testContent","exportBuffer","rawDbContent","memDb","dbContent","resetClock","metaContent","fileData","dbEntry","metaEntry","FileDownloadError","encryptMeta","dbFile","metaFile","upload","FileUploadError","zipContent","uploadContent","uploadMeta","encrypted","isMissingKey","possiblyUpload","listRemoteFiles","download","arrayBuffer","ab","dbPath","getDatabasePath","setDatabase","reopenDatabase","db_","resetQueryCache","getDatabase","loadClock","clock","deserializeClock","setClock","Timestamp","makeClientId","makeClock","serializeClock","_queryCache","LRU","cached","prepared","firstSync","sendMessages","insertWithUUID","delete_","selectWithSchema","selectFirstWithSchema","insertWithSchema","updateWithSchema","getCategoriesGrouped","insertCategoryGroup","lastGroup","SORT_INCREMENT","moveCategoryGroup","targetId","shoveSortOrders","insertCategory","id_","lastCat","moveCategory","existingTransfers","mapping","insertPayee","deleteTransferPayee","mergePayees","groupById","getOrphanedPayees","getPayeeByName","insertPayeeRule","insertAccount","moveAccount","getTransaction","_addFragmentForAccount","addWhere","showClosed","showOffbudget","fragment","getTransactionsByDate","insertTransaction","allMappings","loadMappings","getMapping","midpoint","below","above","terms","makeQuery","pageCount","fetchedIds","ids2","ENCRYPTION_ALGORITHM","sha256String","createHash","digest","masterKey","masterKeyBuffer","iv","cipher","createCipheriv","final","authTag","getAuthTag","algorithm","decipher","createDecipheriv","setAuthTag","decrypted","createKey","secret","createKeyBuffer","importKey","numBytes","pbkdf2Sync","Key","createFromPassword","password","internals","createFromBase64","loadKey","keyInstance","unloadKey","unloadAllKeys","statusCode","responseBody","SyncError","TransactionError","isCodeError","YNAB4","YNAB5","unresolveName","SyncPb","DEMO_BUDGET_ID","TEST_BUDGET_ID","UNCONFIGURED_SERVER","onSheetChange","names","_getNode","undo","redo","withUndo","term","latestDate","notPaged","groupCategories","payeeCounts","mergeIds","orphaned","validateRule","runValidation","conditionErrors","ruleFieldTypes","actionErrors","someDeletionsFailed","nodeSheet","getNode","createQuery","accts","upgradingId","balance_available","balance_limit","stopPolling","cb","matchedTransactions","updatedAccounts","linkToken","link_token","maxMonths","tracking","trackUsage","autoUpdate","floatingSidebar","seenTutorial","encryptKey","stringToInteger","getDefaultDocumentDir","prefsToSet","resetSync","repairSync","makeTestMessage","seenSubscribe","BASE_SERVER","bootstrapped","SIGNUP_SERVER","offline","setServer","fullSync","prefsPath","findBudgets","recomputeAll","showUpdate","initialFullSync","currentPrefs","trackSizes","getFileSize","dbSize","cacheSize","testMode","testBudgetId","clearFullSyncTimeout","uniqueFileName","idFromFileName","sqliteDb","budgetVersion","updateVersion","logger","setNode","Platform","isWeb","isMobile","__TESTING__","syncMigrations","clearUndo","unseen","installAPI","injectAPI","schedulesApp","budgetApp","notesApp","toolsApp","ACTUAL_DOCUMENT_DIR","setupDocumentsDir","ensureExists","initApp","isDev","socketName","keysStr","lastBudget","$send","$query","$q","$db","$setSyncingMode","ACTUAL_APP_VERSION","dataDir","serverURL","ACTUAL_SERVER_URL","cwd","sendMessage","syncAndReceiveMessages","merkle","SyncProtoBuf","addEventListener","shutdown","trie","keyToTimestamp","fullkey","hash","millis","insertKey","build","timestamps","trie1","trie2","node1","node2","keyset","diffkey","next1","next2","MIGRATIONS_DIR","javascriptMigrations","m1632571489012","withMigrationsDir","oldDir","getMigrationsDir","getMigrationId","getUpMigration","getAppliedMigrations","getMigrationList","migrationsDir","m1","m2","getPending","appliedIds","applyJavaScript","dbInterface","applySql","applyMigration","checkDatabaseValidity","migrate","migration","validateAccountType","categoryGroup","validateType","isParent","isChild","runningMethods","currentContext","mutatingMethods","globalMutationsEnabled","_latestHandlerNames","isMutating","flushRunningMethods","wait","undoTag","promise","enableGlobalMutations","disableGlobalMutations","sequential","initialContext","finally","withMutatorContext","prevContext","getMutatorContext","counters","unrecord","increment","isDesktop","throwIfNot200","contentType","postBinary","loadPrefs","dummyTestPrefs","savePrefs","avoidSync","messages","unloadPrefs","getPrefs","getDefaultPrefs","readPrefs","arr1","arr2","updateConditions","newConditions","scheduleConds","extractScheduleConds","newScheduleConds","replacements","getNextDate","dateCond","getRuleForSchedule","ruleId","fixRuleForSchedule","newId","setNextDate","newNextDate","nd","base_next_date","base_next_date_ts","local_next_date","local_next_date_ts","createSchedule","scheduleId","nextDateRepr","nextDateId","schedule_id","updateSchedule","resetNextDate","oldConditions","stripType","deleteSchedule","skipNextDate","getPossibleTransactions","discoverSchedules","findSchedules","getUpcomingDates","onRuleUpdate","payeeIdx","accountIdx","amountIdx","dateIdx","trackJSONPaths","found","postTransactionForSchedule","getScheduledAmount","advanceSchedulesService","syncSuccess","getHasTransactionsQuery","hasTransData","hasTrans","failedToPost","didPost","getStatus","syncDisabled","subtype","completeEvent","lastScheduleRun","takeDates","getRank","day1","day2","dayDiff","matchSchedules","allOccurs","partialMatchRank","baseOccur","occurs","occur","rank","exactAmount","exact","exactDate","schedulesForPattern","baseStart","numDays","baseConfig","weekly","every2weeks","monthly","monthlyLastDay","s1","s2","monthly1stor3rd","dayValue","monthly2ndor4th","findStartDate","currentConfig","prevConfig","allSchedules","finalized","joinURL","pathname","globalSheet","globalOnChange","globalCacheDb","updateSpreadsheetCache","rawDb","setCacheStatus","mainDb","cacheDb","clean","isCacheDirty","loadSpreadsheet","cacheEnabled","cachePath","Spreadsheet","cachedRows","loadUserBudgets","unloadSpreadsheet","unload","reloadSpreadsheet","startTransaction","budgetMonths","budgetMonth","sheetForMonth","endTransaction","getCell","waitOnSpreadsheet","onFinish","firstValue","Graph","serialized","graph","addNode","adjacent","adjacentIncoming","addEdge","removeEdge","removeIncomingEdges","topologicalSort","generateDOT","getEdges","edges","incomingEdges","incoming","iter","cur","topologicalSortUntil","visited","sorted","sourceNodes","edgeStrings","adj","edge","saveCache","dirtyCells","computeQueue","_meta","hasCell","cells","queueComputation","cellNames","running","runComputations","_dependencies","dep","markCacheSafe","cacheBarrier","pendingChange","getExpr","getCellExpr","getCellValueLoose","bootup","onReady","_markDirty","dynamic","resolved","voidCell","voidValue","newDeps","triggerDatabaseChanges","resolveNamesAsObjects","sheets","resolveNamesAsArrays","coerceBuffer","encode","requestPb","SyncRequest","envelopePb","MessageEnvelope","setTimestamp","messagePb","setDataset","setRow","setColumn","setValue","binaryMsg","EncryptedData","setIv","setAuthtag","setContent","setIsencrypted","addMessages","setGroupid","setFileid","setKeyid","setSince","decode","responsePb","SyncResponse","getMerkle","getMessagesList","getTimestamp","getIsencrypted","binary","getContent","getIv","getAuthtag","getDataset","getRow","getColumn","FULL_SYNC_DELAY","SYNCING_MODE","checkSyncingMode","partIds","serializeValue","deserializeValue","_syncListeners","compareMessages","newMessages","timestampStr","applyMessagesForImport","applyMessages","t1","t2","idsPerTable","fetchData","setIn","oldData","currentMerkle","getIn","setBudgetType","newData","getTablesFromMessages","prevData","receiveMessages","recv","_sendMessages","scheduleFullSync","IS_BATCHING","_BATCHED","batched","getMessagesSince","localMessages","syncTimeout","_fullSync","sinceTimestamp","prevDiffTime","encoder","resBuffer","localTimeChanged","receivedMessages","diffTime","rebuiltMerkle","rebuildMerkleHash","numMessages","clocks","randomString","migrateParentIds","toApply","parentId","_unlisten","listen","opt_data","repeatedFields_","opt_includeInstance","includeInstance","getIv_asB64","authtag","getAuthtag_asB64","getData_asB64","$jspbMessageInstance","reader","deserializeBinaryFromReader","writer","serializeBinaryToWriter","getIv_asU8","getAuthtag_asU8","getData_asU8","isencrypted","getContent_asB64","getContent_asU8","messagesList","fileid","groupid","keyid","getFileid","getGroupid","getKeyid","getSince","setMessagesList","opt_value","opt_index","clearMessagesList","setMerkle","rebuilt","keyState","clock_","MutableTimestamp","maxDrift","counter","_state","murmurhash","setMillis","setCounter","phys","lOld","cOld","lNew","cNew","ClockDriftError","OverflowError","lMsg","cMsg","isoString","DuplicateNodeError","blankPayeeRows","parentPayee","clearedRows","deletedRows","numBlankPayees","numCleared","numDeleted","currentUniqueId","mixpanel","isEnabled","toggle","hashed","isAnonymous","login","BUFFERING","startBuffering","stopBuffering","distinct_id","setProfile","MESSAGE_HISTORY","CURSOR","HISTORY_SIZE","trimHistory","markers","cutoff","appendMessages","undoListening","marker","applyUndoAction","undoMessage","oldItem","redoResurrections","resurrect","runMigrations","migrations","updateViews","hashKey","currentHash","existingFiles","initialName","newName","prettyAccountType","determineOffBudget","sequenceState","queue","pump","onceFn","IS_TESTING","month1","month2","_range","inclusive","rangeInclusive","_dayRange","dayRange","dayRangeInclusive","getMonthIndex","getYearStart","getYearEnd","nameForMonth","getDateFormatRegex","memoizeOne","getDayMonthFormat","getDayMonthRegex","getMonthYearFormat","getMonthYearRegex","getShortYearFormat","getShortYearRegex","TYPE_INFO","amountInflow","amountOutfow","mapField","friendlyOp","deserializeField","getFieldError","unparse","inputKey","unparsed","makeValue","currencyToAmount","makeNumberSuffix","prettyDayName","SU","TU","WE","getRecurringDescription","p1","p2","typeOrder","valOrder","strs","uniqueDays","dayName","abbrevDay","dayNames","SplitTransactionError","makeChild","findParentIndex","getSplit","parentIndex","groupTransaction","ungroupTransaction","applyTransactionDiff","groupedTrans","applyChanges","replaceTransactions","transactionsCopy","newSplit","_deleted","diffItems","newTrans","addSplitTransaction","prevSub","splitTransaction","realizeTempTransactions","currencyFormatter","cleanUUID","mergeObjects","composeCellChanges","flattenArray","arrays","shallowEqual","numKeysA","numKeysB","obj1","obj2","hasChanged","groupBySingle","_groupById","newItems","newGrouped","newItem","debugMemoFailure","prevProps","nextProps","throwError","set1","set2","finalSet","titleFirst","numberFormats","label","numberFormat","setNumberFormat","separator","getNumberFormat","toRelaxedNumber","currencyToInteger","toRelaxedInteger","integerToCurrency","amountToCurrency","amountToPrettyCurrency","semverToNumber"],"mappings":";;QAAA;QACA;;QAEA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;QAEA;QACA;QACA;QACA,cAAc;QACd,IAAI;QACJ;;;QAGA;QACA;;;;;;;;;;;;;AC/FA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAgBA,MAAMA,mBAAN,CAA0B;AACxBC,aAAW,CAACC,IAAI,GAAG,EAAR,EAAY;AACrB,SAAKC,QAAL,GAAgBD,IAAI,CAACC,QAAL,KAAkBC,SAAlB,GAA8BF,IAAI,CAACC,QAAnC,GAA8C,IAA9D;AACA,SAAKE,WAAL,GAAmBH,IAAI,CAACG,WAAL,IAAoB,CAAvC;AACD;AACD;;;AACa,MAATC,SAAS,GAAG;AACd,QAAI,KAAKC,UAAL,KAAoBH,SAAxB,EAAmC,OAAO,KAAKG,UAAZ;;AACnC,UAAMC,KAAK,GAAG,KAAKC,I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AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACEzR,aAAW,CAACiC,OAAO,GAAG,EAAX,EAAe;AACxB,UAAMA,OAAN;AACA,SAAKmQ,MAAL,GAAc,EAAd;AACA,SAAKC,OAAL,GAAe,EAAf;;AACA,SAAK,MAAM1J,IAAX,IAAmB,CAAC,QAAD,EAAW,SAAX,CAAnB,EAA0C;AACxC,YAAM2J,GAAG,GAAGrQ,OAAO,CAAC0G,IAAD,CAAnB;;AACA,UAAI2J,GAAJ,EAAS;AACP,aAAK3J,IAAL,IAAa2J,GAAG,CAACpO,GAAJ,CAAQqO,QAAQ,IAAI;AAC/B,cAAIA,QAAQ,YAAYjB,IAAxB,EAA8B;AAC5B,mBAAOiB,QAAQ,CAAC5L,GAAT,CAAa,UAAb,EAAyB,KAAKzG,QAA9B,CAAP;AACD,WAFD,MAEO;AACL,mBAAO,IAAIoR,IAAJ,CAASiB,QAAT,EAAmB;AACxBrS,sBAAQ,EAAE,KAAKA;AADS,aAAnB,CAAP;AAGD;AACF,SARY,CAAb;AASD;AACF;;AACD,SAAK,MAAMyI,IAAX,IAAmB,CAAC,QAAD,EAAW,SAAX,CAAnB,EAA0C;AACxC,YAAM2J,GAAG,GAAGrQ,OAAO,CAAC0G,IAAD,CAAnB;;AACA,UAAI2J,GAAJ,E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A;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAC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,qBAAqB,GAAG,KAA5B;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACe,SAASC,cAAT,CAAwB50C,SAAxB,EAAmC60C,aAAnC,EAAkD9J,YAAlD,EAAgE;AAC7E,MAAI7qC,SAAS,CAAClJ,MAAV,GAAmB,CAAvB,EAA0B;AACxB,UAAM,IAAImJ,SAAJ,CACJ,oCAAoCD,SAAS,CAAClJ,MAA9C,GAAuD,UADnD,CAAN;AAGD;;AAED,MAAIlF,OAAO,GAAGi5C,YAAY,IAAI,EAA9B;AACA,MAAIhI,MAAM,GAAGjxC,OAAO,CAACixC,MAAR,IAAkB8Q,8DAA/B;;AAEA,MAAI,CAAC9Q,MAAM,CAAC6R,cAAZ,EAA4B;AAC1B,UAAM,IAAIzJ,UAAJ,CAAe,6CAAf,CAAN;AACD;;AAED,MAAI2J,UAAU,GAAGpG,oEAAU,CAAC1uC,SAAD,EAAY60C,aAAZ,CAA3B;;AAEA,MAAIp2C,KAAK,CAACq2C,UAAD,CAAT,EAAuB;AACrB,UAAM,IAAI3J,UAAJ,CAAe,oBAAf,CAAN;AACD;;AAED,MAAI4J,eAAe,GAAGpQ,yEAAW,CAAC7yC,OAAD,CAAjC;AACAijD,iBAAe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AgC;AACrC,aAAOvS,MAAM,CAAC6R,cAAP,CAAsB,YAAtB,EAAoCW,KAApC,EAA2CR,eAA3C,CAAP,CADqC,CAGrC;AACD,KAJM,MAIA;AACL,aAAOhS,MAAM,CAAC6R,cAAP,CAAsB,cAAtB,EAAsCW,KAAK,GAAG,CAA9C,EAAiDR,eAAjD,CAAP;AACD;AACF;AACF,C;;;;;;;;;;;;AC9OD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AAEA,IAAIP,cAAc,GAAG,IAArB;AACA,IAAIE,gBAAgB,GAAG,KAAvB;AACA,IAAIc,eAAe,GAAG,MAAtB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACe,SAASC,oBAAT,CACbz1C,SADa,EAEb60C,aAFa,EAGb9J,YAHa,EAIb;AACA,MAAI7qC,SAAS,CAAClJ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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;AC3LA;AAAA;AAAA;AAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACe,SAASjI,OAAT,CAAiB2M,SAAjB,EAA4BiuC,kBAA5B,EAAgD;AAC7D,MAAI/tC,SAAS,CAAClJ,MAAV,GAAmB,CAAvB,EAA0B;AACxB,UAAM,IAAImJ,SAAJ,CACJ,oCAAoCD,SAAS,CAAClJ,MAA9C,GAAuD,UADnD,CAAN;AAGD;;AAED,MAAIhE,IAAI,GAAGq3C,gEAAM,CAACrqC,SAAD,CAAjB;AACA,MAAImuC,aAAa,GAAG9D,gEAAM,CAAC4D,kBAAD,CAA1B;AACA,SAAOj7C,IAAI,CAAC0N,OAAL,KAAiBytC,aAAa,CAACztC,OAAd,EAAxB;AACD,C;;;;;;;;;;;;AClCD;AAAA;AAAA;AAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACe,SAASpO,QAAT,CAAkB0N,SAAlB,EAA6BiuC,kBAA7B,EAAiD;AAC9D,MAAI/tC,SAAS,CAAClJ,MAAV,GAAmB,CAAvB,EAA0B;AACxB,UAAM,IAAImJ,SAAJ,CACJ,oCAAoCD,SAAS,CAAClJ,MAA9C,GAAuD,UADnD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AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACe,SAASQ,OAAT,CAAiB9zC,SAAjB,EAA4B;AACzC,MAAIE,SAAS,CAAClJ,MAAV,GAAmB,CAAvB,EAA0B;AACxB,UAAM,IAAImJ,SAAJ,CACJ,mCAAmCD,SAAS,CAAClJ,MAA7C,GAAsD,UADlD,CAAN;AAGD;;AAED,MAAIhE,IAAI,GAAGq3C,gEAAM,CAACrqC,SAAD,CAAjB;AACA,SAAO,CAACvB,KAAK,CAACzL,IAAD,CAAb;AACD,C;;;;;;;;;;;;ACpED;AAAA;AAAA;AAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACe,SAASinD,WAAT,CAAqBj6C,SAArB,EAAgC;AAC7C,MAAIE,SAAS,CAAClJ,MAAV,GAAmB,CAAvB,EAA0B;AACxB,UAAM,IAAImJ,SAAJ,CACJ,mCAAmCD,SAAS,CAAClJ,MAA7C,GAAsD,UADlD,CAAN;AAGD;;AAED,SAAOqzC,gEAAM,CAACrqC,SAAD,CAAN,CAAkBszC,MAAlB,OAA+B,CAAtC;AACD,C;;;;;;;;;;;;AC/BD;AAAA;AAAA;AAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACe,SAASpB,SAAT,CAAmBlyC,SAAnB,EAA8B;AAC3C,MAAIE,SAAS,CAAClJ,MAAV,GAAmB,CAAvB,EAA0B;AACxB,UAAM,IA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IAAP;AACD,C;;;;;;;;;;;;AChED;AAAA;AAAA;AAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACe,SAASynD,aAAT,CAAuBz6C,SAAvB,EAAkC;AAC/C,MAAIE,SAAS,CAAClJ,MAAV,GAAmB,CAAvB,EAA0B;AACxB,UAAM,IAAImJ,SAAJ,CACJ,mCAAmCD,SAAS,CAAClJ,MAA7C,GAAsD,UADlD,CAAN;AAGD;;AAED,MAAIhE,IAAI,GAAGq3C,gEAAM,CAACrqC,SAAD,CAAjB;AACA,MAAI1E,IAAI,GAAGtI,IAAI,CAAC+a,WAAL,EAAX;AACA/a,MAAI,CAAC+5C,WAAL,CAAiBzxC,IAAI,GAAG,CAAxB,EAA2B,CAA3B,EAA8B,CAA9B;AACAtI,MAAI,CAACg6C,QAAL,CAAc,CAAd,EAAiB,CAAjB,EAAoB,CAApB,EAAuB,CAAvB;AACA,SAAOh6C,IAAP;AACD,C;;;;;;;;;;;;ACpCD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;CAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,IAAIugD,sBAAsB,GAAG,gCAA7B;AAEA,IAAIE,mBAAmB,GAAG,YAA1B;AACA,IAAIC,iBAAiB,GAAG,KAAxB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACe,SAASgH,WAAT,CAAqB16C,SAArB,EAAgC2zC,c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UAAS66B,MAAT,EAAiBoF,KAAjB,EAAwBp1B,KAAxB,EAA+Bre,OAA/B,EAAwC;AAC7C,aAAO+uD,oBAAoB,CAAC1gB,MAAD,CAA3B;AACD,KAJA;AAKD3pC,OAAG,EAAE,UAASxD,IAAT,EAAeqqB,KAAf,EAAsB9sB,KAAtB,EAA6BuB,OAA7B,EAAsC;AACzC,aAAO,CAAC,IAAIqJ,IAAJ,CAAS5K,KAAT,CAAD,EAAkB;AAAE6xD,sBAAc,EAAE;AAAlB,OAAlB,CAAP;AACD;AAPA;AArmCS,CAAd;AAgnCeR,sEAAf,E;;;;;;;;;;;;ACj3CA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAKA,IAAIS,sBAAsB,GAAG,EAA7B,C,CAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,IAAI9O,sBAAsB,GAAG,uDAA7B;AAEA,IAAIE,mBAAmB,GAAG,YAA1B;AACA,IAAIC,iBAAiB,GAAG,KAAxB;AAEA,IAAI4O,mBAAmB,GAAG,IAA1B;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACe,SAASh9C,KAAT,CACbi9C,eADa,EAEbC,iBAFa,EAGb3N,aAHa,EAIb9J,YAJa,EAKb;AACA,MAAI7qC,SAAS,CAAClJ,MAAV,GAAmB,CAAvB,EAA0B;AACxB,UAAM,IAAImJ,SAAJ,CACJ,oCAAoCD,SAAS,CAAClJ,MAA9C,GAAuD,UADnD,CAAN;AAGD;;AAED,MAAIyrD,UAAU,GAAGjuB,MAAM,CAAC+tB,eAAD,CAAvB;AACA,MAAIG,YAAY,GAAGluB,MAAM,CAACguB,iBAAD,CAAzB;AACA,MAAI1wD,OAAO,GAAGi5C,YAAY,IAAI,EAA9B;AAE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,OAAO,GAAGv1C,uEAAS,CAACgnD,YAAD,CAAvB;AACA3zD,MAAI,CAACm3C,UAAL,CAAgB+K,OAAhB;AACA,SAAOliD,IAAP;AACD,C;;;;;;;;;;;;ACpCD;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACe,SAAS4zD,OAAT,CAAiB5mD,SAAjB,EAA4BmsC,SAA5B,EAAuCpB,YAAvC,EAAqD;AAClE,MAAI7qC,SAAS,CAAClJ,MAAV,GAAmB,CAAvB,EAA0B;AACxB,UAAM,IAAImJ,SAAJ,CACJ,oCAAoCD,SAAS,CAAClJ,MAA9C,GAAuD,UADnD,CAAN;AAGD;;AAED,MAAIhE,IAAI,GAAGq3C,gEAAM,CAACrqC,SAAD,CAAjB;AACA,MAAI6mC,IAAI,GAAGlnC,uEAAS,CAACwsC,SAAD,CAApB;AACA,MAAI3sC,IAAI,GAAG23C,iEAAO,CAACnkD,IAAD,EAAO+3C,YAAP,CAAP,GAA8BlE,IAAzC;AACA7zC,MAAI,CAACw5C,OAAL,CAAax5C,IAAI,CAACib,OAAL,KAAiBzO,IAAI,GAAG,CAArC;AACA,SAAOxM,IAAP;AACD,C;;;;;;;;;;;;AC3DD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACe,SAAS6zD,W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,GAAG,CACA5iB,KADH,CACS,GADT,EAEGtd,GAFH,CAEO2K,CAAC,IAAI;AACR,WAAO,CAAC,QAAQA,CAAC,CAAC4R,OAAF,CAAU,SAAV,EAAqB,EAArB,CAAT,EAAmCtX,KAAnC,CAAyC,CAAC,CAA1C,CAAP;AACD,GAJH,EAKG+Y,IALH,CAKQ,EALR,CAFW,CAAf;AASD,C;;;;;;;;;;;AC/XD,2C;;;;;;;;;;;ACAA,mC;;;;;;;;;;;ACAA,+B;;;;;;;;;;;ACAA,uC;;;;;;;;;;;ACAA,wC;;;;;;;;;;;ACAA,iC;;;;;;;;;;;ACAA,mC;;;;;;;;;;;ACAA,2C;;;;;;;;;;;ACAA,iC;;;;;;;;;;;ACAA,iC","file":"bundle.api.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// object to store loaded chunks\n \t// \"0\" means \"already loaded\"\n \tvar installedChunks = {\n \t\t\"main\": 0\n \t};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// uncaught error handler for webpack runtime\n \t__webpack_require__.oe = function(err) {\n \t\tprocess.nextTick(function() {\n \t\t\tthrow err; // catch this error by using import().catch()\n \t\t});\n \t};\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = \"./packages/loot-core/src/server/main.js\");\n","import {\n ArgumentError,\n getDifferenceBetweenWeekdays,\n DateAdapterBase as DateAdapterBase$1,\n dateInputToDateTime,\n dateInputToDateAdapter,\n normalizeDateTimeTimezone as normalizeDateTimeTimezone$1,\n InfiniteLoopError,\n dateTimeSortComparer,\n cloneRuleOptions,\n normalizeRuleOptions,\n RecurrenceRulesIterator,\n recurrenceRulesReducer,\n DateTime as DateTime$1,\n} from '@rschedule/core';\n\nclass OccurrenceGenerator {\n constructor(args = {}) {\n this.timezone = args.timezone !== undefined ? args.timezone : null;\n this.maxDuration = args.maxDuration || 0;\n }\n /** Returns the first occurrence or, if there are no occurrences, null. */\n get firstDate() {\n if (this._firstDate !== undefined) return this._firstDate;\n const start = this._run().next().value;\n this._firstDate = start ? this.dateAdapter.fromDateTime(start) : null;\n return this._firstDate;\n }\n /** If generator is infinite, returns `null`. Otherwise returns the end date */\n get lastDate() {\n if (this._lastDate !== undefined) return this._lastDate;\n if (this.isInfinite) {\n this._lastDate = null;\n return null;\n }\n const end = this._run({ reverse: true }).next().value;\n this._lastDate = end ? this.dateAdapter.fromDateTime(end) : null;\n return this._lastDate;\n }\n pipe(...operators) {\n return operators.reduce((prev, curr) => curr({ base: prev, timezone: this.timezone }), this);\n }\n /**\n * Processes the object's rules/dates and returns an iterable for the occurrences.\n *\n * Options object:\n * - `start` the date to begin iteration on\n * - `end` the date to end iteration on\n * - `take` the max number of dates to take before ending iteration\n * - `reverse` whether to iterate in reverse or not\n *\n * Examples:\n *\n * ```\n * const iterator = schedule.occurrences({ start: new Date(), take: 5 });\n \n * for (const date of iterator) {\n * // do stuff\n * }\n \n * iterator.toArray() // returns Date array\n * iterator.next().value // returns next Date\n * ```\n *\n */\n occurrences(args = {}) {\n return new OccurrenceIterator(this, this.normalizeOccurrencesArgs(args));\n }\n /**\n * Iterates over the object's occurrences and bundles them into collections\n * with a specified granularity (default is `\"YEARLY\"`). Make sure to\n * read about each option & combination of options below.\n *\n * Options object:\n * - start?: DateAdapter\n * - end?: DateAdapter\n * - take?: number\n * - reverse?: NOT SUPPORTED\n * - granularity?: CollectionsGranularity\n * - weekStart?: DateAdapter.Weekday\n * - skipEmptyPeriods?: boolean\n *\n * Returned `Collection` object:\n *\n * - `dates` property containing an array of DateAdapter objects.\n * - `granularity` property containing the granularity.\n * - `CollectionsGranularity` === `RuleOptions.Frequency`.\n * - default is `\"YEARLY\"`\n * - `periodStart` property containing a DateAdapter equal to the period's\n * start time.\n * - `periodEnd` property containing a DateAdapter equal to the period's\n * end time.\n *\n * #### Details:\n *\n * `collections()` always returns full periods. This means that the `start` argument is\n * transformed to be the start of whatever period the `start` argument is in, and the\n * `end` argument is transformed to be the end of whatever period the `end` argument is\n * in.\n *\n * - Example: with granularity `\"YEARLY\"`, the `start` argument will be transformed to be the\n * start of the year passed in the `start` argument, and the `end` argument will be transformed\n * to be the end of the year passed in the `end` argument.\n *\n * By default, the `periodStart` value of `Collection` objects produced by this method increments linearly.\n * This means the returned `Collection#dates` property may have length 0. This can be changed by\n * passing the `skipEmptyPeriods: true` option, in which case the `periodStart` from one collection to the\n * next can \"jump\".\n *\n * - Example 1: if your object's first occurrence is 2019/2/1 (February 1st) and you call\n * `collection({skipEmptyPeriods: true, granularity: 'DAILY', start: new Date(2019,0,1)})`\n * (so starting on January 1st), the first Collection produced will have a `periodStart` in February.\n *\n * - Example 2: if your object's first occurrence is 2019/2/1 (February 1st) and you call\n * `collection({granularity: 'DAILY', start: new Date(2019,0,1)})`\n * (so starting on January 1st), the first collection produced will have a `Collection#periodStart`\n * of January 1st and have `Collection#dates === []`. Similarly, the next 30 collections produced\n * (Jan 2nd - 31st) will all contain an empty array for the `dates` property. Then the February 1st\n * `Collection` will contain dates.\n *\n * When giving a `take` argument to `collections()`, you are specifying\n * the number of `Collection` objects to return (rather than occurrences).\n *\n * When choosing a granularity of `\"WEEKLY\"`, the `weekStart` option is required.\n *\n * When choosing a granularity of `\"MONTHLY\"`:\n *\n * - If the `weekStart` option *is not* present, will generate collections with\n * the `periodStart` and `periodEnd` at the beginning and end of each month.\n *\n * - If the `weekStart` option *is* present, will generate collections with the\n * `periodStart` equal to the start of the first week of the month, and the\n * `periodEnd` equal to the end of the last week of the month. This behavior could be\n * desired when rendering opportunities in a calendar view, where the calendar renders\n * full weeks (which may result in the calendar displaying dates in the\n * previous or next months).\n *\n */\n collections(args = {}) {\n return new CollectionIterator(this, this.normalizeCollectionsArgs(args));\n }\n /**\n * Returns true if an occurrence starts on or between the provided start/end\n * datetimes. If the `excludeEnds` option is provided, then occurrences\n * equal to the start/end times are ignored.\n *\n * If the occurrence generator has a duration, and `excludeEnds !== true`,\n * and a `maxDuration` argument is supplied (either in the constructor or\n * here), then any occurrence that's time overlaps with the start/end times\n * return true.\n */\n occursBetween(startInput, endInput, options = {}) {\n const start = this.normalizeDateInput(startInput);\n const end = this.normalizeDateInput(endInput);\n if (this.hasDuration && !options.excludeEnds) {\n const maxDuration = this.getMaxDuration('occursBetween', options);\n const iterator = this._run({\n start: start.subtract(maxDuration, 'millisecond'),\n end,\n reverse: true,\n });\n for (const day of iterator) {\n if (day.end.isBefore(start)) continue;\n return true;\n }\n return false;\n }\n for (const day of this._run({ start, end })) {\n if (options.excludeEnds) {\n if (day.isEqual(start)) {\n continue;\n }\n if (day.isEqual(end)) {\n break;\n }\n }\n return true;\n }\n return false;\n }\n occursOn(rawArgs) {\n const args = this.normalizeOccursOnArgs(rawArgs);\n if (args.weekday) {\n if (this.isInfinite && !args.before) {\n throw new ArgumentError(\n 'When calling `occursOn()` with a `weekday` argument ' +\n 'and an occurrence object that has infinite occurrences, ' +\n 'you must include a `before` argument as well.',\n );\n }\n const start = args.after && (args.excludeEnds ? args.after.add(1, 'day') : args.after);\n const end = args.before && (args.excludeEnds ? args.before.subtract(1, 'day') : args.before);\n const iterator = this._run({ start, end });\n let date = iterator.next().value;\n if (!date) return false;\n while (date) {\n if (date.get('weekday') === args.weekday) {\n return true;\n }\n date = iterator.next({\n skipToDate: date\n .add(getDifferenceBetweenWeekdays(date.get('weekday'), args.weekday), 'day')\n .granularity('day'),\n }).value;\n }\n return false;\n }\n if (!args.date) {\n throw new ArgumentError(\n `\"occursOn()\" must be called with either a \"date\" or \"weekday\" argument`,\n );\n }\n if (this.hasDuration) {\n const maxDuration = this.getMaxDuration('occursOn', args);\n const iterator = this._run({\n start: args.date.subtract(maxDuration, 'millisecond'),\n end: args.date,\n });\n for (const date of iterator) {\n if (date.end.isBefore(args.date)) continue;\n if (date.isAfter(args.date)) return false;\n return true;\n }\n return false;\n }\n for (const day of this._run({ start: args.date, end: args.date })) {\n return !!day;\n }\n return false;\n }\n /**\n * Returns true if an occurrence starts after the provided datetime.\n * If the `excludeStart` option is provided, then occurrences\n * equal to the provided datetime are ignored.\n *\n * If the occurrence generator has a duration, and `excludeStart !== true`,\n * and a `maxDuration` argument is supplied (either in the constructor or\n * here), then any occurrence that's end time is after/equal to the provided\n * datetime return true.\n */\n occursAfter(date, options = {}) {\n const adapter = this.normalizeDateInput(date);\n if (this.hasDuration && !options.excludeStart) {\n const maxDuration = this.getMaxDuration('occursAfter', options);\n const iterator = this._run({\n start: adapter.subtract(maxDuration, 'millisecond'),\n });\n for (const date of iterator) {\n if (date.end.isBefore(adapter)) continue;\n return true;\n }\n return false;\n }\n for (const day of this._run({ start: adapter })) {\n if (options.excludeStart && day.isEqual(adapter)) {\n continue;\n }\n return true;\n }\n return false;\n }\n /**\n * Returns true if an occurrence starts before the provided datetime.\n * If the `excludeStart` option is provided, then occurrences\n * equal to the provided datetime are ignored.\n *\n * If the occurrence generator has a duration, and `excludeStart` is\n * also provided, then this will only return true if an occurrence\n * both starts and ends before the provided datetime.\n */\n occursBefore(date, options = {}) {\n const adapter = this.normalizeDateInput(date);\n if (this.hasDuration && options.excludeStart) {\n for (const day of this._run({ end: adapter, reverse: true })) {\n if (day.end.isAfterOrEqual(adapter)) continue;\n return true;\n }\n return false;\n }\n for (const day of this._run({ end: adapter, reverse: true })) {\n if (options.excludeStart && day.isEqual(adapter)) {\n continue;\n }\n return true;\n }\n return false;\n }\n get dateAdapter() {\n return DateAdapterBase$1.adapter;\n }\n normalizeOccurrencesArgs(rawArgs) {\n return Object.assign(Object.assign({}, rawArgs), {\n start: this.normalizeDateInput(rawArgs.start),\n end: this.normalizeDateInput(rawArgs.end),\n });\n }\n normalizeCollectionsArgs(rawArgs) {\n if (rawArgs.reverse !== undefined) {\n throw new ArgumentError(\n '`collections()` does not support the `reverse` option at this time.',\n );\n }\n return Object.assign(Object.assign({}, rawArgs), {\n start: this.normalizeDateInput(rawArgs.start),\n end: this.normalizeDateInput(rawArgs.end),\n });\n }\n normalizeOccursOnArgs(rawArgs = {}) {\n return Object.assign(Object.assign({}, rawArgs), {\n date: this.normalizeDateInput(rawArgs.date),\n after: this.normalizeDateInput(rawArgs.after),\n before: this.normalizeDateInput(rawArgs.before),\n excludeDates:\n rawArgs.excludeDates && rawArgs.excludeDates.map(date => this.normalizeDateInput(date)),\n });\n }\n normalizeRunArgs(args) {\n return Object.assign(Object.assign({}, args), {\n start: this.normalizeDateInput(args.start),\n end: this.normalizeDateInput(args.end),\n });\n }\n normalizeDateInput(date) {\n return date ? dateInputToDateTime(date, this.timezone) : undefined;\n }\n normalizeDateInputToAdapter(date) {\n if (!date) return;\n return dateInputToDateAdapter(date);\n }\n normalizeRunOutput(date) {\n return normalizeDateTimeTimezone$1(date, this.timezone);\n }\n getMaxDuration(method, options) {\n const maxDuration = options.maxDuration || this.maxDuration;\n if (!Number.isInteger(maxDuration)) {\n throw new ArgumentError(\n `When an occurrence generator ` +\n `has a duration, a 'maxDuration' argument must be supplied ` +\n `to ${method}().`,\n );\n }\n return maxDuration;\n }\n}\nclass OccurrenceIterator {\n constructor(iterable, args) {\n this.iterable = iterable;\n this.args = args;\n // Need to assert the return type of these methods to prevent typescript from\n // incorrectly reducing them to `DateAdapterBase & { generators: G }`.\n this[Symbol.iterator] = () => this.occurrenceIterator();\n this.iterator = iterable._run(args);\n this.isInfinite = iterable.isInfinite;\n }\n next(args) {\n return this.occurrenceIterator(args).next();\n }\n toArray() {\n if (this.args.end || this.args.take || !this.isInfinite) {\n return Array.from(this.occurrenceIterator());\n }\n throw new InfiniteLoopError(\n 'OccurrenceIterator#toArray() can only be called if the iterator ' +\n 'is not infinite, or you provide and `end` argument, or you provide ' +\n 'a `take` argument.',\n );\n }\n *occurrenceIterator(rawArgs) {\n let args = this.normalizeRunArgs(rawArgs);\n let date = this.iterator.next(args).value;\n while (date) {\n const yieldArgs = yield this.normalizeDateOutput(date);\n args = this.normalizeRunArgs(yieldArgs);\n date = this.iterator.next(args).value;\n }\n return undefined;\n }\n normalizeRunArgs(args) {\n return {\n skipToDate: this.normalizeDateInput(args && args.skipToDate),\n };\n }\n normalizeDateInput(date) {\n return date ? dateInputToDateTime(date, this.iterable.timezone) : undefined;\n }\n normalizeDateOutput(date) {\n if (!date) return;\n return date ? DateAdapterBase$1.adapter.fromDateTime(date) : undefined;\n }\n}\nclass Collection {\n constructor(dates = [], granularity, periodStart, periodEnd) {\n this.dates = dates;\n this.granularity = granularity;\n this.periodStart = periodStart;\n this.periodEnd = periodEnd;\n }\n}\nclass CollectionIterator {\n constructor(iterable, args) {\n this.iterable = iterable;\n this.args = args;\n this.granularity = 'year';\n this[Symbol.iterator] = () => this.iterator;\n if (args.granularity) {\n this.granularity = args.granularity;\n if (this.granularity === 'week' && !args.weekStart) {\n throw new Error('\"week\" granularity requires `weekStart` arg');\n }\n }\n if (args.weekStart) {\n this.weekStart = args.weekStart;\n }\n if (args.reverse) {\n throw new Error(\n '`OccurrenceGenerator#collections()` does not support iterating in reverse. ' +\n 'Though `OccurrenceGenerator#occurrences()` does support iterating in reverse.',\n );\n }\n // Set the end arg, if present, to the end of the period.\n this.args = Object.assign(Object.assign({}, args), {\n start: args.start || iterable._run().next().value,\n end: args.end && this.getPeriod(args.end).end,\n });\n this.startDate =\n (this.args.start && this.normalizeDateOutput(this.getPeriod(this.args.start).start)) || null;\n this.iterator = this.collectionIterator();\n }\n next() {\n return this.iterator.next();\n }\n /**\n * While `next()` and `[Symbol.iterator]` both share state,\n * `toArray()` does not share state and always returns the whole\n * collections array.\n */\n toArray() {\n if (this.args.end || this.args.take || !this.iterable.isInfinite) {\n const collections = [];\n for (const collection of this.collectionIterator()) {\n collections.push(collection);\n }\n return collections;\n }\n throw new InfiniteLoopError(\n 'CollectionIterator#toArray() can only be called if the iterator ' +\n 'is not infinite, or you provide and `end` argument, or you provide ' +\n 'a `take` argument.',\n );\n }\n normalizeDateOutput(date) {\n if (!date) return;\n return DateAdapterBase$1.adapter.fromDateTime(date);\n }\n *collectionIterator() {\n if (!this.startDate) return;\n let iterator = this.occurrenceIterator();\n let date = iterator.next().value;\n if (!date) return;\n // `period` === `periodStart` unless the granularity\n // is `MONTHLY` and a `weekStart` param was provided. In this case,\n // period holds a date === the first of the current month while\n // periodStart holds a date === the beginning of the first week of the month\n // (which might be in the the previous month). Read the\n // `OccurrenceGenerator#collections()` description for more info.\n let period = this.getPeriod(this.args.start);\n let dates = [];\n let index = 0;\n while (date && (this.args.take === undefined || this.args.take > index)) {\n while (date && date.isBeforeOrEqual(period.end)) {\n dates.push(date);\n date = iterator.next().value;\n }\n yield new Collection(\n dates.map(date => this.normalizeDateOutput(date)),\n this.granularity,\n this.normalizeDateOutput(period.start),\n this.normalizeDateOutput(period.end),\n );\n if (!date) return;\n dates = [];\n period = !this.args.skipEmptyPeriods\n ? this.getPeriod(this.incrementPeriod(period.period))\n : this.getPeriod(date);\n // With these args, periods may overlap and the same date may show up\n // in two periods. Because of this, we need to reset the iterator\n // (otherwise it won't return a date it has already returned).\n if (this.granularity === 'month' && this.weekStart) {\n iterator = this.iterable._run({\n start: period.start,\n end: this.args.end,\n });\n date = iterator.next().value;\n }\n index++;\n }\n }\n getPeriod(date) {\n let start;\n let end;\n let period;\n if (this.granularity === 'month' && this.weekStart) {\n start = date.granularity('month').granularity('week', { weekStart: this.weekStart });\n end = date.endGranularity('month').endGranularity('week', { weekStart: this.weekStart });\n period = date.granularity('month');\n } else {\n start = date.granularity(this.granularity, { weekStart: this.weekStart });\n end = date.endGranularity(this.granularity, { weekStart: this.weekStart });\n period = start;\n }\n return { start, end, period };\n }\n incrementPeriod(date) {\n return date.add(1, this.granularity);\n }\n occurrenceIterator() {\n let start = this.args.start || this.iterable._run().next().value;\n if (!start) return this.iterable._run(this.args);\n start = this.getPeriod(start).start;\n return this.iterable._run({\n start,\n end: this.args.end,\n });\n }\n}\nclass Operator extends OccurrenceGenerator {\n constructor(streams, config) {\n super(config);\n this.streams = streams;\n this.config = config;\n this.timezone = config.timezone;\n this.streams = streams.map(stream =>\n stream instanceof Operator ? stream : stream.set('timezone', this.timezone),\n );\n this.isInfinite = this.calculateIsInfinite();\n this.hasDuration = this.calculateHasDuration();\n }\n normalizeDateInput(date) {\n if (!date) return;\n return dateInputToDateTime(date, this.timezone);\n }\n normalizeRunOutput(date) {\n return normalizeDateTimeTimezone$1(date, this.timezone);\n }\n}\n\n/**\n * Simple class that lets us access the `value`, `runArgs`, and `done`\n * status of an OccurrenceGenerator iterator\n */\nclass IterableWrapper {\n constructor(generator, runArgs) {\n this.runArgs = runArgs;\n this.stream = generator._run(this.runArgs);\n this.next();\n }\n next(args) {\n const { done, value } = this.stream.next(args);\n this.done = typeof done === 'boolean' ? done : true;\n this.value = value;\n return { done, value };\n }\n}\nfunction processYieldArgs(streams, options = {}, yieldArgs = {}) {\n if (!yieldArgs.skipToDate || streams.length === 0) return;\n // check for invalid `skipToDate` option\n if (\n options.reverse\n ? streams.every(s => s.value.isBeforeOrEqual(yieldArgs.skipToDate))\n : streams.every(s => s.value.isAfterOrEqual(yieldArgs.skipToDate))\n ) {\n throw new Error(\n 'A provided `skipToDate` option must be greater than the last yielded date ' +\n '(or smaller, in the case of reverse iteration)',\n );\n }\n for (const stream of streams) {\n if (stream.done) continue; // no point in calling `next()`\n if (\n options.reverse\n ? stream.value.isBeforeOrEqual(yieldArgs.skipToDate)\n : stream.value.isAfterOrEqual(yieldArgs.skipToDate)\n ) {\n // This can happen there are two streams and one stream starts after the other finishes.\n // Or, when iterating in reverse, when one stream ends before the other starts.\n // In this case we don't want to call `next()` because it will throw an error.\n // In both of these cases, calling `next()` won't do anything anyway.\n continue;\n }\n stream.next(yieldArgs);\n }\n}\n/** sorts ascending with completed iterables at the end */\nfunction streamsComparer(a, b) {\n if (a.done && b.done) return 0;\n if (a.done) return 1;\n if (b.done) return -1;\n if (a.value.isAfter(b.value)) return 1;\n return -1;\n}\n/** sorts descending with completed iterables at the start */\nfunction streamsReverseComparer(a, b) {\n if (a.done && b.done) return 0;\n if (a.done) return -1;\n if (b.done) return 1;\n if (a.value.isAfter(b.value)) return -1;\n return 1;\n}\nfunction selectNextIterable(streams, options = {}, yieldArgs = {}) {\n processYieldArgs(streams, options, yieldArgs);\n return streams\n .sort(options.reverse ? streamsReverseComparer : streamsComparer)\n .filter(s => !s.done)\n .shift();\n}\nfunction selectLastIterable(streams, options = {}, yieldArgs = {}) {\n processYieldArgs(streams, options, yieldArgs);\n return streams\n .sort(options.reverse ? streamsReverseComparer : streamsComparer)\n .filter(s => !s.done)\n .pop();\n}\n\n/**\n * An operator function which accepts a spread of occurrence generators\n * and adds their occurrences to the output.\n *\n * @param streams a spread of occurrence generators\n */\nfunction add(...streams) {\n return options => new AddOperator(streams, options);\n}\nclass AddOperator extends Operator {\n set(_, value) {\n return new AddOperator(\n this.streams.map(stream => stream.set('timezone', value)),\n Object.assign(Object.assign({}, this.config), {\n base: this.config.base && this.config.base.set('timezone', value),\n timezone: value,\n }),\n );\n }\n *_run(args = {}) {\n const wrappedStreams = this.streams.map(input => new IterableWrapper(input, args));\n if (this.config.base) {\n wrappedStreams.push(new IterableWrapper(this.config.base, args));\n }\n if (wrappedStreams.length === 0) return;\n let stream = selectNextIterable(wrappedStreams, args);\n while (stream && !stream.done) {\n // yield the current stream's value\n const yieldArgs = yield this.normalizeRunOutput(stream.value);\n if (!(yieldArgs && yieldArgs.skipToDate)) {\n // iterate the current stream\n stream.next();\n }\n // select the next stream\n stream = selectNextIterable(wrappedStreams, args, yieldArgs);\n }\n }\n calculateIsInfinite() {\n return (\n (this.config.base && this.config.base.isInfinite) ||\n this.streams.some(stream => stream.isInfinite)\n );\n }\n calculateHasDuration() {\n const streamsDuration = this.streams.every(stream => stream.hasDuration);\n if (!this.config.base) return streamsDuration;\n return this.config.base.hasDuration && streamsDuration;\n }\n}\n\nclass Calendar extends OccurrenceGenerator {\n /**\n *\n * Create a new Calendar object with the specified options.\n *\n * ### Options\n *\n * - **timezone**: The timezone that yielded occurrences should be *displayed* in.\n * Note, this one affects the *displayed* timezone of yielded occurrences.\n * For rules, occurrences are first found using the unmodified rule\n * config (including whatever timezone the `start` datetime is defined\n * in), and then converted to the timezone specified here before being\n * yielded. By default, the timezone is *local* time (`null`). So if you don't\n * want your rules to be displayed in local time, you must supply a\n * timezone argument.\n * - **data**: arbitrary data you can associate with this Calendar. This\n * is the only mutable property of `Calendar` objects.\n * - **maxDuration**: currently unused.\n * - **schedules**: either an occurrence generator, or an array of occurrence generators, which should\n * be used to build up this Calendar's occurrences. The Calendar will display the union of occurrences\n * its schedules produce.\n *\n */\n constructor(args = {}) {\n super(args);\n this.schedules = [];\n this.data = args.data;\n if (args.schedules) {\n this.schedules = Array.isArray(args.schedules) ? args.schedules : [args.schedules];\n this.schedules = this.schedules.map(schedule => schedule.set('timezone', this.timezone));\n }\n this.isInfinite = this.schedules.some(schedule => schedule.isInfinite);\n this.hasDuration = this.schedules.every(schedule => schedule.hasDuration);\n }\n occurrences(args = {}) {\n return new OccurrenceIterator(this, this.normalizeOccurrencesArgs(args));\n }\n collections(args = {}) {\n return new CollectionIterator(this, this.normalizeCollectionsArgs(args));\n }\n set(prop, value, options) {\n if (prop === 'timezone') {\n return new Calendar({\n schedules: this.schedules.map(schedule => schedule.set(prop, value, options)),\n data: this.data,\n timezone: value,\n maxDuration: this.maxDuration,\n });\n } else if (prop === 'schedules') {\n return new Calendar({\n schedules: Array.isArray(value) ? value : [value],\n data: this.data,\n timezone: this.timezone,\n maxDuration: this.maxDuration,\n });\n }\n throw new ArgumentError('Unknown value for `prop`: ' + `\"${prop}\"`);\n }\n *_run(args = {}) {\n if (this.schedules.length === 0) return;\n const count = args.take;\n delete args.take;\n let iterator;\n if (this.schedules.length === 1) {\n iterator = this.schedules[0]._run(args);\n } else {\n iterator = new AddOperator(this.schedules, {\n timezone: this.timezone,\n })._run(args);\n }\n let date = iterator.next().value;\n let index = 0;\n while (date && (count === undefined || count > index)) {\n date = date.add(this, 'generator');\n const yieldArgs = yield this.normalizeRunOutput(date);\n date = iterator.next(yieldArgs).value;\n index++;\n }\n return undefined;\n }\n}\n\nclass Dates extends OccurrenceGenerator {\n constructor(args = {}) {\n super(args);\n this.adapters = [];\n this.isInfinite = false;\n this.maxDuration = 0;\n this.datetimes = [];\n this.data = args.data;\n if (args.dates) {\n this.adapters = args.dates.map(date => {\n let adapter = this.normalizeDateInputToAdapter(date);\n if (args.duration && !adapter.duration) {\n adapter = adapter.set('duration', args.duration);\n }\n return adapter.set('timezone', this.timezone);\n });\n this.datetimes = this.adapters.map(adapter => adapter.toDateTime());\n }\n this.hasDuration = this.datetimes.every(date => !!date.duration);\n if (this.hasDuration) {\n this.maxDuration = this.adapters.reduce(\n (prev, curr) => (curr.duration > prev ? curr.duration : prev),\n 0,\n );\n }\n }\n get length() {\n return this.adapters.length;\n }\n /** Returns the first occurrence or, if there are no occurrences, null. */\n get firstDate() {\n return this.adapters[0] || null;\n }\n /** Returns the last occurrence or, if there are no occurrences, null. */\n get lastDate() {\n return this.adapters[this.length - 1] || null;\n }\n occurrences(args = {}) {\n return new OccurrenceIterator(this, this.normalizeOccurrencesArgs(args));\n }\n collections(args = {}) {\n return new CollectionIterator(this, this.normalizeCollectionsArgs(args));\n }\n add(value) {\n return new Dates({\n dates: [...this.adapters, value],\n timezone: this.timezone,\n data: this.data,\n });\n }\n remove(value) {\n const dates = this.adapters.slice();\n const input = this.normalizeDateInputToAdapter(value);\n const index = dates.findIndex(date => date.valueOf() === input.valueOf());\n if (index >= 0) {\n dates.splice(index, 1);\n }\n return new Dates({\n dates,\n timezone: this.timezone,\n data: this.data,\n });\n }\n set(prop, value, options = {}) {\n let timezone = this.timezone;\n let dates = this.adapters.slice();\n if (prop === 'timezone') {\n if (value === this.timezone) return this;\n else if (options.keepLocalTime) {\n dates = this.adapters.map(adapter => {\n const json = adapter.toJSON();\n json.timezone = value;\n return this.dateAdapter.fromJSON(json);\n });\n }\n timezone = value;\n } else if (prop === 'dates') {\n dates = value;\n } else if (prop === 'duration') {\n dates = dates.map(date => date.set('duration', value || 0));\n } else {\n throw new ArgumentError(\n `Unexpected prop argument \"${prop}\". Accepted values are \"timezone\" or \"dates\"`,\n );\n }\n return new Dates({\n dates,\n data: this.data,\n timezone,\n });\n }\n filter(fn) {\n return new Dates({\n dates: this.adapters.filter(fn),\n data: this.data,\n timezone: this.timezone,\n });\n }\n *_run(args = {}) {\n let dates = this.datetimes.sort(dateTimeSortComparer);\n if (args.start) {\n dates = dates.filter(date => date.isAfterOrEqual(args.start));\n }\n if (args.end) {\n dates = dates.filter(date => date.isBeforeOrEqual(args.end));\n }\n if (args.reverse) {\n dates = dates.slice().reverse();\n }\n if (args.take) {\n dates = dates.slice(0, args.take);\n }\n const dateCache = dates.slice();\n let date = dateCache.shift();\n let yieldArgs;\n while (date) {\n if (\n yieldArgs &&\n yieldArgs.skipToDate &&\n (args.reverse ? yieldArgs.skipToDate.isBefore(date) : yieldArgs.skipToDate.isAfter(date))\n ) {\n date = dateCache.shift();\n continue;\n }\n date = date.add(this, 'generator');\n yieldArgs = yield this.normalizeRunOutput(date);\n // Here, we are matching the behavior of the RecurrenceRulesIterator\n if (\n yieldArgs &&\n yieldArgs.skipToDate &&\n (args.reverse\n ? yieldArgs.skipToDate.isAfterOrEqual(date)\n : yieldArgs.skipToDate.isBeforeOrEqual(date))\n ) {\n throw new Error(\n 'A provided `skipToDate` option must be greater than the last yielded date ' +\n '(or smaller, in the case of reverse iteration)',\n );\n }\n date = dateCache.shift();\n }\n return undefined;\n }\n}\n\nclass InvalidDateAdapterError extends Error {}\nlet dateAdapterConfig;\nclass DateAdapterBase {\n constructor(_date, options) {\n this.duration = (options && options.duration) || 0;\n this.generators = (options && options.generators && options.generators.slice()) || [];\n if (!Number.isInteger(this.duration) || this.duration < 0) {\n throw new InvalidDateAdapterError('duration must be a non-negative integer');\n }\n }\n static set adapter(value) {\n if (dateAdapterConfig) {\n throw new Error(`\"${dateAdapterConfig.name}\" has already been configured.`);\n }\n dateAdapterConfig = value;\n }\n static get adapter() {\n if (!dateAdapterConfig) {\n throw new Error('No date adapter has been configured. See rSchedule docs.');\n }\n return dateAdapterConfig;\n }\n static isDate(_object) {\n throw unimplementedError('isDate()');\n }\n static fromDate(_date, _options) {\n throw unimplementedError('fromDate()');\n }\n static fromJSON(_json) {\n throw unimplementedError('fromJSON()');\n }\n static fromDateTime(_datetime) {\n throw unimplementedError('fromDateTime()');\n }\n /**\n * Returns a string in simplified extended ISO format (ISO 8601).\n *\n * _Note: this method is intended for testing and its\n * implementation isn't particularly performant._\n */\n toISOString() {\n return this.set('timezone', 'UTC')\n .toDateTime()\n .toISOString();\n }\n toDateTime() {\n const date = DateTime.fromJSON(\n Object.assign(Object.assign({}, this.toJSON()), { generators: this.generators }),\n );\n return date;\n }\n}\nDateAdapterBase.hasTimezoneSupport = false;\nfunction unimplementedError(name) {\n return new Error(`You must implement the \"${name}\" method for this DateAdapter class`);\n}\nvar DateAdapter;\n(function(DateAdapter) {\n DateAdapter.WEEKDAYS = ['SU', 'MO', 'TU', 'WE', 'TH', 'FR', 'SA'];\n DateAdapter.MILLISECONDS_IN_SECOND = 1000;\n DateAdapter.MILLISECONDS_IN_MINUTE = DateAdapter.MILLISECONDS_IN_SECOND * 60;\n DateAdapter.MILLISECONDS_IN_HOUR = DateAdapter.MILLISECONDS_IN_MINUTE * 60;\n DateAdapter.MILLISECONDS_IN_DAY = DateAdapter.MILLISECONDS_IN_HOUR * 24;\n DateAdapter.MILLISECONDS_IN_WEEK = DateAdapter.MILLISECONDS_IN_DAY * 7;\n})(DateAdapter || (DateAdapter = {}));\nclass InvalidDateTimeError extends Error {}\nclass DateTime {\n constructor(date, timezone, duration, generators) {\n this.date = new Date(date);\n this.timezone = timezone || null;\n this.duration = duration || 0;\n this.generators = (generators && generators.slice()) || [];\n if (!Number.isInteger(this.duration) || this.duration < 0) {\n throw new InvalidDateTimeError('duration must be a non-negative integer');\n }\n this.assertIsValid();\n }\n // /**\n // * Similar to `Array.isArray()`, `isInstance()` provides a surefire method\n // * of determining if an object is a `DateTime` by checking against the\n // * global symbol registry.\n // */\n // static isInstance(object: any): object is DateTime {\n // return !!(object && object[DATETIME_ID]);\n // }\n static fromJSON(json) {\n const date = new Date(\n Date.UTC(\n json.year,\n json.month - 1,\n json.day,\n json.hour,\n json.minute,\n json.second,\n json.millisecond,\n ),\n );\n return new DateTime(date, json.timezone, json.duration, json.generators);\n }\n static fromDateAdapter(adapter) {\n return DateTime.fromJSON(\n Object.assign(Object.assign({}, adapter.toJSON()), { generators: adapter.generators }),\n );\n }\n /**\n * Returns `undefined` if `duration` is `0`. Else returns\n * the `end` date.\n */\n get end() {\n if (!this.duration) return;\n if (this._end) return this._end;\n this._end = this.add(this.duration, 'millisecond');\n return this._end;\n }\n // While we constrain the argument to be another DateAdapter in typescript\n // we handle the case of someone passing in another type of object in javascript\n isEqual(object) {\n if (!object) {\n return false;\n }\n assertSameTimeZone(this, object);\n return this.valueOf() === object.valueOf();\n }\n isBefore(object) {\n assertSameTimeZone(this, object);\n return this.valueOf() < object.valueOf();\n }\n isBeforeOrEqual(object) {\n assertSameTimeZone(this, object);\n return this.valueOf() <= object.valueOf();\n }\n isAfter(object) {\n assertSameTimeZone(this, object);\n return this.valueOf() > object.valueOf();\n }\n isAfterOrEqual(object) {\n assertSameTimeZone(this, object);\n return this.valueOf() >= object.valueOf();\n }\n isOccurring(object) {\n if (!this.duration) {\n throw new Error('DateTime#isOccurring() is only applicable to DateTimes with durations');\n }\n assertSameTimeZone(this, object);\n return (\n object.isAfterOrEqual(this) && object.isBeforeOrEqual(this.add(this.duration, 'millisecond'))\n );\n }\n add(amount, unit) {\n switch (unit) {\n case 'generator': {\n const generators = this.generators.slice();\n generators.unshift(amount);\n return new DateTime(this.date, this.timezone, this.duration, generators);\n }\n case 'year':\n return this.forkDateTime(addUTCYears(this.date, amount));\n case 'month':\n return this.forkDateTime(addUTCMonths(this.date, amount));\n case 'week':\n return this.forkDateTime(addUTCWeeks(this.date, amount));\n case 'day':\n return this.forkDateTime(addUTCDays(this.date, amount));\n case 'hour':\n return this.forkDateTime(addUTCHours(this.date, amount));\n case 'minute':\n return this.forkDateTime(addUTCMinutes(this.date, amount));\n case 'second':\n return this.forkDateTime(addUTCSeconds(this.date, amount));\n case 'millisecond':\n return this.forkDateTime(addUTCMilliseconds(this.date, amount));\n default:\n throw new Error('Invalid unit provided to `DateTime#add`');\n }\n }\n subtract(amount, unit) {\n switch (unit) {\n case 'year':\n return this.forkDateTime(subUTCYears(this.date, amount));\n case 'month':\n return this.forkDateTime(subUTCMonths(this.date, amount));\n case 'week':\n return this.forkDateTime(subUTCWeeks(this.date, amount));\n case 'day':\n return this.forkDateTime(subUTCDays(this.date, amount));\n case 'hour':\n return this.forkDateTime(subUTCHours(this.date, amount));\n case 'minute':\n return this.forkDateTime(subUTCMinutes(this.date, amount));\n case 'second':\n return this.forkDateTime(subUTCSeconds(this.date, amount));\n case 'millisecond':\n return this.forkDateTime(subUTCMilliseconds(this.date, amount));\n default:\n throw new Error('Invalid unit provided to `DateTime#subtract`');\n }\n }\n get(unit) {\n switch (unit) {\n case 'year':\n return this.date.getUTCFullYear();\n case 'month':\n return this.date.getUTCMonth() + 1;\n case 'yearday':\n return getUTCYearDay(this.date);\n case 'weekday':\n return DateAdapter.WEEKDAYS[this.date.getUTCDay()];\n case 'day':\n return this.date.getUTCDate();\n case 'hour':\n return this.date.getUTCHours();\n case 'minute':\n return this.date.getUTCMinutes();\n case 'second':\n return this.date.getUTCSeconds();\n case 'millisecond':\n return this.date.getUTCMilliseconds();\n default:\n throw new Error('Invalid unit provided to `DateTime#set`');\n }\n }\n set(unit, value) {\n if (unit === 'duration') {\n return new DateTime(this.date, this.timezone, value, this.generators);\n }\n if (unit === 'generators') {\n return new DateTime(this.date, this.timezone, this.duration, value);\n }\n let date = new Date(this.date);\n switch (unit) {\n case 'year':\n date.setUTCFullYear(value);\n break;\n case 'month': {\n // If the current day of the month\n // is greater than days in the month we are moving to, we need to also\n // set the day to the end of that month.\n const length = monthLength(value, date.getUTCFullYear());\n const day = date.getUTCDate();\n if (day > length) {\n date.setUTCDate(1);\n date.setUTCMonth(value);\n date = subUTCDays(date, 1);\n } else {\n date.setUTCMonth(value - 1);\n }\n break;\n }\n case 'day':\n date.setUTCDate(value);\n break;\n case 'hour':\n date.setUTCHours(value);\n break;\n case 'minute':\n date.setUTCMinutes(value);\n break;\n case 'second':\n date.setUTCSeconds(value);\n break;\n case 'millisecond':\n date.setUTCMilliseconds(value);\n break;\n default:\n throw new Error('Invalid unit provided to `DateTime#set`');\n }\n return this.forkDateTime(date);\n }\n granularity(granularity, opt = {}) {\n let date = this.forkDateTime(this.date);\n switch (granularity) {\n case 'year':\n date = date.set('month', 1);\n case 'month':\n date = date.set('day', 1);\n break;\n case 'week':\n date = setDateToStartOfWeek(date, opt.weekStart);\n }\n switch (granularity) {\n case 'year':\n case 'month':\n case 'week':\n case 'day':\n date = date.set('hour', 0);\n case 'hour':\n date = date.set('minute', 0);\n case 'minute':\n date = date.set('second', 0);\n case 'second':\n date = date.set('millisecond', 0);\n case 'millisecond':\n return date;\n default:\n throw new Error('Invalid granularity provided to `DateTime#granularity`: ' + granularity);\n }\n }\n endGranularity(granularity, opt = {}) {\n let date = this.forkDateTime(this.date);\n switch (granularity) {\n case 'year':\n date = date.set('month', 12);\n case 'month':\n date = date.set('day', monthLength(date.get('month'), date.get('year')));\n break;\n case 'week':\n date = setDateToEndOfWeek(date, opt.weekStart);\n }\n switch (granularity) {\n case 'year':\n case 'month':\n case 'week':\n case 'day':\n date = date.set('hour', 23);\n case 'hour':\n date = date.set('minute', 59);\n case 'minute':\n date = date.set('second', 59);\n case 'second':\n date = date.set('millisecond', 999);\n case 'millisecond':\n return date;\n default:\n throw new Error('Invalid granularity provided to `DateTime#granularity`: ' + granularity);\n }\n }\n toISOString() {\n return this.date.toISOString();\n }\n toDateTime() {\n return this;\n }\n toJSON() {\n const json = {\n timezone: this.timezone,\n year: this.get('year'),\n month: this.get('month'),\n day: this.get('day'),\n hour: this.get('hour'),\n minute: this.get('minute'),\n second: this.get('second'),\n millisecond: this.get('millisecond'),\n };\n if (this.duration) {\n json.duration = this.duration;\n }\n return json;\n }\n valueOf() {\n return this.date.valueOf();\n }\n assertIsValid() {\n if (isNaN(this.valueOf())) {\n throw new InvalidDateTimeError('DateTime has invalid date.');\n }\n return true;\n }\n forkDateTime(date) {\n return new DateTime(date, this.timezone, this.duration, this.generators);\n }\n}\nfunction assertSameTimeZone(x, y) {\n if (x.timezone !== y.timezone) {\n throw new InvalidDateTimeError(\n 'Attempted to compare a datetime to another date in a different timezone: ' +\n JSON.stringify(x) +\n ' and ' +\n JSON.stringify(y),\n );\n }\n return true;\n}\nfunction setDateToStartOfWeek(date, wkst) {\n const index = orderedWeekdays(wkst).indexOf(date.get('weekday'));\n return date.subtract(index, 'day');\n}\nfunction setDateToEndOfWeek(date, wkst) {\n const index = orderedWeekdays(wkst).indexOf(date.get('weekday'));\n return date.add(6 - index, 'day');\n}\nfunction orderedWeekdays(wkst = 'SU') {\n const wkdays = DateAdapter.WEEKDAYS.slice();\n let index = wkdays.indexOf(wkst);\n while (index !== 0) {\n shiftArray(wkdays);\n index--;\n }\n return wkdays;\n}\nfunction shiftArray(array, from = 'first') {\n if (array.length === 0) {\n return array;\n } else if (from === 'first') {\n array.push(array.shift());\n } else {\n array.unshift(array.pop());\n }\n return array;\n}\n/**\n * Returns the days in the given month.\n *\n * @param month base-1\n * @param year\n */\nfunction monthLength(month, year) {\n const block = {\n 1: 31,\n 2: getDaysInFebruary(year),\n 3: 31,\n 4: 30,\n 5: 31,\n 6: 30,\n 7: 31,\n 8: 31,\n 9: 30,\n 10: 31,\n 11: 30,\n 12: 31,\n };\n return block[month];\n}\nfunction getDaysInFebruary(year) {\n return isLeapYear(year) ? 29 : 28;\n}\n// taken from date-fn\nfunction isLeapYear(year) {\n return year % 400 === 0 || (year % 4 === 0 && year % 100 !== 0);\n}\nfunction getUTCYearDay(now) {\n const start = new Date(Date.UTC(now.getUTCFullYear(), 0, 1));\n const diff = now.valueOf() - start.valueOf();\n return 1 + Math.floor(diff / DateAdapter.MILLISECONDS_IN_DAY);\n}\n/**\n * These functions are basically lifted from `date-fns`, but changed\n * to use the UTC date methods, which `date-fns` doesn't support.\n */\nfunction toInteger(input) {\n if (input === null || input === true || input === false) {\n return NaN;\n }\n const int = Number(input);\n if (isNaN(int)) {\n return int;\n }\n return int < 0 ? Math.ceil(int) : Math.floor(int);\n}\nfunction addMilliseconds(dirtyDate, dirtyAmount) {\n if (arguments.length < 2) {\n throw new TypeError('2 arguments required, but only ' + arguments.length + ' present');\n }\n const timestamp = dirtyDate.valueOf();\n const amount = toInteger(dirtyAmount);\n return new Date(timestamp + amount);\n}\nfunction addUTCYears(date, input) {\n const amount = toInteger(input);\n return addUTCMonths(date, amount * 12);\n}\nfunction addUTCMonths(date, input) {\n const amount = toInteger(input);\n date = new Date(date);\n const desiredMonth = date.getUTCMonth() + amount;\n const dateWithDesiredMonth = new Date(0);\n dateWithDesiredMonth.setUTCFullYear(date.getUTCFullYear(), desiredMonth, 1);\n dateWithDesiredMonth.setUTCHours(0, 0, 0, 0);\n const daysInMonth = monthLength(\n dateWithDesiredMonth.getUTCMonth() + 1,\n dateWithDesiredMonth.getUTCFullYear(),\n );\n // Set the last day of the new month\n // if the original date was the last day of the longer month\n date.setUTCMonth(desiredMonth, Math.min(daysInMonth, date.getUTCDate()));\n return date;\n}\nfunction addUTCWeeks(date, input) {\n const amount = toInteger(input);\n const days = amount * 7;\n return addUTCDays(date, days);\n}\nfunction addUTCDays(date, input) {\n // by adding milliseconds rather than days, we supress the native Date object's automatic\n // daylight savings time conversions which we don't want in UTC mode\n return addUTCMilliseconds(date, toInteger(input) * DateAdapter.MILLISECONDS_IN_DAY);\n}\nfunction addUTCHours(date, input) {\n const amount = toInteger(input);\n return addMilliseconds(date, amount * DateAdapter.MILLISECONDS_IN_HOUR);\n}\nfunction addUTCMinutes(date, input) {\n const amount = toInteger(input);\n return addMilliseconds(date, amount * DateAdapter.MILLISECONDS_IN_MINUTE);\n}\nfunction addUTCSeconds(date, input) {\n const amount = toInteger(input);\n return addMilliseconds(date, amount * DateAdapter.MILLISECONDS_IN_SECOND);\n}\nfunction addUTCMilliseconds(date, input) {\n const amount = toInteger(input);\n const timestamp = date.getTime();\n return new Date(timestamp + amount);\n}\nfunction subUTCYears(date, amount) {\n return addUTCYears(date, -amount);\n}\nfunction subUTCMonths(date, amount) {\n return addUTCMonths(date, -amount);\n}\nfunction subUTCWeeks(date, amount) {\n return addUTCWeeks(date, -amount);\n}\nfunction subUTCDays(date, amount) {\n return addUTCDays(date, -amount);\n}\nfunction subUTCHours(date, amount) {\n return addUTCHours(date, -amount);\n}\nfunction subUTCMinutes(date, amount) {\n return addUTCMinutes(date, -amount);\n}\nfunction subUTCSeconds(date, amount) {\n return addUTCSeconds(date, -amount);\n}\nfunction subUTCMilliseconds(date, amount) {\n return addUTCMilliseconds(date, -amount);\n}\n\n// export function normalizeDateInput<T extends DateAdapter>(\n// dateAdapter: DateAdapterConstructor<T>,\n// input: DateInput<T>,\n// timezone: string | null,\n// ): DateTime {\n// if (input instanceof DateTime) {\n// if (input.timezone !== timezone) {\n// return dateAdapter\n// .fromDateTime(input)\n// .set('timezone', timezone)\n// .toDateTime();\n// }\n// return input;\n// }\n// return input instanceof DateAdapter\n// ? input.set('timezone', timezone).toDateTime()\n// : new dateAdapter(input).toDateTime();\n// }\nfunction normalizeDateTimeTimezone(date, timezone) {\n if (date.timezone !== timezone) {\n return DateAdapterBase.adapter\n .fromDateTime(date)\n .set('timezone', timezone)\n .toDateTime();\n }\n return date;\n}\n\nclass RuleBase extends OccurrenceGenerator {\n constructor(recurrenceRules, config, options = {}) {\n super(options);\n this.recurrenceRules = recurrenceRules;\n this.options = cloneRuleOptions(config);\n this.normOptions = normalizeRuleOptions(this.recurrenceRules, this.options);\n this.timezone =\n options.timezone !== undefined ? options.timezone : this.normOptions.start.timezone;\n this.data = options.data;\n this.hasDuration = !!config.duration;\n if (this.hasDuration) this.duration = config.duration;\n this.isInfinite = this.normOptions.end === undefined && this.normOptions.count === undefined;\n }\n occurrences(args = {}) {\n return new OccurrenceIterator(this, this.normalizeOccurrencesArgs(args));\n }\n collections(args = {}) {\n return new CollectionIterator(this, this.normalizeCollectionsArgs(args));\n }\n *_run(rawArgs = {}) {\n const args = this.normalizeRunArgs(rawArgs);\n const iterator = new RecurrenceRulesIterator(\n recurrenceRulesReducer(this.recurrenceRules),\n this.normOptions,\n args,\n );\n let date = iterator.next().value;\n let index = 0;\n while (date && (args.take === undefined || index < args.take)) {\n index++;\n date = date.add(this, 'generator');\n const yieldArgs = yield this.normalizeRunOutput(date);\n if (yieldArgs === null || yieldArgs === void 0 ? void 0 : yieldArgs.skipToDate) {\n // The RecurrenceRuleIterator might have a different timezone from the rule.\n // Because of this, the yieldArgs will not properly be normalized by the\n // OccurrenceIterator, so we need to do it here\n date = iterator.next(\n Object.assign(Object.assign({}, yieldArgs), {\n skipToDate: normalizeDateTimeTimezone(yieldArgs.skipToDate, iterator.start.timezone),\n }),\n ).value;\n } else {\n // theoretically, the yieldArgs are undefined here\n // maybe in the future there will be other yieldArg options though\n date = iterator.next(yieldArgs).value;\n }\n }\n return undefined;\n }\n}\n\nclass Rule extends RuleBase {\n /**\n * Create a new Rule object with the specified rule config and options.\n *\n * ### Options\n *\n * - **timezone**: the timezone that yielded occurrences should be in. Note,\n * this does not change the rule config. Occurrences are first found using\n * the unmodified rule config, and then converted to the timezone specified\n * here before being yielded.\n * - **data**: arbitrary data you can associate with this rule. This\n * is the only mutable property of `Rule` objects.\n *\n * ### Rule Config\n *\n * - #### frequency\n *\n * The frequency rule part identifies the type of recurrence rule. Valid values\n * include `\"SECONDLY\"`, `\"MINUTELY\"`, `\"HOURLY\"`, `\"DAILY\"`, `\"WEEKLY\"`,\n * `\"MONTHLY\"`, or `\"YEARLY\"`.\n *\n * - #### start\n *\n * The start of the rule (not necessarily the first occurrence).\n * Either a `DateAdapter` instance, date object, or `DateTime` object.\n * The type of date object depends on the `DateAdapter` class used for this\n * `Rule`.\n *\n * - #### end?\n *\n * The end of the rule (not necessarily the last occurrence).\n * Either a `DateAdapter` instance, date object, or `DateTime` object.\n * The type of date object depends on the `DateAdapter` class used for this\n * `Rule`.\n *\n * - #### duration?\n *\n * A length of time expressed in milliseconds.\n *\n * - #### interval?\n *\n * The interval rule part contains a positive integer representing at\n * which intervals the recurrence rule repeats. The default value is\n * `1`, meaning every second for a SECONDLY rule, every minute for a\n * MINUTELY rule, every hour for an HOURLY rule, every day for a\n * DAILY rule, every week for a WEEKLY rule, every month for a\n * MONTHLY rule, and every year for a YEARLY rule. For example,\n * within a DAILY rule, a value of `8` means every eight days.\n *\n * - #### count?\n *\n * The count rule part defines the number of occurrences at which to\n * range-bound the recurrence. `count` and `end` are both two different\n * ways of specifying how a recurrence completes.\n *\n * - #### weekStart?\n *\n * The weekStart rule part specifies the day on which the workweek starts.\n * Valid values are `\"MO\"`, `\"TU\"`, `\"WE\"`, `\"TH\"`, `\"FR\"`, `\"SA\"`, and `\"SU\"`.\n * This is significant when a WEEKLY rule has an interval greater than 1,\n * and a `byDayOfWeek` rule part is specified. The\n * default value is `\"MO\"`.\n *\n * - #### bySecondOfMinute?\n *\n * The bySecondOfMinute rule part expects an array of seconds\n * within a minute. Valid values are 0 to 60.\n *\n * - #### byMinuteOfHour?\n *\n * The byMinuteOfHour rule part expects an array of minutes within an hour.\n * Valid values are 0 to 59.\n *\n * - #### byHourOfDay?\n *\n * The byHourOfDay rule part expects an array of hours of the day.\n * Valid values are 0 to 23.\n *\n * - #### byDayOfWeek?\n *\n * *note: the byDayOfWeek rule part is kinda complex. Blame the ICAL spec.*\n *\n * The byDayOfWeek rule part expects an array. Each array entry can\n * be a day of the week (`\"SU\"`, `\"MO\"` , `\"TU\"`, `\"WE\"`, `\"TH\"`,\n * `\"FR\"`, `\"SA\"`). If the rule's `frequency` is either MONTHLY or YEARLY,\n * Any entry can also be a tuple where the first value of the tuple is a\n * day of the week and the second value is an positive/negative integer\n * (e.g. `[\"SU\", 1]`). In this case, the number indicates the nth occurrence of\n * the specified day within the MONTHLY or YEARLY rule.\n *\n * The behavior of byDayOfWeek changes depending on the `frequency`\n * of the rule.\n *\n * Within a MONTHLY rule, `[\"MO\", 1]` represents the first Monday\n * within the month, whereas `[\"MO\", -1]` represents the last Monday\n * of the month.\n *\n * Within a YEARLY rule, the numeric value in a byDayOfWeek tuple entry\n * corresponds to an offset within the month when the byMonthOfYear rule part is\n * present, and corresponds to an offset within the year otherwise.\n *\n * Regardless of rule `frequency`, if a byDayOfWeek entry is a string\n * (rather than a tuple), it means \"all of these days\" within the specified\n * frequency (e.g. within a MONTHLY rule, `\"MO\"` represents all Mondays within\n * the month).\n *\n * - #### byDayOfMonth?\n *\n * The byDayOfMonth rule part expects an array of days\n * of the month. Valid values are 1 to 31 or -31 to -1.\n *\n * For example, -10 represents the tenth to the last day of the month.\n * The byDayOfMonth rule part *must not* be specified when the rule's\n * `frequency` is set to WEEKLY.\n *\n * - #### byMonthOfYear?\n *\n * The byMonthOfYear rule part expects an array of months\n * of the year. Valid values are 1 to 12.\n *\n */\n constructor(config, options = {}) {\n super(Rule.recurrenceRules, config, options);\n }\n set(prop, value, tzoptions = {}) {\n let options = cloneRuleOptions(this.options);\n let timezone = this.timezone;\n if (prop === 'timezone') {\n if (value === this.timezone && !tzoptions.keepLocalTime) return this;\n else if (tzoptions.keepLocalTime) {\n const json = this.normalizeDateInput(options.start).toJSON();\n json.timezone = value;\n const adapter = this.dateAdapter.fromJSON(json);\n // prettier-ignore\n options.start =\n options.start instanceof this.dateAdapter ? adapter :\n options.start instanceof DateTime$1 ? adapter.toDateTime() :\n adapter.date;\n }\n timezone = value;\n } else if (prop === 'options') {\n options = value;\n } else {\n options[prop] = value;\n }\n return new Rule(options, {\n data: this.data,\n maxDuration: this.maxDuration,\n timezone,\n });\n }\n}\nRule.recurrenceRules = [];\n\nclass ScheduleBase extends OccurrenceGenerator {\n /**\n * Create a new Schedule object with the specified options.\n *\n * The order of precidence for rrules, rdates, exrules, and exdates is:\n *\n * 1. rrules are included\n * 2. exrules are excluded\n * 3. rdates are included\n * 4. exdates are excluded\n *\n */\n constructor(options) {\n super(options);\n this.data = options.data;\n }\n occurrences(args = {}) {\n return new OccurrenceIterator(this, this.normalizeOccurrencesArgs(args));\n }\n collections(args = {}) {\n return new CollectionIterator(this, this.normalizeCollectionsArgs(args));\n }\n *_run(args = {}) {\n const count = args.take;\n delete args.take;\n const iterator = this.occurrenceStream._run(args);\n let date = iterator.next().value;\n let index = 0;\n while (date && (count === undefined || count > index)) {\n date = date.add(this, 'generator');\n const yieldArgs = yield this.normalizeRunOutput(date);\n date = iterator.next(yieldArgs).value;\n index++;\n }\n return undefined;\n }\n}\n\n/**\n * An operator function which accepts a spread of occurrence generators\n * and removes their occurrences from the output.\n *\n * @param streams a spread of occurrence generators\n */\nfunction subtract(...streams) {\n return options => new SubtractOperator(streams, options);\n}\nclass SubtractOperator extends Operator {\n /** Not actually used but necessary for IRunnable interface */\n set(_, value) {\n return new SubtractOperator(\n this.streams.map(stream => stream.set('timezone', value)),\n Object.assign(Object.assign({}, this.config), {\n base: this.config.base && this.config.base.set('timezone', value),\n timezone: value,\n }),\n );\n }\n *_run(args = {}) {\n if (!this.config.base) return;\n const inclusion = new IterableWrapper(this.config.base, args);\n const exclusion = new IterableWrapper(\n new AddOperator(this.streams, {\n timezone: this.config.timezone,\n }),\n args,\n );\n cycleStreams(inclusion, exclusion, args);\n while (!inclusion.done) {\n const yieldArgs = yield this.normalizeRunOutput(inclusion.value);\n if (!(yieldArgs && yieldArgs.skipToDate)) {\n inclusion.next();\n }\n cycleStreams(inclusion, exclusion, args, yieldArgs);\n }\n }\n calculateIsInfinite() {\n return !!(this.config.base && this.config.base.isInfinite);\n }\n calculateHasDuration() {\n return !!(this.config.base && this.config.base.hasDuration);\n }\n}\nfunction cycleStreams(inclusion, exclusion, options = {}, yieldArgs = {}) {\n processYieldArgs([inclusion, exclusion], options, yieldArgs);\n iterateExclusion(inclusion, exclusion, options);\n while (!inclusion.done && !exclusion.done && inclusion.value.isEqual(exclusion.value)) {\n inclusion.next();\n iterateExclusion(inclusion, exclusion, options);\n }\n}\nfunction iterateExclusion(inclusion, exclusion, options = {}) {\n if (options.reverse) {\n while (!exclusion.done && !inclusion.done && exclusion.value.isAfter(inclusion.value)) {\n exclusion.next();\n }\n return;\n }\n while (!exclusion.done && !inclusion.done && exclusion.value.isBefore(inclusion.value)) {\n exclusion.next();\n }\n}\n\n/**\n * An operator function which deduplicates an occurrence stream. Occurrence\n * `duration` is currently ignored.\n */\nfunction unique() {\n return options => new UniqueOperator([], options);\n}\nclass UniqueOperator extends Operator {\n /** Not actually used but necessary for IRunnable interface */\n set(_, value) {\n return new UniqueOperator(\n [],\n Object.assign(Object.assign({}, this.config), {\n base: this.config.base && this.config.base.set('timezone', value),\n timezone: value,\n }),\n );\n }\n *_run(args = {}) {\n if (!this.config.base) return;\n const stream = new IterableWrapper(this.config.base, args);\n while (!stream.done) {\n const yieldArgs = yield this.normalizeRunOutput(stream.value);\n const lastValue = stream.value;\n // iterate the current stream\n stream.next(yieldArgs);\n while (\n !(yieldArgs && yieldArgs.skipToDate) &&\n !stream.done &&\n stream.value.isEqual(lastValue)\n ) {\n stream.next();\n }\n }\n }\n calculateIsInfinite() {\n return !!(this.config.base && this.config.base.isInfinite);\n }\n calculateHasDuration() {\n return !!(this.config.base && this.config.base.hasDuration);\n }\n}\n\nclass Schedule extends ScheduleBase {\n /**\n * Create a new Schedule object with the specified options.\n *\n * The order of precidence for rrules, rdates, exrules, and exdates is:\n *\n * 1. rrules are included\n * 2. exrules are excluded\n * 3. rdates are included\n * 4. exdates are excluded\n *\n * ### Options\n *\n * - **timezone**: The timezone that yielded occurrences should be *displayed* in.\n * Note, this one affects the *displayed* timezone of yielded occurrences.\n * For rules, occurrences are first found using the unmodified rule\n * config (including whatever timezone the `start` datetime is defined\n * in), and then converted to the timezone specified here before being\n * yielded. By default, the timezone is *local* time (`null`). So if you don't\n * want your rules to be displayed in local time, you must supply a\n * timezone argument.\n * - **data**: arbitrary data you can associate with this Schedule. This\n * is the only mutable property of `Schedule` objects.\n * - **maxDuration**: currently unused.\n * - **rrules**: rules specifying when occurrences happen. See the \"Rule Config\"\n * section below.\n * - **rdates**: individual dates that should be _included_ in the schedule.\n * - **exdates**: individual dates that should be _excluded_ from the schedule.\n * - **exrules**: rules specifying when occurrences shouldn't happen. See the\n * \"Rule Config\" section below.\n *\n * ### Rule Config\n *\n * - #### frequency\n *\n * The frequency rule part identifies the type of recurrence rule. Valid values\n * include `\"SECONDLY\"`, `\"MINUTELY\"`, `\"HOURLY\"`, `\"DAILY\"`, `\"WEEKLY\"`,\n * `\"MONTHLY\"`, or `\"YEARLY\"`.\n *\n * - #### start\n *\n * The start of the rule (not necessarily the first occurrence).\n * Either a `DateAdapter` instance, date object, or `DateTime` object.\n * The type of date object depends on the `DateAdapter` class used for this\n * `Rule`.\n *\n * - #### end?\n *\n * The end of the rule (not necessarily the last occurrence).\n * Either a `DateAdapter` instance, date object, or `DateTime` object.\n * The type of date object depends on the `DateAdapter` class used for this\n * `Rule`.\n *\n * - #### duration?\n *\n * A length of time expressed in milliseconds.\n *\n * - #### interval?\n *\n * The interval rule part contains a positive integer representing at\n * which intervals the recurrence rule repeats. The default value is\n * `1`, meaning every second for a SECONDLY rule, every minute for a\n * MINUTELY rule, every hour for an HOURLY rule, every day for a\n * DAILY rule, every week for a WEEKLY rule, every month for a\n * MONTHLY rule, and every year for a YEARLY rule. For example,\n * within a DAILY rule, a value of `8` means every eight days.\n *\n * - #### count?\n *\n * The count rule part defines the number of occurrences at which to\n * range-bound the recurrence. `count` and `end` are both two different\n * ways of specifying how a recurrence completes.\n *\n * - #### weekStart?\n *\n * The weekStart rule part specifies the day on which the workweek starts.\n * Valid values are `\"MO\"`, `\"TU\"`, `\"WE\"`, `\"TH\"`, `\"FR\"`, `\"SA\"`, and `\"SU\"`.\n * This is significant when a WEEKLY rule has an interval greater than 1,\n * and a `byDayOfWeek` rule part is specified. The\n * default value is `\"MO\"`.\n *\n * - #### bySecondOfMinute?\n *\n * The bySecondOfMinute rule part expects an array of seconds\n * within a minute. Valid values are 0 to 60.\n *\n * - #### byMinuteOfHour?\n *\n * The byMinuteOfHour rule part expects an array of minutes within an hour.\n * Valid values are 0 to 59.\n *\n * - #### byHourOfDay?\n *\n * The byHourOfDay rule part expects an array of hours of the day.\n * Valid values are 0 to 23.\n *\n * - #### byDayOfWeek?\n *\n * *note: the byDayOfWeek rule part is kinda complex. Blame the ICAL spec.*\n *\n * The byDayOfWeek rule part expects an array. Each array entry can\n * be a day of the week (`\"SU\"`, `\"MO\"` , `\"TU\"`, `\"WE\"`, `\"TH\"`,\n * `\"FR\"`, `\"SA\"`). If the rule's `frequency` is either MONTHLY or YEARLY,\n * Any entry can also be a tuple where the first value of the tuple is a\n * day of the week and the second value is an positive/negative integer\n * (e.g. `[\"SU\", 1]`). In this case, the number indicates the nth occurrence of\n * the specified day within the MONTHLY or YEARLY rule.\n *\n * The behavior of byDayOfWeek changes depending on the `frequency`\n * of the rule.\n *\n * Within a MONTHLY rule, `[\"MO\", 1]` represents the first Monday\n * within the month, whereas `[\"MO\", -1]` represents the last Monday\n * of the month.\n *\n * Within a YEARLY rule, the numeric value in a byDayOfWeek tuple entry\n * corresponds to an offset within the month when the byMonthOfYear rule part is\n * present, and corresponds to an offset within the year otherwise.\n *\n * Regardless of rule `frequency`, if a byDayOfWeek entry is a string\n * (rather than a tuple), it means \"all of these days\" within the specified\n * frequency (e.g. within a MONTHLY rule, `\"MO\"` represents all Mondays within\n * the month).\n *\n * - #### byDayOfMonth?\n *\n * The byDayOfMonth rule part expects an array of days\n * of the month. Valid values are 1 to 31 or -31 to -1.\n *\n * For example, -10 represents the tenth to the last day of the month.\n * The byDayOfMonth rule part *must not* be specified when the rule's\n * `frequency` is set to WEEKLY.\n *\n * - #### byMonthOfYear?\n *\n * The byMonthOfYear rule part expects an array of months\n * of the year. Valid values are 1 to 12.\n *\n */\n constructor(options = {}) {\n super(options);\n this.rrules = [];\n this.exrules = [];\n for (const prop of ['rrules', 'exrules']) {\n const arg = options[prop];\n if (arg) {\n this[prop] = arg.map(ruleArgs => {\n if (ruleArgs instanceof Rule) {\n return ruleArgs.set('timezone', this.timezone);\n } else {\n return new Rule(ruleArgs, {\n timezone: this.timezone,\n });\n }\n });\n }\n }\n for (const prop of ['rdates', 'exdates']) {\n const arg = options[prop];\n if (arg) {\n this[prop] =\n arg instanceof Dates\n ? arg.set('timezone', this.timezone)\n : new Dates({\n dates: arg,\n timezone: this.timezone,\n });\n } else {\n this[prop] = new Dates({\n timezone: this.timezone,\n });\n }\n }\n this.hasDuration =\n this.rrules.every(rule => rule.hasDuration) &&\n this.exrules.every(rule => rule.hasDuration) &&\n this.rdates.hasDuration &&\n this.exdates.hasDuration;\n this.isInfinite = this.rrules.some(rule => rule.isInfinite);\n this.occurrenceStream = [\n add(...this.rrules),\n subtract(...this.exrules),\n add(this.rdates),\n subtract(this.exdates),\n unique(),\n ].reduce((prev, curr) => curr({ base: prev, timezone: this.timezone }), undefined);\n }\n add(prop, value) {\n const rrules = this.rrules.slice();\n const exrules = this.exrules.slice();\n let rdates = this.rdates;\n let exdates = this.exdates;\n switch (prop) {\n case 'rrule':\n rrules.push(value);\n break;\n case 'exrule':\n exrules.push(value);\n break;\n case 'rdate':\n rdates = this.rdates.add(value);\n break;\n case 'exdate':\n exdates = this.exdates.add(value);\n break;\n }\n return new Schedule({\n timezone: this.timezone,\n data: this.data,\n rrules,\n exrules,\n rdates,\n exdates,\n });\n }\n remove(prop, value) {\n let rrules = this.rrules;\n let exrules = this.exrules;\n let rdates = this.rdates;\n let exdates = this.exdates;\n switch (prop) {\n case 'rrule':\n rrules = rrules.filter(rule => rule !== value);\n break;\n case 'exrule':\n exrules = exrules.filter(rule => rule !== value);\n break;\n case 'rdate':\n rdates = this.rdates.remove(value);\n break;\n case 'exdate':\n exdates = this.exdates.remove(value);\n break;\n }\n return new Schedule({\n timezone: this.timezone,\n data: this.data,\n rrules,\n exrules,\n rdates,\n exdates,\n });\n }\n set(prop, value, options = {}) {\n let timezone = this.timezone;\n let rrules = this.rrules;\n let exrules = this.exrules;\n let rdates = this.rdates;\n let exdates = this.exdates;\n switch (prop) {\n case 'timezone':\n if (value === this.timezone && !options.keepLocalTime) return this;\n else if (options.keepLocalTime) {\n rrules = rrules.map(rule => rule.set('timezone', value, options));\n exrules = exrules.map(rule => rule.set('timezone', value, options));\n rdates = rdates.set('timezone', value, options);\n exdates = exdates.set('timezone', value, options);\n }\n timezone = value;\n break;\n case 'rrules':\n rrules = value;\n break;\n case 'exrules':\n exrules = value;\n break;\n case 'rdates':\n rdates = value;\n break;\n case 'exdates':\n exdates = value;\n break;\n }\n return new Schedule({\n timezone,\n data: this.data,\n rrules,\n exrules,\n rdates,\n exdates,\n });\n }\n}\n\n/**\n * An operator function, which takes a spread of occurrence generators and only\n * returns the dates which intersect every occurrence generator.\n *\n * Because it's possible for all the generators to never intersect,\n * and because the intersection operator can't detect this lack of intersection,\n * you must call `intersection()` with a `{maxFailedIterations: number}` argument.\n * For convenience, you can globally set `RScheduleConfig.defaultMaxFailedIterations`.\n * Without further information, I'd probably set `defaultMaxFailedIterations = 50`.\n *\n * The `maxFailedIterations` argument caps the number of iterations the operator will\n * run through without finding a single valid occurrence. If this number is reached, the operator will\n * stop iterating (preventing a possible infinite loop).\n *\n * - Note: `maxFailedIterations` caps the number of iterations which\n * *fail to turn up a single valid occurrence*. Every time a valid occurrence is returned,\n * the current iteration count is reset to 0.\n *\n */\nfunction intersection(args) {\n return options => new IntersectionOperator(args, options);\n}\nclass IntersectionOperator extends Operator {\n constructor(args, config) {\n super(args.streams, config);\n if (this.isInfinite) {\n this.maxFailedIterations =\n args.maxFailedIterations || IntersectionOperator.defaultMaxFailedIterations;\n if (!this.maxFailedIterations) {\n throw new ArgumentError(\n 'The IntersectionOperator must be provided ' +\n 'a `maxFailedIterations` argument when it is built from schedules of infinite length. ' +\n 'This argument is used to ensure that the IntersectionOperator does not enter ' +\n 'an infinite loop because the underlying schedules never intersect. ' +\n 'If the `maxFailedIterations` count is reached it will be assumed that ' +\n 'all valid occurrences have been found and iteration will end without error.' +\n 'Without additional information, \"50\" is probably a good ' +\n '`maxFailedIterations` value. ' +\n 'If the schedules are not of infinite length, `maxFailedIterations` is ignored. ' +\n 'Note also that you can provide a `defaultMaxFailedIterations` number via ' +\n 'IntersectionOperator.defaultMaxFailedIterations.',\n );\n }\n }\n }\n set(_, value) {\n return new IntersectionOperator(\n {\n maxFailedIterations: this.maxFailedIterations,\n streams: this.streams.map(stream => stream.set('timezone', value)),\n },\n Object.assign(Object.assign({}, this.config), {\n base: this.config.base && this.config.base.set('timezone', value),\n timezone: value,\n }),\n );\n }\n *_run(args = {}) {\n const streams = this.streams.map(stream => new IterableWrapper(stream, args));\n if (this.config.base) {\n streams.push(new IterableWrapper(this.config.base, args));\n }\n if (streams.length === 0) return;\n const hasEndDate = !!(!this.isInfinite || args.reverse || args.end);\n if (\n !cycleStreams$1(\n streams,\n undefined,\n Object.assign(Object.assign({}, args), {\n hasEndDate,\n iteration: 0,\n maxIterations: this.maxFailedIterations,\n }),\n )\n ) {\n return;\n }\n let stream = selectNextIterable(streams, args);\n while (stream) {\n const yieldArgs = yield this.normalizeRunOutput(stream.value);\n const lastValidDate = stream.value;\n if (!(yieldArgs === null || yieldArgs === void 0 ? void 0 : yieldArgs.skipToDate)) {\n // iterate the current stream\n stream.next();\n }\n if (\n !cycleStreams$1(\n streams,\n lastValidDate,\n Object.assign(Object.assign({}, args), {\n hasEndDate,\n iteration: 0,\n maxIterations: this.maxFailedIterations,\n }),\n yieldArgs,\n )\n ) {\n return;\n }\n // The call to `cycleStreams()`, above, has already called\n // selectNextIterable with the `yieldArgs`\n stream = selectNextIterable(streams, args);\n }\n }\n calculateIsInfinite() {\n // Note: Array#every() === true when length === 0\n if (!this.config.base) {\n if (this.streams.length === 0) return false;\n return this.streams.every(stream => stream.isInfinite);\n } else if (this.streams.length === 0) return this.config.base.isInfinite;\n return this.config.base.isInfinite && this.streams.every(stream => stream.isInfinite);\n }\n calculateHasDuration() {\n const streamsDuration = this.streams.every(stream => stream.hasDuration);\n if (!this.config.base) return streamsDuration;\n return this.config.base.hasDuration && streamsDuration;\n }\n}\nfunction cycleStreams$1(streams, lastValidDate, options, yieldArgs) {\n const next = selectNextIterable(streams, options, yieldArgs);\n if (!next) return false;\n if (lastValidDate && next.value.isEqual(lastValidDate)) return true;\n if (streams.some(stream => stream.done)) return false;\n if (streams.every(stream => stream.value.isEqual(next.value))) return true;\n options.iteration++;\n if (options.maxIterations && !options.hasEndDate && options.iteration > options.maxIterations) {\n return false;\n }\n // Since not all of the streams are equal, we grab the last stream...\n const last = selectLastIterable(streams, options);\n // ...and skip all the other streams so they are equal or past the last one\n streams.forEach(stream => {\n // Because streams can have multiple, identical dates in a row,\n // we don't want to `skipToDate` if the provided date is equal to the current date.\n if (last.value.isEqual(stream.value)) return;\n stream.next({ skipToDate: last.value });\n });\n // then we repeat\n return cycleStreams$1(streams, lastValidDate, options);\n}\n\nclass DurationIterableWrapper extends IterableWrapper {\n constructor(generator, runArgs) {\n super(generator, runArgs);\n this.workingValue = this.value;\n this.next();\n }\n}\nclass MergeDurationOperatorError extends Error {}\n/**\n * An operator function which takes an occurrence stream with\n * `hasDuration === true` and merges occurrences which have overlapping\n * start and end times.\n *\n * Because it's possible for all the occurrences in the stream to have\n * overlapping start and end times, you must provide a `maxDuration`\n * argument that represents the maximum possible duration for a single\n * occurrence. If this duration is exceeded, a `MergeDurationOperatorError`\n * will be thrown.\n *\n * - For your convenience, you can globally set a default\n * `MergeDurationOperator#maxDuration` via\n * `RScheduleConfig.MergeDurationOperator.defaultMaxDuration`.\n *\n * Usage example:\n *\n * ```typescript\n * const MILLISECONDS_IN_HOUR = 1000 * 60 * 60;\n *\n * const dates = new Dates({\n * dates: [\n * new StandardDateAdapter(new Date(2010, 10, 10, 13), { duration: MILLISECONDS_IN_HOUR * 1 }),\n * new StandardDateAdapter(new Date(2010, 10, 11, 13), { duration: MILLISECONDS_IN_HOUR * 2 }),\n * new StandardDateAdapter(new Date(2010, 10, 11, 14), { duration: MILLISECONDS_IN_HOUR * 2 }),\n * new StandardDateAdapter(new Date(2010, 10, 12, 13), { duration: MILLISECONDS_IN_HOUR * 1 }),\n * ],\n * dateAdpter: StandardDateAdapter,\n * }).pipe(\n * mergeDuration({\n * maxDuration: MILLISECONDS_IN_HOUR * 24\n * })\n * )\n *\n * dates.occurrences().toArray() === [\n * new StandardDateAdapter(new Date(2010, 10, 10, 13), { duration: MILLISECONDS_IN_HOUR * 1 }),\n * new StandardDateAdapter(new Date(2010, 10, 11, 13), { duration: MILLISECONDS_IN_HOUR * 3 }),\n * new StandardDateAdapter(new Date(2010, 10, 12, 13), { duration: MILLISECONDS_IN_HOUR * 1 }),\n * ]\n * ```\n */\nfunction mergeDuration(args) {\n return options => new MergeDurationOperator(args, options);\n}\nclass MergeDurationOperator extends Operator {\n constructor(args, config) {\n super([], config);\n this.maxDuration = args.maxDuration;\n if (config.base && !config.base.hasDuration) {\n throw new ArgumentError(\n 'Base stream provided to MergeDurationOperator does not have an associated duration. ' +\n 'The MergeDurationOperator can only be used with streams which have a duration. ',\n );\n }\n }\n /** Not actually used but necessary for IRunnable interface */\n set(_, value) {\n return new MergeDurationOperator(\n {\n maxDuration: this.maxDuration,\n },\n Object.assign(Object.assign({}, this.config), {\n base: this.config.base && this.config.base.set('timezone', value),\n timezone: value,\n }),\n );\n }\n _run(args = {}) {\n return args.reverse ? this.reverseRun(args) : this.forwardRun(args);\n }\n calculateIsInfinite() {\n return !!(this.config.base && this.config.base.isInfinite);\n }\n calculateHasDuration() {\n return true;\n }\n *forwardRun(args = {}) {\n if (!this.config.base) return;\n // We want to find occurrences that end after the provided\n // `start` time even if they begin before the provided `start`\n // time. Because of this, we must begin iterating `maxDuration`\n // before the provided start time.\n let checkFromStart = args.start;\n if (args.start) {\n checkFromStart = args.start.subtract(this.maxDuration, 'millisecond');\n }\n let checkFromEnd = args.end;\n if (args.end) {\n checkFromEnd = args.end.add(this.maxDuration, 'millisecond');\n }\n const stream = new DurationIterableWrapper(\n this.config.base,\n Object.assign(Object.assign({}, args), { start: checkFromStart, end: checkFromEnd }),\n );\n let yieldArgs;\n // checking `stream.workingValue` because when `stream.done === true`\n // `stream.workingValue` will not have been yielded yet\n while (stream.workingValue) {\n // TODO(@john.carroll.p): figure out how to handle `DateTime#generators` for merged `DateTimes`\n while (!stream.done && stream.workingValue.end.isAfterOrEqual(stream.value)) {\n if (stream.workingValue.duration > this.maxDuration) {\n throw new MergeDurationOperatorError(\n `MergeDurationOperatorError: Occurrence duration exceeded maxDuration of ` +\n this.maxDuration,\n );\n }\n if (stream.value.end.isAfter(stream.workingValue.end)) {\n const diff = stream.value.end.valueOf() - stream.workingValue.end.valueOf();\n stream.workingValue = stream.workingValue.set(\n 'duration',\n stream.workingValue.duration + diff,\n );\n }\n stream.next();\n }\n // check to make sure the occurrence we are about to yield ends after the\n // provided start time.\n if (args.start && stream.workingValue.end.isBefore(args.start)) {\n stream.workingValue = stream.value;\n stream.next();\n continue;\n }\n // make sure the occurrence we are about to yield ends after the\n // provided skipToDate\n if (\n (yieldArgs === null || yieldArgs === void 0 ? void 0 : yieldArgs.skipToDate) &&\n stream.workingValue.end.isBefore(yieldArgs.skipToDate)\n ) {\n stream.workingValue = stream.value;\n stream.next();\n continue;\n }\n // make sure we are not after the user requested `end` time.\n if (args.end && stream.workingValue && stream.workingValue.isAfter(args.end)) {\n break;\n }\n if (stream.workingValue.duration > this.maxDuration) {\n throw new MergeDurationOperatorError(\n `MergeDurationOperatorError: Occurrence duration exceeded maxDuration of ` +\n this.maxDuration,\n );\n }\n yieldArgs = yield this.normalizeRunOutput(stream.workingValue);\n if (\n (yieldArgs === null || yieldArgs === void 0 ? void 0 : yieldArgs.skipToDate) &&\n stream.workingValue.isAfterOrEqual(yieldArgs.skipToDate)\n ) {\n throw new Error(\n 'A provided `skipToDate` option must be greater than the last yielded date ' +\n '(or smaller, in the case of reverse iteration)',\n );\n }\n stream.workingValue = stream.value;\n stream.next();\n }\n }\n *reverseRun(args = {}) {\n if (!this.config.base) return;\n // We want to find occurrences that end after the provided\n // `start` time even if they begin before the provided `start`\n // time. Because of this, we must begin iterating `maxDuration`\n // before the provided start time.\n let checkFromStart = args.start;\n if (args.start) {\n checkFromStart = args.start.subtract(this.maxDuration, 'millisecond');\n }\n let checkFromEnd = args.end;\n if (args.end) {\n checkFromEnd = args.end.add(this.maxDuration, 'millisecond');\n }\n const stream = new DurationIterableWrapper(\n this.config.base,\n Object.assign(Object.assign({}, args), { start: checkFromStart, end: checkFromEnd }),\n );\n let yieldArgs;\n // checking `stream.workingValue` because when `stream.done === true`\n // `stream.workingValue` will not have been yielded yet\n while (stream.workingValue) {\n // TODO(@john.carroll.p): figure out how to handle `DateTime#generators` for merged `DateTimes`\n while (!stream.done && stream.workingValue.isBeforeOrEqual(stream.value.end)) {\n if (stream.workingValue.duration > this.maxDuration) {\n throw new MergeDurationOperatorError(\n `MergeDurationOperatorError: Occurrence duration exceeded maxDuration of ` +\n this.maxDuration,\n );\n }\n if (\n stream.value.isBefore(stream.workingValue) ||\n stream.value.end.isAfter(stream.workingValue.end)\n ) {\n if (stream.value.end.isAfter(stream.workingValue.end)) {\n // `stream.workingValue` is a subset of `stream.value`\n // so simply replace `stream.workingValue` with `stream.value`\n stream.workingValue = stream.value;\n } else {\n const diff = stream.workingValue.valueOf() - stream.value.valueOf();\n stream.workingValue = stream.value.set('duration', stream.workingValue.duration + diff);\n }\n }\n stream.next();\n }\n // check to make sure the occurrence we are about to yield starts before the\n // provided start time.\n if (args.start && stream.workingValue.end.isBefore(args.start)) {\n break;\n }\n if (\n yieldArgs &&\n yieldArgs.skipToDate &&\n stream.workingValue.end.isBefore(yieldArgs.skipToDate)\n ) {\n stream.workingValue = stream.value;\n stream.next();\n continue;\n }\n // make sure we are not after the user requested `end` time.\n if (args.end && stream.workingValue && stream.workingValue.isAfter(args.end)) {\n stream.workingValue = stream.value;\n stream.next();\n continue;\n }\n if (stream.workingValue.duration > this.maxDuration) {\n throw new MergeDurationOperatorError(\n `MergeDurationOperatorError: Occurrence duration exceeded maxDuration of ` +\n this.maxDuration,\n );\n }\n yieldArgs = yield this.normalizeRunOutput(stream.workingValue);\n if (\n yieldArgs &&\n yieldArgs.skipToDate &&\n stream.workingValue.end.isBeforeOrEqual(yieldArgs.skipToDate)\n ) {\n throw new Error(\n 'A provided `skipToDate` option must be greater than the last yielded date ' +\n '(or smaller, in the case of reverse iteration)',\n );\n }\n stream.workingValue = stream.value;\n stream.next();\n }\n }\n}\n\nclass SplitDurationOperatorError extends Error {}\n/**\n * An operator function which takes an occurrence stream with\n * `hasDuration === true` and passes occurrences through a splitting\n * function. One usecase for this operator is to dynamically break up\n * occurrences with a large duration into several smaller occurrences.\n *\n * You must provide a `maxDuration` argument that represents the\n * maximum possible duration for a single occurrence. If this\n * duration is exceeded, a `SplitDurationOperatorError` will be\n * thrown.\n *\n * - For your convenience, you can globally set a default\n * `SplitDurationOperator#maxDuration` via\n * `RScheduleConfig.SplitDurationOperator.defaultMaxDuration`.\n *\n * Usage example:\n *\n * ```typescript\n * const MILLISECONDS_IN_HOUR = 1000 * 60 * 60;\n *\n * const splitFn = (date: DateTime) => {\n * if (date.duration > MILLISECONDS_IN_HOUR) {\n * const diff = date.duration! / 2;\n *\n * return [\n * date.set('duration', diff),\n * date.add(diff, 'millisecond').set('duration', diff),\n * ];\n * }\n *\n * return [date];\n * };\n *\n * const dates = new Dates({\n * dates: [\n * new StandardDateAdapter(new Date(2010, 10, 10, 13), { duration: MILLISECONDS_IN_HOUR * 1 }),\n * new StandardDateAdapter(new Date(2010, 10, 11, 13), { duration: MILLISECONDS_IN_HOUR * 2 }),\n * ],\n * dateAdpter: StandardDateAdapter,\n * }).pipe(\n * splitDuration({\n * splitFn,\n * maxDuration: MILLISECONDS_IN_HOUR * 1\n * })\n * )\n *\n * expect(dates.occurrences().toArray()).toEqual([\n * new StandardDateAdapter(new Date(2010, 10, 10, 13), { duration: MILLISECONDS_IN_HOUR * 1 }),\n * new StandardDateAdapter(new Date(2010, 10, 11, 13), { duration: MILLISECONDS_IN_HOUR * 1 }),\n * new StandardDateAdapter(new Date(2010, 10, 11, 14), { duration: MILLISECONDS_IN_HOUR * 1 }),\n * ])\n * ```\n */\nfunction splitDuration(args) {\n return options => new SplitDurationOperator(args, options);\n}\nclass SplitDurationOperator extends Operator {\n constructor(args, config) {\n super([], config);\n this.splitFn = args.splitFn;\n this.maxDuration = args.maxDuration;\n if (config.base && !config.base.hasDuration) {\n throw new ArgumentError(\n 'Base stream provided to SplitDurationOperator does not have an associated duration. ' +\n 'The SplitDurationOperator can only be used with streams which have a duration.',\n );\n }\n }\n /** Not actually used but necessary for IRunnable interface */\n set(_, value) {\n return new SplitDurationOperator(\n {\n maxDuration: this.maxDuration,\n splitFn: this.splitFn,\n },\n Object.assign(Object.assign({}, this.config), {\n base: this.config.base && this.config.base.set('timezone', value),\n timezone: value,\n }),\n );\n }\n *_run(args = {}) {\n if (!this.config.base) return;\n const reverse = args.reverse || false;\n // We want to find occurrences that end after the provided\n // `start` time even if they begin before the provided `start`\n // time. Because of this, we add `maxDuration` to\n // the provided start time.\n let checkFromStart = args.start;\n if (args.start) {\n checkFromStart = args.start.subtract(this.maxDuration, 'millisecond');\n }\n // same goes for `end` time as with `start` time.\n let checkFromEnd = args.end;\n if (args.end) {\n checkFromEnd = args.end.add(this.maxDuration, 'millisecond');\n }\n const stream = new IterableWrapper(\n this.config.base,\n Object.assign(Object.assign({}, args), { start: checkFromStart, end: checkFromEnd }),\n );\n let yieldArgs;\n const datesBucket = [];\n while (!stream.done || (datesBucket[0] && datesBucket[0][0])) {\n /**\n * Example:\n * 10am - 2pm -> 10am - 12pm, 12pm - 2pm\n * 11am - 3pm -> 11am - 1pm, 1pm - 3pm\n * 2pm - 4pm -> 2pm - 3pm, 3pm - 4pm\n */\n if (!(datesBucket[0] && datesBucket[0][0])) {\n // we're out of dates\n datesBucket.push(this.splitDate(stream.value, reverse));\n stream.next();\n }\n while (\n !stream.done &&\n (reverse\n ? datesBucket[0].some(date => date.isBeforeOrEqual(stream.value.end))\n : datesBucket[0].some(date => date.isAfterOrEqual(stream.value)))\n ) {\n datesBucket.push(this.splitDate(stream.value, reverse));\n stream.next();\n }\n let selectedDate = datesBucket[0] && datesBucket[0][0];\n let bucketIndex = -1;\n let selectedBucketIndex = 0;\n let dateIndex = -1;\n let selectedDateIndex = 0;\n // find the next date as well as its location in the datesBucket\n for (const bucket of datesBucket) {\n bucketIndex++;\n dateIndex = -1;\n for (const date of bucket) {\n dateIndex++;\n let dateShouldComeNext;\n if (reverse) {\n dateShouldComeNext =\n date.isAfter(selectedDate) ||\n (date.isEqual(selectedDate) && date.duration > selectedDate.duration);\n } else {\n dateShouldComeNext =\n date.isBefore(selectedDate) ||\n (date.isEqual(selectedDate) && date.duration < selectedDate.duration);\n }\n if (dateShouldComeNext) {\n selectedDate = date;\n selectedBucketIndex = bucketIndex;\n selectedDateIndex = dateIndex;\n break;\n }\n }\n }\n datesBucket[selectedBucketIndex].splice(selectedDateIndex, 1);\n if (datesBucket[selectedBucketIndex].length === 0) {\n datesBucket.splice(selectedBucketIndex, 1);\n }\n // If we've been yieldedArgs from the last cycle, check to see\n // that the selectedDate honors the `skipToDate` requirement\n // if not, discard this selectedDate\n if (\n yieldArgs &&\n yieldArgs.skipToDate &&\n selectedDate &&\n !datePastEnd(selectedDate, args) &&\n !datePastSkipToDate(selectedDate, yieldArgs.skipToDate, args)\n ) {\n continue;\n }\n // because we subtracted `maxDuration` to the base iterator's start time,\n // check to make sure the selectedDate we are about to yield should\n // actually be yielded (it may be before the provided `start` time).\n // If not, discard the selectedDate.\n if (args.start && selectedDate.end.isBefore(args.start)) {\n if (reverse) break;\n continue;\n }\n // because we added `maxDuration` to the base iterator's end time,\n // check to make sure the selectedDate we are about to yield should\n // actually be yielded (it may be after the provided `end` time).\n // If not, end iteration.\n if (args.end && selectedDate.isAfter(args.end)) {\n if (reverse) continue;\n break;\n }\n if (selectedDate.duration > this.maxDuration) {\n throw new SplitDurationOperatorError(\n `SplitDurationOperatorError: Occurrence duration exceeded maxDuration of ` +\n this.maxDuration,\n );\n }\n yieldArgs = yield this.normalizeRunOutput(selectedDate);\n if (\n yieldArgs &&\n yieldArgs.skipToDate &&\n (args.reverse\n ? selectedDate.isBeforeOrEqual(yieldArgs.skipToDate)\n : selectedDate.isAfterOrEqual(yieldArgs.skipToDate))\n ) {\n throw new Error(\n 'A provided `skipToDate` option must be greater than the last yielded date ' +\n '(or smaller, in the case of reverse iteration)',\n );\n }\n }\n }\n calculateIsInfinite() {\n return !!(this.config.base && this.config.base.isInfinite);\n }\n calculateHasDuration() {\n return true;\n }\n splitDate(date, reverse) {\n const dates = this.splitFn(date);\n let valid;\n if (dates.length === 0) {\n valid = false;\n } else if (dates.length === 1) {\n valid = date.duration === dates[0].duration;\n } else {\n valid = date.duration === dates.reduce((prev, curr) => prev + curr.duration, 0);\n }\n if (!valid) {\n throw new Error(\n 'The provided SplitDurationOperator split function ' +\n 'must return an array of DateTimes with length > 0 ' +\n 'where the total duration of the new dates equals the duration of ' +\n 'the original date.',\n );\n }\n dates.sort(dateTimeSortComparer);\n if (reverse) {\n dates.reverse();\n }\n return dates;\n }\n}\nfunction datePastEnd(date, options) {\n return !!(options.reverse\n ? options.start && date.isBefore(options.start)\n : options.end && date.isAfter(options.end));\n}\nfunction datePastSkipToDate(date, skipToDate, options) {\n return !!(options.reverse ? skipToDate.isAfterOrEqual(date) : skipToDate.isBeforeOrEqual(date));\n}\n\nexport {\n AddOperator,\n Calendar,\n Collection,\n CollectionIterator,\n Dates,\n IntersectionOperator,\n MergeDurationOperator,\n MergeDurationOperatorError,\n OccurrenceGenerator,\n OccurrenceIterator,\n Operator,\n Rule,\n RuleBase,\n Schedule,\n ScheduleBase,\n SplitDurationOperator,\n SplitDurationOperatorError,\n SubtractOperator,\n UniqueOperator,\n add,\n intersection,\n mergeDuration,\n splitDuration,\n subtract,\n unique,\n};\n","class InvalidDateAdapterError extends Error {}\nlet dateAdapterConfig;\nclass DateAdapterBase {\n constructor(_date, options) {\n this.duration = (options && options.duration) || 0;\n this.generators = (options && options.generators && options.generators.slice()) || [];\n if (!Number.isInteger(this.duration) || this.duration < 0) {\n throw new InvalidDateAdapterError('duration must be a non-negative integer');\n }\n }\n static set adapter(value) {\n if (dateAdapterConfig) {\n throw new Error(`\"${dateAdapterConfig.name}\" has already been configured.`);\n }\n dateAdapterConfig = value;\n }\n static get adapter() {\n if (!dateAdapterConfig) {\n throw new Error('No date adapter has been configured. See rSchedule docs.');\n }\n return dateAdapterConfig;\n }\n static isDate(_object) {\n throw unimplementedError('isDate()');\n }\n static fromDate(_date, _options) {\n throw unimplementedError('fromDate()');\n }\n static fromJSON(_json) {\n throw unimplementedError('fromJSON()');\n }\n static fromDateTime(_datetime) {\n throw unimplementedError('fromDateTime()');\n }\n /**\n * Returns a string in simplified extended ISO format (ISO 8601).\n *\n * _Note: this method is intended for testing and its\n * implementation isn't particularly performant._\n */\n toISOString() {\n return this.set('timezone', 'UTC')\n .toDateTime()\n .toISOString();\n }\n toDateTime() {\n const date = DateTime.fromJSON(\n Object.assign(Object.assign({}, this.toJSON()), { generators: this.generators }),\n );\n return date;\n }\n}\nDateAdapterBase.hasTimezoneSupport = false;\nfunction unimplementedError(name) {\n return new Error(`You must implement the \"${name}\" method for this DateAdapter class`);\n}\nvar DateAdapter;\n(function(DateAdapter) {\n DateAdapter.WEEKDAYS = ['SU', 'MO', 'TU', 'WE', 'TH', 'FR', 'SA'];\n DateAdapter.MILLISECONDS_IN_SECOND = 1000;\n DateAdapter.MILLISECONDS_IN_MINUTE = DateAdapter.MILLISECONDS_IN_SECOND * 60;\n DateAdapter.MILLISECONDS_IN_HOUR = DateAdapter.MILLISECONDS_IN_MINUTE * 60;\n DateAdapter.MILLISECONDS_IN_DAY = DateAdapter.MILLISECONDS_IN_HOUR * 24;\n DateAdapter.MILLISECONDS_IN_WEEK = DateAdapter.MILLISECONDS_IN_DAY * 7;\n})(DateAdapter || (DateAdapter = {}));\nclass InvalidDateTimeError extends Error {}\nclass DateTime {\n constructor(date, timezone, duration, generators) {\n this.date = new Date(date);\n this.timezone = timezone || null;\n this.duration = duration || 0;\n this.generators = (generators && generators.slice()) || [];\n if (!Number.isInteger(this.duration) || this.duration < 0) {\n throw new InvalidDateTimeError('duration must be a non-negative integer');\n }\n this.assertIsValid();\n }\n // /**\n // * Similar to `Array.isArray()`, `isInstance()` provides a surefire method\n // * of determining if an object is a `DateTime` by checking against the\n // * global symbol registry.\n // */\n // static isInstance(object: any): object is DateTime {\n // return !!(object && object[DATETIME_ID]);\n // }\n static fromJSON(json) {\n const date = new Date(\n Date.UTC(\n json.year,\n json.month - 1,\n json.day,\n json.hour,\n json.minute,\n json.second,\n json.millisecond,\n ),\n );\n return new DateTime(date, json.timezone, json.duration, json.generators);\n }\n static fromDateAdapter(adapter) {\n return DateTime.fromJSON(\n Object.assign(Object.assign({}, adapter.toJSON()), { generators: adapter.generators }),\n );\n }\n /**\n * Returns `undefined` if `duration` is `0`. Else returns\n * the `end` date.\n */\n get end() {\n if (!this.duration) return;\n if (this._end) return this._end;\n this._end = this.add(this.duration, 'millisecond');\n return this._end;\n }\n // While we constrain the argument to be another DateAdapter in typescript\n // we handle the case of someone passing in another type of object in javascript\n isEqual(object) {\n if (!object) {\n return false;\n }\n assertSameTimeZone(this, object);\n return this.valueOf() === object.valueOf();\n }\n isBefore(object) {\n assertSameTimeZone(this, object);\n return this.valueOf() < object.valueOf();\n }\n isBeforeOrEqual(object) {\n assertSameTimeZone(this, object);\n return this.valueOf() <= object.valueOf();\n }\n isAfter(object) {\n assertSameTimeZone(this, object);\n return this.valueOf() > object.valueOf();\n }\n isAfterOrEqual(object) {\n assertSameTimeZone(this, object);\n return this.valueOf() >= object.valueOf();\n }\n isOccurring(object) {\n if (!this.duration) {\n throw new Error('DateTime#isOccurring() is only applicable to DateTimes with durations');\n }\n assertSameTimeZone(this, object);\n return (\n object.isAfterOrEqual(this) && object.isBeforeOrEqual(this.add(this.duration, 'millisecond'))\n );\n }\n add(amount, unit) {\n switch (unit) {\n case 'generator': {\n const generators = this.generators.slice();\n generators.unshift(amount);\n return new DateTime(this.date, this.timezone, this.duration, generators);\n }\n case 'year':\n return this.forkDateTime(addUTCYears(this.date, amount));\n case 'month':\n return this.forkDateTime(addUTCMonths(this.date, amount));\n case 'week':\n return this.forkDateTime(addUTCWeeks(this.date, amount));\n case 'day':\n return this.forkDateTime(addUTCDays(this.date, amount));\n case 'hour':\n return this.forkDateTime(addUTCHours(this.date, amount));\n case 'minute':\n return this.forkDateTime(addUTCMinutes(this.date, amount));\n case 'second':\n return this.forkDateTime(addUTCSeconds(this.date, amount));\n case 'millisecond':\n return this.forkDateTime(addUTCMilliseconds(this.date, amount));\n default:\n throw new Error('Invalid unit provided to `DateTime#add`');\n }\n }\n subtract(amount, unit) {\n switch (unit) {\n case 'year':\n return this.forkDateTime(subUTCYears(this.date, amount));\n case 'month':\n return this.forkDateTime(subUTCMonths(this.date, amount));\n case 'week':\n return this.forkDateTime(subUTCWeeks(this.date, amount));\n case 'day':\n return this.forkDateTime(subUTCDays(this.date, amount));\n case 'hour':\n return this.forkDateTime(subUTCHours(this.date, amount));\n case 'minute':\n return this.forkDateTime(subUTCMinutes(this.date, amount));\n case 'second':\n return this.forkDateTime(subUTCSeconds(this.date, amount));\n case 'millisecond':\n return this.forkDateTime(subUTCMilliseconds(this.date, amount));\n default:\n throw new Error('Invalid unit provided to `DateTime#subtract`');\n }\n }\n get(unit) {\n switch (unit) {\n case 'year':\n return this.date.getUTCFullYear();\n case 'month':\n return this.date.getUTCMonth() + 1;\n case 'yearday':\n return getUTCYearDay(this.date);\n case 'weekday':\n return DateAdapter.WEEKDAYS[this.date.getUTCDay()];\n case 'day':\n return this.date.getUTCDate();\n case 'hour':\n return this.date.getUTCHours();\n case 'minute':\n return this.date.getUTCMinutes();\n case 'second':\n return this.date.getUTCSeconds();\n case 'millisecond':\n return this.date.getUTCMilliseconds();\n default:\n throw new Error('Invalid unit provided to `DateTime#set`');\n }\n }\n set(unit, value) {\n if (unit === 'duration') {\n return new DateTime(this.date, this.timezone, value, this.generators);\n }\n if (unit === 'generators') {\n return new DateTime(this.date, this.timezone, this.duration, value);\n }\n let date = new Date(this.date);\n switch (unit) {\n case 'year':\n date.setUTCFullYear(value);\n break;\n case 'month': {\n // If the current day of the month\n // is greater than days in the month we are moving to, we need to also\n // set the day to the end of that month.\n const length = monthLength(value, date.getUTCFullYear());\n const day = date.getUTCDate();\n if (day > length) {\n date.setUTCDate(1);\n date.setUTCMonth(value);\n date = subUTCDays(date, 1);\n } else {\n date.setUTCMonth(value - 1);\n }\n break;\n }\n case 'day':\n date.setUTCDate(value);\n break;\n case 'hour':\n date.setUTCHours(value);\n break;\n case 'minute':\n date.setUTCMinutes(value);\n break;\n case 'second':\n date.setUTCSeconds(value);\n break;\n case 'millisecond':\n date.setUTCMilliseconds(value);\n break;\n default:\n throw new Error('Invalid unit provided to `DateTime#set`');\n }\n return this.forkDateTime(date);\n }\n granularity(granularity, opt = {}) {\n let date = this.forkDateTime(this.date);\n switch (granularity) {\n case 'year':\n date = date.set('month', 1);\n case 'month':\n date = date.set('day', 1);\n break;\n case 'week':\n date = setDateToStartOfWeek(date, opt.weekStart);\n }\n switch (granularity) {\n case 'year':\n case 'month':\n case 'week':\n case 'day':\n date = date.set('hour', 0);\n case 'hour':\n date = date.set('minute', 0);\n case 'minute':\n date = date.set('second', 0);\n case 'second':\n date = date.set('millisecond', 0);\n case 'millisecond':\n return date;\n default:\n throw new Error('Invalid granularity provided to `DateTime#granularity`: ' + granularity);\n }\n }\n endGranularity(granularity, opt = {}) {\n let date = this.forkDateTime(this.date);\n switch (granularity) {\n case 'year':\n date = date.set('month', 12);\n case 'month':\n date = date.set('day', monthLength(date.get('month'), date.get('year')));\n break;\n case 'week':\n date = setDateToEndOfWeek(date, opt.weekStart);\n }\n switch (granularity) {\n case 'year':\n case 'month':\n case 'week':\n case 'day':\n date = date.set('hour', 23);\n case 'hour':\n date = date.set('minute', 59);\n case 'minute':\n date = date.set('second', 59);\n case 'second':\n date = date.set('millisecond', 999);\n case 'millisecond':\n return date;\n default:\n throw new Error('Invalid granularity provided to `DateTime#granularity`: ' + granularity);\n }\n }\n toISOString() {\n return this.date.toISOString();\n }\n toDateTime() {\n return this;\n }\n toJSON() {\n const json = {\n timezone: this.timezone,\n year: this.get('year'),\n month: this.get('month'),\n day: this.get('day'),\n hour: this.get('hour'),\n minute: this.get('minute'),\n second: this.get('second'),\n millisecond: this.get('millisecond'),\n };\n if (this.duration) {\n json.duration = this.duration;\n }\n return json;\n }\n valueOf() {\n return this.date.valueOf();\n }\n assertIsValid() {\n if (isNaN(this.valueOf())) {\n throw new InvalidDateTimeError('DateTime has invalid date.');\n }\n return true;\n }\n forkDateTime(date) {\n return new DateTime(date, this.timezone, this.duration, this.generators);\n }\n}\nfunction assertSameTimeZone(x, y) {\n if (x.timezone !== y.timezone) {\n throw new InvalidDateTimeError(\n 'Attempted to compare a datetime to another date in a different timezone: ' +\n JSON.stringify(x) +\n ' and ' +\n JSON.stringify(y),\n );\n }\n return true;\n}\nfunction setDateToStartOfWeek(date, wkst) {\n const index = orderedWeekdays(wkst).indexOf(date.get('weekday'));\n return date.subtract(index, 'day');\n}\nfunction setDateToEndOfWeek(date, wkst) {\n const index = orderedWeekdays(wkst).indexOf(date.get('weekday'));\n return date.add(6 - index, 'day');\n}\nfunction dateTimeSortComparer(a, b) {\n if (a.isAfter(b)) return 1;\n if (a.isBefore(b)) return -1;\n if (a.duration && b.duration) {\n if (a.duration > b.duration) return 1;\n if (a.duration < b.duration) return -1;\n }\n return 0;\n}\nfunction uniqDateTimes(dates) {\n return Array.from(new Map(dates.map(date => [date.toISOString(), date])).values());\n}\nfunction orderedWeekdays(wkst = 'SU') {\n const wkdays = DateAdapter.WEEKDAYS.slice();\n let index = wkdays.indexOf(wkst);\n while (index !== 0) {\n shiftArray(wkdays);\n index--;\n }\n return wkdays;\n}\nfunction shiftArray(array, from = 'first') {\n if (array.length === 0) {\n return array;\n } else if (from === 'first') {\n array.push(array.shift());\n } else {\n array.unshift(array.pop());\n }\n return array;\n}\nfunction getDifferenceBetweenWeekdays(x, y) {\n if (x === y) return 0;\n const result = DateAdapter.WEEKDAYS.indexOf(x) - DateAdapter.WEEKDAYS.indexOf(y);\n return result > 0 ? 7 - result : Math.abs(result);\n}\n/**\n * Returns the days in the given month.\n *\n * @param month base-1\n * @param year\n */\nfunction monthLength(month, year) {\n const block = {\n 1: 31,\n 2: getDaysInFebruary(year),\n 3: 31,\n 4: 30,\n 5: 31,\n 6: 30,\n 7: 31,\n 8: 31,\n 9: 30,\n 10: 31,\n 11: 30,\n 12: 31,\n };\n return block[month];\n}\nfunction getDaysInFebruary(year) {\n return isLeapYear(year) ? 29 : 28;\n}\n// taken from date-fn\nfunction isLeapYear(year) {\n return year % 400 === 0 || (year % 4 === 0 && year % 100 !== 0);\n}\nfunction getDaysInYear(year) {\n return isLeapYear(year) ? 366 : 365;\n}\nfunction getUTCYearDay(now) {\n const start = new Date(Date.UTC(now.getUTCFullYear(), 0, 1));\n const diff = now.valueOf() - start.valueOf();\n return 1 + Math.floor(diff / DateAdapter.MILLISECONDS_IN_DAY);\n}\n/**\n * These functions are basically lifted from `date-fns`, but changed\n * to use the UTC date methods, which `date-fns` doesn't support.\n */\nfunction toInteger(input) {\n if (input === null || input === true || input === false) {\n return NaN;\n }\n const int = Number(input);\n if (isNaN(int)) {\n return int;\n }\n return int < 0 ? Math.ceil(int) : Math.floor(int);\n}\nfunction addMilliseconds(dirtyDate, dirtyAmount) {\n if (arguments.length < 2) {\n throw new TypeError('2 arguments required, but only ' + arguments.length + ' present');\n }\n const timestamp = dirtyDate.valueOf();\n const amount = toInteger(dirtyAmount);\n return new Date(timestamp + amount);\n}\nfunction addUTCYears(date, input) {\n const amount = toInteger(input);\n return addUTCMonths(date, amount * 12);\n}\nfunction addUTCMonths(date, input) {\n const amount = toInteger(input);\n date = new Date(date);\n const desiredMonth = date.getUTCMonth() + amount;\n const dateWithDesiredMonth = new Date(0);\n dateWithDesiredMonth.setUTCFullYear(date.getUTCFullYear(), desiredMonth, 1);\n dateWithDesiredMonth.setUTCHours(0, 0, 0, 0);\n const daysInMonth = monthLength(\n dateWithDesiredMonth.getUTCMonth() + 1,\n dateWithDesiredMonth.getUTCFullYear(),\n );\n // Set the last day of the new month\n // if the original date was the last day of the longer month\n date.setUTCMonth(desiredMonth, Math.min(daysInMonth, date.getUTCDate()));\n return date;\n}\nfunction addUTCWeeks(date, input) {\n const amount = toInteger(input);\n const days = amount * 7;\n return addUTCDays(date, days);\n}\nfunction addUTCDays(date, input) {\n // by adding milliseconds rather than days, we supress the native Date object's automatic\n // daylight savings time conversions which we don't want in UTC mode\n return addUTCMilliseconds(date, toInteger(input) * DateAdapter.MILLISECONDS_IN_DAY);\n}\nfunction addUTCHours(date, input) {\n const amount = toInteger(input);\n return addMilliseconds(date, amount * DateAdapter.MILLISECONDS_IN_HOUR);\n}\nfunction addUTCMinutes(date, input) {\n const amount = toInteger(input);\n return addMilliseconds(date, amount * DateAdapter.MILLISECONDS_IN_MINUTE);\n}\nfunction addUTCSeconds(date, input) {\n const amount = toInteger(input);\n return addMilliseconds(date, amount * DateAdapter.MILLISECONDS_IN_SECOND);\n}\nfunction addUTCMilliseconds(date, input) {\n const amount = toInteger(input);\n const timestamp = date.getTime();\n return new Date(timestamp + amount);\n}\nfunction subUTCYears(date, amount) {\n return addUTCYears(date, -amount);\n}\nfunction subUTCMonths(date, amount) {\n return addUTCMonths(date, -amount);\n}\nfunction subUTCWeeks(date, amount) {\n return addUTCWeeks(date, -amount);\n}\nfunction subUTCDays(date, amount) {\n return addUTCDays(date, -amount);\n}\nfunction subUTCHours(date, amount) {\n return addUTCHours(date, -amount);\n}\nfunction subUTCMinutes(date, amount) {\n return addUTCMinutes(date, -amount);\n}\nfunction subUTCSeconds(date, amount) {\n return addUTCSeconds(date, -amount);\n}\nfunction subUTCMilliseconds(date, amount) {\n return addUTCMilliseconds(date, -amount);\n}\n\nclass ArgumentError extends Error {}\nclass InfiniteLoopError extends Error {}\nfunction numberSortComparer(a, b) {\n if (a > b) {\n return 1;\n } else if (b > a) {\n return -1;\n } else {\n return 0;\n }\n}\nfunction freqToGranularity(freq) {\n switch (freq) {\n case 'YEARLY':\n return 'year';\n case 'MONTHLY':\n return 'month';\n case 'WEEKLY':\n return 'week';\n case 'DAILY':\n return 'day';\n case 'HOURLY':\n return 'hour';\n case 'MINUTELY':\n return 'minute';\n case 'SECONDLY':\n return 'second';\n case 'MILLISECONDLY':\n return 'millisecond';\n default:\n throw new Error('unknown freq passed to freqToGranularity()');\n }\n}\nfunction cloneJSON(json) {\n return JSON.parse(JSON.stringify(json));\n}\nfunction dateInputToDateAdapter(date) {\n // prettier-ignore\n return date instanceof DateTime ? DateAdapterBase.adapter.fromDateTime(date) :\n date instanceof DateAdapterBase ? date :\n DateAdapterBase.adapter.fromDate(date);\n}\nfunction dateInputToDateTime(date, timezone) {\n if (date instanceof DateTime) {\n if (date.timezone !== timezone) {\n return DateAdapterBase.adapter\n .fromDateTime(date)\n .set('timezone', timezone)\n .toDateTime();\n }\n return date;\n }\n return date instanceof DateAdapterBase\n ? date.set('timezone', timezone).toDateTime()\n : DateAdapterBase.adapter\n .fromDate(date)\n .set('timezone', timezone)\n .toDateTime();\n}\n// export function normalizeDateInput<T extends DateAdapter>(\n// dateAdapter: DateAdapterConstructor<T>,\n// input: DateInput<T>,\n// timezone: string | null,\n// ): DateTime {\n// if (input instanceof DateTime) {\n// if (input.timezone !== timezone) {\n// return dateAdapter\n// .fromDateTime(input)\n// .set('timezone', timezone)\n// .toDateTime();\n// }\n// return input;\n// }\n// return input instanceof DateAdapter\n// ? input.set('timezone', timezone).toDateTime()\n// : new dateAdapter(input).toDateTime();\n// }\nfunction normalizeDateTimeTimezone(date, timezone) {\n if (date.timezone !== timezone) {\n return DateAdapterBase.adapter\n .fromDateTime(date)\n .set('timezone', timezone)\n .toDateTime();\n }\n return date;\n}\n\nclass RuleOptionError extends Error {}\nfunction normalizeDefaultOptions(options) {\n let start;\n if (options.start instanceof DateTime) {\n start = options.start;\n } else if (options.start instanceof DateAdapterBase) {\n start = options.start.toDateTime();\n } else if (DateAdapterBase.adapter.isDate(options.start)) {\n start = DateAdapterBase.adapter.fromDate(options.start).toDateTime();\n } else {\n throw new RuleOptionError(\n '\"start\" must be either a `DateAdapter` instance or an instance of the ' +\n 'date a DateAdapter is wrapping (e.g. `StandardDateAdapter` wraps a `Date`)',\n );\n }\n let end;\n if (options.end) {\n if (options.end instanceof DateTime) {\n end = options.end;\n } else if (options.end instanceof DateAdapterBase) {\n end = options.end.toDateTime();\n } else if (DateAdapterBase.adapter.isDate(options.end)) {\n end = DateAdapterBase.adapter.fromDate(options.end).toDateTime();\n } else {\n throw new RuleOptionError(\n '\"end\" must be either be `undefined`, a `DateAdapter` instance, or an instance of the ' +\n 'date a DateAdapter is wrapping (e.g. `StandardDateAdapter` wraps a `Date`)',\n );\n }\n }\n if (options.duration !== undefined) {\n if (!Number.isInteger(options.duration)) {\n throw new RuleOptionError('\"duration\" expects a whole number');\n }\n if (options.duration <= 0) {\n throw new RuleOptionError('\"duration\" must be greater than 0');\n }\n }\n if (options.count !== undefined) {\n if (!Number.isInteger(options.count)) {\n throw new RuleOptionError('\"count\" must be a whole number');\n }\n if (options.count < 0) {\n throw new RuleOptionError('\"count\" must be greater than 0');\n }\n }\n if (options.end !== undefined && options.count !== undefined) {\n throw new RuleOptionError('\"end\" and \"count\" cannot both be present');\n }\n return {\n start,\n end,\n count: options.count,\n duration: options.duration,\n };\n}\nfunction normalizeRuleOptions(recurrenceModules, options) {\n const normOptions = normalizeDefaultOptions(options);\n const startOptions = cloneJSON(options);\n recurrenceModules.forEach(mod => {\n mod.normalizeOptions(startOptions, normOptions);\n });\n Object.keys(normOptions).forEach(key => {\n if (normOptions[key] === undefined) {\n delete normOptions[key];\n }\n });\n return normOptions;\n}\nfunction cloneRuleOptions(options) {\n const obj = cloneJSON(options);\n obj.start = options.start;\n if (options.end) obj.end = options.end;\n return obj;\n}\n\nclass RecurrenceRuleError extends Error {}\nclass ValidDateTime {\n constructor(date) {\n this.date = date;\n }\n}\nclass InvalidDateTime {\n constructor(date) {\n this.date = date;\n }\n}\nfunction recurrenceRulesReducer(rules) {\n return iterator =>\n rules.reduce((prev, curr) => {\n const rule = curr.get(iterator);\n if (rule) prev.push(rule);\n return prev;\n }, []);\n}\n\nclass RecurrenceRulesIterator {\n constructor(recurrenceRules, options, args) {\n this.options = options;\n this.args = args;\n this.rules = [];\n this.iterator =\n // prettier-ignore\n this.options.count === undefined ? this.iterate() :\n this.args.reverse ? this.iterateWithReverseCount() :\n this.iterateWithCount();\n this.options = Object.assign(Object.assign({}, cloneJSON(options)), {\n start: options.start,\n end: options.end,\n });\n this.reverse = (this.options.count === undefined && args.reverse) || false;\n const { start, end } = this.normalizeDateTimeArgs(args);\n if (options.count !== undefined) {\n this.start = options.start;\n } else if (start && options.start) {\n this.start = start.isAfterOrEqual(options.start) ? start : options.start;\n } else {\n this.start = start || options.start;\n }\n if (end && options.end) {\n this.end = end.isBeforeOrEqual(options.end) ? end : options.end;\n } else {\n this.end = end || options.end;\n }\n if (this.args.reverse && !(options.count !== undefined || this.end)) {\n throw new Error(\n 'When iterating in reverse, the rule must have an `end` or `count` ' +\n 'property or you must provide an `end` argument.',\n );\n }\n this.isInfinite = !this.end && this.options.count === undefined;\n this.hasDuration = !!this.options.duration;\n this.rules = Array.isArray(recurrenceRules) ? recurrenceRules : recurrenceRules(this);\n }\n [Symbol.iterator]() {\n return this.iterator;\n }\n next(args) {\n return this.iterator.next(args);\n }\n /**\n * In the pipe controller, we have an extra level of indirection with\n * the `run()` and `iterate()` methods. The `iterate()` method is the\n * method which actually runs the logic in the pipes. If we didn't\n * need to account for the `count` property of a rule, we would *only*\n * need the iterate method... so much simpler. But we do need to account\n * for rules with a `count` property.\n *\n * Rules with a `count` property need to begin iteration at the beginning\n * because the `count` is always from the rule's start time. So if someone\n * passes in a new start time as an argument to a rule with `count`, we\n * need to secretly iterate from the beginning, tracking the number of\n * iterations, and then only start yielding dates when we reach the section\n * the user cares about (or, if we hit our `count` quota, cancel iterating).\n *\n * Additionally, we need to handle iterating in reverse. In this case, we build\n * up a cache of dates between the rule's start time and the reverse iteration\n * start date. Once we hit the reverse iteration start date, we start\n * yielding dates in the cache, in reverse order.\n *\n * In general, I imagine the count number, if used, will be small. But a large\n * count will definitely have a negative performance affect. I don't think\n * there's anything to be done about this.\n */\n *iterateWithReverseCount() {\n const dates = Array.from(this.iterateWithCount()).reverse();\n let yieldArgs;\n const dateCache = dates.slice();\n let date = dateCache.shift();\n while (date) {\n if (yieldArgs && yieldArgs.skipToDate && date.isAfter(yieldArgs.skipToDate)) {\n date = dateCache.shift();\n continue;\n }\n yieldArgs = yield date;\n if (yieldArgs && yieldArgs.skipToDate && yieldArgs.skipToDate.isAfterOrEqual(date)) {\n throw new Error(\n 'A provided `skipToDate` option must be greater than the last yielded date ' +\n '(or smaller, in the case of reverse iteration)',\n );\n }\n date = dateCache.shift();\n }\n return undefined;\n }\n *iterateWithCount() {\n if (this.options.count === 0) return;\n const iterable = this.iterate();\n const start = this.args.start || this.start;\n let date = iterable.next().value;\n let index = 1;\n let yieldArgs;\n while (date && index <= this.options.count) {\n index++;\n if (date.isBefore(start)) {\n date = iterable.next().value;\n continue;\n }\n if (yieldArgs && yieldArgs.skipToDate && date.isBefore(yieldArgs.skipToDate)) {\n date = iterable.next().value;\n continue;\n }\n yieldArgs = yield date;\n if (yieldArgs && yieldArgs.skipToDate && yieldArgs.skipToDate.isBeforeOrEqual(date)) {\n throw new Error(\n 'A provided `skipToDate` option must be greater than the last yielded date ' +\n '(or smaller, in the case of reverse iteration)',\n );\n }\n date = iterable.next().value;\n }\n return undefined;\n }\n *iterate() {\n let startingDate = this.start;\n if (this.reverse) startingDate = this.end;\n let date = this.nextDate(startingDate);\n while (date) {\n const args = yield this.normalizeRunOutput(date);\n if (args && args.skipToDate) {\n if (\n this.reverse\n ? args.skipToDate.isAfterOrEqual(date)\n : args.skipToDate.isBeforeOrEqual(date)\n ) {\n // We cannot consistently skip backwards because after an iterator is \"done\"\n // it always returns undefined and you cannot reset it. Theoretically, it would be\n // fine to skip backwards if the iterator wasn't already \"done\", but this\n // would be prone to user error so we simply disallow skipping backwards altogether.\n throw new Error(\n 'A provided `skipToDate` option must be greater than the last yielded date ' +\n '(or smaller, in the case of reverse iteration)',\n );\n }\n date = this.nextDate(args.skipToDate);\n } else {\n date = this.nextDate(\n this.reverse ? date.subtract(1, 'millisecond') : date.add(1, 'millisecond'),\n );\n }\n }\n return undefined;\n }\n /**\n * Loops through the recurrence rules until a valid date is found.\n */\n nextDate(start) {\n let result = this.runRules(start.set('generators', []));\n if (this.isDatePastEnd(result.date)) return null;\n let index = 0;\n while (result instanceof InvalidDateTime && index < 50) {\n result = this.runRules(result.date);\n if (this.isDatePastEnd(result.date)) return null;\n index++;\n }\n if (result instanceof InvalidDateTime) {\n throw new RecurrenceRuleError(\n `Failed to find a matching occurrence in ${index} iterations. ` +\n `Last iterated date: \"${result.date.toISOString()}\"`,\n );\n }\n if (this.reverse ? start.isBefore(result.date) : start.isAfter(result.date)) {\n throw new RecurrenceRuleError(\n 'An error occurred in a recurrence rule. If this happened using ' +\n 'the rSchedule provided recurrence rules, you should ' +\n 'open an issue in the rSchedule repo. The maintainer is going to ' +\n 'want to know how to recreate the error.',\n );\n }\n return result.date;\n }\n /**\n * Performs one run of the recurrence rules and returns the result.\n * It's a slightly optimized reducer function.\n */\n runRules(start) {\n let result = new ValidDateTime(start);\n for (const rule of this.rules) {\n if (result instanceof InvalidDateTime) {\n return result;\n }\n result = rule.run(result.date);\n }\n return result;\n }\n isDatePastEnd(date) {\n return this.reverse ? date.isBefore(this.start) : this.end && date.isAfter(this.end);\n }\n normalizeRunOutput(date) {\n return this.hasDuration ? date.set('duration', this.options.duration) : date;\n }\n normalizeDateTimeArgs(args) {\n return {\n start: args.start && normalizeDateTimeTimezone(args.start, this.options.start.timezone),\n end: args.end && normalizeDateTimeTimezone(args.end, this.options.start.timezone),\n };\n }\n}\n\nexport {\n ArgumentError,\n DateAdapter,\n DateAdapterBase,\n DateTime,\n InfiniteLoopError,\n InvalidDateAdapterError,\n InvalidDateTime,\n InvalidDateTimeError,\n RecurrenceRuleError,\n RecurrenceRulesIterator,\n RuleOptionError,\n ValidDateTime,\n cloneJSON,\n cloneRuleOptions,\n dateInputToDateAdapter,\n dateInputToDateTime,\n dateTimeSortComparer,\n freqToGranularity,\n getDaysInYear,\n getDifferenceBetweenWeekdays,\n isLeapYear,\n normalizeDateTimeTimezone,\n normalizeRuleOptions,\n numberSortComparer,\n orderedWeekdays,\n recurrenceRulesReducer,\n uniqDateTimes,\n};\n","import {\n freqToGranularity,\n ValidDateTime,\n InvalidDateTime,\n DateAdapter,\n RuleOptionError,\n numberSortComparer,\n getDifferenceBetweenWeekdays,\n RecurrenceRuleError,\n uniqDateTimes,\n dateTimeSortComparer,\n} from '@rschedule/core';\n\nclass RecurrenceRule {\n constructor(processor) {\n this.processor = processor;\n this.start = processor.start;\n this.end = processor.end;\n this.options = processor.options;\n }\n}\n\nclass FrequencyRule extends RecurrenceRule {\n constructor(processor, initDate) {\n super(processor);\n this.initDate = initDate;\n this.intervalUnit = freqToGranularity(this.options.frequency);\n this.firstIntervalStartDate = this.normalizedStartDate(this.options.start);\n this.intervalStartDate = this.firstIntervalStartDate;\n this.intervalEndDate = this.normalizedEndDate(this.firstIntervalStartDate);\n this.skipToInterval(this.initDate);\n }\n run(date) {\n return this.validateDate(new ValidDateTime(date));\n }\n validateDate(arg) {\n const { date } = arg;\n if (arg instanceof ValidDateTime && this.dateIsWithinInterval(date)) {\n return arg;\n }\n this.skipToInterval(date);\n return new InvalidDateTime(\n // if the interval is 1, date will always be within the interval\n this.dateIsWithinInterval(date) ? date : this.setToCurrentInterval(),\n );\n }\n setToCurrentInterval() {\n return this.intervalStartDate;\n }\n normalizedStartDate(date) {\n if (this.options.frequency === 'WEEKLY') {\n return date.granularity('week', { weekStart: this.options.weekStart });\n }\n return date.granularity(this.intervalUnit);\n }\n normalizedEndDate(start) {\n switch (this.options.frequency) {\n case 'YEARLY':\n return start.add(1, 'year');\n case 'MONTHLY':\n return start.add(1, 'month');\n case 'WEEKLY':\n return start.add(1, 'week');\n case 'DAILY':\n return start.add(1, 'day');\n case 'HOURLY':\n return start.add(1, 'hour');\n case 'MINUTELY':\n return start.add(1, 'minute');\n case 'SECONDLY':\n return start.add(1, 'second');\n case 'MILLISECONDLY':\n return start.add(1, 'millisecond');\n default:\n throw new Error(`Unknown frequency ${this.options.frequency}`);\n }\n }\n skipToInterval(date) {\n const amount = this.intervalDifference(date);\n this.intervalStartDate = this.firstIntervalStartDate.add(amount, this.intervalUnit);\n this.intervalEndDate = this.normalizedEndDate(this.intervalStartDate);\n }\n dateIsWithinInterval(date) {\n return this.intervalStartDate.isBeforeOrEqual(date) && this.intervalEndDate.isAfter(date);\n }\n intervalDifference(date) {\n return intervalDifferenceBetweenDates({\n first: this.firstIntervalStartDate,\n second: date,\n unit: this.intervalUnit,\n interval: this.options.interval,\n weekStart: this.options.weekStart,\n direction: 'after',\n });\n }\n}\n/**\n * Given the frequency (unit) and interval, this function finds\n * how many jumps forward the first date needs in order to equal\n * or exceed the second date.\n *\n * For example:\n *\n * 1. Unit is daily and interval is 1. The second date is 3 days\n * after the first. This will return 3.\n * 2. Unit is yearly and interval is 1. The second date is 3 days\n * after the first. This will return 0.\n * 3. Unit is yearly and interval is 3. The second date is 4 years\n * after the first. This will return 6.\n */\nfunction intervalDifferenceBetweenDates({ first, second, unit, interval, weekStart, direction }) {\n let difference = (() => {\n let intervalDuration;\n let months;\n switch (unit) {\n case 'year':\n months = (second.get('year') - first.get('year')) * 12;\n months = months + second.get('month') - first.get('month');\n return Math.floor(months / 12);\n case 'month':\n months = (second.get('year') - first.get('year')) * 12;\n months = months + second.get('month') - first.get('month');\n return months;\n case 'week':\n first = first.granularity('week', { weekStart });\n intervalDuration = DateAdapter.MILLISECONDS_IN_WEEK;\n break;\n case 'day':\n intervalDuration = DateAdapter.MILLISECONDS_IN_DAY;\n break;\n case 'hour':\n intervalDuration = DateAdapter.MILLISECONDS_IN_HOUR;\n break;\n case 'minute':\n intervalDuration = DateAdapter.MILLISECONDS_IN_MINUTE;\n break;\n case 'second':\n intervalDuration = DateAdapter.MILLISECONDS_IN_SECOND;\n break;\n case 'millisecond':\n intervalDuration = 1;\n break;\n default:\n throw new Error('Unexpected `unit` value');\n }\n const diff = second.valueOf() - first.valueOf();\n return Math.floor(diff / intervalDuration);\n })();\n const fn = direction === 'after' ? Math.ceil : Math.floor;\n difference = fn(difference / interval) * interval;\n return difference;\n}\n\nclass RevFrequencyRule extends FrequencyRule {\n setToCurrentInterval() {\n return this.intervalEndDate.subtract(1, 'millisecond');\n }\n intervalDifference(date) {\n return intervalDifferenceBetweenDates({\n first: this.firstIntervalStartDate,\n second: date,\n unit: this.intervalUnit,\n interval: this.options.interval,\n weekStart: this.options.weekStart,\n direction: 'before',\n });\n }\n}\n\nconst FREQUENCIES = [\n 'MILLISECONDLY',\n 'SECONDLY',\n 'MINUTELY',\n 'HOURLY',\n 'DAILY',\n 'WEEKLY',\n 'MONTHLY',\n 'YEARLY',\n];\nconst FrequencyRuleModule = {\n name: 'FrequencyRule',\n get: processor => {\n if (\n processor.options.byMillisecondOfSecond !== undefined ||\n processor.options.frequency !== 'MILLISECONDLY'\n ) {\n return null;\n }\n if (processor.reverse) return new RevFrequencyRule(processor, processor.end);\n return new FrequencyRule(processor, processor.start);\n },\n normalizeOptions: (options, norm) => {\n if (!FREQUENCIES.includes(options.frequency)) {\n throw new RuleOptionError(`\"frequency\" must be one of ${JSON.stringify(FREQUENCIES)}`);\n }\n if (options.interval !== undefined) {\n if (!Number.isInteger(options.interval)) {\n throw new RuleOptionError('\"interval\" expects a whole number');\n }\n if (options.interval < 1) {\n throw new RuleOptionError('\"interval\" cannot be less than 1');\n }\n }\n if (options.weekStart !== undefined) {\n if (!DateAdapter.WEEKDAYS.includes(options.weekStart)) {\n throw new RuleOptionError(\n `\"weekStart\" must be one of ${JSON.stringify(DateAdapter.WEEKDAYS)}`,\n );\n }\n }\n norm.frequency = options.frequency;\n norm.interval = options.interval || 1;\n norm.weekStart = options.weekStart || 'MO';\n },\n deps: () => [FrequencyRuleModule],\n};\n\nfunction ruleOptionFilled(option) {\n return Array.isArray(option) && option.length > 0;\n}\n\nconst freqCache = new WeakMap();\nclass RecurrenceRuleBase extends RecurrenceRule {\n constructor(processor) {\n super(processor);\n if (!freqCache.has(this.processor)) {\n freqCache.set(this.processor, new FrequencyRule(processor, processor.start));\n }\n this.frequency = freqCache.get(this.processor);\n }\n validateDate(arg) {\n return this.frequency.validateDate(arg);\n }\n}\nclass RevRecurrenceRuleBase extends RecurrenceRule {\n constructor(processor) {\n super(processor);\n if (!freqCache.has(this.processor)) {\n freqCache.set(this.processor, new RevFrequencyRule(processor, processor.end));\n }\n this.frequency = freqCache.get(this.processor);\n }\n validateDate(arg) {\n return this.frequency.validateDate(arg);\n }\n}\n\n/**\n * Contains shared logic for ByHourOfDay, ByMinuteOfHour,\n * BySecondOfMinute, and ByMillisecondOfSecond reverse rule pipes\n */\nclass RevByTimeOfUnitRule extends RevRecurrenceRuleBase {\n run(date) {\n // e.g. const currentTime = date.get('hour');\n const currentTime = date.get(this.granularity);\n // e.g. for (const time of this.options.byHourOfDay) {\n for (const time of this.option) {\n if (currentTime < time) continue;\n if (currentTime === time) {\n return this.validateDate(new ValidDateTime(date));\n }\n // e.g. return this.nextValidDate(args, date.endGranularity('day').set('hour', time));\n return this.validateDate(\n new InvalidDateTime(date.endGranularity(this.baseGranularity).set(this.granularity, time)),\n );\n }\n return this.validateDate(\n new InvalidDateTime(\n date\n // e.g. .endGranularity('day')\n .endGranularity(this.baseGranularity)\n // e.g. .subtract(1, 'day')\n .subtract(1, this.baseGranularity)\n // e.g. .set('hour', this.options.byHourOfDay[0]);\n .set(this.granularity, this.option[0]),\n ),\n );\n }\n}\n\nclass RevByMillisecondOfSecondRule extends RevByTimeOfUnitRule {\n constructor() {\n super(...arguments);\n this.baseGranularity = 'second';\n this.granularity = 'millisecond';\n this.option = this.options.byMillisecondOfSecond.slice().reverse();\n }\n}\n\n/**\n * Contains shared logic for ByHourOfDay, ByMinuteOfHour,\n * BySecondOfMinute, and ByMillisecondOfSecond rule pipes\n */\nclass ByTimeOfUnitRule extends RecurrenceRuleBase {\n run(date) {\n // e.g. const currentTime = date.get('hour');\n const currentTime = date.get(this.granularity);\n // e.g. for (const time of this.options.byHourOfDay) {\n for (const time of this.option) {\n if (currentTime > time) continue;\n if (currentTime === time) {\n return this.validateDate(new ValidDateTime(date));\n }\n // e.g. return this.nextValidDate(args, date.granularity('day').set('hour', time));\n return this.validateDate(\n new InvalidDateTime(date.granularity(this.baseGranularity).set(this.granularity, time)),\n );\n }\n return this.validateDate(\n new InvalidDateTime(\n date\n // e.g. .granularity('day')\n .granularity(this.baseGranularity)\n // e.g. .add(1, 'day')\n .add(1, this.baseGranularity)\n // e.g. .set('hour', this.options.byHourOfDay[0]);\n .set(this.granularity, this.option[0]),\n ),\n );\n }\n}\n\nclass ByMillisecondOfSecondRule extends ByTimeOfUnitRule {\n constructor() {\n super(...arguments);\n this.baseGranularity = 'second';\n this.granularity = 'millisecond';\n this.option = this.options.byMillisecondOfSecond;\n }\n}\n\nconst ByMillisecondOfSecondRuleModule = {\n name: 'ByMillisecondOfSecond',\n get: processor => {\n if (processor.options.byMillisecondOfSecond === undefined) return null;\n if (processor.reverse) return new RevByMillisecondOfSecondRule(processor);\n return new ByMillisecondOfSecondRule(processor);\n },\n normalizeOptions: (options, norm) => {\n if (options.byMillisecondOfSecond !== undefined) {\n if (!ruleOptionFilled(options.byMillisecondOfSecond)) {\n throw new RuleOptionError('\"byMillisecondOfSecond\" expects a non-empty array');\n }\n if (options.byMillisecondOfSecond.some(num => num < 0 || num > 999)) {\n throw new RuleOptionError('\"byMillisecondOfSecond\" values must be >= 0 && <= 999');\n }\n norm.byMillisecondOfSecond = options.byMillisecondOfSecond;\n norm.byMillisecondOfSecond.sort(numberSortComparer);\n } else if (options.frequency !== 'MILLISECONDLY') {\n norm.byMillisecondOfSecond = [norm.start.get('millisecond')];\n }\n },\n deps: () => [FrequencyRuleModule, ByMillisecondOfSecondRuleModule],\n};\n\nclass RevBySecondOfMinuteRule extends RevByTimeOfUnitRule {\n constructor() {\n super(...arguments);\n this.baseGranularity = 'minute';\n this.granularity = 'second';\n this.option = this.options.bySecondOfMinute.slice().reverse();\n }\n}\n\nclass BySecondOfMinuteRule extends ByTimeOfUnitRule {\n constructor() {\n super(...arguments);\n this.baseGranularity = 'minute';\n this.granularity = 'second';\n this.option = this.options.bySecondOfMinute;\n }\n}\n\nconst BySecondOfMinuteRuleModule = {\n name: 'BySecondOfMinute',\n get: processor => {\n if (processor.options.bySecondOfMinute === undefined) return null;\n if (processor.reverse) return new RevBySecondOfMinuteRule(processor);\n return new BySecondOfMinuteRule(processor);\n },\n normalizeOptions: (options, norm) => {\n if (options.bySecondOfMinute !== undefined) {\n if (!ruleOptionFilled(options.bySecondOfMinute)) {\n throw new RuleOptionError('\"bySecondOfMinute\" expects a non-empty array');\n }\n if (options.bySecondOfMinute.some(num => num < 0 || num > 60)) {\n throw new RuleOptionError('\"bySecondOfMinute\" values must be >= 0 && <= 60');\n }\n norm.bySecondOfMinute = options.bySecondOfMinute;\n norm.bySecondOfMinute.sort(numberSortComparer);\n } else if (!['SECONDLY', 'MILLISECONDLY'].includes(options.frequency)) {\n norm.bySecondOfMinute = [norm.start.get('second')];\n }\n },\n deps: () => [FrequencyRuleModule, BySecondOfMinuteRuleModule, ByMillisecondOfSecondRuleModule],\n};\n\nclass RevByMinuteOfHourRule extends RevByTimeOfUnitRule {\n constructor() {\n super(...arguments);\n this.baseGranularity = 'hour';\n this.granularity = 'minute';\n this.option = this.options.byMinuteOfHour.slice().reverse();\n }\n}\n\nclass ByMinuteOfHourRule extends ByTimeOfUnitRule {\n constructor() {\n super(...arguments);\n this.baseGranularity = 'hour';\n this.granularity = 'minute';\n this.option = this.options.byMinuteOfHour;\n }\n}\n\nconst ByMinuteOfHourRuleModule = {\n name: 'ByMinuteOfHour',\n get: processor => {\n if (processor.options.byMinuteOfHour === undefined) return null;\n if (processor.reverse) return new RevByMinuteOfHourRule(processor);\n return new ByMinuteOfHourRule(processor);\n },\n normalizeOptions: (options, norm) => {\n if (options.byMinuteOfHour !== undefined) {\n if (!ruleOptionFilled(options.byMinuteOfHour)) {\n throw new RuleOptionError('\"byMinuteOfHour\" expects a non-empty array');\n }\n if (options.byMinuteOfHour.some(num => num < 0 || num > 59)) {\n throw new RuleOptionError('\"byMinuteOfHour\" values must be >= 0 && <= 59');\n }\n norm.byMinuteOfHour = options.byMinuteOfHour;\n norm.byMinuteOfHour.sort(numberSortComparer);\n } else if (!['MINUTELY', 'SECONDLY', 'MILLISECONDLY'].includes(options.frequency)) {\n norm.byMinuteOfHour = [norm.start.get('minute')];\n }\n },\n deps: () => [\n FrequencyRuleModule,\n ByMinuteOfHourRuleModule,\n BySecondOfMinuteRuleModule,\n ByMillisecondOfSecondRuleModule,\n ],\n};\n\nclass RevByHourOfDayRule extends RevByTimeOfUnitRule {\n constructor() {\n super(...arguments);\n this.baseGranularity = 'day';\n this.granularity = 'hour';\n this.option = this.options.byHourOfDay.slice().reverse();\n }\n}\n\nclass ByHourOfDayRule extends ByTimeOfUnitRule {\n constructor() {\n super(...arguments);\n this.baseGranularity = 'day';\n this.granularity = 'hour';\n this.option = this.options.byHourOfDay;\n }\n}\n\nconst ByHourOfDayRuleModule = {\n name: 'ByHourOfDay',\n get: processor => {\n if (processor.options.byHourOfDay === undefined) return null;\n if (processor.reverse) return new RevByHourOfDayRule(processor);\n return new ByHourOfDayRule(processor);\n },\n normalizeOptions: (options, norm) => {\n if (options.byHourOfDay !== undefined) {\n if (!ruleOptionFilled(options.byHourOfDay)) {\n throw new RuleOptionError('\"byHourOfDay\" expects a non-empty array');\n }\n if (options.byHourOfDay.some(num => num < 0 || num > 23)) {\n throw new RuleOptionError('\"byHourOfDay\" values must be >= 0 && <= 23');\n }\n norm.byHourOfDay = options.byHourOfDay;\n norm.byHourOfDay.sort(numberSortComparer);\n } else if (['YEARLY', 'MONTHLY', 'WEEKLY', 'DAILY'].includes(options.frequency)) {\n norm.byHourOfDay = [norm.start.get('hour')];\n }\n },\n deps: () => [\n FrequencyRuleModule,\n ByHourOfDayRuleModule,\n ByMinuteOfHourRuleModule,\n BySecondOfMinuteRuleModule,\n ByMillisecondOfSecondRuleModule,\n ],\n};\n\nfunction getNextWeekday(date, weekday) {\n return date.add(getDifferenceBetweenWeekdays(date.get('weekday'), weekday), 'day');\n}\n\nfunction getNthWeekdayOfMonth(date, weekday, nth) {\n let base = date.set('day', 1);\n if (nth < 0) {\n base = base.add(1, 'month');\n }\n base = getNextWeekday(base, weekday);\n // when nth is negative, adding it will act as subtraction\n return nth < 0 ? base.add(nth, 'week') : base.add(nth - 1, 'week');\n}\n\nclass ByDayOfMonthRule extends RecurrenceRuleBase {\n run(date) {\n const normalizedByDayOfMonth = normalizeByDayOfMonth(\n date,\n this.options.byDayOfMonth,\n this.options.byDayOfWeek,\n );\n const currentDay = date.get('day');\n for (const day of normalizedByDayOfMonth) {\n if (currentDay > day) continue;\n if (currentDay === day) {\n return this.validateDate(new ValidDateTime(date));\n }\n return this.validateDate(new InvalidDateTime(date.granularity('month').set('day', day)));\n }\n let next;\n let nextMonth = date;\n let index = 0;\n while (!next && index < 30) {\n nextMonth = nextMonth.granularity('month').add(1, 'month');\n next = normalizeByDayOfMonth(\n nextMonth,\n this.options.byDayOfMonth,\n this.options.byDayOfWeek,\n )[0];\n index++;\n }\n if (index >= 13) {\n throw new RecurrenceRuleError('byDayOfMonth Infinite while loop');\n }\n return this.validateDate(new InvalidDateTime(nextMonth.set('day', next)));\n }\n}\n/**\n * Does a few things:\n *\n * 1. filters out byDayOfMonth entries which are not applicable\n * to current month\n * 2. negative entries to positive ones\n * 3. if a byDayOfWeek option is given, removes days which are\n * not on the correct day of the week\n */\nfunction normalizeByDayOfMonth(date, byDayOfMonth, byDayOfWeek) {\n const lengthOfMonth = date.endGranularity('month').get('day');\n let normalizedByDayOfMonth = byDayOfMonth\n .filter(day => lengthOfMonth >= Math.abs(day))\n .map(day => (day > 0 ? day : lengthOfMonth + day + 1));\n if (byDayOfWeek) {\n const base = date.granularity('month');\n const filteredByDayOfMonth = [];\n byDayOfWeek.forEach(entry => {\n if (typeof entry === 'string') {\n filteredByDayOfMonth.push(\n ...normalizedByDayOfMonth.filter(day => base.set('day', day).get('weekday') === entry),\n );\n return;\n }\n const nthWeekdayOfMonth = getNthWeekdayOfMonth(date, ...entry).get('day');\n if (normalizedByDayOfMonth.includes(nthWeekdayOfMonth)) {\n filteredByDayOfMonth.push(nthWeekdayOfMonth);\n }\n });\n normalizedByDayOfMonth = Array.from(new Set(filteredByDayOfMonth));\n }\n return normalizedByDayOfMonth.sort((a, b) => {\n if (a > b) return 1;\n if (a < b) return -1;\n else return 0;\n });\n}\n\nclass RevByDayOfMonthRule extends RevRecurrenceRuleBase {\n run(date) {\n const normalizedByDayOfMonth = normalizeByDayOfMonth(\n date,\n this.options.byDayOfMonth,\n this.options.byDayOfWeek,\n ).reverse();\n const currentDay = date.get('day');\n for (const day of normalizedByDayOfMonth) {\n if (currentDay < day) continue;\n if (currentDay === day) {\n return this.validateDate(new ValidDateTime(date));\n }\n return this.validateDate(new InvalidDateTime(date.endGranularity('month').set('day', day)));\n }\n let next;\n let nextMonth = date;\n let index = 0;\n while (!next && index < 30) {\n nextMonth = nextMonth.endGranularity('month').subtract(1, 'month');\n next = normalizeByDayOfMonth(\n nextMonth,\n this.options.byDayOfMonth,\n this.options.byDayOfWeek,\n ).pop();\n index++;\n }\n if (index >= 13) {\n throw new RecurrenceRuleError('byDayOfMonth Infinite while loop');\n }\n return this.validateDate(new InvalidDateTime(nextMonth.set('day', next)));\n }\n}\n\nconst ByDayOfMonthRuleModule = {\n name: 'ByDayOfMonth',\n get: processor => {\n if (processor.options.byDayOfMonth === undefined) return null;\n if (processor.reverse) return new RevByDayOfMonthRule(processor);\n return new ByDayOfMonthRule(processor);\n },\n normalizeOptions: (options, norm) => {\n if (options.byDayOfMonth !== undefined) {\n if (options.frequency === 'WEEKLY') {\n throw new RuleOptionError('when \"frequency\" is \"WEEKLY\", \"byDayOfMonth\" cannot be present');\n }\n if (!ruleOptionFilled(options.byDayOfMonth)) {\n throw new RuleOptionError('\"byDayOfMonth\" expects a non-empty array');\n }\n if (options.byDayOfMonth.some(num => num === 0 || num < -31 || num > 31)) {\n throw new RuleOptionError(\n '\"byDayOfMonth\" values must be `num !== 0 && num <= 31 && num >= -31`',\n );\n }\n norm.byDayOfMonth = options.byDayOfMonth.slice();\n } else if (\n !(ruleOptionFilled(options.byDayOfWeek) || ruleOptionFilled(options.byDayOfYear)) &&\n ['YEARLY', 'MONTHLY'].includes(options.frequency)\n ) {\n norm.byDayOfMonth = [norm.start.get('day')];\n }\n },\n deps: () => [\n FrequencyRuleModule,\n ByDayOfMonthRuleModule,\n ByHourOfDayRuleModule,\n ByMinuteOfHourRuleModule,\n BySecondOfMinuteRuleModule,\n ByMillisecondOfSecondRuleModule,\n ],\n};\n\nfunction getNthWeekdayOfYear(date, weekday, nth) {\n let base = date.set('month', 1).set('day', 1);\n if (nth < 0) {\n base = base.add(1, 'year');\n }\n base = getNextWeekday(base, weekday);\n // when nth is negative, adding it will act as subtraction\n return nth < 0 ? base.add(nth, 'week') : base.add(nth - 1, 'week');\n}\n\nfunction getPreviousWeekday(date, weekday) {\n const diff = getDifferenceBetweenWeekdays(date.get('weekday'), weekday);\n return date.subtract(diff === 0 ? 0 : 7 - diff, 'day');\n}\n\nclass RevByDayOfWeekRule extends RevRecurrenceRuleBase {\n run(date) {\n if (this.options.frequency === 'YEARLY') {\n return this.options.byMonthOfYear === undefined\n ? this.expandYearly(date)\n : this.expandMonthly(date);\n } else if (this.options.frequency === 'MONTHLY') {\n return this.expandMonthly(date);\n }\n return this.expand(date);\n }\n expandYearly(date) {\n let next = getPrevWeekdaysOfYear(date, this.options.byDayOfWeek)[0];\n let index = 0;\n let base = date;\n // If we can't find a valid date this year,\n // search the previous year. Only search the past 28 years.\n // (the calendar repeats on a 28 year cycle, according\n // to the internet).\n while (!next && index < 28) {\n index++;\n base = base.granularity('year').subtract(1, 'millisecond');\n next = getPrevWeekdaysOfYear(base, this.options.byDayOfWeek)[0];\n }\n if (!next) {\n throw new RecurrenceRuleError(\n 'The byDayOfWeek rule appears to contain an impossible combination',\n );\n }\n return this.result(date, next);\n }\n expandMonthly(date) {\n let next = getPrevWeekdaysOfMonth(date, this.options.byDayOfWeek)[0];\n let index = 0;\n let base = date;\n // TODO: performance improvment\n // If, in the first year, a match isn't found, we should be able to\n // jumpt to the previous leap year and check that. Or, if already on\n // a leap year, we can just error immediately.\n // If we can't find a valid date this month,\n // search the previous month. Only search the past 4 years\n // (to account for leap year).\n while (!next && index < 50) {\n index++;\n base = base.granularity('month').subtract(1, 'millisecond');\n next = getPrevWeekdaysOfMonth(base, this.options.byDayOfWeek)[0];\n }\n if (!next) {\n throw new RecurrenceRuleError(\n 'The byDayOfWeek rule appears to contain an impossible combination',\n );\n }\n return this.result(date, next);\n }\n expand(date) {\n const next = this.options.byDayOfWeek\n .map(weekday => getPreviousWeekday(date, weekday))\n .sort(dateTimeSortComparer)\n .pop();\n return this.result(date, next);\n }\n result(date, next) {\n if (next.isEqual(date)) {\n return this.validateDate(new ValidDateTime(date));\n }\n return this.validateDate(new InvalidDateTime(next.endGranularity('day')));\n }\n}\n/** For each byDayOfWeek entry, find the previous DateTime */\nfunction getPrevWeekdaysOfYear(date, byDayOfWeek) {\n const normalizedNthWeekdaysOfYear = byDayOfWeek\n .filter(entry => Array.isArray(entry))\n .map(entry => getNthWeekdayOfYear(date, ...entry));\n const normalizedNextWeekdays = byDayOfWeek\n .filter(entry => typeof entry === 'string')\n .map(weekday => getPreviousWeekday(date, weekday))\n .filter(entry => entry.get('year') === date.get('year'));\n return uniqDateTimes([...normalizedNthWeekdaysOfYear, ...normalizedNextWeekdays])\n .filter(entry => entry.isBeforeOrEqual(date))\n .sort(dateTimeSortComparer)\n .reverse();\n}\n/** For each byDayOfWeek entry, find the previous DateTime */\nfunction getPrevWeekdaysOfMonth(date, byDayOfWeek) {\n const normalizedNthWeekdaysOfMonth = byDayOfWeek\n .filter(entry => Array.isArray(entry))\n .map(entry => getNthWeekdayOfMonth(date, ...entry));\n const normalizedNextWeekdays = byDayOfWeek\n .filter(entry => typeof entry === 'string')\n .map(weekday => getPreviousWeekday(date, weekday))\n .filter(\n entry => entry.get('year') === date.get('year') && entry.get('month') === date.get('month'),\n );\n return uniqDateTimes([...normalizedNthWeekdaysOfMonth, ...normalizedNextWeekdays])\n .filter(entry => entry.isBeforeOrEqual(date))\n .sort(dateTimeSortComparer)\n .reverse();\n}\n\nclass ByDayOfWeekRule extends RecurrenceRuleBase {\n run(date) {\n if (this.options.frequency === 'YEARLY') {\n return this.options.byMonthOfYear === undefined\n ? this.expandYearly(date)\n : this.expandMonthly(date);\n } else if (this.options.frequency === 'MONTHLY') {\n return this.expandMonthly(date);\n }\n return this.expand(date);\n }\n expandYearly(date) {\n let next = getNextWeekdaysOfYear(date, this.options.byDayOfWeek)[0];\n let index = 0;\n let base = date;\n // If we can't find a valid date this year,\n // search next year. Only search the next 28 years.\n // (the calendar repeats on a 28 year cycle, according\n // to the internet).\n while (!next && index < 28) {\n index++;\n base = base.granularity('year').add(1, 'year');\n next = getNextWeekdaysOfYear(base, this.options.byDayOfWeek)[0];\n }\n if (!next) {\n throw new RecurrenceRuleError(\n 'The byDayOfWeek rule appears to contain an impossible combination',\n );\n }\n return this.result(date, next);\n }\n expandMonthly(date) {\n let next = getNextWeekdaysOfMonth(date, this.options.byDayOfWeek)[0];\n let index = 0;\n let base = date;\n // TODO: performance improvment\n // If, in the first year, a match isn't found, we should be able to\n // jumpt to the next leap year and check that. Or, if already on\n // a leap year, we can just error immediately.\n // If we can't find a valid date this month,\n // search the next month. Only search the next 4 years\n // (to account for leap year).\n while (!next && index < 50) {\n index++;\n base = base.granularity('month').add(1, 'month');\n next = getNextWeekdaysOfMonth(base, this.options.byDayOfWeek)[0];\n }\n if (!next) {\n throw new RecurrenceRuleError(\n 'The byDayOfWeek rule appears to contain an impossible combination',\n );\n }\n return this.result(date, next);\n }\n expand(date) {\n const next = this.options.byDayOfWeek\n .map(weekday => getNextWeekday(date, weekday))\n .sort(dateTimeSortComparer)[0];\n return this.result(date, next);\n }\n result(date, next) {\n if (next.isEqual(date)) {\n return this.validateDate(new ValidDateTime(date));\n }\n return this.validateDate(new InvalidDateTime(next.granularity('day')));\n }\n}\n/** For each byDayOfWeek entry, find the next DateTime */\nfunction getNextWeekdaysOfYear(date, byDayOfWeek) {\n const normalizedNthWeekdaysOfYear = byDayOfWeek\n .filter(entry => Array.isArray(entry))\n .map(entry => getNthWeekdayOfYear(date, ...entry));\n const normalizedNextWeekdays = byDayOfWeek\n .filter(entry => typeof entry === 'string')\n .map(weekday => getNextWeekday(date, weekday))\n .filter(entry => entry.get('year') === date.get('year'));\n return uniqDateTimes([...normalizedNthWeekdaysOfYear, ...normalizedNextWeekdays])\n .filter(entry => entry.isAfterOrEqual(date))\n .sort(dateTimeSortComparer);\n}\n/** For each byDayOfWeek entry, find the next DateTime */\nfunction getNextWeekdaysOfMonth(date, byDayOfWeek) {\n const normalizedNthWeekdaysOfMonth = byDayOfWeek\n .filter(entry => Array.isArray(entry))\n .map(entry => getNthWeekdayOfMonth(date, ...entry));\n const normalizedNextWeekdays = byDayOfWeek\n .filter(entry => typeof entry === 'string')\n .map(weekday => getNextWeekday(date, weekday))\n .filter(\n entry => entry.get('year') === date.get('year') && entry.get('month') === date.get('month'),\n );\n return uniqDateTimes([...normalizedNthWeekdaysOfMonth, ...normalizedNextWeekdays])\n .filter(entry => entry.isAfterOrEqual(date))\n .sort(dateTimeSortComparer);\n}\n\nconst ByDayOfWeekRuleModule = {\n name: 'ByDayOfWeek',\n get: processor => {\n if (processor.options.byDayOfWeek === undefined) return null;\n if (processor.reverse) return new RevByDayOfWeekRule(processor);\n return new ByDayOfWeekRule(processor);\n },\n normalizeOptions: (options, norm) => {\n if (options.byDayOfWeek !== undefined) {\n if (!ruleOptionFilled(options.byDayOfWeek)) {\n throw new RuleOptionError('\"byDayOfWeek\" expects a non-empty array');\n }\n const invalidWeeday = options.byDayOfWeek.find(day =>\n Array.isArray(day)\n ? !DateAdapter.WEEKDAYS.includes(day[0])\n : !DateAdapter.WEEKDAYS.includes(day),\n );\n if (invalidWeeday) {\n throw new RuleOptionError(\n `\"byDayOfWeek\" expects weedays in the form ` +\n `${JSON.stringify(DateAdapter.WEEKDAYS)} but \"${invalidWeeday}\" was provided`,\n );\n }\n if (\n !['YEARLY', 'MONTHLY'].includes(options.frequency) &&\n options.byDayOfWeek.some(weekday => Array.isArray(weekday))\n ) {\n throw new RuleOptionError(\n '\"byDayOfWeek\" can only include a numeric value (i.e. `[string, number]`) when the \"frequency\" is ' +\n 'either \"MONTHLY\" or \"YEARLY\"',\n );\n }\n if (\n options.frequency === 'MONTHLY' &&\n options.byDayOfWeek.some(\n weekday =>\n Array.isArray(weekday) && (weekday[1] < -31 || weekday[1] === 0 || weekday[1] > 31),\n )\n ) {\n throw new RuleOptionError(\n 'when \"frequency\" is \"MONTHLY\", each \"byDayOfWeek\" can optionally only' +\n ' have a numeric value >= -31 and <= 31 and !== 0',\n );\n }\n if (\n options.frequency === 'YEARLY' &&\n options.byDayOfWeek.some(\n weekday =>\n Array.isArray(weekday) && (weekday[1] < -366 || weekday[1] === 0 || weekday[1] > 366),\n )\n ) {\n throw new RuleOptionError(\n 'when \"frequency\" is \"YEARLY\", each \"byDayOfWeek\" can optionally only' +\n ' have a numeric value >= -366 and <= 366 and !== 0',\n );\n }\n norm.byDayOfWeek = options.byDayOfWeek;\n } else if (!ruleOptionFilled(options.byDayOfMonth) && options.frequency === 'WEEKLY') {\n norm.byDayOfWeek = [norm.start.get('weekday')];\n }\n },\n deps: () => [\n FrequencyRuleModule,\n ByDayOfWeekRuleModule,\n ByHourOfDayRuleModule,\n ByMinuteOfHourRuleModule,\n BySecondOfMinuteRuleModule,\n ByMillisecondOfSecondRuleModule,\n ],\n};\n\nclass RevByMonthOfYearRule extends RevRecurrenceRuleBase {\n constructor() {\n super(...arguments);\n this.option = this.processor.options.byMonthOfYear.slice().reverse();\n }\n run(date) {\n const currentMonth = date.get('month');\n for (const month of this.option) {\n if (currentMonth < month) continue;\n if (currentMonth === month) {\n return this.validateDate(new ValidDateTime(date));\n }\n return this.validateDate(\n new InvalidDateTime(date.endGranularity('year').set('month', month)),\n );\n }\n return this.validateDate(\n new InvalidDateTime(\n date\n .endGranularity('year')\n .subtract(1, 'year')\n .set('month', this.option[0]),\n ),\n );\n }\n}\n\nclass ByMonthOfYearRule extends RecurrenceRuleBase {\n run(date) {\n const currentMonth = date.get('month');\n for (const month of this.options.byMonthOfYear) {\n if (currentMonth > month) continue;\n if (currentMonth === month) {\n return this.validateDate(new ValidDateTime(date));\n }\n return this.validateDate(new InvalidDateTime(date.granularity('year').set('month', month)));\n }\n return this.validateDate(\n new InvalidDateTime(\n date\n .granularity('year')\n .add(1, 'year')\n .set('month', this.options.byMonthOfYear[0]),\n ),\n );\n }\n}\n\nconst ByMonthOfYearRuleModule = {\n name: 'ByMonthOfYear',\n get: processor => {\n if (processor.options.byMonthOfYear === undefined) return null;\n if (processor.reverse) {\n return new RevByMonthOfYearRule(processor);\n }\n return new ByMonthOfYearRule(processor);\n },\n normalizeOptions: (options, norm) => {\n if (options.byMonthOfYear !== undefined) {\n if (!ruleOptionFilled(options.byMonthOfYear)) {\n throw new RuleOptionError('\"byMonthOfYear\" expects a non-empty array');\n }\n if (options.byMonthOfYear.some(num => num < 1 || num > 12)) {\n throw new RuleOptionError('\"byMonthOfYear\" values must be `num >= 1 && num >= 12`');\n }\n norm.byMonthOfYear = options.byMonthOfYear.slice();\n norm.byMonthOfYear.sort(numberSortComparer);\n } else if (\n !(\n ruleOptionFilled(options.byDayOfMonth) ||\n ruleOptionFilled(options.byDayOfWeek) ||\n ruleOptionFilled(options.byDayOfYear)\n ) &&\n options.frequency === 'YEARLY'\n ) {\n norm.byMonthOfYear = [norm.start.get('month')];\n }\n },\n deps: () => [\n FrequencyRuleModule,\n ByMonthOfYearRuleModule,\n ByDayOfMonthRuleModule,\n ByHourOfDayRuleModule,\n ByMinuteOfHourRuleModule,\n BySecondOfMinuteRuleModule,\n ByMillisecondOfSecondRuleModule,\n ],\n};\n\nconst ICAL_RULES = [\n FrequencyRuleModule,\n ByMonthOfYearRuleModule,\n ByDayOfMonthRuleModule,\n ByDayOfWeekRuleModule,\n ByHourOfDayRuleModule,\n ByMinuteOfHourRuleModule,\n BySecondOfMinuteRuleModule,\n ByMillisecondOfSecondRuleModule,\n];\n\nexport {\n ByDayOfMonthRule,\n ByDayOfMonthRuleModule,\n ByDayOfWeekRule,\n ByDayOfWeekRuleModule,\n ByHourOfDayRule,\n ByHourOfDayRuleModule,\n ByMillisecondOfSecondRule,\n ByMillisecondOfSecondRuleModule,\n ByMinuteOfHourRule,\n ByMinuteOfHourRuleModule,\n ByMonthOfYearRule,\n ByMonthOfYearRuleModule,\n BySecondOfMinuteRule,\n BySecondOfMinuteRuleModule,\n FrequencyRule,\n FrequencyRuleModule,\n ICAL_RULES,\n RevByDayOfMonthRule,\n RevByDayOfWeekRule,\n RevByHourOfDayRule,\n RevByMillisecondOfSecondRule,\n RevByMinuteOfHourRule,\n RevByMonthOfYearRule,\n RevBySecondOfMinuteRule,\n RevFrequencyRule,\n getPrevWeekdaysOfMonth,\n getPrevWeekdaysOfYear,\n};\n","import { Dates, Rule, Schedule } from '@rschedule/core/generators';\nimport {\n serializeDataToJSON,\n ParseJSONError,\n registerJSONSerializerFn,\n} from '@rschedule/json-tools';\nimport { DateAdapterBase, cloneJSON } from '@rschedule/core';\n\nDates.prototype.toJSON = function serialize(opts = {}) {\n const json = {\n type: 'Dates',\n dates: this.adapters.map(adapter => adapter.toJSON()),\n };\n if (!opts.nested) json.timezone = this.timezone;\n serializeDataToJSON(this, json, opts);\n return json;\n};\nDates.fromJSON = function parse(json, options = {}) {\n if (json.type !== 'Dates') {\n throw new ParseJSONError('Invalid Dates JSON');\n }\n return new Dates({\n dates: json.dates.map(date => DateAdapterBase.adapter.fromJSON(date)),\n data: typeof options.data === 'function' ? options.data(json) : json.data,\n timezone: options.timezone || json.timezone,\n });\n};\nregisterJSONSerializerFn('Dates', Dates.fromJSON);\n\nRule.prototype.toJSON = function serialize(opts = {}) {\n const json = {\n type: 'Rule',\n config: Object.assign(Object.assign({}, cloneJSON(this.options)), {\n start: this.normalizeDateInput(this.options.start).toJSON(),\n }),\n };\n if (this.options.end) {\n json.config.end = this.normalizeDateInput(this.options.end).toJSON();\n }\n if (!opts.nested) json.timezone = this.timezone;\n serializeDataToJSON(this, json, opts);\n return json;\n};\nRule.fromJSON = function fromJSON(json, options = {}) {\n const config = Object.assign(Object.assign({}, json.config), {\n start: DateAdapterBase.adapter.fromJSON(json.config.start),\n end: json.config.end && DateAdapterBase.adapter.fromJSON(json.config.end),\n });\n return new Rule(config, {\n data: typeof options.data === 'function' ? options.data(json) : json.data,\n timezone: options.timezone || json.timezone,\n });\n};\nregisterJSONSerializerFn('Rule', Rule.fromJSON);\n\nSchedule.prototype.toJSON = function serialize(opts = {}) {\n const json = {\n type: 'Schedule',\n rrules: this.rrules.map(rule =>\n rule.toJSON(Object.assign(Object.assign({}, opts), { nested: true })),\n ),\n exrules: this.exrules.map(rule =>\n rule.toJSON(Object.assign(Object.assign({}, opts), { nested: true })),\n ),\n rdates: this.rdates.toJSON(Object.assign(Object.assign({}, opts), { nested: true })),\n exdates: this.exdates.toJSON(Object.assign(Object.assign({}, opts), { nested: true })),\n };\n if (!opts.nested) json.timezone = this.timezone;\n serializeDataToJSON(this, json, opts);\n return json;\n};\nSchedule.fromJSON = function parse(json, options = {}) {\n if (json.type !== 'Schedule') {\n throw new ParseJSONError('Invalid Schedule JSON');\n }\n return new Schedule({\n rrules: json.rrules.map(rule =>\n Rule.fromJSON(rule, Object.assign({ timezone: json.timezone }, options)),\n ),\n exrules: json.exrules.map(rule =>\n Rule.fromJSON(rule, Object.assign({ timezone: json.timezone }, options)),\n ),\n rdates: Dates.fromJSON(json.rdates, Object.assign({ timezone: json.timezone }, options)),\n exdates: Dates.fromJSON(json.exdates, Object.assign({ timezone: json.timezone }, options)),\n data: typeof options.data === 'function' ? options.data(json) : json.data,\n timezone: options.timezone || json.timezone,\n });\n};\nregisterJSONSerializerFn('Schedule', Schedule.fromJSON);\n","import { OccurrenceGenerator } from '@rschedule/core/generators';\n\nclass ParseJSONError extends Error {}\nclass SerializeJSONError extends Error {}\nOccurrenceGenerator.JSON_FN_MAP = new Map();\nOccurrenceGenerator.prototype.toJSON = function serialize(opts) {\n throw new SerializeJSONError(\n `To support smaller bundles, ${this.constructor.name}#toJSON() ` +\n `must be manually added. See \"@rschedule/json-tools\" in the rSchedule docs.`,\n );\n};\nOccurrenceGenerator.fromJSON = function parse(json, options) {\n if (typeof json !== 'object' || json === null) {\n throw new ParseJSONError(`Invalid json \"${json}\"`);\n }\n const fn = OccurrenceGenerator.JSON_FN_MAP.get(json.type);\n if (!fn) {\n throw new ParseJSONError(\n `Unknown rSchedule object type \"${json.type}\". Have you added a json serializer ` +\n `for \"${json.type}\"? ` +\n `See \"@rschedule/json-tools\" in the rSchedule docs.`,\n );\n }\n return fn(json, options);\n};\nfunction serializeDataToJSON(gen, json, opt) {\n if (!opt.data) return;\n if (opt.data === true) {\n json.data = gen.data;\n } else {\n json.data = opt.data(gen);\n }\n if (json.data === undefined) delete json.data;\n}\nfunction registerJSONSerializerFn(name, fn) {\n OccurrenceGenerator.JSON_FN_MAP.set(name, fn);\n}\n\nexport { ParseJSONError, SerializeJSONError, registerJSONSerializerFn, serializeDataToJSON };\n","import { DateAdapterBase, InvalidDateAdapterError, ArgumentError } from '@rschedule/core';\n\nclass StandardDateAdapter extends DateAdapterBase {\n constructor(date, options = {}) {\n super(undefined, options);\n if (!['UTC', null, undefined].includes(options.timezone)) {\n throw new InvalidDateAdapterError(\n `StandardDateAdapter only supports \"UTC\" and ` +\n `local time zones but \"${options.timezone}\" was provided.`,\n );\n }\n this._date = new Date(date);\n this.timezone = options.timezone !== undefined ? options.timezone : null;\n this.assertIsValid();\n }\n static isDate(object) {\n return Object.prototype.toString.call(object) === '[object Date]';\n }\n static fromDate(date, options) {\n return new StandardDateAdapter(date, options);\n }\n static fromJSON(json) {\n const args = [\n json.year,\n json.month - 1,\n json.day,\n json.hour,\n json.minute,\n json.second,\n json.millisecond,\n ];\n switch (json.timezone) {\n case 'UTC': {\n return new StandardDateAdapter(new Date(Date.UTC(...args)), {\n timezone: 'UTC',\n duration: json.duration,\n });\n }\n case null: {\n return new StandardDateAdapter(new Date(...args), {\n timezone: null,\n duration: json.duration,\n });\n }\n default:\n throw new InvalidDateAdapterError(\n 'The `StandardDateAdapter` only supports datetimes in ' +\n `UTC or LOCAL (null) time. You provided a JSON object ` +\n `with timezone \"${json.timezone}\".`,\n );\n }\n }\n static fromDateTime(datetime) {\n const date = StandardDateAdapter.fromJSON(datetime.toJSON());\n date.generators.push(...datetime.generators);\n return date;\n }\n get date() {\n return new Date(this._date);\n }\n get end() {\n if (!this.duration) return;\n if (this._end) return this._end;\n this._end = StandardDateAdapter.fromDateTime(\n this.toDateTime().add(this.duration, 'millisecond'),\n ).date;\n return this._end;\n }\n set(prop, value) {\n if (prop === 'timezone') {\n if (this.timezone === value) return this;\n else {\n return new StandardDateAdapter(this._date, {\n timezone: value,\n duration: this.duration,\n generators: this.generators,\n });\n }\n } else if (prop === 'duration') {\n if (this.duration === value) return this;\n else {\n return new StandardDateAdapter(this._date, {\n timezone: this.timezone,\n duration: value,\n generators: this.generators,\n });\n }\n }\n throw new ArgumentError(`Unknown prop \"${prop}\" for StandardDateAdapter#set()`);\n }\n valueOf() {\n return this._date.valueOf();\n }\n toJSON() {\n let json;\n if (this.timezone === 'UTC') {\n json = {\n timezone: this.timezone,\n year: this._date.getUTCFullYear(),\n month: this._date.getUTCMonth() + 1,\n day: this._date.getUTCDate(),\n hour: this._date.getUTCHours(),\n minute: this._date.getUTCMinutes(),\n second: this._date.getUTCSeconds(),\n millisecond: this._date.getUTCMilliseconds(),\n };\n } else {\n json = {\n timezone: this.timezone,\n year: this._date.getFullYear(),\n month: this._date.getMonth() + 1,\n day: this._date.getDate(),\n hour: this._date.getHours(),\n minute: this._date.getMinutes(),\n second: this._date.getSeconds(),\n millisecond: this._date.getMilliseconds(),\n };\n }\n if (this.duration) {\n json.duration = this.duration;\n }\n return json;\n }\n assertIsValid() {\n if (!StandardDateAdapter.isDate(this._date) || isNaN(this._date.valueOf())) {\n throw new InvalidDateAdapterError('StandardDateAdapter has invalid date.');\n } else if (![null, 'UTC'].includes(this.timezone)) {\n throw new InvalidDateAdapterError(\n 'StandardDateAdapter only supports local (null) and UTC timezones but ' +\n `\"${this.timezone}\" was specified.`,\n );\n } else if (this.duration && this.duration <= 0) {\n throw new InvalidDateAdapterError('If provided, duration must be greater than 0.');\n }\n return true;\n }\n}\nStandardDateAdapter.hasTimezoneSupport = false;\n\nexport { StandardDateAdapter };\n","import { DateAdapterBase } from '@rschedule/core';\nimport { Rule } from '@rschedule/core/generators';\nimport { ICAL_RULES } from '@rschedule/core/rules/ICAL_RULES';\nimport { StandardDateAdapter } from '@rschedule/standard-date-adapter';\n\nDateAdapterBase.adapter = StandardDateAdapter;\nRule.recurrenceRules = ICAL_RULES;\n","/*!\n * accounting.js v0.4.2\n * Copyright 2014 Open Exchange Rates\n *\n * Freely distributable under the MIT license.\n * Portions of accounting.js are inspired or borrowed from underscore.js\n *\n * Full details and documentation:\n * http://openexchangerates.github.io/accounting.js/\n */\n\n(function(root, undefined) {\n\n\t/* --- Setup --- */\n\n\t// Create the local library object, to be exported or referenced globally later\n\tvar lib = {};\n\n\t// Current version\n\tlib.version = '0.4.2';\n\n\n\t/* --- Exposed settings --- */\n\n\t// The library's settings configuration object. Contains default parameters for\n\t// currency and number formatting\n\tlib.settings = {\n\t\tcurrency: {\n\t\t\tsymbol : \"$\",\t\t// default currency symbol is '$'\n\t\t\tformat : \"%s%v\",\t// controls output: %s = symbol, %v = value (can be object, see docs)\n\t\t\tdecimal : \".\",\t\t// decimal point separator\n\t\t\tthousand : \",\",\t\t// thousands separator\n\t\t\tprecision : 2,\t\t// decimal places\n\t\t\tgrouping : 3\t\t// digit grouping (not implemented yet)\n\t\t},\n\t\tnumber: {\n\t\t\tprecision : 0,\t\t// default precision on numbers is 0\n\t\t\tgrouping : 3,\t\t// digit grouping (not implemented yet)\n\t\t\tthousand : \",\",\n\t\t\tdecimal : \".\"\n\t\t}\n\t};\n\n\n\t/* --- Internal Helper Methods --- */\n\n\t// Store reference to possibly-available ECMAScript 5 methods for later\n\tvar nativeMap = Array.prototype.map,\n\t\tnativeIsArray = Array.isArray,\n\t\ttoString = Object.prototype.toString;\n\n\t/**\n\t * Tests whether supplied parameter is a string\n\t * from underscore.js\n\t */\n\tfunction isString(obj) {\n\t\treturn !!(obj === '' || (obj && obj.charCodeAt && obj.substr));\n\t}\n\n\t/**\n\t * Tests whether supplied parameter is an array\n\t * from underscore.js, delegates to ECMA5's native Array.isArray\n\t */\n\tfunction isArray(obj) {\n\t\treturn nativeIsArray ? nativeIsArray(obj) : toString.call(obj) === '[object Array]';\n\t}\n\n\t/**\n\t * Tests whether supplied parameter is a true object\n\t */\n\tfunction isObject(obj) {\n\t\treturn obj && toString.call(obj) === '[object Object]';\n\t}\n\n\t/**\n\t * Extends an object with a defaults object, similar to underscore's _.defaults\n\t *\n\t * Used for abstracting parameter handling from API methods\n\t */\n\tfunction defaults(object, defs) {\n\t\tvar key;\n\t\tobject = object || {};\n\t\tdefs = defs || {};\n\t\t// Iterate over object non-prototype properties:\n\t\tfor (key in defs) {\n\t\t\tif (defs.hasOwnProperty(key)) {\n\t\t\t\t// Replace values with defaults only if undefined (allow empty/zero values):\n\t\t\t\tif (object[key] == null) object[key] = defs[key];\n\t\t\t}\n\t\t}\n\t\treturn object;\n\t}\n\n\t/**\n\t * Implementation of `Array.map()` for iteration loops\n\t *\n\t * Returns a new Array as a result of calling `iterator` on each array value.\n\t * Defers to native Array.map if available\n\t */\n\tfunction map(obj, iterator, context) {\n\t\tvar results = [], i, j;\n\n\t\tif (!obj) return results;\n\n\t\t// Use native .map method if it exists:\n\t\tif (nativeMap && obj.map === nativeMap) return obj.map(iterator, context);\n\n\t\t// Fallback for native .map:\n\t\tfor (i = 0, j = obj.length; i < j; i++ ) {\n\t\t\tresults[i] = iterator.call(context, obj[i], i, obj);\n\t\t}\n\t\treturn results;\n\t}\n\n\t/**\n\t * Check and normalise the value of precision (must be positive integer)\n\t */\n\tfunction checkPrecision(val, base) {\n\t\tval = Math.round(Math.abs(val));\n\t\treturn isNaN(val)? base : val;\n\t}\n\n\n\t/**\n\t * Parses a format string or object and returns format obj for use in rendering\n\t *\n\t * `format` is either a string with the default (positive) format, or object\n\t * containing `pos` (required), `neg` and `zero` values (or a function returning\n\t * either a string or object)\n\t *\n\t * Either string or format.pos must contain \"%v\" (value) to be valid\n\t */\n\tfunction checkCurrencyFormat(format) {\n\t\tvar defaults = lib.settings.currency.format;\n\n\t\t// Allow function as format parameter (should return string or object):\n\t\tif ( typeof format === \"function\" ) format = format();\n\n\t\t// Format can be a string, in which case `value` (\"%v\") must be present:\n\t\tif ( isString( format ) && format.match(\"%v\") ) {\n\n\t\t\t// Create and return positive, negative and zero formats:\n\t\t\treturn {\n\t\t\t\tpos : format,\n\t\t\t\tneg : format.replace(\"-\", \"\").replace(\"%v\", \"-%v\"),\n\t\t\t\tzero : format\n\t\t\t};\n\n\t\t// If no format, or object is missing valid positive value, use defaults:\n\t\t} else if ( !format || !format.pos || !format.pos.match(\"%v\") ) {\n\n\t\t\t// If defaults is a string, casts it to an object for faster checking next time:\n\t\t\treturn ( !isString( defaults ) ) ? defaults : lib.settings.currency.format = {\n\t\t\t\tpos : defaults,\n\t\t\t\tneg : defaults.replace(\"%v\", \"-%v\"),\n\t\t\t\tzero : defaults\n\t\t\t};\n\n\t\t}\n\t\t// Otherwise, assume format was fine:\n\t\treturn format;\n\t}\n\n\n\t/* --- API Methods --- */\n\n\t/**\n\t * Takes a string/array of strings, removes all formatting/cruft and returns the raw float value\n\t * Alias: `accounting.parse(string)`\n\t *\n\t * Decimal must be included in the regular expression to match floats (defaults to\n\t * accounting.settings.number.decimal), so if the number uses a non-standard decimal \n\t * separator, provide it as the second argument.\n\t *\n\t * Also matches bracketed negatives (eg. \"$ (1.99)\" => -1.99)\n\t *\n\t * Doesn't throw any errors (`NaN`s become 0) but this may change in future\n\t */\n\tvar unformat = lib.unformat = lib.parse = function(value, decimal) {\n\t\t// Recursively unformat arrays:\n\t\tif (isArray(value)) {\n\t\t\treturn map(value, function(val) {\n\t\t\t\treturn unformat(val, decimal);\n\t\t\t});\n\t\t}\n\n\t\t// Fails silently (need decent errors):\n\t\tvalue = value || 0;\n\n\t\t// Return the value as-is if it's already a number:\n\t\tif (typeof value === \"number\") return value;\n\n\t\t// Default decimal point comes from settings, but could be set to eg. \",\" in opts:\n\t\tdecimal = decimal || lib.settings.number.decimal;\n\n\t\t // Build regex to strip out everything except digits, decimal point and minus sign:\n\t\tvar regex = new RegExp(\"[^0-9-\" + decimal + \"]\", [\"g\"]),\n\t\t\tunformatted = parseFloat(\n\t\t\t\t(\"\" + value)\n\t\t\t\t.replace(/\\((?=\\d+)(.*)\\)/, \"-$1\") // replace bracketed values with negatives\n\t\t\t\t.replace(regex, '') // strip out any cruft\n\t\t\t\t.replace(decimal, '.') // make sure decimal point is standard\n\t\t\t);\n\n\t\t// This will fail silently which may cause trouble, let's wait and see:\n\t\treturn !isNaN(unformatted) ? unformatted : 0;\n\t};\n\n\n\t/**\n\t * Implementation of toFixed() that treats floats more like decimals\n\t *\n\t * Fixes binary rounding issues (eg. (0.615).toFixed(2) === \"0.61\") that present\n\t * problems for accounting- and finance-related software.\n\t */\n\tvar toFixed = lib.toFixed = function(value, precision) {\n\t\tprecision = checkPrecision(precision, lib.settings.number.precision);\n\n\t\tvar exponentialForm = Number(lib.unformat(value) + 'e' + precision);\n\t\tvar rounded = Math.round(exponentialForm);\n\t\tvar finalResult = Number(rounded + 'e-' + precision).toFixed(precision);\n\t\treturn finalResult;\n\t};\n\n\n\t/**\n\t * Format a number, with comma-separated thousands and custom precision/decimal places\n\t * Alias: `accounting.format()`\n\t *\n\t * Localise by overriding the precision and thousand / decimal separators\n\t * 2nd parameter `precision` can be an object matching `settings.number`\n\t */\n\tvar formatNumber = lib.formatNumber = lib.format = function(number, precision, thousand, decimal) {\n\t\t// Resursively format arrays:\n\t\tif (isArray(number)) {\n\t\t\treturn map(number, function(val) {\n\t\t\t\treturn formatNumber(val, precision, thousand, decimal);\n\t\t\t});\n\t\t}\n\n\t\t// Clean up number:\n\t\tnumber = unformat(number);\n\n\t\t// Build options object from second param (if object) or all params, extending defaults:\n\t\tvar opts = defaults(\n\t\t\t\t(isObject(precision) ? precision : {\n\t\t\t\t\tprecision : precision,\n\t\t\t\t\tthousand : thousand,\n\t\t\t\t\tdecimal : decimal\n\t\t\t\t}),\n\t\t\t\tlib.settings.number\n\t\t\t),\n\n\t\t\t// Clean up precision\n\t\t\tusePrecision = checkPrecision(opts.precision),\n\n\t\t\t// Do some calc:\n\t\t\tnegative = number < 0 ? \"-\" : \"\",\n\t\t\tbase = parseInt(toFixed(Math.abs(number || 0), usePrecision), 10) + \"\",\n\t\t\tmod = base.length > 3 ? base.length % 3 : 0;\n\n\t\t// Format the number:\n\t\treturn negative + (mod ? base.substr(0, mod) + opts.thousand : \"\") + base.substr(mod).replace(/(\\d{3})(?=\\d)/g, \"$1\" + opts.thousand) + (usePrecision ? opts.decimal + toFixed(Math.abs(number), usePrecision).split('.')[1] : \"\");\n\t};\n\n\n\t/**\n\t * Format a number into currency\n\t *\n\t * Usage: accounting.formatMoney(number, symbol, precision, thousandsSep, decimalSep, format)\n\t * defaults: (0, \"$\", 2, \",\", \".\", \"%s%v\")\n\t *\n\t * Localise by overriding the symbol, precision, thousand / decimal separators and format\n\t * Second param can be an object matching `settings.currency` which is the easiest way.\n\t *\n\t * To do: tidy up the parameters\n\t */\n\tvar formatMoney = lib.formatMoney = function(number, symbol, precision, thousand, decimal, format) {\n\t\t// Resursively format arrays:\n\t\tif (isArray(number)) {\n\t\t\treturn map(number, function(val){\n\t\t\t\treturn formatMoney(val, symbol, precision, thousand, decimal, format);\n\t\t\t});\n\t\t}\n\n\t\t// Clean up number:\n\t\tnumber = unformat(number);\n\n\t\t// Build options object from second param (if object) or all params, extending defaults:\n\t\tvar opts = defaults(\n\t\t\t\t(isObject(symbol) ? symbol : {\n\t\t\t\t\tsymbol : symbol,\n\t\t\t\t\tprecision : precision,\n\t\t\t\t\tthousand : thousand,\n\t\t\t\t\tdecimal : decimal,\n\t\t\t\t\tformat : format\n\t\t\t\t}),\n\t\t\t\tlib.settings.currency\n\t\t\t),\n\n\t\t\t// Check format (returns object with pos, neg and zero):\n\t\t\tformats = checkCurrencyFormat(opts.format),\n\n\t\t\t// Choose which format to use for this value:\n\t\t\tuseFormat = number > 0 ? formats.pos : number < 0 ? formats.neg : formats.zero;\n\n\t\t// Return with currency symbol added:\n\t\treturn useFormat.replace('%s', opts.symbol).replace('%v', formatNumber(Math.abs(number), checkPrecision(opts.precision), opts.thousand, opts.decimal));\n\t};\n\n\n\t/**\n\t * Format a list of numbers into an accounting column, padding with whitespace\n\t * to line up currency symbols, thousand separators and decimals places\n\t *\n\t * List should be an array of numbers\n\t * Second parameter can be an object containing keys that match the params\n\t *\n\t * Returns array of accouting-formatted number strings of same length\n\t *\n\t * NB: `white-space:pre` CSS rule is required on the list container to prevent\n\t * browsers from collapsing the whitespace in the output strings.\n\t */\n\tlib.formatColumn = function(list, symbol, precision, thousand, decimal, format) {\n\t\tif (!list || !isArray(list)) return [];\n\n\t\t// Build options object from second param (if object) or all params, extending defaults:\n\t\tvar opts = defaults(\n\t\t\t\t(isObject(symbol) ? symbol : {\n\t\t\t\t\tsymbol : symbol,\n\t\t\t\t\tprecision : precision,\n\t\t\t\t\tthousand : thousand,\n\t\t\t\t\tdecimal : decimal,\n\t\t\t\t\tformat : format\n\t\t\t\t}),\n\t\t\t\tlib.settings.currency\n\t\t\t),\n\n\t\t\t// Check format (returns object with pos, neg and zero), only need pos for now:\n\t\t\tformats = checkCurrencyFormat(opts.format),\n\n\t\t\t// Whether to pad at start of string or after currency symbol:\n\t\t\tpadAfterSymbol = formats.pos.indexOf(\"%s\") < formats.pos.indexOf(\"%v\") ? true : false,\n\n\t\t\t// Store value for the length of the longest string in the column:\n\t\t\tmaxLength = 0,\n\n\t\t\t// Format the list according to options, store the length of the longest string:\n\t\t\tformatted = map(list, function(val, i) {\n\t\t\t\tif (isArray(val)) {\n\t\t\t\t\t// Recursively format columns if list is a multi-dimensional array:\n\t\t\t\t\treturn lib.formatColumn(val, opts);\n\t\t\t\t} else {\n\t\t\t\t\t// Clean up the value\n\t\t\t\t\tval = unformat(val);\n\n\t\t\t\t\t// Choose which format to use for this value (pos, neg or zero):\n\t\t\t\t\tvar useFormat = val > 0 ? formats.pos : val < 0 ? formats.neg : formats.zero,\n\n\t\t\t\t\t\t// Format this value, push into formatted list and save the length:\n\t\t\t\t\t\tfVal = useFormat.replace('%s', opts.symbol).replace('%v', formatNumber(Math.abs(val), checkPrecision(opts.precision), opts.thousand, opts.decimal));\n\n\t\t\t\t\tif (fVal.length > maxLength) maxLength = fVal.length;\n\t\t\t\t\treturn fVal;\n\t\t\t\t}\n\t\t\t});\n\n\t\t// Pad each number in the list and send back the column of numbers:\n\t\treturn map(formatted, function(val, i) {\n\t\t\t// Only if this is a string (not a nested array, which would have already been padded):\n\t\t\tif (isString(val) && val.length < maxLength) {\n\t\t\t\t// Depending on symbol position, pad after symbol or at index 0:\n\t\t\t\treturn padAfterSymbol ? val.replace(opts.symbol, opts.symbol+(new Array(maxLength - val.length + 1).join(\" \"))) : (new Array(maxLength - val.length + 1).join(\" \")) + val;\n\t\t\t}\n\t\t\treturn val;\n\t\t});\n\t};\n\n\n\t/* --- Module Definition --- */\n\n\t// Export accounting for CommonJS. If being loaded as an AMD module, define it as such.\n\t// Otherwise, just add `accounting` to the global object\n\tif (typeof exports !== 'undefined') {\n\t\tif (typeof module !== 'undefined' && module.exports) {\n\t\t\texports = module.exports = lib;\n\t\t}\n\t\texports.accounting = lib;\n\t} else if (typeof define === 'function' && define.amd) {\n\t\t// Return the library as an AMD module:\n\t\tdefine([], function() {\n\t\t\treturn lib;\n\t\t});\n\t} else {\n\t\t// Use accounting.noConflict to restore `accounting` back to its original value.\n\t\t// Returns a reference to the library's `accounting` object;\n\t\t// e.g. `var numbers = accounting.noConflict();`\n\t\tlib.noConflict = (function(oldAccounting) {\n\t\t\treturn function() {\n\t\t\t\t// Reset the value of the root's `accounting` variable:\n\t\t\t\troot.accounting = oldAccounting;\n\t\t\t\t// Delete the noConflict method:\n\t\t\t\tlib.noConflict = undefined;\n\t\t\t\t// Return reference to the library to re-assign it:\n\t\t\t\treturn lib;\n\t\t\t};\n\t\t})(root.accounting);\n\n\t\t// Declare `fx` on the root (global/window) object:\n\t\troot['accounting'] = lib;\n\t}\n\n\t// Root will be `window` in browser or `global` on the server:\n}(this));\n","const Utils = require(\"./util\");\nconst pth = require(\"path\");\nconst ZipEntry = require(\"./zipEntry\");\nconst ZipFile = require(\"./zipFile\");\n\nconst get_Bool = (val, def) => (typeof val === \"boolean\" ? val : def);\nconst get_Str = (val, def) => (typeof val === \"string\" ? val : def);\n\nconst defaultOptions = {\n // option \"noSort\" : if true it disables files sorting\n noSort: false,\n // read entries during load (initial loading may be slower)\n readEntries: false,\n // default method is none\n method: Utils.Constants.NONE,\n // file system\n fs: null\n};\n\nmodule.exports = function (/**String*/ input, /** object */ options) {\n let inBuffer = null;\n\n // create object based default options, allowing them to be overwritten\n const opts = Object.assign(Object.create(null), defaultOptions);\n\n // test input variable\n if (input && \"object\" === typeof input) {\n // if value is not buffer we accept it to be object with options\n if (!(input instanceof Uint8Array)) {\n Object.assign(opts, input);\n input = opts.input ? opts.input : undefined;\n if (opts.input) delete opts.input;\n }\n\n // if input is buffer\n if (Buffer.isBuffer(input)) {\n inBuffer = input;\n opts.method = Utils.Constants.BUFFER;\n input = undefined;\n }\n }\n\n // assign options\n Object.assign(opts, options);\n\n // instanciate utils filesystem\n const filetools = new Utils(opts);\n\n // if input is file name we retrieve its content\n if (input && \"string\" === typeof input) {\n // load zip file\n if (filetools.fs.existsSync(input)) {\n opts.method = Utils.Constants.FILE;\n opts.filename = input;\n inBuffer = filetools.fs.readFileSync(input);\n } else {\n throw new Error(Utils.Errors.INVALID_FILENAME);\n }\n }\n\n // create variable\n const _zip = new ZipFile(inBuffer, opts);\n\n const { canonical, sanitize } = Utils;\n\n function getEntry(/**Object*/ entry) {\n if (entry && _zip) {\n var item;\n // If entry was given as a file name\n if (typeof entry === \"string\") item = _zip.getEntry(entry);\n // if entry was given as a ZipEntry object\n if (typeof entry === \"object\" && typeof entry.entryName !== \"undefined\" && typeof entry.header !== \"undefined\") item = _zip.getEntry(entry.entryName);\n\n if (item) {\n return item;\n }\n }\n return null;\n }\n\n function fixPath(zipPath) {\n const { join, normalize, sep } = pth.posix;\n // convert windows file separators and normalize\n return join(\".\", normalize(sep + zipPath.split(\"\\\\\").join(sep) + sep));\n }\n\n return {\n /**\n * Extracts the given entry from the archive and returns the content as a Buffer object\n * @param entry ZipEntry object or String with the full path of the entry\n *\n * @return Buffer or Null in case of error\n */\n readFile: function (/**Object*/ entry, /*String, Buffer*/ pass) {\n var item = getEntry(entry);\n return (item && item.getData(pass)) || null;\n },\n\n /**\n * Asynchronous readFile\n * @param entry ZipEntry object or String with the full path of the entry\n * @param callback\n *\n * @return Buffer or Null in case of error\n */\n readFileAsync: function (/**Object*/ entry, /**Function*/ callback) {\n var item = getEntry(entry);\n if (item) {\n item.getDataAsync(callback);\n } else {\n callback(null, \"getEntry failed for:\" + entry);\n }\n },\n\n /**\n * Extracts the given entry from the archive and returns the content as plain text in the given encoding\n * @param entry ZipEntry object or String with the full path of the entry\n * @param encoding Optional. If no encoding is specified utf8 is used\n *\n * @return String\n */\n readAsText: function (/**Object*/ entry, /**String=*/ encoding) {\n var item = getEntry(entry);\n if (item) {\n var data = item.getData();\n if (data && data.length) {\n return data.toString(encoding || \"utf8\");\n }\n }\n return \"\";\n },\n\n /**\n * Asynchronous readAsText\n * @param entry ZipEntry object or String with the full path of the entry\n * @param callback\n * @param encoding Optional. If no encoding is specified utf8 is used\n *\n * @return String\n */\n readAsTextAsync: function (/**Object*/ entry, /**Function*/ callback, /**String=*/ encoding) {\n var item = getEntry(entry);\n if (item) {\n item.getDataAsync(function (data, err) {\n if (err) {\n callback(data, err);\n return;\n }\n\n if (data && data.length) {\n callback(data.toString(encoding || \"utf8\"));\n } else {\n callback(\"\");\n }\n });\n } else {\n callback(\"\");\n }\n },\n\n /**\n * Remove the entry from the file or the entry and all it's nested directories and files if the given entry is a directory\n *\n * @param entry\n */\n deleteFile: function (/**Object*/ entry) {\n // @TODO: test deleteFile\n var item = getEntry(entry);\n if (item) {\n _zip.deleteEntry(item.entryName);\n }\n },\n\n /**\n * Adds a comment to the zip. The zip must be rewritten after adding the comment.\n *\n * @param comment\n */\n addZipComment: function (/**String*/ comment) {\n // @TODO: test addZipComment\n _zip.comment = comment;\n },\n\n /**\n * Returns the zip comment\n *\n * @return String\n */\n getZipComment: function () {\n return _zip.comment || \"\";\n },\n\n /**\n * Adds a comment to a specified zipEntry. The zip must be rewritten after adding the comment\n * The comment cannot exceed 65535 characters in length\n *\n * @param entry\n * @param comment\n */\n addZipEntryComment: function (/**Object*/ entry, /**String*/ comment) {\n var item = getEntry(entry);\n if (item) {\n item.comment = comment;\n }\n },\n\n /**\n * Returns the comment of the specified entry\n *\n * @param entry\n * @return String\n */\n getZipEntryComment: function (/**Object*/ entry) {\n var item = getEntry(entry);\n if (item) {\n return item.comment || \"\";\n }\n return \"\";\n },\n\n /**\n * Updates the content of an existing entry inside the archive. The zip must be rewritten after updating the content\n *\n * @param entry\n * @param content\n */\n updateFile: function (/**Object*/ entry, /**Buffer*/ content) {\n var item = getEntry(entry);\n if (item) {\n item.setData(content);\n }\n },\n\n /**\n * Adds a file from the disk to the archive\n *\n * @param localPath File to add to zip\n * @param zipPath Optional path inside the zip\n * @param zipName Optional name for the file\n */\n addLocalFile: function (/**String*/ localPath, /**String=*/ zipPath, /**String=*/ zipName, /**String*/ comment) {\n if (filetools.fs.existsSync(localPath)) {\n // fix ZipPath\n zipPath = zipPath ? fixPath(zipPath) : \"\";\n\n // p - local file name\n var p = localPath.split(\"\\\\\").join(\"/\").split(\"/\").pop();\n\n // add file name into zippath\n zipPath += zipName ? zipName : p;\n\n // read file attributes\n const _attr = filetools.fs.statSync(localPath);\n\n // add file into zip file\n this.addFile(zipPath, filetools.fs.readFileSync(localPath), comment, _attr);\n } else {\n throw new Error(Utils.Errors.FILE_NOT_FOUND.replace(\"%s\", localPath));\n }\n },\n\n /**\n * Adds a local directory and all its nested files and directories to the archive\n *\n * @param localPath\n * @param zipPath optional path inside zip\n * @param filter optional RegExp or Function if files match will\n * be included.\n */\n addLocalFolder: function (/**String*/ localPath, /**String=*/ zipPath, /**=RegExp|Function*/ filter) {\n // Prepare filter\n if (filter instanceof RegExp) {\n // if filter is RegExp wrap it\n filter = (function (rx) {\n return function (filename) {\n return rx.test(filename);\n };\n })(filter);\n } else if (\"function\" !== typeof filter) {\n // if filter is not function we will replace it\n filter = function () {\n return true;\n };\n }\n\n // fix ZipPath\n zipPath = zipPath ? fixPath(zipPath) : \"\";\n\n // normalize the path first\n localPath = pth.normalize(localPath);\n\n if (filetools.fs.existsSync(localPath)) {\n const items = filetools.findFiles(localPath);\n const self = this;\n\n if (items.length) {\n items.forEach(function (filepath) {\n var p = pth.relative(localPath, filepath).split(\"\\\\\").join(\"/\"); //windows fix\n if (filter(p)) {\n var stats = filetools.fs.statSync(filepath);\n if (stats.isFile()) {\n self.addFile(zipPath + p, filetools.fs.readFileSync(filepath), \"\", stats);\n } else {\n self.addFile(zipPath + p + \"/\", Buffer.alloc(0), \"\", stats);\n }\n }\n });\n }\n } else {\n throw new Error(Utils.Errors.FILE_NOT_FOUND.replace(\"%s\", localPath));\n }\n },\n\n /**\n * Asynchronous addLocalFile\n * @param localPath\n * @param callback\n * @param zipPath optional path inside zip\n * @param filter optional RegExp or Function if files match will\n * be included.\n */\n addLocalFolderAsync: function (/*String*/ localPath, /*Function*/ callback, /*String*/ zipPath, /*RegExp|Function*/ filter) {\n if (filter instanceof RegExp) {\n filter = (function (rx) {\n return function (filename) {\n return rx.test(filename);\n };\n })(filter);\n } else if (\"function\" !== typeof filter) {\n filter = function () {\n return true;\n };\n }\n\n // fix ZipPath\n zipPath = zipPath ? fixPath(zipPath) : \"\";\n\n // normalize the path first\n localPath = pth.normalize(localPath);\n\n var self = this;\n filetools.fs.open(localPath, \"r\", function (err) {\n if (err && err.code === \"ENOENT\") {\n callback(undefined, Utils.Errors.FILE_NOT_FOUND.replace(\"%s\", localPath));\n } else if (err) {\n callback(undefined, err);\n } else {\n var items = filetools.findFiles(localPath);\n var i = -1;\n\n var next = function () {\n i += 1;\n if (i < items.length) {\n var filepath = items[i];\n var p = pth.relative(localPath, filepath).split(\"\\\\\").join(\"/\"); //windows fix\n p = p\n .normalize(\"NFD\")\n .replace(/[\\u0300-\\u036f]/g, \"\")\n .replace(/[^\\x20-\\x7E]/g, \"\"); // accent fix\n if (filter(p)) {\n filetools.fs.stat(filepath, function (er0, stats) {\n if (er0) callback(undefined, er0);\n if (stats.isFile()) {\n filetools.fs.readFile(filepath, function (er1, data) {\n if (er1) {\n callback(undefined, er1);\n } else {\n self.addFile(zipPath + p, data, \"\", stats);\n next();\n }\n });\n } else {\n self.addFile(zipPath + p + \"/\", Buffer.alloc(0), \"\", stats);\n next();\n }\n });\n } else {\n next();\n }\n } else {\n callback(true, undefined);\n }\n };\n\n next();\n }\n });\n },\n\n /**\n *\n * @param {string} localPath - path where files will be extracted\n * @param {object} props - optional properties\n * @param {string} props.zipPath - optional path inside zip\n * @param {regexp, function} props.filter - RegExp or Function if files match will be included.\n */\n addLocalFolderPromise: function (/*String*/ localPath, /* object */ props) {\n return new Promise((resolve, reject) => {\n const { filter, zipPath } = Object.assign({}, props);\n this.addLocalFolderAsync(\n localPath,\n (done, err) => {\n if (err) reject(err);\n if (done) resolve(this);\n },\n zipPath,\n filter\n );\n });\n },\n\n /**\n * Allows you to create a entry (file or directory) in the zip file.\n * If you want to create a directory the entryName must end in / and a null buffer should be provided.\n * Comment and attributes are optional\n *\n * @param {string} entryName\n * @param {Buffer | string} content - file content as buffer or utf8 coded string\n * @param {string} comment - file comment\n * @param {number | object} attr - number as unix file permissions, object as filesystem Stats object\n */\n addFile: function (/**String*/ entryName, /**Buffer*/ content, /**String*/ comment, /**Number*/ attr) {\n let entry = getEntry(entryName);\n const update = entry != null;\n\n // prepare new entry\n if (!update) {\n entry = new ZipEntry();\n entry.entryName = entryName;\n }\n entry.comment = comment || \"\";\n\n const isStat = \"object\" === typeof attr && attr instanceof filetools.fs.Stats;\n\n // last modification time from file stats\n if (isStat) {\n entry.header.time = attr.mtime;\n }\n\n // Set file attribute\n var fileattr = entry.isDirectory ? 0x10 : 0; // (MS-DOS directory flag)\n\n // extended attributes field for Unix\n if (!Utils.isWin) {\n // set file type either S_IFDIR / S_IFREG\n let unix = entry.isDirectory ? 0x4000 : 0x8000;\n\n if (isStat) {\n // File attributes from file stats\n unix |= 0xfff & attr.mode;\n } else if (\"number\" === typeof attr) {\n // attr from given attr values\n unix |= 0xfff & attr;\n } else {\n // Default values:\n unix |= entry.isDirectory ? 0o755 : 0o644; // permissions (drwxr-xr-x) or (-r-wr--r--)\n }\n\n fileattr = (fileattr | (unix << 16)) >>> 0; // add attributes\n }\n\n entry.attr = fileattr;\n\n entry.setData(content);\n if (!update) _zip.setEntry(entry);\n },\n\n /**\n * Returns an array of ZipEntry objects representing the files and folders inside the archive\n *\n * @return Array\n */\n getEntries: function () {\n return _zip ? _zip.entries : [];\n },\n\n /**\n * Returns a ZipEntry object representing the file or folder specified by ``name``.\n *\n * @param name\n * @return ZipEntry\n */\n getEntry: function (/**String*/ name) {\n return getEntry(name);\n },\n\n getEntryCount: function () {\n return _zip.getEntryCount();\n },\n\n forEach: function (callback) {\n return _zip.forEach(callback);\n },\n\n /**\n * Extracts the given entry to the given targetPath\n * If the entry is a directory inside the archive, the entire directory and it's subdirectories will be extracted\n *\n * @param entry ZipEntry object or String with the full path of the entry\n * @param targetPath Target folder where to write the file\n * @param maintainEntryPath If maintainEntryPath is true and the entry is inside a folder, the entry folder\n * will be created in targetPath as well. Default is TRUE\n * @param overwrite If the file already exists at the target path, the file will be overwriten if this is true.\n * Default is FALSE\n * @param keepOriginalPermission The file will be set as the permission from the entry if this is true.\n * Default is FALSE\n * @param outFileName String If set will override the filename of the extracted file (Only works if the entry is a file)\n *\n * @return Boolean\n */\n extractEntryTo: function (\n /**Object*/ entry,\n /**String*/ targetPath,\n /**Boolean*/ maintainEntryPath,\n /**Boolean*/ overwrite,\n /**Boolean*/ keepOriginalPermission,\n /**String**/ outFileName\n ) {\n overwrite = get_Bool(overwrite, false);\n keepOriginalPermission = get_Bool(keepOriginalPermission, false);\n maintainEntryPath = get_Bool(maintainEntryPath, true);\n outFileName = get_Str(outFileName, get_Str(keepOriginalPermission, undefined));\n\n var item = getEntry(entry);\n if (!item) {\n throw new Error(Utils.Errors.NO_ENTRY);\n }\n\n var entryName = canonical(item.entryName);\n\n var target = sanitize(targetPath, outFileName && !item.isDirectory ? outFileName : maintainEntryPath ? entryName : pth.basename(entryName));\n\n if (item.isDirectory) {\n var children = _zip.getEntryChildren(item);\n children.forEach(function (child) {\n if (child.isDirectory) return;\n var content = child.getData();\n if (!content) {\n throw new Error(Utils.Errors.CANT_EXTRACT_FILE);\n }\n var name = canonical(child.entryName);\n var childName = sanitize(targetPath, maintainEntryPath ? name : pth.basename(name));\n // The reverse operation for attr depend on method addFile()\n const fileAttr = keepOriginalPermission ? child.header.fileAttr : undefined;\n filetools.writeFileTo(childName, content, overwrite, fileAttr);\n });\n return true;\n }\n\n var content = item.getData();\n if (!content) throw new Error(Utils.Errors.CANT_EXTRACT_FILE);\n\n if (filetools.fs.existsSync(target) && !overwrite) {\n throw new Error(Utils.Errors.CANT_OVERRIDE);\n }\n // The reverse operation for attr depend on method addFile()\n const fileAttr = keepOriginalPermission ? entry.header.fileAttr : undefined;\n filetools.writeFileTo(target, content, overwrite, fileAttr);\n\n return true;\n },\n\n /**\n * Test the archive\n *\n */\n test: function (pass) {\n if (!_zip) {\n return false;\n }\n\n for (var entry in _zip.entries) {\n try {\n if (entry.isDirectory) {\n continue;\n }\n var content = _zip.entries[entry].getData(pass);\n if (!content) {\n return false;\n }\n } catch (err) {\n return false;\n }\n }\n return true;\n },\n\n /**\n * Extracts the entire archive to the given location\n *\n * @param targetPath Target location\n * @param overwrite If the file already exists at the target path, the file will be overwriten if this is true.\n * Default is FALSE\n * @param keepOriginalPermission The file will be set as the permission from the entry if this is true.\n * Default is FALSE\n */\n extractAllTo: function (/**String*/ targetPath, /**Boolean*/ overwrite, /**Boolean*/ keepOriginalPermission, /*String, Buffer*/ pass) {\n overwrite = get_Bool(overwrite, false);\n pass = get_Str(keepOriginalPermission, pass);\n keepOriginalPermission = get_Bool(keepOriginalPermission, false);\n if (!_zip) {\n throw new Error(Utils.Errors.NO_ZIP);\n }\n _zip.entries.forEach(function (entry) {\n var entryName = sanitize(targetPath, canonical(entry.entryName.toString()));\n if (entry.isDirectory) {\n filetools.makeDir(entryName);\n return;\n }\n var content = entry.getData(pass);\n if (!content) {\n throw new Error(Utils.Errors.CANT_EXTRACT_FILE);\n }\n // The reverse operation for attr depend on method addFile()\n const fileAttr = keepOriginalPermission ? entry.header.fileAttr : undefined;\n filetools.writeFileTo(entryName, content, overwrite, fileAttr);\n try {\n filetools.fs.utimesSync(entryName, entry.header.time, entry.header.time);\n } catch (err) {\n throw new Error(Utils.Errors.CANT_EXTRACT_FILE);\n }\n });\n },\n\n /**\n * Asynchronous extractAllTo\n *\n * @param targetPath Target location\n * @param overwrite If the file already exists at the target path, the file will be overwriten if this is true.\n * Default is FALSE\n * @param keepOriginalPermission The file will be set as the permission from the entry if this is true.\n * Default is FALSE\n * @param callback The callback will be executed when all entries are extracted successfully or any error is thrown.\n */\n extractAllToAsync: function (/**String*/ targetPath, /**Boolean*/ overwrite, /**Boolean*/ keepOriginalPermission, /**Function*/ callback) {\n if (!callback) {\n callback = function () {};\n }\n overwrite = get_Bool(overwrite, false);\n if (typeof keepOriginalPermission === \"function\" && !callback) callback = keepOriginalPermission;\n keepOriginalPermission = get_Bool(keepOriginalPermission, false);\n if (!_zip) {\n callback(new Error(Utils.Errors.NO_ZIP));\n return;\n }\n\n targetPath = pth.resolve(targetPath);\n // convert entryName to\n const getPath = (entry) => sanitize(targetPath, pth.normalize(canonical(entry.entryName.toString())));\n const getError = (msg, file) => new Error(msg + ': \"' + file + '\"');\n\n // separate directories from files\n const dirEntries = [];\n const fileEntries = new Set();\n _zip.entries.forEach((e) => {\n if (e.isDirectory) {\n dirEntries.push(e);\n } else {\n fileEntries.add(e);\n }\n });\n\n // Create directory entries first synchronously\n // this prevents race condition and assures folders are there before writing files\n for (const entry of dirEntries) {\n const dirPath = getPath(entry);\n // The reverse operation for attr depend on method addFile()\n const dirAttr = keepOriginalPermission ? entry.header.fileAttr : undefined;\n try {\n filetools.makeDir(dirPath);\n if (dirAttr) filetools.fs.chmodSync(dirPath, dirAttr);\n // in unix timestamp will change if files are later added to folder, but still\n filetools.fs.utimesSync(dirPath, entry.header.time, entry.header.time);\n } catch (er) {\n callback(getError(\"Unable to create folder\", dirPath));\n }\n }\n\n // callback wrapper, for some house keeping\n const done = () => {\n if (fileEntries.size === 0) {\n callback();\n }\n };\n\n // Extract file entries asynchronously\n for (const entry of fileEntries.values()) {\n const entryName = pth.normalize(canonical(entry.entryName.toString()));\n const filePath = sanitize(targetPath, entryName);\n entry.getDataAsync(function (content, err_1) {\n if (err_1) {\n callback(new Error(err_1));\n return;\n }\n if (!content) {\n callback(new Error(Utils.Errors.CANT_EXTRACT_FILE));\n } else {\n // The reverse operation for attr depend on method addFile()\n const fileAttr = keepOriginalPermission ? entry.header.fileAttr : undefined;\n filetools.writeFileToAsync(filePath, content, overwrite, fileAttr, function (succ) {\n if (!succ) {\n callback(getError(\"Unable to write file\", filePath));\n return;\n }\n filetools.fs.utimes(filePath, entry.header.time, entry.header.time, function (err_2) {\n if (err_2) {\n callback(getError(\"Unable to set times\", filePath));\n return;\n }\n fileEntries.delete(entry);\n // call the callback if it was last entry\n done();\n });\n });\n }\n });\n }\n // call the callback if fileEntries was empty\n done();\n },\n\n /**\n * Writes the newly created zip file to disk at the specified location or if a zip was opened and no ``targetFileName`` is provided, it will overwrite the opened zip\n *\n * @param targetFileName\n * @param callback\n */\n writeZip: function (/**String*/ targetFileName, /**Function*/ callback) {\n if (arguments.length === 1) {\n if (typeof targetFileName === \"function\") {\n callback = targetFileName;\n targetFileName = \"\";\n }\n }\n\n if (!targetFileName && opts.filename) {\n targetFileName = opts.filename;\n }\n if (!targetFileName) return;\n\n var zipData = _zip.compressToBuffer();\n if (zipData) {\n var ok = filetools.writeFileTo(targetFileName, zipData, true);\n if (typeof callback === \"function\") callback(!ok ? new Error(\"failed\") : null, \"\");\n }\n },\n\n writeZipPromise: function (/**String*/ targetFileName, /* object */ props) {\n const { overwrite, perm } = Object.assign({ overwrite: true }, props);\n\n return new Promise((resolve, reject) => {\n // find file name\n if (!targetFileName && opts.filename) targetFileName = opts.filename;\n if (!targetFileName) reject(\"ADM-ZIP: ZIP File Name Missing\");\n\n this.toBufferPromise().then((zipData) => {\n const ret = (done) => (done ? resolve(done) : reject(\"ADM-ZIP: Wasn't able to write zip file\"));\n filetools.writeFileToAsync(targetFileName, zipData, overwrite, perm, ret);\n }, reject);\n });\n },\n\n toBufferPromise: function () {\n return new Promise((resolve, reject) => {\n _zip.toAsyncBuffer(resolve, reject);\n });\n },\n\n /**\n * Returns the content of the entire zip file as a Buffer object\n *\n * @return Buffer\n */\n toBuffer: function (/**Function=*/ onSuccess, /**Function=*/ onFail, /**Function=*/ onItemStart, /**Function=*/ onItemEnd) {\n this.valueOf = 2;\n if (typeof onSuccess === \"function\") {\n _zip.toAsyncBuffer(onSuccess, onFail, onItemStart, onItemEnd);\n return null;\n }\n return _zip.compressToBuffer();\n }\n };\n};\n","var Utils = require(\"../util\"),\n Constants = Utils.Constants;\n\n/* The central directory file header */\nmodule.exports = function () {\n var _verMade = 20, // v2.0\n _version = 10, // v1.0\n _flags = 0,\n _method = 0,\n _time = 0,\n _crc = 0,\n _compressedSize = 0,\n _size = 0,\n _fnameLen = 0,\n _extraLen = 0,\n _comLen = 0,\n _diskStart = 0,\n _inattr = 0,\n _attr = 0,\n _offset = 0;\n\n _verMade |= Utils.isWin ? 0x0a00 : 0x0300;\n\n // Set EFS flag since filename and comment fields are all by default encoded using UTF-8.\n // Without it file names may be corrupted for other apps when file names use unicode chars\n _flags |= Constants.FLG_EFS;\n\n var _dataHeader = {};\n\n function setTime(val) {\n val = new Date(val);\n _time =\n (((val.getFullYear() - 1980) & 0x7f) << 25) | // b09-16 years from 1980\n ((val.getMonth() + 1) << 21) | // b05-08 month\n (val.getDate() << 16) | // b00-04 hour\n // 2 bytes time\n (val.getHours() << 11) | // b11-15 hour\n (val.getMinutes() << 5) | // b05-10 minute\n (val.getSeconds() >> 1); // b00-04 seconds divided by 2\n }\n\n setTime(+new Date());\n\n return {\n get made() {\n return _verMade;\n },\n set made(val) {\n _verMade = val;\n },\n\n get version() {\n return _version;\n },\n set version(val) {\n _version = val;\n },\n\n get flags() {\n return _flags;\n },\n set flags(val) {\n _flags = val;\n },\n\n get method() {\n return _method;\n },\n set method(val) {\n switch (val) {\n case Constants.STORED:\n this.version = 10;\n case Constants.DEFLATED:\n default:\n this.version = 20;\n }\n _method = val;\n },\n\n get time() {\n return new Date(((_time >> 25) & 0x7f) + 1980, ((_time >> 21) & 0x0f) - 1, (_time >> 16) & 0x1f, (_time >> 11) & 0x1f, (_time >> 5) & 0x3f, (_time & 0x1f) << 1);\n },\n set time(val) {\n setTime(val);\n },\n\n get crc() {\n return _crc;\n },\n set crc(val) {\n _crc = Math.max(0, val) >>> 0;\n },\n\n get compressedSize() {\n return _compressedSize;\n },\n set compressedSize(val) {\n _compressedSize = Math.max(0, val) >>> 0;\n },\n\n get size() {\n return _size;\n },\n set size(val) {\n _size = Math.max(0, val) >>> 0;\n },\n\n get fileNameLength() {\n return _fnameLen;\n },\n set fileNameLength(val) {\n _fnameLen = val;\n },\n\n get extraLength() {\n return _extraLen;\n },\n set extraLength(val) {\n _extraLen = val;\n },\n\n get commentLength() {\n return _comLen;\n },\n set commentLength(val) {\n _comLen = val;\n },\n\n get diskNumStart() {\n return _diskStart;\n },\n set diskNumStart(val) {\n _diskStart = Math.max(0, val) >>> 0;\n },\n\n get inAttr() {\n return _inattr;\n },\n set inAttr(val) {\n _inattr = Math.max(0, val) >>> 0;\n },\n\n get attr() {\n return _attr;\n },\n set attr(val) {\n _attr = Math.max(0, val) >>> 0;\n },\n\n // get Unix file permissions\n get fileAttr() {\n return _attr ? (((_attr >>> 0) | 0) >> 16) & 0xfff : 0;\n },\n\n get offset() {\n return _offset;\n },\n set offset(val) {\n _offset = Math.max(0, val) >>> 0;\n },\n\n get encripted() {\n return (_flags & 1) === 1;\n },\n\n get entryHeaderSize() {\n return Constants.CENHDR + _fnameLen + _extraLen + _comLen;\n },\n\n get realDataOffset() {\n return _offset + Constants.LOCHDR + _dataHeader.fnameLen + _dataHeader.extraLen;\n },\n\n get dataHeader() {\n return _dataHeader;\n },\n\n loadDataHeaderFromBinary: function (/*Buffer*/ input) {\n var data = input.slice(_offset, _offset + Constants.LOCHDR);\n // 30 bytes and should start with \"PK\\003\\004\"\n if (data.readUInt32LE(0) !== Constants.LOCSIG) {\n throw new Error(Utils.Errors.INVALID_LOC);\n }\n _dataHeader = {\n // version needed to extract\n version: data.readUInt16LE(Constants.LOCVER),\n // general purpose bit flag\n flags: data.readUInt16LE(Constants.LOCFLG),\n // compression method\n method: data.readUInt16LE(Constants.LOCHOW),\n // modification time (2 bytes time, 2 bytes date)\n time: data.readUInt32LE(Constants.LOCTIM),\n // uncompressed file crc-32 value\n crc: data.readUInt32LE(Constants.LOCCRC),\n // compressed size\n compressedSize: data.readUInt32LE(Constants.LOCSIZ),\n // uncompressed size\n size: data.readUInt32LE(Constants.LOCLEN),\n // filename length\n fnameLen: data.readUInt16LE(Constants.LOCNAM),\n // extra field length\n extraLen: data.readUInt16LE(Constants.LOCEXT)\n };\n },\n\n loadFromBinary: function (/*Buffer*/ data) {\n // data should be 46 bytes and start with \"PK 01 02\"\n if (data.length !== Constants.CENHDR || data.readUInt32LE(0) !== Constants.CENSIG) {\n throw new Error(Utils.Errors.INVALID_CEN);\n }\n // version made by\n _verMade = data.readUInt16LE(Constants.CENVEM);\n // version needed to extract\n _version = data.readUInt16LE(Constants.CENVER);\n // encrypt, decrypt flags\n _flags = data.readUInt16LE(Constants.CENFLG);\n // compression method\n _method = data.readUInt16LE(Constants.CENHOW);\n // modification time (2 bytes time, 2 bytes date)\n _time = data.readUInt32LE(Constants.CENTIM);\n // uncompressed file crc-32 value\n _crc = data.readUInt32LE(Constants.CENCRC);\n // compressed size\n _compressedSize = data.readUInt32LE(Constants.CENSIZ);\n // uncompressed size\n _size = data.readUInt32LE(Constants.CENLEN);\n // filename length\n _fnameLen = data.readUInt16LE(Constants.CENNAM);\n // extra field length\n _extraLen = data.readUInt16LE(Constants.CENEXT);\n // file comment length\n _comLen = data.readUInt16LE(Constants.CENCOM);\n // volume number start\n _diskStart = data.readUInt16LE(Constants.CENDSK);\n // internal file attributes\n _inattr = data.readUInt16LE(Constants.CENATT);\n // external file attributes\n _attr = data.readUInt32LE(Constants.CENATX);\n // LOC header offset\n _offset = data.readUInt32LE(Constants.CENOFF);\n },\n\n dataHeaderToBinary: function () {\n // LOC header size (30 bytes)\n var data = Buffer.alloc(Constants.LOCHDR);\n // \"PK\\003\\004\"\n data.writeUInt32LE(Constants.LOCSIG, 0);\n // version needed to extract\n data.writeUInt16LE(_version, Constants.LOCVER);\n // general purpose bit flag\n data.writeUInt16LE(_flags, Constants.LOCFLG);\n // compression method\n data.writeUInt16LE(_method, Constants.LOCHOW);\n // modification time (2 bytes time, 2 bytes date)\n data.writeUInt32LE(_time, Constants.LOCTIM);\n // uncompressed file crc-32 value\n data.writeUInt32LE(_crc, Constants.LOCCRC);\n // compressed size\n data.writeUInt32LE(_compressedSize, Constants.LOCSIZ);\n // uncompressed size\n data.writeUInt32LE(_size, Constants.LOCLEN);\n // filename length\n data.writeUInt16LE(_fnameLen, Constants.LOCNAM);\n // extra field length\n data.writeUInt16LE(_extraLen, Constants.LOCEXT);\n return data;\n },\n\n entryHeaderToBinary: function () {\n // CEN header size (46 bytes)\n var data = Buffer.alloc(Constants.CENHDR + _fnameLen + _extraLen + _comLen);\n // \"PK\\001\\002\"\n data.writeUInt32LE(Constants.CENSIG, 0);\n // version made by\n data.writeUInt16LE(_verMade, Constants.CENVEM);\n // version needed to extract\n data.writeUInt16LE(_version, Constants.CENVER);\n // encrypt, decrypt flags\n data.writeUInt16LE(_flags, Constants.CENFLG);\n // compression method\n data.writeUInt16LE(_method, Constants.CENHOW);\n // modification time (2 bytes time, 2 bytes date)\n data.writeUInt32LE(_time, Constants.CENTIM);\n // uncompressed file crc-32 value\n data.writeUInt32LE(_crc, Constants.CENCRC);\n // compressed size\n data.writeUInt32LE(_compressedSize, Constants.CENSIZ);\n // uncompressed size\n data.writeUInt32LE(_size, Constants.CENLEN);\n // filename length\n data.writeUInt16LE(_fnameLen, Constants.CENNAM);\n // extra field length\n data.writeUInt16LE(_extraLen, Constants.CENEXT);\n // file comment length\n data.writeUInt16LE(_comLen, Constants.CENCOM);\n // volume number start\n data.writeUInt16LE(_diskStart, Constants.CENDSK);\n // internal file attributes\n data.writeUInt16LE(_inattr, Constants.CENATT);\n // external file attributes\n data.writeUInt32LE(_attr, Constants.CENATX);\n // LOC header offset\n data.writeUInt32LE(_offset, Constants.CENOFF);\n // fill all with\n data.fill(0x00, Constants.CENHDR);\n return data;\n },\n\n toJSON: function () {\n const bytes = function (nr) {\n return nr + \" bytes\";\n };\n\n return {\n made: _verMade,\n version: _version,\n flags: _flags,\n method: Utils.methodToString(_method),\n time: this.time,\n crc: \"0x\" + _crc.toString(16).toUpperCase(),\n compressedSize: bytes(_compressedSize),\n size: bytes(_size),\n fileNameLength: bytes(_fnameLen),\n extraLength: bytes(_extraLen),\n commentLength: bytes(_comLen),\n diskNumStart: _diskStart,\n inAttr: _inattr,\n attr: _attr,\n offset: _offset,\n entryHeaderSize: bytes(Constants.CENHDR + _fnameLen + _extraLen + _comLen)\n };\n },\n\n toString: function () {\n return JSON.stringify(this.toJSON(), null, \"\\t\");\n }\n };\n};\n","exports.EntryHeader = require(\"./entryHeader\");\nexports.MainHeader = require(\"./mainHeader\");\n","var Utils = require(\"../util\"),\n Constants = Utils.Constants;\n\n/* The entries in the end of central directory */\nmodule.exports = function () {\n var _volumeEntries = 0,\n _totalEntries = 0,\n _size = 0,\n _offset = 0,\n _commentLength = 0;\n\n return {\n get diskEntries() {\n return _volumeEntries;\n },\n set diskEntries(/*Number*/ val) {\n _volumeEntries = _totalEntries = val;\n },\n\n get totalEntries() {\n return _totalEntries;\n },\n set totalEntries(/*Number*/ val) {\n _totalEntries = _volumeEntries = val;\n },\n\n get size() {\n return _size;\n },\n set size(/*Number*/ val) {\n _size = val;\n },\n\n get offset() {\n return _offset;\n },\n set offset(/*Number*/ val) {\n _offset = val;\n },\n\n get commentLength() {\n return _commentLength;\n },\n set commentLength(/*Number*/ val) {\n _commentLength = val;\n },\n\n get mainHeaderSize() {\n return Constants.ENDHDR + _commentLength;\n },\n\n loadFromBinary: function (/*Buffer*/ data) {\n // data should be 22 bytes and start with \"PK 05 06\"\n // or be 56+ bytes and start with \"PK 06 06\" for Zip64\n if (\n (data.length !== Constants.ENDHDR || data.readUInt32LE(0) !== Constants.ENDSIG) &&\n (data.length < Constants.ZIP64HDR || data.readUInt32LE(0) !== Constants.ZIP64SIG)\n ) {\n throw new Error(Utils.Errors.INVALID_END);\n }\n\n if (data.readUInt32LE(0) === Constants.ENDSIG) {\n // number of entries on this volume\n _volumeEntries = data.readUInt16LE(Constants.ENDSUB);\n // total number of entries\n _totalEntries = data.readUInt16LE(Constants.ENDTOT);\n // central directory size in bytes\n _size = data.readUInt32LE(Constants.ENDSIZ);\n // offset of first CEN header\n _offset = data.readUInt32LE(Constants.ENDOFF);\n // zip file comment length\n _commentLength = data.readUInt16LE(Constants.ENDCOM);\n } else {\n // number of entries on this volume\n _volumeEntries = Utils.readBigUInt64LE(data, Constants.ZIP64SUB);\n // total number of entries\n _totalEntries = Utils.readBigUInt64LE(data, Constants.ZIP64TOT);\n // central directory size in bytes\n _size = Utils.readBigUInt64LE(data, Constants.ZIP64SIZ);\n // offset of first CEN header\n _offset = Utils.readBigUInt64LE(data, Constants.ZIP64OFF);\n\n _commentLength = 0;\n }\n },\n\n toBinary: function () {\n var b = Buffer.alloc(Constants.ENDHDR + _commentLength);\n // \"PK 05 06\" signature\n b.writeUInt32LE(Constants.ENDSIG, 0);\n b.writeUInt32LE(0, 4);\n // number of entries on this volume\n b.writeUInt16LE(_volumeEntries, Constants.ENDSUB);\n // total number of entries\n b.writeUInt16LE(_totalEntries, Constants.ENDTOT);\n // central directory size in bytes\n b.writeUInt32LE(_size, Constants.ENDSIZ);\n // offset of first CEN header\n b.writeUInt32LE(_offset, Constants.ENDOFF);\n // zip file comment length\n b.writeUInt16LE(_commentLength, Constants.ENDCOM);\n // fill comment memory with spaces so no garbage is left there\n b.fill(\" \", Constants.ENDHDR);\n\n return b;\n },\n\n toJSON: function () {\n // creates 0x0000 style output\n const offset = function (nr, len) {\n let offs = nr.toString(16).toUpperCase();\n while (offs.length < len) offs = \"0\" + offs;\n return \"0x\" + offs;\n };\n\n return {\n diskEntries: _volumeEntries,\n totalEntries: _totalEntries,\n size: _size + \" bytes\",\n offset: offset(_offset, 4),\n commentLength: _commentLength\n };\n },\n\n toString: function () {\n return JSON.stringify(this.toJSON(), null, \"\\t\");\n }\n };\n};\n","module.exports = function (/*Buffer*/ inbuf) {\n var zlib = require(\"zlib\");\n\n var opts = { chunkSize: (parseInt(inbuf.length / 1024) + 1) * 1024 };\n\n return {\n deflate: function () {\n return zlib.deflateRawSync(inbuf, opts);\n },\n\n deflateAsync: function (/*Function*/ callback) {\n var tmp = zlib.createDeflateRaw(opts),\n parts = [],\n total = 0;\n tmp.on(\"data\", function (data) {\n parts.push(data);\n total += data.length;\n });\n tmp.on(\"end\", function () {\n var buf = Buffer.alloc(total),\n written = 0;\n buf.fill(0);\n for (var i = 0; i < parts.length; i++) {\n var part = parts[i];\n part.copy(buf, written);\n written += part.length;\n }\n callback && callback(buf);\n });\n tmp.end(inbuf);\n }\n };\n};\n","exports.Deflater = require(\"./deflater\");\nexports.Inflater = require(\"./inflater\");\nexports.ZipCrypto = require(\"./zipcrypto\");\n","module.exports = function (/*Buffer*/ inbuf) {\n var zlib = require(\"zlib\");\n\n return {\n inflate: function () {\n return zlib.inflateRawSync(inbuf);\n },\n\n inflateAsync: function (/*Function*/ callback) {\n var tmp = zlib.createInflateRaw(),\n parts = [],\n total = 0;\n tmp.on(\"data\", function (data) {\n parts.push(data);\n total += data.length;\n });\n tmp.on(\"end\", function () {\n var buf = Buffer.alloc(total),\n written = 0;\n buf.fill(0);\n for (var i = 0; i < parts.length; i++) {\n var part = parts[i];\n part.copy(buf, written);\n written += part.length;\n }\n callback && callback(buf);\n });\n tmp.end(inbuf);\n }\n };\n};\n","\"use strict\";\n\n// node crypt, we use it for generate salt\n// eslint-disable-next-line node/no-unsupported-features/node-builtins\nconst { randomFillSync } = require(\"crypto\");\n\n// generate CRC32 lookup table\nconst crctable = new Uint32Array(256).map((t, crc) => {\n for (let j = 0; j < 8; j++) {\n if (0 !== (crc & 1)) {\n crc = (crc >>> 1) ^ 0xedb88320;\n } else {\n crc >>>= 1;\n }\n }\n return crc >>> 0;\n});\n\n// C-style uInt32 Multiply (discards higher bits, when JS multiply discards lower bits)\nconst uMul = (a, b) => Math.imul(a, b) >>> 0;\n\n// crc32 byte single update (actually same function is part of utils.crc32 function :) )\nconst crc32update = (pCrc32, bval) => {\n return crctable[(pCrc32 ^ bval) & 0xff] ^ (pCrc32 >>> 8);\n};\n\n// function for generating salt for encrytion header\nconst genSalt = () => {\n if (\"function\" === typeof randomFillSync) {\n return randomFillSync(Buffer.alloc(12));\n } else {\n // fallback if function is not defined\n return genSalt.node();\n }\n};\n\n// salt generation with node random function (mainly as fallback)\ngenSalt.node = () => {\n const salt = Buffer.alloc(12);\n const len = salt.length;\n for (let i = 0; i < len; i++) salt[i] = (Math.random() * 256) & 0xff;\n return salt;\n};\n\n// general config\nconst config = {\n genSalt\n};\n\n// Class Initkeys handles same basic ops with keys\nfunction Initkeys(pw) {\n const pass = Buffer.isBuffer(pw) ? pw : Buffer.from(pw);\n this.keys = new Uint32Array([0x12345678, 0x23456789, 0x34567890]);\n for (let i = 0; i < pass.length; i++) {\n this.updateKeys(pass[i]);\n }\n}\n\nInitkeys.prototype.updateKeys = function (byteValue) {\n const keys = this.keys;\n keys[0] = crc32update(keys[0], byteValue);\n keys[1] += keys[0] & 0xff;\n keys[1] = uMul(keys[1], 134775813) + 1;\n keys[2] = crc32update(keys[2], keys[1] >>> 24);\n return byteValue;\n};\n\nInitkeys.prototype.next = function () {\n const k = (this.keys[2] | 2) >>> 0; // key\n return (uMul(k, k ^ 1) >> 8) & 0xff; // decode\n};\n\nfunction make_decrypter(/*Buffer*/ pwd) {\n // 1. Stage initialize key\n const keys = new Initkeys(pwd);\n\n // return decrypter function\n return function (/*Buffer*/ data) {\n // result - we create new Buffer for results\n const result = Buffer.alloc(data.length);\n let pos = 0;\n // process input data\n for (let c of data) {\n //c ^= keys.next();\n //result[pos++] = c; // decode & Save Value\n result[pos++] = keys.updateKeys(c ^ keys.next()); // update keys with decoded byte\n }\n return result;\n };\n}\n\nfunction make_encrypter(/*Buffer*/ pwd) {\n // 1. Stage initialize key\n const keys = new Initkeys(pwd);\n\n // return encrypting function, result and pos is here so we dont have to merge buffers later\n return function (/*Buffer*/ data, /*Buffer*/ result, /* Number */ pos = 0) {\n // result - we create new Buffer for results\n if (!result) result = Buffer.alloc(data.length);\n // process input data\n for (let c of data) {\n const k = keys.next(); // save key byte\n result[pos++] = c ^ k; // save val\n keys.updateKeys(c); // update keys with decoded byte\n }\n return result;\n };\n}\n\nfunction decrypt(/*Buffer*/ data, /*Object*/ header, /*String, Buffer*/ pwd) {\n if (!data || !Buffer.isBuffer(data) || data.length < 12) {\n return Buffer.alloc(0);\n }\n\n // 1. We Initialize and generate decrypting function\n const decrypter = make_decrypter(pwd);\n\n // 2. decrypt salt what is always 12 bytes and is a part of file content\n const salt = decrypter(data.slice(0, 12));\n\n // 3. does password meet expectations\n if (salt[11] !== header.crc >>> 24) {\n throw \"ADM-ZIP: Wrong Password\";\n }\n\n // 4. decode content\n return decrypter(data.slice(12));\n}\n\n// lets add way to populate salt, NOT RECOMMENDED for production but maybe useful for testing general functionality\nfunction _salter(data) {\n if (Buffer.isBuffer(data) && data.length >= 12) {\n // be aware - currently salting buffer data is modified\n config.genSalt = function () {\n return data.slice(0, 12);\n };\n } else if (data === \"node\") {\n // test salt generation with node random function\n config.genSalt = genSalt.node;\n } else {\n // if value is not acceptable config gets reset.\n config.genSalt = genSalt;\n }\n}\n\nfunction encrypt(/*Buffer*/ data, /*Object*/ header, /*String, Buffer*/ pwd, /*Boolean*/ oldlike = false) {\n // 1. test data if data is not Buffer we make buffer from it\n if (data == null) data = Buffer.alloc(0);\n // if data is not buffer be make buffer from it\n if (!Buffer.isBuffer(data)) data = Buffer.from(data.toString());\n\n // 2. We Initialize and generate encrypting function\n const encrypter = make_encrypter(pwd);\n\n // 3. generate salt (12-bytes of random data)\n const salt = config.genSalt();\n salt[11] = (header.crc >>> 24) & 0xff;\n\n // old implementations (before PKZip 2.04g) used two byte check\n if (oldlike) salt[10] = (header.crc >>> 16) & 0xff;\n\n // 4. create output\n const result = Buffer.alloc(data.length + 12);\n encrypter(salt, result);\n\n // finally encode content\n return encrypter(data, result, 12);\n}\n\nmodule.exports = { decrypt, encrypt, _salter };\n","module.exports = {\n /* The local file header */\n LOCHDR : 30, // LOC header size\n LOCSIG : 0x04034b50, // \"PK\\003\\004\"\n LOCVER : 4,\t// version needed to extract\n LOCFLG : 6, // general purpose bit flag\n LOCHOW : 8, // compression method\n LOCTIM : 10, // modification time (2 bytes time, 2 bytes date)\n LOCCRC : 14, // uncompressed file crc-32 value\n LOCSIZ : 18, // compressed size\n LOCLEN : 22, // uncompressed size\n LOCNAM : 26, // filename length\n LOCEXT : 28, // extra field length\n\n /* The Data descriptor */\n EXTSIG : 0x08074b50, // \"PK\\007\\008\"\n EXTHDR : 16, // EXT header size\n EXTCRC : 4, // uncompressed file crc-32 value\n EXTSIZ : 8, // compressed size\n EXTLEN : 12, // uncompressed size\n\n /* The central directory file header */\n CENHDR : 46, // CEN header size\n CENSIG : 0x02014b50, // \"PK\\001\\002\"\n CENVEM : 4, // version made by\n CENVER : 6, // version needed to extract\n CENFLG : 8, // encrypt, decrypt flags\n CENHOW : 10, // compression method\n CENTIM : 12, // modification time (2 bytes time, 2 bytes date)\n CENCRC : 16, // uncompressed file crc-32 value\n CENSIZ : 20, // compressed size\n CENLEN : 24, // uncompressed size\n CENNAM : 28, // filename length\n CENEXT : 30, // extra field length\n CENCOM : 32, // file comment length\n CENDSK : 34, // volume number start\n CENATT : 36, // internal file attributes\n CENATX : 38, // external file attributes (host system dependent)\n CENOFF : 42, // LOC header offset\n\n /* The entries in the end of central directory */\n ENDHDR : 22, // END header size\n ENDSIG : 0x06054b50, // \"PK\\005\\006\"\n ENDSUB : 8, // number of entries on this disk\n ENDTOT : 10, // total number of entries\n ENDSIZ : 12, // central directory size in bytes\n ENDOFF : 16, // offset of first CEN header\n ENDCOM : 20, // zip file comment length\n\n END64HDR : 20, // zip64 END header size\n END64SIG : 0x07064b50, // zip64 Locator signature, \"PK\\006\\007\"\n END64START : 4, // number of the disk with the start of the zip64\n END64OFF : 8, // relative offset of the zip64 end of central directory\n END64NUMDISKS : 16, // total number of disks\n\n ZIP64SIG : 0x06064b50, // zip64 signature, \"PK\\006\\006\"\n ZIP64HDR : 56, // zip64 record minimum size\n ZIP64LEAD : 12, // leading bytes at the start of the record, not counted by the value stored in ZIP64SIZE\n ZIP64SIZE : 4, // zip64 size of the central directory record\n ZIP64VEM : 12, // zip64 version made by\n ZIP64VER : 14, // zip64 version needed to extract\n ZIP64DSK : 16, // zip64 number of this disk\n ZIP64DSKDIR : 20, // number of the disk with the start of the record directory\n ZIP64SUB : 24, // number of entries on this disk\n ZIP64TOT : 32, // total number of entries\n ZIP64SIZB : 40, // zip64 central directory size in bytes\n ZIP64OFF : 48, // offset of start of central directory with respect to the starting disk number\n ZIP64EXTRA : 56, // extensible data sector\n\n /* Compression methods */\n STORED : 0, // no compression\n SHRUNK : 1, // shrunk\n REDUCED1 : 2, // reduced with compression factor 1\n REDUCED2 : 3, // reduced with compression factor 2\n REDUCED3 : 4, // reduced with compression factor 3\n REDUCED4 : 5, // reduced with compression factor 4\n IMPLODED : 6, // imploded\n // 7 reserved for Tokenizing compression algorithm\n DEFLATED : 8, // deflated\n ENHANCED_DEFLATED: 9, // enhanced deflated\n PKWARE : 10,// PKWare DCL imploded\n // 11 reserved by PKWARE\n BZIP2 : 12, // compressed using BZIP2\n // 13 reserved by PKWARE\n LZMA : 14, // LZMA\n // 15-17 reserved by PKWARE\n IBM_TERSE : 18, // compressed using IBM TERSE\n IBM_LZ77 : 19, // IBM LZ77 z\n AES_ENCRYPT : 99, // WinZIP AES encryption method\n\n /* General purpose bit flag */\n // values can obtained with expression 2**bitnr\n FLG_ENC : 1, // Bit 0: encrypted file\n FLG_COMP1 : 2, // Bit 1, compression option\n FLG_COMP2 : 4, // Bit 2, compression option\n FLG_DESC : 8, // Bit 3, data descriptor\n FLG_ENH : 16, // Bit 4, enhanced deflating\n FLG_PATCH : 32, // Bit 5, indicates that the file is compressed patched data.\n FLG_STR : 64, // Bit 6, strong encryption (patented)\n // Bits 7-10: Currently unused.\n FLG_EFS : 2048, // Bit 11: Language encoding flag (EFS)\n // Bit 12: Reserved by PKWARE for enhanced compression.\n // Bit 13: encrypted the Central Directory (patented).\n // Bits 14-15: Reserved by PKWARE.\n FLG_MSK : 4096, // mask header values\n\n /* Load type */\n FILE : 2,\n BUFFER : 1,\n NONE : 0,\n\n /* 4.5 Extensible data fields */\n EF_ID : 0,\n EF_SIZE : 2,\n\n /* Header IDs */\n ID_ZIP64 : 0x0001,\n ID_AVINFO : 0x0007,\n ID_PFS : 0x0008,\n ID_OS2 : 0x0009,\n ID_NTFS : 0x000a,\n ID_OPENVMS : 0x000c,\n ID_UNIX : 0x000d,\n ID_FORK : 0x000e,\n ID_PATCH : 0x000f,\n ID_X509_PKCS7 : 0x0014,\n ID_X509_CERTID_F : 0x0015,\n ID_X509_CERTID_C : 0x0016,\n ID_STRONGENC : 0x0017,\n ID_RECORD_MGT : 0x0018,\n ID_X509_PKCS7_RL : 0x0019,\n ID_IBM1 : 0x0065,\n ID_IBM2 : 0x0066,\n ID_POSZIP : 0x4690,\n\n EF_ZIP64_OR_32 : 0xffffffff,\n EF_ZIP64_OR_16 : 0xffff,\n EF_ZIP64_SUNCOMP : 0,\n EF_ZIP64_SCOMP : 8,\n EF_ZIP64_RHO : 16,\n EF_ZIP64_DSN : 24\n};\n","module.exports = {\n /* Header error messages */\n INVALID_LOC: \"Invalid LOC header (bad signature)\",\n INVALID_CEN: \"Invalid CEN header (bad signature)\",\n INVALID_END: \"Invalid END header (bad signature)\",\n\n /* ZipEntry error messages*/\n NO_DATA: \"Nothing to decompress\",\n BAD_CRC: \"CRC32 checksum failed\",\n FILE_IN_THE_WAY: \"There is a file in the way: %s\",\n UNKNOWN_METHOD: \"Invalid/unsupported compression method\",\n\n /* Inflater error messages */\n AVAIL_DATA: \"inflate::Available inflate data did not terminate\",\n INVALID_DISTANCE: \"inflate::Invalid literal/length or distance code in fixed or dynamic block\",\n TO_MANY_CODES: \"inflate::Dynamic block code description: too many length or distance codes\",\n INVALID_REPEAT_LEN: \"inflate::Dynamic block code description: repeat more than specified lengths\",\n INVALID_REPEAT_FIRST: \"inflate::Dynamic block code description: repeat lengths with no first length\",\n INCOMPLETE_CODES: \"inflate::Dynamic block code description: code lengths codes incomplete\",\n INVALID_DYN_DISTANCE: \"inflate::Dynamic block code description: invalid distance code lengths\",\n INVALID_CODES_LEN: \"inflate::Dynamic block code description: invalid literal/length code lengths\",\n INVALID_STORE_BLOCK: \"inflate::Stored block length did not match one's complement\",\n INVALID_BLOCK_TYPE: \"inflate::Invalid block type (type == 3)\",\n\n /* ADM-ZIP error messages */\n CANT_EXTRACT_FILE: \"Could not extract the file\",\n CANT_OVERRIDE: \"Target file already exists\",\n NO_ZIP: \"No zip file was loaded\",\n NO_ENTRY: \"Entry doesn't exist\",\n DIRECTORY_CONTENT_ERROR: \"A directory cannot have content\",\n FILE_NOT_FOUND: \"File not found: %s\",\n NOT_IMPLEMENTED: \"Not implemented\",\n INVALID_FILENAME: \"Invalid filename\",\n INVALID_FORMAT: \"Invalid or unsupported zip format. No END header found\"\n};\n","const fs = require(\"./fileSystem\").require();\nconst pth = require(\"path\");\n\nfs.existsSync = fs.existsSync || pth.existsSync;\n\nmodule.exports = function (/*String*/ path) {\n var _path = path || \"\",\n _obj = newAttr(),\n _stat = null;\n\n function newAttr() {\n return {\n directory: false,\n readonly: false,\n hidden: false,\n executable: false,\n mtime: 0,\n atime: 0\n };\n }\n\n if (_path && fs.existsSync(_path)) {\n _stat = fs.statSync(_path);\n _obj.directory = _stat.isDirectory();\n _obj.mtime = _stat.mtime;\n _obj.atime = _stat.atime;\n _obj.executable = (0o111 & _stat.mode) !== 0; // file is executable who ever har right not just owner\n _obj.readonly = (0o200 & _stat.mode) === 0; // readonly if owner has no write right\n _obj.hidden = pth.basename(_path)[0] === \".\";\n } else {\n console.warn(\"Invalid path: \" + _path);\n }\n\n return {\n get directory() {\n return _obj.directory;\n },\n\n get readOnly() {\n return _obj.readonly;\n },\n\n get hidden() {\n return _obj.hidden;\n },\n\n get mtime() {\n return _obj.mtime;\n },\n\n get atime() {\n return _obj.atime;\n },\n\n get executable() {\n return _obj.executable;\n },\n\n decodeAttributes: function () {},\n\n encodeAttributes: function () {},\n\n toJSON: function () {\n return {\n path: _path,\n isDirectory: _obj.directory,\n isReadOnly: _obj.readonly,\n isHidden: _obj.hidden,\n isExecutable: _obj.executable,\n mTime: _obj.mtime,\n aTime: _obj.atime\n };\n },\n\n toString: function () {\n return JSON.stringify(this.toJSON(), null, \"\\t\");\n }\n };\n};\n","exports.require = function () {\n if (typeof process === \"object\" && process.versions && process.versions[\"electron\"]) {\n try {\n const originalFs = require(\"original-fs\");\n if (Object.keys(originalFs).length > 0) {\n return originalFs;\n }\n } catch (e) {}\n }\n return require(\"fs\");\n};\n","module.exports = require(\"./utils\");\nmodule.exports.Constants = require(\"./constants\");\nmodule.exports.Errors = require(\"./errors\");\nmodule.exports.FileAttr = require(\"./fattr\");\n","const fsystem = require(\"./fileSystem\").require();\nconst pth = require(\"path\");\nconst Constants = require(\"./constants\");\nconst isWin = typeof process === \"object\" && \"win32\" === process.platform;\n\nconst is_Obj = (obj) => obj && typeof obj === \"object\";\n\n// generate CRC32 lookup table\nconst crcTable = new Uint32Array(256).map((t, c) => {\n for (let k = 0; k < 8; k++) {\n if ((c & 1) !== 0) {\n c = 0xedb88320 ^ (c >>> 1);\n } else {\n c >>>= 1;\n }\n }\n return c >>> 0;\n});\n\n// UTILS functions\n\nfunction Utils(opts) {\n this.sep = pth.sep;\n this.fs = fsystem;\n\n if (is_Obj(opts)) {\n // custom filesystem\n if (is_Obj(opts.fs) && typeof opts.fs.statSync === \"function\") {\n this.fs = opts.fs;\n }\n }\n}\n\nmodule.exports = Utils;\n\n// INSTANCED functions\n\nUtils.prototype.makeDir = function (/*String*/ folder) {\n const self = this;\n\n // Sync - make directories tree\n function mkdirSync(/*String*/ fpath) {\n let resolvedPath = fpath.split(self.sep)[0];\n fpath.split(self.sep).forEach(function (name) {\n if (!name || name.substr(-1, 1) === \":\") return;\n resolvedPath += self.sep + name;\n var stat;\n try {\n stat = self.fs.statSync(resolvedPath);\n } catch (e) {\n self.fs.mkdirSync(resolvedPath);\n }\n if (stat && stat.isFile()) throw Errors.FILE_IN_THE_WAY.replace(\"%s\", resolvedPath);\n });\n }\n\n mkdirSync(folder);\n};\n\nUtils.prototype.writeFileTo = function (/*String*/ path, /*Buffer*/ content, /*Boolean*/ overwrite, /*Number*/ attr) {\n const self = this;\n if (self.fs.existsSync(path)) {\n if (!overwrite) return false; // cannot overwrite\n\n var stat = self.fs.statSync(path);\n if (stat.isDirectory()) {\n return false;\n }\n }\n var folder = pth.dirname(path);\n if (!self.fs.existsSync(folder)) {\n self.makeDir(folder);\n }\n\n var fd;\n try {\n fd = self.fs.openSync(path, \"w\", 438); // 0666\n } catch (e) {\n self.fs.chmodSync(path, 438);\n fd = self.fs.openSync(path, \"w\", 438);\n }\n if (fd) {\n try {\n self.fs.writeSync(fd, content, 0, content.length, 0);\n } finally {\n self.fs.closeSync(fd);\n }\n }\n self.fs.chmodSync(path, attr || 438);\n return true;\n};\n\nUtils.prototype.writeFileToAsync = function (/*String*/ path, /*Buffer*/ content, /*Boolean*/ overwrite, /*Number*/ attr, /*Function*/ callback) {\n if (typeof attr === \"function\") {\n callback = attr;\n attr = undefined;\n }\n\n const self = this;\n\n self.fs.exists(path, function (exist) {\n if (exist && !overwrite) return callback(false);\n\n self.fs.stat(path, function (err, stat) {\n if (exist && stat.isDirectory()) {\n return callback(false);\n }\n\n var folder = pth.dirname(path);\n self.fs.exists(folder, function (exists) {\n if (!exists) self.makeDir(folder);\n\n self.fs.open(path, \"w\", 438, function (err, fd) {\n if (err) {\n self.fs.chmod(path, 438, function () {\n self.fs.open(path, \"w\", 438, function (err, fd) {\n self.fs.write(fd, content, 0, content.length, 0, function () {\n self.fs.close(fd, function () {\n self.fs.chmod(path, attr || 438, function () {\n callback(true);\n });\n });\n });\n });\n });\n } else if (fd) {\n self.fs.write(fd, content, 0, content.length, 0, function () {\n self.fs.close(fd, function () {\n self.fs.chmod(path, attr || 438, function () {\n callback(true);\n });\n });\n });\n } else {\n self.fs.chmod(path, attr || 438, function () {\n callback(true);\n });\n }\n });\n });\n });\n });\n};\n\nUtils.prototype.findFiles = function (/*String*/ path) {\n const self = this;\n\n function findSync(/*String*/ dir, /*RegExp*/ pattern, /*Boolean*/ recursive) {\n if (typeof pattern === \"boolean\") {\n recursive = pattern;\n pattern = undefined;\n }\n let files = [];\n self.fs.readdirSync(dir).forEach(function (file) {\n var path = pth.join(dir, file);\n\n if (self.fs.statSync(path).isDirectory() && recursive) files = files.concat(findSync(path, pattern, recursive));\n\n if (!pattern || pattern.test(path)) {\n files.push(pth.normalize(path) + (self.fs.statSync(path).isDirectory() ? self.sep : \"\"));\n }\n });\n return files;\n }\n\n return findSync(path, undefined, true);\n};\n\nUtils.prototype.getAttributes = function () {};\n\nUtils.prototype.setAttributes = function () {};\n\n// STATIC functions\n\n// crc32 single update (it is part of crc32)\nUtils.crc32update = function (crc, byte) {\n return crcTable[(crc ^ byte) & 0xff] ^ (crc >>> 8);\n};\n\nUtils.crc32 = function (buf) {\n if (typeof buf === \"string\") {\n buf = Buffer.from(buf, \"utf8\");\n }\n // Generate crcTable\n if (!crcTable.length) genCRCTable();\n\n let len = buf.length;\n let crc = ~0;\n for (let off = 0; off < len; ) crc = Utils.crc32update(crc, buf[off++]);\n // xor and cast as uint32 number\n return ~crc >>> 0;\n};\n\nUtils.methodToString = function (/*Number*/ method) {\n switch (method) {\n case Constants.STORED:\n return \"STORED (\" + method + \")\";\n case Constants.DEFLATED:\n return \"DEFLATED (\" + method + \")\";\n default:\n return \"UNSUPPORTED (\" + method + \")\";\n }\n};\n\n// removes \"..\" style path elements\nUtils.canonical = function (/*string*/ path) {\n if (!path) return \"\";\n // trick normalize think path is absolute\n var safeSuffix = pth.posix.normalize(\"/\" + path.split(\"\\\\\").join(\"/\"));\n return pth.join(\".\", safeSuffix);\n};\n\n// make abolute paths taking prefix as root folder\nUtils.sanitize = function (/*string*/ prefix, /*string*/ name) {\n prefix = pth.resolve(pth.normalize(prefix));\n var parts = name.split(\"/\");\n for (var i = 0, l = parts.length; i < l; i++) {\n var path = pth.normalize(pth.join(prefix, parts.slice(i, l).join(pth.sep)));\n if (path.indexOf(prefix) === 0) {\n return path;\n }\n }\n return pth.normalize(pth.join(prefix, pth.basename(name)));\n};\n\n// converts buffer, Uint8Array, string types to buffer\nUtils.toBuffer = function toBuffer(/*buffer, Uint8Array, string*/ input) {\n if (Buffer.isBuffer(input)) {\n return input;\n } else if (input instanceof Uint8Array) {\n return Buffer.from(input);\n } else {\n // expect string all other values are invalid and return empty buffer\n return typeof input === \"string\" ? Buffer.from(input, \"utf8\") : Buffer.alloc(0);\n }\n};\n\nUtils.readBigUInt64LE = function (/*Buffer*/ buffer, /*int*/ index) {\n var slice = Buffer.from(buffer.slice(index, index + 8));\n slice.swap64();\n\n return parseInt(`0x${slice.toString(\"hex\")}`);\n};\n\nUtils.isWin = isWin; // Do we have windows system\nUtils.crcTable = crcTable;\n","var Utils = require(\"./util\"),\n Headers = require(\"./headers\"),\n Constants = Utils.Constants,\n Methods = require(\"./methods\");\n\nmodule.exports = function (/*Buffer*/ input) {\n var _entryHeader = new Headers.EntryHeader(),\n _entryName = Buffer.alloc(0),\n _comment = Buffer.alloc(0),\n _isDirectory = false,\n uncompressedData = null,\n _extra = Buffer.alloc(0);\n\n function getCompressedDataFromZip() {\n if (!input || !Buffer.isBuffer(input)) {\n return Buffer.alloc(0);\n }\n _entryHeader.loadDataHeaderFromBinary(input);\n return input.slice(_entryHeader.realDataOffset, _entryHeader.realDataOffset + _entryHeader.compressedSize);\n }\n\n function crc32OK(data) {\n // if bit 3 (0x08) of the general-purpose flags field is set, then the CRC-32 and file sizes are not known when the header is written\n if ((_entryHeader.flags & 0x8) !== 0x8) {\n if (Utils.crc32(data) !== _entryHeader.dataHeader.crc) {\n return false;\n }\n } else {\n // @TODO: load and check data descriptor header\n // The fields in the local header are filled with zero, and the CRC-32 and size are appended in a 12-byte structure\n // (optionally preceded by a 4-byte signature) immediately after the compressed data:\n }\n return true;\n }\n\n function decompress(/*Boolean*/ async, /*Function*/ callback, /*String, Buffer*/ pass) {\n if (typeof callback === \"undefined\" && typeof async === \"string\") {\n pass = async;\n async = void 0;\n }\n if (_isDirectory) {\n if (async && callback) {\n callback(Buffer.alloc(0), Utils.Errors.DIRECTORY_CONTENT_ERROR); //si added error.\n }\n return Buffer.alloc(0);\n }\n\n var compressedData = getCompressedDataFromZip();\n\n if (compressedData.length === 0) {\n // File is empty, nothing to decompress.\n if (async && callback) callback(compressedData);\n return compressedData;\n }\n\n if (_entryHeader.encripted) {\n if (\"string\" !== typeof pass && !Buffer.isBuffer(pass)) {\n throw new Error(\"ADM-ZIP: Incompatible password parameter\");\n }\n compressedData = Methods.ZipCrypto.decrypt(compressedData, _entryHeader, pass);\n }\n\n var data = Buffer.alloc(_entryHeader.size);\n\n switch (_entryHeader.method) {\n case Utils.Constants.STORED:\n compressedData.copy(data);\n if (!crc32OK(data)) {\n if (async && callback) callback(data, Utils.Errors.BAD_CRC); //si added error\n throw new Error(Utils.Errors.BAD_CRC);\n } else {\n //si added otherwise did not seem to return data.\n if (async && callback) callback(data);\n return data;\n }\n case Utils.Constants.DEFLATED:\n var inflater = new Methods.Inflater(compressedData);\n if (!async) {\n const result = inflater.inflate(data);\n result.copy(data, 0);\n if (!crc32OK(data)) {\n throw new Error(Utils.Errors.BAD_CRC + \" \" + _entryName.toString());\n }\n return data;\n } else {\n inflater.inflateAsync(function (result) {\n result.copy(result, 0);\n if (callback) {\n if (!crc32OK(result)) {\n callback(result, Utils.Errors.BAD_CRC); //si added error\n } else {\n callback(result);\n }\n }\n });\n }\n break;\n default:\n if (async && callback) callback(Buffer.alloc(0), Utils.Errors.UNKNOWN_METHOD);\n throw new Error(Utils.Errors.UNKNOWN_METHOD);\n }\n }\n\n function compress(/*Boolean*/ async, /*Function*/ callback) {\n if ((!uncompressedData || !uncompressedData.length) && Buffer.isBuffer(input)) {\n // no data set or the data wasn't changed to require recompression\n if (async && callback) callback(getCompressedDataFromZip());\n return getCompressedDataFromZip();\n }\n\n if (uncompressedData.length && !_isDirectory) {\n var compressedData;\n // Local file header\n switch (_entryHeader.method) {\n case Utils.Constants.STORED:\n _entryHeader.compressedSize = _entryHeader.size;\n\n compressedData = Buffer.alloc(uncompressedData.length);\n uncompressedData.copy(compressedData);\n\n if (async && callback) callback(compressedData);\n return compressedData;\n default:\n case Utils.Constants.DEFLATED:\n var deflater = new Methods.Deflater(uncompressedData);\n if (!async) {\n var deflated = deflater.deflate();\n _entryHeader.compressedSize = deflated.length;\n return deflated;\n } else {\n deflater.deflateAsync(function (data) {\n compressedData = Buffer.alloc(data.length);\n _entryHeader.compressedSize = data.length;\n data.copy(compressedData);\n callback && callback(compressedData);\n });\n }\n deflater = null;\n break;\n }\n } else if (async && callback) {\n callback(Buffer.alloc(0));\n } else {\n return Buffer.alloc(0);\n }\n }\n\n function readUInt64LE(buffer, offset) {\n return (buffer.readUInt32LE(offset + 4) << 4) + buffer.readUInt32LE(offset);\n }\n\n function parseExtra(data) {\n var offset = 0;\n var signature, size, part;\n while (offset < data.length) {\n signature = data.readUInt16LE(offset);\n offset += 2;\n size = data.readUInt16LE(offset);\n offset += 2;\n part = data.slice(offset, offset + size);\n offset += size;\n if (Constants.ID_ZIP64 === signature) {\n parseZip64ExtendedInformation(part);\n }\n }\n }\n\n //Override header field values with values from the ZIP64 extra field\n function parseZip64ExtendedInformation(data) {\n var size, compressedSize, offset, diskNumStart;\n\n if (data.length >= Constants.EF_ZIP64_SCOMP) {\n size = readUInt64LE(data, Constants.EF_ZIP64_SUNCOMP);\n if (_entryHeader.size === Constants.EF_ZIP64_OR_32) {\n _entryHeader.size = size;\n }\n }\n if (data.length >= Constants.EF_ZIP64_RHO) {\n compressedSize = readUInt64LE(data, Constants.EF_ZIP64_SCOMP);\n if (_entryHeader.compressedSize === Constants.EF_ZIP64_OR_32) {\n _entryHeader.compressedSize = compressedSize;\n }\n }\n if (data.length >= Constants.EF_ZIP64_DSN) {\n offset = readUInt64LE(data, Constants.EF_ZIP64_RHO);\n if (_entryHeader.offset === Constants.EF_ZIP64_OR_32) {\n _entryHeader.offset = offset;\n }\n }\n if (data.length >= Constants.EF_ZIP64_DSN + 4) {\n diskNumStart = data.readUInt32LE(Constants.EF_ZIP64_DSN);\n if (_entryHeader.diskNumStart === Constants.EF_ZIP64_OR_16) {\n _entryHeader.diskNumStart = diskNumStart;\n }\n }\n }\n\n return {\n get entryName() {\n return _entryName.toString();\n },\n get rawEntryName() {\n return _entryName;\n },\n set entryName(val) {\n _entryName = Utils.toBuffer(val);\n var lastChar = _entryName[_entryName.length - 1];\n _isDirectory = lastChar === 47 || lastChar === 92;\n _entryHeader.fileNameLength = _entryName.length;\n },\n\n get extra() {\n return _extra;\n },\n set extra(val) {\n _extra = val;\n _entryHeader.extraLength = val.length;\n parseExtra(val);\n },\n\n get comment() {\n return _comment.toString();\n },\n set comment(val) {\n _comment = Utils.toBuffer(val);\n _entryHeader.commentLength = _comment.length;\n },\n\n get name() {\n var n = _entryName.toString();\n return _isDirectory\n ? n\n .substr(n.length - 1)\n .split(\"/\")\n .pop()\n : n.split(\"/\").pop();\n },\n get isDirectory() {\n return _isDirectory;\n },\n\n getCompressedData: function () {\n return compress(false, null);\n },\n\n getCompressedDataAsync: function (/*Function*/ callback) {\n compress(true, callback);\n },\n\n setData: function (value) {\n uncompressedData = Utils.toBuffer(value);\n if (!_isDirectory && uncompressedData.length) {\n _entryHeader.size = uncompressedData.length;\n _entryHeader.method = Utils.Constants.DEFLATED;\n _entryHeader.crc = Utils.crc32(value);\n _entryHeader.changed = true;\n } else {\n // folders and blank files should be stored\n _entryHeader.method = Utils.Constants.STORED;\n }\n },\n\n getData: function (pass) {\n if (_entryHeader.changed) {\n return uncompressedData;\n } else {\n return decompress(false, null, pass);\n }\n },\n\n getDataAsync: function (/*Function*/ callback, pass) {\n if (_entryHeader.changed) {\n callback(uncompressedData);\n } else {\n decompress(true, callback, pass);\n }\n },\n\n set attr(attr) {\n _entryHeader.attr = attr;\n },\n get attr() {\n return _entryHeader.attr;\n },\n\n set header(/*Buffer*/ data) {\n _entryHeader.loadFromBinary(data);\n },\n\n get header() {\n return _entryHeader;\n },\n\n packHeader: function () {\n // 1. create header (buffer)\n var header = _entryHeader.entryHeaderToBinary();\n var addpos = Utils.Constants.CENHDR;\n // 2. add file name\n _entryName.copy(header, addpos);\n addpos += _entryName.length;\n // 3. add extra data\n if (_entryHeader.extraLength) {\n _extra.copy(header, addpos);\n addpos += _entryHeader.extraLength;\n }\n // 4. add file comment\n if (_entryHeader.commentLength) {\n _comment.copy(header, addpos);\n }\n return header;\n },\n\n toJSON: function () {\n const bytes = function (nr) {\n return \"<\" + ((nr && nr.length + \" bytes buffer\") || \"null\") + \">\";\n };\n\n return {\n entryName: this.entryName,\n name: this.name,\n comment: this.comment,\n isDirectory: this.isDirectory,\n header: _entryHeader.toJSON(),\n compressedData: bytes(input),\n data: bytes(uncompressedData)\n };\n },\n\n toString: function () {\n return JSON.stringify(this.toJSON(), null, \"\\t\");\n }\n };\n};\n","const ZipEntry = require(\"./zipEntry\");\nconst Headers = require(\"./headers\");\nconst Utils = require(\"./util\");\n\nmodule.exports = function (/*Buffer|null*/ inBuffer, /** object */ options) {\n var entryList = [],\n entryTable = {},\n _comment = Buffer.alloc(0),\n mainHeader = new Headers.MainHeader(),\n loadedEntries = false;\n\n // assign options\n const opts = Object.assign(Object.create(null), options);\n\n const { noSort } = opts;\n\n if (inBuffer) {\n // is a memory buffer\n readMainHeader(opts.readEntries);\n } else {\n // none. is a new file\n loadedEntries = true;\n }\n\n function iterateEntries(callback) {\n const totalEntries = mainHeader.diskEntries; // total number of entries\n let index = mainHeader.offset; // offset of first CEN header\n\n for (let i = 0; i < totalEntries; i++) {\n let tmp = index;\n const entry = new ZipEntry(inBuffer);\n\n entry.header = inBuffer.slice(tmp, (tmp += Utils.Constants.CENHDR));\n entry.entryName = inBuffer.slice(tmp, (tmp += entry.header.fileNameLength));\n\n index += entry.header.entryHeaderSize;\n\n callback(entry);\n }\n }\n\n function readEntries() {\n loadedEntries = true;\n entryTable = {};\n entryList = new Array(mainHeader.diskEntries); // total number of entries\n var index = mainHeader.offset; // offset of first CEN header\n for (var i = 0; i < entryList.length; i++) {\n var tmp = index,\n entry = new ZipEntry(inBuffer);\n entry.header = inBuffer.slice(tmp, (tmp += Utils.Constants.CENHDR));\n\n entry.entryName = inBuffer.slice(tmp, (tmp += entry.header.fileNameLength));\n\n if (entry.header.extraLength) {\n entry.extra = inBuffer.slice(tmp, (tmp += entry.header.extraLength));\n }\n\n if (entry.header.commentLength) entry.comment = inBuffer.slice(tmp, tmp + entry.header.commentLength);\n\n index += entry.header.entryHeaderSize;\n\n entryList[i] = entry;\n entryTable[entry.entryName] = entry;\n }\n }\n\n function readMainHeader(/*Boolean*/ readNow) {\n var i = inBuffer.length - Utils.Constants.ENDHDR, // END header size\n max = Math.max(0, i - 0xffff), // 0xFFFF is the max zip file comment length\n n = max,\n endStart = inBuffer.length,\n endOffset = -1, // Start offset of the END header\n commentEnd = 0;\n\n for (i; i >= n; i--) {\n if (inBuffer[i] !== 0x50) continue; // quick check that the byte is 'P'\n if (inBuffer.readUInt32LE(i) === Utils.Constants.ENDSIG) {\n // \"PK\\005\\006\"\n endOffset = i;\n commentEnd = i;\n endStart = i + Utils.Constants.ENDHDR;\n // We already found a regular signature, let's look just a bit further to check if there's any zip64 signature\n n = i - Utils.Constants.END64HDR;\n continue;\n }\n\n if (inBuffer.readUInt32LE(i) === Utils.Constants.END64SIG) {\n // Found a zip64 signature, let's continue reading the whole zip64 record\n n = max;\n continue;\n }\n\n if (inBuffer.readUInt32LE(i) === Utils.Constants.ZIP64SIG) {\n // Found the zip64 record, let's determine it's size\n endOffset = i;\n endStart = i + Utils.readBigUInt64LE(inBuffer, i + Utils.Constants.ZIP64SIZE) + Utils.Constants.ZIP64LEAD;\n break;\n }\n }\n\n if (!~endOffset) throw new Error(Utils.Errors.INVALID_FORMAT);\n\n mainHeader.loadFromBinary(inBuffer.slice(endOffset, endStart));\n if (mainHeader.commentLength) {\n _comment = inBuffer.slice(commentEnd + Utils.Constants.ENDHDR);\n }\n if (readNow) readEntries();\n }\n\n function sortEntries() {\n if (entryList.length > 1 && !noSort) {\n entryList.sort((a, b) => a.entryName.toLowerCase().localeCompare(b.entryName.toLowerCase()));\n }\n }\n\n return {\n /**\n * Returns an array of ZipEntry objects existent in the current opened archive\n * @return Array\n */\n get entries() {\n if (!loadedEntries) {\n readEntries();\n }\n return entryList;\n },\n\n /**\n * Archive comment\n * @return {String}\n */\n get comment() {\n return _comment.toString();\n },\n set comment(val) {\n _comment = Utils.toBuffer(val);\n mainHeader.commentLength = _comment.length;\n },\n\n getEntryCount: function () {\n if (!loadedEntries) {\n return mainHeader.diskEntries;\n }\n\n return entryList.length;\n },\n\n forEach: function (callback) {\n if (!loadedEntries) {\n iterateEntries(callback);\n return;\n }\n\n entryList.forEach(callback);\n },\n\n /**\n * Returns a reference to the entry with the given name or null if entry is inexistent\n *\n * @param entryName\n * @return ZipEntry\n */\n getEntry: function (/*String*/ entryName) {\n if (!loadedEntries) {\n readEntries();\n }\n return entryTable[entryName] || null;\n },\n\n /**\n * Adds the given entry to the entry list\n *\n * @param entry\n */\n setEntry: function (/*ZipEntry*/ entry) {\n if (!loadedEntries) {\n readEntries();\n }\n entryList.push(entry);\n entryTable[entry.entryName] = entry;\n mainHeader.totalEntries = entryList.length;\n },\n\n /**\n * Removes the entry with the given name from the entry list.\n *\n * If the entry is a directory, then all nested files and directories will be removed\n * @param entryName\n */\n deleteEntry: function (/*String*/ entryName) {\n if (!loadedEntries) {\n readEntries();\n }\n var entry = entryTable[entryName];\n if (entry && entry.isDirectory) {\n var _self = this;\n this.getEntryChildren(entry).forEach(function (child) {\n if (child.entryName !== entryName) {\n _self.deleteEntry(child.entryName);\n }\n });\n }\n entryList.splice(entryList.indexOf(entry), 1);\n delete entryTable[entryName];\n mainHeader.totalEntries = entryList.length;\n },\n\n /**\n * Iterates and returns all nested files and directories of the given entry\n *\n * @param entry\n * @return Array\n */\n getEntryChildren: function (/*ZipEntry*/ entry) {\n if (!loadedEntries) {\n readEntries();\n }\n if (entry && entry.isDirectory) {\n const list = [];\n const name = entry.entryName;\n const len = name.length;\n\n entryList.forEach(function (zipEntry) {\n if (zipEntry.entryName.substr(0, len) === name) {\n list.push(zipEntry);\n }\n });\n return list;\n }\n return [];\n },\n\n /**\n * Returns the zip file\n *\n * @return Buffer\n */\n compressToBuffer: function () {\n if (!loadedEntries) {\n readEntries();\n }\n sortEntries();\n\n const dataBlock = [];\n const entryHeaders = [];\n let totalSize = 0;\n let dindex = 0;\n\n mainHeader.size = 0;\n mainHeader.offset = 0;\n\n for (const entry of entryList) {\n // compress data and set local and entry header accordingly. Reason why is called first\n const compressedData = entry.getCompressedData();\n // 1. construct data header\n entry.header.offset = dindex;\n const dataHeader = entry.header.dataHeaderToBinary();\n const entryNameLen = entry.rawEntryName.length;\n // 1.2. postheader - data after data header\n const postHeader = Buffer.alloc(entryNameLen + entry.extra.length);\n entry.rawEntryName.copy(postHeader, 0);\n postHeader.copy(entry.extra, entryNameLen);\n\n // 2. offsets\n const dataLength = dataHeader.length + postHeader.length + compressedData.length;\n dindex += dataLength;\n\n // 3. store values in sequence\n dataBlock.push(dataHeader);\n dataBlock.push(postHeader);\n dataBlock.push(compressedData);\n\n // 4. construct entry header\n const entryHeader = entry.packHeader();\n entryHeaders.push(entryHeader);\n // 5. update main header\n mainHeader.size += entryHeader.length;\n totalSize += dataLength + entryHeader.length;\n }\n\n totalSize += mainHeader.mainHeaderSize; // also includes zip file comment length\n // point to end of data and beginning of central directory first record\n mainHeader.offset = dindex;\n\n dindex = 0;\n const outBuffer = Buffer.alloc(totalSize);\n // write data blocks\n for (const content of dataBlock) {\n content.copy(outBuffer, dindex);\n dindex += content.length;\n }\n\n // write central directory entries\n for (const content of entryHeaders) {\n content.copy(outBuffer, dindex);\n dindex += content.length;\n }\n\n // write main header\n const mh = mainHeader.toBinary();\n if (_comment) {\n _comment.copy(mh, Utils.Constants.ENDHDR); // add zip file comment\n }\n mh.copy(outBuffer, dindex);\n\n return outBuffer;\n },\n\n toAsyncBuffer: function (/*Function*/ onSuccess, /*Function*/ onFail, /*Function*/ onItemStart, /*Function*/ onItemEnd) {\n try {\n if (!loadedEntries) {\n readEntries();\n }\n sortEntries();\n\n const dataBlock = [];\n const entryHeaders = [];\n let totalSize = 0;\n let dindex = 0;\n\n mainHeader.size = 0;\n mainHeader.offset = 0;\n\n const compress2Buffer = function (entryLists) {\n if (entryLists.length) {\n const entry = entryLists.pop();\n const name = entry.entryName + entry.extra.toString();\n if (onItemStart) onItemStart(name);\n entry.getCompressedDataAsync(function (compressedData) {\n if (onItemEnd) onItemEnd(name);\n\n entry.header.offset = dindex;\n // data header\n const dataHeader = entry.header.dataHeaderToBinary();\n const postHeader = Buffer.alloc(name.length, name);\n const dataLength = dataHeader.length + postHeader.length + compressedData.length;\n\n dindex += dataLength;\n\n dataBlock.push(dataHeader);\n dataBlock.push(postHeader);\n dataBlock.push(compressedData);\n\n const entryHeader = entry.packHeader();\n entryHeaders.push(entryHeader);\n mainHeader.size += entryHeader.length;\n totalSize += dataLength + entryHeader.length;\n\n compress2Buffer(entryLists);\n });\n } else {\n totalSize += mainHeader.mainHeaderSize; // also includes zip file comment length\n // point to end of data and beginning of central directory first record\n mainHeader.offset = dindex;\n\n dindex = 0;\n const outBuffer = Buffer.alloc(totalSize);\n dataBlock.forEach(function (content) {\n content.copy(outBuffer, dindex); // write data blocks\n dindex += content.length;\n });\n entryHeaders.forEach(function (content) {\n content.copy(outBuffer, dindex); // write central directory entries\n dindex += content.length;\n });\n\n const mh = mainHeader.toBinary();\n if (_comment) {\n _comment.copy(mh, Utils.Constants.ENDHDR); // add zip file comment\n }\n\n mh.copy(outBuffer, dindex); // write main header\n\n onSuccess(outBuffer);\n }\n };\n\n compress2Buffer(entryList);\n } catch (e) {\n onFail(e);\n }\n }\n };\n};\n","'use strict';\n\nvar possibleNames = [\n\t'BigInt64Array',\n\t'BigUint64Array',\n\t'Float32Array',\n\t'Float64Array',\n\t'Int16Array',\n\t'Int32Array',\n\t'Int8Array',\n\t'Uint16Array',\n\t'Uint32Array',\n\t'Uint8Array',\n\t'Uint8ClampedArray'\n];\n\nvar g = typeof globalThis === 'undefined' ? global : globalThis;\n\nmodule.exports = function availableTypedArrays() {\n\tvar out = [];\n\tfor (var i = 0; i < possibleNames.length; i++) {\n\t\tif (typeof g[possibleNames[i]] === 'function') {\n\t\t\tout[out.length] = possibleNames[i];\n\t\t}\n\t}\n\treturn out;\n};\n","'use strict';\n\nvar GetIntrinsic = require('get-intrinsic');\n\nvar callBind = require('./');\n\nvar $indexOf = callBind(GetIntrinsic('String.prototype.indexOf'));\n\nmodule.exports = function callBoundIntrinsic(name, allowMissing) {\n\tvar intrinsic = GetIntrinsic(name, !!allowMissing);\n\tif (typeof intrinsic === 'function' && $indexOf(name, '.prototype.') > -1) {\n\t\treturn callBind(intrinsic);\n\t}\n\treturn intrinsic;\n};\n","'use strict';\n\nvar bind = require('function-bind');\nvar GetIntrinsic = require('get-intrinsic');\n\nvar $apply = GetIntrinsic('%Function.prototype.apply%');\nvar $call = GetIntrinsic('%Function.prototype.call%');\nvar $reflectApply = GetIntrinsic('%Reflect.apply%', true) || bind.call($call, $apply);\n\nvar $gOPD = GetIntrinsic('%Object.getOwnPropertyDescriptor%', true);\nvar $defineProperty = GetIntrinsic('%Object.defineProperty%', true);\nvar $max = GetIntrinsic('%Math.max%');\n\nif ($defineProperty) {\n\ttry {\n\t\t$defineProperty({}, 'a', { value: 1 });\n\t} catch (e) {\n\t\t// IE 8 has a broken defineProperty\n\t\t$defineProperty = null;\n\t}\n}\n\nmodule.exports = function callBind(originalFunction) {\n\tvar func = $reflectApply(bind, $call, arguments);\n\tif ($gOPD && $defineProperty) {\n\t\tvar desc = $gOPD(func, 'length');\n\t\tif (desc.configurable) {\n\t\t\t// original length, plus the receiver, minus any additional arguments (after the receiver)\n\t\t\t$defineProperty(\n\t\t\t\tfunc,\n\t\t\t\t'length',\n\t\t\t\t{ value: 1 + $max(0, originalFunction.length - (arguments.length - 1)) }\n\t\t\t);\n\t\t}\n\t}\n\treturn func;\n};\n\nvar applyBind = function applyBind() {\n\treturn $reflectApply(bind, $apply, arguments);\n};\n\nif ($defineProperty) {\n\t$defineProperty(module.exports, 'apply', { value: applyBind });\n} else {\n\tmodule.exports.apply = applyBind;\n}\n","var charenc = {\n // UTF-8 encoding\n utf8: {\n // Convert a string to a byte array\n stringToBytes: function(str) {\n return charenc.bin.stringToBytes(unescape(encodeURIComponent(str)));\n },\n\n // Convert a byte array to a string\n bytesToString: function(bytes) {\n return decodeURIComponent(escape(charenc.bin.bytesToString(bytes)));\n }\n },\n\n // Binary encoding\n bin: {\n // Convert a string to a byte array\n stringToBytes: function(str) {\n for (var bytes = [], i = 0; i < str.length; i++)\n bytes.push(str.charCodeAt(i) & 0xFF);\n return bytes;\n },\n\n // Convert a byte array to a string\n bytesToString: function(bytes) {\n for (var str = [], i = 0; i < bytes.length; i++)\n str.push(String.fromCharCode(bytes[i]));\n return str.join('');\n }\n }\n};\n\nmodule.exports = charenc;\n","(function() {\n var base64map\n = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/',\n\n crypt = {\n // Bit-wise rotation left\n rotl: function(n, b) {\n return (n << b) | (n >>> (32 - b));\n },\n\n // Bit-wise rotation right\n rotr: function(n, b) {\n return (n << (32 - b)) | (n >>> b);\n },\n\n // Swap big-endian to little-endian and vice versa\n endian: function(n) {\n // If number given, swap endian\n if (n.constructor == Number) {\n return crypt.rotl(n, 8) & 0x00FF00FF | crypt.rotl(n, 24) & 0xFF00FF00;\n }\n\n // Else, assume array and swap all items\n for (var i = 0; i < n.length; i++)\n n[i] = crypt.endian(n[i]);\n return n;\n },\n\n // Generate an array of any length of random bytes\n randomBytes: function(n) {\n for (var bytes = []; n > 0; n--)\n bytes.push(Math.floor(Math.random() * 256));\n return bytes;\n },\n\n // Convert a byte array to big-endian 32-bit words\n bytesToWords: function(bytes) {\n for (var words = [], i = 0, b = 0; i < bytes.length; i++, b += 8)\n words[b >>> 5] |= bytes[i] << (24 - b % 32);\n return words;\n },\n\n // Convert big-endian 32-bit words to a byte array\n wordsToBytes: function(words) {\n for (var bytes = [], b = 0; b < words.length * 32; b += 8)\n bytes.push((words[b >>> 5] >>> (24 - b % 32)) & 0xFF);\n return bytes;\n },\n\n // Convert a byte array to a hex string\n bytesToHex: function(bytes) {\n for (var hex = [], i = 0; i < bytes.length; i++) {\n hex.push((bytes[i] >>> 4).toString(16));\n hex.push((bytes[i] & 0xF).toString(16));\n }\n return hex.join('');\n },\n\n // Convert a hex string to a byte array\n hexToBytes: function(hex) {\n for (var bytes = [], c = 0; c < hex.length; c += 2)\n bytes.push(parseInt(hex.substr(c, 2), 16));\n return bytes;\n },\n\n // Convert a byte array to a base-64 string\n bytesToBase64: function(bytes) {\n for (var base64 = [], i = 0; i < bytes.length; i += 3) {\n var triplet = (bytes[i] << 16) | (bytes[i + 1] << 8) | bytes[i + 2];\n for (var j = 0; j < 4; j++)\n if (i * 8 + j * 6 <= bytes.length * 8)\n base64.push(base64map.charAt((triplet >>> 6 * (3 - j)) & 0x3F));\n else\n base64.push('=');\n }\n return base64.join('');\n },\n\n // Convert a base-64 string to a byte array\n base64ToBytes: function(base64) {\n // Remove non-base-64 characters\n base64 = base64.replace(/[^A-Z0-9+\\/]/ig, '');\n\n for (var bytes = [], i = 0, imod4 = 0; i < base64.length;\n imod4 = ++i % 4) {\n if (imod4 == 0) continue;\n bytes.push(((base64map.indexOf(base64.charAt(i - 1))\n & (Math.pow(2, -2 * imod4 + 8) - 1)) << (imod4 * 2))\n | (base64map.indexOf(base64.charAt(i)) >>> (6 - imod4 * 2)));\n }\n return bytes;\n }\n };\n\n module.exports = crypt;\n})();\n","\n\nclass ResizeableBuffer{\n constructor(size=100){\n this.size = size\n this.length = 0\n this.buf = Buffer.alloc(size)\n }\n prepend(val){\n if(Buffer.isBuffer(val)){\n const length = this.length + val.length\n if(length >= this.size){\n this.resize()\n if(length >= this.size){\n throw Error('INVALID_BUFFER_STATE')\n }\n }\n const buf = this.buf\n this.buf = Buffer.alloc(this.size)\n val.copy(this.buf, 0)\n buf.copy(this.buf, val.length)\n this.length += val.length\n }else{\n const length = this.length++\n if(length === this.size){\n this.resize()\n }\n const buf = this.clone()\n this.buf[0] = val\n buf.copy(this.buf,1, 0, length)\n }\n }\n append(val){\n const length = this.length++\n if(length === this.size){\n this.resize()\n }\n this.buf[length] = val\n }\n clone(){\n return Buffer.from(this.buf.slice(0, this.length))\n }\n resize(){\n const length = this.length\n this.size = this.size * 2\n const buf = Buffer.alloc(this.size)\n this.buf.copy(buf,0, 0, length)\n this.buf = buf\n }\n toString(encoding){\n if(encoding){\n return this.buf.slice(0, this.length).toString(encoding)\n }else{\n return Uint8Array.prototype.slice.call(this.buf.slice(0, this.length))\n }\n }\n toJSON(){\n return this.toString('utf8')\n }\n reset(){\n this.length = 0\n }\n}\n\nmodule.exports = ResizeableBuffer\n","\n/*\nCSV Parse\n\nPlease look at the [project documentation](https://csv.js.org/parse/) for\nadditional information.\n*/\n\nconst { Transform } = require('stream')\nconst ResizeableBuffer = require('./ResizeableBuffer')\n\n// white space characters\n// https://en.wikipedia.org/wiki/Whitespace_character\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions/Character_Classes#Types\n// \\f\\n\\r\\t\\v\\u00a0\\u1680\\u2000-\\u200a\\u2028\\u2029\\u202f\\u205f\\u3000\\ufeff\nconst tab = 9\nconst nl = 10 // \\n, 0x0A in hexadecimal, 10 in decimal\nconst np = 12\nconst cr = 13 // \\r, 0x0D in hexadécimal, 13 in decimal\nconst space = 32\nconst boms = {\n // Note, the following are equals:\n // Buffer.from(\"\\ufeff\")\n // Buffer.from([239, 187, 191])\n // Buffer.from('EFBBBF', 'hex')\n 'utf8': Buffer.from([239, 187, 191]),\n // Note, the following are equals:\n // Buffer.from \"\\ufeff\", 'utf16le\n // Buffer.from([255, 254])\n 'utf16le': Buffer.from([255, 254])\n}\n\nclass Parser extends Transform {\n constructor(opts = {}){\n super({...{readableObjectMode: true}, ...opts, encoding: null})\n this.__originalOptions = opts\n this.__normalizeOptions(opts)\n }\n __normalizeOptions(opts){\n const options = {}\n // Merge with user options\n for(let opt in opts){\n options[underscore(opt)] = opts[opt]\n }\n // Normalize option `encoding`\n // Note: defined first because other options depends on it\n // to convert chars/strings into buffers.\n if(options.encoding === undefined || options.encoding === true){\n options.encoding = 'utf8'\n }else if(options.encoding === null || options.encoding === false){\n options.encoding = null\n }else if(typeof options.encoding !== 'string' && options.encoding !== null){\n throw new CsvError('CSV_INVALID_OPTION_ENCODING', [\n 'Invalid option encoding:',\n 'encoding must be a string or null to return a buffer,',\n `got ${JSON.stringify(options.encoding)}`\n ], options)\n }\n // Normalize option `bom`\n if(options.bom === undefined || options.bom === null || options.bom === false){\n options.bom = false\n }else if(options.bom !== true){\n throw new CsvError('CSV_INVALID_OPTION_BOM', [\n 'Invalid option bom:', 'bom must be true,',\n `got ${JSON.stringify(options.bom)}`\n ], options)\n }\n // Normalize option `cast`\n let fnCastField = null\n if(options.cast === undefined || options.cast === null || options.cast === false || options.cast === ''){\n options.cast = undefined\n }else if(typeof options.cast === 'function'){\n fnCastField = options.cast\n options.cast = true\n }else if(options.cast !== true){\n throw new CsvError('CSV_INVALID_OPTION_CAST', [\n 'Invalid option cast:', 'cast must be true or a function,',\n `got ${JSON.stringify(options.cast)}`\n ], options)\n }\n // Normalize option `cast_date`\n if(options.cast_date === undefined || options.cast_date === null || options.cast_date === false || options.cast_date === ''){\n options.cast_date = false\n }else if(options.cast_date === true){\n options.cast_date = function(value){\n const date = Date.parse(value)\n return !isNaN(date) ? new Date(date) : value\n }\n }else{\n throw new CsvError('CSV_INVALID_OPTION_CAST_DATE', [\n 'Invalid option cast_date:', 'cast_date must be true or a function,',\n `got ${JSON.stringify(options.cast_date)}`\n ], options)\n }\n // Normalize option `columns`\n let fnFirstLineToHeaders = null\n if(options.columns === true){\n // Fields in the first line are converted as-is to columns\n fnFirstLineToHeaders = undefined\n }else if(typeof options.columns === 'function'){\n fnFirstLineToHeaders = options.columns\n options.columns = true\n }else if(Array.isArray(options.columns)){\n options.columns = normalizeColumnsArray(options.columns)\n }else if(options.columns === undefined || options.columns === null || options.columns === false){\n options.columns = false\n }else{\n throw new CsvError('CSV_INVALID_OPTION_COLUMNS', [\n 'Invalid option columns:',\n 'expect an array, a function or true,',\n `got ${JSON.stringify(options.columns)}`\n ], options)\n }\n // Normalize option `columns_duplicates_to_array`\n if(options.columns_duplicates_to_array === undefined || options.columns_duplicates_to_array === null || options.columns_duplicates_to_array === false){\n options.columns_duplicates_to_array = false\n }else if(options.columns_duplicates_to_array !== true){\n throw new CsvError('CSV_INVALID_OPTION_COLUMNS_DUPLICATES_TO_ARRAY', [\n 'Invalid option columns_duplicates_to_array:',\n 'expect an boolean,',\n `got ${JSON.stringify(options.columns_duplicates_to_array)}`\n ], options)\n }else if(options.columns === false){\n throw new CsvError('CSV_INVALID_OPTION_COLUMNS_DUPLICATES_TO_ARRAY', [\n 'Invalid option columns_duplicates_to_array:',\n 'the `columns` mode must be activated.'\n ], options)\n }\n // Normalize option `comment`\n if(options.comment === undefined || options.comment === null || options.comment === false || options.comment === ''){\n options.comment = null\n }else{\n if(typeof options.comment === 'string'){\n options.comment = Buffer.from(options.comment, options.encoding)\n }\n if(!Buffer.isBuffer(options.comment)){\n throw new CsvError('CSV_INVALID_OPTION_COMMENT', [\n 'Invalid option comment:',\n 'comment must be a buffer or a string,',\n `got ${JSON.stringify(options.comment)}`\n ], options)\n }\n }\n // Normalize option `delimiter`\n const delimiter_json = JSON.stringify(options.delimiter)\n if(!Array.isArray(options.delimiter)) options.delimiter = [options.delimiter]\n if(options.delimiter.length === 0){\n throw new CsvError('CSV_INVALID_OPTION_DELIMITER', [\n 'Invalid option delimiter:',\n 'delimiter must be a non empty string or buffer or array of string|buffer,',\n `got ${delimiter_json}`\n ], options)\n }\n options.delimiter = options.delimiter.map(function(delimiter){\n if(delimiter === undefined || delimiter === null || delimiter === false){\n return Buffer.from(',', options.encoding)\n }\n if(typeof delimiter === 'string'){\n delimiter = Buffer.from(delimiter, options.encoding)\n }\n if( !Buffer.isBuffer(delimiter) || delimiter.length === 0){\n throw new CsvError('CSV_INVALID_OPTION_DELIMITER', [\n 'Invalid option delimiter:',\n 'delimiter must be a non empty string or buffer or array of string|buffer,',\n `got ${delimiter_json}`\n ], options)\n }\n return delimiter\n })\n // Normalize option `escape`\n if(options.escape === undefined || options.escape === true){\n options.escape = Buffer.from('\"', options.encoding)\n }else if(typeof options.escape === 'string'){\n options.escape = Buffer.from(options.escape, options.encoding)\n }else if (options.escape === null || options.escape === false){\n options.escape = null\n }\n if(options.escape !== null){\n if(!Buffer.isBuffer(options.escape)){\n throw new Error(`Invalid Option: escape must be a buffer, a string or a boolean, got ${JSON.stringify(options.escape)}`)\n }\n }\n // Normalize option `from`\n if(options.from === undefined || options.from === null){\n options.from = 1\n }else{\n if(typeof options.from === 'string' && /\\d+/.test(options.from)){\n options.from = parseInt(options.from)\n }\n if(Number.isInteger(options.from)){\n if(options.from < 0){\n throw new Error(`Invalid Option: from must be a positive integer, got ${JSON.stringify(opts.from)}`)\n }\n }else{\n throw new Error(`Invalid Option: from must be an integer, got ${JSON.stringify(options.from)}`)\n }\n }\n // Normalize option `from_line`\n if(options.from_line === undefined || options.from_line === null){\n options.from_line = 1\n }else{\n if(typeof options.from_line === 'string' && /\\d+/.test(options.from_line)){\n options.from_line = parseInt(options.from_line)\n }\n if(Number.isInteger(options.from_line)){\n if(options.from_line <= 0){\n throw new Error(`Invalid Option: from_line must be a positive integer greater than 0, got ${JSON.stringify(opts.from_line)}`)\n }\n }else{\n throw new Error(`Invalid Option: from_line must be an integer, got ${JSON.stringify(opts.from_line)}`)\n }\n }\n // Normalize options `ignore_last_delimiters`\n if(options.ignore_last_delimiters === undefined || options.ignore_last_delimiters === null){\n options.ignore_last_delimiters = false\n }else if(typeof options.ignore_last_delimiters === 'number'){\n options.ignore_last_delimiters = Math.floor(options.ignore_last_delimiters)\n if(options.ignore_last_delimiters === 0){\n options.ignore_last_delimiters = false\n }\n }else if(typeof options.ignore_last_delimiters !== 'boolean'){\n throw new CsvError('CSV_INVALID_OPTION_IGNORE_LAST_DELIMITERS', [\n 'Invalid option `ignore_last_delimiters`:',\n 'the value must be a boolean value or an integer,',\n `got ${JSON.stringify(options.ignore_last_delimiters)}`\n ], options)\n }\n if(options.ignore_last_delimiters === true && options.columns === false){\n throw new CsvError('CSV_IGNORE_LAST_DELIMITERS_REQUIRES_COLUMNS', [\n 'The option `ignore_last_delimiters`',\n 'requires the activation of the `columns` option'\n ], options)\n }\n // Normalize option `info`\n if(options.info === undefined || options.info === null || options.info === false){\n options.info = false\n }else if(options.info !== true){\n throw new Error(`Invalid Option: info must be true, got ${JSON.stringify(options.info)}`)\n }\n // Normalize option `max_record_size`\n if(options.max_record_size === undefined || options.max_record_size === null || options.max_record_size === false){\n options.max_record_size = 0\n }else if(Number.isInteger(options.max_record_size) && options.max_record_size >= 0){\n // Great, nothing to do\n }else if(typeof options.max_record_size === 'string' && /\\d+/.test(options.max_record_size)){\n options.max_record_size = parseInt(options.max_record_size)\n }else{\n throw new Error(`Invalid Option: max_record_size must be a positive integer, got ${JSON.stringify(options.max_record_size)}`)\n }\n // Normalize option `objname`\n if(options.objname === undefined || options.objname === null || options.objname === false){\n options.objname = undefined\n }else if(Buffer.isBuffer(options.objname)){\n if(options.objname.length === 0){\n throw new Error(`Invalid Option: objname must be a non empty buffer`)\n }\n if(options.encoding === null){\n // Don't call `toString`, leave objname as a buffer\n }else{\n options.objname = options.objname.toString(options.encoding)\n }\n }else if(typeof options.objname === 'string'){\n if(options.objname.length === 0){\n throw new Error(`Invalid Option: objname must be a non empty string`)\n }\n // Great, nothing to do\n }else{\n throw new Error(`Invalid Option: objname must be a string or a buffer, got ${options.objname}`)\n }\n // Normalize option `on_record`\n if(options.on_record === undefined || options.on_record === null){\n options.on_record = undefined\n }else if(typeof options.on_record !== 'function'){\n throw new CsvError('CSV_INVALID_OPTION_ON_RECORD', [\n 'Invalid option `on_record`:',\n 'expect a function,',\n `got ${JSON.stringify(options.on_record)}`\n ], options)\n }\n // Normalize option `quote`\n if(options.quote === null || options.quote === false || options.quote === ''){\n options.quote = null\n }else{\n if(options.quote === undefined || options.quote === true){\n options.quote = Buffer.from('\"', options.encoding)\n }else if(typeof options.quote === 'string'){\n options.quote = Buffer.from(options.quote, options.encoding)\n }\n if(!Buffer.isBuffer(options.quote)){\n throw new Error(`Invalid Option: quote must be a buffer or a string, got ${JSON.stringify(options.quote)}`)\n }\n }\n // Normalize option `raw`\n if(options.raw === undefined || options.raw === null || options.raw === false){\n options.raw = false\n }else if(options.raw !== true){\n throw new Error(`Invalid Option: raw must be true, got ${JSON.stringify(options.raw)}`)\n }\n // Normalize option `record_delimiter`\n if(!options.record_delimiter){\n options.record_delimiter = []\n }else if(!Array.isArray(options.record_delimiter)){\n options.record_delimiter = [options.record_delimiter]\n }\n options.record_delimiter = options.record_delimiter.map( function(rd){\n if(typeof rd === 'string'){\n rd = Buffer.from(rd, options.encoding)\n }\n return rd\n })\n // Normalize option `relax`\n if(typeof options.relax === 'boolean'){\n // Great, nothing to do\n }else if(options.relax === undefined || options.relax === null){\n options.relax = false\n }else{\n throw new Error(`Invalid Option: relax must be a boolean, got ${JSON.stringify(options.relax)}`)\n }\n // Normalize option `relax_column_count`\n if(typeof options.relax_column_count === 'boolean'){\n // Great, nothing to do\n }else if(options.relax_column_count === undefined || options.relax_column_count === null){\n options.relax_column_count = false\n }else{\n throw new Error(`Invalid Option: relax_column_count must be a boolean, got ${JSON.stringify(options.relax_column_count)}`)\n }\n if(typeof options.relax_column_count_less === 'boolean'){\n // Great, nothing to do\n }else if(options.relax_column_count_less === undefined || options.relax_column_count_less === null){\n options.relax_column_count_less = false\n }else{\n throw new Error(`Invalid Option: relax_column_count_less must be a boolean, got ${JSON.stringify(options.relax_column_count_less)}`)\n }\n if(typeof options.relax_column_count_more === 'boolean'){\n // Great, nothing to do\n }else if(options.relax_column_count_more === undefined || options.relax_column_count_more === null){\n options.relax_column_count_more = false\n }else{\n throw new Error(`Invalid Option: relax_column_count_more must be a boolean, got ${JSON.stringify(options.relax_column_count_more)}`)\n }\n // Normalize option `skip_empty_lines`\n if(typeof options.skip_empty_lines === 'boolean'){\n // Great, nothing to do\n }else if(options.skip_empty_lines === undefined || options.skip_empty_lines === null){\n options.skip_empty_lines = false\n }else{\n throw new Error(`Invalid Option: skip_empty_lines must be a boolean, got ${JSON.stringify(options.skip_empty_lines)}`)\n }\n // Normalize option `skip_lines_with_empty_values`\n if(typeof options.skip_lines_with_empty_values === 'boolean'){\n // Great, nothing to do\n }else if(options.skip_lines_with_empty_values === undefined || options.skip_lines_with_empty_values === null){\n options.skip_lines_with_empty_values = false\n }else{\n throw new Error(`Invalid Option: skip_lines_with_empty_values must be a boolean, got ${JSON.stringify(options.skip_lines_with_empty_values)}`)\n }\n // Normalize option `skip_lines_with_error`\n if(typeof options.skip_lines_with_error === 'boolean'){\n // Great, nothing to do\n }else if(options.skip_lines_with_error === undefined || options.skip_lines_with_error === null){\n options.skip_lines_with_error = false\n }else{\n throw new Error(`Invalid Option: skip_lines_with_error must be a boolean, got ${JSON.stringify(options.skip_lines_with_error)}`)\n }\n // Normalize option `rtrim`\n if(options.rtrim === undefined || options.rtrim === null || options.rtrim === false){\n options.rtrim = false\n }else if(options.rtrim !== true){\n throw new Error(`Invalid Option: rtrim must be a boolean, got ${JSON.stringify(options.rtrim)}`)\n }\n // Normalize option `ltrim`\n if(options.ltrim === undefined || options.ltrim === null || options.ltrim === false){\n options.ltrim = false\n }else if(options.ltrim !== true){\n throw new Error(`Invalid Option: ltrim must be a boolean, got ${JSON.stringify(options.ltrim)}`)\n }\n // Normalize option `trim`\n if(options.trim === undefined || options.trim === null || options.trim === false){\n options.trim = false\n }else if(options.trim !== true){\n throw new Error(`Invalid Option: trim must be a boolean, got ${JSON.stringify(options.trim)}`)\n }\n // Normalize options `trim`, `ltrim` and `rtrim`\n if(options.trim === true && opts.ltrim !== false){\n options.ltrim = true\n }else if(options.ltrim !== true){\n options.ltrim = false\n }\n if(options.trim === true && opts.rtrim !== false){\n options.rtrim = true\n }else if(options.rtrim !== true){\n options.rtrim = false\n }\n // Normalize option `to`\n if(options.to === undefined || options.to === null){\n options.to = -1\n }else{\n if(typeof options.to === 'string' && /\\d+/.test(options.to)){\n options.to = parseInt(options.to)\n }\n if(Number.isInteger(options.to)){\n if(options.to <= 0){\n throw new Error(`Invalid Option: to must be a positive integer greater than 0, got ${JSON.stringify(opts.to)}`)\n }\n }else{\n throw new Error(`Invalid Option: to must be an integer, got ${JSON.stringify(opts.to)}`)\n }\n }\n // Normalize option `to_line`\n if(options.to_line === undefined || options.to_line === null){\n options.to_line = -1\n }else{\n if(typeof options.to_line === 'string' && /\\d+/.test(options.to_line)){\n options.to_line = parseInt(options.to_line)\n }\n if(Number.isInteger(options.to_line)){\n if(options.to_line <= 0){\n throw new Error(`Invalid Option: to_line must be a positive integer greater than 0, got ${JSON.stringify(opts.to_line)}`)\n }\n }else{\n throw new Error(`Invalid Option: to_line must be an integer, got ${JSON.stringify(opts.to_line)}`)\n }\n }\n this.info = {\n bytes: 0,\n comment_lines: 0,\n empty_lines: 0,\n invalid_field_length: 0,\n lines: 1,\n records: 0\n }\n this.options = options\n this.state = {\n bomSkipped: false,\n bufBytesStart: 0,\n castField: fnCastField,\n commenting: false,\n // Current error encountered by a record\n error: undefined,\n enabled: options.from_line === 1,\n escaping: false,\n // escapeIsQuote: options.escape === options.quote,\n escapeIsQuote: Buffer.isBuffer(options.escape) && Buffer.isBuffer(options.quote) && Buffer.compare(options.escape, options.quote) === 0,\n // columns can be `false`, `true`, `Array`\n expectedRecordLength: Array.isArray(options.columns) ? options.columns.length : undefined,\n field: new ResizeableBuffer(20),\n firstLineToHeaders: fnFirstLineToHeaders,\n needMoreDataSize: Math.max(\n // Skip if the remaining buffer smaller than comment\n options.comment !== null ? options.comment.length : 0,\n // Skip if the remaining buffer can be delimiter\n ...options.delimiter.map( (delimiter) => delimiter.length),\n // Skip if the remaining buffer can be escape sequence\n options.quote !== null ? options.quote.length : 0,\n ),\n previousBuf: undefined,\n quoting: false,\n stop: false,\n rawBuffer: new ResizeableBuffer(100),\n record: [],\n recordHasError: false,\n record_length: 0,\n recordDelimiterMaxLength: options.record_delimiter.length === 0 ? 2 : Math.max(...options.record_delimiter.map( (v) => v.length)),\n trimChars: [Buffer.from(' ', options.encoding)[0], Buffer.from('\\t', options.encoding)[0]],\n wasQuoting: false,\n wasRowDelimiter: false\n }\n }\n // Implementation of `Transform._transform`\n _transform(buf, encoding, callback){\n if(this.state.stop === true){\n return\n }\n const err = this.__parse(buf, false)\n if(err !== undefined){\n this.state.stop = true\n }\n callback(err)\n }\n // Implementation of `Transform._flush`\n _flush(callback){\n if(this.state.stop === true){\n return\n }\n const err = this.__parse(undefined, true)\n callback(err)\n }\n // Central parser implementation\n __parse(nextBuf, end){\n const {bom, comment, escape, from_line, ltrim, max_record_size, quote, raw, relax, rtrim, skip_empty_lines, to, to_line} = this.options\n let {record_delimiter} = this.options\n const {bomSkipped, previousBuf, rawBuffer, escapeIsQuote} = this.state\n let buf\n if(previousBuf === undefined){\n if(nextBuf === undefined){\n // Handle empty string\n this.push(null)\n return\n }else{\n buf = nextBuf\n }\n }else if(previousBuf !== undefined && nextBuf === undefined){\n buf = previousBuf\n }else{\n buf = Buffer.concat([previousBuf, nextBuf])\n }\n // Handle UTF BOM\n if(bomSkipped === false){\n if(bom === false){\n this.state.bomSkipped = true\n }else if(buf.length < 3){\n // No enough data\n if(end === false){\n // Wait for more data\n this.state.previousBuf = buf\n return\n }\n }else{\n for(let encoding in boms){\n if(boms[encoding].compare(buf, 0, boms[encoding].length) === 0){\n // Skip BOM\n let bomLength = boms[encoding].length\n this.state.bufBytesStart += bomLength\n buf = buf.slice(bomLength)\n // Renormalize original options with the new encoding\n this.__normalizeOptions({...this.__originalOptions, encoding: encoding})\n break\n }\n }\n this.state.bomSkipped = true\n }\n }\n const bufLen = buf.length\n let pos\n for(pos = 0; pos < bufLen; pos++){\n // Ensure we get enough space to look ahead\n // There should be a way to move this out of the loop\n if(this.__needMoreData(pos, bufLen, end)){\n break\n }\n if(this.state.wasRowDelimiter === true){\n this.info.lines++\n this.state.wasRowDelimiter = false\n }\n if(to_line !== -1 && this.info.lines > to_line){\n this.state.stop = true\n this.push(null)\n return\n }\n // Auto discovery of record_delimiter, unix, mac and windows supported\n if(this.state.quoting === false && record_delimiter.length === 0){\n const record_delimiterCount = this.__autoDiscoverRecordDelimiter(buf, pos)\n if(record_delimiterCount){\n record_delimiter = this.options.record_delimiter\n }\n }\n const chr = buf[pos]\n if(raw === true){\n rawBuffer.append(chr)\n }\n if((chr === cr || chr === nl) && this.state.wasRowDelimiter === false ){\n this.state.wasRowDelimiter = true\n }\n // Previous char was a valid escape char\n // treat the current char as a regular char\n if(this.state.escaping === true){\n this.state.escaping = false\n }else{\n // Escape is only active inside quoted fields\n // We are quoting, the char is an escape chr and there is a chr to escape\n // if(escape !== null && this.state.quoting === true && chr === escape && pos + 1 < bufLen){\n if(escape !== null && this.state.quoting === true && this.__isEscape(buf, pos, chr) && pos + escape.length < bufLen){\n if(escapeIsQuote){\n if(this.__isQuote(buf, pos+escape.length)){\n this.state.escaping = true\n pos += escape.length - 1\n continue\n }\n }else{\n this.state.escaping = true\n pos += escape.length - 1\n continue\n }\n }\n // Not currently escaping and chr is a quote\n // TODO: need to compare bytes instead of single char\n if(this.state.commenting === false && this.__isQuote(buf, pos)){\n if(this.state.quoting === true){\n const nextChr = buf[pos+quote.length]\n const isNextChrTrimable = rtrim && this.__isCharTrimable(nextChr)\n const isNextChrComment = comment !== null && this.__compareBytes(comment, buf, pos+quote.length, nextChr)\n const isNextChrDelimiter = this.__isDelimiter(buf, pos+quote.length, nextChr)\n const isNextChrRecordDelimiter = record_delimiter.length === 0 ? this.__autoDiscoverRecordDelimiter(buf, pos+quote.length) : this.__isRecordDelimiter(nextChr, buf, pos+quote.length)\n // Escape a quote\n // Treat next char as a regular character\n if(escape !== null && this.__isEscape(buf, pos, chr) && this.__isQuote(buf, pos + escape.length)){\n pos += escape.length - 1\n }else if(!nextChr || isNextChrDelimiter || isNextChrRecordDelimiter || isNextChrComment || isNextChrTrimable){\n this.state.quoting = false\n this.state.wasQuoting = true\n pos += quote.length - 1\n continue\n }else if(relax === false){\n const err = this.__error(\n new CsvError('CSV_INVALID_CLOSING_QUOTE', [\n 'Invalid Closing Quote:',\n `got \"${String.fromCharCode(nextChr)}\"`,\n `at line ${this.info.lines}`,\n 'instead of delimiter, record delimiter, trimable character',\n '(if activated) or comment',\n ], this.options, this.__infoField())\n )\n if(err !== undefined) return err\n }else{\n this.state.quoting = false\n this.state.wasQuoting = true\n this.state.field.prepend(quote)\n pos += quote.length - 1\n }\n }else{\n if(this.state.field.length !== 0){\n // In relax mode, treat opening quote preceded by chrs as regular\n if( relax === false ){\n const err = this.__error(\n new CsvError('INVALID_OPENING_QUOTE', [\n 'Invalid Opening Quote:',\n `a quote is found inside a field at line ${this.info.lines}`,\n ], this.options, this.__infoField(), {\n field: this.state.field,\n })\n )\n if(err !== undefined) return err\n }\n }else{\n this.state.quoting = true\n pos += quote.length - 1\n continue\n }\n }\n }\n if(this.state.quoting === false){\n let recordDelimiterLength = this.__isRecordDelimiter(chr, buf, pos)\n if(recordDelimiterLength !== 0){\n // Do not emit comments which take a full line\n const skipCommentLine = this.state.commenting && (this.state.wasQuoting === false && this.state.record.length === 0 && this.state.field.length === 0)\n if(skipCommentLine){\n this.info.comment_lines++\n // Skip full comment line\n }else{\n // Activate records emition if above from_line\n if(this.state.enabled === false && this.info.lines + (this.state.wasRowDelimiter === true ? 1: 0) >= from_line){\n this.state.enabled = true\n this.__resetField()\n this.__resetRecord()\n pos += recordDelimiterLength - 1\n continue\n }\n // Skip if line is empty and skip_empty_lines activated\n if(skip_empty_lines === true && this.state.wasQuoting === false && this.state.record.length === 0 && this.state.field.length === 0){\n this.info.empty_lines++\n pos += recordDelimiterLength - 1\n continue\n }\n this.info.bytes = this.state.bufBytesStart + pos;\n const errField = this.__onField()\n if(errField !== undefined) return errField\n this.info.bytes = this.state.bufBytesStart + pos + recordDelimiterLength;\n const errRecord = this.__onRecord()\n if(errRecord !== undefined) return errRecord\n if(to !== -1 && this.info.records >= to){\n this.state.stop = true\n this.push(null)\n return\n }\n }\n this.state.commenting = false\n pos += recordDelimiterLength - 1\n continue\n }\n if(this.state.commenting){\n continue\n }\n const commentCount = comment === null ? 0 : this.__compareBytes(comment, buf, pos, chr)\n if(commentCount !== 0){\n this.state.commenting = true\n continue\n }\n let delimiterLength = this.__isDelimiter(buf, pos, chr)\n if(delimiterLength !== 0){\n this.info.bytes = this.state.bufBytesStart + pos;\n const errField = this.__onField()\n if(errField !== undefined) return errField\n pos += delimiterLength - 1\n continue\n }\n }\n }\n if(this.state.commenting === false){\n if(max_record_size !== 0 && this.state.record_length + this.state.field.length > max_record_size){\n const err = this.__error(\n new CsvError('CSV_MAX_RECORD_SIZE', [\n 'Max Record Size:',\n 'record exceed the maximum number of tolerated bytes',\n `of ${max_record_size}`,\n `at line ${this.info.lines}`,\n ], this.options, this.__infoField())\n )\n if(err !== undefined) return err\n }\n }\n const lappend = ltrim === false || this.state.quoting === true || this.state.field.length !== 0 || !this.__isCharTrimable(chr)\n // rtrim in non quoting is handle in __onField\n const rappend = rtrim === false || this.state.wasQuoting === false\n if( lappend === true && rappend === true ){\n this.state.field.append(chr)\n }else if(rtrim === true && !this.__isCharTrimable(chr)){\n const err = this.__error(\n new CsvError('CSV_NON_TRIMABLE_CHAR_AFTER_CLOSING_QUOTE', [\n 'Invalid Closing Quote:',\n 'found non trimable byte after quote',\n `at line ${this.info.lines}`,\n ], this.options, this.__infoField())\n )\n if(err !== undefined) return err\n }\n }\n if(end === true){\n // Ensure we are not ending in a quoting state\n if(this.state.quoting === true){\n const err = this.__error(\n new CsvError('CSV_QUOTE_NOT_CLOSED', [\n 'Quote Not Closed:',\n `the parsing is finished with an opening quote at line ${this.info.lines}`,\n ], this.options, this.__infoField())\n )\n if(err !== undefined) return err\n }else{\n // Skip last line if it has no characters\n if(this.state.wasQuoting === true || this.state.record.length !== 0 || this.state.field.length !== 0){\n this.info.bytes = this.state.bufBytesStart + pos;\n const errField = this.__onField()\n if(errField !== undefined) return errField\n const errRecord = this.__onRecord()\n if(errRecord !== undefined) return errRecord\n }else if(this.state.wasRowDelimiter === true){\n this.info.empty_lines++\n }else if(this.state.commenting === true){\n this.info.comment_lines++\n }\n }\n }else{\n this.state.bufBytesStart += pos\n this.state.previousBuf = buf.slice(pos)\n }\n if(this.state.wasRowDelimiter === true){\n this.info.lines++\n this.state.wasRowDelimiter = false\n }\n }\n __onRecord(){\n const {columns, columns_duplicates_to_array, encoding, info, from, relax_column_count, relax_column_count_less, relax_column_count_more, raw, skip_lines_with_empty_values} = this.options\n const {enabled, record} = this.state\n if(enabled === false){\n return this.__resetRecord()\n }\n // Convert the first line into column names\n const recordLength = record.length\n if(columns === true){\n if(skip_lines_with_empty_values === true && isRecordEmpty(record)){\n this.__resetRecord()\n return\n }\n return this.__firstLineToColumns(record)\n }\n if(columns === false && this.info.records === 0){\n this.state.expectedRecordLength = recordLength\n }\n if(recordLength !== this.state.expectedRecordLength){\n const err = columns === false ?\n // Todo: rename CSV_INCONSISTENT_RECORD_LENGTH to\n // CSV_RECORD_INCONSISTENT_FIELDS_LENGTH\n new CsvError('CSV_INCONSISTENT_RECORD_LENGTH', [\n 'Invalid Record Length:',\n `expect ${this.state.expectedRecordLength},`,\n `got ${recordLength} on line ${this.info.lines}`,\n ], this.options, this.__infoField(), {\n record: record,\n })\n :\n // Todo: rename CSV_RECORD_DONT_MATCH_COLUMNS_LENGTH to\n // CSV_RECORD_INCONSISTENT_COLUMNS\n new CsvError('CSV_RECORD_DONT_MATCH_COLUMNS_LENGTH', [\n 'Invalid Record Length:',\n `columns length is ${columns.length},`, // rename columns\n `got ${recordLength} on line ${this.info.lines}`,\n ], this.options, this.__infoField(), {\n record: record,\n })\n if(relax_column_count === true ||\n (relax_column_count_less === true && recordLength < this.state.expectedRecordLength) ||\n (relax_column_count_more === true && recordLength > this.state.expectedRecordLength) ){\n this.info.invalid_field_length++\n this.state.error = err\n // Error is undefined with skip_lines_with_error\n }else{\n const finalErr = this.__error(err)\n if(finalErr) return finalErr\n }\n }\n if(skip_lines_with_empty_values === true && isRecordEmpty(record)){\n this.__resetRecord()\n return\n }\n if(this.state.recordHasError === true){\n this.__resetRecord()\n this.state.recordHasError = false\n return\n }\n this.info.records++\n if(from === 1 || this.info.records >= from){\n // With columns, records are object\n if(columns !== false){\n const obj = {}\n // Transform record array to an object\n for(let i = 0, l = record.length; i < l; i++){\n if(columns[i] === undefined || columns[i].disabled) continue\n // Turn duplicate columns into an array\n if (columns_duplicates_to_array === true && obj[columns[i].name] !== undefined) {\n if (Array.isArray(obj[columns[i].name])) {\n obj[columns[i].name] = obj[columns[i].name].concat(record[i])\n } else {\n obj[columns[i].name] = [obj[columns[i].name], record[i]]\n }\n } else {\n obj[columns[i].name] = record[i]\n }\n }\n const {objname} = this.options\n // Without objname (default)\n if(objname === undefined){\n if(raw === true || info === true){\n const err = this.__push(Object.assign(\n {record: obj},\n (raw === true ? {raw: this.state.rawBuffer.toString(encoding)}: {}),\n (info === true ? {info: this.__infoRecord()}: {})\n ))\n if(err){\n return err\n }\n }else{\n const err = this.__push(obj)\n if(err){\n return err\n }\n }\n // With objname (default)\n }else{\n if(raw === true || info === true){\n const err = this.__push(Object.assign(\n {record: [obj[objname], obj]},\n raw === true ? {raw: this.state.rawBuffer.toString(encoding)}: {},\n info === true ? {info: this.__infoRecord()}: {}\n ))\n if(err){\n return err\n }\n }else{\n const err = this.__push([obj[objname], obj])\n if(err){\n return err\n }\n }\n }\n // Without columns, records are array\n }else{\n if(raw === true || info === true){\n const err = this.__push(Object.assign(\n {record: record},\n raw === true ? {raw: this.state.rawBuffer.toString(encoding)}: {},\n info === true ? {info: this.__infoRecord()}: {}\n ))\n if(err){\n return err\n }\n }else{\n const err = this.__push(record)\n if(err){\n return err\n }\n }\n }\n }\n this.__resetRecord()\n }\n __firstLineToColumns(record){\n const {firstLineToHeaders} = this.state\n try{\n const headers = firstLineToHeaders === undefined ? record : firstLineToHeaders.call(null, record)\n if(!Array.isArray(headers)){\n return this.__error(\n new CsvError('CSV_INVALID_COLUMN_MAPPING', [\n 'Invalid Column Mapping:',\n 'expect an array from column function,',\n `got ${JSON.stringify(headers)}`\n ], this.options, this.__infoField(), {\n headers: headers,\n })\n )\n }\n const normalizedHeaders = normalizeColumnsArray(headers)\n this.state.expectedRecordLength = normalizedHeaders.length\n this.options.columns = normalizedHeaders\n this.__resetRecord()\n return\n }catch(err){\n return err\n }\n }\n __resetRecord(){\n if(this.options.raw === true){\n this.state.rawBuffer.reset()\n }\n this.state.error = undefined\n this.state.record = []\n this.state.record_length = 0\n }\n __onField(){\n const {cast, encoding, rtrim, max_record_size} = this.options\n const {enabled, wasQuoting} = this.state\n // Short circuit for the from_line options\n if(enabled === false){\n return this.__resetField()\n }\n let field = this.state.field.toString(encoding)\n if(rtrim === true && wasQuoting === false){\n field = field.trimRight()\n }\n if(cast === true){\n const [err, f] = this.__cast(field)\n if(err !== undefined) return err\n field = f\n }\n this.state.record.push(field)\n // Increment record length if record size must not exceed a limit\n if(max_record_size !== 0 && typeof field === 'string'){\n this.state.record_length += field.length\n }\n this.__resetField()\n }\n __resetField(){\n this.state.field.reset()\n this.state.wasQuoting = false\n }\n __push(record){\n const {on_record} = this.options\n if(on_record !== undefined){\n const info = this.__infoRecord()\n try{\n record = on_record.call(null, record, info)\n }catch(err){\n return err\n }\n if(record === undefined || record === null){ return }\n }\n this.push(record)\n }\n // Return a tuple with the error and the casted value\n __cast(field){\n const {columns, relax_column_count} = this.options\n const isColumns = Array.isArray(columns)\n // Dont loose time calling cast\n // because the final record is an object\n // and this field can't be associated to a key present in columns\n if( isColumns === true && relax_column_count && this.options.columns.length <= this.state.record.length ){\n return [undefined, undefined]\n }\n if(this.state.castField !== null){\n try{\n const info = this.__infoField()\n return [undefined, this.state.castField.call(null, field, info)]\n }catch(err){\n return [err]\n }\n }\n if(this.__isFloat(field)){\n return [undefined, parseFloat(field)]\n }else if(this.options.cast_date !== false){\n const info = this.__infoField()\n return [undefined, this.options.cast_date.call(null, field, info)]\n }\n return [undefined, field]\n }\n // Helper to test if a character is a space or a line delimiter\n __isCharTrimable(chr){\n return chr === space || chr === tab || chr === cr || chr === nl || chr === np\n }\n // Keep it in case we implement the `cast_int` option\n // __isInt(value){\n // // return Number.isInteger(parseInt(value))\n // // return !isNaN( parseInt( obj ) );\n // return /^(\\-|\\+)?[1-9][0-9]*$/.test(value)\n // }\n __isFloat(value){\n return (value - parseFloat( value ) + 1) >= 0 // Borrowed from jquery\n }\n __compareBytes(sourceBuf, targetBuf, targetPos, firstByte){\n if(sourceBuf[0] !== firstByte) return 0\n const sourceLength = sourceBuf.length\n for(let i = 1; i < sourceLength; i++){\n if(sourceBuf[i] !== targetBuf[targetPos+i]) return 0\n }\n return sourceLength\n }\n __needMoreData(i, bufLen, end){\n if(end) return false\n const {quote} = this.options\n const {quoting, needMoreDataSize, recordDelimiterMaxLength} = this.state\n const numOfCharLeft = bufLen - i - 1\n const requiredLength = Math.max(\n needMoreDataSize,\n // Skip if the remaining buffer smaller than record delimiter\n recordDelimiterMaxLength,\n // Skip if the remaining buffer can be record delimiter following the closing quote\n // 1 is for quote.length\n quoting ? (quote.length + recordDelimiterMaxLength) : 0,\n )\n return numOfCharLeft < requiredLength\n }\n __isDelimiter(buf, pos, chr){\n const {delimiter, ignore_last_delimiters} = this.options\n if(ignore_last_delimiters === true && this.state.record.length === this.options.columns.length - 1){\n return 0\n }else if(ignore_last_delimiters !== false && typeof ignore_last_delimiters === 'number' && this.state.record.length === ignore_last_delimiters - 1){\n return 0\n }\n loop1: for(let i = 0; i < delimiter.length; i++){\n const del = delimiter[i]\n if(del[0] === chr){\n for(let j = 1; j < del.length; j++){\n if(del[j] !== buf[pos+j]) continue loop1\n }\n return del.length\n }\n }\n return 0\n }\n __isRecordDelimiter(chr, buf, pos){\n const {record_delimiter} = this.options\n const recordDelimiterLength = record_delimiter.length\n loop1: for(let i = 0; i < recordDelimiterLength; i++){\n const rd = record_delimiter[i]\n const rdLength = rd.length\n if(rd[0] !== chr){\n continue\n }\n for(let j = 1; j < rdLength; j++){\n if(rd[j] !== buf[pos+j]){\n continue loop1\n }\n }\n return rd.length\n }\n return 0\n }\n __isEscape(buf, pos, chr){\n const {escape} = this.options\n if(escape === null) return false\n const l = escape.length\n if(escape[0] === chr){\n for(let i = 0; i < l; i++){\n if(escape[i] !== buf[pos+i]){\n return false\n }\n }\n return true\n }\n return false\n }\n __isQuote(buf, pos){\n const {quote} = this.options\n if(quote === null) return false\n const l = quote.length\n for(let i = 0; i < l; i++){\n if(quote[i] !== buf[pos+i]){\n return false\n }\n }\n return true\n }\n __autoDiscoverRecordDelimiter(buf, pos){\n const {encoding} = this.options\n const chr = buf[pos]\n if(chr === cr){\n if(buf[pos+1] === nl){\n this.options.record_delimiter.push(Buffer.from('\\r\\n', encoding))\n this.state.recordDelimiterMaxLength = 2\n return 2\n }else{\n this.options.record_delimiter.push(Buffer.from('\\r', encoding))\n this.state.recordDelimiterMaxLength = 1\n return 1\n }\n }else if(chr === nl){\n this.options.record_delimiter.push(Buffer.from('\\n', encoding))\n this.state.recordDelimiterMaxLength = 1\n return 1\n }\n return 0\n }\n __error(msg){\n const {skip_lines_with_error} = this.options\n const err = typeof msg === 'string' ? new Error(msg) : msg\n if(skip_lines_with_error){\n this.state.recordHasError = true\n this.emit('skip', err)\n return undefined\n }else{\n return err\n }\n }\n __infoDataSet(){\n return {\n ...this.info,\n columns: this.options.columns\n }\n }\n __infoRecord(){\n const {columns} = this.options\n return {\n ...this.__infoDataSet(),\n error: this.state.error,\n header: columns === true,\n index: this.state.record.length,\n }\n }\n __infoField(){\n const {columns} = this.options\n const isColumns = Array.isArray(columns)\n return {\n ...this.__infoRecord(),\n column: isColumns === true ?\n ( columns.length > this.state.record.length ?\n columns[this.state.record.length].name :\n null\n ) :\n this.state.record.length,\n quoting: this.state.wasQuoting,\n }\n }\n}\n\nconst parse = function(){\n let data, options, callback\n for(let i in arguments){\n const argument = arguments[i]\n const type = typeof argument\n if(data === undefined && (typeof argument === 'string' || Buffer.isBuffer(argument))){\n data = argument\n }else if(options === undefined && isObject(argument)){\n options = argument\n }else if(callback === undefined && type === 'function'){\n callback = argument\n }else{\n throw new CsvError('CSV_INVALID_ARGUMENT', [\n 'Invalid argument:',\n `got ${JSON.stringify(argument)} at index ${i}`\n ], options || {})\n }\n }\n const parser = new Parser(options)\n if(callback){\n const records = options === undefined || options.objname === undefined ? [] : {}\n parser.on('readable', function(){\n let record\n while((record = this.read()) !== null){\n if(options === undefined || options.objname === undefined){\n records.push(record)\n }else{\n records[record[0]] = record[1]\n }\n }\n })\n parser.on('error', function(err){\n callback(err, undefined, parser.__infoDataSet())\n })\n parser.on('end', function(){\n callback(undefined, records, parser.__infoDataSet())\n })\n }\n if(data !== undefined){\n // Give a chance for events to be registered later\n if(typeof setImmediate === 'function'){\n setImmediate(function(){\n parser.write(data)\n parser.end()\n })\n }else{\n parser.write(data)\n parser.end()\n }\n }\n return parser\n}\n\nclass CsvError extends Error {\n constructor(code, message, options, ...contexts) {\n if(Array.isArray(message)) message = message.join(' ')\n super(message)\n if(Error.captureStackTrace !== undefined){\n Error.captureStackTrace(this, CsvError)\n }\n this.code = code\n for(const context of contexts){\n for(const key in context){\n const value = context[key]\n this[key] = Buffer.isBuffer(value) ? value.toString(options.encoding) : value == null ? value : JSON.parse(JSON.stringify(value))\n }\n }\n }\n}\n\nparse.Parser = Parser\n\nparse.CsvError = CsvError\n\nmodule.exports = parse\n\nconst underscore = function(str){\n return str.replace(/([A-Z])/g, function(_, match){\n return '_' + match.toLowerCase()\n })\n}\n\nconst isObject = function(obj){\n return (typeof obj === 'object' && obj !== null && !Array.isArray(obj))\n}\n\nconst isRecordEmpty = function(record){\n return record.every( (field) => field == null || field.toString && field.toString().trim() === '' )\n}\n\nconst normalizeColumnsArray = function(columns){\n const normalizedColumns = [];\n for(let i = 0, l = columns.length; i < l; i++){\n const column = columns[i]\n if(column === undefined || column === null || column === false){\n normalizedColumns[i] = { disabled: true }\n }else if(typeof column === 'string'){\n normalizedColumns[i] = { name: column }\n }else if(isObject(column)){\n if(typeof column.name !== 'string'){\n throw new CsvError('CSV_OPTION_COLUMNS_MISSING_NAME', [\n 'Option columns missing name:',\n `property \"name\" is required at position ${i}`,\n 'when column is an object literal'\n ])\n }\n normalizedColumns[i] = column\n }else{\n throw new CsvError('CSV_INVALID_COLUMN_DEFINITION', [\n 'Invalid column definition:',\n 'expect a string or a literal object,',\n `got ${JSON.stringify(column)} at position ${i}`\n ])\n }\n }\n return normalizedColumns;\n}\n","\nconst parse = require('.')\n\nmodule.exports = function(data, options={}){\n if(typeof data === 'string'){\n data = Buffer.from(data)\n }\n const records = options && options.objname ? {} : []\n const parser = new parse.Parser(options)\n parser.push = function(record){\n if(record === null){\n return\n }\n if(options.objname === undefined)\n records.push(record)\n else{\n records[record[0]] = record[1]\n }\n }\n const err1 = parser.__parse(data, false)\n if(err1 !== undefined) throw err1\n const err2 = parser.__parse(undefined, true)\n if(err2 !== undefined) throw err2\n return records\n}\n","\n/*\nCSV Stringify\n\nPlease look at the [project documentation](https://csv.js.org/stringify/) for\nadditional information.\n*/\n\nconst { Transform } = require('stream')\nconst bom_utf8 = Buffer.from([239, 187, 191])\n\nclass Stringifier extends Transform {\n constructor(opts = {}){\n super({...{writableObjectMode: true}, ...opts})\n const options = {}\n let err\n // Merge with user options\n for(let opt in opts){\n options[underscore(opt)] = opts[opt]\n }\n if(err = this.normalize(options)) throw err\n switch(options.record_delimiter){\n case 'auto':\n options.record_delimiter = null\n break\n case 'unix':\n options.record_delimiter = \"\\n\"\n break\n case 'mac':\n options.record_delimiter = \"\\r\"\n break\n case 'windows':\n options.record_delimiter = \"\\r\\n\"\n break\n case 'ascii':\n options.record_delimiter = \"\\u001e\"\n break\n case 'unicode':\n options.record_delimiter = \"\\u2028\"\n break\n }\n // Expose options\n this.options = options\n // Internal state\n this.state = {\n stop: false\n }\n // Information\n this.info = {\n records: 0\n }\n }\n normalize(options){\n // Normalize option `bom`\n if(options.bom === undefined || options.bom === null || options.bom === false){\n options.bom = false\n }else if(options.bom !== true){\n return new CsvError('CSV_OPTION_BOOLEAN_INVALID_TYPE', [\n 'option `bom` is optional and must be a boolean value,',\n `got ${JSON.stringify(options.bom)}`\n ])\n }\n // Normalize option `delimiter`\n if(options.delimiter === undefined || options.delimiter === null){\n options.delimiter = ','\n }else if(Buffer.isBuffer(options.delimiter)){\n options.delimiter = options.delimiter.toString()\n }else if(typeof options.delimiter !== 'string'){\n return new CsvError('CSV_OPTION_DELIMITER_INVALID_TYPE', [\n 'option `delimiter` must be a buffer or a string,',\n `got ${JSON.stringify(options.delimiter)}`\n ])\n }\n // Normalize option `quote`\n if(options.quote === undefined || options.quote === null){\n options.quote = '\"'\n }else if(options.quote === true){\n options.quote = '\"'\n }else if(options.quote === false){\n options.quote = ''\n }else if (Buffer.isBuffer(options.quote)){\n options.quote = options.quote.toString()\n }else if(typeof options.quote !== 'string'){\n return new CsvError('CSV_OPTION_QUOTE_INVALID_TYPE', [\n 'option `quote` must be a boolean, a buffer or a string,',\n `got ${JSON.stringify(options.quote)}`\n ])\n }\n // Normalize option `quoted`\n if(options.quoted === undefined || options.quoted === null){\n options.quoted = false\n }else{\n // todo\n }\n // Normalize option `quoted_empty`\n if(options.quoted_empty === undefined || options.quoted_empty === null){\n options.quoted_empty = undefined\n }else{\n // todo\n }\n // Normalize option `quoted_match`\n if(options.quoted_match === undefined || options.quoted_match === null || options.quoted_match === false){\n options.quoted_match = null\n }else if(!Array.isArray(options.quoted_match)){\n options.quoted_match = [options.quoted_match]\n }\n if(options.quoted_match){\n for(let quoted_match of options.quoted_match){\n const isString = typeof quoted_match === 'string'\n const isRegExp = quoted_match instanceof RegExp\n if(!isString && !isRegExp){\n return Error(`Invalid Option: quoted_match must be a string or a regex, got ${JSON.stringify(quoted_match)}`)\n }\n }\n }\n // Normalize option `quoted_string`\n if(options.quoted_string === undefined || options.quoted_string === null){\n options.quoted_string = false\n }else{\n // todo\n }\n // Normalize option `eof`\n if(options.eof === undefined || options.eof === null){\n options.eof = true\n }else{\n // todo\n }\n // Normalize option `escape`\n if(options.escape === undefined || options.escape === null){\n options.escape = '\"'\n }else if(Buffer.isBuffer(options.escape)){\n options.escape = options.escape.toString()\n }else if(typeof options.escape !== 'string'){\n return Error(`Invalid Option: escape must be a buffer or a string, got ${JSON.stringify(options.escape)}`)\n }\n if (options.escape.length > 1){\n return Error(`Invalid Option: escape must be one character, got ${options.escape.length} characters`)\n }\n // Normalize option `header`\n if(options.header === undefined || options.header === null){\n options.header = false\n }else{\n // todo\n }\n // Normalize option `columns`\n options.columns = this.normalize_columns(options.columns)\n // Normalize option `quoted`\n if(options.quoted === undefined || options.quoted === null){\n options.quoted = false\n }else{\n // todo\n }\n // Normalize option `cast`\n if(options.cast === undefined || options.cast === null){\n options.cast = {}\n }else{\n // todo\n }\n // Normalize option cast.bigint\n if(options.cast.bigint === undefined || options.cast.bigint === null){\n // Cast boolean to string by default\n options.cast.bigint = value => '' + value\n }\n // Normalize option cast.boolean\n if(options.cast.boolean === undefined || options.cast.boolean === null){\n // Cast boolean to string by default\n options.cast.boolean = value => value ? '1' : ''\n }\n // Normalize option cast.date\n if(options.cast.date === undefined || options.cast.date === null){\n // Cast date to timestamp string by default\n options.cast.date = value => '' + value.getTime()\n }\n // Normalize option cast.number\n if(options.cast.number === undefined || options.cast.number === null){\n // Cast number to string using native casting by default\n options.cast.number = value => '' + value\n }\n // Normalize option cast.object\n if(options.cast.object === undefined || options.cast.object === null){\n // Stringify object as JSON by default\n options.cast.object = value => JSON.stringify(value)\n }\n // Normalize option cast.string\n if(options.cast.string === undefined || options.cast.string === null){\n // Leave string untouched\n options.cast.string = function(value){return value}\n }\n // Normalize option `record_delimiter`\n if(options.record_delimiter === undefined || options.record_delimiter === null){\n options.record_delimiter = '\\n'\n }else if(Buffer.isBuffer(options.record_delimiter)){\n options.record_delimiter = options.record_delimiter.toString()\n }else if(typeof options.record_delimiter !== 'string'){\n return Error(`Invalid Option: record_delimiter must be a buffer or a string, got ${JSON.stringify(options.record_delimiter)}`)\n }\n }\n _transform(chunk, encoding, callback){\n if(this.state.stop === true){\n return\n }\n // Chunk validation\n if(!Array.isArray(chunk) && typeof chunk !== 'object'){\n this.state.stop = true\n return callback(Error(`Invalid Record: expect an array or an object, got ${JSON.stringify(chunk)}`))\n }\n // Detect columns from the first record\n if(this.info.records === 0){\n if(Array.isArray(chunk)){\n if(this.options.header === true && !this.options.columns){\n this.state.stop = true\n return callback(Error('Undiscoverable Columns: header option requires column option or object records'))\n }\n }else if(this.options.columns === undefined || this.options.columns === null){\n this.options.columns = this.normalize_columns(Object.keys(chunk))\n }\n }\n // Emit the header\n if(this.info.records === 0){\n this.bom()\n this.headers()\n }\n // Emit and stringify the record if an object or an array\n try{\n this.emit('record', chunk, this.info.records)\n }catch(err){\n this.state.stop = true\n return this.emit('error', err)\n }\n // Convert the record into a string\n let chunk_string\n if(this.options.eof){\n chunk_string = this.stringify(chunk)\n if(chunk_string === undefined){\n return\n }else{\n chunk_string = chunk_string + this.options.record_delimiter\n }\n }else{\n chunk_string = this.stringify(chunk)\n if(chunk_string === undefined){\n return\n }else{\n if(this.options.header || this.info.records){\n chunk_string = this.options.record_delimiter + chunk_string\n }\n }\n }\n // Emit the csv\n this.info.records++\n this.push(chunk_string)\n callback()\n }\n _flush(callback){\n if(this.info.records === 0){\n this.bom()\n this.headers()\n }\n callback()\n }\n stringify(chunk, chunkIsHeader=false){\n if(typeof chunk !== 'object'){\n return chunk\n }\n const {columns, header} = this.options\n const record = []\n // Record is an array\n if(Array.isArray(chunk)){\n // We are getting an array but the user has specified output columns. In\n // this case, we respect the columns indexes\n if(columns){\n chunk.splice(columns.length)\n }\n // Cast record elements\n for(let i=0; i<chunk.length; i++){\n const field = chunk[i]\n const [err, value] = this.__cast(field, {\n index: i, column: i, records: this.info.records, header: chunkIsHeader\n })\n if(err){\n this.emit('error', err)\n return\n }\n record[i] = [value, field]\n }\n // Record is a literal object\n }else{\n if(columns){\n for(let i=0; i<columns.length; i++){\n const field = get(chunk, columns[i].key)\n const [err, value] = this.__cast(field, {\n index: i, column: columns[i].key, records: this.info.records, header: chunkIsHeader\n })\n if(err){\n this.emit('error', err)\n return\n }\n record[i] = [value, field]\n }\n }else{\n for(let column of chunk){\n const field = chunk[column]\n const [err, value] = this.__cast(field, {\n index: i, column: columns[i].key, records: this.info.records, header: chunkIsHeader\n })\n if(err){\n this.emit('error', err)\n return\n }\n record.push([value, field])\n }\n }\n }\n let csvrecord = ''\n for(let i=0; i<record.length; i++){\n let options, err\n let [value, field] = record[i]\n if(typeof value === \"string\"){\n options = this.options\n }else if(isObject(value)){\n // let { value, ...options } = value\n options = value\n value = options.value\n delete options.value\n if(typeof value !== \"string\" && value !== undefined && value !== null){\n this.emit(\"error\", Error(`Invalid Casting Value: returned value must return a string, null or undefined, got ${JSON.stringify(value)}`))\n return\n }\n options = {...this.options, ...options}\n if(err = this.normalize(options)){\n this.emit(\"error\", err)\n return\n }\n }else if(value === undefined || value === null){\n options = this.options\n }else{\n this.emit(\"error\", Error(`Invalid Casting Value: returned value must return a string, an object, null or undefined, got ${JSON.stringify(value)}`))\n return\n }\n const {delimiter, escape, quote, quoted, quoted_empty, quoted_string, quoted_match, record_delimiter} = options\n if(value){\n if(typeof value !== 'string'){\n this.emit(\"error\", Error(`Formatter must return a string, null or undefined, got ${JSON.stringify(value)}`))\n return null\n }\n const containsdelimiter = delimiter.length && value.indexOf(delimiter) >= 0\n const containsQuote = (quote !== '') && value.indexOf(quote) >= 0\n const containsEscape = value.indexOf(escape) >= 0 && (escape !== quote)\n const containsRecordDelimiter = value.indexOf(record_delimiter) >= 0\n const quotedString = quoted_string && typeof field === 'string'\n let quotedMatch = quoted_match && quoted_match.filter( quoted_match => {\n if(typeof quoted_match === 'string'){\n return value.indexOf(quoted_match) !== -1\n }else{\n return quoted_match.test(value)\n }\n })\n quotedMatch = quotedMatch && quotedMatch.length > 0\n const shouldQuote = containsQuote === true || containsdelimiter || containsRecordDelimiter || quoted || quotedString || quotedMatch\n if(shouldQuote === true && containsEscape === true){\n const regexp = escape === '\\\\'\n ? new RegExp(escape + escape, 'g')\n : new RegExp(escape, 'g')\n value = value.replace(regexp, escape + escape)\n }\n if(containsQuote === true){\n const regexp = new RegExp(quote,'g')\n value = value.replace(regexp, escape + quote)\n }\n if(shouldQuote === true){\n value = quote + value + quote\n }\n csvrecord += value\n }else if(quoted_empty === true || (field === '' && quoted_string === true && quoted_empty !== false)){\n csvrecord += quote + quote\n }\n if(i !== record.length - 1){\n csvrecord += delimiter\n }\n }\n return csvrecord\n }\n bom(){\n if(this.options.bom !== true){\n return\n }\n this.push(bom_utf8)\n }\n headers(){\n if(this.options.header === false){\n return\n }\n if(this.options.columns === undefined){\n return\n }\n let headers = this.options.columns.map(column => column.header)\n if(this.options.eof){\n headers = this.stringify(headers, true) + this.options.record_delimiter\n }else{\n headers = this.stringify(headers)\n }\n this.push(headers)\n }\n __cast(value, context){\n const type = typeof value\n try{\n if(type === 'string'){ // Fine for 99% of the cases\n return [undefined, this.options.cast.string(value, context)]\n }else if(type === 'bigint'){\n return [undefined, this.options.cast.bigint(value, context)]\n }else if(type === 'number'){\n return [undefined, this.options.cast.number(value, context)]\n }else if(type === 'boolean'){\n return [undefined, this.options.cast.boolean(value, context)]\n }else if(value instanceof Date){\n return [undefined, this.options.cast.date(value, context)]\n }else if(type === 'object' && value !== null){\n return [undefined, this.options.cast.object(value, context)]\n }else{\n return [undefined, value, value]\n }\n }catch(err){\n return [err]\n }\n }\n normalize_columns(columns){\n if(columns === undefined || columns === null){\n return undefined\n }\n if(typeof columns !== 'object'){\n throw Error('Invalid option \"columns\": expect an array or an object')\n }\n if(!Array.isArray(columns)){\n const newcolumns = []\n for(let k in columns){\n newcolumns.push({\n key: k,\n header: columns[k]\n })\n }\n columns = newcolumns\n }else{\n const newcolumns = []\n for(let column of columns){\n if(typeof column === 'string'){\n newcolumns.push({\n key: column,\n header: column\n })\n }else if(typeof column === 'object' && column !== undefined && !Array.isArray(column)){\n if(!column.key){\n throw Error('Invalid column definition: property \"key\" is required')\n }\n if(column.header === undefined){\n column.header = column.key\n }\n newcolumns.push(column)\n }else{\n throw Error('Invalid column definition: expect a string or an object')\n }\n }\n columns = newcolumns\n }\n return columns\n }\n}\n\nconst stringify = function(){\n let data, options, callback\n for(let i in arguments){\n const argument = arguments[i]\n const type = typeof argument\n if(data === undefined && (Array.isArray(argument))){\n data = argument\n }else if(options === undefined && isObject(argument)){\n options = argument\n }else if(callback === undefined && type === 'function'){\n callback = argument\n }else{\n throw new CsvError('CSV_INVALID_ARGUMENT', [\n 'Invalid argument:',\n `got ${JSON.stringify(argument)} at index ${i}`\n ])\n }\n }\n const stringifier = new Stringifier(options)\n if(callback){\n const chunks = []\n stringifier.on('readable', function(){\n let chunk\n while((chunk = this.read()) !== null){\n chunks.push(chunk)\n }\n })\n stringifier.on('error', function(err){\n callback(err)\n })\n stringifier.on('end', function(){\n callback(undefined, chunks.join(''))\n })\n }\n if(data !== undefined){\n // Give a chance for events to be registered later\n if(typeof setImmediate === 'function'){\n setImmediate(function(){\n for(let record of data){\n stringifier.write(record)\n }\n stringifier.end()\n })\n }else{\n for(let record of data){\n stringifier.write(record)\n }\n stringifier.end()\n }\n }\n return stringifier\n}\n\nclass CsvError extends Error {\n constructor(code, message, ...contexts) {\n if(Array.isArray(message)) message = message.join(' ')\n super(message)\n if(Error.captureStackTrace !== undefined){\n Error.captureStackTrace(this, CsvError)\n }\n this.code = code\n for(const context of contexts){\n for(const key in context){\n const value = context[key]\n this[key] = Buffer.isBuffer(value) ? value.toString() : value == null ? value : JSON.parse(JSON.stringify(value))\n }\n }\n }\n}\n\nstringify.Stringifier = Stringifier\n\nstringify.CsvError = CsvError\n\nmodule.exports = stringify\n\nconst isObject = function(obj){\n return typeof obj === 'object' && obj !== null && ! Array.isArray(obj)\n}\n\nconst underscore = function(str){\n return str.replace(/([A-Z])/g, function(_, match){\n return '_' + match.toLowerCase()\n })\n}\n\n// Lodash implementation of `get`\n\nconst charCodeOfDot = '.'.charCodeAt(0)\nconst reEscapeChar = /\\\\(\\\\)?/g\nconst rePropName = RegExp(\n // Match anything that isn't a dot or bracket.\n '[^.[\\\\]]+' + '|' +\n // Or match property names within brackets.\n '\\\\[(?:' +\n // Match a non-string expression.\n '([^\"\\'][^[]*)' + '|' +\n // Or match strings (supports escaping characters).\n '([\"\\'])((?:(?!\\\\2)[^\\\\\\\\]|\\\\\\\\.)*?)\\\\2' +\n ')\\\\]'+ '|' +\n // Or match \"\" as the space between consecutive dots or empty brackets.\n '(?=(?:\\\\.|\\\\[\\\\])(?:\\\\.|\\\\[\\\\]|$))'\n, 'g')\nconst reIsDeepProp = /\\.|\\[(?:[^[\\]]*|([\"'])(?:(?!\\1)[^\\\\]|\\\\.)*?\\1)\\]/\nconst reIsPlainProp = /^\\w*$/\nconst getTag = function(value){\n if(!value)\n value === undefined ? '[object Undefined]' : '[object Null]'\n return Object.prototype.toString.call(value)\n}\nconst isKey = function(value, object){\n if(Array.isArray(value)){\n return false\n }\n const type = typeof value\n if(type === 'number' || type === 'symbol' || type === 'boolean' || !value || isSymbol(value)){\n return true\n }\n return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||\n (object != null && value in Object(object))\n}\nconst isSymbol = function(value){\n const type = typeof value\n return type === 'symbol' || (type === 'object' && value && getTag(value) === '[object Symbol]')\n}\nconst stringToPath = function(string){\n const result = []\n if(string.charCodeAt(0) === charCodeOfDot){\n result.push('')\n }\n string.replace(rePropName, function(match, expression, quote, subString){\n let key = match\n if(quote){\n key = subString.replace(reEscapeChar, '$1')\n }else if(expression){\n key = expression.trim()\n }\n result.push(key)\n })\n return result\n}\nconst castPath = function(value, object){\n if(Array.isArray(value)){\n return value\n } else {\n return isKey(value, object) ? [value] : stringToPath(value)\n }\n}\nconst toKey = function(value){\n if(typeof value === 'string' || isSymbol(value))\n return value\n const result = `${value}`\n return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result\n}\nconst get = function(object, path){\n path = castPath(path, object)\n let index = 0\n const length = path.length\n while(object != null && index < length){\n object = object[toKey(path[index++])]\n }\n return (index && index === length) ? object : undefined\n}\n","\nconst stringify = require('.')\nconst {StringDecoder} = require('string_decoder')\n\nmodule.exports = function(records, options={}){\n const data = []\n if(Buffer.isBuffer(records)){\n const decoder = new StringDecoder()\n records = decoder.write(records)\n }\n function onData(record){\n if(record){\n data.push(record.toString())\n }\n }\n let stringifier = new stringify.Stringifier(options)\n stringifier.on('data', onData);\n for(let record of records){\n stringifier.write(record) \n }\n stringifier.end()\n stringifier.off('data', onData);\n return data.join('')\n}\n","var accounting = require('accounting')\nvar assign = require('object-assign')\nvar localeCurrency = require('locale-currency')\nvar currencies = require('./currencies.json')\nvar localeFormats = require('./localeFormats.json')\n\nvar defaultCurrency = {\n symbol: '',\n thousandsSeparator: ',',\n decimalSeparator: '.',\n symbolOnLeft: true,\n spaceBetweenAmountAndSymbol: false,\n decimalDigits: 2\n}\n\nvar defaultLocaleFormat = {}\n\nvar formatMapping = [\n {\n symbolOnLeft: true,\n spaceBetweenAmountAndSymbol: false,\n format: {\n pos: '%s%v',\n neg: '-%s%v',\n zero: '%s%v'\n }\n },\n {\n symbolOnLeft: true,\n spaceBetweenAmountAndSymbol: true,\n format: {\n pos: '%s %v',\n neg: '-%s %v',\n zero: '%s %v'\n }\n },\n {\n symbolOnLeft: false,\n spaceBetweenAmountAndSymbol: false,\n format: {\n pos: '%v%s',\n neg: '-%v%s',\n zero: '%v%s'\n }\n },\n {\n symbolOnLeft: false,\n spaceBetweenAmountAndSymbol: true,\n format: {\n pos: '%v %s',\n neg: '-%v %s',\n zero: '%v %s'\n }\n }\n]\n\nfunction format(value, options) {\n var code = options.code || (options.locale && localeCurrency.getCurrency(options.locale))\n var localeMatch = /^([a-z]+)([_-]([a-z]+))?$/i.exec(options.locale) || []\n var language = localeMatch[1]\n var region = localeMatch[3]\n var localeFormat = assign({}, defaultLocaleFormat,\n localeFormats[language] || {},\n localeFormats[language + '-' + region] || {})\n var currency = assign({}, defaultCurrency, findCurrency(code), localeFormat)\n \n var symbolOnLeft = currency.symbolOnLeft\n var spaceBetweenAmountAndSymbol = currency.spaceBetweenAmountAndSymbol\n\n var format = formatMapping.filter(function(f) {\n return f.symbolOnLeft == symbolOnLeft && f.spaceBetweenAmountAndSymbol == spaceBetweenAmountAndSymbol\n })[0].format\n\n return accounting.formatMoney(value, {\n symbol: isUndefined(options.symbol)\n ? currency.symbol\n : options.symbol,\n\n decimal: isUndefined(options.decimal)\n ? currency.decimalSeparator\n : options.decimal,\n\n thousand: isUndefined(options.thousand)\n ? currency.thousandsSeparator\n : options.thousand,\n\n precision: typeof options.precision === 'number'\n ? options.precision\n : currency.decimalDigits,\n\n format: ['string', 'object'].indexOf(typeof options.format) > -1\n ? options.format\n : format\n })\n}\n\nfunction findCurrency (currencyCode) {\n return currencies[currencyCode]\n}\n\nfunction isUndefined (val) {\n return typeof val === 'undefined'\n}\n\nfunction unformat(value, options) {\n var code = options.code || (options.locale && localeCurrency.getCurrency(options.locale))\n var localeFormat = localeFormats[options.locale] || defaultLocaleFormat\n var currency = assign({}, defaultCurrency, findCurrency(code), localeFormat)\n var decimal = isUndefined(options.decimal) ? currency.decimalSeparator : options.decimal\n return accounting.unformat(value, decimal)\n}\n\nmodule.exports = {\n defaultCurrency: defaultCurrency,\n get currencies() {\n // In favor of backwards compatibility, the currencies map is converted to an array here\n return Object.keys(currencies).map(function(key) {\n return currencies[key]\n })\n },\n findCurrency: findCurrency,\n format: format,\n unformat: unformat\n}","// TheSpanishInquisition\n\n// Cache the matrix. Note that if you not pass a limit this implementation will use a dynamically calculate one.\n\nmodule.exports = function(__this, that, limit) {\n\n var thisLength = __this.length,\n thatLength = that.length,\n matrix = [];\n\n // If the limit is not defined it will be calculate from this and that args.\n limit = (limit || ((thatLength > thisLength ? thatLength : thisLength)))+1;\n\n for (var i = 0; i < limit; i++) {\n matrix[i] = [i];\n matrix[i].length = limit;\n }\n for (i = 0; i < limit; i++) {\n matrix[0][i] = i;\n }\n\n if (Math.abs(thisLength - thatLength) > (limit || 100)){\n return prepare (limit || 100);\n }\n if (thisLength === 0){\n return prepare (thatLength);\n }\n if (thatLength === 0){\n return prepare (thisLength);\n }\n\n // Calculate matrix.\n var j, this_i, that_j, cost, min, t;\n for (i = 1; i <= thisLength; ++i) {\n this_i = __this[i-1];\n\n // Step 4\n for (j = 1; j <= thatLength; ++j) {\n // Check the jagged ld total so far\n if (i === j && matrix[i][j] > 4) return prepare (thisLength);\n\n that_j = that[j-1];\n cost = (this_i === that_j) ? 0 : 1; // Step 5\n // Calculate the minimum (much faster than Math.min(...)).\n min = matrix[i - 1][j ] + 1; // Deletion.\n if ((t = matrix[i ][j - 1] + 1 ) < min) min = t; // Insertion.\n if ((t = matrix[i - 1][j - 1] + cost) < min) min = t; // Substitution.\n\n // Update matrix.\n matrix[i][j] = (i > 1 && j > 1 && this_i === that[j-2] && __this[i-2] === that_j && (t = matrix[i-2][j-2]+cost) < min) ? t : min; // Transposition.\n }\n }\n\n return prepare (matrix[thisLength][thatLength]);\n\n/**\n *\n */\n function prepare(steps) {\n var length = Math.max(thisLength, thatLength)\n var relative = length === 0\n ? 0\n : (steps / length);\n var similarity = 1 - relative\n return {\n steps: steps,\n relative: relative,\n similarity: similarity\n };\n }\n\n};\n","export default function addLeadingZeros(number, targetLength) {\n var sign = number < 0 ? '-' : ''\n var output = Math.abs(number).toString()\n while (output.length < targetLength) {\n output = '0' + output\n }\n return sign + output\n}\n","export default function assign(target, dirtyObject) {\n if (target == null) {\n throw new TypeError(\n 'assign requires that input parameter not be null or undefined'\n )\n }\n\n dirtyObject = dirtyObject || {}\n\n for (var property in dirtyObject) {\n if (dirtyObject.hasOwnProperty(property)) {\n target[property] = dirtyObject[property]\n }\n }\n\n return target\n}\n","import assign from '../assign/index.js'\n\nexport default function cloneObject(dirtyObject) {\n return assign({}, dirtyObject)\n}\n","import lightFormatters from '../lightFormatters/index.js'\nimport getUTCDayOfYear from '../../../_lib/getUTCDayOfYear/index.js'\nimport getUTCISOWeek from '../../../_lib/getUTCISOWeek/index.js'\nimport getUTCISOWeekYear from '../../../_lib/getUTCISOWeekYear/index.js'\nimport getUTCWeek from '../../../_lib/getUTCWeek/index.js'\nimport getUTCWeekYear from '../../../_lib/getUTCWeekYear/index.js'\nimport addLeadingZeros from '../../addLeadingZeros/index.js'\n\nvar dayPeriodEnum = {\n am: 'am',\n pm: 'pm',\n midnight: 'midnight',\n noon: 'noon',\n morning: 'morning',\n afternoon: 'afternoon',\n evening: 'evening',\n night: 'night'\n}\n\n/*\n * | | Unit | | Unit |\n * |-----|--------------------------------|-----|--------------------------------|\n * | a | AM, PM | A* | Milliseconds in day |\n * | b | AM, PM, noon, midnight | B | Flexible day period |\n * | c | Stand-alone local day of week | C* | Localized hour w/ day period |\n * | d | Day of month | D | Day of year |\n * | e | Local day of week | E | Day of week |\n * | f | | F* | Day of week in month |\n * | g* | Modified Julian day | G | Era |\n * | h | Hour [1-12] | H | Hour [0-23] |\n * | i! | ISO day of week | I! | ISO week of year |\n * | j* | Localized hour w/ day period | J* | Localized hour w/o day period |\n * | k | Hour [1-24] | K | Hour [0-11] |\n * | l* | (deprecated) | L | Stand-alone month |\n * | m | Minute | M | Month |\n * | n | | N | |\n * | o! | Ordinal number modifier | O | Timezone (GMT) |\n * | p! | Long localized time | P! | Long localized date |\n * | q | Stand-alone quarter | Q | Quarter |\n * | r* | Related Gregorian year | R! | ISO week-numbering year |\n * | s | Second | S | Fraction of second |\n * | t! | Seconds timestamp | T! | Milliseconds timestamp |\n * | u | Extended year | U* | Cyclic year |\n * | v* | Timezone (generic non-locat.) | V* | Timezone (location) |\n * | w | Local week of year | W* | Week of month |\n * | x | Timezone (ISO-8601 w/o Z) | X | Timezone (ISO-8601) |\n * | y | Year (abs) | Y | Local week-numbering year |\n * | z | Timezone (specific non-locat.) | Z* | Timezone (aliases) |\n *\n * Letters marked by * are not implemented but reserved by Unicode standard.\n *\n * Letters marked by ! are non-standard, but implemented by date-fns:\n * - `o` modifies the previous token to turn it into an ordinal (see `format` docs)\n * - `i` is ISO day of week. For `i` and `ii` is returns numeric ISO week days,\n * i.e. 7 for Sunday, 1 for Monday, etc.\n * - `I` is ISO week of year, as opposed to `w` which is local week of year.\n * - `R` is ISO week-numbering year, as opposed to `Y` which is local week-numbering year.\n * `R` is supposed to be used in conjunction with `I` and `i`\n * for universal ISO week-numbering date, whereas\n * `Y` is supposed to be used in conjunction with `w` and `e`\n * for week-numbering date specific to the locale.\n * - `P` is long localized date format\n * - `p` is long localized time format\n */\n\nvar formatters = {\n // Era\n G: function(date, token, localize) {\n var era = date.getUTCFullYear() > 0 ? 1 : 0\n switch (token) {\n // AD, BC\n case 'G':\n case 'GG':\n case 'GGG':\n return localize.era(era, { width: 'abbreviated' })\n // A, B\n case 'GGGGG':\n return localize.era(era, { width: 'narrow' })\n // Anno Domini, Before Christ\n case 'GGGG':\n default:\n return localize.era(era, { width: 'wide' })\n }\n },\n\n // Year\n y: function(date, token, localize) {\n // Ordinal number\n if (token === 'yo') {\n var signedYear = date.getUTCFullYear()\n // Returns 1 for 1 BC (which is year 0 in JavaScript)\n var year = signedYear > 0 ? signedYear : 1 - signedYear\n return localize.ordinalNumber(year, { unit: 'year' })\n }\n\n return lightFormatters.y(date, token)\n },\n\n // Local week-numbering year\n Y: function(date, token, localize, options) {\n var signedWeekYear = getUTCWeekYear(date, options)\n // Returns 1 for 1 BC (which is year 0 in JavaScript)\n var weekYear = signedWeekYear > 0 ? signedWeekYear : 1 - signedWeekYear\n\n // Two digit year\n if (token === 'YY') {\n var twoDigitYear = weekYear % 100\n return addLeadingZeros(twoDigitYear, 2)\n }\n\n // Ordinal number\n if (token === 'Yo') {\n return localize.ordinalNumber(weekYear, { unit: 'year' })\n }\n\n // Padding\n return addLeadingZeros(weekYear, token.length)\n },\n\n // ISO week-numbering year\n R: function(date, token) {\n var isoWeekYear = getUTCISOWeekYear(date)\n\n // Padding\n return addLeadingZeros(isoWeekYear, token.length)\n },\n\n // Extended year. This is a single number designating the year of this calendar system.\n // The main difference between `y` and `u` localizers are B.C. years:\n // | Year | `y` | `u` |\n // |------|-----|-----|\n // | AC 1 | 1 | 1 |\n // | BC 1 | 1 | 0 |\n // | BC 2 | 2 | -1 |\n // Also `yy` always returns the last two digits of a year,\n // while `uu` pads single digit years to 2 characters and returns other years unchanged.\n u: function(date, token) {\n var year = date.getUTCFullYear()\n return addLeadingZeros(year, token.length)\n },\n\n // Quarter\n Q: function(date, token, localize) {\n var quarter = Math.ceil((date.getUTCMonth() + 1) / 3)\n switch (token) {\n // 1, 2, 3, 4\n case 'Q':\n return String(quarter)\n // 01, 02, 03, 04\n case 'QQ':\n return addLeadingZeros(quarter, 2)\n // 1st, 2nd, 3rd, 4th\n case 'Qo':\n return localize.ordinalNumber(quarter, { unit: 'quarter' })\n // Q1, Q2, Q3, Q4\n case 'QQQ':\n return localize.quarter(quarter, {\n width: 'abbreviated',\n context: 'formatting'\n })\n // 1, 2, 3, 4 (narrow quarter; could be not numerical)\n case 'QQQQQ':\n return localize.quarter(quarter, {\n width: 'narrow',\n context: 'formatting'\n })\n // 1st quarter, 2nd quarter, ...\n case 'QQQQ':\n default:\n return localize.quarter(quarter, {\n width: 'wide',\n context: 'formatting'\n })\n }\n },\n\n // Stand-alone quarter\n q: function(date, token, localize) {\n var quarter = Math.ceil((date.getUTCMonth() + 1) / 3)\n switch (token) {\n // 1, 2, 3, 4\n case 'q':\n return String(quarter)\n // 01, 02, 03, 04\n case 'qq':\n return addLeadingZeros(quarter, 2)\n // 1st, 2nd, 3rd, 4th\n case 'qo':\n return localize.ordinalNumber(quarter, { unit: 'quarter' })\n // Q1, Q2, Q3, Q4\n case 'qqq':\n return localize.quarter(quarter, {\n width: 'abbreviated',\n context: 'standalone'\n })\n // 1, 2, 3, 4 (narrow quarter; could be not numerical)\n case 'qqqqq':\n return localize.quarter(quarter, {\n width: 'narrow',\n context: 'standalone'\n })\n // 1st quarter, 2nd quarter, ...\n case 'qqqq':\n default:\n return localize.quarter(quarter, {\n width: 'wide',\n context: 'standalone'\n })\n }\n },\n\n // Month\n M: function(date, token, localize) {\n var month = date.getUTCMonth()\n switch (token) {\n case 'M':\n case 'MM':\n return lightFormatters.M(date, token)\n // 1st, 2nd, ..., 12th\n case 'Mo':\n return localize.ordinalNumber(month + 1, { unit: 'month' })\n // Jan, Feb, ..., Dec\n case 'MMM':\n return localize.month(month, {\n width: 'abbreviated',\n context: 'formatting'\n })\n // J, F, ..., D\n case 'MMMMM':\n return localize.month(month, { width: 'narrow', context: 'formatting' })\n // January, February, ..., December\n case 'MMMM':\n default:\n return localize.month(month, { width: 'wide', context: 'formatting' })\n }\n },\n\n // Stand-alone month\n L: function(date, token, localize) {\n var month = date.getUTCMonth()\n switch (token) {\n // 1, 2, ..., 12\n case 'L':\n return String(month + 1)\n // 01, 02, ..., 12\n case 'LL':\n return addLeadingZeros(month + 1, 2)\n // 1st, 2nd, ..., 12th\n case 'Lo':\n return localize.ordinalNumber(month + 1, { unit: 'month' })\n // Jan, Feb, ..., Dec\n case 'LLL':\n return localize.month(month, {\n width: 'abbreviated',\n context: 'standalone'\n })\n // J, F, ..., D\n case 'LLLLL':\n return localize.month(month, { width: 'narrow', context: 'standalone' })\n // January, February, ..., December\n case 'LLLL':\n default:\n return localize.month(month, { width: 'wide', context: 'standalone' })\n }\n },\n\n // Local week of year\n w: function(date, token, localize, options) {\n var week = getUTCWeek(date, options)\n\n if (token === 'wo') {\n return localize.ordinalNumber(week, { unit: 'week' })\n }\n\n return addLeadingZeros(week, token.length)\n },\n\n // ISO week of year\n I: function(date, token, localize) {\n var isoWeek = getUTCISOWeek(date)\n\n if (token === 'Io') {\n return localize.ordinalNumber(isoWeek, { unit: 'week' })\n }\n\n return addLeadingZeros(isoWeek, token.length)\n },\n\n // Day of the month\n d: function(date, token, localize) {\n if (token === 'do') {\n return localize.ordinalNumber(date.getUTCDate(), { unit: 'date' })\n }\n\n return lightFormatters.d(date, token)\n },\n\n // Day of year\n D: function(date, token, localize) {\n var dayOfYear = getUTCDayOfYear(date)\n\n if (token === 'Do') {\n return localize.ordinalNumber(dayOfYear, { unit: 'dayOfYear' })\n }\n\n return addLeadingZeros(dayOfYear, token.length)\n },\n\n // Day of week\n E: function(date, token, localize) {\n var dayOfWeek = date.getUTCDay()\n switch (token) {\n // Tue\n case 'E':\n case 'EE':\n case 'EEE':\n return localize.day(dayOfWeek, {\n width: 'abbreviated',\n context: 'formatting'\n })\n // T\n case 'EEEEE':\n return localize.day(dayOfWeek, {\n width: 'narrow',\n context: 'formatting'\n })\n // Tu\n case 'EEEEEE':\n return localize.day(dayOfWeek, {\n width: 'short',\n context: 'formatting'\n })\n // Tuesday\n case 'EEEE':\n default:\n return localize.day(dayOfWeek, { width: 'wide', context: 'formatting' })\n }\n },\n\n // Local day of week\n e: function(date, token, localize, options) {\n var dayOfWeek = date.getUTCDay()\n var localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7\n switch (token) {\n // Numerical value (Nth day of week with current locale or weekStartsOn)\n case 'e':\n return String(localDayOfWeek)\n // Padded numerical value\n case 'ee':\n return addLeadingZeros(localDayOfWeek, 2)\n // 1st, 2nd, ..., 7th\n case 'eo':\n return localize.ordinalNumber(localDayOfWeek, { unit: 'day' })\n case 'eee':\n return localize.day(dayOfWeek, {\n width: 'abbreviated',\n context: 'formatting'\n })\n // T\n case 'eeeee':\n return localize.day(dayOfWeek, {\n width: 'narrow',\n context: 'formatting'\n })\n // Tu\n case 'eeeeee':\n return localize.day(dayOfWeek, {\n width: 'short',\n context: 'formatting'\n })\n // Tuesday\n case 'eeee':\n default:\n return localize.day(dayOfWeek, { width: 'wide', context: 'formatting' })\n }\n },\n\n // Stand-alone local day of week\n c: function(date, token, localize, options) {\n var dayOfWeek = date.getUTCDay()\n var localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7\n switch (token) {\n // Numerical value (same as in `e`)\n case 'c':\n return String(localDayOfWeek)\n // Padded numerical value\n case 'cc':\n return addLeadingZeros(localDayOfWeek, token.length)\n // 1st, 2nd, ..., 7th\n case 'co':\n return localize.ordinalNumber(localDayOfWeek, { unit: 'day' })\n case 'ccc':\n return localize.day(dayOfWeek, {\n width: 'abbreviated',\n context: 'standalone'\n })\n // T\n case 'ccccc':\n return localize.day(dayOfWeek, {\n width: 'narrow',\n context: 'standalone'\n })\n // Tu\n case 'cccccc':\n return localize.day(dayOfWeek, {\n width: 'short',\n context: 'standalone'\n })\n // Tuesday\n case 'cccc':\n default:\n return localize.day(dayOfWeek, { width: 'wide', context: 'standalone' })\n }\n },\n\n // ISO day of week\n i: function(date, token, localize) {\n var dayOfWeek = date.getUTCDay()\n var isoDayOfWeek = dayOfWeek === 0 ? 7 : dayOfWeek\n switch (token) {\n // 2\n case 'i':\n return String(isoDayOfWeek)\n // 02\n case 'ii':\n return addLeadingZeros(isoDayOfWeek, token.length)\n // 2nd\n case 'io':\n return localize.ordinalNumber(isoDayOfWeek, { unit: 'day' })\n // Tue\n case 'iii':\n return localize.day(dayOfWeek, {\n width: 'abbreviated',\n context: 'formatting'\n })\n // T\n case 'iiiii':\n return localize.day(dayOfWeek, {\n width: 'narrow',\n context: 'formatting'\n })\n // Tu\n case 'iiiiii':\n return localize.day(dayOfWeek, {\n width: 'short',\n context: 'formatting'\n })\n // Tuesday\n case 'iiii':\n default:\n return localize.day(dayOfWeek, { width: 'wide', context: 'formatting' })\n }\n },\n\n // AM or PM\n a: function(date, token, localize) {\n var hours = date.getUTCHours()\n var dayPeriodEnumValue = hours / 12 >= 1 ? 'pm' : 'am'\n\n switch (token) {\n case 'a':\n case 'aa':\n case 'aaa':\n return localize.dayPeriod(dayPeriodEnumValue, {\n width: 'abbreviated',\n context: 'formatting'\n })\n case 'aaaaa':\n return localize.dayPeriod(dayPeriodEnumValue, {\n width: 'narrow',\n context: 'formatting'\n })\n case 'aaaa':\n default:\n return localize.dayPeriod(dayPeriodEnumValue, {\n width: 'wide',\n context: 'formatting'\n })\n }\n },\n\n // AM, PM, midnight, noon\n b: function(date, token, localize) {\n var hours = date.getUTCHours()\n var dayPeriodEnumValue\n if (hours === 12) {\n dayPeriodEnumValue = dayPeriodEnum.noon\n } else if (hours === 0) {\n dayPeriodEnumValue = dayPeriodEnum.midnight\n } else {\n dayPeriodEnumValue = hours / 12 >= 1 ? 'pm' : 'am'\n }\n\n switch (token) {\n case 'b':\n case 'bb':\n case 'bbb':\n return localize.dayPeriod(dayPeriodEnumValue, {\n width: 'abbreviated',\n context: 'formatting'\n })\n case 'bbbbb':\n return localize.dayPeriod(dayPeriodEnumValue, {\n width: 'narrow',\n context: 'formatting'\n })\n case 'bbbb':\n default:\n return localize.dayPeriod(dayPeriodEnumValue, {\n width: 'wide',\n context: 'formatting'\n })\n }\n },\n\n // in the morning, in the afternoon, in the evening, at night\n B: function(date, token, localize) {\n var hours = date.getUTCHours()\n var dayPeriodEnumValue\n if (hours >= 17) {\n dayPeriodEnumValue = dayPeriodEnum.evening\n } else if (hours >= 12) {\n dayPeriodEnumValue = dayPeriodEnum.afternoon\n } else if (hours >= 4) {\n dayPeriodEnumValue = dayPeriodEnum.morning\n } else {\n dayPeriodEnumValue = dayPeriodEnum.night\n }\n\n switch (token) {\n case 'B':\n case 'BB':\n case 'BBB':\n return localize.dayPeriod(dayPeriodEnumValue, {\n width: 'abbreviated',\n context: 'formatting'\n })\n case 'BBBBB':\n return localize.dayPeriod(dayPeriodEnumValue, {\n width: 'narrow',\n context: 'formatting'\n })\n case 'BBBB':\n default:\n return localize.dayPeriod(dayPeriodEnumValue, {\n width: 'wide',\n context: 'formatting'\n })\n }\n },\n\n // Hour [1-12]\n h: function(date, token, localize) {\n if (token === 'ho') {\n var hours = date.getUTCHours() % 12\n if (hours === 0) hours = 12\n return localize.ordinalNumber(hours, { unit: 'hour' })\n }\n\n return lightFormatters.h(date, token)\n },\n\n // Hour [0-23]\n H: function(date, token, localize) {\n if (token === 'Ho') {\n return localize.ordinalNumber(date.getUTCHours(), { unit: 'hour' })\n }\n\n return lightFormatters.H(date, token)\n },\n\n // Hour [0-11]\n K: function(date, token, localize) {\n var hours = date.getUTCHours() % 12\n\n if (token === 'Ko') {\n return localize.ordinalNumber(hours, { unit: 'hour' })\n }\n\n return addLeadingZeros(hours, token.length)\n },\n\n // Hour [1-24]\n k: function(date, token, localize) {\n var hours = date.getUTCHours()\n if (hours === 0) hours = 24\n\n if (token === 'ko') {\n return localize.ordinalNumber(hours, { unit: 'hour' })\n }\n\n return addLeadingZeros(hours, token.length)\n },\n\n // Minute\n m: function(date, token, localize) {\n if (token === 'mo') {\n return localize.ordinalNumber(date.getUTCMinutes(), { unit: 'minute' })\n }\n\n return lightFormatters.m(date, token)\n },\n\n // Second\n s: function(date, token, localize) {\n if (token === 'so') {\n return localize.ordinalNumber(date.getUTCSeconds(), { unit: 'second' })\n }\n\n return lightFormatters.s(date, token)\n },\n\n // Fraction of second\n S: function(date, token) {\n var numberOfDigits = token.length\n var milliseconds = date.getUTCMilliseconds()\n var fractionalSeconds = Math.floor(\n milliseconds * Math.pow(10, numberOfDigits - 3)\n )\n return addLeadingZeros(fractionalSeconds, numberOfDigits)\n },\n\n // Timezone (ISO-8601. If offset is 0, output is always `'Z'`)\n X: function(date, token, _localize, options) {\n var originalDate = options._originalDate || date\n var timezoneOffset = originalDate.getTimezoneOffset()\n\n if (timezoneOffset === 0) {\n return 'Z'\n }\n\n switch (token) {\n // Hours and optional minutes\n case 'X':\n return formatTimezoneWithOptionalMinutes(timezoneOffset)\n\n // Hours, minutes and optional seconds without `:` delimiter\n // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets\n // so this token always has the same output as `XX`\n case 'XXXX':\n case 'XX': // Hours and minutes without `:` delimiter\n return formatTimezone(timezoneOffset)\n\n // Hours, minutes and optional seconds with `:` delimiter\n // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets\n // so this token always has the same output as `XXX`\n case 'XXXXX':\n case 'XXX': // Hours and minutes with `:` delimiter\n default:\n return formatTimezone(timezoneOffset, ':')\n }\n },\n\n // Timezone (ISO-8601. If offset is 0, output is `'+00:00'` or equivalent)\n x: function(date, token, _localize, options) {\n var originalDate = options._originalDate || date\n var timezoneOffset = originalDate.getTimezoneOffset()\n\n switch (token) {\n // Hours and optional minutes\n case 'x':\n return formatTimezoneWithOptionalMinutes(timezoneOffset)\n\n // Hours, minutes and optional seconds without `:` delimiter\n // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets\n // so this token always has the same output as `xx`\n case 'xxxx':\n case 'xx': // Hours and minutes without `:` delimiter\n return formatTimezone(timezoneOffset)\n\n // Hours, minutes and optional seconds with `:` delimiter\n // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets\n // so this token always has the same output as `xxx`\n case 'xxxxx':\n case 'xxx': // Hours and minutes with `:` delimiter\n default:\n return formatTimezone(timezoneOffset, ':')\n }\n },\n\n // Timezone (GMT)\n O: function(date, token, _localize, options) {\n var originalDate = options._originalDate || date\n var timezoneOffset = originalDate.getTimezoneOffset()\n\n switch (token) {\n // Short\n case 'O':\n case 'OO':\n case 'OOO':\n return 'GMT' + formatTimezoneShort(timezoneOffset, ':')\n // Long\n case 'OOOO':\n default:\n return 'GMT' + formatTimezone(timezoneOffset, ':')\n }\n },\n\n // Timezone (specific non-location)\n z: function(date, token, _localize, options) {\n var originalDate = options._originalDate || date\n var timezoneOffset = originalDate.getTimezoneOffset()\n\n switch (token) {\n // Short\n case 'z':\n case 'zz':\n case 'zzz':\n return 'GMT' + formatTimezoneShort(timezoneOffset, ':')\n // Long\n case 'zzzz':\n default:\n return 'GMT' + formatTimezone(timezoneOffset, ':')\n }\n },\n\n // Seconds timestamp\n t: function(date, token, _localize, options) {\n var originalDate = options._originalDate || date\n var timestamp = Math.floor(originalDate.getTime() / 1000)\n return addLeadingZeros(timestamp, token.length)\n },\n\n // Milliseconds timestamp\n T: function(date, token, _localize, options) {\n var originalDate = options._originalDate || date\n var timestamp = originalDate.getTime()\n return addLeadingZeros(timestamp, token.length)\n }\n}\n\nfunction formatTimezoneShort(offset, dirtyDelimiter) {\n var sign = offset > 0 ? '-' : '+'\n var absOffset = Math.abs(offset)\n var hours = Math.floor(absOffset / 60)\n var minutes = absOffset % 60\n if (minutes === 0) {\n return sign + String(hours)\n }\n var delimiter = dirtyDelimiter || ''\n return sign + String(hours) + delimiter + addLeadingZeros(minutes, 2)\n}\n\nfunction formatTimezoneWithOptionalMinutes(offset, dirtyDelimiter) {\n if (offset % 60 === 0) {\n var sign = offset > 0 ? '-' : '+'\n return sign + addLeadingZeros(Math.abs(offset) / 60, 2)\n }\n return formatTimezone(offset, dirtyDelimiter)\n}\n\nfunction formatTimezone(offset, dirtyDelimiter) {\n var delimiter = dirtyDelimiter || ''\n var sign = offset > 0 ? '-' : '+'\n var absOffset = Math.abs(offset)\n var hours = addLeadingZeros(Math.floor(absOffset / 60), 2)\n var minutes = addLeadingZeros(absOffset % 60, 2)\n return sign + hours + delimiter + minutes\n}\n\nexport default formatters\n","import addLeadingZeros from '../../addLeadingZeros/index.js'\n\n/*\n * | | Unit | | Unit |\n * |-----|--------------------------------|-----|--------------------------------|\n * | a | AM, PM | A* | Milliseconds in day |\n * | c | Stand-alone local day of week | C* | Localized hour w/ day period |\n * | d | Day of month | D | Day of year |\n * | e | Local day of week | E | Day of week |\n * | f | | F* | Day of week in month |\n * | g* | Modified Julian day | G | Era |\n * | h | Hour [1-12] | H | Hour [0-23] |\n * | i! | ISO day of week | I! | ISO week of year |\n * | j* | Localized hour w/ day period | J* | Localized hour w/o day period |\n * | k | Hour [1-24] | K | Hour [0-11] |\n * | l* | (deprecated) | L | Stand-alone month |\n * | m | Minute | M | Month |\n * | n | | N | |\n * | o! | Ordinal number modifier | O | Timezone (GMT) |\n * | p! | Long localized time | P! | Long localized date |\n * | q | Stand-alone quarter | Q | Quarter |\n * | r* | Related Gregorian year | R! | ISO week-numbering year |\n * | s | Second | S | Fraction of second |\n * | t! | Seconds timestamp | T! | Milliseconds timestamp |\n * | u | Extended year | U* | Cyclic year |\n * | v* | Timezone (generic non-locat.) | V* | Timezone (location) |\n * | w | Local week of year | W* | Week of month |\n * | x | Timezone (ISO-8601 w/o Z) | X | Timezone (ISO-8601) |\n * | y | Year (abs) | Y | Local week-numbering year |\n * | z | Timezone (specific non-locat.) | Z* | Timezone (aliases) |\n *\n * Letters marked by * are not implemented but reserved by Unicode standard.\n *\n * Letters marked by ! are non-standard, but implemented by date-fns:\n * - `o` modifies the previous token to turn it into an ordinal (see `format` docs)\n * - `i` is ISO day of week. For `i` and `ii` is returns numeric ISO week days,\n * i.e. 7 for Sunday, 1 for Monday, etc.\n * - `I` is ISO week of year, as opposed to `w` which is local week of year.\n * - `R` is ISO week-numbering year, as opposed to `Y` which is local week-numbering year.\n * `R` is supposed to be used in conjunction with `I` and `i`\n * for universal ISO week-numbering date, whereas\n * `Y` is supposed to be used in conjunction with `w` and `e`\n * for week-numbering date specific to the locale.\n * - `P` is long localized date format\n * - `p` is long localized time format\n */\n\nvar formatters = {\n // Year\n y: function(date, token) {\n // From http://www.unicode.org/reports/tr35/tr35-31/tr35-dates.html#Date_Format_tokens\n // | Year | y | yy | yyy | yyyy | yyyyy |\n // |----------|-------|----|-------|-------|-------|\n // | AD 1 | 1 | 01 | 001 | 0001 | 00001 |\n // | AD 12 | 12 | 12 | 012 | 0012 | 00012 |\n // | AD 123 | 123 | 23 | 123 | 0123 | 00123 |\n // | AD 1234 | 1234 | 34 | 1234 | 1234 | 01234 |\n // | AD 12345 | 12345 | 45 | 12345 | 12345 | 12345 |\n\n var signedYear = date.getUTCFullYear()\n // Returns 1 for 1 BC (which is year 0 in JavaScript)\n var year = signedYear > 0 ? signedYear : 1 - signedYear\n return addLeadingZeros(token === 'yy' ? year % 100 : year, token.length)\n },\n\n // Month\n M: function(date, token) {\n var month = date.getUTCMonth()\n return token === 'M' ? String(month + 1) : addLeadingZeros(month + 1, 2)\n },\n\n // Day of the month\n d: function(date, token) {\n return addLeadingZeros(date.getUTCDate(), token.length)\n },\n\n // AM or PM\n a: function(date, token) {\n var dayPeriodEnumValue = date.getUTCHours() / 12 >= 1 ? 'pm' : 'am'\n\n switch (token) {\n case 'a':\n case 'aa':\n case 'aaa':\n return dayPeriodEnumValue.toUpperCase()\n case 'aaaaa':\n return dayPeriodEnumValue[0]\n case 'aaaa':\n default:\n return dayPeriodEnumValue === 'am' ? 'a.m.' : 'p.m.'\n }\n },\n\n // Hour [1-12]\n h: function(date, token) {\n return addLeadingZeros(date.getUTCHours() % 12 || 12, token.length)\n },\n\n // Hour [0-23]\n H: function(date, token) {\n return addLeadingZeros(date.getUTCHours(), token.length)\n },\n\n // Minute\n m: function(date, token) {\n return addLeadingZeros(date.getUTCMinutes(), token.length)\n },\n\n // Second\n s: function(date, token) {\n return addLeadingZeros(date.getUTCSeconds(), token.length)\n }\n}\n\nexport default formatters\n","function dateLongFormatter(pattern, formatLong) {\n switch (pattern) {\n case 'P':\n return formatLong.date({ width: 'short' })\n case 'PP':\n return formatLong.date({ width: 'medium' })\n case 'PPP':\n return formatLong.date({ width: 'long' })\n case 'PPPP':\n default:\n return formatLong.date({ width: 'full' })\n }\n}\n\nfunction timeLongFormatter(pattern, formatLong) {\n switch (pattern) {\n case 'p':\n return formatLong.time({ width: 'short' })\n case 'pp':\n return formatLong.time({ width: 'medium' })\n case 'ppp':\n return formatLong.time({ width: 'long' })\n case 'pppp':\n default:\n return formatLong.time({ width: 'full' })\n }\n}\n\nfunction dateTimeLongFormatter(pattern, formatLong) {\n var matchResult = pattern.match(/(P+)(p+)?/)\n var datePattern = matchResult[1]\n var timePattern = matchResult[2]\n\n if (!timePattern) {\n return dateLongFormatter(pattern, formatLong)\n }\n\n var dateTimeFormat\n\n switch (datePattern) {\n case 'P':\n dateTimeFormat = formatLong.dateTime({ width: 'short' })\n break\n case 'PP':\n dateTimeFormat = formatLong.dateTime({ width: 'medium' })\n break\n case 'PPP':\n dateTimeFormat = formatLong.dateTime({ width: 'long' })\n break\n case 'PPPP':\n default:\n dateTimeFormat = formatLong.dateTime({ width: 'full' })\n break\n }\n\n return dateTimeFormat\n .replace('{{date}}', dateLongFormatter(datePattern, formatLong))\n .replace('{{time}}', timeLongFormatter(timePattern, formatLong))\n}\n\nvar longFormatters = {\n p: timeLongFormatter,\n P: dateTimeLongFormatter\n}\n\nexport default longFormatters\n","var MILLISECONDS_IN_MINUTE = 60000\n\n/**\n * Google Chrome as of 67.0.3396.87 introduced timezones with offset that includes seconds.\n * They usually appear for dates that denote time before the timezones were introduced\n * (e.g. for 'Europe/Prague' timezone the offset is GMT+00:57:44 before 1 October 1891\n * and GMT+01:00:00 after that date)\n *\n * Date#getTimezoneOffset returns the offset in minutes and would return 57 for the example above,\n * which would lead to incorrect calculations.\n *\n * This function returns the timezone offset in milliseconds that takes seconds in account.\n */\nexport default function getTimezoneOffsetInMilliseconds (dirtyDate) {\n var date = new Date(dirtyDate.getTime())\n var baseTimezoneOffset = date.getTimezoneOffset()\n date.setSeconds(0, 0)\n var millisecondsPartOfTimezoneOffset = date.getTime() % MILLISECONDS_IN_MINUTE\n\n return baseTimezoneOffset * MILLISECONDS_IN_MINUTE + millisecondsPartOfTimezoneOffset\n}\n","import toDate from '../../toDate/index.js'\n\nvar MILLISECONDS_IN_DAY = 86400000\n\n// This function will be a part of public API when UTC function will be implemented.\n// See issue: https://github.com/date-fns/date-fns/issues/376\nexport default function getUTCDayOfYear(dirtyDate) {\n if (arguments.length < 1) {\n throw new TypeError(\n '1 argument required, but only ' + arguments.length + ' present'\n )\n }\n\n var date = toDate(dirtyDate)\n var timestamp = date.getTime()\n date.setUTCMonth(0, 1)\n date.setUTCHours(0, 0, 0, 0)\n var startOfYearTimestamp = date.getTime()\n var difference = timestamp - startOfYearTimestamp\n return Math.floor(difference / MILLISECONDS_IN_DAY) + 1\n}\n","import toDate from '../../toDate/index.js'\nimport startOfUTCISOWeek from '../startOfUTCISOWeek/index.js'\nimport startOfUTCISOWeekYear from '../startOfUTCISOWeekYear/index.js'\n\nvar MILLISECONDS_IN_WEEK = 604800000\n\n// This function will be a part of public API when UTC function will be implemented.\n// See issue: https://github.com/date-fns/date-fns/issues/376\nexport default function getUTCISOWeek(dirtyDate) {\n if (arguments.length < 1) {\n throw new TypeError(\n '1 argument required, but only ' + arguments.length + ' present'\n )\n }\n\n var date = toDate(dirtyDate)\n var diff =\n startOfUTCISOWeek(date).getTime() - startOfUTCISOWeekYear(date).getTime()\n\n // Round the number of days to the nearest integer\n // because the number of milliseconds in a week is not constant\n // (e.g. it's different in the week of the daylight saving time clock shift)\n return Math.round(diff / MILLISECONDS_IN_WEEK) + 1\n}\n","import toDate from '../../toDate/index.js'\nimport startOfUTCISOWeek from '../startOfUTCISOWeek/index.js'\n\n// This function will be a part of public API when UTC function will be implemented.\n// See issue: https://github.com/date-fns/date-fns/issues/376\nexport default function getUTCISOWeekYear(dirtyDate) {\n if (arguments.length < 1) {\n throw new TypeError(\n '1 argument required, but only ' + arguments.length + ' present'\n )\n }\n\n var date = toDate(dirtyDate)\n var year = date.getUTCFullYear()\n\n var fourthOfJanuaryOfNextYear = new Date(0)\n fourthOfJanuaryOfNextYear.setUTCFullYear(year + 1, 0, 4)\n fourthOfJanuaryOfNextYear.setUTCHours(0, 0, 0, 0)\n var startOfNextYear = startOfUTCISOWeek(fourthOfJanuaryOfNextYear)\n\n var fourthOfJanuaryOfThisYear = new Date(0)\n fourthOfJanuaryOfThisYear.setUTCFullYear(year, 0, 4)\n fourthOfJanuaryOfThisYear.setUTCHours(0, 0, 0, 0)\n var startOfThisYear = startOfUTCISOWeek(fourthOfJanuaryOfThisYear)\n\n if (date.getTime() >= startOfNextYear.getTime()) {\n return year + 1\n } else if (date.getTime() >= startOfThisYear.getTime()) {\n return year\n } else {\n return year - 1\n }\n}\n","import toDate from '../../toDate/index.js'\nimport startOfUTCWeek from '../startOfUTCWeek/index.js'\nimport startOfUTCWeekYear from '../startOfUTCWeekYear/index.js'\n\nvar MILLISECONDS_IN_WEEK = 604800000\n\n// This function will be a part of public API when UTC function will be implemented.\n// See issue: https://github.com/date-fns/date-fns/issues/376\nexport default function getUTCWeek(dirtyDate, options) {\n if (arguments.length < 1) {\n throw new TypeError(\n '1 argument required, but only ' + arguments.length + ' present'\n )\n }\n\n var date = toDate(dirtyDate)\n var diff =\n startOfUTCWeek(date, options).getTime() -\n startOfUTCWeekYear(date, options).getTime()\n\n // Round the number of days to the nearest integer\n // because the number of milliseconds in a week is not constant\n // (e.g. it's different in the week of the daylight saving time clock shift)\n return Math.round(diff / MILLISECONDS_IN_WEEK) + 1\n}\n","import toInteger from '../toInteger/index.js'\nimport toDate from '../../toDate/index.js'\nimport startOfUTCWeek from '../startOfUTCWeek/index.js'\n\n// This function will be a part of public API when UTC function will be implemented.\n// See issue: https://github.com/date-fns/date-fns/issues/376\nexport default function getUTCWeekYear (dirtyDate, dirtyOptions) {\n if (arguments.length < 1) {\n throw new TypeError('1 argument required, but only ' + arguments.length + ' present')\n }\n\n var date = toDate(dirtyDate, dirtyOptions)\n var year = date.getUTCFullYear()\n\n var options = dirtyOptions || {}\n var locale = options.locale\n var localeFirstWeekContainsDate = locale &&\n locale.options &&\n locale.options.firstWeekContainsDate\n var defaultFirstWeekContainsDate =\n localeFirstWeekContainsDate == null\n ? 1\n : toInteger(localeFirstWeekContainsDate)\n var firstWeekContainsDate =\n options.firstWeekContainsDate == null\n ? defaultFirstWeekContainsDate\n : toInteger(options.firstWeekContainsDate)\n\n // Test if weekStartsOn is between 1 and 7 _and_ is not NaN\n if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) {\n throw new RangeError('firstWeekContainsDate must be between 1 and 7 inclusively')\n }\n\n var firstWeekOfNextYear = new Date(0)\n firstWeekOfNextYear.setUTCFullYear(year + 1, 0, firstWeekContainsDate)\n firstWeekOfNextYear.setUTCHours(0, 0, 0, 0)\n var startOfNextYear = startOfUTCWeek(firstWeekOfNextYear, dirtyOptions)\n\n var firstWeekOfThisYear = new Date(0)\n firstWeekOfThisYear.setUTCFullYear(year, 0, firstWeekContainsDate)\n firstWeekOfThisYear.setUTCHours(0, 0, 0, 0)\n var startOfThisYear = startOfUTCWeek(firstWeekOfThisYear, dirtyOptions)\n\n if (date.getTime() >= startOfNextYear.getTime()) {\n return year + 1\n } else if (date.getTime() >= startOfThisYear.getTime()) {\n return year\n } else {\n return year - 1\n }\n}\n","export var protectedTokens = ['D', 'DD', 'YY', 'YYYY']\n\nexport function isProtectedToken(token) {\n return protectedTokens.indexOf(token) !== -1\n}\n\nexport function throwProtectedError(token) {\n throw new RangeError(\n '`options.awareOfUnicodeTokens` must be set to `true` to use `' +\n token +\n '` token; see: https://git.io/fxCyr'\n )\n}\n","import toInteger from '../toInteger/index.js'\nimport toDate from '../../toDate/index.js'\n\n// This function will be a part of public API when UTC function will be implemented.\n// See issue: https://github.com/date-fns/date-fns/issues/376\nexport default function setUTCDay(dirtyDate, dirtyDay, dirtyOptions) {\n if (arguments.length < 2) {\n throw new TypeError(\n '2 arguments required, but only ' + arguments.length + ' present'\n )\n }\n\n var options = dirtyOptions || {}\n var locale = options.locale\n var localeWeekStartsOn =\n locale && locale.options && locale.options.weekStartsOn\n var defaultWeekStartsOn =\n localeWeekStartsOn == null ? 0 : toInteger(localeWeekStartsOn)\n var weekStartsOn =\n options.weekStartsOn == null\n ? defaultWeekStartsOn\n : toInteger(options.weekStartsOn)\n\n // Test if weekStartsOn is between 0 and 6 _and_ is not NaN\n if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {\n throw new RangeError('weekStartsOn must be between 0 and 6 inclusively')\n }\n\n var date = toDate(dirtyDate)\n var day = toInteger(dirtyDay)\n\n var currentDay = date.getUTCDay()\n\n var remainder = day % 7\n var dayIndex = (remainder + 7) % 7\n\n var diff = (dayIndex < weekStartsOn ? 7 : 0) + day - currentDay\n\n date.setUTCDate(date.getUTCDate() + diff)\n return date\n}\n","import toInteger from '../toInteger/index.js'\nimport toDate from '../../toDate/index.js'\n\n// This function will be a part of public API when UTC function will be implemented.\n// See issue: https://github.com/date-fns/date-fns/issues/376\nexport default function setUTCISODay(dirtyDate, dirtyDay) {\n if (arguments.length < 2) {\n throw new TypeError(\n '2 arguments required, but only ' + arguments.length + ' present'\n )\n }\n\n var day = toInteger(dirtyDay)\n\n if (day % 7 === 0) {\n day = day - 7\n }\n\n var weekStartsOn = 1\n var date = toDate(dirtyDate)\n var currentDay = date.getUTCDay()\n\n var remainder = day % 7\n var dayIndex = (remainder + 7) % 7\n\n var diff = (dayIndex < weekStartsOn ? 7 : 0) + day - currentDay\n\n date.setUTCDate(date.getUTCDate() + diff)\n return date\n}\n","import toInteger from '../toInteger/index.js'\nimport toDate from '../../toDate/index.js'\nimport getUTCISOWeek from '../getUTCISOWeek/index.js'\n\n// This function will be a part of public API when UTC function will be implemented.\n// See issue: https://github.com/date-fns/date-fns/issues/376\nexport default function setUTCISOWeek(dirtyDate, dirtyISOWeek) {\n if (arguments.length < 2) {\n throw new TypeError(\n '2 arguments required, but only ' + arguments.length + ' present'\n )\n }\n\n var date = toDate(dirtyDate)\n var isoWeek = toInteger(dirtyISOWeek)\n var diff = getUTCISOWeek(date) - isoWeek\n date.setUTCDate(date.getUTCDate() - diff * 7)\n return date\n}\n","import toInteger from '../toInteger/index.js'\nimport toDate from '../../toDate/index.js'\nimport getUTCWeek from '../getUTCWeek/index.js'\n\n// This function will be a part of public API when UTC function will be implemented.\n// See issue: https://github.com/date-fns/date-fns/issues/376\nexport default function setUTCWeek(dirtyDate, dirtyWeek, options) {\n if (arguments.length < 2) {\n throw new TypeError(\n '2 arguments required, but only ' + arguments.length + ' present'\n )\n }\n\n var date = toDate(dirtyDate)\n var week = toInteger(dirtyWeek)\n var diff = getUTCWeek(date, options) - week\n date.setUTCDate(date.getUTCDate() - diff * 7)\n return date\n}\n","import toDate from '../../toDate/index.js'\n\n// This function will be a part of public API when UTC function will be implemented.\n// See issue: https://github.com/date-fns/date-fns/issues/376\nexport default function startOfUTCISOWeek(dirtyDate) {\n if (arguments.length < 1) {\n throw new TypeError(\n '1 argument required, but only ' + arguments.length + ' present'\n )\n }\n\n var weekStartsOn = 1\n\n var date = toDate(dirtyDate)\n var day = date.getUTCDay()\n var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn\n\n date.setUTCDate(date.getUTCDate() - diff)\n date.setUTCHours(0, 0, 0, 0)\n return date\n}\n","import getUTCISOWeekYear from '../getUTCISOWeekYear/index.js'\nimport startOfUTCISOWeek from '../startOfUTCISOWeek/index.js'\n\n// This function will be a part of public API when UTC function will be implemented.\n// See issue: https://github.com/date-fns/date-fns/issues/376\nexport default function startOfUTCISOWeekYear(dirtyDate) {\n if (arguments.length < 1) {\n throw new TypeError(\n '1 argument required, but only ' + arguments.length + ' present'\n )\n }\n\n var year = getUTCISOWeekYear(dirtyDate)\n var fourthOfJanuary = new Date(0)\n fourthOfJanuary.setUTCFullYear(year, 0, 4)\n fourthOfJanuary.setUTCHours(0, 0, 0, 0)\n var date = startOfUTCISOWeek(fourthOfJanuary)\n return date\n}\n","import toInteger from '../toInteger/index.js'\nimport toDate from '../../toDate/index.js'\n\n// This function will be a part of public API when UTC function will be implemented.\n// See issue: https://github.com/date-fns/date-fns/issues/376\nexport default function startOfUTCWeek(dirtyDate, dirtyOptions) {\n if (arguments.length < 1) {\n throw new TypeError(\n '1 argument required, but only ' + arguments.length + ' present'\n )\n }\n\n var options = dirtyOptions || {}\n var locale = options.locale\n var localeWeekStartsOn =\n locale && locale.options && locale.options.weekStartsOn\n var defaultWeekStartsOn =\n localeWeekStartsOn == null ? 0 : toInteger(localeWeekStartsOn)\n var weekStartsOn =\n options.weekStartsOn == null\n ? defaultWeekStartsOn\n : toInteger(options.weekStartsOn)\n\n // Test if weekStartsOn is between 0 and 6 _and_ is not NaN\n if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {\n throw new RangeError('weekStartsOn must be between 0 and 6 inclusively')\n }\n\n var date = toDate(dirtyDate)\n var day = date.getUTCDay()\n var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn\n\n date.setUTCDate(date.getUTCDate() - diff)\n date.setUTCHours(0, 0, 0, 0)\n return date\n}\n","import toInteger from '../toInteger/index.js'\nimport getUTCWeekYear from '../getUTCWeekYear/index.js'\nimport startOfUTCWeek from '../startOfUTCWeek/index.js'\n\n// This function will be a part of public API when UTC function will be implemented.\n// See issue: https://github.com/date-fns/date-fns/issues/376\nexport default function startOfUTCWeekYear (dirtyDate, dirtyOptions) {\n if (arguments.length < 1) {\n throw new TypeError('1 argument required, but only ' + arguments.length + ' present')\n }\n\n var options = dirtyOptions || {}\n var locale = options.locale\n var localeFirstWeekContainsDate = locale &&\n locale.options &&\n locale.options.firstWeekContainsDate\n var defaultFirstWeekContainsDate =\n localeFirstWeekContainsDate == null\n ? 1\n : toInteger(localeFirstWeekContainsDate)\n var firstWeekContainsDate =\n options.firstWeekContainsDate == null\n ? defaultFirstWeekContainsDate\n : toInteger(options.firstWeekContainsDate)\n\n var year = getUTCWeekYear(dirtyDate, dirtyOptions)\n var firstWeek = new Date(0)\n firstWeek.setUTCFullYear(year, 0, firstWeekContainsDate)\n firstWeek.setUTCHours(0, 0, 0, 0)\n var date = startOfUTCWeek(firstWeek, dirtyOptions)\n return date\n}\n","export default function toInteger (dirtyNumber) {\n if (dirtyNumber === null || dirtyNumber === true || dirtyNumber === false) {\n return NaN\n }\n\n var number = Number(dirtyNumber)\n\n if (isNaN(number)) {\n return number\n }\n\n return number < 0 ? Math.ceil(number) : Math.floor(number)\n}\n","import toInteger from '../_lib/toInteger/index.js'\nimport toDate from '../toDate/index.js'\n\n/**\n * @name addDays\n * @category Day Helpers\n * @summary Add the specified number of days to the given date.\n *\n * @description\n * Add the specified number of days to the given date.\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} date - the date to be changed\n * @param {Number} amount - the amount of days to be added\n * @returns {Date} the new date with the days added\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Add 10 days to 1 September 2014:\n * var result = addDays(new Date(2014, 8, 1), 10)\n * //=> Thu Sep 11 2014 00:00:00\n */\nexport default function addDays(dirtyDate, dirtyAmount) {\n if (arguments.length < 2) {\n throw new TypeError(\n '2 arguments required, but only ' + arguments.length + ' present'\n )\n }\n\n var date = toDate(dirtyDate)\n var amount = toInteger(dirtyAmount)\n date.setDate(date.getDate() + amount)\n return date\n}\n","import toInteger from '../_lib/toInteger/index.js'\nimport addMilliseconds from '../addMilliseconds/index.js'\n\nvar MILLISECONDS_IN_HOUR = 3600000\n\n/**\n * @name addHours\n * @category Hour Helpers\n * @summary Add the specified number of hours to the given date.\n *\n * @description\n * Add the specified number of hours to the given date.\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} date - the date to be changed\n * @param {Number} amount - the amount of hours to be added\n * @returns {Date} the new date with the hours added\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Add 2 hours to 10 July 2014 23:00:00:\n * var result = addHours(new Date(2014, 6, 10, 23, 0), 2)\n * //=> Fri Jul 11 2014 01:00:00\n */\nexport default function addHours(dirtyDate, dirtyAmount) {\n if (arguments.length < 2) {\n throw new TypeError(\n '2 arguments required, but only ' + arguments.length + ' present'\n )\n }\n\n var amount = toInteger(dirtyAmount)\n return addMilliseconds(dirtyDate, amount * MILLISECONDS_IN_HOUR)\n}\n","import toInteger from '../_lib/toInteger/index.js'\nimport getISOWeekYear from '../getISOWeekYear/index.js'\nimport setISOWeekYear from '../setISOWeekYear/index.js'\n\n/**\n * @name addISOWeekYears\n * @category ISO Week-Numbering Year Helpers\n * @summary Add the specified number of ISO week-numbering years to the given date.\n *\n * @description\n * Add the specified number of ISO week-numbering years to the given date.\n *\n * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * - The function was renamed from `addISOYears` to `addISOWeekYears`.\n * \"ISO week year\" is short for [ISO week-numbering year](https://en.wikipedia.org/wiki/ISO_week_date).\n * This change makes the name consistent with\n * locale-dependent week-numbering year helpers, e.g., `addWeekYears`.\n *\n * @param {Date|Number} date - the date to be changed\n * @param {Number} amount - the amount of ISO week-numbering years to be added\n * @returns {Date} the new date with the ISO week-numbering years added\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Add 5 ISO week-numbering years to 2 July 2010:\n * var result = addISOWeekYears(new Date(2010, 6, 2), 5)\n * //=> Fri Jun 26 2015 00:00:00\n */\nexport default function addISOWeekYears(dirtyDate, dirtyAmount) {\n if (arguments.length < 2) {\n throw new TypeError(\n '2 arguments required, but only ' + arguments.length + ' present'\n )\n }\n\n var amount = toInteger(dirtyAmount)\n return setISOWeekYear(dirtyDate, getISOWeekYear(dirtyDate) + amount)\n}\n","import toInteger from '../_lib/toInteger/index.js'\nimport toDate from '../toDate/index.js'\n\n/**\n * @name addMilliseconds\n * @category Millisecond Helpers\n * @summary Add the specified number of milliseconds to the given date.\n *\n * @description\n * Add the specified number of milliseconds to the given date.\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} date - the date to be changed\n * @param {Number} amount - the amount of milliseconds to be added\n * @returns {Date} the new date with the milliseconds added\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Add 750 milliseconds to 10 July 2014 12:45:30.000:\n * var result = addMilliseconds(new Date(2014, 6, 10, 12, 45, 30, 0), 750)\n * //=> Thu Jul 10 2014 12:45:30.750\n */\nexport default function addMilliseconds(dirtyDate, dirtyAmount) {\n if (arguments.length < 2) {\n throw new TypeError(\n '2 arguments required, but only ' + arguments.length + ' present'\n )\n }\n\n var timestamp = toDate(dirtyDate).getTime()\n var amount = toInteger(dirtyAmount)\n return new Date(timestamp + amount)\n}\n","import toInteger from '../_lib/toInteger/index.js'\nimport addMilliseconds from '../addMilliseconds/index.js'\n\nvar MILLISECONDS_IN_MINUTE = 60000\n\n/**\n * @name addMinutes\n * @category Minute Helpers\n * @summary Add the specified number of minutes to the given date.\n *\n * @description\n * Add the specified number of minutes to the given date.\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} date - the date to be changed\n * @param {Number} amount - the amount of minutes to be added\n * @returns {Date} the new date with the minutes added\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Add 30 minutes to 10 July 2014 12:00:00:\n * var result = addMinutes(new Date(2014, 6, 10, 12, 0), 30)\n * //=> Thu Jul 10 2014 12:30:00\n */\nexport default function addMinutes(dirtyDate, dirtyAmount) {\n if (arguments.length < 2) {\n throw new TypeError(\n '2 arguments required, but only ' + arguments.length + ' present'\n )\n }\n\n var amount = toInteger(dirtyAmount)\n return addMilliseconds(dirtyDate, amount * MILLISECONDS_IN_MINUTE)\n}\n","import toInteger from '../_lib/toInteger/index.js'\nimport toDate from '../toDate/index.js'\nimport getDaysInMonth from '../getDaysInMonth/index.js'\n\n/**\n * @name addMonths\n * @category Month Helpers\n * @summary Add the specified number of months to the given date.\n *\n * @description\n * Add the specified number of months to the given date.\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} date - the date to be changed\n * @param {Number} amount - the amount of months to be added\n * @returns {Date} the new date with the months added\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Add 5 months to 1 September 2014:\n * var result = addMonths(new Date(2014, 8, 1), 5)\n * //=> Sun Feb 01 2015 00:00:00\n */\nexport default function addMonths(dirtyDate, dirtyAmount) {\n if (arguments.length < 2) {\n throw new TypeError(\n '2 arguments required, but only ' + arguments.length + ' present'\n )\n }\n\n var date = toDate(dirtyDate)\n var amount = toInteger(dirtyAmount)\n var desiredMonth = date.getMonth() + amount\n var dateWithDesiredMonth = new Date(0)\n dateWithDesiredMonth.setFullYear(date.getFullYear(), desiredMonth, 1)\n dateWithDesiredMonth.setHours(0, 0, 0, 0)\n var daysInMonth = getDaysInMonth(dateWithDesiredMonth)\n // Set the last day of the new month\n // if the original date was the last day of the longer month\n date.setMonth(desiredMonth, Math.min(daysInMonth, date.getDate()))\n return date\n}\n","import toInteger from '../_lib/toInteger/index.js'\nimport addMonths from '../addMonths/index.js'\n\n/**\n * @name addQuarters\n * @category Quarter Helpers\n * @summary Add the specified number of year quarters to the given date.\n *\n * @description\n * Add the specified number of year quarters to the given date.\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} date - the date to be changed\n * @param {Number} amount - the amount of quarters to be added\n * @returns {Date} the new date with the quarters added\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Add 1 quarter to 1 September 2014:\n * var result = addQuarters(new Date(2014, 8, 1), 1)\n * //=> Mon Dec 01 2014 00:00:00\n */\nexport default function addQuarters(dirtyDate, dirtyAmount) {\n if (arguments.length < 2) {\n throw new TypeError(\n '2 arguments required, but only ' + arguments.length + ' present'\n )\n }\n\n var amount = toInteger(dirtyAmount)\n var months = amount * 3\n return addMonths(dirtyDate, months)\n}\n","import toInteger from '../_lib/toInteger/index.js'\nimport addMilliseconds from '../addMilliseconds/index.js'\n\n/**\n * @name addSeconds\n * @category Second Helpers\n * @summary Add the specified number of seconds to the given date.\n *\n * @description\n * Add the specified number of seconds to the given date.\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} date - the date to be changed\n * @param {Number} amount - the amount of seconds to be added\n * @returns {Date} the new date with the seconds added\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Add 30 seconds to 10 July 2014 12:45:00:\n * var result = addSeconds(new Date(2014, 6, 10, 12, 45, 0), 30)\n * //=> Thu Jul 10 2014 12:45:30\n */\nexport default function addSeconds(dirtyDate, dirtyAmount) {\n if (arguments.length < 2) {\n throw new TypeError(\n '2 arguments required, but only ' + arguments.length + ' present'\n )\n }\n\n var amount = toInteger(dirtyAmount)\n return addMilliseconds(dirtyDate, amount * 1000)\n}\n","import toInteger from '../_lib/toInteger/index.js'\nimport addDays from '../addDays/index.js'\n\n/**\n * @name addWeeks\n * @category Week Helpers\n * @summary Add the specified number of weeks to the given date.\n *\n * @description\n * Add the specified number of week to the given date.\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} date - the date to be changed\n * @param {Number} amount - the amount of weeks to be added\n * @returns {Date} the new date with the weeks added\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Add 4 weeks to 1 September 2014:\n * var result = addWeeks(new Date(2014, 8, 1), 4)\n * //=> Mon Sep 29 2014 00:00:00\n */\nexport default function addWeeks(dirtyDate, dirtyAmount) {\n if (arguments.length < 2) {\n throw new TypeError(\n '2 arguments required, but only ' + arguments.length + ' present'\n )\n }\n\n var amount = toInteger(dirtyAmount)\n var days = amount * 7\n return addDays(dirtyDate, days)\n}\n","import toInteger from '../_lib/toInteger/index.js'\nimport addMonths from '../addMonths/index.js'\n\n/**\n * @name addYears\n * @category Year Helpers\n * @summary Add the specified number of years to the given date.\n *\n * @description\n * Add the specified number of years to the given date.\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} date - the date to be changed\n * @param {Number} amount - the amount of years to be added\n * @returns {Date} the new date with the years added\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Add 5 years to 1 September 2014:\n * var result = addYears(new Date(2014, 8, 1), 5)\n * //=> Sun Sep 01 2019 00:00:00\n */\nexport default function addYears(dirtyDate, dirtyAmount) {\n if (arguments.length < 2) {\n throw new TypeError(\n '2 arguments required, but only ' + arguments.length + ' present'\n )\n }\n\n var amount = toInteger(dirtyAmount)\n return addMonths(dirtyDate, amount * 12)\n}\n","import toDate from '../toDate/index.js'\n\n/**\n * @name areIntervalsOverlapping\n * @category Interval Helpers\n * @summary Is the given time interval overlapping with another time interval?\n *\n * @description\n * Is the given time interval overlapping with another time interval?\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * - The function was renamed from `areRangesOverlapping` to `areIntervalsOverlapping`.\n * This change was made to mirror the use of the word \"interval\" in standard ISO 8601:2004 terminology:\n *\n * ```\n * 2.1.3\n * time interval\n * part of the time axis limited by two instants\n * ```\n *\n * Also, this function now accepts an object with `start` and `end` properties\n * instead of two arguments as an interval.\n * This function now throws `RangeError` if the start of the interval is after its end\n * or if any date in the interval is `Invalid Date`.\n *\n * ```javascript\n * // Before v2.0.0\n *\n * areRangesOverlapping(\n * new Date(2014, 0, 10), new Date(2014, 0, 20),\n * new Date(2014, 0, 17), new Date(2014, 0, 21)\n * )\n *\n * // v2.0.0 onward\n *\n * areIntervalsOverlapping(\n * { start: new Date(2014, 0, 10), end: new Date(2014, 0, 20) },\n * { start: new Date(2014, 0, 17), end: new Date(2014, 0, 21) }\n * )\n * ```\n *\n * @param {Interval} intervalLeft - the first interval to compare. See [Interval]{@link docs/types/Interval}\n * @param {Interval} intervalRight - the second interval to compare. See [Interval]{@link docs/types/Interval}\n * @returns {Boolean} whether the time intervals are overlapping\n * @throws {TypeError} 2 arguments required\n * @throws {RangeError} The start of an interval cannot be after its end\n * @throws {RangeError} Date in interval cannot be `Invalid Date`\n *\n * @example\n * // For overlapping time intervals:\n * areIntervalsOverlapping(\n * { start: new Date(2014, 0, 10), end: new Date(2014, 0, 20) },\n * { start: new Date(2014, 0, 17), end: new Date(2014, 0, 21) }\n * )\n * //=> true\n *\n * @example\n * // For non-overlapping time intervals:\n * areIntervalsOverlapping(\n * { start: new Date(2014, 0, 10), end: new Date(2014, 0, 20) },\n * { start: new Date(2014, 0, 21), end: new Date(2014, 0, 22) }\n * )\n * //=> false\n */\nexport default function areIntervalsOverlapping(\n dirtyIntervalLeft,\n dirtyIntervalRight\n) {\n if (arguments.length < 2) {\n throw new TypeError(\n '2 arguments required, but only ' + arguments.length + ' present'\n )\n }\n\n var intervalLeft = dirtyIntervalLeft || {}\n var intervalRight = dirtyIntervalRight || {}\n var leftStartTime = toDate(intervalLeft.start).getTime()\n var leftEndTime = toDate(intervalLeft.end).getTime()\n var rightStartTime = toDate(intervalRight.start).getTime()\n var rightEndTime = toDate(intervalRight.end).getTime()\n\n // Throw an exception if start date is after end date or if any date is `Invalid Date`\n if (!(leftStartTime <= leftEndTime && rightStartTime <= rightEndTime)) {\n throw new RangeError('Invalid interval')\n }\n\n return leftStartTime < rightEndTime && rightStartTime < leftEndTime\n}\n","import toDate from '../toDate/index.js'\n\n/**\n * @name closestIndexTo\n * @category Common Helpers\n * @summary Return an index of the closest date from the array comparing to the given date.\n *\n * @description\n * Return an index of the closest date from the array comparing to the given date.\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * - Now, `closestIndexTo` doesn't throw an exception\n * when the second argument is not an array, and returns Invalid Date instead.\n *\n * @param {Date|Number} dateToCompare - the date to compare with\n * @param {Date[]|Number[]} datesArray - the array to search\n * @returns {Number} an index of the date closest to the given date\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Which date is closer to 6 September 2015?\n * var dateToCompare = new Date(2015, 8, 6)\n * var datesArray = [\n * new Date(2015, 0, 1),\n * new Date(2016, 0, 1),\n * new Date(2017, 0, 1)\n * ]\n * var result = closestIndexTo(dateToCompare, datesArray)\n * //=> 1\n */\nexport default function closestIndexTo(dirtyDateToCompare, dirtyDatesArray) {\n if (arguments.length < 2) {\n throw new TypeError(\n '2 arguments required, but only ' + arguments.length + ' present'\n )\n }\n\n var dateToCompare = toDate(dirtyDateToCompare)\n\n if (isNaN(dateToCompare)) {\n return NaN\n }\n\n var timeToCompare = dateToCompare.getTime()\n\n var datesArray\n // `dirtyDatesArray` is undefined or null\n if (dirtyDatesArray == null) {\n datesArray = []\n\n // `dirtyDatesArray` is Array, Set or Map, or object with custom `forEach` method\n } else if (typeof dirtyDatesArray.forEach === 'function') {\n datesArray = dirtyDatesArray\n\n // If `dirtyDatesArray` is Array-like Object, convert to Array. Otherwise, make it empty Array\n } else {\n datesArray = Array.prototype.slice.call(dirtyDatesArray)\n }\n\n var result\n var minDistance\n datesArray.forEach(function(dirtyDate, index) {\n var currentDate = toDate(dirtyDate)\n\n if (isNaN(currentDate)) {\n result = NaN\n minDistance = NaN\n return\n }\n\n var distance = Math.abs(timeToCompare - currentDate.getTime())\n if (result == null || distance < minDistance) {\n result = index\n minDistance = distance\n }\n })\n\n return result\n}\n","import toDate from '../toDate/index.js'\n\n/**\n * @name closestTo\n * @category Common Helpers\n * @summary Return a date from the array closest to the given date.\n *\n * @description\n * Return a date from the array closest to the given date.\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * - Now, `closestTo` doesn't throw an exception\n * when the second argument is not an array, and returns Invalid Date instead.\n *\n * @param {Date|Number} dateToCompare - the date to compare with\n * @param {Date[]|Number[]} datesArray - the array to search\n * @returns {Date} the date from the array closest to the given date\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Which date is closer to 6 September 2015: 1 January 2000 or 1 January 2030?\n * var dateToCompare = new Date(2015, 8, 6)\n * var result = closestTo(dateToCompare, [\n * new Date(2000, 0, 1),\n * new Date(2030, 0, 1)\n * ])\n * //=> Tue Jan 01 2030 00:00:00\n */\nexport default function closestTo(dirtyDateToCompare, dirtyDatesArray) {\n if (arguments.length < 2) {\n throw new TypeError(\n '2 arguments required, but only ' + arguments.length + ' present'\n )\n }\n\n var dateToCompare = toDate(dirtyDateToCompare)\n\n if (isNaN(dateToCompare)) {\n return new Date(NaN)\n }\n\n var timeToCompare = dateToCompare.getTime()\n\n var datesArray\n // `dirtyDatesArray` is undefined or null\n if (dirtyDatesArray == null) {\n datesArray = []\n\n // `dirtyDatesArray` is Array, Set or Map, or object with custom `forEach` method\n } else if (typeof dirtyDatesArray.forEach === 'function') {\n datesArray = dirtyDatesArray\n\n // If `dirtyDatesArray` is Array-like Object, convert to Array. Otherwise, make it empty Array\n } else {\n datesArray = Array.prototype.slice.call(dirtyDatesArray)\n }\n\n var result\n var minDistance\n datesArray.forEach(function(dirtyDate) {\n var currentDate = toDate(dirtyDate)\n\n if (isNaN(currentDate)) {\n result = new Date(NaN)\n minDistance = NaN\n return\n }\n\n var distance = Math.abs(timeToCompare - currentDate.getTime())\n if (result == null || distance < minDistance) {\n result = currentDate\n minDistance = distance\n }\n })\n\n return result\n}\n","import toDate from '../toDate/index.js'\n\n/**\n * @name compareAsc\n * @category Common Helpers\n * @summary Compare the two dates and return -1, 0 or 1.\n *\n * @description\n * Compare the two dates and return 1 if the first date is after the second,\n * -1 if the first date is before the second or 0 if dates are equal.\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} dateLeft - the first date to compare\n * @param {Date|Number} dateRight - the second date to compare\n * @returns {Number} the result of the comparison\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Compare 11 February 1987 and 10 July 1989:\n * var result = compareAsc(new Date(1987, 1, 11), new Date(1989, 6, 10))\n * //=> -1\n *\n * @example\n * // Sort the array of dates:\n * var result = [\n * new Date(1995, 6, 2),\n * new Date(1987, 1, 11),\n * new Date(1989, 6, 10)\n * ].sort(compareAsc)\n * //=> [\n * // Wed Feb 11 1987 00:00:00,\n * // Mon Jul 10 1989 00:00:00,\n * // Sun Jul 02 1995 00:00:00\n * // ]\n */\nexport default function compareAsc(dirtyDateLeft, dirtyDateRight) {\n if (arguments.length < 2) {\n throw new TypeError(\n '2 arguments required, but only ' + arguments.length + ' present'\n )\n }\n\n var dateLeft = toDate(dirtyDateLeft)\n var dateRight = toDate(dirtyDateRight)\n\n var diff = dateLeft.getTime() - dateRight.getTime()\n\n if (diff < 0) {\n return -1\n } else if (diff > 0) {\n return 1\n // Return 0 if diff is 0; return NaN if diff is NaN\n } else {\n return diff\n }\n}\n","import toDate from '../toDate/index.js'\n\n/**\n * @name compareDesc\n * @category Common Helpers\n * @summary Compare the two dates reverse chronologically and return -1, 0 or 1.\n *\n * @description\n * Compare the two dates and return -1 if the first date is after the second,\n * 1 if the first date is before the second or 0 if dates are equal.\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} dateLeft - the first date to compare\n * @param {Date|Number} dateRight - the second date to compare\n * @returns {Number} the result of the comparison\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Compare 11 February 1987 and 10 July 1989 reverse chronologically:\n * var result = compareDesc(new Date(1987, 1, 11), new Date(1989, 6, 10))\n * //=> 1\n *\n * @example\n * // Sort the array of dates in reverse chronological order:\n * var result = [\n * new Date(1995, 6, 2),\n * new Date(1987, 1, 11),\n * new Date(1989, 6, 10)\n * ].sort(compareDesc)\n * //=> [\n * // Sun Jul 02 1995 00:00:00,\n * // Mon Jul 10 1989 00:00:00,\n * // Wed Feb 11 1987 00:00:00\n * // ]\n */\nexport default function compareDesc(dirtyDateLeft, dirtyDateRight) {\n if (arguments.length < 2) {\n throw new TypeError(\n '2 arguments required, but only ' + arguments.length + ' present'\n )\n }\n\n var dateLeft = toDate(dirtyDateLeft)\n var dateRight = toDate(dirtyDateRight)\n\n var diff = dateLeft.getTime() - dateRight.getTime()\n\n if (diff > 0) {\n return -1\n } else if (diff < 0) {\n return 1\n // Return 0 if diff is 0; return NaN if diff is NaN\n } else {\n return diff\n }\n}\n","import getTimezoneOffsetInMilliseconds from '../_lib/getTimezoneOffsetInMilliseconds/index.js'\nimport startOfDay from '../startOfDay/index.js'\n\nvar MILLISECONDS_IN_DAY = 86400000\n\n/**\n * @name differenceInCalendarDays\n * @category Day Helpers\n * @summary Get the number of calendar days between the given dates.\n *\n * @description\n * Get the number of calendar days between the given dates. This means that the times are removed\n * from the dates and then the difference in days is calculated.\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} dateLeft - the later date\n * @param {Date|Number} dateRight - the earlier date\n * @returns {Number} the number of calendar days\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // How many calendar days are between\n * // 2 July 2011 23:00:00 and 2 July 2012 00:00:00?\n * var result = differenceInCalendarDays(\n * new Date(2012, 6, 2, 0, 0),\n * new Date(2011, 6, 2, 23, 0)\n * )\n * //=> 366\n * // How many calendar days are between\n * // 2 July 2011 23:59:00 and 3 July 2011 00:01:00?\n * var result = differenceInCalendarDays(\n * new Date(2011, 6, 2, 0, 1),\n * new Date(2011, 6, 2, 23, 59)\n * )\n * //=> 1\n */\nexport default function differenceInCalendarDays(\n dirtyDateLeft,\n dirtyDateRight\n) {\n if (arguments.length < 2) {\n throw new TypeError(\n '2 arguments required, but only ' + arguments.length + ' present'\n )\n }\n\n var startOfDayLeft = startOfDay(dirtyDateLeft)\n var startOfDayRight = startOfDay(dirtyDateRight)\n\n var timestampLeft =\n startOfDayLeft.getTime() - getTimezoneOffsetInMilliseconds(startOfDayLeft)\n var timestampRight =\n startOfDayRight.getTime() - getTimezoneOffsetInMilliseconds(startOfDayRight)\n\n // Round the number of days to the nearest integer\n // because the number of milliseconds in a day is not constant\n // (e.g. it's different in the day of the daylight saving time clock shift)\n return Math.round((timestampLeft - timestampRight) / MILLISECONDS_IN_DAY)\n}\n","import getISOWeekYear from '../getISOWeekYear/index.js'\n\n/**\n * @name differenceInCalendarISOWeekYears\n * @category ISO Week-Numbering Year Helpers\n * @summary Get the number of calendar ISO week-numbering years between the given dates.\n *\n * @description\n * Get the number of calendar ISO week-numbering years between the given dates.\n *\n * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * - The function was renamed from `differenceInCalendarISOYears` to `differenceInCalendarISOWeekYears`.\n * \"ISO week year\" is short for [ISO week-numbering year](https://en.wikipedia.org/wiki/ISO_week_date).\n * This change makes the name consistent with\n * locale-dependent week-numbering year helpers, e.g., `addWeekYears`.\n *\n * @param {Date|Number} dateLeft - the later date\n * @param {Date|Number} dateRight - the earlier date\n * @returns {Number} the number of calendar ISO week-numbering years\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // How many calendar ISO week-numbering years are 1 January 2010 and 1 January 2012?\n * var result = differenceInCalendarISOWeekYears(\n * new Date(2012, 0, 1),\n * new Date(2010, 0, 1)\n * )\n * //=> 2\n */\nexport default function differenceInCalendarISOWeekYears(\n dirtyDateLeft,\n dirtyDateRight\n) {\n if (arguments.length < 2) {\n throw new TypeError(\n '2 arguments required, but only ' + arguments.length + ' present'\n )\n }\n\n return getISOWeekYear(dirtyDateLeft) - getISOWeekYear(dirtyDateRight)\n}\n","import getTimezoneOffsetInMilliseconds from '../_lib/getTimezoneOffsetInMilliseconds/index.js'\nimport startOfISOWeek from '../startOfISOWeek/index.js'\n\nvar MILLISECONDS_IN_WEEK = 604800000\n\n/**\n * @name differenceInCalendarISOWeeks\n * @category ISO Week Helpers\n * @summary Get the number of calendar ISO weeks between the given dates.\n *\n * @description\n * Get the number of calendar ISO weeks between the given dates.\n *\n * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} dateLeft - the later date\n * @param {Date|Number} dateRight - the earlier date\n * @returns {Number} the number of calendar ISO weeks\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // How many calendar ISO weeks are between 6 July 2014 and 21 July 2014?\n * var result = differenceInCalendarISOWeeks(\n * new Date(2014, 6, 21),\n * new Date(2014, 6, 6)\n * )\n * //=> 3\n */\nexport default function differenceInCalendarISOWeeks(\n dirtyDateLeft,\n dirtyDateRight\n) {\n if (arguments.length < 2) {\n throw new TypeError(\n '2 arguments required, but only ' + arguments.length + ' present'\n )\n }\n\n var startOfISOWeekLeft = startOfISOWeek(dirtyDateLeft)\n var startOfISOWeekRight = startOfISOWeek(dirtyDateRight)\n\n var timestampLeft =\n startOfISOWeekLeft.getTime() -\n getTimezoneOffsetInMilliseconds(startOfISOWeekLeft)\n var timestampRight =\n startOfISOWeekRight.getTime() -\n getTimezoneOffsetInMilliseconds(startOfISOWeekRight)\n\n // Round the number of days to the nearest integer\n // because the number of milliseconds in a week is not constant\n // (e.g. it's different in the week of the daylight saving time clock shift)\n return Math.round((timestampLeft - timestampRight) / MILLISECONDS_IN_WEEK)\n}\n","import toDate from '../toDate/index.js'\n\n/**\n * @name differenceInCalendarMonths\n * @category Month Helpers\n * @summary Get the number of calendar months between the given dates.\n *\n * @description\n * Get the number of calendar months between the given dates.\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} dateLeft - the later date\n * @param {Date|Number} dateRight - the earlier date\n * @returns {Number} the number of calendar months\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // How many calendar months are between 31 January 2014 and 1 September 2014?\n * var result = differenceInCalendarMonths(\n * new Date(2014, 8, 1),\n * new Date(2014, 0, 31)\n * )\n * //=> 8\n */\nexport default function differenceInCalendarMonths(\n dirtyDateLeft,\n dirtyDateRight\n) {\n if (arguments.length < 2) {\n throw new TypeError(\n '2 arguments required, but only ' + arguments.length + ' present'\n )\n }\n\n var dateLeft = toDate(dirtyDateLeft)\n var dateRight = toDate(dirtyDateRight)\n\n var yearDiff = dateLeft.getFullYear() - dateRight.getFullYear()\n var monthDiff = dateLeft.getMonth() - dateRight.getMonth()\n\n return yearDiff * 12 + monthDiff\n}\n","import getQuarter from '../getQuarter/index.js'\nimport toDate from '../toDate/index.js'\n\n/**\n * @name differenceInCalendarQuarters\n * @category Quarter Helpers\n * @summary Get the number of calendar quarters between the given dates.\n *\n * @description\n * Get the number of calendar quarters between the given dates.\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} dateLeft - the later date\n * @param {Date|Number} dateRight - the earlier date\n * @returns {Number} the number of calendar quarters\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // How many calendar quarters are between 31 December 2013 and 2 July 2014?\n * var result = differenceInCalendarQuarters(\n * new Date(2014, 6, 2),\n * new Date(2013, 11, 31)\n * )\n * //=> 3\n */\nexport default function differenceInCalendarQuarters(\n dirtyDateLeft,\n dirtyDateRight\n) {\n if (arguments.length < 2) {\n throw new TypeError(\n '2 arguments required, but only ' + arguments.length + ' present'\n )\n }\n\n var dateLeft = toDate(dirtyDateLeft)\n var dateRight = toDate(dirtyDateRight)\n\n var yearDiff = dateLeft.getFullYear() - dateRight.getFullYear()\n var quarterDiff = getQuarter(dateLeft) - getQuarter(dateRight)\n\n return yearDiff * 4 + quarterDiff\n}\n","import getTimezoneOffsetInMilliseconds from '../_lib/getTimezoneOffsetInMilliseconds/index.js'\nimport startOfWeek from '../startOfWeek/index.js'\n\nvar MILLISECONDS_IN_WEEK = 604800000\n\n/**\n * @name differenceInCalendarWeeks\n * @category Week Helpers\n * @summary Get the number of calendar weeks between the given dates.\n *\n * @description\n * Get the number of calendar weeks between the given dates.\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} dateLeft - the later date\n * @param {Date|Number} dateRight - the earlier date\n * @param {Object} [options] - an object with options.\n * @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)\n * @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale}\n * @returns {Number} the number of calendar weeks\n * @throws {TypeError} 2 arguments required\n * @throws {RangeError} `options.weekStartsOn` must be between 0 and 6\n *\n * @example\n * // How many calendar weeks are between 5 July 2014 and 20 July 2014?\n * var result = differenceInCalendarWeeks(\n * new Date(2014, 6, 20),\n * new Date(2014, 6, 5)\n * )\n * //=> 3\n *\n * @example\n * // If the week starts on Monday,\n * // how many calendar weeks are between 5 July 2014 and 20 July 2014?\n * var result = differenceInCalendarWeeks(\n * new Date(2014, 6, 20),\n * new Date(2014, 6, 5),\n * { weekStartsOn: 1 }\n * )\n * //=> 2\n */\nexport default function differenceInCalendarWeeks(\n dirtyDateLeft,\n dirtyDateRight,\n dirtyOptions\n) {\n if (arguments.length < 2) {\n throw new TypeError(\n '2 arguments required, but only ' + arguments.length + ' present'\n )\n }\n\n var startOfWeekLeft = startOfWeek(dirtyDateLeft, dirtyOptions)\n var startOfWeekRight = startOfWeek(dirtyDateRight, dirtyOptions)\n\n var timestampLeft =\n startOfWeekLeft.getTime() - getTimezoneOffsetInMilliseconds(startOfWeekLeft)\n var timestampRight =\n startOfWeekRight.getTime() -\n getTimezoneOffsetInMilliseconds(startOfWeekRight)\n\n // Round the number of days to the nearest integer\n // because the number of milliseconds in a week is not constant\n // (e.g. it's different in the week of the daylight saving time clock shift)\n return Math.round((timestampLeft - timestampRight) / MILLISECONDS_IN_WEEK)\n}\n","import toDate from '../toDate/index.js'\n\n/**\n * @name differenceInCalendarYears\n * @category Year Helpers\n * @summary Get the number of calendar years between the given dates.\n *\n * @description\n * Get the number of calendar years between the given dates.\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} dateLeft - the later date\n * @param {Date|Number} dateRight - the earlier date\n * @returns {Number} the number of calendar years\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // How many calendar years are between 31 December 2013 and 11 February 2015?\n * var result = differenceInCalendarYears(\n * new Date(2015, 1, 11),\n * new Date(2013, 11, 31)\n * )\n * //=> 2\n */\nexport default function differenceInCalendarYears(\n dirtyDateLeft,\n dirtyDateRight\n) {\n if (arguments.length < 2) {\n throw new TypeError(\n '2 arguments required, but only ' + arguments.length + ' present'\n )\n }\n\n var dateLeft = toDate(dirtyDateLeft)\n var dateRight = toDate(dirtyDateRight)\n\n return dateLeft.getFullYear() - dateRight.getFullYear()\n}\n","import toDate from '../toDate/index.js'\nimport differenceInCalendarDays from '../differenceInCalendarDays/index.js'\nimport compareAsc from '../compareAsc/index.js'\n\n/**\n * @name differenceInDays\n * @category Day Helpers\n * @summary Get the number of full days between the given dates.\n *\n * @description\n * Get the number of full day periods between the given dates.\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} dateLeft - the later date\n * @param {Date|Number} dateRight - the earlier date\n * @returns {Number} the number of full days\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // How many full days are between\n * // 2 July 2011 23:00:00 and 2 July 2012 00:00:00?\n * var result = differenceInDays(\n * new Date(2012, 6, 2, 0, 0),\n * new Date(2011, 6, 2, 23, 0)\n * )\n * //=> 365\n * // How many days are between\n * // 2 July 2011 23:59:00 and 3 July 2011 00:01:00?\n * var result = differenceInDays(\n * new Date(2011, 6, 2, 0, 1),\n * new Date(2011, 6, 2, 23, 59)\n * )\n * //=> 0\n */\nexport default function differenceInDays(dirtyDateLeft, dirtyDateRight) {\n if (arguments.length < 2) {\n throw new TypeError(\n '2 arguments required, but only ' + arguments.length + ' present'\n )\n }\n\n var dateLeft = toDate(dirtyDateLeft)\n var dateRight = toDate(dirtyDateRight)\n\n var sign = compareAsc(dateLeft, dateRight)\n var difference = Math.abs(differenceInCalendarDays(dateLeft, dateRight))\n\n dateLeft.setDate(dateLeft.getDate() - sign * difference)\n\n // Math.abs(diff in full days - diff in calendar days) === 1 if last calendar day is not full\n // If so, result must be decreased by 1 in absolute value\n var isLastDayNotFull = compareAsc(dateLeft, dateRight) === -sign\n var result = sign * (difference - isLastDayNotFull)\n // Prevent negative zero\n return result === 0 ? 0 : result\n}\n","import differenceInMilliseconds from '../differenceInMilliseconds/index.js'\n\nvar MILLISECONDS_IN_HOUR = 3600000\n\n/**\n * @name differenceInHours\n * @category Hour Helpers\n * @summary Get the number of hours between the given dates.\n *\n * @description\n * Get the number of hours between the given dates.\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} dateLeft - the later date\n * @param {Date|Number} dateRight - the earlier date\n * @returns {Number} the number of hours\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // How many hours are between 2 July 2014 06:50:00 and 2 July 2014 19:00:00?\n * var result = differenceInHours(\n * new Date(2014, 6, 2, 19, 0),\n * new Date(2014, 6, 2, 6, 50)\n * )\n * //=> 12\n */\nexport default function differenceInHours(dirtyDateLeft, dirtyDateRight) {\n if (arguments.length < 2) {\n throw new TypeError(\n '2 arguments required, but only ' + arguments.length + ' present'\n )\n }\n\n var diff =\n differenceInMilliseconds(dirtyDateLeft, dirtyDateRight) /\n MILLISECONDS_IN_HOUR\n return diff > 0 ? Math.floor(diff) : Math.ceil(diff)\n}\n","import toDate from '../toDate/index.js'\nimport differenceInCalendarISOWeekYears from '../differenceInCalendarISOWeekYears/index.js'\nimport compareAsc from '../compareAsc/index.js'\nimport subISOWeekYears from '../subISOWeekYears/index.js'\n\n/**\n * @name differenceInISOWeekYears\n * @category ISO Week-Numbering Year Helpers\n * @summary Get the number of full ISO week-numbering years between the given dates.\n *\n * @description\n * Get the number of full ISO week-numbering years between the given dates.\n *\n * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * - The function was renamed from `differenceInISOYears` to `differenceInISOWeekYears`.\n * \"ISO week year\" is short for [ISO week-numbering year](https://en.wikipedia.org/wiki/ISO_week_date).\n * This change makes the name consistent with\n * locale-dependent week-numbering year helpers, e.g., `addWeekYears`.\n *\n * @param {Date|Number} dateLeft - the later date\n * @param {Date|Number} dateRight - the earlier date\n * @returns {Number} the number of full ISO week-numbering years\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // How many full ISO week-numbering years are between 1 January 2010 and 1 January 2012?\n * var result = differenceInISOWeekYears(\n * new Date(2012, 0, 1),\n * new Date(2010, 0, 1)\n * )\n * //=> 1\n */\nexport default function differenceInISOWeekYears(\n dirtyDateLeft,\n dirtyDateRight\n) {\n if (arguments.length < 2) {\n throw new TypeError(\n '2 arguments required, but only ' + arguments.length + ' present'\n )\n }\n\n var dateLeft = toDate(dirtyDateLeft)\n var dateRight = toDate(dirtyDateRight)\n\n var sign = compareAsc(dateLeft, dateRight)\n var difference = Math.abs(\n differenceInCalendarISOWeekYears(dateLeft, dateRight)\n )\n dateLeft = subISOWeekYears(dateLeft, sign * difference)\n\n // Math.abs(diff in full ISO years - diff in calendar ISO years) === 1\n // if last calendar ISO year is not full\n // If so, result must be decreased by 1 in absolute value\n var isLastISOWeekYearNotFull = compareAsc(dateLeft, dateRight) === -sign\n var result = sign * (difference - isLastISOWeekYearNotFull)\n // Prevent negative zero\n return result === 0 ? 0 : result\n}\n","import toDate from '../toDate/index.js'\n\n/**\n * @name differenceInMilliseconds\n * @category Millisecond Helpers\n * @summary Get the number of milliseconds between the given dates.\n *\n * @description\n * Get the number of milliseconds between the given dates.\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} dateLeft - the later date\n * @param {Date|Number} dateRight - the earlier date\n * @returns {Number} the number of milliseconds\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // How many milliseconds are between\n * // 2 July 2014 12:30:20.600 and 2 July 2014 12:30:21.700?\n * var result = differenceInMilliseconds(\n * new Date(2014, 6, 2, 12, 30, 21, 700),\n * new Date(2014, 6, 2, 12, 30, 20, 600)\n * )\n * //=> 1100\n */\nexport default function differenceInMilliseconds(\n dirtyDateLeft,\n dirtyDateRight\n) {\n if (arguments.length < 2) {\n throw new TypeError(\n '2 arguments required, but only ' + arguments.length + ' present'\n )\n }\n\n var dateLeft = toDate(dirtyDateLeft)\n var dateRight = toDate(dirtyDateRight)\n return dateLeft.getTime() - dateRight.getTime()\n}\n","import differenceInMilliseconds from '../differenceInMilliseconds/index.js'\n\nvar MILLISECONDS_IN_MINUTE = 60000\n\n/**\n * @name differenceInMinutes\n * @category Minute Helpers\n * @summary Get the number of minutes between the given dates.\n *\n * @description\n * Get the number of minutes between the given dates.\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} dateLeft - the later date\n * @param {Date|Number} dateRight - the earlier date\n * @returns {Number} the number of minutes\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // How many minutes are between 2 July 2014 12:07:59 and 2 July 2014 12:20:00?\n * var result = differenceInMinutes(\n * new Date(2014, 6, 2, 12, 20, 0),\n * new Date(2014, 6, 2, 12, 7, 59)\n * )\n * //=> 12\n */\nexport default function differenceInMinutes(dirtyDateLeft, dirtyDateRight) {\n if (arguments.length < 2) {\n throw new TypeError(\n '2 arguments required, but only ' + arguments.length + ' present'\n )\n }\n\n var diff =\n differenceInMilliseconds(dirtyDateLeft, dirtyDateRight) /\n MILLISECONDS_IN_MINUTE\n return diff > 0 ? Math.floor(diff) : Math.ceil(diff)\n}\n","import toDate from '../toDate/index.js'\nimport differenceInCalendarMonths from '../differenceInCalendarMonths/index.js'\nimport compareAsc from '../compareAsc/index.js'\n\n/**\n * @name differenceInMonths\n * @category Month Helpers\n * @summary Get the number of full months between the given dates.\n *\n * @description\n * Get the number of full months between the given dates.\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} dateLeft - the later date\n * @param {Date|Number} dateRight - the earlier date\n * @returns {Number} the number of full months\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // How many full months are between 31 January 2014 and 1 September 2014?\n * var result = differenceInMonths(new Date(2014, 8, 1), new Date(2014, 0, 31))\n * //=> 7\n */\nexport default function differenceInMonths(dirtyDateLeft, dirtyDateRight) {\n if (arguments.length < 2) {\n throw new TypeError(\n '2 arguments required, but only ' + arguments.length + ' present'\n )\n }\n\n var dateLeft = toDate(dirtyDateLeft)\n var dateRight = toDate(dirtyDateRight)\n\n var sign = compareAsc(dateLeft, dateRight)\n var difference = Math.abs(differenceInCalendarMonths(dateLeft, dateRight))\n dateLeft.setMonth(dateLeft.getMonth() - sign * difference)\n\n // Math.abs(diff in full months - diff in calendar months) === 1 if last calendar month is not full\n // If so, result must be decreased by 1 in absolute value\n var isLastMonthNotFull = compareAsc(dateLeft, dateRight) === -sign\n var result = sign * (difference - isLastMonthNotFull)\n // Prevent negative zero\n return result === 0 ? 0 : result\n}\n","import differenceInMonths from '../differenceInMonths/index.js'\n\n/**\n * @name differenceInQuarters\n * @category Quarter Helpers\n * @summary Get the number of full quarters between the given dates.\n *\n * @description\n * Get the number of full quarters between the given dates.\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} dateLeft - the later date\n * @param {Date|Number} dateRight - the earlier date\n * @returns {Number} the number of full quarters\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // How many full quarters are between 31 December 2013 and 2 July 2014?\n * var result = differenceInQuarters(new Date(2014, 6, 2), new Date(2013, 11, 31))\n * //=> 2\n */\nexport default function differenceInQuarters(dirtyDateLeft, dirtyDateRight) {\n if (arguments.length < 2) {\n throw new TypeError(\n '2 arguments required, but only ' + arguments.length + ' present'\n )\n }\n\n var diff = differenceInMonths(dirtyDateLeft, dirtyDateRight) / 3\n return diff > 0 ? Math.floor(diff) : Math.ceil(diff)\n}\n","import differenceInMilliseconds from '../differenceInMilliseconds/index.js'\n\n/**\n * @name differenceInSeconds\n * @category Second Helpers\n * @summary Get the number of seconds between the given dates.\n *\n * @description\n * Get the number of seconds between the given dates.\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} dateLeft - the later date\n * @param {Date|Number} dateRight - the earlier date\n * @returns {Number} the number of seconds\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // How many seconds are between\n * // 2 July 2014 12:30:07.999 and 2 July 2014 12:30:20.000?\n * var result = differenceInSeconds(\n * new Date(2014, 6, 2, 12, 30, 20, 0),\n * new Date(2014, 6, 2, 12, 30, 7, 999)\n * )\n * //=> 12\n */\nexport default function differenceInSeconds(dirtyDateLeft, dirtyDateRight) {\n if (arguments.length < 2) {\n throw new TypeError(\n '2 arguments required, but only ' + arguments.length + ' present'\n )\n }\n\n var diff = differenceInMilliseconds(dirtyDateLeft, dirtyDateRight) / 1000\n return diff > 0 ? Math.floor(diff) : Math.ceil(diff)\n}\n","import differenceInDays from '../differenceInDays/index.js'\n\n/**\n * @name differenceInWeeks\n * @category Week Helpers\n * @summary Get the number of full weeks between the given dates.\n *\n * @description\n * Get the number of full weeks between the given dates.\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} dateLeft - the later date\n * @param {Date|Number} dateRight - the earlier date\n * @returns {Number} the number of full weeks\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // How many full weeks are between 5 July 2014 and 20 July 2014?\n * var result = differenceInWeeks(new Date(2014, 6, 20), new Date(2014, 6, 5))\n * //=> 2\n */\nexport default function differenceInWeeks(dirtyDateLeft, dirtyDateRight) {\n if (arguments.length < 2) {\n throw new TypeError(\n '2 arguments required, but only ' + arguments.length + ' present'\n )\n }\n\n var diff = differenceInDays(dirtyDateLeft, dirtyDateRight) / 7\n return diff > 0 ? Math.floor(diff) : Math.ceil(diff)\n}\n","import toDate from '../toDate/index.js'\nimport differenceInCalendarYears from '../differenceInCalendarYears/index.js'\nimport compareAsc from '../compareAsc/index.js'\n\n/**\n * @name differenceInYears\n * @category Year Helpers\n * @summary Get the number of full years between the given dates.\n *\n * @description\n * Get the number of full years between the given dates.\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} dateLeft - the later date\n * @param {Date|Number} dateRight - the earlier date\n * @returns {Number} the number of full years\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // How many full years are between 31 December 2013 and 11 February 2015?\n * var result = differenceInYears(new Date(2015, 1, 11), new Date(2013, 11, 31))\n * //=> 1\n */\nexport default function differenceInYears(dirtyDateLeft, dirtyDateRight) {\n if (arguments.length < 2) {\n throw new TypeError(\n '2 arguments required, but only ' + arguments.length + ' present'\n )\n }\n\n var dateLeft = toDate(dirtyDateLeft)\n var dateRight = toDate(dirtyDateRight)\n\n var sign = compareAsc(dateLeft, dateRight)\n var difference = Math.abs(differenceInCalendarYears(dateLeft, dateRight))\n dateLeft.setFullYear(dateLeft.getFullYear() - sign * difference)\n\n // Math.abs(diff in full years - diff in calendar years) === 1 if last calendar year is not full\n // If so, result must be decreased by 1 in absolute value\n var isLastYearNotFull = compareAsc(dateLeft, dateRight) === -sign\n var result = sign * (difference - isLastYearNotFull)\n // Prevent negative zero\n return result === 0 ? 0 : result\n}\n","import toDate from '../toDate/index.js'\n\n/**\n * @name eachDayOfInterval\n * @category Interval Helpers\n * @summary Return the array of dates within the specified time interval.\n *\n * @description\n * Return the array of dates within the specified time interval.\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * - The function was renamed from `eachDay` to `eachDayOfInterval`.\n * This change was made to mirror the use of the word \"interval\" in standard ISO 8601:2004 terminology:\n *\n * ```\n * 2.1.3\n * time interval\n * part of the time axis limited by two instants\n * ```\n *\n * Also, this function now accepts an object with `start` and `end` properties\n * instead of two arguments as an interval.\n * This function now throws `RangeError` if the start of the interval is after its end\n * or if any date in the interval is `Invalid Date`.\n *\n * ```javascript\n * // Before v2.0.0\n *\n * eachDay(new Date(2014, 0, 10), new Date(2014, 0, 20))\n *\n * // v2.0.0 onward\n *\n * eachDayOfInterval(\n * { start: new Date(2014, 0, 10), end: new Date(2014, 0, 20) }\n * )\n * ```\n *\n * @param {Interval} interval - the interval. See [Interval]{@link docs/types/Interval}\n * @param {Object} [options] - an object with options.\n * @param {Number} [options.step=1] - the step to increment by. The value should be more than 1.\n * @returns {Date[]} the array with starts of days from the day of the interval start to the day of the interval end\n * @throws {TypeError} 1 argument required\n * @throws {RangeError} `options.step` must be a number greater than 1\n * @throws {RangeError} The start of an interval cannot be after its end\n * @throws {RangeError} Date in interval cannot be `Invalid Date`\n *\n * @example\n * // Each day between 6 October 2014 and 10 October 2014:\n * var result = eachDayOfInterval({\n * start: new Date(2014, 9, 6),\n * end: new Date(2014, 9, 10)\n * })\n * //=> [\n * // Mon Oct 06 2014 00:00:00,\n * // Tue Oct 07 2014 00:00:00,\n * // Wed Oct 08 2014 00:00:00,\n * // Thu Oct 09 2014 00:00:00,\n * // Fri Oct 10 2014 00:00:00\n * // ]\n */\nexport default function eachDayOfInterval(dirtyInterval, options) {\n if (arguments.length < 1) {\n throw new TypeError(\n '1 argument required, but only ' + arguments.length + ' present'\n )\n }\n\n var interval = dirtyInterval || {}\n var startDate = toDate(interval.start)\n var endDate = toDate(interval.end)\n\n var endTime = endDate.getTime()\n\n // Throw an exception if start date is after end date or if any date is `Invalid Date`\n if (!(startDate.getTime() <= endTime)) {\n throw new RangeError('Invalid interval')\n }\n\n var dates = []\n\n var currentDate = startDate\n currentDate.setHours(0, 0, 0, 0)\n\n var step = options && 'step' in options ? Number(options.step) : 1\n if (step < 1 || isNaN(step))\n throw new RangeError('`options.step` must be a number greater than 1')\n\n while (currentDate.getTime() <= endTime) {\n dates.push(toDate(currentDate))\n currentDate.setDate(currentDate.getDate() + step)\n currentDate.setHours(0, 0, 0, 0)\n }\n\n return dates\n}\n","import toDate from '../toDate/index.js'\nimport startOfWeek from '../startOfWeek/index.js'\nimport addWeeks from '../addWeeks/index.js'\n\n/**\n * @name eachWeekOfInterval\n * @category Interval Helpers\n * @summary Return the array of weeks within the specified time interval.\n *\n * @description\n * Return the array of weeks within the specified time interval.\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Interval} interval - the interval. See [Interval]{@link docs/types/Interval}\n * @param {Object} [options] - an object with options.\n * @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)\n * @returns {Date[]} the array with starts of weeks from the week of the interval start to the week of the interval end\n * @throws {TypeError} 1 argument required\n * @throws {RangeError} `options.weekStartsOn` must be 0, 1, ..., 6\n * @throws {RangeError} The start of an interval cannot be after its end\n * @throws {RangeError} Date in interval cannot be `Invalid Date`\n *\n * @example\n * // Each week within interval 6 October 2014 - 23 November 2014:\n * var result = eachWeekOfInterval({\n * start: new Date(2014, 9, 6),\n * end: new Date(2014, 10, 23)\n * })\n * //=> [\n * // Sun Oct 05 2014 00:00:00,\n * // Sun Oct 12 2014 00:00:00,\n * // Sun Oct 19 2014 00:00:00,\n * // Sun Oct 26 2014 00:00:00,\n * // Sun Nov 02 2014 00:00:00,\n * // Sun Nov 09 2014 00:00:00,\n * // Sun Nov 16 2014 00:00:00,\n * // Sun Nov 23 2014 00:00:00\n * // ]\n */\nexport default function eachWeekOfInterval(dirtyInterval, options) {\n if (arguments.length < 1) {\n throw new TypeError(\n '1 argument required, but only ' + arguments.length + ' present'\n )\n }\n\n var interval = dirtyInterval || {}\n var startDate = toDate(interval.start)\n var endDate = toDate(interval.end)\n\n var endTime = endDate.getTime()\n\n // Throw an exception if start date is after end date or if any date is `Invalid Date`\n if (!(startDate.getTime() <= endTime)) {\n throw new RangeError('Invalid interval')\n }\n\n var startDateWeek = startOfWeek(startDate, options)\n var endDateWeek = startOfWeek(endDate, options)\n\n // Some timezones switch DST at midnight, making start of day unreliable in these timezones, 3pm is a safe bet\n startDateWeek.setHours(15)\n endDateWeek.setHours(15)\n\n endTime = endDateWeek.getTime()\n\n var weeks = []\n\n var currentWeek = startDateWeek\n\n while (currentWeek.getTime() <= endTime) {\n currentWeek.setHours(0)\n weeks.push(toDate(currentWeek))\n currentWeek = addWeeks(currentWeek, 1)\n currentWeek.setHours(15)\n }\n\n return weeks\n}\n","import eachDayOfInterval from '../eachDayOfInterval/index.js'\nimport isSunday from '../isSunday/index.js'\nimport isWeekend from '../isWeekend/index.js'\n\n/**\n * @name eachWeekendOfInterval\n * @category Interval Helpers\n * @summary List all the Saturdays and Sundays in the given date interval.\n *\n * @description\n * Get all the Saturdays and Sundays in the given date interval.\n *\n * @param {Interval} interval - the given interval. See [Interval]{@link docs/types/Interval}\n * @returns {Date[]} an array containing all the Saturdays and Sundays\n * @throws {TypeError} 1 argument required\n * @throws {RangeError} The start of an interval cannot be after its end\n * @throws {RangeError} Date in interval cannot be `Invalid Date`\n *\n * @example\n * // Lists all Saturdays and Sundays in the given date interval\n * var result = eachWeekendOfInterval({\n * start: new Date(2018, 8, 17),\n * end: new Date(2018, 8, 30)\n * })\n * //=> [\n * // Sat Sep 22 2018 00:00:00,\n * // Sun Sep 23 2018 00:00:00,\n * // Sat Sep 29 2018 00:00:00,\n * // Sun Sep 30 2018 00:00:00\n * // ]\n */\nexport default function eachWeekendOfInterval(interval) {\n if (arguments.length < 1) {\n throw new TypeError(\n '1 argument required, but only ' + arguments.length + ' present'\n )\n }\n\n var dateInterval = eachDayOfInterval(interval)\n var weekends = []\n var index = 0\n while (index++ < dateInterval.length) {\n var date = dateInterval[index]\n if (isWeekend(date)) {\n weekends.push(date)\n if (isSunday(date)) index = index + 5\n }\n }\n return weekends\n}\n","import eachWeekendOfInterval from '../eachWeekendOfInterval/index.js'\nimport startOfMonth from '../startOfMonth/index.js'\nimport endOfMonth from '../endOfMonth/index.js'\n\n/**\n * @name eachWeekendOfMonth\n * @category Month Helpers\n * @summary List all the Saturdays and Sundays in the given month.\n *\n * @description\n * Get all the Saturdays and Sundays in the given month.\n *\n * @param {Date|Number} date - the given month\n * @returns {Date[]} an array containing all the Saturdays and Sundays\n * @throws {TypeError} 1 argument required\n * @throws {RangeError} The passed date is invalid\n *\n * @example\n * // Lists all Saturdays and Sundays in the given month\n * var result = eachWeekendOfMonth(new Date(2022, 1, 1))\n * //=> [\n * // Sat Feb 05 2022 00:00:00,\n * // Sun Feb 06 2022 00:00:00,\n * // Sat Feb 12 2022 00:00:00,\n * // Sun Feb 13 2022 00:00:00,\n * // Sat Feb 19 2022 00:00:00,\n * // Sun Feb 20 2022 00:00:00,\n * // Sat Feb 26 2022 00:00:00,\n * // Sun Feb 27 2022 00:00:00\n * // ]\n */\nexport default function eachWeekendOfMonth(dirtyDate) {\n if (arguments.length < 1) {\n throw new TypeError(\n '1 arguments required, but only ' + arguments.length + ' present'\n )\n }\n\n var startDate = startOfMonth(dirtyDate)\n if (isNaN(startDate)) throw new RangeError('The passed date is invalid')\n\n var endDate = endOfMonth(dirtyDate)\n return eachWeekendOfInterval({ start: startDate, end: endDate })\n}\n","import eachWeekendOfInterval from '../eachWeekendOfInterval/index.js'\nimport startOfYear from '../startOfYear/index.js'\nimport endOfYear from '../endOfYear/index.js'\n\n/**\n * @name eachWeekendOfYear\n * @category Year Helpers\n * @summary List all the Saturdays and Sundays in the year.\n *\n * @description\n * Get all the Saturdays and Sundays in the year.\n *\n * @param {Date|Number} date - the given year\n * @returns {Date[]} an array containing all the Saturdays and Sundays\n * @throws {TypeError} 1 argument required\n * @throws {RangeError} The passed date is invalid\n *\n * @example\n * // Lists all Saturdays and Sundays in the year\n * var result = eachWeekendOfYear(new Date(2020, 1, 1))\n * //=> [\n * // Sat Jan 03 2020 00:00:00,\n * // Sun Jan 04 2020 00:00:00,\n * // ...\n * // Sun Dec 27 2020 00:00:00\n * // ]\n * ]\n */\nexport default function eachWeekendOfYear(dirtyDate) {\n if (arguments.length < 1) {\n throw new TypeError(\n '1 arguments required, but only ' + arguments.length + ' present'\n )\n }\n\n var startDate = startOfYear(dirtyDate)\n if (isNaN(startDate)) throw new RangeError('The passed date is invalid')\n\n var endDate = endOfYear(dirtyDate)\n return eachWeekendOfInterval({ start: startDate, end: endDate })\n}\n","import toDate from '../toDate/index.js'\n\n/**\n * @name endOfDay\n * @category Day Helpers\n * @summary Return the end of a day for the given date.\n *\n * @description\n * Return the end of a day for the given date.\n * The result will be in the local timezone.\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} date - the original date\n * @returns {Date} the end of a day\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // The end of a day for 2 September 2014 11:55:00:\n * var result = endOfDay(new Date(2014, 8, 2, 11, 55, 0))\n * //=> Tue Sep 02 2014 23:59:59.999\n */\nexport default function endOfDay(dirtyDate) {\n if (arguments.length < 1) {\n throw new TypeError(\n '1 argument required, but only ' + arguments.length + ' present'\n )\n }\n\n var date = toDate(dirtyDate)\n date.setHours(23, 59, 59, 999)\n return date\n}\n","import toDate from '../toDate/index.js'\n\n/**\n * @name endOfDecade\n * @category Decade Helpers\n * @summary Return the end of a decade for the given date.\n *\n * @description\n * Return the end of a decade for the given date.\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} date - the original date\n * @returns {Date} the end of a decade\n * @param {Object} [options] - an object with options.\n * @param {0|1|2} [options.additionalDigits=2] - passed to `toDate`. See [toDate]{@link https://date-fns.org/docs/toDate}\n * @throws {TypeError} 1 argument required\n * @throws {RangeError} `options.additionalDigits` must be 0, 1 or 2\n *\n * @example\n * // The end of a decade for 12 May 1984 00:00:00:\n * var result = endOfDecade(new Date(1984, 4, 12, 00, 00, 00))\n * //=> Dec 31 1989 23:59:59.999\n */\nexport default function endOfDecade(dirtyDate) {\n if (arguments.length < 1) {\n throw new TypeError(\n '1 argument required, but only ' + arguments.length + ' present'\n )\n }\n\n var date = toDate(dirtyDate)\n var year = date.getFullYear()\n var decade = 9 + Math.floor(year / 10) * 10\n date.setFullYear(decade, 11, 31)\n date.setHours(23, 59, 59, 999)\n return date\n}\n","import toDate from '../toDate/index.js'\n\n/**\n * @name endOfHour\n * @category Hour Helpers\n * @summary Return the end of an hour for the given date.\n *\n * @description\n * Return the end of an hour for the given date.\n * The result will be in the local timezone.\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} date - the original date\n * @returns {Date} the end of an hour\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // The end of an hour for 2 September 2014 11:55:00:\n * var result = endOfHour(new Date(2014, 8, 2, 11, 55))\n * //=> Tue Sep 02 2014 11:59:59.999\n */\nexport default function endOfHour(dirtyDate) {\n if (arguments.length < 1) {\n throw new TypeError(\n '1 argument required, but only ' + arguments.length + ' present'\n )\n }\n\n var date = toDate(dirtyDate)\n date.setMinutes(59, 59, 999)\n return date\n}\n","import endOfWeek from '../endOfWeek/index.js'\n\n/**\n * @name endOfISOWeek\n * @category ISO Week Helpers\n * @summary Return the end of an ISO week for the given date.\n *\n * @description\n * Return the end of an ISO week for the given date.\n * The result will be in the local timezone.\n *\n * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} date - the original date\n * @returns {Date} the end of an ISO week\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // The end of an ISO week for 2 September 2014 11:55:00:\n * var result = endOfISOWeek(new Date(2014, 8, 2, 11, 55, 0))\n * //=> Sun Sep 07 2014 23:59:59.999\n */\nexport default function endOfISOWeek(dirtyDate) {\n if (arguments.length < 1) {\n throw new TypeError(\n '1 argument required, but only ' + arguments.length + ' present'\n )\n }\n\n return endOfWeek(dirtyDate, { weekStartsOn: 1 })\n}\n","import getISOWeekYear from '../getISOWeekYear/index.js'\nimport startOfISOWeek from '../startOfISOWeek/index.js'\n\n/**\n * @name endOfISOWeekYear\n * @category ISO Week-Numbering Year Helpers\n * @summary Return the end of an ISO week-numbering year for the given date.\n *\n * @description\n * Return the end of an ISO week-numbering year,\n * which always starts 3 days before the year's first Thursday.\n * The result will be in the local timezone.\n *\n * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * - The function was renamed from `endOfISOYear` to `endOfISOWeekYear`.\n * \"ISO week year\" is short for [ISO week-numbering year](https://en.wikipedia.org/wiki/ISO_week_date).\n * This change makes the name consistent with\n * locale-dependent week-numbering year helpers, e.g., `addWeekYears`.\n *\n * @param {Date|Number} date - the original date\n * @returns {Date} the end of an ISO week-numbering year\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // The end of an ISO week-numbering year for 2 July 2005:\n * var result = endOfISOWeekYear(new Date(2005, 6, 2))\n * //=> Sun Jan 01 2006 23:59:59.999\n */\nexport default function endOfISOWeekYear(dirtyDate) {\n if (arguments.length < 1) {\n throw new TypeError(\n '1 argument required, but only ' + arguments.length + ' present'\n )\n }\n\n var year = getISOWeekYear(dirtyDate)\n var fourthOfJanuaryOfNextYear = new Date(0)\n fourthOfJanuaryOfNextYear.setFullYear(year + 1, 0, 4)\n fourthOfJanuaryOfNextYear.setHours(0, 0, 0, 0)\n var date = startOfISOWeek(fourthOfJanuaryOfNextYear)\n date.setMilliseconds(date.getMilliseconds() - 1)\n return date\n}\n","import toDate from '../toDate/index.js'\n\n/**\n * @name endOfMinute\n * @category Minute Helpers\n * @summary Return the end of a minute for the given date.\n *\n * @description\n * Return the end of a minute for the given date.\n * The result will be in the local timezone.\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} date - the original date\n * @returns {Date} the end of a minute\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // The end of a minute for 1 December 2014 22:15:45.400:\n * var result = endOfMinute(new Date(2014, 11, 1, 22, 15, 45, 400))\n * //=> Mon Dec 01 2014 22:15:59.999\n */\nexport default function endOfMinute(dirtyDate) {\n if (arguments.length < 1) {\n throw new TypeError(\n '1 argument required, but only ' + arguments.length + ' present'\n )\n }\n\n var date = toDate(dirtyDate)\n date.setSeconds(59, 999)\n return date\n}\n","import toDate from '../toDate/index.js'\n\n/**\n * @name endOfMonth\n * @category Month Helpers\n * @summary Return the end of a month for the given date.\n *\n * @description\n * Return the end of a month for the given date.\n * The result will be in the local timezone.\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} date - the original date\n * @returns {Date} the end of a month\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // The end of a month for 2 September 2014 11:55:00:\n * var result = endOfMonth(new Date(2014, 8, 2, 11, 55, 0))\n * //=> Tue Sep 30 2014 23:59:59.999\n */\nexport default function endOfMonth(dirtyDate) {\n if (arguments.length < 1) {\n throw new TypeError(\n '1 argument required, but only ' + arguments.length + ' present'\n )\n }\n\n var date = toDate(dirtyDate)\n var month = date.getMonth()\n date.setFullYear(date.getFullYear(), month + 1, 0)\n date.setHours(23, 59, 59, 999)\n return date\n}\n","import toDate from '../toDate/index.js'\n\n/**\n * @name endOfQuarter\n * @category Quarter Helpers\n * @summary Return the end of a year quarter for the given date.\n *\n * @description\n * Return the end of a year quarter for the given date.\n * The result will be in the local timezone.\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} date - the original date\n * @returns {Date} the end of a quarter\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // The end of a quarter for 2 September 2014 11:55:00:\n * var result = endOfQuarter(new Date(2014, 8, 2, 11, 55, 0))\n * //=> Tue Sep 30 2014 23:59:59.999\n */\nexport default function endOfQuarter(dirtyDate) {\n if (arguments.length < 1) {\n throw new TypeError(\n '1 argument required, but only ' + arguments.length + ' present'\n )\n }\n\n var date = toDate(dirtyDate)\n var currentMonth = date.getMonth()\n var month = currentMonth - (currentMonth % 3) + 3\n date.setMonth(month, 0)\n date.setHours(23, 59, 59, 999)\n return date\n}\n","import toDate from '../toDate/index.js'\n\n/**\n * @name endOfSecond\n * @category Second Helpers\n * @summary Return the end of a second for the given date.\n *\n * @description\n * Return the end of a second for the given date.\n * The result will be in the local timezone.\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} date - the original date\n * @returns {Date} the end of a second\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // The end of a second for 1 December 2014 22:15:45.400:\n * var result = endOfSecond(new Date(2014, 11, 1, 22, 15, 45, 400))\n * //=> Mon Dec 01 2014 22:15:45.999\n */\nexport default function endOfSecond(dirtyDate) {\n if (arguments.length < 1) {\n throw new TypeError(\n '1 argument required, but only ' + arguments.length + ' present'\n )\n }\n\n var date = toDate(dirtyDate)\n date.setMilliseconds(999)\n return date\n}\n","import toInteger from '../_lib/toInteger/index.js'\nimport toDate from '../toDate/index.js'\n\n/**\n * @name endOfWeek\n * @category Week Helpers\n * @summary Return the end of a week for the given date.\n *\n * @description\n * Return the end of a week for the given date.\n * The result will be in the local timezone.\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} date - the original date\n * @param {Object} [options] - an object with options.\n * @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)\n * @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale}\n * @returns {Date} the end of a week\n * @throws {TypeError} 1 argument required\n * @throws {RangeError} `options.weekStartsOn` must be between 0 and 6\n *\n * @example\n * // The end of a week for 2 September 2014 11:55:00:\n * var result = endOfWeek(new Date(2014, 8, 2, 11, 55, 0))\n * //=> Sat Sep 06 2014 23:59:59.999\n *\n * @example\n * // If the week starts on Monday, the end of the week for 2 September 2014 11:55:00:\n * var result = endOfWeek(new Date(2014, 8, 2, 11, 55, 0), { weekStartsOn: 1 })\n * //=> Sun Sep 07 2014 23:59:59.999\n */\nexport default function endOfWeek(dirtyDate, dirtyOptions) {\n if (arguments.length < 1) {\n throw new TypeError(\n '1 argument required, but only ' + arguments.length + ' present'\n )\n }\n\n var options = dirtyOptions || {}\n\n var locale = options.locale\n var localeWeekStartsOn =\n locale && locale.options && locale.options.weekStartsOn\n var defaultWeekStartsOn =\n localeWeekStartsOn == null ? 0 : toInteger(localeWeekStartsOn)\n var weekStartsOn =\n options.weekStartsOn == null\n ? defaultWeekStartsOn\n : toInteger(options.weekStartsOn)\n\n // Test if weekStartsOn is between 0 and 6 _and_ is not NaN\n if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {\n throw new RangeError('weekStartsOn must be between 0 and 6 inclusively')\n }\n\n var date = toDate(dirtyDate)\n var day = date.getDay()\n var diff = (day < weekStartsOn ? -7 : 0) + 6 - (day - weekStartsOn)\n\n date.setDate(date.getDate() + diff)\n date.setHours(23, 59, 59, 999)\n return date\n}\n","import toDate from '../toDate/index.js'\n\n/**\n * @name endOfYear\n * @category Year Helpers\n * @summary Return the end of a year for the given date.\n *\n * @description\n * Return the end of a year for the given date.\n * The result will be in the local timezone.\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} date - the original date\n * @returns {Date} the end of a year\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // The end of a year for 2 September 2014 11:55:00:\n * var result = endOfYear(new Date(2014, 8, 2, 11, 55, 00))\n * //=> Wed Dec 31 2014 23:59:59.999\n */\nexport default function endOfYear(dirtyDate) {\n if (arguments.length < 1) {\n throw new TypeError(\n '1 argument required, but only ' + arguments.length + ' present'\n )\n }\n\n var date = toDate(dirtyDate)\n var year = date.getFullYear()\n date.setFullYear(year + 1, 0, 0)\n date.setHours(23, 59, 59, 999)\n return date\n}\n","import toInteger from '../_lib/toInteger/index.js'\nimport getTimezoneOffsetInMilliseconds from '../_lib/getTimezoneOffsetInMilliseconds/index.js'\nimport toDate from '../toDate/index.js'\nimport isValid from '../isValid/index.js'\nimport defaultLocale from '../locale/en-US/index.js'\nimport formatters from '../_lib/format/formatters/index.js'\nimport longFormatters from '../_lib/format/longFormatters/index.js'\nimport subMilliseconds from '../subMilliseconds/index.js'\nimport {\n isProtectedToken,\n throwProtectedError\n} from '../_lib/protectedTokens/index.js'\n\n// This RegExp consists of three parts separated by `|`:\n// - [yYQqMLwIdDecihHKkms]o matches any available ordinal number token\n// (one of the certain letters followed by `o`)\n// - (\\w)\\1* matches any sequences of the same letter\n// - '' matches two quote characters in a row\n// - '(''|[^'])+('|$) matches anything surrounded by two quote characters ('),\n// except a single quote symbol, which ends the sequence.\n// Two quote characters do not end the sequence.\n// If there is no matching single quote\n// then the sequence will continue until the end of the string.\n// - . matches any single character unmatched by previous parts of the RegExps\nvar formattingTokensRegExp = /[yYQqMLwIdDecihHKkms]o|(\\w)\\1*|''|'(''|[^'])+('|$)|./g\n\n// This RegExp catches symbols escaped by quotes, and also\n// sequences of symbols P, p, and the combinations like `PPPPPPPppppp`\nvar longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g\n\nvar escapedStringRegExp = /^'(.*?)'?$/\nvar doubleQuoteRegExp = /''/g\n\n/**\n * @name format\n * @category Common Helpers\n * @summary Format the date.\n *\n * @description\n * Return the formatted date string in the given format. The result may vary by locale.\n *\n * > âš ï¸ Please note that the `format` tokens differ from Moment.js and other libraries.\n * > See: https://git.io/fxCyr\n *\n * The characters wrapped between two single quotes characters (') are escaped.\n * Two single quotes in a row, whether inside or outside a quoted sequence, represent a 'real' single quote.\n * (see the last example)\n *\n * Format of the string is based on Unicode Technical Standard #35:\n * https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table\n * with a few additions (see note 7 below the table).\n *\n * Accepted patterns:\n * | Unit | Pattern | Result examples | Notes |\n * |---------------------------------|---------|-----------------------------------|-------|\n * | Era | G..GGG | AD, BC | |\n * | | GGGG | Anno Domini, Before Christ | 2 |\n * | | GGGGG | A, B | |\n * | Calendar year | y | 44, 1, 1900, 2017 | 5 |\n * | | yo | 44th, 1st, 0th, 17th | 5,7 |\n * | | yy | 44, 01, 00, 17 | 5 |\n * | | yyy | 044, 001, 1900, 2017 | 5 |\n * | | yyyy | 0044, 0001, 1900, 2017 | 5 |\n * | | yyyyy | ... | 3,5 |\n * | Local week-numbering year | Y | 44, 1, 1900, 2017 | 5 |\n * | | Yo | 44th, 1st, 1900th, 2017th | 5,7 |\n * | | YY | 44, 01, 00, 17 | 5,8 |\n * | | YYY | 044, 001, 1900, 2017 | 5 |\n * | | YYYY | 0044, 0001, 1900, 2017 | 5,8 |\n * | | YYYYY | ... | 3,5 |\n * | ISO week-numbering year | R | -43, 0, 1, 1900, 2017 | 5,7 |\n * | | RR | -43, 00, 01, 1900, 2017 | 5,7 |\n * | | RRR | -043, 000, 001, 1900, 2017 | 5,7 |\n * | | RRRR | -0043, 0000, 0001, 1900, 2017 | 5,7 |\n * | | RRRRR | ... | 3,5,7 |\n * | Extended year | u | -43, 0, 1, 1900, 2017 | 5 |\n * | | uu | -43, 01, 1900, 2017 | 5 |\n * | | uuu | -043, 001, 1900, 2017 | 5 |\n * | | uuuu | -0043, 0001, 1900, 2017 | 5 |\n * | | uuuuu | ... | 3,5 |\n * | Quarter (formatting) | Q | 1, 2, 3, 4 | |\n * | | Qo | 1st, 2nd, 3rd, 4th | 7 |\n * | | QQ | 01, 02, 03, 04 | |\n * | | QQQ | Q1, Q2, Q3, Q4 | |\n * | | QQQQ | 1st quarter, 2nd quarter, ... | 2 |\n * | | QQQQQ | 1, 2, 3, 4 | 4 |\n * | Quarter (stand-alone) | q | 1, 2, 3, 4 | |\n * | | qo | 1st, 2nd, 3rd, 4th | 7 |\n * | | qq | 01, 02, 03, 04 | |\n * | | qqq | Q1, Q2, Q3, Q4 | |\n * | | qqqq | 1st quarter, 2nd quarter, ... | 2 |\n * | | qqqqq | 1, 2, 3, 4 | 4 |\n * | Month (formatting) | M | 1, 2, ..., 12 | |\n * | | Mo | 1st, 2nd, ..., 12th | 7 |\n * | | MM | 01, 02, ..., 12 | |\n * | | MMM | Jan, Feb, ..., Dec | |\n * | | MMMM | January, February, ..., December | 2 |\n * | | MMMMM | J, F, ..., D | |\n * | Month (stand-alone) | L | 1, 2, ..., 12 | |\n * | | Lo | 1st, 2nd, ..., 12th | 7 |\n * | | LL | 01, 02, ..., 12 | |\n * | | LLL | Jan, Feb, ..., Dec | |\n * | | LLLL | January, February, ..., December | 2 |\n * | | LLLLL | J, F, ..., D | |\n * | Local week of year | w | 1, 2, ..., 53 | |\n * | | wo | 1st, 2nd, ..., 53th | 7 |\n * | | ww | 01, 02, ..., 53 | |\n * | ISO week of year | I | 1, 2, ..., 53 | 7 |\n * | | Io | 1st, 2nd, ..., 53th | 7 |\n * | | II | 01, 02, ..., 53 | 7 |\n * | Day of month | d | 1, 2, ..., 31 | |\n * | | do | 1st, 2nd, ..., 31st | 7 |\n * | | dd | 01, 02, ..., 31 | |\n * | Day of year | D | 1, 2, ..., 365, 366 | 8 |\n * | | Do | 1st, 2nd, ..., 365th, 366th | 7 |\n * | | DD | 01, 02, ..., 365, 366 | 8 |\n * | | DDD | 001, 002, ..., 365, 366 | |\n * | | DDDD | ... | 3 |\n * | Day of week (formatting) | E..EEE | Mon, Tue, Wed, ..., Su | |\n * | | EEEE | Monday, Tuesday, ..., Sunday | 2 |\n * | | EEEEE | M, T, W, T, F, S, S | |\n * | | EEEEEE | Mo, Tu, We, Th, Fr, Su, Sa | |\n * | ISO day of week (formatting) | i | 1, 2, 3, ..., 7 | 7 |\n * | | io | 1st, 2nd, ..., 7th | 7 |\n * | | ii | 01, 02, ..., 07 | 7 |\n * | | iii | Mon, Tue, Wed, ..., Su | 7 |\n * | | iiii | Monday, Tuesday, ..., Sunday | 2,7 |\n * | | iiiii | M, T, W, T, F, S, S | 7 |\n * | | iiiiii | Mo, Tu, We, Th, Fr, Su, Sa | 7 |\n * | Local day of week (formatting) | e | 2, 3, 4, ..., 1 | |\n * | | eo | 2nd, 3rd, ..., 1st | 7 |\n * | | ee | 02, 03, ..., 01 | |\n * | | eee | Mon, Tue, Wed, ..., Su | |\n * | | eeee | Monday, Tuesday, ..., Sunday | 2 |\n * | | eeeee | M, T, W, T, F, S, S | |\n * | | eeeeee | Mo, Tu, We, Th, Fr, Su, Sa | |\n * | Local day of week (stand-alone) | c | 2, 3, 4, ..., 1 | |\n * | | co | 2nd, 3rd, ..., 1st | 7 |\n * | | cc | 02, 03, ..., 01 | |\n * | | ccc | Mon, Tue, Wed, ..., Su | |\n * | | cccc | Monday, Tuesday, ..., Sunday | 2 |\n * | | ccccc | M, T, W, T, F, S, S | |\n * | | cccccc | Mo, Tu, We, Th, Fr, Su, Sa | |\n * | AM, PM | a..aaa | AM, PM | |\n * | | aaaa | a.m., p.m. | 2 |\n * | | aaaaa | a, p | |\n * | AM, PM, noon, midnight | b..bbb | AM, PM, noon, midnight | |\n * | | bbbb | a.m., p.m., noon, midnight | 2 |\n * | | bbbbb | a, p, n, mi | |\n * | Flexible day period | B..BBB | at night, in the morning, ... | |\n * | | BBBB | at night, in the morning, ... | 2 |\n * | | BBBBB | at night, in the morning, ... | |\n * | Hour [1-12] | h | 1, 2, ..., 11, 12 | |\n * | | ho | 1st, 2nd, ..., 11th, 12th | 7 |\n * | | hh | 01, 02, ..., 11, 12 | |\n * | Hour [0-23] | H | 0, 1, 2, ..., 23 | |\n * | | Ho | 0th, 1st, 2nd, ..., 23rd | 7 |\n * | | HH | 00, 01, 02, ..., 23 | |\n * | Hour [0-11] | K | 1, 2, ..., 11, 0 | |\n * | | Ko | 1st, 2nd, ..., 11th, 0th | 7 |\n * | | KK | 1, 2, ..., 11, 0 | |\n * | Hour [1-24] | k | 24, 1, 2, ..., 23 | |\n * | | ko | 24th, 1st, 2nd, ..., 23rd | 7 |\n * | | kk | 24, 01, 02, ..., 23 | |\n * | Minute | m | 0, 1, ..., 59 | |\n * | | mo | 0th, 1st, ..., 59th | 7 |\n * | | mm | 00, 01, ..., 59 | |\n * | Second | s | 0, 1, ..., 59 | |\n * | | so | 0th, 1st, ..., 59th | 7 |\n * | | ss | 00, 01, ..., 59 | |\n * | Fraction of second | S | 0, 1, ..., 9 | |\n * | | SS | 00, 01, ..., 99 | |\n * | | SSS | 000, 0001, ..., 999 | |\n * | | SSSS | ... | 3 |\n * | Timezone (ISO-8601 w/ Z) | X | -08, +0530, Z | |\n * | | XX | -0800, +0530, Z | |\n * | | XXX | -08:00, +05:30, Z | |\n * | | XXXX | -0800, +0530, Z, +123456 | 2 |\n * | | XXXXX | -08:00, +05:30, Z, +12:34:56 | |\n * | Timezone (ISO-8601 w/o Z) | x | -08, +0530, +00 | |\n * | | xx | -0800, +0530, +0000 | |\n * | | xxx | -08:00, +05:30, +00:00 | 2 |\n * | | xxxx | -0800, +0530, +0000, +123456 | |\n * | | xxxxx | -08:00, +05:30, +00:00, +12:34:56 | |\n * | Timezone (GMT) | O...OOO | GMT-8, GMT+5:30, GMT+0 | |\n * | | OOOO | GMT-08:00, GMT+05:30, GMT+00:00 | 2 |\n * | Timezone (specific non-locat.) | z...zzz | GMT-8, GMT+5:30, GMT+0 | 6 |\n * | | zzzz | GMT-08:00, GMT+05:30, GMT+00:00 | 2,6 |\n * | Seconds timestamp | t | 512969520 | 7 |\n * | | tt | ... | 3,7 |\n * | Milliseconds timestamp | T | 512969520900 | 7 |\n * | | TT | ... | 3,7 |\n * | Long localized date | P | 05/29/1453 | 7 |\n * | | PP | May 29, 1453 | 7 |\n * | | PPP | May 29th, 1453 | 7 |\n * | | PPPP | Sunday, May 29th, 1453 | 2,7 |\n * | Long localized time | p | 12:00 AM | 7 |\n * | | pp | 12:00:00 AM | 7 |\n * | | ppp | 12:00:00 AM GMT+2 | 7 |\n * | | pppp | 12:00:00 AM GMT+02:00 | 2,7 |\n * | Combination of date and time | Pp | 05/29/1453, 12:00 AM | 7 |\n * | | PPpp | May 29, 1453, 12:00:00 AM | 7 |\n * | | PPPppp | May 29th, 1453 at ... | 7 |\n * | | PPPPpppp| Sunday, May 29th, 1453 at ... | 2,7 |\n * Notes:\n * 1. \"Formatting\" units (e.g. formatting quarter) in the default en-US locale\n * are the same as \"stand-alone\" units, but are different in some languages.\n * \"Formatting\" units are declined according to the rules of the language\n * in the context of a date. \"Stand-alone\" units are always nominative singular:\n *\n * `format(new Date(2017, 10, 6), 'do LLLL', {locale: cs}) //=> '6. listopad'`\n *\n * `format(new Date(2017, 10, 6), 'do MMMM', {locale: cs}) //=> '6. listopadu'`\n *\n * 2. Any sequence of the identical letters is a pattern, unless it is escaped by\n * the single quote characters (see below).\n * If the sequence is longer than listed in table (e.g. `EEEEEEEEEEE`)\n * the output will be the same as default pattern for this unit, usually\n * the longest one (in case of ISO weekdays, `EEEE`). Default patterns for units\n * are marked with \"2\" in the last column of the table.\n *\n * `format(new Date(2017, 10, 6), 'MMM') //=> 'Nov'`\n *\n * `format(new Date(2017, 10, 6), 'MMMM') //=> 'November'`\n *\n * `format(new Date(2017, 10, 6), 'MMMMM') //=> 'N'`\n *\n * `format(new Date(2017, 10, 6), 'MMMMMM') //=> 'November'`\n *\n * `format(new Date(2017, 10, 6), 'MMMMMMM') //=> 'November'`\n *\n * 3. Some patterns could be unlimited length (such as `yyyyyyyy`).\n * The output will be padded with zeros to match the length of the pattern.\n *\n * `format(new Date(2017, 10, 6), 'yyyyyyyy') //=> '00002017'`\n *\n * 4. `QQQQQ` and `qqqqq` could be not strictly numerical in some locales.\n * These tokens represent the shortest form of the quarter.\n *\n * 5. The main difference between `y` and `u` patterns are B.C. years:\n *\n * | Year | `y` | `u` |\n * |------|-----|-----|\n * | AC 1 | 1 | 1 |\n * | BC 1 | 1 | 0 |\n * | BC 2 | 2 | -1 |\n *\n * Also `yy` always returns the last two digits of a year,\n * while `uu` pads single digit years to 2 characters and returns other years unchanged:\n *\n * | Year | `yy` | `uu` |\n * |------|------|------|\n * | 1 | 01 | 01 |\n * | 14 | 14 | 14 |\n * | 376 | 76 | 376 |\n * | 1453 | 53 | 1453 |\n *\n * The same difference is true for local and ISO week-numbering years (`Y` and `R`),\n * except local week-numbering years are dependent on `options.weekStartsOn`\n * and `options.firstWeekContainsDate` (compare [getISOWeekYear]{@link https://date-fns.org/docs/getISOWeekYear}\n * and [getWeekYear]{@link https://date-fns.org/docs/getWeekYear}).\n *\n * 6. Specific non-location timezones are currently unavailable in `date-fns`,\n * so right now these tokens fall back to GMT timezones.\n *\n * 7. These patterns are not in the Unicode Technical Standard #35:\n * - `i`: ISO day of week\n * - `I`: ISO week of year\n * - `R`: ISO week-numbering year\n * - `t`: seconds timestamp\n * - `T`: milliseconds timestamp\n * - `o`: ordinal number modifier\n * - `P`: long localized date\n * - `p`: long localized time\n *\n * 8. These tokens are often confused with others. See: https://git.io/fxCyr\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * - The second argument is now required for the sake of explicitness.\n *\n * ```javascript\n * // Before v2.0.0\n * format(new Date(2016, 0, 1))\n *\n * // v2.0.0 onward\n * format(new Date(2016, 0, 1), \"yyyy-MM-dd'T'HH:mm:ss.SSSxxx\")\n * ```\n *\n * - New format string API for `format` function\n * which is based on [Unicode Technical Standard #35](https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table).\n * See [this post](https://blog.date-fns.org/post/unicode-tokens-in-date-fns-v2-sreatyki91jg) for more details.\n *\n * - Characters are now escaped using single quote symbols (`'`) instead of square brackets.\n *\n * @param {Date|Number} date - the original date\n * @param {String} format - the string of tokens\n * @param {Object} [options] - an object with options.\n * @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)\n * @param {Number} [options.firstWeekContainsDate=1] - the day of January, which is\n * @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale}\n * @param {Boolean} [options.awareOfUnicodeTokens=false] - if true, allows usage of Unicode tokens causes confusion:\n * - Some of the day of year tokens (`D`, `DD`) that are confused with the day of month tokens (`d`, `dd`).\n * - Some of the local week-numbering year tokens (`YY`, `YYYY`) that are confused with the calendar year tokens (`yy`, `yyyy`).\n * See: https://git.io/fxCyr\n * @returns {String} the formatted date string\n * @throws {TypeError} 2 arguments required\n * @throws {RangeError} `options.locale` must contain `localize` property\n * @throws {RangeError} `options.locale` must contain `formatLong` property\n * @throws {RangeError} `options.weekStartsOn` must be between 0 and 6\n * @throws {RangeError} `options.firstWeekContainsDate` must be between 1 and 7\n * @throws {RangeError} `options.awareOfUnicodeTokens` must be set to `true` to use `XX` token; see: https://git.io/fxCyr\n *\n * @example\n * // Represent 11 February 2014 in middle-endian format:\n * var result = format(new Date(2014, 1, 11), 'MM/dd/yyyy')\n * //=> '02/11/2014'\n *\n * @example\n * // Represent 2 July 2014 in Esperanto:\n * import { eoLocale } from 'date-fns/locale/eo'\n * var result = format(new Date(2014, 6, 2), \"do 'de' MMMM yyyy\", {\n * locale: eoLocale\n * })\n * //=> '2-a de julio 2014'\n *\n * @example\n * // Escape string by single quote characters:\n * var result = format(new Date(2014, 6, 2, 15), \"h 'o''clock'\")\n * //=> \"3 o'clock\"\n */\nexport default function format(dirtyDate, dirtyFormatStr, dirtyOptions) {\n if (arguments.length < 2) {\n throw new TypeError(\n '2 arguments required, but only ' + arguments.length + ' present'\n )\n }\n\n var formatStr = String(dirtyFormatStr)\n var options = dirtyOptions || {}\n\n var locale = options.locale || defaultLocale\n\n var localeFirstWeekContainsDate =\n locale.options && locale.options.firstWeekContainsDate\n var defaultFirstWeekContainsDate =\n localeFirstWeekContainsDate == null\n ? 1\n : toInteger(localeFirstWeekContainsDate)\n var firstWeekContainsDate =\n options.firstWeekContainsDate == null\n ? defaultFirstWeekContainsDate\n : toInteger(options.firstWeekContainsDate)\n\n // Test if weekStartsOn is between 1 and 7 _and_ is not NaN\n if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) {\n throw new RangeError(\n 'firstWeekContainsDate must be between 1 and 7 inclusively'\n )\n }\n\n var localeWeekStartsOn = locale.options && locale.options.weekStartsOn\n var defaultWeekStartsOn =\n localeWeekStartsOn == null ? 0 : toInteger(localeWeekStartsOn)\n var weekStartsOn =\n options.weekStartsOn == null\n ? defaultWeekStartsOn\n : toInteger(options.weekStartsOn)\n\n // Test if weekStartsOn is between 0 and 6 _and_ is not NaN\n if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {\n throw new RangeError('weekStartsOn must be between 0 and 6 inclusively')\n }\n\n if (!locale.localize) {\n throw new RangeError('locale must contain localize property')\n }\n\n if (!locale.formatLong) {\n throw new RangeError('locale must contain formatLong property')\n }\n\n var originalDate = toDate(dirtyDate)\n\n if (!isValid(originalDate)) {\n throw new RangeError('Invalid time value')\n }\n\n // Convert the date in system timezone to the same date in UTC+00:00 timezone.\n // This ensures that when UTC functions will be implemented, locales will be compatible with them.\n // See an issue about UTC functions: https://github.com/date-fns/date-fns/issues/376\n var timezoneOffset = getTimezoneOffsetInMilliseconds(originalDate)\n var utcDate = subMilliseconds(originalDate, timezoneOffset)\n\n var formatterOptions = {\n firstWeekContainsDate: firstWeekContainsDate,\n weekStartsOn: weekStartsOn,\n locale: locale,\n _originalDate: originalDate\n }\n\n var result = formatStr\n .match(longFormattingTokensRegExp)\n .map(function(substring) {\n var firstCharacter = substring[0]\n if (firstCharacter === 'p' || firstCharacter === 'P') {\n var longFormatter = longFormatters[firstCharacter]\n return longFormatter(substring, locale.formatLong, formatterOptions)\n }\n return substring\n })\n .join('')\n .match(formattingTokensRegExp)\n .map(function(substring) {\n // Replace two single quote characters with one single quote character\n if (substring === \"''\") {\n return \"'\"\n }\n\n var firstCharacter = substring[0]\n if (firstCharacter === \"'\") {\n return cleanEscapedString(substring)\n }\n\n var formatter = formatters[firstCharacter]\n if (formatter) {\n if (!options.awareOfUnicodeTokens && isProtectedToken(substring)) {\n throwProtectedError(substring)\n }\n return formatter(utcDate, substring, locale.localize, formatterOptions)\n }\n\n return substring\n })\n .join('')\n\n return result\n}\n\nfunction cleanEscapedString(input) {\n return input.match(escapedStringRegExp)[1].replace(doubleQuoteRegExp, \"'\")\n}\n","import getTimezoneOffsetInMilliseconds from '../_lib/getTimezoneOffsetInMilliseconds/index.js'\nimport compareAsc from '../compareAsc/index.js'\nimport toDate from '../toDate/index.js'\nimport differenceInSeconds from '../differenceInSeconds/index.js'\nimport differenceInMonths from '../differenceInMonths/index.js'\nimport cloneObject from '../_lib/cloneObject/index.js'\nimport defaultLocale from '../locale/en-US/index.js'\n\nvar MINUTES_IN_DAY = 1440\nvar MINUTES_IN_ALMOST_TWO_DAYS = 2520\nvar MINUTES_IN_MONTH = 43200\nvar MINUTES_IN_TWO_MONTHS = 86400\n\n/**\n * @name formatDistance\n * @category Common Helpers\n * @summary Return the distance between the given dates in words.\n *\n * @description\n * Return the distance between the given dates in words.\n *\n * | Distance between dates | Result |\n * |-------------------------------------------------------------------|---------------------|\n * | 0 ... 30 secs | less than a minute |\n * | 30 secs ... 1 min 30 secs | 1 minute |\n * | 1 min 30 secs ... 44 mins 30 secs | [2..44] minutes |\n * | 44 mins ... 30 secs ... 89 mins 30 secs | about 1 hour |\n * | 89 mins 30 secs ... 23 hrs 59 mins 30 secs | about [2..24] hours |\n * | 23 hrs 59 mins 30 secs ... 41 hrs 59 mins 30 secs | 1 day |\n * | 41 hrs 59 mins 30 secs ... 29 days 23 hrs 59 mins 30 secs | [2..30] days |\n * | 29 days 23 hrs 59 mins 30 secs ... 44 days 23 hrs 59 mins 30 secs | about 1 month |\n * | 44 days 23 hrs 59 mins 30 secs ... 59 days 23 hrs 59 mins 30 secs | about 2 months |\n * | 59 days 23 hrs 59 mins 30 secs ... 1 yr | [2..12] months |\n * | 1 yr ... 1 yr 3 months | about 1 year |\n * | 1 yr 3 months ... 1 yr 9 month s | over 1 year |\n * | 1 yr 9 months ... 2 yrs | almost 2 years |\n * | N yrs ... N yrs 3 months | about N years |\n * | N yrs 3 months ... N yrs 9 months | over N years |\n * | N yrs 9 months ... N+1 yrs | almost N+1 years |\n *\n * With `options.includeSeconds == true`:\n * | Distance between dates | Result |\n * |------------------------|----------------------|\n * | 0 secs ... 5 secs | less than 5 seconds |\n * | 5 secs ... 10 secs | less than 10 seconds |\n * | 10 secs ... 20 secs | less than 20 seconds |\n * | 20 secs ... 40 secs | half a minute |\n * | 40 secs ... 60 secs | less than a minute |\n * | 60 secs ... 90 secs | 1 minute |\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * - The function was renamed from `distanceInWords ` to `formatDistance `\n * to make its name consistent with `format` and `formatRelative`.\n *\n * - The order of arguments is swapped to make the function\n * consistent with `differenceIn...` functions.\n *\n * ```javascript\n * // Before v2.0.0\n *\n * distanceInWords(\n * new Date(1986, 3, 4, 10, 32, 0),\n * new Date(1986, 3, 4, 11, 32, 0),\n * { addSuffix: true }\n * ) //=> 'in about 1 hour'\n *\n * // v2.0.0 onward\n *\n * formatDistance(\n * new Date(1986, 3, 4, 11, 32, 0),\n * new Date(1986, 3, 4, 10, 32, 0),\n * { addSuffix: true }\n * ) //=> 'in about 1 hour'\n * ```\n *\n * @param {Date|Number} date - the date\n * @param {Date|Number} baseDate - the date to compare with\n * @param {Object} [options] - an object with options.\n * @param {Boolean} [options.includeSeconds=false] - distances less than a minute are more detailed\n * @param {Boolean} [options.addSuffix=false] - result indicates if the second date is earlier or later than the first\n * @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale}\n * @returns {String} the distance in words\n * @throws {TypeError} 2 arguments required\n * @throws {RangeError} `options.locale` must contain `formatDistance` property\n *\n * @example\n * // What is the distance between 2 July 2014 and 1 January 2015?\n * var result = formatDistance(new Date(2014, 6, 2), new Date(2015, 0, 1))\n * //=> '6 months'\n *\n * @example\n * // What is the distance between 1 January 2015 00:00:15\n * // and 1 January 2015 00:00:00, including seconds?\n * var result = formatDistance(\n * new Date(2015, 0, 1, 0, 0, 15),\n * new Date(2015, 0, 1, 0, 0, 0),\n * { includeSeconds: true }\n * )\n * //=> 'less than 20 seconds'\n *\n * @example\n * // What is the distance from 1 January 2016\n * // to 1 January 2015, with a suffix?\n * var result = formatDistance(new Date(2015, 0, 1), new Date(2016, 0, 1), {\n * addSuffix: true\n * })\n * //=> 'about 1 year ago'\n *\n * @example\n * // What is the distance between 1 August 2016 and 1 January 2015 in Esperanto?\n * import { eoLocale } from 'date-fns/locale/eo'\n * var result = formatDistance(new Date(2016, 7, 1), new Date(2015, 0, 1), {\n * locale: eoLocale\n * })\n * //=> 'pli ol 1 jaro'\n */\nexport default function formatDistance(dirtyDate, dirtyBaseDate, dirtyOptions) {\n if (arguments.length < 2) {\n throw new TypeError(\n '2 arguments required, but only ' + arguments.length + ' present'\n )\n }\n\n var options = dirtyOptions || {}\n var locale = options.locale || defaultLocale\n\n if (!locale.formatDistance) {\n throw new RangeError('locale must contain formatDistance property')\n }\n\n var comparison = compareAsc(dirtyDate, dirtyBaseDate)\n\n if (isNaN(comparison)) {\n throw new RangeError('Invalid time value')\n }\n\n var localizeOptions = cloneObject(options)\n localizeOptions.addSuffix = Boolean(options.addSuffix)\n localizeOptions.comparison = comparison\n\n var dateLeft\n var dateRight\n if (comparison > 0) {\n dateLeft = toDate(dirtyBaseDate)\n dateRight = toDate(dirtyDate)\n } else {\n dateLeft = toDate(dirtyDate)\n dateRight = toDate(dirtyBaseDate)\n }\n\n var seconds = differenceInSeconds(dateRight, dateLeft)\n var offsetInSeconds =\n (getTimezoneOffsetInMilliseconds(dateRight) -\n getTimezoneOffsetInMilliseconds(dateLeft)) /\n 1000\n var minutes = Math.round((seconds - offsetInSeconds) / 60)\n var months\n\n // 0 up to 2 mins\n if (minutes < 2) {\n if (options.includeSeconds) {\n if (seconds < 5) {\n return locale.formatDistance('lessThanXSeconds', 5, localizeOptions)\n } else if (seconds < 10) {\n return locale.formatDistance('lessThanXSeconds', 10, localizeOptions)\n } else if (seconds < 20) {\n return locale.formatDistance('lessThanXSeconds', 20, localizeOptions)\n } else if (seconds < 40) {\n return locale.formatDistance('halfAMinute', null, localizeOptions)\n } else if (seconds < 60) {\n return locale.formatDistance('lessThanXMinutes', 1, localizeOptions)\n } else {\n return locale.formatDistance('xMinutes', 1, localizeOptions)\n }\n } else {\n if (minutes === 0) {\n return locale.formatDistance('lessThanXMinutes', 1, localizeOptions)\n } else {\n return locale.formatDistance('xMinutes', minutes, localizeOptions)\n }\n }\n\n // 2 mins up to 0.75 hrs\n } else if (minutes < 45) {\n return locale.formatDistance('xMinutes', minutes, localizeOptions)\n\n // 0.75 hrs up to 1.5 hrs\n } else if (minutes < 90) {\n return locale.formatDistance('aboutXHours', 1, localizeOptions)\n\n // 1.5 hrs up to 24 hrs\n } else if (minutes < MINUTES_IN_DAY) {\n var hours = Math.round(minutes / 60)\n return locale.formatDistance('aboutXHours', hours, localizeOptions)\n\n // 1 day up to 1.75 days\n } else if (minutes < MINUTES_IN_ALMOST_TWO_DAYS) {\n return locale.formatDistance('xDays', 1, localizeOptions)\n\n // 1.75 days up to 30 days\n } else if (minutes < MINUTES_IN_MONTH) {\n var days = Math.round(minutes / MINUTES_IN_DAY)\n return locale.formatDistance('xDays', days, localizeOptions)\n\n // 1 month up to 2 months\n } else if (minutes < MINUTES_IN_TWO_MONTHS) {\n months = Math.round(minutes / MINUTES_IN_MONTH)\n return locale.formatDistance('aboutXMonths', months, localizeOptions)\n }\n\n months = differenceInMonths(dateRight, dateLeft)\n\n // 2 months up to 12 months\n if (months < 12) {\n var nearestMonth = Math.round(minutes / MINUTES_IN_MONTH)\n return locale.formatDistance('xMonths', nearestMonth, localizeOptions)\n\n // 1 year up to max Date\n } else {\n var monthsSinceStartOfYear = months % 12\n var years = Math.floor(months / 12)\n\n // N years up to 1 years 3 months\n if (monthsSinceStartOfYear < 3) {\n return locale.formatDistance('aboutXYears', years, localizeOptions)\n\n // N years 3 months up to N years 9 months\n } else if (monthsSinceStartOfYear < 9) {\n return locale.formatDistance('overXYears', years, localizeOptions)\n\n // N years 9 months up to N year 12 months\n } else {\n return locale.formatDistance('almostXYears', years + 1, localizeOptions)\n }\n }\n}\n","import getTimezoneOffsetInMilliseconds from '../_lib/getTimezoneOffsetInMilliseconds/index.js'\nimport compareAsc from '../compareAsc/index.js'\nimport toDate from '../toDate/index.js'\nimport differenceInSeconds from '../differenceInSeconds/index.js'\nimport cloneObject from '../_lib/cloneObject/index.js'\nimport defaultLocale from '../locale/en-US/index.js'\n\nvar MINUTES_IN_DAY = 1440\nvar MINUTES_IN_MONTH = 43200\nvar MINUTES_IN_YEAR = 525600\n\n/**\n * @name formatDistanceStrict\n * @category Common Helpers\n * @summary Return the distance between the given dates in words.\n *\n * @description\n * Return the distance between the given dates in words, using strict units.\n * This is like `formatDistance`, but does not use helpers like 'almost', 'over',\n * 'less than' and the like.\n *\n * | Distance between dates | Result |\n * |------------------------|---------------------|\n * | 0 ... 59 secs | [0..59] seconds |\n * | 1 ... 59 mins | [1..59] minutes |\n * | 1 ... 23 hrs | [1..23] hours |\n * | 1 ... 29 days | [1..29] days |\n * | 1 ... 11 months | [1..11] months |\n * | 1 ... N years | [1..N] years |\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * - The function was renamed from `distanceInWordsStrict` to `formatDistanceStrict`\n * to make its name consistent with `format` and `formatRelative`.\n *\n * - The order of arguments is swapped to make the function\n * consistent with `differenceIn...` functions.\n *\n * ```javascript\n * // Before v2.0.0\n *\n * distanceInWordsStrict(\n * new Date(2015, 0, 2),\n * new Date(2014, 6, 2)\n * ) //=> '6 months'\n *\n * // v2.0.0 onward\n *\n * formatDistanceStrict(\n * new Date(2014, 6, 2),\n * new Date(2015, 0, 2)\n * ) //=> '6 months'\n * ```\n *\n * - `partialMethod` option is renamed to `roundingMethod`.\n *\n * ```javascript\n * // Before v2.0.0\n *\n * distanceInWordsStrict(\n * new Date(1986, 3, 4, 10, 32, 0),\n * new Date(1986, 3, 4, 10, 33, 1),\n * { partialMethod: 'ceil' }\n * ) //=> '2 minutes'\n *\n * // v2.0.0 onward\n *\n * formatDistanceStrict(\n * new Date(1986, 3, 4, 10, 33, 1),\n * new Date(1986, 3, 4, 10, 32, 0),\n * { roundingMethod: 'ceil' }\n * ) //=> '2 minutes'\n * ```\n *\n * - If `roundingMethod` is not specified, it now defaults to `round` instead of `floor`.\n *\n * - `unit` option now accepts one of the strings:\n * 'second', 'minute', 'hour', 'day', 'month' or 'year' instead of 's', 'm', 'h', 'd', 'M' or 'Y'\n *\n * ```javascript\n * // Before v2.0.0\n *\n * distanceInWordsStrict(\n * new Date(1986, 3, 4, 10, 32, 0),\n * new Date(1986, 3, 4, 10, 33, 1),\n * { unit: 'm' }\n * )\n *\n * // v2.0.0 onward\n *\n * formatDistanceStrict(\n * new Date(1986, 3, 4, 10, 33, 1),\n * new Date(1986, 3, 4, 10, 32, 0),\n * { unit: 'minute' }\n * )\n * ```\n *\n * @param {Date|Number} date - the date\n * @param {Date|Number} baseDate - the date to compare with\n * @param {Object} [options] - an object with options.\n * @param {Boolean} [options.addSuffix=false] - result indicates if the second date is earlier or later than the first\n * @param {'second'|'minute'|'hour'|'day'|'month'|'year'} [options.unit] - if specified, will force a unit\n * @param {'floor'|'ceil'|'round'} [options.roundingMethod='round'] - which way to round partial units\n * @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale}\n * @returns {String} the distance in words\n * @throws {TypeError} 2 arguments required\n * @throws {RangeError} `options.roundingMethod` must be 'floor', 'ceil' or 'round'\n * @throws {RangeError} `options.unit` must be 'second', 'minute', 'hour', 'day', 'month' or 'year'\n * @throws {RangeError} `options.locale` must contain `formatDistance` property\n *\n * @example\n * // What is the distance between 2 July 2014 and 1 January 2015?\n * var result = formatDistanceStrict(new Date(2014, 6, 2), new Date(2015, 0, 2))\n * //=> '6 months'\n *\n * @example\n * // What is the distance between 1 January 2015 00:00:15\n * // and 1 January 2015 00:00:00?\n * var result = formatDistanceStrict(\n * new Date(2015, 0, 1, 0, 0, 15),\n * new Date(2015, 0, 1, 0, 0, 0)\n * )\n * //=> '15 seconds'\n *\n * @example\n * // What is the distance from 1 January 2016\n * // to 1 January 2015, with a suffix?\n * var result = formatDistanceStrict(new Date(2015, 0, 1), new Date(2016, 0, 1), {\n * addSuffix: true\n * })\n * //=> '1 year ago'\n *\n * @example\n * // What is the distance from 1 January 2016\n * // to 1 January 2015, in minutes?\n * var result = formatDistanceStrict(new Date(2016, 0, 1), new Date(2015, 0, 1), {\n * unit: 'minute'\n * })\n * //=> '525600 minutes'\n *\n * @example\n * // What is the distance from 1 January 2016\n * // to 28 January 2015, in months, rounded up?\n * var result = formatDistanceStrict(new Date(2015, 0, 28), new Date(2015, 0, 1), {\n * unit: 'month',\n * roundingMethod: 'ceil'\n * })\n * //=> '1 month'\n *\n * @example\n * // What is the distance between 1 August 2016 and 1 January 2015 in Esperanto?\n * import { eoLocale } from 'date-fns/locale/eo'\n * var result = formatDistanceStrict(new Date(2016, 7, 1), new Date(2015, 0, 1), {\n * locale: eoLocale\n * })\n * //=> '1 jaro'\n */\nexport default function formatDistanceStrict(\n dirtyDate,\n dirtyBaseDate,\n dirtyOptions\n) {\n if (arguments.length < 2) {\n throw new TypeError(\n '2 arguments required, but only ' + arguments.length + ' present'\n )\n }\n\n var options = dirtyOptions || {}\n var locale = options.locale || defaultLocale\n\n if (!locale.formatDistance) {\n throw new RangeError('locale must contain localize.formatDistance property')\n }\n\n var comparison = compareAsc(dirtyDate, dirtyBaseDate)\n\n if (isNaN(comparison)) {\n throw new RangeError('Invalid time value')\n }\n\n var localizeOptions = cloneObject(options)\n localizeOptions.addSuffix = Boolean(options.addSuffix)\n localizeOptions.comparison = comparison\n\n var dateLeft\n var dateRight\n if (comparison > 0) {\n dateLeft = toDate(dirtyBaseDate)\n dateRight = toDate(dirtyDate)\n } else {\n dateLeft = toDate(dirtyDate)\n dateRight = toDate(dirtyBaseDate)\n }\n\n var roundingMethod =\n options.roundingMethod == null ? 'round' : String(options.roundingMethod)\n var roundingMethodFn\n\n if (roundingMethod === 'floor') {\n roundingMethodFn = Math.floor\n } else if (roundingMethod === 'ceil') {\n roundingMethodFn = Math.ceil\n } else if (roundingMethod === 'round') {\n roundingMethodFn = Math.round\n } else {\n throw new RangeError(\"roundingMethod must be 'floor', 'ceil' or 'round'\")\n }\n\n var seconds = differenceInSeconds(dateRight, dateLeft)\n var offsetInSeconds =\n (getTimezoneOffsetInMilliseconds(dateRight) -\n getTimezoneOffsetInMilliseconds(dateLeft)) /\n 1000\n var minutes = roundingMethodFn((seconds - offsetInSeconds) / 60)\n\n var unit\n if (options.unit == null) {\n if (minutes < 1) {\n unit = 'second'\n } else if (minutes < 60) {\n unit = 'minute'\n } else if (minutes < MINUTES_IN_DAY) {\n unit = 'hour'\n } else if (minutes < MINUTES_IN_MONTH) {\n unit = 'day'\n } else if (minutes < MINUTES_IN_YEAR) {\n unit = 'month'\n } else {\n unit = 'year'\n }\n } else {\n unit = String(options.unit)\n }\n\n // 0 up to 60 seconds\n if (unit === 'second') {\n return locale.formatDistance('xSeconds', seconds, localizeOptions)\n\n // 1 up to 60 mins\n } else if (unit === 'minute') {\n return locale.formatDistance('xMinutes', minutes, localizeOptions)\n\n // 1 up to 24 hours\n } else if (unit === 'hour') {\n var hours = roundingMethodFn(minutes / 60)\n return locale.formatDistance('xHours', hours, localizeOptions)\n\n // 1 up to 30 days\n } else if (unit === 'day') {\n var days = roundingMethodFn(minutes / MINUTES_IN_DAY)\n return locale.formatDistance('xDays', days, localizeOptions)\n\n // 1 up to 12 months\n } else if (unit === 'month') {\n var months = roundingMethodFn(minutes / MINUTES_IN_MONTH)\n return locale.formatDistance('xMonths', months, localizeOptions)\n\n // 1 year up to max Date\n } else if (unit === 'year') {\n var years = roundingMethodFn(minutes / MINUTES_IN_YEAR)\n return locale.formatDistance('xYears', years, localizeOptions)\n }\n\n throw new RangeError(\n \"unit must be 'second', 'minute', 'hour', 'day', 'month' or 'year'\"\n )\n}\n","import getTimezoneOffsetInMilliseconds from '../_lib/getTimezoneOffsetInMilliseconds/index.js'\nimport toDate from '../toDate/index.js'\nimport format from '../format/index.js'\nimport differenceInCalendarDays from '../differenceInCalendarDays/index.js'\nimport defaultLocale from '../locale/en-US/index.js'\nimport subMilliseconds from '../subMilliseconds/index.js'\n\n/**\n * @name formatRelative\n * @category Common Helpers\n * @summary Represent the date in words relative to the given base date.\n *\n * @description\n * Represent the date in words relative to the given base date.\n *\n * | Distance to the base date | Result |\n * |---------------------------|---------------------------|\n * | Previous 6 days | last Sunday at 04:30 AM |\n * | Last day | yesterday at 04:30 AM |\n * | Same day | today at 04:30 AM |\n * | Next day | tomorrow at 04:30 AM |\n * | Next 6 days | Sunday at 04:30 AM |\n * | Other | 12/31/2017 |\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} date - the date to format\n * @param {Date|Number} baseDate - the date to compare with\n * @param {Object} [options] - an object with options.\n * @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)\n * @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale}\n * @returns {String} the date in words\n * @throws {TypeError} 2 arguments required\n * @throws {RangeError} `options.weekStartsOn` must be between 0 and 6\n * @throws {RangeError} `options.locale` must contain `localize` property\n * @throws {RangeError} `options.locale` must contain `formatLong` property\n * @throws {RangeError} `options.locale` must contain `formatRelative` property\n */\nexport default function formatRelative(dirtyDate, dirtyBaseDate, dirtyOptions) {\n if (arguments.length < 2) {\n throw new TypeError(\n '2 arguments required, but only ' + arguments.length + ' present'\n )\n }\n\n var date = toDate(dirtyDate)\n var baseDate = toDate(dirtyBaseDate)\n\n var options = dirtyOptions || {}\n var locale = options.locale || defaultLocale\n\n if (!locale.localize) {\n throw new RangeError('locale must contain localize property')\n }\n\n if (!locale.formatLong) {\n throw new RangeError('locale must contain formatLong property')\n }\n\n if (!locale.formatRelative) {\n throw new RangeError('locale must contain formatRelative property')\n }\n\n var diff = differenceInCalendarDays(date, baseDate)\n\n if (isNaN(diff)) {\n throw new RangeError('Invalid time value')\n }\n\n var token\n if (diff < -6) {\n token = 'other'\n } else if (diff < -1) {\n token = 'lastWeek'\n } else if (diff < 0) {\n token = 'yesterday'\n } else if (diff < 1) {\n token = 'today'\n } else if (diff < 2) {\n token = 'tomorrow'\n } else if (diff < 7) {\n token = 'nextWeek'\n } else {\n token = 'other'\n }\n\n var utcDate = subMilliseconds(date, getTimezoneOffsetInMilliseconds(date))\n var utcBaseDate = subMilliseconds(\n baseDate,\n getTimezoneOffsetInMilliseconds(baseDate)\n )\n var formatStr = locale.formatRelative(token, utcDate, utcBaseDate, options)\n return format(date, formatStr, options)\n}\n","import toDate from '../toDate/index.js'\nimport toInteger from '../_lib/toInteger/index.js'\n\n/**\n * @name fromUnixTime\n * @category Timestamp Helpers\n * @summary Create a date from a Unix timestamp.\n *\n * @description\n * Create a date from a Unix timestamp.\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Number} unixTime - the given Unix timestamp\n * @returns {Date} the date\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // Create the date 29 February 2012 11:45:05:\n * var result = fromUnixTime(1330515905)\n * //=> Wed Feb 29 2012 11:45:05\n */\nexport default function fromUnixTime(dirtyUnixTime) {\n if (arguments.length < 1) {\n throw new TypeError(\n '1 argument required, but only ' + arguments.length + ' present'\n )\n }\n\n var unixTime = toInteger(dirtyUnixTime)\n\n return toDate(unixTime * 1000)\n}\n","import toDate from '../toDate/index.js'\n\n/**\n * @name getDate\n * @category Day Helpers\n * @summary Get the day of the month of the given date.\n *\n * @description\n * Get the day of the month of the given date.\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} date - the given date\n * @returns {Number} the day of month\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // Which day of the month is 29 February 2012?\n * var result = getDate(new Date(2012, 1, 29))\n * //=> 29\n */\nexport default function getDate(dirtyDate) {\n if (arguments.length < 1) {\n throw new TypeError(\n '1 argument required, but only ' + arguments.length + ' present'\n )\n }\n\n var date = toDate(dirtyDate)\n var dayOfMonth = date.getDate()\n return dayOfMonth\n}\n","import toDate from '../toDate/index.js'\n\n/**\n * @name getDay\n * @category Weekday Helpers\n * @summary Get the day of the week of the given date.\n *\n * @description\n * Get the day of the week of the given date.\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} date - the given date\n * @returns {Number} the day of week\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // Which day of the week is 29 February 2012?\n * var result = getDay(new Date(2012, 1, 29))\n * //=> 3\n */\nexport default function getDay(dirtyDate) {\n if (arguments.length < 1) {\n throw new TypeError(\n '1 argument required, but only ' + arguments.length + ' present'\n )\n }\n\n var date = toDate(dirtyDate)\n var day = date.getDay()\n return day\n}\n","import toDate from '../toDate/index.js'\nimport startOfYear from '../startOfYear/index.js'\nimport differenceInCalendarDays from '../differenceInCalendarDays/index.js'\n\n/**\n * @name getDayOfYear\n * @category Day Helpers\n * @summary Get the day of the year of the given date.\n *\n * @description\n * Get the day of the year of the given date.\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} date - the given date\n * @returns {Number} the day of year\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // Which day of the year is 2 July 2014?\n * var result = getDayOfYear(new Date(2014, 6, 2))\n * //=> 183\n */\nexport default function getDayOfYear(dirtyDate) {\n if (arguments.length < 1) {\n throw new TypeError(\n '1 argument required, but only ' + arguments.length + ' present'\n )\n }\n\n var date = toDate(dirtyDate)\n var diff = differenceInCalendarDays(date, startOfYear(date))\n var dayOfYear = diff + 1\n return dayOfYear\n}\n","import toDate from '../toDate/index.js'\n\n/**\n * @name getDaysInMonth\n * @category Month Helpers\n * @summary Get the number of days in a month of the given date.\n *\n * @description\n * Get the number of days in a month of the given date.\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} date - the given date\n * @returns {Number} the number of days in a month\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // How many days are in February 2000?\n * var result = getDaysInMonth(new Date(2000, 1))\n * //=> 29\n */\nexport default function getDaysInMonth(dirtyDate) {\n if (arguments.length < 1) {\n throw new TypeError(\n '1 argument required, but only ' + arguments.length + ' present'\n )\n }\n\n var date = toDate(dirtyDate)\n var year = date.getFullYear()\n var monthIndex = date.getMonth()\n var lastDayOfMonth = new Date(0)\n lastDayOfMonth.setFullYear(year, monthIndex + 1, 0)\n lastDayOfMonth.setHours(0, 0, 0, 0)\n return lastDayOfMonth.getDate()\n}\n","import toDate from '../toDate/index.js'\nimport isLeapYear from '../isLeapYear/index.js'\n\n/**\n * @name getDaysInYear\n * @category Year Helpers\n * @summary Get the number of days in a year of the given date.\n *\n * @description\n * Get the number of days in a year of the given date.\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} date - the given date\n * @returns {Number} the number of days in a year\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // How many days are in 2012?\n * var result = getDaysInYear(new Date(2012, 0, 1))\n * //=> 366\n */\nexport default function getDaysInYear(dirtyDate) {\n if (arguments.length < 1) {\n throw new TypeError(\n '1 argument required, but only ' + arguments.length + ' present'\n )\n }\n\n var date = toDate(dirtyDate)\n\n if (isNaN(date)) {\n return NaN\n }\n\n return isLeapYear(date) ? 366 : 365\n}\n","import toDate from '../toDate/index.js'\n\n/**\n * @name getDecade\n * @category Decade Helpers\n * @summary Get the decade of the given date.\n *\n * @description\n * Get the decade of the given date.\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} date - the given date\n * @returns {Number} the year of decade\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // Which decade belongs 27 November 1942?\n * var result = getDecade(new Date(1942, 10, 27))\n * //=> 1940\n */\nexport default function getDecade(dirtyDate) {\n if (arguments.length < 1) {\n throw new TypeError(\n '1 argument required, but only ' + arguments.length + ' present'\n )\n }\n\n var date = toDate(dirtyDate)\n var year = date.getFullYear()\n var decade = Math.floor(year / 10) * 10\n return decade\n}\n","import toDate from '../toDate/index.js'\n\n/**\n * @name getHours\n * @category Hour Helpers\n * @summary Get the hours of the given date.\n *\n * @description\n * Get the hours of the given date.\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} date - the given date\n * @returns {Number} the hours\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // Get the hours of 29 February 2012 11:45:00:\n * var result = getHours(new Date(2012, 1, 29, 11, 45))\n * //=> 11\n */\nexport default function getHours(dirtyDate) {\n if (arguments.length < 1) {\n throw new TypeError(\n '1 argument required, but only ' + arguments.length + ' present'\n )\n }\n\n var date = toDate(dirtyDate)\n var hours = date.getHours()\n return hours\n}\n","import toDate from '../toDate/index.js'\n\n/**\n * @name getISODay\n * @category Weekday Helpers\n * @summary Get the day of the ISO week of the given date.\n *\n * @description\n * Get the day of the ISO week of the given date,\n * which is 7 for Sunday, 1 for Monday etc.\n *\n * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} date - the given date\n * @returns {Number} the day of ISO week\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // Which day of the ISO week is 26 February 2012?\n * var result = getISODay(new Date(2012, 1, 26))\n * //=> 7\n */\nexport default function getISODay(dirtyDate) {\n if (arguments.length < 1) {\n throw new TypeError(\n '1 argument required, but only ' + arguments.length + ' present'\n )\n }\n\n var date = toDate(dirtyDate)\n var day = date.getDay()\n\n if (day === 0) {\n day = 7\n }\n\n return day\n}\n","import toDate from '../toDate/index.js'\nimport startOfISOWeek from '../startOfISOWeek/index.js'\nimport startOfISOWeekYear from '../startOfISOWeekYear/index.js'\n\nvar MILLISECONDS_IN_WEEK = 604800000\n\n/**\n * @name getISOWeek\n * @category ISO Week Helpers\n * @summary Get the ISO week of the given date.\n *\n * @description\n * Get the ISO week of the given date.\n *\n * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} date - the given date\n * @returns {Number} the ISO week\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // Which week of the ISO-week numbering year is 2 January 2005?\n * var result = getISOWeek(new Date(2005, 0, 2))\n * //=> 53\n */\nexport default function getISOWeek(dirtyDate) {\n if (arguments.length < 1) {\n throw new TypeError(\n '1 argument required, but only ' + arguments.length + ' present'\n )\n }\n\n var date = toDate(dirtyDate)\n var diff = startOfISOWeek(date).getTime() - startOfISOWeekYear(date).getTime()\n\n // Round the number of days to the nearest integer\n // because the number of milliseconds in a week is not constant\n // (e.g. it's different in the week of the daylight saving time clock shift)\n return Math.round(diff / MILLISECONDS_IN_WEEK) + 1\n}\n","import toDate from '../toDate/index.js'\nimport startOfISOWeek from '../startOfISOWeek/index.js'\n\n/**\n * @name getISOWeekYear\n * @category ISO Week-Numbering Year Helpers\n * @summary Get the ISO week-numbering year of the given date.\n *\n * @description\n * Get the ISO week-numbering year of the given date,\n * which always starts 3 days before the year's first Thursday.\n *\n * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * - The function was renamed from `getISOYear` to `getISOWeekYear`.\n * \"ISO week year\" is short for [ISO week-numbering year](https://en.wikipedia.org/wiki/ISO_week_date).\n * This change makes the name consistent with\n * locale-dependent week-numbering year helpers, e.g., `getWeekYear`.\n *\n * @param {Date|Number} date - the given date\n * @returns {Number} the ISO week-numbering year\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // Which ISO-week numbering year is 2 January 2005?\n * var result = getISOWeekYear(new Date(2005, 0, 2))\n * //=> 2004\n */\nexport default function getISOWeekYear(dirtyDate) {\n if (arguments.length < 1) {\n throw new TypeError(\n '1 argument required, but only ' + arguments.length + ' present'\n )\n }\n\n var date = toDate(dirtyDate)\n var year = date.getFullYear()\n\n var fourthOfJanuaryOfNextYear = new Date(0)\n fourthOfJanuaryOfNextYear.setFullYear(year + 1, 0, 4)\n fourthOfJanuaryOfNextYear.setHours(0, 0, 0, 0)\n var startOfNextYear = startOfISOWeek(fourthOfJanuaryOfNextYear)\n\n var fourthOfJanuaryOfThisYear = new Date(0)\n fourthOfJanuaryOfThisYear.setFullYear(year, 0, 4)\n fourthOfJanuaryOfThisYear.setHours(0, 0, 0, 0)\n var startOfThisYear = startOfISOWeek(fourthOfJanuaryOfThisYear)\n\n if (date.getTime() >= startOfNextYear.getTime()) {\n return year + 1\n } else if (date.getTime() >= startOfThisYear.getTime()) {\n return year\n } else {\n return year - 1\n }\n}\n","import startOfISOWeekYear from '../startOfISOWeekYear/index.js'\nimport addWeeks from '../addWeeks/index.js'\n\nvar MILLISECONDS_IN_WEEK = 604800000\n\n/**\n * @name getISOWeeksInYear\n * @category ISO Week-Numbering Year Helpers\n * @summary Get the number of weeks in an ISO week-numbering year of the given date.\n *\n * @description\n * Get the number of weeks in an ISO week-numbering year of the given date.\n *\n * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} date - the given date\n * @returns {Number} the number of ISO weeks in a year\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // How many weeks are in ISO week-numbering year 2015?\n * var result = getISOWeeksInYear(new Date(2015, 1, 11))\n * //=> 53\n */\nexport default function getISOWeeksInYear(dirtyDate) {\n if (arguments.length < 1) {\n throw new TypeError(\n '1 argument required, but only ' + arguments.length + ' present'\n )\n }\n\n var thisYear = startOfISOWeekYear(dirtyDate)\n var nextYear = startOfISOWeekYear(addWeeks(thisYear, 60))\n var diff = nextYear.valueOf() - thisYear.valueOf()\n // Round the number of weeks to the nearest integer\n // because the number of milliseconds in a week is not constant\n // (e.g. it's different in the week of the daylight saving time clock shift)\n return Math.round(diff / MILLISECONDS_IN_WEEK)\n}\n","import toDate from '../toDate/index.js'\n\n/**\n * @name getMilliseconds\n * @category Millisecond Helpers\n * @summary Get the milliseconds of the given date.\n *\n * @description\n * Get the milliseconds of the given date.\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} date - the given date\n * @returns {Number} the milliseconds\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // Get the milliseconds of 29 February 2012 11:45:05.123:\n * var result = getMilliseconds(new Date(2012, 1, 29, 11, 45, 5, 123))\n * //=> 123\n */\nexport default function getMilliseconds(dirtyDate) {\n if (arguments.length < 1) {\n throw new TypeError(\n '1 argument required, but only ' + arguments.length + ' present'\n )\n }\n\n var date = toDate(dirtyDate)\n var milliseconds = date.getMilliseconds()\n return milliseconds\n}\n","import toDate from '../toDate/index.js'\n\n/**\n * @name getMinutes\n * @category Minute Helpers\n * @summary Get the minutes of the given date.\n *\n * @description\n * Get the minutes of the given date.\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} date - the given date\n * @returns {Number} the minutes\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // Get the minutes of 29 February 2012 11:45:05:\n * var result = getMinutes(new Date(2012, 1, 29, 11, 45, 5))\n * //=> 45\n */\nexport default function getMinutes(dirtyDate) {\n if (arguments.length < 1) {\n throw new TypeError(\n '1 argument required, but only ' + arguments.length + ' present'\n )\n }\n\n var date = toDate(dirtyDate)\n var minutes = date.getMinutes()\n return minutes\n}\n","import toDate from '../toDate/index.js'\n\n/**\n * @name getMonth\n * @category Month Helpers\n * @summary Get the month of the given date.\n *\n * @description\n * Get the month of the given date.\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} date - the given date\n * @returns {Number} the month\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // Which month is 29 February 2012?\n * var result = getMonth(new Date(2012, 1, 29))\n * //=> 1\n */\nexport default function getMonth(dirtyDate) {\n if (arguments.length < 1) {\n throw new TypeError(\n '1 argument required, but only ' + arguments.length + ' present'\n )\n }\n\n var date = toDate(dirtyDate)\n var month = date.getMonth()\n return month\n}\n","import toDate from '../toDate/index.js'\n\nvar MILLISECONDS_IN_DAY = 24 * 60 * 60 * 1000\n\n/**\n * @name getOverlappingDaysInIntervals\n * @category Interval Helpers\n * @summary Get the number of days that overlap in two time intervals\n *\n * @description\n * Get the number of days that overlap in two time intervals\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * - The function was renamed from `getOverlappingDaysInRanges` to `getOverlappingDaysInIntervals`.\n * This change was made to mirror the use of the word \"interval\" in standard ISO 8601:2004 terminology:\n *\n * ```\n * 2.1.3\n * time interval\n * part of the time axis limited by two instants\n * ```\n *\n * Also, this function now accepts an object with `start` and `end` properties\n * instead of two arguments as an interval.\n * This function now throws `RangeError` if the start of the interval is after its end\n * or if any date in the interval is `Invalid Date`.\n *\n * ```javascript\n * // Before v2.0.0\n *\n * getOverlappingDaysInRanges(\n * new Date(2014, 0, 10), new Date(2014, 0, 20),\n * new Date(2014, 0, 17), new Date(2014, 0, 21)\n * )\n *\n * // v2.0.0 onward\n *\n * getOverlappingDaysInIntervals(\n * { start: new Date(2014, 0, 10), end: new Date(2014, 0, 20) },\n * { start: new Date(2014, 0, 17), end: new Date(2014, 0, 21) }\n * )\n * ```\n *\n * @param {Interval} intervalLeft - the first interval to compare. See [Interval]{@link docs/Interval}\n * @param {Interval} intervalRight - the second interval to compare. See [Interval]{@link docs/Interval}\n * @returns {Number} the number of days that overlap in two time intervals\n * @throws {TypeError} 2 arguments required\n * @throws {RangeError} The start of an interval cannot be after its end\n * @throws {RangeError} Date in interval cannot be `Invalid Date`\n *\n * @example\n * // For overlapping time intervals adds 1 for each started overlapping day:\n * getOverlappingDaysInIntervals(\n * { start: new Date(2014, 0, 10), end: new Date(2014, 0, 20) },\n * { start: new Date(2014, 0, 17), end: new Date(2014, 0, 21) }\n * )\n * //=> 3\n *\n * @example\n * // For non-overlapping time intervals returns 0:\n * getOverlappingDaysInIntervals(\n * { start: new Date(2014, 0, 10), end: new Date(2014, 0, 20) },\n * { start: new Date(2014, 0, 21), end: new Date(2014, 0, 22) }\n * )\n * //=> 0\n */\nexport default function getOverlappingDaysInIntervals(\n dirtyIntervalLeft,\n dirtyIntervalRight\n) {\n if (arguments.length < 2) {\n throw new TypeError(\n '2 arguments required, but only ' + arguments.length + ' present'\n )\n }\n\n var intervalLeft = dirtyIntervalLeft || {}\n var intervalRight = dirtyIntervalRight || {}\n var leftStartTime = toDate(intervalLeft.start).getTime()\n var leftEndTime = toDate(intervalLeft.end).getTime()\n var rightStartTime = toDate(intervalRight.start).getTime()\n var rightEndTime = toDate(intervalRight.end).getTime()\n\n // Throw an exception if start date is after end date or if any date is `Invalid Date`\n if (!(leftStartTime <= leftEndTime && rightStartTime <= rightEndTime)) {\n throw new RangeError('Invalid interval')\n }\n\n var isOverlapping =\n leftStartTime < rightEndTime && rightStartTime < leftEndTime\n\n if (!isOverlapping) {\n return 0\n }\n\n var overlapStartDate =\n rightStartTime < leftStartTime ? leftStartTime : rightStartTime\n\n var overlapEndDate = rightEndTime > leftEndTime ? leftEndTime : rightEndTime\n\n var differenceInMs = overlapEndDate - overlapStartDate\n\n return Math.ceil(differenceInMs / MILLISECONDS_IN_DAY)\n}\n","import toDate from '../toDate/index.js'\n\n/**\n * @name getQuarter\n * @category Quarter Helpers\n * @summary Get the year quarter of the given date.\n *\n * @description\n * Get the year quarter of the given date.\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} date - the given date\n * @returns {Number} the quarter\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // Which quarter is 2 July 2014?\n * var result = getQuarter(new Date(2014, 6, 2))\n * //=> 3\n */\nexport default function getQuarter(dirtyDate) {\n if (arguments.length < 1) {\n throw new TypeError(\n '1 argument required, but only ' + arguments.length + ' present'\n )\n }\n\n var date = toDate(dirtyDate)\n var quarter = Math.floor(date.getMonth() / 3) + 1\n return quarter\n}\n","import toDate from '../toDate/index.js'\n\n/**\n * @name getSeconds\n * @category Second Helpers\n * @summary Get the seconds of the given date.\n *\n * @description\n * Get the seconds of the given date.\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} date - the given date\n * @returns {Number} the seconds\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // Get the seconds of 29 February 2012 11:45:05.123:\n * var result = getSeconds(new Date(2012, 1, 29, 11, 45, 5, 123))\n * //=> 5\n */\nexport default function getSeconds(dirtyDate) {\n if (arguments.length < 1) {\n throw new TypeError(\n '1 argument required, but only ' + arguments.length + ' present'\n )\n }\n\n var date = toDate(dirtyDate)\n var seconds = date.getSeconds()\n return seconds\n}\n","import toDate from '../toDate/index.js'\n\n/**\n * @name getTime\n * @category Timestamp Helpers\n * @summary Get the milliseconds timestamp of the given date.\n *\n * @description\n * Get the milliseconds timestamp of the given date.\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} date - the given date\n * @returns {Number} the timestamp\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // Get the timestamp of 29 February 2012 11:45:05.123:\n * var result = getTime(new Date(2012, 1, 29, 11, 45, 5, 123))\n * //=> 1330515905123\n */\nexport default function getTime(dirtyDate) {\n if (arguments.length < 1) {\n throw new TypeError(\n '1 argument required, but only ' + arguments.length + ' present'\n )\n }\n\n var date = toDate(dirtyDate)\n var timestamp = date.getTime()\n return timestamp\n}\n","import getTime from '../getTime/index.js'\n\n/**\n * @name getUnixTime\n * @category Timestamp Helpers\n * @summary Get the seconds timestamp of the given date.\n *\n * @description\n * Get the seconds timestamp of the given date.\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} date - the given date\n * @returns {Number} the timestamp\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // Get the timestamp of 29 February 2012 11:45:05 CET:\n * var result = getUnixTime(new Date(2012, 1, 29, 11, 45, 5))\n * //=> 1330512305\n */\nexport default function getUnixTime(dirtyDate) {\n if (arguments.length < 1) {\n throw new TypeError(\n '1 argument required, but only ' + arguments.length + ' present'\n )\n }\n\n return Math.floor(getTime(dirtyDate) / 1000)\n}\n","import toDate from '../toDate/index.js'\nimport startOfWeek from '../startOfWeek/index.js'\nimport startOfWeekYear from '../startOfWeekYear/index.js'\n\nvar MILLISECONDS_IN_WEEK = 604800000\n\n/**\n * @name getWeek\n * @category Week Helpers\n * @summary Get the local week index of the given date.\n *\n * @description\n * Get the local week index of the given date.\n * The exact calculation depends on the values of\n * `options.weekStartsOn` (which is the index of the first day of the week)\n * and `options.firstWeekContainsDate` (which is the day of January, which is always in\n * the first week of the week-numbering year)\n *\n * Week numbering: https://en.wikipedia.org/wiki/Week#Week_numbering\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} date - the given date\n * @param {Object} [options] - an object with options.\n * @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)\n * @param {1|2|3|4|5|6|7} [options.firstWeekContainsDate=1] - the day of January, which is always in the first week of the year\n * @returns {Number} the week\n * @throws {TypeError} 1 argument required\n * @throws {RangeError} `options.weekStartsOn` must be between 0 and 6\n * @throws {RangeError} `options.firstWeekContainsDate` must be between 1 and 7\n *\n * @example\n * // Which week of the local week numbering year is 2 January 2005 with default options?\n * var result = getISOWeek(new Date(2005, 0, 2))\n * //=> 2\n *\n * // Which week of the local week numbering year is 2 January 2005,\n * // if Monday is the first day of the week,\n * // and the first week of the year always contains 4 January?\n * var result = getISOWeek(new Date(2005, 0, 2), {\n * weekStartsOn: 1,\n * firstWeekContainsDate: 4\n * })\n * //=> 53\n */\n\nexport default function getWeek(dirtyDate, options) {\n if (arguments.length < 1) {\n throw new TypeError(\n '1 argument required, but only ' + arguments.length + ' present'\n )\n }\n\n var date = toDate(dirtyDate)\n var diff =\n startOfWeek(date, options).getTime() -\n startOfWeekYear(date, options).getTime()\n\n // Round the number of days to the nearest integer\n // because the number of milliseconds in a week is not constant\n // (e.g. it's different in the week of the daylight saving time clock shift)\n return Math.round(diff / MILLISECONDS_IN_WEEK) + 1\n}\n","import toInteger from '../_lib/toInteger/index.js'\nimport getDate from '../getDate/index.js'\nimport startOfMonth from '../startOfMonth/index.js'\nimport getDay from '../getDay/index.js'\n\n/**\n * @name getWeekOfMonth\n * @category Week Helpers\n * @summary Get the week of the month of the given date.\n *\n * @description\n * Get the week of the month of the given date.\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} date - the given date\n * @param {Object} [options] - an object with options.\n * @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)\n * @returns {Number} the week of month\n * @throws {TypeError} 1 argument required\n * @throws {RangeError} `options.weekStartsOn` must be between 0 and 6\n *\n * @example\n * // Which week of the month is 9 November 2017?\n * var result = getWeekOfMonth(new Date(2017, 10, 9))\n * //=> 2\n */\nexport default function getWeekOfMonth(date, dirtyOptions) {\n if (arguments.length < 1) {\n throw new TypeError(\n '1 argument required, but only ' + arguments.length + ' present'\n )\n }\n\n var options = dirtyOptions || {}\n var locale = options.locale\n var localeWeekStartsOn =\n locale && locale.options && locale.options.weekStartsOn\n var defaultWeekStartsOn =\n localeWeekStartsOn == null ? 0 : toInteger(localeWeekStartsOn)\n var weekStartsOn =\n options.weekStartsOn == null\n ? defaultWeekStartsOn\n : toInteger(options.weekStartsOn)\n\n // Test if weekStartsOn is between 0 and 6 _and_ is not NaN\n if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {\n throw new RangeError('weekStartsOn must be between 0 and 6 inclusively')\n }\n\n var startWeekDay = getDay(startOfMonth(date))\n var currentWeekDay = getDay(date)\n\n var startWeekDayWithOptions =\n startWeekDay < weekStartsOn ? 7 - weekStartsOn : startWeekDay\n var diff = startWeekDayWithOptions > currentWeekDay ? 7 - weekStartsOn : 0\n\n return Math.ceil((getDate(date) + diff) / 7)\n}\n","import toInteger from '../_lib/toInteger/index.js'\nimport toDate from '../toDate/index.js'\nimport startOfWeek from '../startOfWeek/index.js'\n\n/**\n * @name getWeekYear\n * @category Week-Numbering Year Helpers\n * @summary Get the local week-numbering year of the given date.\n *\n * @description\n * Get the local week-numbering year of the given date.\n * The exact calculation depends on the values of\n * `options.weekStartsOn` (which is the index of the first day of the week)\n * and `options.firstWeekContainsDate` (which is the day of January, which is always in\n * the first week of the week-numbering year)\n *\n * Week numbering: https://en.wikipedia.org/wiki/Week#Week_numbering\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} date - the given date\n * @param {Object} [options] - an object with options.\n * @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)\n * @param {1|2|3|4|5|6|7} [options.firstWeekContainsDate=1] - the day of January, which is always in the first week of the year\n * @returns {Number} the local week-numbering year\n * @throws {TypeError} 1 argument required\n * @throws {RangeError} `options.weekStartsOn` must be between 0 and 6\n * @throws {RangeError} `options.firstWeekContainsDate` must be between 1 and 7\n *\n * @example\n * // Which week numbering year is 26 December 2004 with the default settings?\n * var result = getWeekYear(new Date(2004, 11, 26))\n * //=> 2005\n *\n * @example\n * // Which week numbering year is 26 December 2004 if week starts on Saturday?\n * var result = getWeekYear(new Date(2004, 11, 26), { weekStartsOn: 6 })\n * //=> 2004\n *\n * @example\n * // Which week numbering year is 26 December 2004 if the first week contains 4 January?\n * var result = getWeekYear(new Date(2004, 11, 26), { firstWeekContainsDate: 4 })\n * //=> 2004\n */\nexport default function getWeekYear(dirtyDate, dirtyOptions) {\n if (arguments.length < 1) {\n throw new TypeError(\n '1 argument required, but only ' + arguments.length + ' present'\n )\n }\n\n var date = toDate(dirtyDate)\n var year = date.getFullYear()\n\n var options = dirtyOptions || {}\n var locale = options.locale\n var localeFirstWeekContainsDate =\n locale && locale.options && locale.options.firstWeekContainsDate\n var defaultFirstWeekContainsDate =\n localeFirstWeekContainsDate == null\n ? 1\n : toInteger(localeFirstWeekContainsDate)\n var firstWeekContainsDate =\n options.firstWeekContainsDate == null\n ? defaultFirstWeekContainsDate\n : toInteger(options.firstWeekContainsDate)\n\n // Test if weekStartsOn is between 1 and 7 _and_ is not NaN\n if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) {\n throw new RangeError(\n 'firstWeekContainsDate must be between 1 and 7 inclusively'\n )\n }\n\n var firstWeekOfNextYear = new Date(0)\n firstWeekOfNextYear.setFullYear(year + 1, 0, firstWeekContainsDate)\n firstWeekOfNextYear.setHours(0, 0, 0, 0)\n var startOfNextYear = startOfWeek(firstWeekOfNextYear, dirtyOptions)\n\n var firstWeekOfThisYear = new Date(0)\n firstWeekOfThisYear.setFullYear(year, 0, firstWeekContainsDate)\n firstWeekOfThisYear.setHours(0, 0, 0, 0)\n var startOfThisYear = startOfWeek(firstWeekOfThisYear, dirtyOptions)\n\n if (date.getTime() >= startOfNextYear.getTime()) {\n return year + 1\n } else if (date.getTime() >= startOfThisYear.getTime()) {\n return year\n } else {\n return year - 1\n }\n}\n","import differenceInCalendarWeeks from '../differenceInCalendarWeeks/index.js'\nimport lastDayOfMonth from '../lastDayOfMonth/index.js'\nimport startOfMonth from '../startOfMonth/index.js'\n\n/**\n * @name getWeeksInMonth\n * @category Week Helpers\n * @summary Get the number of calendar weeks a month spans.\n *\n * @description\n * Get the number of calendar weeks the month in the given date spans.\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} date - the given date\n * @param {Object} [options] - an object with options.\n * @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)\n * @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale}\n * @returns {Number} the number of calendar weeks\n * @throws {TypeError} 2 arguments required\n * @throws {RangeError} `options.weekStartsOn` must be between 0 and 6\n *\n * @example\n * // How many calendar weeks does February 2015 span?\n * var result = getWeeksInMonth(new Date(2015, 1, 8))\n * //=> 4\n *\n * @example\n * // If the week starts on Monday,\n * // how many calendar weeks does July 2017 span?\n * var result = getWeeksInMonth(new Date(2017, 6, 5), { weekStartsOn: 1 })\n * //=> 6\n */\nexport default function getWeeksInMonth(date, options) {\n if (arguments.length < 1) {\n throw new TypeError(\n '1 argument required, but only ' + arguments.length + ' present'\n )\n }\n\n return (\n differenceInCalendarWeeks(\n lastDayOfMonth(date),\n startOfMonth(date),\n options\n ) + 1\n )\n}\n","import toDate from '../toDate/index.js'\n\n/**\n * @name getYear\n * @category Year Helpers\n * @summary Get the year of the given date.\n *\n * @description\n * Get the year of the given date.\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} date - the given date\n * @returns {Number} the year\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // Which year is 2 July 2014?\n * var result = getYear(new Date(2014, 6, 2))\n * //=> 2014\n */\nexport default function getYear(dirtyDate) {\n if (arguments.length < 1) {\n throw new TypeError(\n '1 argument required, but only ' + arguments.length + ' present'\n )\n }\n\n var date = toDate(dirtyDate)\n var year = date.getFullYear()\n return year\n}\n","// This file is generated automatically by `scripts/build/indices.js`. Please, don't change it.\n\nexport { default as addDays } from './addDays/index.js'\nexport { default as addHours } from './addHours/index.js'\nexport { default as addISOWeekYears } from './addISOWeekYears/index.js'\nexport { default as addMilliseconds } from './addMilliseconds/index.js'\nexport { default as addMinutes } from './addMinutes/index.js'\nexport { default as addMonths } from './addMonths/index.js'\nexport { default as addQuarters } from './addQuarters/index.js'\nexport { default as addSeconds } from './addSeconds/index.js'\nexport { default as addWeeks } from './addWeeks/index.js'\nexport { default as addYears } from './addYears/index.js'\nexport {\n default as areIntervalsOverlapping\n} from './areIntervalsOverlapping/index.js'\nexport { default as closestIndexTo } from './closestIndexTo/index.js'\nexport { default as closestTo } from './closestTo/index.js'\nexport { default as compareAsc } from './compareAsc/index.js'\nexport { default as compareDesc } from './compareDesc/index.js'\nexport {\n default as differenceInCalendarDays\n} from './differenceInCalendarDays/index.js'\nexport {\n default as differenceInCalendarISOWeekYears\n} from './differenceInCalendarISOWeekYears/index.js'\nexport {\n default as differenceInCalendarISOWeeks\n} from './differenceInCalendarISOWeeks/index.js'\nexport {\n default as differenceInCalendarMonths\n} from './differenceInCalendarMonths/index.js'\nexport {\n default as differenceInCalendarQuarters\n} from './differenceInCalendarQuarters/index.js'\nexport {\n default as differenceInCalendarWeeks\n} from './differenceInCalendarWeeks/index.js'\nexport {\n default as differenceInCalendarYears\n} from './differenceInCalendarYears/index.js'\nexport { default as differenceInDays } from './differenceInDays/index.js'\nexport { default as differenceInHours } from './differenceInHours/index.js'\nexport {\n default as differenceInISOWeekYears\n} from './differenceInISOWeekYears/index.js'\nexport {\n default as differenceInMilliseconds\n} from './differenceInMilliseconds/index.js'\nexport { default as differenceInMinutes } from './differenceInMinutes/index.js'\nexport { default as differenceInMonths } from './differenceInMonths/index.js'\nexport {\n default as differenceInQuarters\n} from './differenceInQuarters/index.js'\nexport { default as differenceInSeconds } from './differenceInSeconds/index.js'\nexport { default as differenceInWeeks } from './differenceInWeeks/index.js'\nexport { default as differenceInYears } from './differenceInYears/index.js'\nexport { default as eachDayOfInterval } from './eachDayOfInterval/index.js'\nexport { default as eachWeekOfInterval } from './eachWeekOfInterval/index.js'\nexport {\n default as eachWeekendOfInterval\n} from './eachWeekendOfInterval/index.js'\nexport { default as eachWeekendOfMonth } from './eachWeekendOfMonth/index.js'\nexport { default as eachWeekendOfYear } from './eachWeekendOfYear/index.js'\nexport { default as endOfDay } from './endOfDay/index.js'\nexport { default as endOfDecade } from './endOfDecade/index.js'\nexport { default as endOfHour } from './endOfHour/index.js'\nexport { default as endOfISOWeek } from './endOfISOWeek/index.js'\nexport { default as endOfISOWeekYear } from './endOfISOWeekYear/index.js'\nexport { default as endOfMinute } from './endOfMinute/index.js'\nexport { default as endOfMonth } from './endOfMonth/index.js'\nexport { default as endOfQuarter } from './endOfQuarter/index.js'\nexport { default as endOfSecond } from './endOfSecond/index.js'\nexport { default as endOfWeek } from './endOfWeek/index.js'\nexport { default as endOfYear } from './endOfYear/index.js'\nexport { default as format } from './format/index.js'\nexport { default as formatDistance } from './formatDistance/index.js'\nexport {\n default as formatDistanceStrict\n} from './formatDistanceStrict/index.js'\nexport { default as formatRelative } from './formatRelative/index.js'\nexport { default as fromUnixTime } from './fromUnixTime/index.js'\nexport { default as getDate } from './getDate/index.js'\nexport { default as getDay } from './getDay/index.js'\nexport { default as getDayOfYear } from './getDayOfYear/index.js'\nexport { default as getDaysInMonth } from './getDaysInMonth/index.js'\nexport { default as getDaysInYear } from './getDaysInYear/index.js'\nexport { default as getDecade } from './getDecade/index.js'\nexport { default as getHours } from './getHours/index.js'\nexport { default as getISODay } from './getISODay/index.js'\nexport { default as getISOWeek } from './getISOWeek/index.js'\nexport { default as getISOWeekYear } from './getISOWeekYear/index.js'\nexport { default as getISOWeeksInYear } from './getISOWeeksInYear/index.js'\nexport { default as getMilliseconds } from './getMilliseconds/index.js'\nexport { default as getMinutes } from './getMinutes/index.js'\nexport { default as getMonth } from './getMonth/index.js'\nexport {\n default as getOverlappingDaysInIntervals\n} from './getOverlappingDaysInIntervals/index.js'\nexport { default as getQuarter } from './getQuarter/index.js'\nexport { default as getSeconds } from './getSeconds/index.js'\nexport { default as getTime } from './getTime/index.js'\nexport { default as getUnixTime } from './getUnixTime/index.js'\nexport { default as getWeek } from './getWeek/index.js'\nexport { default as getWeekOfMonth } from './getWeekOfMonth/index.js'\nexport { default as getWeekYear } from './getWeekYear/index.js'\nexport { default as getWeeksInMonth } from './getWeeksInMonth/index.js'\nexport { default as getYear } from './getYear/index.js'\nexport { default as isAfter } from './isAfter/index.js'\nexport { default as isBefore } from './isBefore/index.js'\nexport { default as isDate } from './isDate/index.js'\nexport { default as isEqual } from './isEqual/index.js'\nexport { default as isFirstDayOfMonth } from './isFirstDayOfMonth/index.js'\nexport { default as isFriday } from './isFriday/index.js'\nexport { default as isLastDayOfMonth } from './isLastDayOfMonth/index.js'\nexport { default as isLeapYear } from './isLeapYear/index.js'\nexport { default as isMonday } from './isMonday/index.js'\nexport { default as isSameDay } from './isSameDay/index.js'\nexport { default as isSameHour } from './isSameHour/index.js'\nexport { default as isSameISOWeek } from './isSameISOWeek/index.js'\nexport { default as isSameISOWeekYear } from './isSameISOWeekYear/index.js'\nexport { default as isSameMinute } from './isSameMinute/index.js'\nexport { default as isSameMonth } from './isSameMonth/index.js'\nexport { default as isSameQuarter } from './isSameQuarter/index.js'\nexport { default as isSameSecond } from './isSameSecond/index.js'\nexport { default as isSameWeek } from './isSameWeek/index.js'\nexport { default as isSameYear } from './isSameYear/index.js'\nexport { default as isSaturday } from './isSaturday/index.js'\nexport { default as isSunday } from './isSunday/index.js'\nexport { default as isThursday } from './isThursday/index.js'\nexport { default as isTuesday } from './isTuesday/index.js'\nexport { default as isValid } from './isValid/index.js'\nexport { default as isWednesday } from './isWednesday/index.js'\nexport { default as isWeekend } from './isWeekend/index.js'\nexport { default as isWithinInterval } from './isWithinInterval/index.js'\nexport { default as lastDayOfDecade } from './lastDayOfDecade/index.js'\nexport { default as lastDayOfISOWeek } from './lastDayOfISOWeek/index.js'\nexport {\n default as lastDayOfISOWeekYear\n} from './lastDayOfISOWeekYear/index.js'\nexport { default as lastDayOfMonth } from './lastDayOfMonth/index.js'\nexport { default as lastDayOfQuarter } from './lastDayOfQuarter/index.js'\nexport { default as lastDayOfWeek } from './lastDayOfWeek/index.js'\nexport { default as lastDayOfYear } from './lastDayOfYear/index.js'\nexport { default as lightFormat } from './lightFormat/index.js'\nexport { default as max } from './max/index.js'\nexport { default as min } from './min/index.js'\nexport { default as parse } from './parse/index.js'\nexport { default as parseISO } from './parseISO/index.js'\nexport {\n default as roundToNearestMinutes\n} from './roundToNearestMinutes/index.js'\nexport { default as setDate } from './setDate/index.js'\nexport { default as setDay } from './setDay/index.js'\nexport { default as setDayOfYear } from './setDayOfYear/index.js'\nexport { default as setHours } from './setHours/index.js'\nexport { default as setISODay } from './setISODay/index.js'\nexport { default as setISOWeek } from './setISOWeek/index.js'\nexport { default as setISOWeekYear } from './setISOWeekYear/index.js'\nexport { default as setMilliseconds } from './setMilliseconds/index.js'\nexport { default as setMinutes } from './setMinutes/index.js'\nexport { default as setMonth } from './setMonth/index.js'\nexport { default as setQuarter } from './setQuarter/index.js'\nexport { default as setSeconds } from './setSeconds/index.js'\nexport { default as setWeek } from './setWeek/index.js'\nexport { default as setWeekYear } from './setWeekYear/index.js'\nexport { default as setYear } from './setYear/index.js'\nexport { default as startOfDay } from './startOfDay/index.js'\nexport { default as startOfDecade } from './startOfDecade/index.js'\nexport { default as startOfHour } from './startOfHour/index.js'\nexport { default as startOfISOWeek } from './startOfISOWeek/index.js'\nexport { default as startOfISOWeekYear } from './startOfISOWeekYear/index.js'\nexport { default as startOfMinute } from './startOfMinute/index.js'\nexport { default as startOfMonth } from './startOfMonth/index.js'\nexport { default as startOfQuarter } from './startOfQuarter/index.js'\nexport { default as startOfSecond } from './startOfSecond/index.js'\nexport { default as startOfWeek } from './startOfWeek/index.js'\nexport { default as startOfWeekYear } from './startOfWeekYear/index.js'\nexport { default as startOfYear } from './startOfYear/index.js'\nexport { default as subDays } from './subDays/index.js'\nexport { default as subHours } from './subHours/index.js'\nexport { default as subISOWeekYears } from './subISOWeekYears/index.js'\nexport { default as subMilliseconds } from './subMilliseconds/index.js'\nexport { default as subMinutes } from './subMinutes/index.js'\nexport { default as subMonths } from './subMonths/index.js'\nexport { default as subQuarters } from './subQuarters/index.js'\nexport { default as subSeconds } from './subSeconds/index.js'\nexport { default as subWeeks } from './subWeeks/index.js'\nexport { default as subYears } from './subYears/index.js'\nexport { default as toDate } from './toDate/index.js'\n","import toDate from '../toDate/index.js'\n\n/**\n * @name isAfter\n * @category Common Helpers\n * @summary Is the first date after the second one?\n *\n * @description\n * Is the first date after the second one?\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} date - the date that should be after the other one to return true\n * @param {Date|Number} dateToCompare - the date to compare with\n * @returns {Boolean} the first date is after the second date\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Is 10 July 1989 after 11 February 1987?\n * var result = isAfter(new Date(1989, 6, 10), new Date(1987, 1, 11))\n * //=> true\n */\nexport default function isAfter(dirtyDate, dirtyDateToCompare) {\n if (arguments.length < 2) {\n throw new TypeError(\n '2 arguments required, but only ' + arguments.length + ' present'\n )\n }\n\n var date = toDate(dirtyDate)\n var dateToCompare = toDate(dirtyDateToCompare)\n return date.getTime() > dateToCompare.getTime()\n}\n","import toDate from '../toDate/index.js'\n\n/**\n * @name isBefore\n * @category Common Helpers\n * @summary Is the first date before the second one?\n *\n * @description\n * Is the first date before the second one?\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} date - the date that should be before the other one to return true\n * @param {Date|Number} dateToCompare - the date to compare with\n * @returns {Boolean} the first date is before the second date\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Is 10 July 1989 before 11 February 1987?\n * var result = isBefore(new Date(1989, 6, 10), new Date(1987, 1, 11))\n * //=> false\n */\nexport default function isBefore(dirtyDate, dirtyDateToCompare) {\n if (arguments.length < 2) {\n throw new TypeError(\n '2 arguments required, but only ' + arguments.length + ' present'\n )\n }\n\n var date = toDate(dirtyDate)\n var dateToCompare = toDate(dirtyDateToCompare)\n return date.getTime() < dateToCompare.getTime()\n}\n","/**\n * @name isDate\n * @category Common Helpers\n * @summary Is the given value a date?\n *\n * @description\n * Returns true if the given value is an instance of Date. The function works for dates transferred across iframes.\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {*} value - the value to check\n * @returns {boolean} true if the given value is a date\n * @throws {TypeError} 1 arguments required\n *\n * @example\n * // For a valid date:\n * var result = isDate(new Date())\n * //=> true\n *\n * @example\n * // For an invalid date:\n * var result = isDate(new Date(NaN))\n * //=> true\n *\n * @example\n * // For some value:\n * var result = isDate('2014-02-31')\n * //=> false\n *\n * @example\n * // For an object:\n * var result = isDate({})\n * //=> false\n */\nexport default function isDate(value) {\n if (arguments.length < 1) {\n throw new TypeError(\n '1 argument required, but only ' + arguments.length + ' present'\n )\n }\n\n return (\n value instanceof Date ||\n (typeof value === 'object' &&\n Object.prototype.toString.call(value) === '[object Date]')\n )\n}\n","import toDate from '../toDate/index.js'\n\n/**\n * @name isEqual\n * @category Common Helpers\n * @summary Are the given dates equal?\n *\n * @description\n * Are the given dates equal?\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} dateLeft - the first date to compare\n * @param {Date|Number} dateRight - the second date to compare\n * @returns {Boolean} the dates are equal\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Are 2 July 2014 06:30:45.000 and 2 July 2014 06:30:45.500 equal?\n * var result = isEqual(\n * new Date(2014, 6, 2, 6, 30, 45, 0),\n * new Date(2014, 6, 2, 6, 30, 45, 500)\n * )\n * //=> false\n */\nexport default function isEqual(dirtyLeftDate, dirtyRightDate) {\n if (arguments.length < 2) {\n throw new TypeError(\n '2 arguments required, but only ' + arguments.length + ' present'\n )\n }\n\n var dateLeft = toDate(dirtyLeftDate)\n var dateRight = toDate(dirtyRightDate)\n return dateLeft.getTime() === dateRight.getTime()\n}\n","import toDate from '../toDate/index.js'\n\n/**\n * @name isFirstDayOfMonth\n * @category Month Helpers\n * @summary Is the given date the first day of a month?\n *\n * @description\n * Is the given date the first day of a month?\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} date - the date to check\n * @returns {Boolean} the date is the first day of a month\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // Is 1 September 2014 the first day of a month?\n * var result = isFirstDayOfMonth(new Date(2014, 8, 1))\n * //=> true\n */\nexport default function isFirstDayOfMonth(dirtyDate) {\n if (arguments.length < 1) {\n throw new TypeError(\n '1 argument required, but only ' + arguments.length + ' present'\n )\n }\n\n return toDate(dirtyDate).getDate() === 1\n}\n","import toDate from '../toDate/index.js'\n\n/**\n * @name isFriday\n * @category Weekday Helpers\n * @summary Is the given date Friday?\n *\n * @description\n * Is the given date Friday?\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} date - the date to check\n * @returns {Boolean} the date is Friday\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // Is 26 September 2014 Friday?\n * var result = isFriday(new Date(2014, 8, 26))\n * //=> true\n */\nexport default function isFriday(dirtyDate) {\n if (arguments.length < 1) {\n throw new TypeError(\n '1 argument required, but only ' + arguments.length + ' present'\n )\n }\n\n return toDate(dirtyDate).getDay() === 5\n}\n","import toDate from '../toDate/index.js'\nimport endOfDay from '../endOfDay/index.js'\nimport endOfMonth from '../endOfMonth/index.js'\n\n/**\n * @name isLastDayOfMonth\n * @category Month Helpers\n * @summary Is the given date the last day of a month?\n *\n * @description\n * Is the given date the last day of a month?\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} date - the date to check\n * @returns {Boolean} the date is the last day of a month\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // Is 28 February 2014 the last day of a month?\n * var result = isLastDayOfMonth(new Date(2014, 1, 28))\n * //=> true\n */\nexport default function isLastDayOfMonth(dirtyDate) {\n if (arguments.length < 1) {\n throw new TypeError(\n '1 argument required, but only ' + arguments.length + ' present'\n )\n }\n\n var date = toDate(dirtyDate)\n return endOfDay(date).getTime() === endOfMonth(date).getTime()\n}\n","import toDate from '../toDate/index.js'\n\n/**\n * @name isLeapYear\n * @category Year Helpers\n * @summary Is the given date in the leap year?\n *\n * @description\n * Is the given date in the leap year?\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} date - the date to check\n * @returns {Boolean} the date is in the leap year\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // Is 1 September 2012 in the leap year?\n * var result = isLeapYear(new Date(2012, 8, 1))\n * //=> true\n */\nexport default function isLeapYear(dirtyDate) {\n if (arguments.length < 1) {\n throw new TypeError(\n '1 argument required, but only ' + arguments.length + ' present'\n )\n }\n\n var date = toDate(dirtyDate)\n var year = date.getFullYear()\n return year % 400 === 0 || (year % 4 === 0 && year % 100 !== 0)\n}\n","import toDate from '../toDate/index.js'\n\n/**\n * @name isMonday\n * @category Weekday Helpers\n * @summary Is the given date Monday?\n *\n * @description\n * Is the given date Monday?\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} date - the date to check\n * @returns {Boolean} the date is Monday\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // Is 22 September 2014 Monday?\n * var result = isMonday(new Date(2014, 8, 22))\n * //=> true\n */\nexport default function isMonday(dirtyDate) {\n if (arguments.length < 1) {\n throw new TypeError(\n '1 argument required, but only ' + arguments.length + ' present'\n )\n }\n\n return toDate(dirtyDate).getDay() === 1\n}\n","import startOfDay from '../startOfDay/index.js'\n\n/**\n * @name isSameDay\n * @category Day Helpers\n * @summary Are the given dates in the same day?\n *\n * @description\n * Are the given dates in the same day?\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} dateLeft - the first date to check\n * @param {Date|Number} dateRight - the second date to check\n * @returns {Boolean} the dates are in the same day\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Are 4 September 06:00:00 and 4 September 18:00:00 in the same day?\n * var result = isSameDay(new Date(2014, 8, 4, 6, 0), new Date(2014, 8, 4, 18, 0))\n * //=> true\n */\nexport default function isSameDay(dirtyDateLeft, dirtyDateRight) {\n if (arguments.length < 2) {\n throw new TypeError(\n '2 arguments required, but only ' + arguments.length + ' present'\n )\n }\n\n var dateLeftStartOfDay = startOfDay(dirtyDateLeft)\n var dateRightStartOfDay = startOfDay(dirtyDateRight)\n\n return dateLeftStartOfDay.getTime() === dateRightStartOfDay.getTime()\n}\n","import startOfHour from '../startOfHour/index.js'\n\n/**\n * @name isSameHour\n * @category Hour Helpers\n * @summary Are the given dates in the same hour?\n *\n * @description\n * Are the given dates in the same hour?\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} dateLeft - the first date to check\n * @param {Date|Number} dateRight - the second date to check\n * @returns {Boolean} the dates are in the same hour\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Are 4 September 2014 06:00:00 and 4 September 06:30:00 in the same hour?\n * var result = isSameHour(new Date(2014, 8, 4, 6, 0), new Date(2014, 8, 4, 6, 30))\n * //=> true\n */\nexport default function isSameHour(dirtyDateLeft, dirtyDateRight) {\n if (arguments.length < 2) {\n throw new TypeError(\n '2 arguments required, but only ' + arguments.length + ' present'\n )\n }\n\n var dateLeftStartOfHour = startOfHour(dirtyDateLeft)\n var dateRightStartOfHour = startOfHour(dirtyDateRight)\n\n return dateLeftStartOfHour.getTime() === dateRightStartOfHour.getTime()\n}\n","import isSameWeek from '../isSameWeek/index.js'\n\n/**\n * @name isSameISOWeek\n * @category ISO Week Helpers\n * @summary Are the given dates in the same ISO week?\n *\n * @description\n * Are the given dates in the same ISO week?\n *\n * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} dateLeft - the first date to check\n * @param {Date|Number} dateRight - the second date to check\n * @returns {Boolean} the dates are in the same ISO week\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Are 1 September 2014 and 7 September 2014 in the same ISO week?\n * var result = isSameISOWeek(new Date(2014, 8, 1), new Date(2014, 8, 7))\n * //=> true\n */\nexport default function isSameISOWeek(dirtyDateLeft, dirtyDateRight) {\n if (arguments.length < 2) {\n throw new TypeError(\n '2 arguments required, but only ' + arguments.length + ' present'\n )\n }\n\n return isSameWeek(dirtyDateLeft, dirtyDateRight, { weekStartsOn: 1 })\n}\n","import startOfISOWeekYear from '../startOfISOWeekYear/index.js'\n\n/**\n * @name isSameISOWeekYear\n * @category ISO Week-Numbering Year Helpers\n * @summary Are the given dates in the same ISO week-numbering year?\n *\n * @description\n * Are the given dates in the same ISO week-numbering year?\n *\n * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * - The function was renamed from `isSameISOYear` to `isSameISOWeekYear`.\n * \"ISO week year\" is short for [ISO week-numbering year](https://en.wikipedia.org/wiki/ISO_week_date).\n * This change makes the name consistent with\n * locale-dependent week-numbering year helpers, e.g., `getWeekYear`.\n *\n * @param {Date|Number} dateLeft - the first date to check\n * @param {Date|Number} dateRight - the second date to check\n * @returns {Boolean} the dates are in the same ISO week-numbering year\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Are 29 December 2003 and 2 January 2005 in the same ISO week-numbering year?\n * var result = isSameISOWeekYear(new Date(2003, 11, 29), new Date(2005, 0, 2))\n * //=> true\n */\nexport default function isSameISOWeekYear(dirtyDateLeft, dirtyDateRight) {\n if (arguments.length < 2) {\n throw new TypeError(\n '2 arguments required, but only ' + arguments.length + ' present'\n )\n }\n\n var dateLeftStartOfYear = startOfISOWeekYear(dirtyDateLeft)\n var dateRightStartOfYear = startOfISOWeekYear(dirtyDateRight)\n\n return dateLeftStartOfYear.getTime() === dateRightStartOfYear.getTime()\n}\n","import startOfMinute from '../startOfMinute/index.js'\n\n/**\n * @name isSameMinute\n * @category Minute Helpers\n * @summary Are the given dates in the same minute?\n *\n * @description\n * Are the given dates in the same minute?\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} dateLeft - the first date to check\n * @param {Date|Number} dateRight - the second date to check\n * @returns {Boolean} the dates are in the same minute\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Are 4 September 2014 06:30:00 and 4 September 2014 06:30:15\n * // in the same minute?\n * var result = isSameMinute(\n * new Date(2014, 8, 4, 6, 30),\n * new Date(2014, 8, 4, 6, 30, 15)\n * )\n * //=> true\n */\nexport default function isSameMinute(dirtyDateLeft, dirtyDateRight) {\n if (arguments.length < 2) {\n throw new TypeError(\n '2 arguments required, but only ' + arguments.length + ' present'\n )\n }\n\n var dateLeftStartOfMinute = startOfMinute(dirtyDateLeft)\n var dateRightStartOfMinute = startOfMinute(dirtyDateRight)\n\n return dateLeftStartOfMinute.getTime() === dateRightStartOfMinute.getTime()\n}\n","import toDate from '../toDate/index.js'\n\n/**\n * @name isSameMonth\n * @category Month Helpers\n * @summary Are the given dates in the same month?\n *\n * @description\n * Are the given dates in the same month?\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} dateLeft - the first date to check\n * @param {Date|Number} dateRight - the second date to check\n * @returns {Boolean} the dates are in the same month\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Are 2 September 2014 and 25 September 2014 in the same month?\n * var result = isSameMonth(new Date(2014, 8, 2), new Date(2014, 8, 25))\n * //=> true\n */\nexport default function isSameMonth(dirtyDateLeft, dirtyDateRight) {\n if (arguments.length < 2) {\n throw new TypeError(\n '2 arguments required, but only ' + arguments.length + ' present'\n )\n }\n\n var dateLeft = toDate(dirtyDateLeft)\n var dateRight = toDate(dirtyDateRight)\n return (\n dateLeft.getFullYear() === dateRight.getFullYear() &&\n dateLeft.getMonth() === dateRight.getMonth()\n )\n}\n","import startOfQuarter from '../startOfQuarter/index.js'\n\n/**\n * @name isSameQuarter\n * @category Quarter Helpers\n * @summary Are the given dates in the same year quarter?\n *\n * @description\n * Are the given dates in the same year quarter?\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} dateLeft - the first date to check\n * @param {Date|Number} dateRight - the second date to check\n * @returns {Boolean} the dates are in the same quarter\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Are 1 January 2014 and 8 March 2014 in the same quarter?\n * var result = isSameQuarter(new Date(2014, 0, 1), new Date(2014, 2, 8))\n * //=> true\n */\nexport default function isSameQuarter(dirtyDateLeft, dirtyDateRight) {\n if (arguments.length < 2) {\n throw new TypeError(\n '2 arguments required, but only ' + arguments.length + ' present'\n )\n }\n\n var dateLeftStartOfQuarter = startOfQuarter(dirtyDateLeft)\n var dateRightStartOfQuarter = startOfQuarter(dirtyDateRight)\n\n return dateLeftStartOfQuarter.getTime() === dateRightStartOfQuarter.getTime()\n}\n","import startOfSecond from '../startOfSecond/index.js'\n\n/**\n * @name isSameSecond\n * @category Second Helpers\n * @summary Are the given dates in the same second?\n *\n * @description\n * Are the given dates in the same second?\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} dateLeft - the first date to check\n * @param {Date|Number} dateRight - the second date to check\n * @returns {Boolean} the dates are in the same second\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Are 4 September 2014 06:30:15.000 and 4 September 2014 06:30.15.500\n * // in the same second?\n * var result = isSameSecond(\n * new Date(2014, 8, 4, 6, 30, 15),\n * new Date(2014, 8, 4, 6, 30, 15, 500)\n * )\n * //=> true\n */\nexport default function isSameSecond(dirtyDateLeft, dirtyDateRight) {\n if (arguments.length < 2) {\n throw new TypeError(\n '2 arguments required, but only ' + arguments.length + ' present'\n )\n }\n\n var dateLeftStartOfSecond = startOfSecond(dirtyDateLeft)\n var dateRightStartOfSecond = startOfSecond(dirtyDateRight)\n\n return dateLeftStartOfSecond.getTime() === dateRightStartOfSecond.getTime()\n}\n","import startOfWeek from '../startOfWeek/index.js'\n\n/**\n * @name isSameWeek\n * @category Week Helpers\n * @summary Are the given dates in the same week?\n *\n * @description\n * Are the given dates in the same week?\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} dateLeft - the first date to check\n * @param {Date|Number} dateRight - the second date to check\n * @param {Object} [options] - an object with options.\n * @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)\n * @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale}\n * @returns {Boolean} the dates are in the same week\n * @throws {TypeError} 2 arguments required\n * @throws {RangeError} `options.weekStartsOn` must be between 0 and 6\n *\n * @example\n * // Are 31 August 2014 and 4 September 2014 in the same week?\n * var result = isSameWeek(new Date(2014, 7, 31), new Date(2014, 8, 4))\n * //=> true\n *\n * @example\n * // If week starts with Monday,\n * // are 31 August 2014 and 4 September 2014 in the same week?\n * var result = isSameWeek(new Date(2014, 7, 31), new Date(2014, 8, 4), {\n * weekStartsOn: 1\n * })\n * //=> false\n */\nexport default function isSameWeek(\n dirtyDateLeft,\n dirtyDateRight,\n dirtyOptions\n) {\n if (arguments.length < 2) {\n throw new TypeError(\n '2 arguments required, but only ' + arguments.length + ' present'\n )\n }\n\n var dateLeftStartOfWeek = startOfWeek(dirtyDateLeft, dirtyOptions)\n var dateRightStartOfWeek = startOfWeek(dirtyDateRight, dirtyOptions)\n\n return dateLeftStartOfWeek.getTime() === dateRightStartOfWeek.getTime()\n}\n","import toDate from '../toDate/index.js'\n\n/**\n * @name isSameYear\n * @category Year Helpers\n * @summary Are the given dates in the same year?\n *\n * @description\n * Are the given dates in the same year?\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} dateLeft - the first date to check\n * @param {Date|Number} dateRight - the second date to check\n * @returns {Boolean} the dates are in the same year\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Are 2 September 2014 and 25 September 2014 in the same year?\n * var result = isSameYear(new Date(2014, 8, 2), new Date(2014, 8, 25))\n * //=> true\n */\nexport default function isSameYear(dirtyDateLeft, dirtyDateRight) {\n if (arguments.length < 2) {\n throw new TypeError(\n '2 arguments required, but only ' + arguments.length + ' present'\n )\n }\n\n var dateLeft = toDate(dirtyDateLeft)\n var dateRight = toDate(dirtyDateRight)\n return dateLeft.getFullYear() === dateRight.getFullYear()\n}\n","import toDate from '../toDate/index.js'\n\n/**\n * @name isSaturday\n * @category Weekday Helpers\n * @summary Is the given date Saturday?\n *\n * @description\n * Is the given date Saturday?\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} date - the date to check\n * @returns {Boolean} the date is Saturday\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // Is 27 September 2014 Saturday?\n * var result = isSaturday(new Date(2014, 8, 27))\n * //=> true\n */\nexport default function isSaturday(dirtyDate) {\n if (arguments.length < 1) {\n throw new TypeError(\n '1 argument required, but only ' + arguments.length + ' present'\n )\n }\n\n return toDate(dirtyDate).getDay() === 6\n}\n","import toDate from '../toDate/index.js'\n\n/**\n * @name isSunday\n * @category Weekday Helpers\n * @summary Is the given date Sunday?\n *\n * @description\n * Is the given date Sunday?\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} date - the date to check\n * @returns {Boolean} the date is Sunday\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // Is 21 September 2014 Sunday?\n * var result = isSunday(new Date(2014, 8, 21))\n * //=> true\n */\nexport default function isSunday(dirtyDate) {\n if (arguments.length < 1) {\n throw new TypeError(\n '1 argument required, but only ' + arguments.length + ' present'\n )\n }\n\n return toDate(dirtyDate).getDay() === 0\n}\n","import toDate from '../toDate/index.js'\n\n/**\n * @name isThursday\n * @category Weekday Helpers\n * @summary Is the given date Thursday?\n *\n * @description\n * Is the given date Thursday?\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} date - the date to check\n * @returns {Boolean} the date is Thursday\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // Is 25 September 2014 Thursday?\n * var result = isThursday(new Date(2014, 8, 25))\n * //=> true\n */\nexport default function isThursday(dirtyDate) {\n if (arguments.length < 1) {\n throw new TypeError(\n '1 argument required, but only ' + arguments.length + ' present'\n )\n }\n\n return toDate(dirtyDate).getDay() === 4\n}\n","import toDate from '../toDate/index.js'\n\n/**\n * @name isTuesday\n * @category Weekday Helpers\n * @summary Is the given date Tuesday?\n *\n * @description\n * Is the given date Tuesday?\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} date - the date to check\n * @returns {Boolean} the date is Tuesday\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // Is 23 September 2014 Tuesday?\n * var result = isTuesday(new Date(2014, 8, 23))\n * //=> true\n */\nexport default function isTuesday(dirtyDate) {\n if (arguments.length < 1) {\n throw new TypeError(\n '1 argument required, but only ' + arguments.length + ' present'\n )\n }\n\n return toDate(dirtyDate).getDay() === 2\n}\n","import toDate from '../toDate/index.js'\n\n/**\n * @name isValid\n * @category Common Helpers\n * @summary Is the given date valid?\n *\n * @description\n * Returns false if argument is Invalid Date and true otherwise.\n * Argument is converted to Date using `toDate`. See [toDate]{@link https://date-fns.org/docs/toDate}\n * Invalid Date is a Date, whose time value is NaN.\n *\n * Time value of Date: http://es5.github.io/#x15.9.1.1\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * - Now `isValid` doesn't throw an exception\n * if the first argument is not an instance of Date.\n * Instead, argument is converted beforehand using `toDate`.\n *\n * Examples:\n *\n * | `isValid` argument | Before v2.0.0 | v2.0.0 onward |\n * |---------------------------|---------------|---------------|\n * | `new Date()` | `true` | `true` |\n * | `new Date('2016-01-01')` | `true` | `true` |\n * | `new Date('')` | `false` | `false` |\n * | `new Date(1488370835081)` | `true` | `true` |\n * | `new Date(NaN)` | `false` | `false` |\n * | `'2016-01-01'` | `TypeError` | `true` |\n * | `''` | `TypeError` | `false` |\n * | `1488370835081` | `TypeError` | `true` |\n * | `NaN` | `TypeError` | `false` |\n *\n * We introduce this change to make *date-fns* consistent with ECMAScript behavior\n * that try to coerce arguments to the expected type\n * (which is also the case with other *date-fns* functions).\n *\n * @param {*} date - the date to check\n * @returns {Boolean} the date is valid\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // For the valid date:\n * var result = isValid(new Date(2014, 1, 31))\n * //=> true\n *\n * @example\n * // For the value, convertable into a date:\n * var result = isValid(1393804800000)\n * //=> true\n *\n * @example\n * // For the invalid date:\n * var result = isValid(new Date(''))\n * //=> false\n */\nexport default function isValid(dirtyDate) {\n if (arguments.length < 1) {\n throw new TypeError(\n '1 argument required, but only ' + arguments.length + ' present'\n )\n }\n\n var date = toDate(dirtyDate)\n return !isNaN(date)\n}\n","import toDate from '../toDate/index.js'\n\n/**\n * @name isWednesday\n * @category Weekday Helpers\n * @summary Is the given date Wednesday?\n *\n * @description\n * Is the given date Wednesday?\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} date - the date to check\n * @returns {Boolean} the date is Wednesday\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // Is 24 September 2014 Wednesday?\n * var result = isWednesday(new Date(2014, 8, 24))\n * //=> true\n */\nexport default function isWednesday(dirtyDate) {\n if (arguments.length < 1) {\n throw new TypeError(\n '1 argument required, but only ' + arguments.length + ' present'\n )\n }\n\n return toDate(dirtyDate).getDay() === 3\n}\n","import toDate from '../toDate/index.js'\n\n/**\n * @name isWeekend\n * @category Weekday Helpers\n * @summary Does the given date fall on a weekend?\n *\n * @description\n * Does the given date fall on a weekend?\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} date - the date to check\n * @returns {Boolean} the date falls on a weekend\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // Does 5 October 2014 fall on a weekend?\n * var result = isWeekend(new Date(2014, 9, 5))\n * //=> true\n */\nexport default function isWeekend(dirtyDate) {\n if (arguments.length < 1) {\n throw new TypeError(\n '1 argument required, but only ' + arguments.length + ' present'\n )\n }\n\n var date = toDate(dirtyDate)\n var day = date.getDay()\n return day === 0 || day === 6\n}\n","import toDate from '../toDate/index.js'\n\n/**\n * @name isWithinInterval\n * @category Interval Helpers\n * @summary Is the given date within the interval?\n *\n * @description\n * Is the given date within the interval?\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * - The function was renamed from `isWithinRange` to `isWithinInterval`.\n * This change was made to mirror the use of the word \"interval\" in standard ISO 8601:2004 terminology:\n *\n * ```\n * 2.1.3\n * time interval\n * part of the time axis limited by two instants\n * ```\n *\n * Also, this function now accepts an object with `start` and `end` properties\n * instead of two arguments as an interval.\n * This function now throws `RangeError` if the start of the interval is after its end\n * or if any date in the interval is `Invalid Date`.\n *\n * ```javascript\n * // Before v2.0.0\n *\n * isWithinRange(\n * new Date(2014, 0, 3),\n * new Date(2014, 0, 1), new Date(2014, 0, 7)\n * )\n *\n * // v2.0.0 onward\n *\n * isWithinInterval(\n * new Date(2014, 0, 3),\n * { start: new Date(2014, 0, 1), end: new Date(2014, 0, 7) }\n * )\n * ```\n *\n * @param {Date|Number} date - the date to check\n * @param {Interval} interval - the interval to check\n * @returns {Boolean} the date is within the interval\n * @throws {TypeError} 2 arguments required\n * @throws {RangeError} The start of an interval cannot be after its end\n * @throws {RangeError} Date in interval cannot be `Invalid Date`\n *\n * @example\n * // For the date within the interval:\n * isWithinInterval(new Date(2014, 0, 3), {\n * start: new Date(2014, 0, 1),\n * end: new Date(2014, 0, 7)\n * })\n * //=> true\n *\n * @example\n * // For the date outside of the interval:\n * isWithinInterval(new Date(2014, 0, 10), {\n * start: new Date(2014, 0, 1),\n * end: new Date(2014, 0, 7)\n * })\n * //=> false\n */\nexport default function isWithinInterval(dirtyDate, dirtyInterval) {\n if (arguments.length < 2) {\n throw new TypeError(\n '2 arguments required, but only ' + arguments.length + ' present'\n )\n }\n\n var interval = dirtyInterval || {}\n var time = toDate(dirtyDate).getTime()\n var startTime = toDate(interval.start).getTime()\n var endTime = toDate(interval.end).getTime()\n\n // Throw an exception if start date is after end date or if any date is `Invalid Date`\n if (!(startTime <= endTime)) {\n throw new RangeError('Invalid interval')\n }\n\n return time >= startTime && time <= endTime\n}\n","import toDate from '../toDate/index.js'\n\n/**\n * @name lastDayOfDecade\n * @category Decade Helpers\n * @summary Return the last day of a decade for the given date.\n *\n * @description\n * Return the last day of a decade for the given date.\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} date - the original date\n * @returns {Date} the last day of a decade\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // The last day of a decade for 21 December 2012 21:12:00:\n * var result = lastDayOfDecade(new Date(2012, 11, 21, 21, 12, 00))\n * //=> Wed Dec 31 2019 00:00:00\n */\nexport default function lastDayOfDecade(dirtyDate) {\n if (arguments.length < 1) {\n throw new TypeError(\n '1 argument required, but only ' + arguments.length + ' present'\n )\n }\n\n var date = toDate(dirtyDate)\n var year = date.getFullYear()\n var decade = 9 + Math.floor(year / 10) * 10\n date.setFullYear(decade + 1, 0, 0)\n date.setHours(0, 0, 0, 0)\n return date\n}\n","import lastDayOfWeek from '../lastDayOfWeek/index.js'\n\n/**\n * @name lastDayOfISOWeek\n * @category ISO Week Helpers\n * @summary Return the last day of an ISO week for the given date.\n *\n * @description\n * Return the last day of an ISO week for the given date.\n * The result will be in the local timezone.\n *\n * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} date - the original date\n * @returns {Date} the last day of an ISO week\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // The last day of an ISO week for 2 September 2014 11:55:00:\n * var result = lastDayOfISOWeek(new Date(2014, 8, 2, 11, 55, 0))\n * //=> Sun Sep 07 2014 00:00:00\n */\nexport default function lastDayOfISOWeek(dirtyDate) {\n if (arguments.length < 1) {\n throw new TypeError(\n '1 argument required, but only ' + arguments.length + ' present'\n )\n }\n\n return lastDayOfWeek(dirtyDate, { weekStartsOn: 1 })\n}\n","import getISOWeekYear from '../getISOWeekYear/index.js'\nimport startOfISOWeek from '../startOfISOWeek/index.js'\n\n/**\n * @name lastDayOfISOWeekYear\n * @category ISO Week-Numbering Year Helpers\n * @summary Return the last day of an ISO week-numbering year for the given date.\n *\n * @description\n * Return the last day of an ISO week-numbering year,\n * which always starts 3 days before the year's first Thursday.\n * The result will be in the local timezone.\n *\n * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * - The function was renamed from `lastDayOfISOYear` to `lastDayOfISOWeekYear`.\n * \"ISO week year\" is short for [ISO week-numbering year](https://en.wikipedia.org/wiki/ISO_week_date).\n * This change makes the name consistent with\n * locale-dependent week-numbering year helpers, e.g., `getWeekYear`.\n *\n * @param {Date|Number} date - the original date\n * @returns {Date} the end of an ISO week-numbering year\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // The last day of an ISO week-numbering year for 2 July 2005:\n * var result = lastDayOfISOWeekYear(new Date(2005, 6, 2))\n * //=> Sun Jan 01 2006 00:00:00\n */\nexport default function lastDayOfISOWeekYear(dirtyDate) {\n if (arguments.length < 1) {\n throw new TypeError(\n '1 argument required, but only ' + arguments.length + ' present'\n )\n }\n\n var year = getISOWeekYear(dirtyDate)\n var fourthOfJanuary = new Date(0)\n fourthOfJanuary.setFullYear(year + 1, 0, 4)\n fourthOfJanuary.setHours(0, 0, 0, 0)\n var date = startOfISOWeek(fourthOfJanuary)\n date.setDate(date.getDate() - 1)\n return date\n}\n","import toDate from '../toDate/index.js'\n\n/**\n * @name lastDayOfMonth\n * @category Month Helpers\n * @summary Return the last day of a month for the given date.\n *\n * @description\n * Return the last day of a month for the given date.\n * The result will be in the local timezone.\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} date - the original date\n * @returns {Date} the last day of a month\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // The last day of a month for 2 September 2014 11:55:00:\n * var result = lastDayOfMonth(new Date(2014, 8, 2, 11, 55, 0))\n * //=> Tue Sep 30 2014 00:00:00\n */\nexport default function lastDayOfMonth(dirtyDate) {\n if (arguments.length < 1) {\n throw new TypeError(\n '1 argument required, but only ' + arguments.length + ' present'\n )\n }\n\n var date = toDate(dirtyDate)\n var month = date.getMonth()\n date.setFullYear(date.getFullYear(), month + 1, 0)\n date.setHours(0, 0, 0, 0)\n return date\n}\n","import toDate from '../toDate/index.js'\n\n/**\n * @name lastDayOfQuarter\n * @category Quarter Helpers\n * @summary Return the last day of a year quarter for the given date.\n *\n * @description\n * Return the last day of a year quarter for the given date.\n * The result will be in the local timezone.\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} date - the original date\n * @param {Object} [options] - an object with options.\n * @param {0|1|2} [options.additionalDigits=2] - passed to `toDate`. See [toDate]{@link https://date-fns.org/docs/toDate}\n * @returns {Date} the last day of a quarter\n * @throws {TypeError} 1 argument required\n * @throws {RangeError} `options.additionalDigits` must be 0, 1 or 2\n *\n * @example\n * // The last day of a quarter for 2 September 2014 11:55:00:\n * var result = lastDayOfQuarter(new Date(2014, 8, 2, 11, 55, 0))\n * //=> Tue Sep 30 2014 00:00:00\n */\nexport default function lastDayOfQuarter(dirtyDate) {\n if (arguments.length < 1) {\n throw new TypeError(\n '1 argument required, but only ' + arguments.length + ' present'\n )\n }\n\n var date = toDate(dirtyDate)\n var currentMonth = date.getMonth()\n var month = currentMonth - (currentMonth % 3) + 3\n date.setMonth(month, 0)\n date.setHours(0, 0, 0, 0)\n return date\n}\n","import toInteger from '../_lib/toInteger/index.js'\nimport toDate from '../toDate/index.js'\n\n/**\n * @name lastDayOfWeek\n * @category Week Helpers\n * @summary Return the last day of a week for the given date.\n *\n * @description\n * Return the last day of a week for the given date.\n * The result will be in the local timezone.\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} date - the original date\n * @param {Object} [options] - an object with options.\n * @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)\n * @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale}\n * @returns {Date} the last day of a week\n * @throws {TypeError} 1 argument required\n * @throws {RangeError} `options.weekStartsOn` must be between 0 and 6\n *\n * @example\n * // The last day of a week for 2 September 2014 11:55:00:\n * var result = lastDayOfWeek(new Date(2014, 8, 2, 11, 55, 0))\n * //=> Sat Sep 06 2014 00:00:00\n *\n * @example\n * // If the week starts on Monday, the last day of the week for 2 September 2014 11:55:00:\n * var result = lastDayOfWeek(new Date(2014, 8, 2, 11, 55, 0), { weekStartsOn: 1 })\n * //=> Sun Sep 07 2014 00:00:00\n */\nexport default function lastDayOfWeek(dirtyDate, dirtyOptions) {\n if (arguments.length < 1) {\n throw new TypeError(\n '1 argument required, but only ' + arguments.length + ' present'\n )\n }\n\n var options = dirtyOptions || {}\n var locale = options.locale\n var localeWeekStartsOn =\n locale && locale.options && locale.options.weekStartsOn\n var defaultWeekStartsOn =\n localeWeekStartsOn == null ? 0 : toInteger(localeWeekStartsOn)\n var weekStartsOn =\n options.weekStartsOn == null\n ? defaultWeekStartsOn\n : toInteger(options.weekStartsOn)\n\n // Test if weekStartsOn is between 0 and 6 _and_ is not NaN\n if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {\n throw new RangeError('weekStartsOn must be between 0 and 6')\n }\n\n var date = toDate(dirtyDate)\n var day = date.getDay()\n var diff = (day < weekStartsOn ? -7 : 0) + 6 - (day - weekStartsOn)\n\n date.setHours(0, 0, 0, 0)\n date.setDate(date.getDate() + diff)\n return date\n}\n","import toDate from '../toDate/index.js'\n\n/**\n * @name lastDayOfYear\n * @category Year Helpers\n * @summary Return the last day of a year for the given date.\n *\n * @description\n * Return the last day of a year for the given date.\n * The result will be in the local timezone.\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} date - the original date\n * @returns {Date} the last day of a year\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // The last day of a year for 2 September 2014 11:55:00:\n * var result = lastDayOfYear(new Date(2014, 8, 2, 11, 55, 00))\n * //=> Wed Dec 31 2014 00:00:00\n */\nexport default function lastDayOfYear(dirtyDate) {\n if (arguments.length < 1) {\n throw new TypeError(\n '1 argument required, but only ' + arguments.length + ' present'\n )\n }\n\n var date = toDate(dirtyDate)\n var year = date.getFullYear()\n date.setFullYear(year + 1, 0, 0)\n date.setHours(0, 0, 0, 0)\n return date\n}\n","import toDate from '../toDate/index.js'\nimport formatters from '../_lib/format/lightFormatters/index.js'\nimport getTimezoneOffsetInMilliseconds from '../_lib/getTimezoneOffsetInMilliseconds/index.js'\nimport isValid from '../isValid/index.js'\nimport subMilliseconds from '../subMilliseconds/index.js'\n\n// This RegExp consists of three parts separated by `|`:\n// - (\\w)\\1* matches any sequences of the same letter\n// - '' matches two quote characters in a row\n// - '(''|[^'])+('|$) matches anything surrounded by two quote characters ('),\n// except a single quote symbol, which ends the sequence.\n// Two quote characters do not end the sequence.\n// If there is no matching single quote\n// then the sequence will continue until the end of the string.\n// - . matches any single character unmatched by previous parts of the RegExps\nvar formattingTokensRegExp = /(\\w)\\1*|''|'(''|[^'])+('|$)|./g\n\nvar escapedStringRegExp = /^'(.*?)'?$/\nvar doubleQuoteRegExp = /''/g\n\n/**\n * @name lightFormat\n * @category Common Helpers\n * @summary Format the date.\n *\n * @description\n * Return the formatted date string in the given format. Unlike `format`,\n * `lightFormat` doesn't use locales and outputs date using the most popular tokens.\n *\n * > âš ï¸ Please note that the `lightFormat` tokens differ from Moment.js and other libraries.\n * > See: https://git.io/fxCyr\n *\n * The characters wrapped between two single quotes characters (') are escaped.\n * Two single quotes in a row, whether inside or outside a quoted sequence, represent a 'real' single quote.\n * (see the last example)\n *\n * Format of the string is based on Unicode Technical Standard #35:\n * https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table\n * with a few additions (see note 7 below the table).\n *\n * Accepted patterns:\n * | Unit | Pattern | Result examples |\n * |---------------------------------|---------|-----------------------------------|\n * | AM, PM | a..aaa | AM, PM |\n * | | aaaa | a.m., p.m. |\n * | | aaaaa | a, p |\n * | Calendar year | y | 44, 1, 1900, 2017 |\n * | | yy | 44, 01, 00, 17 |\n * | | yyy | 044, 001, 000, 017 |\n * | | yyyy | 0044, 0001, 1900, 2017 |\n * | Month (formatting) | M | 1, 2, ..., 12 |\n * | | MM | 01, 02, ..., 12 |\n * | Day of month | d | 1, 2, ..., 31 |\n * | | dd | 01, 02, ..., 31 |\n * | Hour [1-12] | h | 1, 2, ..., 11, 12 |\n * | | hh | 01, 02, ..., 11, 12 |\n * | Hour [0-23] | H | 0, 1, 2, ..., 23 |\n * | | HH | 00, 01, 02, ..., 23 |\n * | Minute | m | 0, 1, ..., 59 |\n * | | mm | 00, 01, ..., 59 |\n * | Second | s | 0, 1, ..., 59 |\n * | | ss | 00, 01, ..., 59 |\n * | Timezone (ISO-8601 w/ Z) | X | -08, +0530, Z |\n * | | XX | -0800, +0530, Z |\n * | | XXX | -08:00, +05:30, Z |\n * | | XXXX | -0800, +0530, Z, +123456 |\n * | | XXXXX | -08:00, +05:30, Z, +12:34:56 |\n * | Timezone (ISO-8601 w/o Z) | x | -08, +0530, +00 |\n * | | xx | -0800, +0530, +0000 |\n * | | xxx | -08:00, +05:30, +00:00 |\n * | | xxxx | -0800, +0530, +0000, +123456 |\n * | | xxxxx | -08:00, +05:30, +00:00, +12:34:56 |\n *\n * @param {Date|Number} date - the original date\n * @param {String} format - the string of tokens\n * @returns {String} the formatted date string\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * var result = format(new Date(2014, 1, 11), 'yyyy-MM-dd')\n * //=> '1987-02-11'\n */\nexport default function lightFormat(dirtyDate, dirtyFormatStr) {\n if (arguments.length < 2) {\n throw new TypeError(\n '2 arguments required, but only ' + arguments.length + ' present'\n )\n }\n\n var formatStr = String(dirtyFormatStr)\n\n var originalDate = toDate(dirtyDate)\n\n if (!isValid(originalDate)) {\n throw new RangeError('Invalid time value')\n }\n\n // Convert the date in system timezone to the same date in UTC+00:00 timezone.\n // This ensures that when UTC functions will be implemented, locales will be compatible with them.\n // See an issue about UTC functions: https://github.com/date-fns/date-fns/issues/376\n var timezoneOffset = getTimezoneOffsetInMilliseconds(originalDate)\n var utcDate = subMilliseconds(originalDate, timezoneOffset)\n\n var result = formatStr\n .match(formattingTokensRegExp)\n .map(function(substring) {\n // Replace two single quote characters with one single quote character\n if (substring === \"''\") {\n return \"'\"\n }\n\n var firstCharacter = substring[0]\n if (firstCharacter === \"'\") {\n return cleanEscapedString(substring)\n }\n\n var formatter = formatters[firstCharacter]\n if (formatter) {\n return formatter(utcDate, substring, null, {})\n }\n\n return substring\n })\n .join('')\n\n return result\n}\n\nfunction cleanEscapedString(input) {\n return input.match(escapedStringRegExp)[1].replace(doubleQuoteRegExp, \"'\")\n}\n","export default function buildFormatLongFn (args) {\n return function (dirtyOptions) {\n var options = dirtyOptions || {}\n var width = options.width ? String(options.width) : args.defaultWidth\n var format = args.formats[width] || args.formats[args.defaultWidth]\n return format\n }\n}\n","export default function buildLocalizeFn (args) {\n return function (dirtyIndex, dirtyOptions) {\n var options = dirtyOptions || {}\n var width = options.width ? String(options.width) : args.defaultWidth\n var context = options.context ? String(options.context) : 'standalone'\n\n var valuesArray\n if (context === 'formatting' && args.formattingValues) {\n valuesArray = args.formattingValues[width] || args.formattingValues[args.defaultFormattingWidth]\n } else {\n valuesArray = args.values[width] || args.values[args.defaultWidth]\n }\n var index = args.argumentCallback ? args.argumentCallback(dirtyIndex) : dirtyIndex\n return valuesArray[index]\n }\n}\n","export default function buildMatchFn (args) {\n return function (dirtyString, dirtyOptions) {\n var string = String(dirtyString)\n var options = dirtyOptions || {}\n var width = options.width\n\n var matchPattern = (width && args.matchPatterns[width]) || args.matchPatterns[args.defaultMatchWidth]\n var matchResult = string.match(matchPattern)\n\n if (!matchResult) {\n return null\n }\n var matchedString = matchResult[0]\n\n var parsePatterns = (width && args.parsePatterns[width]) || args.parsePatterns[args.defaultParseWidth]\n\n var value\n if (Object.prototype.toString.call(parsePatterns) === '[object Array]') {\n value = parsePatterns.findIndex(function (pattern) {\n return pattern.test(string)\n })\n } else {\n value = findKey(parsePatterns, function (pattern) {\n return pattern.test(string)\n })\n }\n\n value = args.valueCallback ? args.valueCallback(value) : value\n value = options.valueCallback ? options.valueCallback(value) : value\n\n return {\n value: value,\n rest: string.slice(matchedString.length)\n }\n }\n}\n\nfunction findKey (object, predicate) {\n for (var key in object) {\n if (object.hasOwnProperty(key) && predicate(object[key])) {\n return key\n }\n }\n}\n","export default function buildMatchPatternFn (args) {\n return function (dirtyString, dirtyOptions) {\n var string = String(dirtyString)\n var options = dirtyOptions || {}\n\n var matchResult = string.match(args.matchPattern)\n if (!matchResult) {\n return null\n }\n var matchedString = matchResult[0]\n\n var parseResult = string.match(args.parsePattern)\n if (!parseResult) {\n return null\n }\n var value = args.valueCallback ? args.valueCallback(parseResult[0]) : parseResult[0]\n value = options.valueCallback ? options.valueCallback(value) : value\n\n return {\n value: value,\n rest: string.slice(matchedString.length)\n }\n }\n}\n","var formatDistanceLocale = {\n lessThanXSeconds: {\n one: 'less than a second',\n other: 'less than {{count}} seconds'\n },\n\n xSeconds: {\n one: '1 second',\n other: '{{count}} seconds'\n },\n\n halfAMinute: 'half a minute',\n\n lessThanXMinutes: {\n one: 'less than a minute',\n other: 'less than {{count}} minutes'\n },\n\n xMinutes: {\n one: '1 minute',\n other: '{{count}} minutes'\n },\n\n aboutXHours: {\n one: 'about 1 hour',\n other: 'about {{count}} hours'\n },\n\n xHours: {\n one: '1 hour',\n other: '{{count}} hours'\n },\n\n xDays: {\n one: '1 day',\n other: '{{count}} days'\n },\n\n aboutXMonths: {\n one: 'about 1 month',\n other: 'about {{count}} months'\n },\n\n xMonths: {\n one: '1 month',\n other: '{{count}} months'\n },\n\n aboutXYears: {\n one: 'about 1 year',\n other: 'about {{count}} years'\n },\n\n xYears: {\n one: '1 year',\n other: '{{count}} years'\n },\n\n overXYears: {\n one: 'over 1 year',\n other: 'over {{count}} years'\n },\n\n almostXYears: {\n one: 'almost 1 year',\n other: 'almost {{count}} years'\n }\n}\n\nexport default function formatDistance (token, count, options) {\n options = options || {}\n\n var result\n if (typeof formatDistanceLocale[token] === 'string') {\n result = formatDistanceLocale[token]\n } else if (count === 1) {\n result = formatDistanceLocale[token].one\n } else {\n result = formatDistanceLocale[token].other.replace('{{count}}', count)\n }\n\n if (options.addSuffix) {\n if (options.comparison > 0) {\n return 'in ' + result\n } else {\n return result + ' ago'\n }\n }\n\n return result\n}\n","import buildFormatLongFn from '../../../_lib/buildFormatLongFn/index.js'\n\nvar dateFormats = {\n full: 'EEEE, MMMM do, y',\n long: 'MMMM do, y',\n medium: 'MMM d, y',\n short: 'MM/dd/yyyy'\n}\n\nvar timeFormats = {\n full: 'h:mm:ss a zzzz',\n long: 'h:mm:ss a z',\n medium: 'h:mm:ss a',\n short: 'h:mm a'\n}\n\nvar dateTimeFormats = {\n full: \"{{date}} 'at' {{time}}\",\n long: \"{{date}} 'at' {{time}}\",\n medium: '{{date}}, {{time}}',\n short: '{{date}}, {{time}}'\n}\n\nvar formatLong = {\n date: buildFormatLongFn({\n formats: dateFormats,\n defaultWidth: 'full'\n }),\n\n time: buildFormatLongFn({\n formats: timeFormats,\n defaultWidth: 'full'\n }),\n\n dateTime: buildFormatLongFn({\n formats: dateTimeFormats,\n defaultWidth: 'full'\n })\n}\n\nexport default formatLong\n","var formatRelativeLocale = {\n lastWeek: \"'last' eeee 'at' p\",\n yesterday: \"'yesterday at' p\",\n today: \"'today at' p\",\n tomorrow: \"'tomorrow at' p\",\n nextWeek: \"eeee 'at' p\",\n other: 'P'\n}\n\nexport default function formatRelative (token, date, baseDate, options) {\n return formatRelativeLocale[token]\n}\n","import buildLocalizeFn from '../../../_lib/buildLocalizeFn/index.js'\n\nvar eraValues = {\n narrow: ['B', 'A'],\n abbreviated: ['BC', 'AD'],\n wide: ['Before Christ', 'Anno Domini']\n}\n\nvar quarterValues = {\n narrow: ['1', '2', '3', '4'],\n abbreviated: ['Q1', 'Q2', 'Q3', 'Q4'],\n wide: ['1st quarter', '2nd quarter', '3rd quarter', '4th quarter']\n}\n\n// Note: in English, the names of days of the week and months are capitalized.\n// If you are making a new locale based on this one, check if the same is true for the language you're working on.\n// Generally, formatted dates should look like they are in the middle of a sentence,\n// e.g. in Spanish language the weekdays and months should be in the lowercase.\nvar monthValues = {\n narrow: ['J', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', 'O', 'N', 'D'],\n abbreviated: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],\n wide: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']\n}\n\nvar dayValues = {\n narrow: ['S', 'M', 'T', 'W', 'T', 'F', 'S'],\n short: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],\n abbreviated: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],\n wide: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']\n}\n\nvar dayPeriodValues = {\n narrow: {\n am: 'a',\n pm: 'p',\n midnight: 'mi',\n noon: 'n',\n morning: 'morning',\n afternoon: 'afternoon',\n evening: 'evening',\n night: 'night'\n },\n abbreviated: {\n am: 'AM',\n pm: 'PM',\n midnight: 'midnight',\n noon: 'noon',\n morning: 'morning',\n afternoon: 'afternoon',\n evening: 'evening',\n night: 'night'\n },\n wide: {\n am: 'a.m.',\n pm: 'p.m.',\n midnight: 'midnight',\n noon: 'noon',\n morning: 'morning',\n afternoon: 'afternoon',\n evening: 'evening',\n night: 'night'\n }\n}\nvar formattingDayPeriodValues = {\n narrow: {\n am: 'a',\n pm: 'p',\n midnight: 'mi',\n noon: 'n',\n morning: 'in the morning',\n afternoon: 'in the afternoon',\n evening: 'in the evening',\n night: 'at night'\n },\n abbreviated: {\n am: 'AM',\n pm: 'PM',\n midnight: 'midnight',\n noon: 'noon',\n morning: 'in the morning',\n afternoon: 'in the afternoon',\n evening: 'in the evening',\n night: 'at night'\n },\n wide: {\n am: 'a.m.',\n pm: 'p.m.',\n midnight: 'midnight',\n noon: 'noon',\n morning: 'in the morning',\n afternoon: 'in the afternoon',\n evening: 'in the evening',\n night: 'at night'\n }\n}\n\nfunction ordinalNumber (dirtyNumber, dirtyOptions) {\n var number = Number(dirtyNumber)\n\n // If ordinal numbers depend on context, for example,\n // if they are different for different grammatical genders,\n // use `options.unit`:\n //\n // var options = dirtyOptions || {}\n // var unit = String(options.unit)\n //\n // where `unit` can be 'year', 'quarter', 'month', 'week', 'date', 'dayOfYear',\n // 'day', 'hour', 'minute', 'second'\n\n var rem100 = number % 100\n if (rem100 > 20 || rem100 < 10) {\n switch (rem100 % 10) {\n case 1:\n return number + 'st'\n case 2:\n return number + 'nd'\n case 3:\n return number + 'rd'\n }\n }\n return number + 'th'\n}\n\nvar localize = {\n ordinalNumber: ordinalNumber,\n\n era: buildLocalizeFn({\n values: eraValues,\n defaultWidth: 'wide'\n }),\n\n quarter: buildLocalizeFn({\n values: quarterValues,\n defaultWidth: 'wide',\n argumentCallback: function (quarter) {\n return Number(quarter) - 1\n }\n }),\n\n month: buildLocalizeFn({\n values: monthValues,\n defaultWidth: 'wide'\n }),\n\n day: buildLocalizeFn({\n values: dayValues,\n defaultWidth: 'wide'\n }),\n\n dayPeriod: buildLocalizeFn({\n values: dayPeriodValues,\n defaultWidth: 'wide',\n formattingValues: formattingDayPeriodValues,\n defaultFormattingWidth: 'wide'\n })\n}\n\nexport default localize\n","import buildMatchPatternFn from '../../../_lib/buildMatchPatternFn/index.js'\nimport buildMatchFn from '../../../_lib/buildMatchFn/index.js'\n\nvar matchOrdinalNumberPattern = /^(\\d+)(th|st|nd|rd)?/i\nvar parseOrdinalNumberPattern = /\\d+/i\n\nvar matchEraPatterns = {\n narrow: /^(b|a)/i,\n abbreviated: /^(b\\.?\\s?c\\.?|b\\.?\\s?c\\.?\\s?e\\.?|a\\.?\\s?d\\.?|c\\.?\\s?e\\.?)/i,\n wide: /^(before christ|before common era|anno domini|common era)/i\n}\nvar parseEraPatterns = {\n any: [/^b/i, /^(a|c)/i]\n}\n\nvar matchQuarterPatterns = {\n narrow: /^[1234]/i,\n abbreviated: /^q[1234]/i,\n wide: /^[1234](th|st|nd|rd)? quarter/i\n}\nvar parseQuarterPatterns = {\n any: [/1/i, /2/i, /3/i, /4/i]\n}\n\nvar matchMonthPatterns = {\n narrow: /^[jfmasond]/i,\n abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,\n wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i\n}\nvar parseMonthPatterns = {\n narrow: [/^j/i, /^f/i, /^m/i, /^a/i, /^m/i, /^j/i, /^j/i, /^a/i, /^s/i, /^o/i, /^n/i, /^d/i],\n any: [/^ja/i, /^f/i, /^mar/i, /^ap/i, /^may/i, /^jun/i, /^jul/i, /^au/i, /^s/i, /^o/i, /^n/i, /^d/i]\n}\n\nvar matchDayPatterns = {\n narrow: /^[smtwf]/i,\n short: /^(su|mo|tu|we|th|fr|sa)/i,\n abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,\n wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i\n}\nvar parseDayPatterns = {\n narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],\n any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i]\n}\n\nvar matchDayPeriodPatterns = {\n narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,\n any: /^([ap]\\.?\\s?m\\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i\n}\nvar parseDayPeriodPatterns = {\n any: {\n am: /^a/i,\n pm: /^p/i,\n midnight: /^mi/i,\n noon: /^no/i,\n morning: /morning/i,\n afternoon: /afternoon/i,\n evening: /evening/i,\n night: /night/i\n }\n}\n\nvar match = {\n ordinalNumber: buildMatchPatternFn({\n matchPattern: matchOrdinalNumberPattern,\n parsePattern: parseOrdinalNumberPattern,\n valueCallback: function (value) {\n return parseInt(value, 10)\n }\n }),\n\n era: buildMatchFn({\n matchPatterns: matchEraPatterns,\n defaultMatchWidth: 'wide',\n parsePatterns: parseEraPatterns,\n defaultParseWidth: 'any'\n }),\n\n quarter: buildMatchFn({\n matchPatterns: matchQuarterPatterns,\n defaultMatchWidth: 'wide',\n parsePatterns: parseQuarterPatterns,\n defaultParseWidth: 'any',\n valueCallback: function (index) {\n return index + 1\n }\n }),\n\n month: buildMatchFn({\n matchPatterns: matchMonthPatterns,\n defaultMatchWidth: 'wide',\n parsePatterns: parseMonthPatterns,\n defaultParseWidth: 'any'\n }),\n\n day: buildMatchFn({\n matchPatterns: matchDayPatterns,\n defaultMatchWidth: 'wide',\n parsePatterns: parseDayPatterns,\n defaultParseWidth: 'any'\n }),\n\n dayPeriod: buildMatchFn({\n matchPatterns: matchDayPeriodPatterns,\n defaultMatchWidth: 'any',\n parsePatterns: parseDayPeriodPatterns,\n defaultParseWidth: 'any'\n })\n}\n\nexport default match\n","import formatDistance from './_lib/formatDistance/index.js'\nimport formatLong from './_lib/formatLong/index.js'\nimport formatRelative from './_lib/formatRelative/index.js'\nimport localize from './_lib/localize/index.js'\nimport match from './_lib/match/index.js'\n\n/**\n * @type {Locale}\n * @category Locales\n * @summary English locale (United States).\n * @language English\n * @iso-639-2 eng\n * @author Sasha Koss [@kossnocorp]{@link https://github.com/kossnocorp}\n * @author Lesha Koss [@leshakoss]{@link https://github.com/leshakoss}\n */\nvar locale = {\n formatDistance: formatDistance,\n formatLong: formatLong,\n formatRelative: formatRelative,\n localize: localize,\n match: match,\n options: {\n weekStartsOn: 0 /* Sunday */,\n firstWeekContainsDate: 1\n }\n}\n\nexport default locale\n","import toDate from '../toDate/index.js'\n\n/**\n * @name max\n * @category Common Helpers\n * @summary Return the latest of the given dates.\n *\n * @description\n * Return the latest of the given dates.\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * - `max` function now accepts an array of dates rather than spread arguments.\n *\n * ```javascript\n * // Before v2.0.0\n * var date1 = new Date(1989, 6, 10)\n * var date2 = new Date(1987, 1, 11)\n * var maxDate = max(date1, date2)\n *\n * // v2.0.0 onward:\n * var dates = [new Date(1989, 6, 10), new Date(1987, 1, 11)]\n * var maxDate = max(dates)\n * ```\n *\n * @param {Date[]|Number[]} datesArray - the dates to compare\n * @returns {Date} the latest of the dates\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // Which of these dates is the latest?\n * var result = max([\n * new Date(1989, 6, 10),\n * new Date(1987, 1, 11),\n * new Date(1995, 6, 2),\n * new Date(1990, 0, 1)\n * ])\n * //=> Sun Jul 02 1995 00:00:00\n */\nexport default function max(dirtyDatesArray) {\n if (arguments.length < 1) {\n throw new TypeError(\n '1 argument required, but only ' + arguments.length + ' present'\n )\n }\n\n var datesArray\n // `dirtyDatesArray` is undefined or null\n if (dirtyDatesArray == null) {\n datesArray = []\n\n // `dirtyDatesArray` is Array, Set or Map, or object with custom `forEach` method\n } else if (typeof dirtyDatesArray.forEach === 'function') {\n datesArray = dirtyDatesArray\n\n // If `dirtyDatesArray` is Array-like Object, convert to Array. Otherwise, make it empty Array\n } else {\n datesArray = Array.prototype.slice.call(dirtyDatesArray)\n }\n\n var result\n datesArray.forEach(function(dirtyDate) {\n var currentDate = toDate(dirtyDate)\n\n if (result === undefined || result < currentDate || isNaN(currentDate)) {\n result = currentDate\n }\n })\n\n return result\n}\n","import toDate from '../toDate/index.js'\n\n/**\n * @name min\n * @category Common Helpers\n * @summary Return the earliest of the given dates.\n *\n * @description\n * Return the earliest of the given dates.\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * - `min` function now accepts an array of dates rather than spread arguments.\n *\n * ```javascript\n * // Before v2.0.0\n * var date1 = new Date(1989, 6, 10)\n * var date2 = new Date(1987, 1, 11)\n * var minDate = min(date1, date2)\n *\n * // v2.0.0 onward:\n * var dates = [new Date(1989, 6, 10), new Date(1987, 1, 11)]\n * var minDate = min(dates)\n * ```\n *\n * @param {Date[]|Number[]} datesArray - the dates to compare\n * @returns {Date} the earliest of the dates\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // Which of these dates is the earliest?\n * var result = min([\n * new Date(1989, 6, 10),\n * new Date(1987, 1, 11),\n * new Date(1995, 6, 2),\n * new Date(1990, 0, 1)\n * ])\n * //=> Wed Feb 11 1987 00:00:00\n */\nexport default function min(dirtyDatesArray) {\n if (arguments.length < 1) {\n throw new TypeError(\n '1 argument required, but only ' + arguments.length + ' present'\n )\n }\n\n var datesArray\n // `dirtyDatesArray` is undefined or null\n if (dirtyDatesArray == null) {\n datesArray = []\n\n // `dirtyDatesArray` is Array, Set or Map, or object with custom `forEach` method\n } else if (typeof dirtyDatesArray.forEach === 'function') {\n datesArray = dirtyDatesArray\n\n // If `dirtyDatesArray` is Array-like Object, convert to Array. Otherwise, make it empty Array\n } else {\n datesArray = Array.prototype.slice.call(dirtyDatesArray)\n }\n\n var result\n datesArray.forEach(function(dirtyDate) {\n var currentDate = toDate(dirtyDate)\n\n if (result === undefined || result > currentDate || isNaN(currentDate)) {\n result = currentDate\n }\n })\n\n return result\n}\n","import getUTCWeekYear from '../../../_lib/getUTCWeekYear/index.js'\nimport setUTCDay from '../../../_lib/setUTCDay/index.js'\nimport setUTCWeek from '../../../_lib/setUTCWeek/index.js'\nimport startOfUTCWeek from '../../../_lib/startOfUTCWeek/index.js'\nimport setUTCISODay from '../../../_lib/setUTCISODay/index.js'\nimport setUTCISOWeek from '../../../_lib/setUTCISOWeek/index.js'\nimport startOfUTCISOWeek from '../../../_lib/startOfUTCISOWeek/index.js'\n\nvar MILLISECONDS_IN_HOUR = 3600000\nvar MILLISECONDS_IN_MINUTE = 60000\nvar MILLISECONDS_IN_SECOND = 1000\n\nvar numericPatterns = {\n month: /^(1[0-2]|0?\\d)/, // 0 to 12\n date: /^(3[0-1]|[0-2]?\\d)/, // 0 to 31\n dayOfYear: /^(36[0-6]|3[0-5]\\d|[0-2]?\\d?\\d)/, // 0 to 366\n week: /^(5[0-3]|[0-4]?\\d)/, // 0 to 53\n hour23h: /^(2[0-3]|[0-1]?\\d)/, // 0 to 23\n hour24h: /^(2[0-4]|[0-1]?\\d)/, // 0 to 24\n hour11h: /^(1[0-1]|0?\\d)/, // 0 to 11\n hour12h: /^(1[0-2]|0?\\d)/, // 0 to 12\n minute: /^[0-5]?\\d/, // 0 to 59\n second: /^[0-5]?\\d/, // 0 to 59\n\n singleDigit: /^\\d/, // 0 to 9\n twoDigits: /^\\d{1,2}/, // 0 to 99\n threeDigits: /^\\d{1,3}/, // 0 to 999\n fourDigits: /^\\d{1,4}/, // 0 to 9999\n\n anyDigitsSigned: /^-?\\d+/,\n singleDigitSigned: /^-?\\d/, // 0 to 9, -0 to -9\n twoDigitsSigned: /^-?\\d{1,2}/, // 0 to 99, -0 to -99\n threeDigitsSigned: /^-?\\d{1,3}/, // 0 to 999, -0 to -999\n fourDigitsSigned: /^-?\\d{1,4}/ // 0 to 9999, -0 to -9999\n}\n\nvar timezonePatterns = {\n basicOptionalMinutes: /^([+-])(\\d{2})(\\d{2})?|Z/,\n basic: /^([+-])(\\d{2})(\\d{2})|Z/,\n basicOptionalSeconds: /^([+-])(\\d{2})(\\d{2})((\\d{2}))?|Z/,\n extended: /^([+-])(\\d{2}):(\\d{2})|Z/,\n extendedOptionalSeconds: /^([+-])(\\d{2}):(\\d{2})(:(\\d{2}))?|Z/\n}\n\nfunction parseNumericPattern(pattern, string, valueCallback) {\n var matchResult = string.match(pattern)\n\n if (!matchResult) {\n return null\n }\n\n var value = parseInt(matchResult[0], 10)\n\n return {\n value: valueCallback ? valueCallback(value) : value,\n rest: string.slice(matchResult[0].length)\n }\n}\n\nfunction parseTimezonePattern(pattern, string) {\n var matchResult = string.match(pattern)\n\n if (!matchResult) {\n return null\n }\n\n // Input is 'Z'\n if (matchResult[0] === 'Z') {\n return {\n value: 0,\n rest: string.slice(1)\n }\n }\n\n var sign = matchResult[1] === '+' ? 1 : -1\n var hours = matchResult[2] ? parseInt(matchResult[2], 10) : 0\n var minutes = matchResult[3] ? parseInt(matchResult[3], 10) : 0\n var seconds = matchResult[5] ? parseInt(matchResult[5], 10) : 0\n\n return {\n value:\n sign *\n (hours * MILLISECONDS_IN_HOUR +\n minutes * MILLISECONDS_IN_MINUTE +\n seconds * MILLISECONDS_IN_SECOND),\n rest: string.slice(matchResult[0].length)\n }\n}\n\nfunction parseAnyDigitsSigned(string, valueCallback) {\n return parseNumericPattern(\n numericPatterns.anyDigitsSigned,\n string,\n valueCallback\n )\n}\n\nfunction parseNDigits(n, string, valueCallback) {\n switch (n) {\n case 1:\n return parseNumericPattern(\n numericPatterns.singleDigit,\n string,\n valueCallback\n )\n case 2:\n return parseNumericPattern(\n numericPatterns.twoDigits,\n string,\n valueCallback\n )\n case 3:\n return parseNumericPattern(\n numericPatterns.threeDigits,\n string,\n valueCallback\n )\n case 4:\n return parseNumericPattern(\n numericPatterns.fourDigits,\n string,\n valueCallback\n )\n default:\n return parseNumericPattern(\n new RegExp('^\\\\d{1,' + n + '}'),\n string,\n valueCallback\n )\n }\n}\n\nfunction parseNDigitsSigned(n, string, valueCallback) {\n switch (n) {\n case 1:\n return parseNumericPattern(\n numericPatterns.singleDigitSigned,\n string,\n valueCallback\n )\n case 2:\n return parseNumericPattern(\n numericPatterns.twoDigitsSigned,\n string,\n valueCallback\n )\n case 3:\n return parseNumericPattern(\n numericPatterns.threeDigitsSigned,\n string,\n valueCallback\n )\n case 4:\n return parseNumericPattern(\n numericPatterns.fourDigitsSigned,\n string,\n valueCallback\n )\n default:\n return parseNumericPattern(\n new RegExp('^-?\\\\d{1,' + n + '}'),\n string,\n valueCallback\n )\n }\n}\n\nfunction dayPeriodEnumToHours(enumValue) {\n switch (enumValue) {\n case 'morning':\n return 4\n case 'evening':\n return 17\n case 'pm':\n case 'noon':\n case 'afternoon':\n return 12\n case 'am':\n case 'midnight':\n case 'night':\n default:\n return 0\n }\n}\n\nfunction normalizeTwoDigitYear(twoDigitYear, currentYear) {\n var isCommonEra = currentYear > 0\n // Absolute number of the current year:\n // 1 -> 1 AC\n // 0 -> 1 BC\n // -1 -> 2 BC\n var absCurrentYear = isCommonEra ? currentYear : 1 - currentYear\n\n var result\n if (absCurrentYear <= 50) {\n result = twoDigitYear || 100\n } else {\n var rangeEnd = absCurrentYear + 50\n var rangeEndCentury = Math.floor(rangeEnd / 100) * 100\n var isPreviousCentury = twoDigitYear >= rangeEnd % 100\n result = twoDigitYear + rangeEndCentury - (isPreviousCentury ? 100 : 0)\n }\n\n return isCommonEra ? result : 1 - result\n}\n\nvar DAYS_IN_MONTH = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]\nvar DAYS_IN_MONTH_LEAP_YEAR = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]\n\n// User for validation\nfunction isLeapYearIndex(year) {\n return year % 400 === 0 || (year % 4 === 0 && year % 100 !== 0)\n}\n\n/*\n * | | Unit | | Unit |\n * |-----|--------------------------------|-----|--------------------------------|\n * | a | AM, PM | A* | Milliseconds in day |\n * | b | AM, PM, noon, midnight | B | Flexible day period |\n * | c | Stand-alone local day of week | C* | Localized hour w/ day period |\n * | d | Day of month | D | Day of year |\n * | e | Local day of week | E | Day of week |\n * | f | | F* | Day of week in month |\n * | g* | Modified Julian day | G | Era |\n * | h | Hour [1-12] | H | Hour [0-23] |\n * | i! | ISO day of week | I! | ISO week of year |\n * | j* | Localized hour w/ day period | J* | Localized hour w/o day period |\n * | k | Hour [1-24] | K | Hour [0-11] |\n * | l* | (deprecated) | L | Stand-alone month |\n * | m | Minute | M | Month |\n * | n | | N | |\n * | o! | Ordinal number modifier | O* | Timezone (GMT) |\n * | p | | P | |\n * | q | Stand-alone quarter | Q | Quarter |\n * | r* | Related Gregorian year | R! | ISO week-numbering year |\n * | s | Second | S | Fraction of second |\n * | t! | Seconds timestamp | T! | Milliseconds timestamp |\n * | u | Extended year | U* | Cyclic year |\n * | v* | Timezone (generic non-locat.) | V* | Timezone (location) |\n * | w | Local week of year | W* | Week of month |\n * | x | Timezone (ISO-8601 w/o Z) | X | Timezone (ISO-8601) |\n * | y | Year (abs) | Y | Local week-numbering year |\n * | z* | Timezone (specific non-locat.) | Z* | Timezone (aliases) |\n *\n * Letters marked by * are not implemented but reserved by Unicode standard.\n *\n * Letters marked by ! are non-standard, but implemented by date-fns:\n * - `o` modifies the previous token to turn it into an ordinal (see `parse` docs)\n * - `i` is ISO day of week. For `i` and `ii` is returns numeric ISO week days,\n * i.e. 7 for Sunday, 1 for Monday, etc.\n * - `I` is ISO week of year, as opposed to `w` which is local week of year.\n * - `R` is ISO week-numbering year, as opposed to `Y` which is local week-numbering year.\n * `R` is supposed to be used in conjunction with `I` and `i`\n * for universal ISO week-numbering date, whereas\n * `Y` is supposed to be used in conjunction with `w` and `e`\n * for week-numbering date specific to the locale.\n */\nvar parsers = {\n // Era\n G: {\n priority: 140,\n parse: function(string, token, match, options) {\n switch (token) {\n // AD, BC\n case 'G':\n case 'GG':\n case 'GGG':\n return (\n match.era(string, { width: 'abbreviated' }) ||\n match.era(string, { width: 'narrow' })\n )\n // A, B\n case 'GGGGG':\n return match.era(string, { width: 'narrow' })\n // Anno Domini, Before Christ\n case 'GGGG':\n default:\n return (\n match.era(string, { width: 'wide' }) ||\n match.era(string, { width: 'abbreviated' }) ||\n match.era(string, { width: 'narrow' })\n )\n }\n },\n set: function(date, flags, value, options) {\n // Sets year 10 BC if BC, or 10 AC if AC\n date.setUTCFullYear(value === 1 ? 10 : -9, 0, 1)\n date.setUTCHours(0, 0, 0, 0)\n return date\n }\n },\n\n // Year\n y: {\n // From http://www.unicode.org/reports/tr35/tr35-31/tr35-dates.html#Date_Format_Patterns\n // | Year | y | yy | yyy | yyyy | yyyyy |\n // |----------|-------|----|-------|-------|-------|\n // | AD 1 | 1 | 01 | 001 | 0001 | 00001 |\n // | AD 12 | 12 | 12 | 012 | 0012 | 00012 |\n // | AD 123 | 123 | 23 | 123 | 0123 | 00123 |\n // | AD 1234 | 1234 | 34 | 1234 | 1234 | 01234 |\n // | AD 12345 | 12345 | 45 | 12345 | 12345 | 12345 |\n\n priority: 130,\n parse: function(string, token, match, options) {\n var valueCallback = function(year) {\n return {\n year: year,\n isTwoDigitYear: token === 'yy'\n }\n }\n\n switch (token) {\n case 'y':\n return parseNDigits(4, string, valueCallback)\n case 'yo':\n return match.ordinalNumber(string, {\n unit: 'year',\n valueCallback: valueCallback\n })\n default:\n return parseNDigits(token.length, string, valueCallback)\n }\n },\n validate: function(date, value, options) {\n return value.isTwoDigitYear || value.year > 0\n },\n set: function(date, flags, value, options) {\n var currentYear = getUTCWeekYear(date, options)\n\n if (value.isTwoDigitYear) {\n var normalizedTwoDigitYear = normalizeTwoDigitYear(\n value.year,\n currentYear\n )\n date.setUTCFullYear(normalizedTwoDigitYear, 0, 1)\n date.setUTCHours(0, 0, 0, 0)\n return date\n }\n\n var year = currentYear > 0 ? value.year : 1 - value.year\n date.setUTCFullYear(year, 0, 1)\n date.setUTCHours(0, 0, 0, 0)\n return date\n }\n },\n\n // Local week-numbering year\n Y: {\n priority: 130,\n parse: function(string, token, match, options) {\n var valueCallback = function(year) {\n return {\n year: year,\n isTwoDigitYear: token === 'YY'\n }\n }\n\n switch (token) {\n case 'Y':\n return parseNDigits(4, string, valueCallback)\n case 'Yo':\n return match.ordinalNumber(string, {\n unit: 'year',\n valueCallback: valueCallback\n })\n default:\n return parseNDigits(token.length, string, valueCallback)\n }\n },\n validate: function(date, value, options) {\n return value.isTwoDigitYear || value.year > 0\n },\n set: function(date, flags, value, options) {\n var currentYear = date.getUTCFullYear()\n\n if (value.isTwoDigitYear) {\n var normalizedTwoDigitYear = normalizeTwoDigitYear(\n value.year,\n currentYear\n )\n date.setUTCFullYear(\n normalizedTwoDigitYear,\n 0,\n options.firstWeekContainsDate\n )\n date.setUTCHours(0, 0, 0, 0)\n return startOfUTCWeek(date, options)\n }\n\n var year = currentYear > 0 ? value.year : 1 - value.year\n date.setUTCFullYear(year, 0, options.firstWeekContainsDate)\n date.setUTCHours(0, 0, 0, 0)\n return startOfUTCWeek(date, options)\n }\n },\n\n // ISO week-numbering year\n R: {\n priority: 130,\n parse: function(string, token, match, options) {\n if (token === 'R') {\n return parseNDigitsSigned(4, string)\n }\n\n return parseNDigitsSigned(token.length, string)\n },\n set: function(date, flags, value, options) {\n var firstWeekOfYear = new Date(0)\n firstWeekOfYear.setUTCFullYear(value, 0, 4)\n firstWeekOfYear.setUTCHours(0, 0, 0, 0)\n return startOfUTCISOWeek(firstWeekOfYear)\n }\n },\n\n // Extended year\n u: {\n priority: 130,\n parse: function(string, token, match, options) {\n if (token === 'u') {\n return parseNDigitsSigned(4, string)\n }\n\n return parseNDigitsSigned(token.length, string)\n },\n set: function(date, flags, value, options) {\n date.setUTCFullYear(value, 0, 1)\n date.setUTCHours(0, 0, 0, 0)\n return date\n }\n },\n\n // Quarter\n Q: {\n priority: 120,\n parse: function(string, token, match, options) {\n switch (token) {\n // 1, 2, 3, 4\n case 'Q':\n case 'QQ': // 01, 02, 03, 04\n return parseNDigits(token.length, string)\n // 1st, 2nd, 3rd, 4th\n case 'Qo':\n return match.ordinalNumber(string, { unit: 'quarter' })\n // Q1, Q2, Q3, Q4\n case 'QQQ':\n return (\n match.quarter(string, {\n width: 'abbreviated',\n context: 'formatting'\n }) ||\n match.quarter(string, { width: 'narrow', context: 'formatting' })\n )\n // 1, 2, 3, 4 (narrow quarter; could be not numerical)\n case 'QQQQQ':\n return match.quarter(string, {\n width: 'narrow',\n context: 'formatting'\n })\n // 1st quarter, 2nd quarter, ...\n case 'QQQQ':\n default:\n return (\n match.quarter(string, { width: 'wide', context: 'formatting' }) ||\n match.quarter(string, {\n width: 'abbreviated',\n context: 'formatting'\n }) ||\n match.quarter(string, { width: 'narrow', context: 'formatting' })\n )\n }\n },\n validate: function(date, value, options) {\n return value >= 1 && value <= 4\n },\n set: function(date, flags, value, options) {\n date.setUTCMonth((value - 1) * 3, 1)\n date.setUTCHours(0, 0, 0, 0)\n return date\n }\n },\n\n // Stand-alone quarter\n q: {\n priority: 120,\n parse: function(string, token, match, options) {\n switch (token) {\n // 1, 2, 3, 4\n case 'q':\n case 'qq': // 01, 02, 03, 04\n return parseNDigits(token.length, string)\n // 1st, 2nd, 3rd, 4th\n case 'qo':\n return match.ordinalNumber(string, { unit: 'quarter' })\n // Q1, Q2, Q3, Q4\n case 'qqq':\n return (\n match.quarter(string, {\n width: 'abbreviated',\n context: 'standalone'\n }) ||\n match.quarter(string, { width: 'narrow', context: 'standalone' })\n )\n // 1, 2, 3, 4 (narrow quarter; could be not numerical)\n case 'qqqqq':\n return match.quarter(string, {\n width: 'narrow',\n context: 'standalone'\n })\n // 1st quarter, 2nd quarter, ...\n case 'qqqq':\n default:\n return (\n match.quarter(string, { width: 'wide', context: 'standalone' }) ||\n match.quarter(string, {\n width: 'abbreviated',\n context: 'standalone'\n }) ||\n match.quarter(string, { width: 'narrow', context: 'standalone' })\n )\n }\n },\n validate: function(date, value, options) {\n return value >= 1 && value <= 4\n },\n set: function(date, flags, value, options) {\n date.setUTCMonth((value - 1) * 3, 1)\n date.setUTCHours(0, 0, 0, 0)\n return date\n }\n },\n\n // Month\n M: {\n priority: 110,\n parse: function(string, token, match, options) {\n var valueCallback = function(value) {\n return value - 1\n }\n\n switch (token) {\n // 1, 2, ..., 12\n case 'M':\n return parseNumericPattern(\n numericPatterns.month,\n string,\n valueCallback\n )\n // 01, 02, ..., 12\n case 'MM':\n return parseNDigits(2, string, valueCallback)\n // 1st, 2nd, ..., 12th\n case 'Mo':\n return match.ordinalNumber(string, {\n unit: 'month',\n valueCallback: valueCallback\n })\n // Jan, Feb, ..., Dec\n case 'MMM':\n return (\n match.month(string, {\n width: 'abbreviated',\n context: 'formatting'\n }) ||\n match.month(string, { width: 'narrow', context: 'formatting' })\n )\n // J, F, ..., D\n case 'MMMMM':\n return match.month(string, { width: 'narrow', context: 'formatting' })\n // January, February, ..., December\n case 'MMMM':\n default:\n return (\n match.month(string, { width: 'wide', context: 'formatting' }) ||\n match.month(string, {\n width: 'abbreviated',\n context: 'formatting'\n }) ||\n match.month(string, { width: 'narrow', context: 'formatting' })\n )\n }\n },\n validate: function(date, value, options) {\n return value >= 0 && value <= 11\n },\n set: function(date, flags, value, options) {\n date.setUTCMonth(value, 1)\n date.setUTCHours(0, 0, 0, 0)\n return date\n }\n },\n\n // Stand-alone month\n L: {\n priority: 110,\n parse: function(string, token, match, options) {\n var valueCallback = function(value) {\n return value - 1\n }\n\n switch (token) {\n // 1, 2, ..., 12\n case 'L':\n return parseNumericPattern(\n numericPatterns.month,\n string,\n valueCallback\n )\n // 01, 02, ..., 12\n case 'LL':\n return parseNDigits(2, string, valueCallback)\n // 1st, 2nd, ..., 12th\n case 'Lo':\n return match.ordinalNumber(string, {\n unit: 'month',\n valueCallback: valueCallback\n })\n // Jan, Feb, ..., Dec\n case 'LLL':\n return (\n match.month(string, {\n width: 'abbreviated',\n context: 'standalone'\n }) ||\n match.month(string, { width: 'narrow', context: 'standalone' })\n )\n // J, F, ..., D\n case 'LLLLL':\n return match.month(string, { width: 'narrow', context: 'standalone' })\n // January, February, ..., December\n case 'LLLL':\n default:\n return (\n match.month(string, { width: 'wide', context: 'standalone' }) ||\n match.month(string, {\n width: 'abbreviated',\n context: 'standalone'\n }) ||\n match.month(string, { width: 'narrow', context: 'standalone' })\n )\n }\n },\n validate: function(date, value, options) {\n return value >= 0 && value <= 11\n },\n set: function(date, flags, value, options) {\n date.setUTCMonth(value, 1)\n date.setUTCHours(0, 0, 0, 0)\n return date\n }\n },\n\n // Local week of year\n w: {\n priority: 100,\n parse: function(string, token, match, options) {\n switch (token) {\n case 'w':\n return parseNumericPattern(numericPatterns.week, string)\n case 'wo':\n return match.ordinalNumber(string, { unit: 'week' })\n default:\n return parseNDigits(token.length, string)\n }\n },\n validate: function(date, value, options) {\n return value >= 1 && value <= 53\n },\n set: function(date, flags, value, options) {\n return startOfUTCWeek(setUTCWeek(date, value, options), options)\n }\n },\n\n // ISO week of year\n I: {\n priority: 100,\n parse: function(string, token, match, options) {\n switch (token) {\n case 'I':\n return parseNumericPattern(numericPatterns.week, string)\n case 'Io':\n return match.ordinalNumber(string, { unit: 'week' })\n default:\n return parseNDigits(token.length, string)\n }\n },\n validate: function(date, value, options) {\n return value >= 1 && value <= 53\n },\n set: function(date, flags, value, options) {\n return startOfUTCISOWeek(setUTCISOWeek(date, value, options), options)\n }\n },\n\n // Day of the month\n d: {\n priority: 90,\n parse: function(string, token, match, options) {\n switch (token) {\n case 'd':\n return parseNumericPattern(numericPatterns.date, string)\n case 'do':\n return match.ordinalNumber(string, { unit: 'date' })\n default:\n return parseNDigits(token.length, string)\n }\n },\n validate: function(date, value, options) {\n var year = date.getUTCFullYear()\n var isLeapYear = isLeapYearIndex(year)\n var month = date.getUTCMonth()\n if (isLeapYear) {\n return value >= 1 && value <= DAYS_IN_MONTH_LEAP_YEAR[month]\n } else {\n return value >= 1 && value <= DAYS_IN_MONTH[month]\n }\n },\n set: function(date, flags, value, options) {\n date.setUTCDate(value)\n date.setUTCHours(0, 0, 0, 0)\n return date\n }\n },\n\n // Day of year\n D: {\n priority: 90,\n parse: function(string, token, match, options) {\n switch (token) {\n case 'D':\n case 'DD':\n return parseNumericPattern(numericPatterns.dayOfYear, string)\n case 'Do':\n return match.ordinalNumber(string, { unit: 'date' })\n default:\n return parseNDigits(token.length, string)\n }\n },\n validate: function(date, value, options) {\n var year = date.getUTCFullYear()\n var isLeapYear = isLeapYearIndex(year)\n if (isLeapYear) {\n return value >= 1 && value <= 366\n } else {\n return value >= 1 && value <= 365\n }\n },\n set: function(date, flags, value, options) {\n date.setUTCMonth(0, value)\n date.setUTCHours(0, 0, 0, 0)\n return date\n }\n },\n\n // Day of week\n E: {\n priority: 90,\n parse: function(string, token, match, options) {\n switch (token) {\n // Tue\n case 'E':\n case 'EE':\n case 'EEE':\n return (\n match.day(string, {\n width: 'abbreviated',\n context: 'formatting'\n }) ||\n match.day(string, { width: 'short', context: 'formatting' }) ||\n match.day(string, { width: 'narrow', context: 'formatting' })\n )\n // T\n case 'EEEEE':\n return match.day(string, { width: 'narrow', context: 'formatting' })\n // Tu\n case 'EEEEEE':\n return (\n match.day(string, { width: 'short', context: 'formatting' }) ||\n match.day(string, { width: 'narrow', context: 'formatting' })\n )\n // Tuesday\n case 'EEEE':\n default:\n return (\n match.day(string, { width: 'wide', context: 'formatting' }) ||\n match.day(string, {\n width: 'abbreviated',\n context: 'formatting'\n }) ||\n match.day(string, { width: 'short', context: 'formatting' }) ||\n match.day(string, { width: 'narrow', context: 'formatting' })\n )\n }\n },\n validate: function(date, value, options) {\n return value >= 0 && value <= 6\n },\n set: function(date, flags, value, options) {\n date = setUTCDay(date, value, options)\n date.setUTCHours(0, 0, 0, 0)\n return date\n }\n },\n\n // Local day of week\n e: {\n priority: 90,\n parse: function(string, token, match, options) {\n var valueCallback = function(value) {\n var wholeWeekDays = Math.floor((value - 1) / 7) * 7\n return ((value + options.weekStartsOn + 6) % 7) + wholeWeekDays\n }\n\n switch (token) {\n // 3\n case 'e':\n case 'ee': // 03\n return parseNDigits(token.length, string, valueCallback)\n // 3rd\n case 'eo':\n return match.ordinalNumber(string, {\n unit: 'day',\n valueCallback: valueCallback\n })\n // Tue\n case 'eee':\n return (\n match.day(string, {\n width: 'abbreviated',\n context: 'formatting'\n }) ||\n match.day(string, { width: 'short', context: 'formatting' }) ||\n match.day(string, { width: 'narrow', context: 'formatting' })\n )\n // T\n case 'eeeee':\n return match.day(string, { width: 'narrow', context: 'formatting' })\n // Tu\n case 'eeeeee':\n return (\n match.day(string, { width: 'short', context: 'formatting' }) ||\n match.day(string, { width: 'narrow', context: 'formatting' })\n )\n // Tuesday\n case 'eeee':\n default:\n return (\n match.day(string, { width: 'wide', context: 'formatting' }) ||\n match.day(string, {\n width: 'abbreviated',\n context: 'formatting'\n }) ||\n match.day(string, { width: 'short', context: 'formatting' }) ||\n match.day(string, { width: 'narrow', context: 'formatting' })\n )\n }\n },\n validate: function(date, value, options) {\n return value >= 0 && value <= 6\n },\n set: function(date, flags, value, options) {\n date = setUTCDay(date, value, options)\n date.setUTCHours(0, 0, 0, 0)\n return date\n }\n },\n\n // Stand-alone local day of week\n c: {\n priority: 90,\n parse: function(string, token, match, options) {\n var valueCallback = function(value) {\n var wholeWeekDays = Math.floor((value - 1) / 7) * 7\n return ((value + options.weekStartsOn + 6) % 7) + wholeWeekDays\n }\n\n switch (token) {\n // 3\n case 'c':\n case 'cc': // 03\n return parseNDigits(token.length, string, valueCallback)\n // 3rd\n case 'co':\n return match.ordinalNumber(string, {\n unit: 'day',\n valueCallback: valueCallback\n })\n // Tue\n case 'ccc':\n return (\n match.day(string, {\n width: 'abbreviated',\n context: 'standalone'\n }) ||\n match.day(string, { width: 'short', context: 'standalone' }) ||\n match.day(string, { width: 'narrow', context: 'standalone' })\n )\n // T\n case 'ccccc':\n return match.day(string, { width: 'narrow', context: 'standalone' })\n // Tu\n case 'cccccc':\n return (\n match.day(string, { width: 'short', context: 'standalone' }) ||\n match.day(string, { width: 'narrow', context: 'standalone' })\n )\n // Tuesday\n case 'cccc':\n default:\n return (\n match.day(string, { width: 'wide', context: 'standalone' }) ||\n match.day(string, {\n width: 'abbreviated',\n context: 'standalone'\n }) ||\n match.day(string, { width: 'short', context: 'standalone' }) ||\n match.day(string, { width: 'narrow', context: 'standalone' })\n )\n }\n },\n validate: function(date, value, options) {\n return value >= 0 && value <= 6\n },\n set: function(date, flags, value, options) {\n date = setUTCDay(date, value, options)\n date.setUTCHours(0, 0, 0, 0)\n return date\n }\n },\n\n // ISO day of week\n i: {\n priority: 90,\n parse: function(string, token, match, options) {\n var valueCallback = function(value) {\n if (value === 0) {\n return 7\n }\n return value\n }\n\n switch (token) {\n // 2\n case 'i':\n case 'ii': // 02\n return parseNDigits(token.length, string)\n // 2nd\n case 'io':\n return match.ordinalNumber(string, { unit: 'day' })\n // Tue\n case 'iii':\n return (\n match.day(string, {\n width: 'abbreviated',\n context: 'formatting',\n valueCallback: valueCallback\n }) ||\n match.day(string, {\n width: 'short',\n context: 'formatting',\n valueCallback: valueCallback\n }) ||\n match.day(string, {\n width: 'narrow',\n context: 'formatting',\n valueCallback: valueCallback\n })\n )\n // T\n case 'iiiii':\n return match.day(string, {\n width: 'narrow',\n context: 'formatting',\n valueCallback: valueCallback\n })\n // Tu\n case 'iiiiii':\n return (\n match.day(string, {\n width: 'short',\n context: 'formatting',\n valueCallback: valueCallback\n }) ||\n match.day(string, {\n width: 'narrow',\n context: 'formatting',\n valueCallback: valueCallback\n })\n )\n // Tuesday\n case 'iiii':\n default:\n return (\n match.day(string, {\n width: 'wide',\n context: 'formatting',\n valueCallback: valueCallback\n }) ||\n match.day(string, {\n width: 'abbreviated',\n context: 'formatting',\n valueCallback: valueCallback\n }) ||\n match.day(string, {\n width: 'short',\n context: 'formatting',\n valueCallback: valueCallback\n }) ||\n match.day(string, {\n width: 'narrow',\n context: 'formatting',\n valueCallback: valueCallback\n })\n )\n }\n },\n validate: function(date, value, options) {\n return value >= 1 && value <= 7\n },\n set: function(date, flags, value, options) {\n date = setUTCISODay(date, value, options)\n date.setUTCHours(0, 0, 0, 0)\n return date\n }\n },\n\n // AM or PM\n a: {\n priority: 80,\n parse: function(string, token, match, options) {\n switch (token) {\n case 'a':\n case 'aa':\n case 'aaa':\n return (\n match.dayPeriod(string, {\n width: 'abbreviated',\n context: 'formatting'\n }) ||\n match.dayPeriod(string, { width: 'narrow', context: 'formatting' })\n )\n case 'aaaaa':\n return match.dayPeriod(string, {\n width: 'narrow',\n context: 'formatting'\n })\n case 'aaaa':\n default:\n return (\n match.dayPeriod(string, { width: 'wide', context: 'formatting' }) ||\n match.dayPeriod(string, {\n width: 'abbreviated',\n context: 'formatting'\n }) ||\n match.dayPeriod(string, { width: 'narrow', context: 'formatting' })\n )\n }\n },\n set: function(date, flags, value, options) {\n date.setUTCHours(dayPeriodEnumToHours(value), 0, 0, 0)\n return date\n }\n },\n\n // AM, PM, midnight\n b: {\n priority: 80,\n parse: function(string, token, match, options) {\n switch (token) {\n case 'b':\n case 'bb':\n case 'bbb':\n return (\n match.dayPeriod(string, {\n width: 'abbreviated',\n context: 'formatting'\n }) ||\n match.dayPeriod(string, { width: 'narrow', context: 'formatting' })\n )\n case 'bbbbb':\n return match.dayPeriod(string, {\n width: 'narrow',\n context: 'formatting'\n })\n case 'bbbb':\n default:\n return (\n match.dayPeriod(string, { width: 'wide', context: 'formatting' }) ||\n match.dayPeriod(string, {\n width: 'abbreviated',\n context: 'formatting'\n }) ||\n match.dayPeriod(string, { width: 'narrow', context: 'formatting' })\n )\n }\n },\n set: function(date, flags, value, options) {\n date.setUTCHours(dayPeriodEnumToHours(value), 0, 0, 0)\n return date\n }\n },\n\n // in the morning, in the afternoon, in the evening, at night\n B: {\n priority: 80,\n parse: function(string, token, match, options) {\n switch (token) {\n case 'B':\n case 'BB':\n case 'BBB':\n return (\n match.dayPeriod(string, {\n width: 'abbreviated',\n context: 'formatting'\n }) ||\n match.dayPeriod(string, { width: 'narrow', context: 'formatting' })\n )\n case 'BBBBB':\n return match.dayPeriod(string, {\n width: 'narrow',\n context: 'formatting'\n })\n case 'BBBB':\n default:\n return (\n match.dayPeriod(string, { width: 'wide', context: 'formatting' }) ||\n match.dayPeriod(string, {\n width: 'abbreviated',\n context: 'formatting'\n }) ||\n match.dayPeriod(string, { width: 'narrow', context: 'formatting' })\n )\n }\n },\n set: function(date, flags, value, options) {\n date.setUTCHours(dayPeriodEnumToHours(value), 0, 0, 0)\n return date\n }\n },\n\n // Hour [1-12]\n h: {\n priority: 70,\n parse: function(string, token, match, options) {\n switch (token) {\n case 'h':\n return parseNumericPattern(numericPatterns.hour12h, string)\n case 'ho':\n return match.ordinalNumber(string, { unit: 'hour' })\n default:\n return parseNDigits(token.length, string)\n }\n },\n validate: function(date, value, options) {\n return value >= 1 && value <= 12\n },\n set: function(date, flags, value, options) {\n var isPM = date.getUTCHours() >= 12\n if (isPM && value < 12) {\n date.setUTCHours(value + 12, 0, 0, 0)\n } else if (!isPM && value === 12) {\n date.setUTCHours(0, 0, 0, 0)\n } else {\n date.setUTCHours(value, 0, 0, 0)\n }\n return date\n }\n },\n\n // Hour [0-23]\n H: {\n priority: 70,\n parse: function(string, token, match, options) {\n switch (token) {\n case 'H':\n return parseNumericPattern(numericPatterns.hour23h, string)\n case 'Ho':\n return match.ordinalNumber(string, { unit: 'hour' })\n default:\n return parseNDigits(token.length, string)\n }\n },\n validate: function(date, value, options) {\n return value >= 0 && value <= 23\n },\n set: function(date, flags, value, options) {\n date.setUTCHours(value, 0, 0, 0)\n return date\n }\n },\n\n // Hour [0-11]\n K: {\n priority: 70,\n parse: function(string, token, match, options) {\n switch (token) {\n case 'K':\n return parseNumericPattern(numericPatterns.hour11h, string)\n case 'Ko':\n return match.ordinalNumber(string, { unit: 'hour' })\n default:\n return parseNDigits(token.length, string)\n }\n },\n validate: function(date, value, options) {\n return value >= 0 && value <= 11\n },\n set: function(date, flags, value, options) {\n var isPM = date.getUTCHours() >= 12\n if (isPM && value < 12) {\n date.setUTCHours(value + 12, 0, 0, 0)\n } else {\n date.setUTCHours(value, 0, 0, 0)\n }\n return date\n }\n },\n\n // Hour [1-24]\n k: {\n priority: 70,\n parse: function(string, token, match, options) {\n switch (token) {\n case 'k':\n return parseNumericPattern(numericPatterns.hour24h, string)\n case 'ko':\n return match.ordinalNumber(string, { unit: 'hour' })\n default:\n return parseNDigits(token.length, string)\n }\n },\n validate: function(date, value, options) {\n return value >= 1 && value <= 24\n },\n set: function(date, flags, value, options) {\n var hours = value <= 24 ? value % 24 : value\n date.setUTCHours(hours, 0, 0, 0)\n return date\n }\n },\n\n // Minute\n m: {\n priority: 60,\n parse: function(string, token, match, options) {\n switch (token) {\n case 'm':\n return parseNumericPattern(numericPatterns.minute, string)\n case 'mo':\n return match.ordinalNumber(string, { unit: 'minute' })\n default:\n return parseNDigits(token.length, string)\n }\n },\n validate: function(date, value, options) {\n return value >= 0 && value <= 59\n },\n set: function(date, flags, value, options) {\n date.setUTCMinutes(value, 0, 0)\n return date\n }\n },\n\n // Second\n s: {\n priority: 50,\n parse: function(string, token, match, options) {\n switch (token) {\n case 's':\n return parseNumericPattern(numericPatterns.second, string)\n case 'so':\n return match.ordinalNumber(string, { unit: 'second' })\n default:\n return parseNDigits(token.length, string)\n }\n },\n validate: function(date, value, options) {\n return value >= 0 && value <= 59\n },\n set: function(date, flags, value, options) {\n date.setUTCSeconds(value, 0)\n return date\n }\n },\n\n // Fraction of second\n S: {\n priority: 30,\n parse: function(string, token, match, options) {\n var valueCallback = function(value) {\n return Math.floor(value * Math.pow(10, -token.length + 3))\n }\n return parseNDigits(token.length, string, valueCallback)\n },\n set: function(date, flags, value, options) {\n date.setUTCMilliseconds(value)\n return date\n }\n },\n\n // Timezone (ISO-8601. +00:00 is `'Z'`)\n X: {\n priority: 10,\n parse: function(string, token, match, options) {\n switch (token) {\n case 'X':\n return parseTimezonePattern(\n timezonePatterns.basicOptionalMinutes,\n string\n )\n case 'XX':\n return parseTimezonePattern(timezonePatterns.basic, string)\n case 'XXXX':\n return parseTimezonePattern(\n timezonePatterns.basicOptionalSeconds,\n string\n )\n case 'XXXXX':\n return parseTimezonePattern(\n timezonePatterns.extendedOptionalSeconds,\n string\n )\n case 'XXX':\n default:\n return parseTimezonePattern(timezonePatterns.extended, string)\n }\n },\n set: function(date, flags, value, options) {\n if (flags.timestampIsSet) {\n return date\n }\n return new Date(date.getTime() - value)\n }\n },\n\n // Timezone (ISO-8601)\n x: {\n priority: 10,\n parse: function(string, token, match, options) {\n switch (token) {\n case 'x':\n return parseTimezonePattern(\n timezonePatterns.basicOptionalMinutes,\n string\n )\n case 'xx':\n return parseTimezonePattern(timezonePatterns.basic, string)\n case 'xxxx':\n return parseTimezonePattern(\n timezonePatterns.basicOptionalSeconds,\n string\n )\n case 'xxxxx':\n return parseTimezonePattern(\n timezonePatterns.extendedOptionalSeconds,\n string\n )\n case 'xxx':\n default:\n return parseTimezonePattern(timezonePatterns.extended, string)\n }\n },\n set: function(date, flags, value, options) {\n if (flags.timestampIsSet) {\n return date\n }\n return new Date(date.getTime() - value)\n }\n },\n\n // Seconds timestamp\n t: {\n priority: 40,\n parse: function(string, token, match, options) {\n return parseAnyDigitsSigned(string)\n },\n set: function(date, flags, value, options) {\n return [new Date(value * 1000), { timestampIsSet: true }]\n }\n },\n\n // Milliseconds timestamp\n T: {\n priority: 20,\n parse: function(string, token, match, options) {\n return parseAnyDigitsSigned(string)\n },\n set: function(date, flags, value, options) {\n return [new Date(value), { timestampIsSet: true }]\n }\n }\n}\n\nexport default parsers\n","import toInteger from '../_lib/toInteger/index.js'\nimport assign from '../_lib/assign/index.js'\nimport getTimezoneOffsetInMilliseconds from '../_lib/getTimezoneOffsetInMilliseconds/index.js'\nimport toDate from '../toDate/index.js'\nimport subMilliseconds from '../subMilliseconds/index.js'\nimport defaultLocale from '../locale/en-US/index.js'\nimport parsers from './_lib/parsers/index.js'\nimport {\n isProtectedToken,\n throwProtectedError\n} from '../_lib/protectedTokens/index.js'\n\nvar TIMEZONE_UNIT_PRIORITY = 10\n\n// This RegExp consists of three parts separated by `|`:\n// - [yYQqMLwIdDecihHKkms]o matches any available ordinal number token\n// (one of the certain letters followed by `o`)\n// - (\\w)\\1* matches any sequences of the same letter\n// - '' matches two quote characters in a row\n// - '(''|[^'])+('|$) matches anything surrounded by two quote characters ('),\n// except a single quote symbol, which ends the sequence.\n// Two quote characters do not end the sequence.\n// If there is no matching single quote\n// then the sequence will continue until the end of the string.\n// - . matches any single character unmatched by previous parts of the RegExps\nvar formattingTokensRegExp = /[yYQqMLwIdDecihHKkms]o|(\\w)\\1*|''|'(''|[^'])+('|$)|./g\n\nvar escapedStringRegExp = /^'(.*?)'?$/\nvar doubleQuoteRegExp = /''/g\n\nvar notWhitespaceRegExp = /\\S/\n\n/**\n * @name parse\n * @category Common Helpers\n * @summary Parse the date.\n *\n * @description\n * Return the date parsed from string using the given format string.\n *\n * > âš ï¸ Please note that the `format` tokens differ from Moment.js and other libraries.\n * > See: https://git.io/fxCyr\n *\n * The characters in the format string wrapped between two single quotes characters (') are escaped.\n * Two single quotes in a row, whether inside or outside a quoted sequence, represent a 'real' single quote.\n *\n * Format of the format string is based on Unicode Technical Standard #35:\n * https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table\n * with a few additions (see note 5 below the table).\n *\n * Accepted format string patterns:\n * | Unit |Prior| Pattern | Result examples | Notes |\n * |---------------------------------|-----|---------|-----------------------------------|-------|\n * | Era | 140 | G..GGG | AD, BC | |\n * | | | GGGG | Anno Domini, Before Christ | 2 |\n * | | | GGGGG | A, B | |\n * | Calendar year | 130 | y | 44, 1, 1900, 2017, 9999 | 4 |\n * | | | yo | 44th, 1st, 1900th, 9999999th | 4,5 |\n * | | | yy | 44, 01, 00, 17 | 4 |\n * | | | yyy | 044, 001, 123, 999 | 4 |\n * | | | yyyy | 0044, 0001, 1900, 2017 | 4 |\n * | | | yyyyy | ... | 2,4 |\n * | Local week-numbering year | 130 | Y | 44, 1, 1900, 2017, 9000 | 4 |\n * | | | Yo | 44th, 1st, 1900th, 9999999th | 4,5 |\n * | | | YY | 44, 01, 00, 17 | 4,6 |\n * | | | YYY | 044, 001, 123, 999 | 4 |\n * | | | YYYY | 0044, 0001, 1900, 2017 | 4,6 |\n * | | | YYYYY | ... | 2,4 |\n * | ISO week-numbering year | 130 | R | -43, 1, 1900, 2017, 9999, -9999 | 4,5 |\n * | | | RR | -43, 01, 00, 17 | 4,5 |\n * | | | RRR | -043, 001, 123, 999, -999 | 4,5 |\n * | | | RRRR | -0043, 0001, 2017, 9999, -9999 | 4,5 |\n * | | | RRRRR | ... | 2,4,5 |\n * | Extended year | 130 | u | -43, 1, 1900, 2017, 9999, -999 | 4 |\n * | | | uu | -43, 01, 99, -99 | 4 |\n * | | | uuu | -043, 001, 123, 999, -999 | 4 |\n * | | | uuuu | -0043, 0001, 2017, 9999, -9999 | 4 |\n * | | | uuuuu | ... | 2,4 |\n * | Quarter (formatting) | 120 | Q | 1, 2, 3, 4 | |\n * | | | Qo | 1st, 2nd, 3rd, 4th | 5 |\n * | | | QQ | 01, 02, 03, 04 | |\n * | | | QQQ | Q1, Q2, Q3, Q4 | |\n * | | | QQQQ | 1st quarter, 2nd quarter, ... | 2 |\n * | | | QQQQQ | 1, 2, 3, 4 | 4 |\n * | Quarter (stand-alone) | 120 | q | 1, 2, 3, 4 | |\n * | | | qo | 1st, 2nd, 3rd, 4th | 5 |\n * | | | qq | 01, 02, 03, 04 | |\n * | | | qqq | Q1, Q2, Q3, Q4 | |\n * | | | qqqq | 1st quarter, 2nd quarter, ... | 2 |\n * | | | qqqqq | 1, 2, 3, 4 | 3 |\n * | Month (formatting) | 110 | M | 1, 2, ..., 12 | |\n * | | | Mo | 1st, 2nd, ..., 12th | 5 |\n * | | | MM | 01, 02, ..., 12 | |\n * | | | MMM | Jan, Feb, ..., Dec | |\n * | | | MMMM | January, February, ..., December | 2 |\n * | | | MMMMM | J, F, ..., D | |\n * | Month (stand-alone) | 110 | L | 1, 2, ..., 12 | |\n * | | | Lo | 1st, 2nd, ..., 12th | 5 |\n * | | | LL | 01, 02, ..., 12 | |\n * | | | LLL | Jan, Feb, ..., Dec | |\n * | | | LLLL | January, February, ..., December | 2 |\n * | | | LLLLL | J, F, ..., D | |\n * | Local week of year | 100 | w | 1, 2, ..., 53 | |\n * | | | wo | 1st, 2nd, ..., 53th | 5 |\n * | | | ww | 01, 02, ..., 53 | |\n * | ISO week of year | 100 | I | 1, 2, ..., 53 | 5 |\n * | | | Io | 1st, 2nd, ..., 53th | 5 |\n * | | | II | 01, 02, ..., 53 | 5 |\n * | Day of month | 90 | d | 1, 2, ..., 31 | |\n * | | | do | 1st, 2nd, ..., 31st | 5 |\n * | | | dd | 01, 02, ..., 31 | |\n * | Day of year | 90 | D | 1, 2, ..., 365, 366 | 6 |\n * | | | Do | 1st, 2nd, ..., 365th, 366th | 5 |\n * | | | DD | 01, 02, ..., 365, 366 | 6 |\n * | | | DDD | 001, 002, ..., 365, 366 | |\n * | | | DDDD | ... | 2 |\n * | Day of week (formatting) | 90 | E..EEE | Mon, Tue, Wed, ..., Su | |\n * | | | EEEE | Monday, Tuesday, ..., Sunday | 2 |\n * | | | EEEEE | M, T, W, T, F, S, S | |\n * | | | EEEEEE | Mo, Tu, We, Th, Fr, Su, Sa | |\n * | ISO day of week (formatting) | 90 | i | 1, 2, 3, ..., 7 | 5 |\n * | | | io | 1st, 2nd, ..., 7th | 5 |\n * | | | ii | 01, 02, ..., 07 | 5 |\n * | | | iii | Mon, Tue, Wed, ..., Su | 5 |\n * | | | iiii | Monday, Tuesday, ..., Sunday | 2,5 |\n * | | | iiiii | M, T, W, T, F, S, S | 5 |\n * | | | iiiiii | Mo, Tu, We, Th, Fr, Su, Sa | 5 |\n * | Local day of week (formatting) | 90 | e | 2, 3, 4, ..., 1 | |\n * | | | eo | 2nd, 3rd, ..., 1st | 5 |\n * | | | ee | 02, 03, ..., 01 | |\n * | | | eee | Mon, Tue, Wed, ..., Su | |\n * | | | eeee | Monday, Tuesday, ..., Sunday | 2 |\n * | | | eeeee | M, T, W, T, F, S, S | |\n * | | | eeeeee | Mo, Tu, We, Th, Fr, Su, Sa | |\n * | Local day of week (stand-alone) | 90 | c | 2, 3, 4, ..., 1 | |\n * | | | co | 2nd, 3rd, ..., 1st | 5 |\n * | | | cc | 02, 03, ..., 01 | |\n * | | | ccc | Mon, Tue, Wed, ..., Su | |\n * | | | cccc | Monday, Tuesday, ..., Sunday | 2 |\n * | | | ccccc | M, T, W, T, F, S, S | |\n * | | | cccccc | Mo, Tu, We, Th, Fr, Su, Sa | |\n * | AM, PM | 80 | a..aaa | AM, PM | |\n * | | | aaaa | a.m., p.m. | 2 |\n * | | | aaaaa | a, p | |\n * | AM, PM, noon, midnight | 80 | b..bbb | AM, PM, noon, midnight | |\n * | | | bbbb | a.m., p.m., noon, midnight | 2 |\n * | | | bbbbb | a, p, n, mi | |\n * | Flexible day period | 80 | B..BBB | at night, in the morning, ... | |\n * | | | BBBB | at night, in the morning, ... | 2 |\n * | | | BBBBB | at night, in the morning, ... | |\n * | Hour [1-12] | 70 | h | 1, 2, ..., 11, 12 | |\n * | | | ho | 1st, 2nd, ..., 11th, 12th | 5 |\n * | | | hh | 01, 02, ..., 11, 12 | |\n * | Hour [0-23] | 70 | H | 0, 1, 2, ..., 23 | |\n * | | | Ho | 0th, 1st, 2nd, ..., 23rd | 5 |\n * | | | HH | 00, 01, 02, ..., 23 | |\n * | Hour [0-11] | 70 | K | 1, 2, ..., 11, 0 | |\n * | | | Ko | 1st, 2nd, ..., 11th, 0th | 5 |\n * | | | KK | 1, 2, ..., 11, 0 | |\n * | Hour [1-24] | 70 | k | 24, 1, 2, ..., 23 | |\n * | | | ko | 24th, 1st, 2nd, ..., 23rd | 5 |\n * | | | kk | 24, 01, 02, ..., 23 | |\n * | Minute | 60 | m | 0, 1, ..., 59 | |\n * | | | mo | 0th, 1st, ..., 59th | 5 |\n * | | | mm | 00, 01, ..., 59 | |\n * | Second | 50 | s | 0, 1, ..., 59 | |\n * | | | so | 0th, 1st, ..., 59th | 5 |\n * | | | ss | 00, 01, ..., 59 | |\n * | Seconds timestamp | 40 | t | 512969520 | |\n * | | | tt | ... | 2 |\n * | Fraction of second | 30 | S | 0, 1, ..., 9 | |\n * | | | SS | 00, 01, ..., 99 | |\n * | | | SSS | 000, 0001, ..., 999 | |\n * | | | SSSS | ... | 2 |\n * | Milliseconds timestamp | 20 | T | 512969520900 | |\n * | | | TT | ... | 2 |\n * | Timezone (ISO-8601 w/ Z) | 10 | X | -08, +0530, Z | |\n * | | | XX | -0800, +0530, Z | |\n * | | | XXX | -08:00, +05:30, Z | |\n * | | | XXXX | -0800, +0530, Z, +123456 | 2 |\n * | | | XXXXX | -08:00, +05:30, Z, +12:34:56 | |\n * | Timezone (ISO-8601 w/o Z) | 10 | x | -08, +0530, +00 | |\n * | | | xx | -0800, +0530, +0000 | |\n * | | | xxx | -08:00, +05:30, +00:00 | 2 |\n * | | | xxxx | -0800, +0530, +0000, +123456 | |\n * | | | xxxxx | -08:00, +05:30, +00:00, +12:34:56 | |\n * Notes:\n * 1. \"Formatting\" units (e.g. formatting quarter) in the default en-US locale\n * are the same as \"stand-alone\" units, but are different in some languages.\n * \"Formatting\" units are declined according to the rules of the language\n * in the context of a date. \"Stand-alone\" units are always nominative singular.\n * In `format` function, they will produce different result:\n *\n * `format(new Date(2017, 10, 6), 'do LLLL', {locale: cs}) //=> '6. listopad'`\n *\n * `format(new Date(2017, 10, 6), 'do MMMM', {locale: cs}) //=> '6. listopadu'`\n *\n * `parse` will try to match both formatting and stand-alone units interchangably.\n *\n * 2. Any sequence of the identical letters is a pattern, unless it is escaped by\n * the single quote characters (see below).\n * If the sequence is longer than listed in table:\n * - for numerical units (`yyyyyyyy`) `parse` will try to match a number\n * as wide as the sequence\n * - for text units (`MMMMMMMM`) `parse` will try to match the widest variation of the unit.\n * These variations are marked with \"2\" in the last column of the table.\n *\n * 3. `QQQQQ` and `qqqqq` could be not strictly numerical in some locales.\n * These tokens represent the shortest form of the quarter.\n *\n * 4. The main difference between `y` and `u` patterns are B.C. years:\n *\n * | Year | `y` | `u` |\n * |------|-----|-----|\n * | AC 1 | 1 | 1 |\n * | BC 1 | 1 | 0 |\n * | BC 2 | 2 | -1 |\n *\n * Also `yy` will try to guess the century of two digit year by proximity with `baseDate`:\n *\n * `parse('50', 'yy', new Date(2018, 0, 1)) //=> Sat Jan 01 2050 00:00:00`\n *\n * `parse('75', 'yy', new Date(2018, 0, 1)) //=> Wed Jan 01 1975 00:00:00`\n *\n * while `uu` will just assign the year as is:\n *\n * `parse('50', 'uu', new Date(2018, 0, 1)) //=> Sat Jan 01 0050 00:00:00`\n *\n * `parse('75', 'uu', new Date(2018, 0, 1)) //=> Tue Jan 01 0075 00:00:00`\n *\n * The same difference is true for local and ISO week-numbering years (`Y` and `R`),\n * except local week-numbering years are dependent on `options.weekStartsOn`\n * and `options.firstWeekContainsDate` (compare [setISOWeekYear]{@link https://date-fns.org/docs/setISOWeekYear}\n * and [setWeekYear]{@link https://date-fns.org/docs/setWeekYear}).\n *\n * 5. These patterns are not in the Unicode Technical Standard #35:\n * - `i`: ISO day of week\n * - `I`: ISO week of year\n * - `R`: ISO week-numbering year\n * - `o`: ordinal number modifier\n *\n * 6. These tokens are often confused with others. See: https://git.io/fxCyr\n *\n * Values will be assigned to the date in the descending order of its unit's priority.\n * Units of an equal priority overwrite each other in the order of appearance.\n *\n * If no values of higher priority are parsed (e.g. when parsing string 'January 1st' without a year),\n * the values will be taken from 3rd argument `baseDate` which works as a context of parsing.\n *\n * `baseDate` must be passed for correct work of the function.\n * If you're not sure which `baseDate` to supply, create a new instance of Date:\n * `parse('02/11/2014', 'MM/dd/yyyy', new Date())`\n * In this case parsing will be done in the context of the current date.\n * If `baseDate` is `Invalid Date` or a value not convertible to valid `Date`,\n * then `Invalid Date` will be returned.\n *\n * The result may vary by locale.\n *\n * If `formatString` matches with `dateString` but does not provides tokens, `baseDate` will be returned.\n *\n * If parsing failed, `Invalid Date` will be returned.\n * Invalid Date is a Date, whose time value is NaN.\n * Time value of Date: http://es5.github.io/#x15.9.1.1\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * - Old `parse` was renamed to `toDate`.\n * Now `parse` is a new function which parses a string using a provided format.\n *\n * ```javascript\n * // Before v2.0.0\n * parse('2016-01-01')\n *\n * // v2.0.0 onward\n * toDate('2016-01-01')\n * parse('2016-01-01', 'yyyy-MM-dd', new Date())\n * ```\n *\n * @param {String} dateString - the string to parse\n * @param {String} formatString - the string of tokens\n * @param {Date|Number} baseDate - defines values missing from the parsed dateString\n * @param {Object} [options] - an object with options.\n * @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale}\n * @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)\n * @param {1|2|3|4|5|6|7} [options.firstWeekContainsDate=1] - the day of January, which is always in the first week of the year\n * @param {Boolean} [options.awareOfUnicodeTokens=false] - if true, allows usage of Unicode tokens causes confusion:\n * - Some of the day of year tokens (`D`, `DD`) that are confused with the day of month tokens (`d`, `dd`).\n * - Some of the local week-numbering year tokens (`YY`, `YYYY`) that are confused with the calendar year tokens (`yy`, `yyyy`).\n * See: https://git.io/fxCyr\n * @returns {Date} the parsed date\n * @throws {TypeError} 3 arguments required\n * @throws {RangeError} `options.weekStartsOn` must be between 0 and 6\n * @throws {RangeError} `options.firstWeekContainsDate` must be between 1 and 7\n * @throws {RangeError} `options.locale` must contain `match` property\n * @throws {RangeError} `options.awareOfUnicodeTokens` must be set to `true` to use `XX` token; see: https://git.io/fxCyr\n *\n * @example\n * // Parse 11 February 2014 from middle-endian format:\n * var result = parse('02/11/2014', 'MM/dd/yyyy', new Date())\n * //=> Tue Feb 11 2014 00:00:00\n *\n * @example\n * // Parse 28th of February in Esperanto locale in the context of 2010 year:\n * import eo from 'date-fns/locale/eo'\n * var result = parse('28-a de februaro', \"do 'de' MMMM\", new Date(2010, 0, 1), {\n * locale: eo\n * })\n * //=> Sun Feb 28 2010 00:00:00\n */\nexport default function parse(\n dirtyDateString,\n dirtyFormatString,\n dirtyBaseDate,\n dirtyOptions\n) {\n if (arguments.length < 3) {\n throw new TypeError(\n '3 arguments required, but only ' + arguments.length + ' present'\n )\n }\n\n var dateString = String(dirtyDateString)\n var formatString = String(dirtyFormatString)\n var options = dirtyOptions || {}\n\n var locale = options.locale || defaultLocale\n\n if (!locale.match) {\n throw new RangeError('locale must contain match property')\n }\n\n var localeFirstWeekContainsDate =\n locale.options && locale.options.firstWeekContainsDate\n var defaultFirstWeekContainsDate =\n localeFirstWeekContainsDate == null\n ? 1\n : toInteger(localeFirstWeekContainsDate)\n var firstWeekContainsDate =\n options.firstWeekContainsDate == null\n ? defaultFirstWeekContainsDate\n : toInteger(options.firstWeekContainsDate)\n\n // Test if weekStartsOn is between 1 and 7 _and_ is not NaN\n if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) {\n throw new RangeError(\n 'firstWeekContainsDate must be between 1 and 7 inclusively'\n )\n }\n\n var localeWeekStartsOn = locale.options && locale.options.weekStartsOn\n var defaultWeekStartsOn =\n localeWeekStartsOn == null ? 0 : toInteger(localeWeekStartsOn)\n var weekStartsOn =\n options.weekStartsOn == null\n ? defaultWeekStartsOn\n : toInteger(options.weekStartsOn)\n\n // Test if weekStartsOn is between 0 and 6 _and_ is not NaN\n if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {\n throw new RangeError('weekStartsOn must be between 0 and 6 inclusively')\n }\n\n if (formatString === '') {\n if (dateString === '') {\n return toDate(dirtyBaseDate)\n } else {\n return new Date(NaN)\n }\n }\n\n var subFnOptions = {\n firstWeekContainsDate: firstWeekContainsDate,\n weekStartsOn: weekStartsOn,\n locale: locale\n }\n\n // If timezone isn't specified, it will be set to the system timezone\n var setters = [\n {\n priority: TIMEZONE_UNIT_PRIORITY,\n set: dateToSystemTimezone,\n index: 0\n }\n ]\n\n var i\n\n var tokens = formatString.match(formattingTokensRegExp)\n\n for (i = 0; i < tokens.length; i++) {\n var token = tokens[i]\n\n if (!options.awareOfUnicodeTokens && isProtectedToken(token)) {\n throwProtectedError(token)\n }\n\n var firstCharacter = token[0]\n var parser = parsers[firstCharacter]\n if (parser) {\n var parseResult = parser.parse(\n dateString,\n token,\n locale.match,\n subFnOptions\n )\n\n if (!parseResult) {\n return new Date(NaN)\n }\n\n setters.push({\n priority: parser.priority,\n set: parser.set,\n validate: parser.validate,\n value: parseResult.value,\n index: setters.length\n })\n\n dateString = parseResult.rest\n } else {\n // Replace two single quote characters with one single quote character\n if (token === \"''\") {\n token = \"'\"\n } else if (firstCharacter === \"'\") {\n token = cleanEscapedString(token)\n }\n\n // Cut token from string, or, if string doesn't match the token, return Invalid Date\n if (dateString.indexOf(token) === 0) {\n dateString = dateString.slice(token.length)\n } else {\n return new Date(NaN)\n }\n }\n }\n\n // Check if the remaining input contains something other than whitespace\n if (dateString.length > 0 && notWhitespaceRegExp.test(dateString)) {\n return new Date(NaN)\n }\n\n var uniquePrioritySetters = setters\n .map(function(setter) {\n return setter.priority\n })\n .sort(function(a, b) {\n return b - a\n })\n .filter(function(priority, index, array) {\n return array.indexOf(priority) === index\n })\n .map(function(priority) {\n return setters\n .filter(function(setter) {\n return setter.priority === priority\n })\n .reverse()\n })\n .map(function(setterArray) {\n return setterArray[0]\n })\n\n var date = toDate(dirtyBaseDate)\n\n if (isNaN(date)) {\n return new Date(NaN)\n }\n\n // Convert the date in system timezone to the same date in UTC+00:00 timezone.\n // This ensures that when UTC functions will be implemented, locales will be compatible with them.\n // See an issue about UTC functions: https://github.com/date-fns/date-fns/issues/37\n var utcDate = subMilliseconds(date, getTimezoneOffsetInMilliseconds(date))\n\n var flags = {}\n for (i = 0; i < uniquePrioritySetters.length; i++) {\n var setter = uniquePrioritySetters[i]\n\n if (\n setter.validate &&\n !setter.validate(utcDate, setter.value, subFnOptions)\n ) {\n return new Date(NaN)\n }\n\n var result = setter.set(utcDate, flags, setter.value, subFnOptions)\n // Result is tuple (date, flags)\n if (result[0]) {\n utcDate = result[0]\n assign(flags, result[1])\n // Result is date\n } else {\n utcDate = result\n }\n }\n\n return utcDate\n}\n\nfunction dateToSystemTimezone(date, flags) {\n if (flags.timestampIsSet) {\n return date\n }\n\n var convertedDate = new Date(0)\n convertedDate.setFullYear(\n date.getUTCFullYear(),\n date.getUTCMonth(),\n date.getUTCDate()\n )\n convertedDate.setHours(\n date.getUTCHours(),\n date.getUTCMinutes(),\n date.getUTCSeconds(),\n date.getUTCMilliseconds()\n )\n return convertedDate\n}\n\nfunction cleanEscapedString(input) {\n return input.match(escapedStringRegExp)[1].replace(doubleQuoteRegExp, \"'\")\n}\n","import toInteger from '../_lib/toInteger/index.js'\nimport getTimezoneOffsetInMilliseconds from '../_lib/getTimezoneOffsetInMilliseconds/index.js'\n\nvar MILLISECONDS_IN_HOUR = 3600000\nvar MILLISECONDS_IN_MINUTE = 60000\nvar DEFAULT_ADDITIONAL_DIGITS = 2\n\nvar patterns = {\n dateTimeDelimiter: /[T ]/,\n timeZoneDelimiter: /[Z ]/i,\n timezone: /([Z+-].*)$/\n}\n\nvar dateRegex = /^-?(?:(\\d{3})|(\\d{2})(?:-?(\\d{2}))?|W(\\d{2})(?:-?(\\d{1}))?|)$/\nvar timeRegex = /^(\\d{2}(?:[.,]\\d*)?)(?::?(\\d{2}(?:[.,]\\d*)?))?(?::?(\\d{2}(?:[.,]\\d*)?))?$/\nvar timezoneRegex = /^([+-])(\\d{2})(?::?(\\d{2}))?$/\n\n/**\n * @name parseISO\n * @category Common Helpers\n * @summary Parse ISO string\n *\n * @description\n * Parse the given string in ISO 8601 format and return an instance of Date.\n *\n * Function accepts complete ISO 8601 formats as well as partial implementations.\n * ISO 8601: http://en.wikipedia.org/wiki/ISO_8601\n *\n * If the argument isn't a string, the function cannot parse the string or\n * the values are invalid, it returns Invalid Date.\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * - The previous `parse` implementation was renamed to `parseISO`.\n *\n * ```javascript\n * // Before v2.0.0\n * parse('2016-01-01')\n *\n * // v2.0.0 onward\n * parseISO('2016-01-01')\n * ```\n *\n * - `parseISO` now validates separate date and time values in ISO-8601 strings\n * and returns `Invalid Date` if the date is invalid.\n *\n * ```javascript\n * parseISO('2018-13-32')\n * //=> Invalid Date\n * ```\n *\n * - `parseISO` now doesn't fall back to `new Date` constructor\n * if it fails to parse a string argument. Instead, it returns `Invalid Date`.\n *\n * @param {String} argument - the value to convert\n * @param {Object} [options] - an object with options.\n * @param {0|1|2} [options.additionalDigits=2] - the additional number of digits in the extended year format\n * @returns {Date} the parsed date in the local time zone\n * @throws {TypeError} 1 argument required\n * @throws {RangeError} `options.additionalDigits` must be 0, 1 or 2\n *\n * @example\n * // Convert string '2014-02-11T11:30:30' to date:\n * var result = parseISO('2014-02-11T11:30:30')\n * //=> Tue Feb 11 2014 11:30:30\n *\n * @example\n * // Convert string '+02014101' to date,\n * // if the additional number of digits in the extended year format is 1:\n * var result = parseISO('+02014101', { additionalDigits: 1 })\n * //=> Fri Apr 11 2014 00:00:00\n */\nexport default function parseISO(argument, dirtyOptions) {\n if (arguments.length < 1) {\n throw new TypeError(\n '1 argument required, but only ' + arguments.length + ' present'\n )\n }\n\n var options = dirtyOptions || {}\n\n var additionalDigits =\n options.additionalDigits == null\n ? DEFAULT_ADDITIONAL_DIGITS\n : toInteger(options.additionalDigits)\n if (\n additionalDigits !== 2 &&\n additionalDigits !== 1 &&\n additionalDigits !== 0\n ) {\n throw new RangeError('additionalDigits must be 0, 1 or 2')\n }\n\n if (\n !(\n typeof argument === 'string' ||\n Object.prototype.toString.call(argument) === '[object String]'\n )\n ) {\n return new Date(NaN)\n }\n\n var dateStrings = splitDateString(argument)\n var parseYearResult = parseYear(dateStrings.date, additionalDigits)\n var date = parseDate(parseYearResult.restDateString, parseYearResult.year)\n\n if (isNaN(date) || !date) {\n return new Date(NaN)\n }\n\n var timestamp = date.getTime()\n var time = 0\n var offset\n\n if (dateStrings.time) {\n time = parseTime(dateStrings.time)\n if (isNaN(time)) {\n return new Date(NaN)\n }\n }\n\n if (dateStrings.timezone) {\n offset = parseTimezone(dateStrings.timezone)\n if (isNaN(offset)) {\n return new Date(NaN)\n }\n } else {\n var fullTime = timestamp + time\n var fullTimeDate = new Date(fullTime)\n\n offset = getTimezoneOffsetInMilliseconds(fullTimeDate)\n\n // Adjust time when it's coming from DST\n var fullTimeDateNextDay = new Date(fullTime)\n fullTimeDateNextDay.setDate(fullTimeDate.getDate() + 1)\n var offsetDiff =\n getTimezoneOffsetInMilliseconds(fullTimeDateNextDay) - offset\n if (offsetDiff > 0) {\n offset += offsetDiff\n }\n }\n\n return new Date(timestamp + time + offset)\n}\n\nfunction splitDateString(dateString) {\n var dateStrings = {}\n var array = dateString.split(patterns.dateTimeDelimiter)\n var timeString\n\n if (/:/.test(array[0])) {\n dateStrings.date = null\n timeString = array[0]\n } else {\n dateStrings.date = array[0]\n timeString = array[1]\n if (patterns.timeZoneDelimiter.test(dateStrings.date)) {\n dateStrings.date = dateString.split(patterns.timeZoneDelimiter)[0]\n timeString = dateString.substr(dateStrings.date.length, dateString.length)\n }\n }\n\n if (timeString) {\n var token = patterns.timezone.exec(timeString)\n if (token) {\n dateStrings.time = timeString.replace(token[1], '')\n dateStrings.timezone = token[1]\n } else {\n dateStrings.time = timeString\n }\n }\n\n return dateStrings\n}\n\nfunction parseYear(dateString, additionalDigits) {\n var regex = new RegExp(\n '^(?:(\\\\d{4}|[+-]\\\\d{' +\n (4 + additionalDigits) +\n '})|(\\\\d{2}|[+-]\\\\d{' +\n (2 + additionalDigits) +\n '})$)'\n )\n\n var captures = dateString.match(regex)\n // Invalid ISO-formatted year\n if (!captures) return { year: null }\n\n var year = captures[1] && parseInt(captures[1])\n var century = captures[2] && parseInt(captures[2])\n\n return {\n year: century == null ? year : century * 100,\n restDateString: dateString.slice((captures[1] || captures[2]).length)\n }\n}\n\nfunction parseDate(dateString, year) {\n // Invalid ISO-formatted year\n if (year === null) return null\n\n var captures = dateString.match(dateRegex)\n // Invalid ISO-formatted string\n if (!captures) return null\n\n var isWeekDate = !!captures[4]\n var dayOfYear = parseDateUnit(captures[1])\n var month = parseDateUnit(captures[2]) - 1\n var day = parseDateUnit(captures[3])\n var week = parseDateUnit(captures[4]) - 1\n var dayOfWeek = parseDateUnit(captures[5]) - 1\n\n if (isWeekDate) {\n if (!validateWeekDate(year, week, dayOfWeek)) {\n return new Date(NaN)\n }\n return dayOfISOWeekYear(year, week, dayOfWeek)\n } else {\n var date = new Date(0)\n if (\n !validateDate(year, month, day) ||\n !validateDayOfYearDate(year, dayOfYear)\n ) {\n return new Date(NaN)\n }\n date.setUTCFullYear(year, month, Math.max(dayOfYear, day))\n return date\n }\n}\n\nfunction parseDateUnit(value) {\n return value ? parseInt(value) : 1\n}\n\nfunction parseTime(timeString) {\n var captures = timeString.match(timeRegex)\n if (!captures) return null // Invalid ISO-formatted time\n\n var hours = parseTimeUnit(captures[1])\n var minutes = parseTimeUnit(captures[2])\n var seconds = parseTimeUnit(captures[3])\n\n if (!validateTime(hours, minutes, seconds)) {\n return NaN\n }\n\n return (\n (hours % 24) * MILLISECONDS_IN_HOUR +\n minutes * MILLISECONDS_IN_MINUTE +\n seconds * 1000\n )\n}\n\nfunction parseTimeUnit(value) {\n return (value && parseFloat(value.replace(',', '.'))) || 0\n}\n\nfunction parseTimezone(timezoneString) {\n if (timezoneString === 'Z') return 0\n\n var captures = timezoneString.match(timezoneRegex)\n if (!captures) return 0\n\n var sign = captures[1] === '+' ? -1 : 1\n var hours = parseInt(captures[2])\n var minutes = (captures[3] && parseInt(captures[3])) || 0\n\n if (!validateTimezone(hours, minutes)) {\n return NaN\n }\n\n return (\n sign * (hours * MILLISECONDS_IN_HOUR + minutes * MILLISECONDS_IN_MINUTE)\n )\n}\n\nfunction dayOfISOWeekYear(isoWeekYear, week, day) {\n var date = new Date(0)\n date.setUTCFullYear(isoWeekYear, 0, 4)\n var fourthOfJanuaryDay = date.getUTCDay() || 7\n var diff = (week || 0) * 7 + (day || 0) + 1 - fourthOfJanuaryDay\n date.setUTCDate(date.getUTCDate() + diff)\n return date\n}\n\n// Validation functions\n\n// February is null to handle the leap year (using ||)\nvar daysInMonths = [31, null, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]\n\nfunction isLeapYearIndex(year) {\n return year % 400 === 0 || (year % 4 === 0 && year % 100)\n}\n\nfunction validateDate(year, month, date) {\n return !(\n month < 0 ||\n month > 11 ||\n date < 1 ||\n date > (daysInMonths[month] || (isLeapYearIndex(year) ? 29 : 28))\n )\n}\n\nfunction validateDayOfYearDate(year, dayOfYear) {\n return !(dayOfYear < 1 || dayOfYear > (isLeapYearIndex(year) ? 366 : 365))\n}\n\nfunction validateWeekDate(_year, week, day) {\n return !(week < 0 || week > 52 || day < 0 || day > 6)\n}\n\nfunction validateTime(hours, minutes, seconds) {\n return !(\n seconds < 0 ||\n seconds >= 60 ||\n minutes < 0 ||\n minutes >= 60 ||\n hours < 0 ||\n hours >= 25\n )\n}\n\nfunction validateTimezone(_hours, minutes) {\n return !(minutes < 0 || minutes > 59)\n}\n","import toDate from '../toDate/index.js'\nimport toInteger from '../_lib/toInteger/index.js'\n\n/**\n * @name roundToNearestMinutes\n * @category Minute Helpers\n * @summary Rounds the given date to the nearest minute\n *\n * @description\n * Rounds the given date to the nearest minute\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} date - the date to round\n * @param {Object} [options] - an object with options.\n * @param {Number} [options.nearestTo=1] - passed to `toDate`. See [toDate]{@link https://date-fns.org/docs/toDate}\n * @returns {Date} the new date rounded to the closest minute\n * @throws {TypeError} 1 argument required\n * @throws {RangeError} `options.nearestTo` must be between 1 and 30\n *\n * @example\n * // Round 10 July 2014 12:12:34 to nearest minute:\n * var result = roundToNearestMinutes(new Date(2014, 6, 10, 12, 12, 34))\n * //=> Thu Jul 10 2014 12:13:00\n */\nexport default function roundToNearestMinutes(dirtyDate, options) {\n if (arguments.length < 1) {\n throw new TypeError('1 argument required, but only none provided present')\n }\n\n var nearestTo =\n options && 'nearestTo' in options ? toInteger(options.nearestTo) : 1\n\n if (nearestTo < 1 || nearestTo > 30) {\n throw new RangeError('`options.nearestTo` must be between 1 and 30')\n }\n\n var date = toDate(dirtyDate)\n var seconds = date.getSeconds() // relevant if nearestTo is 1, which is the default case\n var minutes = date.getMinutes() + seconds / 60\n var roundedMinutes = Math.floor(minutes / nearestTo) * nearestTo\n var remainderMinutes = minutes % nearestTo\n var addedMinutes = Math.round(remainderMinutes / nearestTo) * nearestTo\n\n return new Date(\n date.getFullYear(),\n date.getMonth(),\n date.getDate(),\n date.getHours(),\n roundedMinutes + addedMinutes\n )\n}\n","import toInteger from '../_lib/toInteger/index.js'\nimport toDate from '../toDate/index.js'\n\n/**\n * @name setDate\n * @category Day Helpers\n * @summary Set the day of the month to the given date.\n *\n * @description\n * Set the day of the month to the given date.\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} date - the date to be changed\n * @param {Number} dayOfMonth - the day of the month of the new date\n * @returns {Date} the new date with the day of the month set\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Set the 30th day of the month to 1 September 2014:\n * var result = setDate(new Date(2014, 8, 1), 30)\n * //=> Tue Sep 30 2014 00:00:00\n */\nexport default function setDate(dirtyDate, dirtyDayOfMonth) {\n if (arguments.length < 2) {\n throw new TypeError(\n '2 arguments required, but only ' + arguments.length + ' present'\n )\n }\n\n var date = toDate(dirtyDate)\n var dayOfMonth = toInteger(dirtyDayOfMonth)\n date.setDate(dayOfMonth)\n return date\n}\n","import toInteger from '../_lib/toInteger/index.js'\nimport toDate from '../toDate/index.js'\nimport addDays from '../addDays/index.js'\n\n/**\n * @name setDay\n * @category Weekday Helpers\n * @summary Set the day of the week to the given date.\n *\n * @description\n * Set the day of the week to the given date.\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} date - the date to be changed\n * @param {Number} day - the day of the week of the new date\n * @param {Object} [options] - an object with options.\n * @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)\n * @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale}\n * @returns {Date} the new date with the day of the week set\n * @throws {TypeError} 2 arguments required\n * @throws {RangeError} `options.weekStartsOn` must be between 0 and 6\n *\n * @example\n * // Set Sunday to 1 September 2014:\n * var result = setDay(new Date(2014, 8, 1), 0)\n * //=> Sun Aug 31 2014 00:00:00\n *\n * @example\n * // If week starts with Monday, set Sunday to 1 September 2014:\n * var result = setDay(new Date(2014, 8, 1), 0, { weekStartsOn: 1 })\n * //=> Sun Sep 07 2014 00:00:00\n */\nexport default function setDay(dirtyDate, dirtyDay, dirtyOptions) {\n if (arguments.length < 2) {\n throw new TypeError(\n '2 arguments required, but only ' + arguments.length + ' present'\n )\n }\n\n var options = dirtyOptions || {}\n var locale = options.locale\n var localeWeekStartsOn =\n locale && locale.options && locale.options.weekStartsOn\n var defaultWeekStartsOn =\n localeWeekStartsOn == null ? 0 : toInteger(localeWeekStartsOn)\n var weekStartsOn =\n options.weekStartsOn == null\n ? defaultWeekStartsOn\n : toInteger(options.weekStartsOn)\n\n // Test if weekStartsOn is between 0 and 6 _and_ is not NaN\n if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {\n throw new RangeError('weekStartsOn must be between 0 and 6 inclusively')\n }\n\n var date = toDate(dirtyDate, options)\n var day = toInteger(dirtyDay)\n var currentDay = date.getDay()\n\n var remainder = day % 7\n var dayIndex = (remainder + 7) % 7\n\n var diff = (dayIndex < weekStartsOn ? 7 : 0) + day - currentDay\n return addDays(date, diff, options)\n}\n","import toInteger from '../_lib/toInteger/index.js'\nimport toDate from '../toDate/index.js'\n\n/**\n * @name setDayOfYear\n * @category Day Helpers\n * @summary Set the day of the year to the given date.\n *\n * @description\n * Set the day of the year to the given date.\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} date - the date to be changed\n * @param {Number} dayOfYear - the day of the year of the new date\n * @returns {Date} the new date with the day of the year set\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Set the 2nd day of the year to 2 July 2014:\n * var result = setDayOfYear(new Date(2014, 6, 2), 2)\n * //=> Thu Jan 02 2014 00:00:00\n */\nexport default function setDayOfYear(dirtyDate, dirtyDayOfYear) {\n if (arguments.length < 2) {\n throw new TypeError(\n '2 arguments required, but only ' + arguments.length + ' present'\n )\n }\n\n var date = toDate(dirtyDate)\n var dayOfYear = toInteger(dirtyDayOfYear)\n date.setMonth(0)\n date.setDate(dayOfYear)\n return date\n}\n","import toInteger from '../_lib/toInteger/index.js'\nimport toDate from '../toDate/index.js'\n\n/**\n * @name setHours\n * @category Hour Helpers\n * @summary Set the hours to the given date.\n *\n * @description\n * Set the hours to the given date.\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} date - the date to be changed\n * @param {Number} hours - the hours of the new date\n * @returns {Date} the new date with the hours set\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Set 4 hours to 1 September 2014 11:30:00:\n * var result = setHours(new Date(2014, 8, 1, 11, 30), 4)\n * //=> Mon Sep 01 2014 04:30:00\n */\nexport default function setHours(dirtyDate, dirtyHours) {\n if (arguments.length < 2) {\n throw new TypeError(\n '2 arguments required, but only ' + arguments.length + ' present'\n )\n }\n\n var date = toDate(dirtyDate)\n var hours = toInteger(dirtyHours)\n date.setHours(hours)\n return date\n}\n","import toInteger from '../_lib/toInteger/index.js'\nimport toDate from '../toDate/index.js'\nimport addDays from '../addDays/index.js'\nimport getISODay from '../getISODay/index.js'\n\n/**\n * @name setISODay\n * @category Weekday Helpers\n * @summary Set the day of the ISO week to the given date.\n *\n * @description\n * Set the day of the ISO week to the given date.\n * ISO week starts with Monday.\n * 7 is the index of Sunday, 1 is the index of Monday etc.\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} date - the date to be changed\n * @param {Number} day - the day of the ISO week of the new date\n * @returns {Date} the new date with the day of the ISO week set\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Set Sunday to 1 September 2014:\n * var result = setISODay(new Date(2014, 8, 1), 7)\n * //=> Sun Sep 07 2014 00:00:00\n */\nexport default function setISODay(dirtyDate, dirtyDay) {\n if (arguments.length < 2) {\n throw new TypeError(\n '2 arguments required, but only ' + arguments.length + ' present'\n )\n }\n\n var date = toDate(dirtyDate)\n var day = toInteger(dirtyDay)\n var currentDay = getISODay(date)\n var diff = day - currentDay\n return addDays(date, diff)\n}\n","import toInteger from '../_lib/toInteger/index.js'\nimport toDate from '../toDate/index.js'\nimport getISOWeek from '../getISOWeek/index.js'\n\n/**\n * @name setISOWeek\n * @category ISO Week Helpers\n * @summary Set the ISO week to the given date.\n *\n * @description\n * Set the ISO week to the given date, saving the weekday number.\n *\n * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} date - the date to be changed\n * @param {Number} isoWeek - the ISO week of the new date\n * @returns {Date} the new date with the ISO week set\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Set the 53rd ISO week to 7 August 2004:\n * var result = setISOWeek(new Date(2004, 7, 7), 53)\n * //=> Sat Jan 01 2005 00:00:00\n */\nexport default function setISOWeek(dirtyDate, dirtyISOWeek) {\n if (arguments.length < 2) {\n throw new TypeError(\n '2 arguments required, but only ' + arguments.length + ' present'\n )\n }\n\n var date = toDate(dirtyDate)\n var isoWeek = toInteger(dirtyISOWeek)\n var diff = getISOWeek(date) - isoWeek\n date.setDate(date.getDate() - diff * 7)\n return date\n}\n","import toInteger from '../_lib/toInteger/index.js'\nimport toDate from '../toDate/index.js'\nimport startOfISOWeekYear from '../startOfISOWeekYear/index.js'\nimport differenceInCalendarDays from '../differenceInCalendarDays/index.js'\n\n/**\n * @name setISOWeekYear\n * @category ISO Week-Numbering Year Helpers\n * @summary Set the ISO week-numbering year to the given date.\n *\n * @description\n * Set the ISO week-numbering year to the given date,\n * saving the week number and the weekday number.\n *\n * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * - The function was renamed from `setISOYear` to `setISOWeekYear`.\n * \"ISO week year\" is short for [ISO week-numbering year](https://en.wikipedia.org/wiki/ISO_week_date).\n * This change makes the name consistent with\n * locale-dependent week-numbering year helpers, e.g., `setWeekYear`.\n *\n * @param {Date|Number} date - the date to be changed\n * @param {Number} isoWeekYear - the ISO week-numbering year of the new date\n * @returns {Date} the new date with the ISO week-numbering year set\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Set ISO week-numbering year 2007 to 29 December 2008:\n * var result = setISOWeekYear(new Date(2008, 11, 29), 2007)\n * //=> Mon Jan 01 2007 00:00:00\n */\nexport default function setISOWeekYear(dirtyDate, dirtyISOWeekYear) {\n if (arguments.length < 2) {\n throw new TypeError(\n '2 arguments required, but only ' + arguments.length + ' present'\n )\n }\n\n var date = toDate(dirtyDate)\n var isoWeekYear = toInteger(dirtyISOWeekYear)\n var diff = differenceInCalendarDays(date, startOfISOWeekYear(date))\n var fourthOfJanuary = new Date(0)\n fourthOfJanuary.setFullYear(isoWeekYear, 0, 4)\n fourthOfJanuary.setHours(0, 0, 0, 0)\n date = startOfISOWeekYear(fourthOfJanuary)\n date.setDate(date.getDate() + diff)\n return date\n}\n","import toInteger from '../_lib/toInteger/index.js'\nimport toDate from '../toDate/index.js'\n\n/**\n * @name setMilliseconds\n * @category Millisecond Helpers\n * @summary Set the milliseconds to the given date.\n *\n * @description\n * Set the milliseconds to the given date.\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} date - the date to be changed\n * @param {Number} milliseconds - the milliseconds of the new date\n * @returns {Date} the new date with the milliseconds set\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Set 300 milliseconds to 1 September 2014 11:30:40.500:\n * var result = setMilliseconds(new Date(2014, 8, 1, 11, 30, 40, 500), 300)\n * //=> Mon Sep 01 2014 11:30:40.300\n */\nexport default function setMilliseconds(dirtyDate, dirtyMilliseconds) {\n if (arguments.length < 2) {\n throw new TypeError(\n '2 arguments required, but only ' + arguments.length + ' present'\n )\n }\n\n var date = toDate(dirtyDate)\n var milliseconds = toInteger(dirtyMilliseconds)\n date.setMilliseconds(milliseconds)\n return date\n}\n","import toInteger from '../_lib/toInteger/index.js'\nimport toDate from '../toDate/index.js'\n\n/**\n * @name setMinutes\n * @category Minute Helpers\n * @summary Set the minutes to the given date.\n *\n * @description\n * Set the minutes to the given date.\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} date - the date to be changed\n * @param {Number} minutes - the minutes of the new date\n * @returns {Date} the new date with the minutes set\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Set 45 minutes to 1 September 2014 11:30:40:\n * var result = setMinutes(new Date(2014, 8, 1, 11, 30, 40), 45)\n * //=> Mon Sep 01 2014 11:45:40\n */\nexport default function setMinutes(dirtyDate, dirtyMinutes) {\n if (arguments.length < 2) {\n throw new TypeError(\n '2 arguments required, but only ' + arguments.length + ' present'\n )\n }\n\n var date = toDate(dirtyDate)\n var minutes = toInteger(dirtyMinutes)\n date.setMinutes(minutes)\n return date\n}\n","import toInteger from '../_lib/toInteger/index.js'\nimport toDate from '../toDate/index.js'\nimport getDaysInMonth from '../getDaysInMonth/index.js'\n\n/**\n * @name setMonth\n * @category Month Helpers\n * @summary Set the month to the given date.\n *\n * @description\n * Set the month to the given date.\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} date - the date to be changed\n * @param {Number} month - the month of the new date\n * @returns {Date} the new date with the month set\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Set February to 1 September 2014:\n * var result = setMonth(new Date(2014, 8, 1), 1)\n * //=> Sat Feb 01 2014 00:00:00\n */\nexport default function setMonth(dirtyDate, dirtyMonth) {\n if (arguments.length < 2) {\n throw new TypeError(\n '2 arguments required, but only ' + arguments.length + ' present'\n )\n }\n\n var date = toDate(dirtyDate)\n var month = toInteger(dirtyMonth)\n var year = date.getFullYear()\n var day = date.getDate()\n\n var dateWithDesiredMonth = new Date(0)\n dateWithDesiredMonth.setFullYear(year, month, 15)\n dateWithDesiredMonth.setHours(0, 0, 0, 0)\n var daysInMonth = getDaysInMonth(dateWithDesiredMonth)\n // Set the last day of the new month\n // if the original date was the last day of the longer month\n date.setMonth(month, Math.min(day, daysInMonth))\n return date\n}\n","import toInteger from '../_lib/toInteger/index.js'\nimport toDate from '../toDate/index.js'\nimport setMonth from '../setMonth/index.js'\n\n/**\n * @name setQuarter\n * @category Quarter Helpers\n * @summary Set the year quarter to the given date.\n *\n * @description\n * Set the year quarter to the given date.\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} date - the date to be changed\n * @param {Number} quarter - the quarter of the new date\n * @returns {Date} the new date with the quarter set\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Set the 2nd quarter to 2 July 2014:\n * var result = setQuarter(new Date(2014, 6, 2), 2)\n * //=> Wed Apr 02 2014 00:00:00\n */\nexport default function setQuarter(dirtyDate, dirtyQuarter) {\n if (arguments.length < 2) {\n throw new TypeError(\n '2 arguments required, but only ' + arguments.length + ' present'\n )\n }\n\n var date = toDate(dirtyDate)\n var quarter = toInteger(dirtyQuarter)\n var oldQuarter = Math.floor(date.getMonth() / 3) + 1\n var diff = quarter - oldQuarter\n return setMonth(date, date.getMonth() + diff * 3)\n}\n","import toInteger from '../_lib/toInteger/index.js'\nimport toDate from '../toDate/index.js'\n\n/**\n * @name setSeconds\n * @category Second Helpers\n * @summary Set the seconds to the given date.\n *\n * @description\n * Set the seconds to the given date.\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} date - the date to be changed\n * @param {Number} seconds - the seconds of the new date\n * @returns {Date} the new date with the seconds set\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Set 45 seconds to 1 September 2014 11:30:40:\n * var result = setSeconds(new Date(2014, 8, 1, 11, 30, 40), 45)\n * //=> Mon Sep 01 2014 11:30:45\n */\nexport default function setSeconds(dirtyDate, dirtySeconds) {\n if (arguments.length < 2) {\n throw new TypeError(\n '2 arguments required, but only ' + arguments.length + ' present'\n )\n }\n\n var date = toDate(dirtyDate)\n var seconds = toInteger(dirtySeconds)\n date.setSeconds(seconds)\n return date\n}\n","import toInteger from '../_lib/toInteger/index.js'\nimport toDate from '../toDate/index.js'\nimport getWeek from '../getWeek/index.js'\n\n/**\n * @name setWeek\n * @category Week Helpers\n * @summary Set the local week to the given date.\n *\n * @description\n * Set the local week to the given date, saving the weekday number.\n * The exact calculation depends on the values of\n * `options.weekStartsOn` (which is the index of the first day of the week)\n * and `options.firstWeekContainsDate` (which is the day of January, which is always in\n * the first week of the week-numbering year)\n *\n * Week numbering: https://en.wikipedia.org/wiki/Week#Week_numbering\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} date - the date to be changed\n * @param {Number} week - the week of the new date\n * @param {Object} [options] - an object with options.\n * @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)\n * @param {1|2|3|4|5|6|7} [options.firstWeekContainsDate=1] - the day of January, which is always in the first week of the year\n * @returns {Date} the new date with the local week set\n * @throws {TypeError} 2 arguments required\n * @throws {RangeError} `options.weekStartsOn` must be between 0 and 6\n * @throws {RangeError} `options.firstWeekContainsDate` must be between 1 and 7\n *\n * @example\n * // Set the 1st week to 2 January 2005 with default options:\n * var result = setWeek(new Date(2005, 0, 2), 1)\n * //=> Sun Dec 26 2004 00:00:00\n *\n * @example\n * // Set the 1st week to 2 January 2005,\n * // if Monday is the first day of the week,\n * // and the first week of the year always contains 4 January:\n * var result = setWeek(new Date(2005, 0, 2), 1, {\n * weekStartsOn: 1,\n * firstWeekContainsDate: 4\n * })\n * //=> Sun Jan 4 2004 00:00:00\n */\nexport default function setWeek(dirtyDate, dirtyWeek, dirtyOptions) {\n if (arguments.length < 2) {\n throw new TypeError(\n '2 arguments required, but only ' + arguments.length + ' present'\n )\n }\n\n var date = toDate(dirtyDate)\n var week = toInteger(dirtyWeek)\n var diff = getWeek(date, dirtyOptions) - week\n date.setDate(date.getDate() - diff * 7)\n return date\n}\n","import toInteger from '../_lib/toInteger/index.js'\nimport toDate from '../toDate/index.js'\nimport startOfWeekYear from '../startOfWeekYear/index.js'\nimport differenceInCalendarDays from '../differenceInCalendarDays/index.js'\n\n/**\n * @name setWeekYear\n * @category Week-Numbering Year Helpers\n * @summary Set the local week-numbering year to the given date.\n *\n * @description\n * Set the local week-numbering year to the given date,\n * saving the week number and the weekday number.\n * The exact calculation depends on the values of\n * `options.weekStartsOn` (which is the index of the first day of the week)\n * and `options.firstWeekContainsDate` (which is the day of January, which is always in\n * the first week of the week-numbering year)\n *\n * Week numbering: https://en.wikipedia.org/wiki/Week#Week_numbering\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} date - the date to be changed\n * @param {Number} weekYear - the local week-numbering year of the new date\n * @param {Object} [options] - an object with options.\n * @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)\n * @param {1|2|3|4|5|6|7} [options.firstWeekContainsDate=1] - the day of January, which is always in the first week of the year\n * @returns {Date} the new date with the local week-numbering year set\n * @throws {TypeError} 2 arguments required\n * @throws {RangeError} `options.weekStartsOn` must be between 0 and 6\n * @throws {RangeError} `options.firstWeekContainsDate` must be between 1 and 7\n *\n * @example\n * // Set the local week-numbering year 2004 to 2 January 2010 with default options:\n * var result = setWeekYear(new Date(2010, 0, 2), 2004)\n * //=> Sat Jan 03 2004 00:00:00\n *\n * @example\n * // Set the local week-numbering year 2004 to 2 January 2010,\n * // if Monday is the first day of week\n * // and 4 January is always in the first week of the year:\n * var result = setWeekYear(new Date(2010, 0, 2), 2004, {\n * weekStartsOn: 1,\n * firstWeekContainsDate: 4\n * })\n * //=> Sat Jan 01 2005 00:00:00\n */\nexport default function setWeekYear(dirtyDate, dirtyWeekYear, dirtyOptions) {\n if (arguments.length < 2) {\n throw new TypeError(\n '2 arguments required, but only ' + arguments.length + ' present'\n )\n }\n\n var options = dirtyOptions || {}\n var locale = options.locale\n var localeFirstWeekContainsDate =\n locale && locale.options && locale.options.firstWeekContainsDate\n var defaultFirstWeekContainsDate =\n localeFirstWeekContainsDate == null\n ? 1\n : toInteger(localeFirstWeekContainsDate)\n var firstWeekContainsDate =\n options.firstWeekContainsDate == null\n ? defaultFirstWeekContainsDate\n : toInteger(options.firstWeekContainsDate)\n\n var date = toDate(dirtyDate)\n var weekYear = toInteger(dirtyWeekYear)\n var diff = differenceInCalendarDays(date, startOfWeekYear(date, dirtyOptions))\n var firstWeek = new Date(0)\n firstWeek.setFullYear(weekYear, 0, firstWeekContainsDate)\n firstWeek.setHours(0, 0, 0, 0)\n date = startOfWeekYear(firstWeek, dirtyOptions)\n date.setDate(date.getDate() + diff)\n return date\n}\n","import toInteger from '../_lib/toInteger/index.js'\nimport toDate from '../toDate/index.js'\n\n/**\n * @name setYear\n * @category Year Helpers\n * @summary Set the year to the given date.\n *\n * @description\n * Set the year to the given date.\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} date - the date to be changed\n * @param {Number} year - the year of the new date\n * @returns {Date} the new date with the year set\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Set year 2013 to 1 September 2014:\n * var result = setYear(new Date(2014, 8, 1), 2013)\n * //=> Sun Sep 01 2013 00:00:00\n */\nexport default function setYear(dirtyDate, dirtyYear) {\n if (arguments.length < 2) {\n throw new TypeError(\n '2 arguments required, but only ' + arguments.length + ' present'\n )\n }\n\n var date = toDate(dirtyDate)\n var year = toInteger(dirtyYear)\n\n // Check if date is Invalid Date because Date.prototype.setFullYear ignores the value of Invalid Date\n if (isNaN(date)) {\n return new Date(NaN)\n }\n\n date.setFullYear(year)\n return date\n}\n","import toDate from '../toDate/index.js'\n\n/**\n * @name startOfDay\n * @category Day Helpers\n * @summary Return the start of a day for the given date.\n *\n * @description\n * Return the start of a day for the given date.\n * The result will be in the local timezone.\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} date - the original date\n * @returns {Date} the start of a day\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // The start of a day for 2 September 2014 11:55:00:\n * var result = startOfDay(new Date(2014, 8, 2, 11, 55, 0))\n * //=> Tue Sep 02 2014 00:00:00\n */\nexport default function startOfDay(dirtyDate) {\n if (arguments.length < 1) {\n throw new TypeError(\n '1 argument required, but only ' + arguments.length + ' present'\n )\n }\n\n var date = toDate(dirtyDate)\n date.setHours(0, 0, 0, 0)\n return date\n}\n","import toDate from '../toDate/index.js'\n\n/**\n * @name startOfDecade\n * @category Decade Helpers\n * @summary Return the start of a decade for the given date.\n *\n * @description\n * Return the start of a decade for the given date.\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} date - the original date\n * @returns {Date} the start of a decade\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // The start of a decade for 21 October 2015 00:00:00:\n * var result = startOfDecade(new Date(2015, 9, 21, 00, 00, 00))\n * //=> Jan 01 2010 00:00:00\n */\nexport default function startOfDecade(dirtyDate) {\n if (arguments.length < 1) {\n throw new TypeError(\n '1 argument required, but only ' + arguments.length + ' present'\n )\n }\n\n var date = toDate(dirtyDate)\n var year = date.getFullYear()\n var decade = Math.floor(year / 10) * 10\n date.setFullYear(decade, 0, 1)\n date.setHours(0, 0, 0, 0)\n return date\n}\n","import toDate from '../toDate/index.js'\n\n/**\n * @name startOfHour\n * @category Hour Helpers\n * @summary Return the start of an hour for the given date.\n *\n * @description\n * Return the start of an hour for the given date.\n * The result will be in the local timezone.\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} date - the original date\n * @returns {Date} the start of an hour\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // The start of an hour for 2 September 2014 11:55:00:\n * var result = startOfHour(new Date(2014, 8, 2, 11, 55))\n * //=> Tue Sep 02 2014 11:00:00\n */\nexport default function startOfHour(dirtyDate) {\n if (arguments.length < 1) {\n throw new TypeError(\n '1 argument required, but only ' + arguments.length + ' present'\n )\n }\n\n var date = toDate(dirtyDate)\n date.setMinutes(0, 0, 0)\n return date\n}\n","import startOfWeek from '../startOfWeek/index.js'\n\n/**\n * @name startOfISOWeek\n * @category ISO Week Helpers\n * @summary Return the start of an ISO week for the given date.\n *\n * @description\n * Return the start of an ISO week for the given date.\n * The result will be in the local timezone.\n *\n * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} date - the original date\n * @returns {Date} the start of an ISO week\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // The start of an ISO week for 2 September 2014 11:55:00:\n * var result = startOfISOWeek(new Date(2014, 8, 2, 11, 55, 0))\n * //=> Mon Sep 01 2014 00:00:00\n */\nexport default function startOfISOWeek(dirtyDate) {\n if (arguments.length < 1) {\n throw new TypeError(\n '1 argument required, but only ' + arguments.length + ' present'\n )\n }\n\n return startOfWeek(dirtyDate, { weekStartsOn: 1 })\n}\n","import getISOWeekYear from '../getISOWeekYear/index.js'\nimport startOfISOWeek from '../startOfISOWeek/index.js'\n\n/**\n * @name startOfISOWeekYear\n * @category ISO Week-Numbering Year Helpers\n * @summary Return the start of an ISO week-numbering year for the given date.\n *\n * @description\n * Return the start of an ISO week-numbering year,\n * which always starts 3 days before the year's first Thursday.\n * The result will be in the local timezone.\n *\n * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} date - the original date\n * @returns {Date} the start of an ISO week-numbering year\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // The start of an ISO week-numbering year for 2 July 2005:\n * var result = startOfISOWeekYear(new Date(2005, 6, 2))\n * //=> Mon Jan 03 2005 00:00:00\n */\nexport default function startOfISOWeekYear(dirtyDate) {\n if (arguments.length < 1) {\n throw new TypeError(\n '1 argument required, but only ' + arguments.length + ' present'\n )\n }\n\n var year = getISOWeekYear(dirtyDate)\n var fourthOfJanuary = new Date(0)\n fourthOfJanuary.setFullYear(year, 0, 4)\n fourthOfJanuary.setHours(0, 0, 0, 0)\n var date = startOfISOWeek(fourthOfJanuary)\n return date\n}\n","import toDate from '../toDate/index.js'\n\n/**\n * @name startOfMinute\n * @category Minute Helpers\n * @summary Return the start of a minute for the given date.\n *\n * @description\n * Return the start of a minute for the given date.\n * The result will be in the local timezone.\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} date - the original date\n * @returns {Date} the start of a minute\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // The start of a minute for 1 December 2014 22:15:45.400:\n * var result = startOfMinute(new Date(2014, 11, 1, 22, 15, 45, 400))\n * //=> Mon Dec 01 2014 22:15:00\n */\nexport default function startOfMinute(dirtyDate) {\n if (arguments.length < 1) {\n throw new TypeError(\n '1 argument required, but only ' + arguments.length + ' present'\n )\n }\n\n var date = toDate(dirtyDate)\n date.setSeconds(0, 0)\n return date\n}\n","import toDate from '../toDate/index.js'\n\n/**\n * @name startOfMonth\n * @category Month Helpers\n * @summary Return the start of a month for the given date.\n *\n * @description\n * Return the start of a month for the given date.\n * The result will be in the local timezone.\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} date - the original date\n * @returns {Date} the start of a month\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // The start of a month for 2 September 2014 11:55:00:\n * var result = startOfMonth(new Date(2014, 8, 2, 11, 55, 0))\n * //=> Mon Sep 01 2014 00:00:00\n */\nexport default function startOfMonth(dirtyDate) {\n if (arguments.length < 1) {\n throw new TypeError(\n '1 argument required, but only ' + arguments.length + ' present'\n )\n }\n\n var date = toDate(dirtyDate)\n date.setDate(1)\n date.setHours(0, 0, 0, 0)\n return date\n}\n","import toDate from '../toDate/index.js'\n\n/**\n * @name startOfQuarter\n * @category Quarter Helpers\n * @summary Return the start of a year quarter for the given date.\n *\n * @description\n * Return the start of a year quarter for the given date.\n * The result will be in the local timezone.\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} date - the original date\n * @returns {Date} the start of a quarter\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // The start of a quarter for 2 September 2014 11:55:00:\n * var result = startOfQuarter(new Date(2014, 8, 2, 11, 55, 0))\n * //=> Tue Jul 01 2014 00:00:00\n */\nexport default function startOfQuarter(dirtyDate) {\n if (arguments.length < 1) {\n throw new TypeError(\n '1 argument required, but only ' + arguments.length + ' present'\n )\n }\n\n var date = toDate(dirtyDate)\n var currentMonth = date.getMonth()\n var month = currentMonth - (currentMonth % 3)\n date.setMonth(month, 1)\n date.setHours(0, 0, 0, 0)\n return date\n}\n","import toDate from '../toDate/index.js'\n\n/**\n * @name startOfSecond\n * @category Second Helpers\n * @summary Return the start of a second for the given date.\n *\n * @description\n * Return the start of a second for the given date.\n * The result will be in the local timezone.\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} date - the original date\n * @returns {Date} the start of a second\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // The start of a second for 1 December 2014 22:15:45.400:\n * var result = startOfSecond(new Date(2014, 11, 1, 22, 15, 45, 400))\n * //=> Mon Dec 01 2014 22:15:45.000\n */\nexport default function startOfSecond(dirtyDate) {\n if (arguments.length < 1) {\n throw new TypeError(\n '1 argument required, but only ' + arguments.length + ' present'\n )\n }\n\n var date = toDate(dirtyDate)\n date.setMilliseconds(0)\n return date\n}\n","import toInteger from '../_lib/toInteger/index.js'\nimport toDate from '../toDate/index.js'\n\n/**\n * @name startOfWeek\n * @category Week Helpers\n * @summary Return the start of a week for the given date.\n *\n * @description\n * Return the start of a week for the given date.\n * The result will be in the local timezone.\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} date - the original date\n * @param {Object} [options] - an object with options.\n * @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)\n * @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale}\n * @returns {Date} the start of a week\n * @throws {TypeError} 1 argument required\n * @throws {RangeError} `options.weekStartsOn` must be between 0 and 6\n *\n * @example\n * // The start of a week for 2 September 2014 11:55:00:\n * var result = startOfWeek(new Date(2014, 8, 2, 11, 55, 0))\n * //=> Sun Aug 31 2014 00:00:00\n *\n * @example\n * // If the week starts on Monday, the start of the week for 2 September 2014 11:55:00:\n * var result = startOfWeek(new Date(2014, 8, 2, 11, 55, 0), { weekStartsOn: 1 })\n * //=> Mon Sep 01 2014 00:00:00\n */\nexport default function startOfWeek(dirtyDate, dirtyOptions) {\n if (arguments.length < 1) {\n throw new TypeError(\n '1 argument required, but only ' + arguments.length + ' present'\n )\n }\n\n var options = dirtyOptions || {}\n var locale = options.locale\n var localeWeekStartsOn =\n locale && locale.options && locale.options.weekStartsOn\n var defaultWeekStartsOn =\n localeWeekStartsOn == null ? 0 : toInteger(localeWeekStartsOn)\n var weekStartsOn =\n options.weekStartsOn == null\n ? defaultWeekStartsOn\n : toInteger(options.weekStartsOn)\n\n // Test if weekStartsOn is between 0 and 6 _and_ is not NaN\n if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {\n throw new RangeError('weekStartsOn must be between 0 and 6 inclusively')\n }\n\n var date = toDate(dirtyDate)\n var day = date.getDay()\n var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn\n\n date.setDate(date.getDate() - diff)\n date.setHours(0, 0, 0, 0)\n return date\n}\n","import toInteger from '../_lib/toInteger/index.js'\nimport getWeekYear from '../getWeekYear/index.js'\nimport startOfWeek from '../startOfWeek/index.js'\n\n/**\n * @name startOfWeekYear\n * @category Week-Numbering Year Helpers\n * @summary Return the start of a local week-numbering year for the given date.\n *\n * @description\n * Return the start of a local week-numbering year.\n * The exact calculation depends on the values of\n * `options.weekStartsOn` (which is the index of the first day of the week)\n * and `options.firstWeekContainsDate` (which is the day of January, which is always in\n * the first week of the week-numbering year)\n *\n * Week numbering: https://en.wikipedia.org/wiki/Week#Week_numbering\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} date - the original date\n * @param {Object} [options] - an object with options.\n * @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)\n * @param {1|2|3|4|5|6|7} [options.firstWeekContainsDate=1] - the day of January, which is always in the first week of the year\n * @returns {Date} the start of a week-numbering year\n * @throws {TypeError} 1 argument required\n * @throws {RangeError} `options.weekStartsOn` must be between 0 and 6\n * @throws {RangeError} `options.firstWeekContainsDate` must be between 1 and 7\n *\n * @example\n * // The start of an a week-numbering year for 2 July 2005 with default settings:\n * var result = startOfWeekYear(new Date(2005, 6, 2))\n * //=> Sun Dec 26 2004 00:00:00\n *\n * @example\n * // The start of a week-numbering year for 2 July 2005\n * // if Monday is the first day of week\n * // and 4 January is always in the first week of the year:\n * var result = startOfWeekYear(new Date(2005, 6, 2), {\n * weekStartsOn: 1,\n * firstWeekContainsDate: 4\n * })\n * //=> Mon Jan 03 2005 00:00:00\n */\nexport default function startOfWeekYear(dirtyDate, dirtyOptions) {\n if (arguments.length < 1) {\n throw new TypeError(\n '1 argument required, but only ' + arguments.length + ' present'\n )\n }\n\n var options = dirtyOptions || {}\n var locale = options.locale\n var localeFirstWeekContainsDate =\n locale && locale.options && locale.options.firstWeekContainsDate\n var defaultFirstWeekContainsDate =\n localeFirstWeekContainsDate == null\n ? 1\n : toInteger(localeFirstWeekContainsDate)\n var firstWeekContainsDate =\n options.firstWeekContainsDate == null\n ? defaultFirstWeekContainsDate\n : toInteger(options.firstWeekContainsDate)\n\n var year = getWeekYear(dirtyDate, dirtyOptions)\n var firstWeek = new Date(0)\n firstWeek.setFullYear(year, 0, firstWeekContainsDate)\n firstWeek.setHours(0, 0, 0, 0)\n var date = startOfWeek(firstWeek, dirtyOptions)\n return date\n}\n","import toDate from '../toDate/index.js'\n\n/**\n * @name startOfYear\n * @category Year Helpers\n * @summary Return the start of a year for the given date.\n *\n * @description\n * Return the start of a year for the given date.\n * The result will be in the local timezone.\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} date - the original date\n * @returns {Date} the start of a year\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // The start of a year for 2 September 2014 11:55:00:\n * var result = startOfYear(new Date(2014, 8, 2, 11, 55, 00))\n * //=> Wed Jan 01 2014 00:00:00\n */\nexport default function startOfYear(dirtyDate) {\n if (arguments.length < 1) {\n throw new TypeError(\n '1 argument required, but only ' + arguments.length + ' present'\n )\n }\n\n var cleanDate = toDate(dirtyDate)\n var date = new Date(0)\n date.setFullYear(cleanDate.getFullYear(), 0, 1)\n date.setHours(0, 0, 0, 0)\n return date\n}\n","import toInteger from '../_lib/toInteger/index.js'\nimport addDays from '../addDays/index.js'\n\n/**\n * @name subDays\n * @category Day Helpers\n * @summary Subtract the specified number of days from the given date.\n *\n * @description\n * Subtract the specified number of days from the given date.\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} date - the date to be changed\n * @param {Number} amount - the amount of days to be subtracted\n * @returns {Date} the new date with the days subtracted\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Subtract 10 days from 1 September 2014:\n * var result = subDays(new Date(2014, 8, 1), 10)\n * //=> Fri Aug 22 2014 00:00:00\n */\nexport default function subDays(dirtyDate, dirtyAmount) {\n if (arguments.length < 2) {\n throw new TypeError(\n '2 arguments required, but only ' + arguments.length + ' present'\n )\n }\n\n var amount = toInteger(dirtyAmount)\n return addDays(dirtyDate, -amount)\n}\n","import toInteger from '../_lib/toInteger/index.js'\nimport addHours from '../addHours/index.js'\n\n/**\n * @name subHours\n * @category Hour Helpers\n * @summary Subtract the specified number of hours from the given date.\n *\n * @description\n * Subtract the specified number of hours from the given date.\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} date - the date to be changed\n * @param {Number} amount - the amount of hours to be subtracted\n * @returns {Date} the new date with the hours subtracted\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Subtract 2 hours from 11 July 2014 01:00:00:\n * var result = subHours(new Date(2014, 6, 11, 1, 0), 2)\n * //=> Thu Jul 10 2014 23:00:00\n */\nexport default function subHours(dirtyDate, dirtyAmount) {\n if (arguments.length < 2) {\n throw new TypeError(\n '2 arguments required, but only ' + arguments.length + ' present'\n )\n }\n\n var amount = toInteger(dirtyAmount)\n return addHours(dirtyDate, -amount)\n}\n","import toInteger from '../_lib/toInteger/index.js'\nimport addISOWeekYears from '../addISOWeekYears/index.js'\n\n/**\n * @name subISOWeekYears\n * @category ISO Week-Numbering Year Helpers\n * @summary Subtract the specified number of ISO week-numbering years from the given date.\n *\n * @description\n * Subtract the specified number of ISO week-numbering years from the given date.\n *\n * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * - The function was renamed from `subISOYears` to `subISOWeekYears`.\n * \"ISO week year\" is short for [ISO week-numbering year](https://en.wikipedia.org/wiki/ISO_week_date).\n * This change makes the name consistent with\n * locale-dependent week-numbering year helpers, e.g., `setWeekYear`.\n *\n * @param {Date|Number} date - the date to be changed\n * @param {Number} amount - the amount of ISO week-numbering years to be subtracted\n * @returns {Date} the new date with the ISO week-numbering years subtracted\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Subtract 5 ISO week-numbering years from 1 September 2014:\n * var result = subISOWeekYears(new Date(2014, 8, 1), 5)\n * //=> Mon Aug 31 2009 00:00:00\n */\nexport default function subISOWeekYears(dirtyDate, dirtyAmount) {\n if (arguments.length < 2) {\n throw new TypeError(\n '2 arguments required, but only ' + arguments.length + ' present'\n )\n }\n\n var amount = toInteger(dirtyAmount)\n return addISOWeekYears(dirtyDate, -amount)\n}\n","import toInteger from '../_lib/toInteger/index.js'\nimport addMilliseconds from '../addMilliseconds/index.js'\n\n/**\n * @name subMilliseconds\n * @category Millisecond Helpers\n * @summary Subtract the specified number of milliseconds from the given date.\n *\n * @description\n * Subtract the specified number of milliseconds from the given date.\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} date - the date to be changed\n * @param {Number} amount - the amount of milliseconds to be subtracted\n * @returns {Date} the new date with the milliseconds subtracted\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Subtract 750 milliseconds from 10 July 2014 12:45:30.000:\n * var result = subMilliseconds(new Date(2014, 6, 10, 12, 45, 30, 0), 750)\n * //=> Thu Jul 10 2014 12:45:29.250\n */\nexport default function subMilliseconds(dirtyDate, dirtyAmount) {\n if (arguments.length < 2) {\n throw new TypeError(\n '2 arguments required, but only ' + arguments.length + ' present'\n )\n }\n\n var amount = toInteger(dirtyAmount)\n return addMilliseconds(dirtyDate, -amount)\n}\n","import toInteger from '../_lib/toInteger/index.js'\nimport addMinutes from '../addMinutes/index.js'\n\n/**\n * @name subMinutes\n * @category Minute Helpers\n * @summary Subtract the specified number of minutes from the given date.\n *\n * @description\n * Subtract the specified number of minutes from the given date.\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} date - the date to be changed\n * @param {Number} amount - the amount of minutes to be subtracted\n * @returns {Date} the new date with the minutes subtracted\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Subtract 30 minutes from 10 July 2014 12:00:00:\n * var result = subMinutes(new Date(2014, 6, 10, 12, 0), 30)\n * //=> Thu Jul 10 2014 11:30:00\n */\nexport default function subMinutes(dirtyDate, dirtyAmount) {\n if (arguments.length < 2) {\n throw new TypeError(\n '2 arguments required, but only ' + arguments.length + ' present'\n )\n }\n\n var amount = toInteger(dirtyAmount)\n return addMinutes(dirtyDate, -amount)\n}\n","import toInteger from '../_lib/toInteger/index.js'\nimport addMonths from '../addMonths/index.js'\n\n/**\n * @name subMonths\n * @category Month Helpers\n * @summary Subtract the specified number of months from the given date.\n *\n * @description\n * Subtract the specified number of months from the given date.\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} date - the date to be changed\n * @param {Number} amount - the amount of months to be subtracted\n * @returns {Date} the new date with the months subtracted\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Subtract 5 months from 1 February 2015:\n * var result = subMonths(new Date(2015, 1, 1), 5)\n * //=> Mon Sep 01 2014 00:00:00\n */\nexport default function subMonths(dirtyDate, dirtyAmount) {\n if (arguments.length < 2) {\n throw new TypeError(\n '2 arguments required, but only ' + arguments.length + ' present'\n )\n }\n\n var amount = toInteger(dirtyAmount)\n return addMonths(dirtyDate, -amount)\n}\n","import toInteger from '../_lib/toInteger/index.js'\nimport addQuarters from '../addQuarters/index.js'\n\n/**\n * @name subQuarters\n * @category Quarter Helpers\n * @summary Subtract the specified number of year quarters from the given date.\n *\n * @description\n * Subtract the specified number of year quarters from the given date.\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} date - the date to be changed\n * @param {Number} amount - the amount of quarters to be subtracted\n * @returns {Date} the new date with the quarters subtracted\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Subtract 3 quarters from 1 September 2014:\n * var result = subQuarters(new Date(2014, 8, 1), 3)\n * //=> Sun Dec 01 2013 00:00:00\n */\nexport default function subQuarters(dirtyDate, dirtyAmount) {\n if (arguments.length < 2) {\n throw new TypeError(\n '2 arguments required, but only ' + arguments.length + ' present'\n )\n }\n\n var amount = toInteger(dirtyAmount)\n return addQuarters(dirtyDate, -amount)\n}\n","import toInteger from '../_lib/toInteger/index.js'\nimport addSeconds from '../addSeconds/index.js'\n\n/**\n * @name subSeconds\n * @category Second Helpers\n * @summary Subtract the specified number of seconds from the given date.\n *\n * @description\n * Subtract the specified number of seconds from the given date.\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} date - the date to be changed\n * @param {Number} amount - the amount of seconds to be subtracted\n * @returns {Date} the new date with the seconds subtracted\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Subtract 30 seconds from 10 July 2014 12:45:00:\n * var result = subSeconds(new Date(2014, 6, 10, 12, 45, 0), 30)\n * //=> Thu Jul 10 2014 12:44:30\n */\nexport default function subSeconds(dirtyDate, dirtyAmount) {\n if (arguments.length < 2) {\n throw new TypeError(\n '2 arguments required, but only ' + arguments.length + ' present'\n )\n }\n\n var amount = toInteger(dirtyAmount)\n return addSeconds(dirtyDate, -amount)\n}\n","import toInteger from '../_lib/toInteger/index.js'\nimport addWeeks from '../addWeeks/index.js'\n\n/**\n * @name subWeeks\n * @category Week Helpers\n * @summary Subtract the specified number of weeks from the given date.\n *\n * @description\n * Subtract the specified number of weeks from the given date.\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} date - the date to be changed\n * @param {Number} amount - the amount of weeks to be subtracted\n * @returns {Date} the new date with the weeks subtracted\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Subtract 4 weeks from 1 September 2014:\n * var result = subWeeks(new Date(2014, 8, 1), 4)\n * //=> Mon Aug 04 2014 00:00:00\n */\nexport default function subWeeks(dirtyDate, dirtyAmount) {\n if (arguments.length < 2) {\n throw new TypeError(\n '2 arguments required, but only ' + arguments.length + ' present'\n )\n }\n\n var amount = toInteger(dirtyAmount)\n return addWeeks(dirtyDate, -amount)\n}\n","import toInteger from '../_lib/toInteger/index.js'\nimport addYears from '../addYears/index.js'\n\n/**\n * @name subYears\n * @category Year Helpers\n * @summary Subtract the specified number of years from the given date.\n *\n * @description\n * Subtract the specified number of years from the given date.\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} date - the date to be changed\n * @param {Number} amount - the amount of years to be subtracted\n * @returns {Date} the new date with the years subtracted\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Subtract 5 years from 1 September 2014:\n * var result = subYears(new Date(2014, 8, 1), 5)\n * //=> Tue Sep 01 2009 00:00:00\n */\nexport default function subYears(dirtyDate, dirtyAmount) {\n if (arguments.length < 2) {\n throw new TypeError(\n '2 arguments required, but only ' + arguments.length + ' present'\n )\n }\n\n var amount = toInteger(dirtyAmount)\n return addYears(dirtyDate, -amount)\n}\n","/**\n * @name toDate\n * @category Common Helpers\n * @summary Convert the given argument to an instance of Date.\n *\n * @description\n * Convert the given argument to an instance of Date.\n *\n * If the argument is an instance of Date, the function returns its clone.\n *\n * If the argument is a number, it is treated as a timestamp.\n *\n * If the argument is none of the above, the function returns Invalid Date.\n *\n * **Note**: *all* Date arguments passed to any *date-fns* function is processed by `toDate`.\n *\n * @param {Date|Number} argument - the value to convert\n * @returns {Date} the parsed date in the local time zone\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // Clone the date:\n * var result = toDate(new Date(2014, 1, 11, 11, 30, 30))\n * //=> Tue Feb 11 2014 11:30:30\n *\n * @example\n * // Convert the timestamp to date:\n * var result = toDate(1392098430000)\n * //=> Tue Feb 11 2014 11:30:30\n */\nexport default function toDate(argument) {\n if (arguments.length < 1) {\n throw new TypeError(\n '1 argument required, but only ' + arguments.length + ' present'\n )\n }\n\n var argStr = Object.prototype.toString.call(argument)\n\n // Clone the date\n if (\n argument instanceof Date ||\n (typeof argument === 'object' && argStr === '[object Date]')\n ) {\n // Prevent the date to lose the milliseconds when passed to new Date() in IE10\n return new Date(argument.getTime())\n } else if (typeof argument === 'number' || argStr === '[object Number]') {\n return new Date(argument)\n } else {\n if (\n (typeof argument === 'string' || argStr === '[object String]') &&\n typeof console !== 'undefined'\n ) {\n console.warn(\n \"Starting with v2.0.0-beta.1 date-fns doesn't accept strings as arguments. Please use `parseISO` to parse strings. See: https://git.io/fpAk2\"\n )\n console.warn(new Error().stack)\n }\n return new Date(NaN)\n }\n}\n","'use strict';\n\nvar objectKeys = require('object-keys');\nvar isArguments = require('is-arguments');\nvar is = require('object-is');\nvar isRegex = require('is-regex');\nvar flags = require('regexp.prototype.flags');\nvar isArray = require('isarray');\nvar isDate = require('is-date-object');\nvar whichBoxedPrimitive = require('which-boxed-primitive');\nvar GetIntrinsic = require('get-intrinsic');\nvar callBound = require('call-bind/callBound');\nvar whichCollection = require('which-collection');\nvar getIterator = require('es-get-iterator');\nvar getSideChannel = require('side-channel');\nvar whichTypedArray = require('which-typed-array');\nvar assign = require('object.assign');\n\nvar $getTime = callBound('Date.prototype.getTime');\nvar gPO = Object.getPrototypeOf;\nvar $objToString = callBound('Object.prototype.toString');\n\nvar $Set = GetIntrinsic('%Set%', true);\nvar $mapHas = callBound('Map.prototype.has', true);\nvar $mapGet = callBound('Map.prototype.get', true);\nvar $mapSize = callBound('Map.prototype.size', true);\nvar $setAdd = callBound('Set.prototype.add', true);\nvar $setDelete = callBound('Set.prototype.delete', true);\nvar $setHas = callBound('Set.prototype.has', true);\nvar $setSize = callBound('Set.prototype.size', true);\n\n// taken from https://github.com/browserify/commonjs-assert/blob/bba838e9ba9e28edf3127ce6974624208502f6bc/internal/util/comparisons.js#L401-L414\nfunction setHasEqualElement(set, val1, opts, channel) {\n var i = getIterator(set);\n var result;\n while ((result = i.next()) && !result.done) {\n if (internalDeepEqual(val1, result.value, opts, channel)) { // eslint-disable-line no-use-before-define\n // Remove the matching element to make sure we do not check that again.\n $setDelete(set, result.value);\n return true;\n }\n }\n\n return false;\n}\n\n// taken from https://github.com/browserify/commonjs-assert/blob/bba838e9ba9e28edf3127ce6974624208502f6bc/internal/util/comparisons.js#L416-L439\nfunction findLooseMatchingPrimitives(prim) {\n if (typeof prim === 'undefined') {\n return null;\n }\n if (typeof prim === 'object') { // Only pass in null as object!\n return void 0;\n }\n if (typeof prim === 'symbol') {\n return false;\n }\n if (typeof prim === 'string' || typeof prim === 'number') {\n // Loose equal entries exist only if the string is possible to convert to a regular number and not NaN.\n return +prim === +prim; // eslint-disable-line no-implicit-coercion\n }\n return true;\n}\n\n// taken from https://github.com/browserify/commonjs-assert/blob/bba838e9ba9e28edf3127ce6974624208502f6bc/internal/util/comparisons.js#L449-L460\nfunction mapMightHaveLoosePrim(a, b, prim, item, opts, channel) {\n var altValue = findLooseMatchingPrimitives(prim);\n if (altValue != null) {\n return altValue;\n }\n var curB = $mapGet(b, altValue);\n var looseOpts = assign({}, opts, { strict: false });\n if (\n (typeof curB === 'undefined' && !$mapHas(b, altValue))\n // eslint-disable-next-line no-use-before-define\n || !internalDeepEqual(item, curB, looseOpts, channel)\n ) {\n return false;\n }\n // eslint-disable-next-line no-use-before-define\n return !$mapHas(a, altValue) && internalDeepEqual(item, curB, looseOpts, channel);\n}\n\n// taken from https://github.com/browserify/commonjs-assert/blob/bba838e9ba9e28edf3127ce6974624208502f6bc/internal/util/comparisons.js#L441-L447\nfunction setMightHaveLoosePrim(a, b, prim) {\n var altValue = findLooseMatchingPrimitives(prim);\n if (altValue != null) {\n return altValue;\n }\n\n return $setHas(b, altValue) && !$setHas(a, altValue);\n}\n\n// taken from https://github.com/browserify/commonjs-assert/blob/bba838e9ba9e28edf3127ce6974624208502f6bc/internal/util/comparisons.js#L518-L533\nfunction mapHasEqualEntry(set, map, key1, item1, opts, channel) {\n var i = getIterator(set);\n var result;\n var key2;\n while ((result = i.next()) && !result.done) {\n key2 = result.value;\n if (\n // eslint-disable-next-line no-use-before-define\n internalDeepEqual(key1, key2, opts, channel)\n // eslint-disable-next-line no-use-before-define\n && internalDeepEqual(item1, $mapGet(map, key2), opts, channel)\n ) {\n $setDelete(set, key2);\n return true;\n }\n }\n\n return false;\n}\n\nfunction internalDeepEqual(actual, expected, options, channel) {\n var opts = options || {};\n\n // 7.1. All identical values are equivalent, as determined by ===.\n if (opts.strict ? is(actual, expected) : actual === expected) {\n return true;\n }\n\n var actualBoxed = whichBoxedPrimitive(actual);\n var expectedBoxed = whichBoxedPrimitive(expected);\n if (actualBoxed !== expectedBoxed) {\n return false;\n }\n\n // 7.3. Other pairs that do not both pass typeof value == 'object', equivalence is determined by ==.\n if (!actual || !expected || (typeof actual !== 'object' && typeof expected !== 'object')) {\n return opts.strict ? is(actual, expected) : actual == expected; // eslint-disable-line eqeqeq\n }\n\n /*\n * 7.4. For all other Object pairs, including Array objects, equivalence is\n * determined by having the same number of owned properties (as verified\n * with Object.prototype.hasOwnProperty.call), the same set of keys\n * (although not necessarily the same order), equivalent values for every\n * corresponding key, and an identical 'prototype' property. Note: this\n * accounts for both named and indexed properties on Arrays.\n */\n // see https://github.com/nodejs/node/commit/d3aafd02efd3a403d646a3044adcf14e63a88d32 for memos/channel inspiration\n\n var hasActual = channel.has(actual);\n var hasExpected = channel.has(expected);\n var sentinel;\n if (hasActual && hasExpected) {\n if (channel.get(actual) === channel.get(expected)) {\n return true;\n }\n } else {\n sentinel = {};\n }\n if (!hasActual) { channel.set(actual, sentinel); }\n if (!hasExpected) { channel.set(expected, sentinel); }\n\n // eslint-disable-next-line no-use-before-define\n return objEquiv(actual, expected, opts, channel);\n}\n\nfunction isBuffer(x) {\n if (!x || typeof x !== 'object' || typeof x.length !== 'number') {\n return false;\n }\n if (typeof x.copy !== 'function' || typeof x.slice !== 'function') {\n return false;\n }\n if (x.length > 0 && typeof x[0] !== 'number') {\n return false;\n }\n\n return !!(x.constructor && x.constructor.isBuffer && x.constructor.isBuffer(x));\n}\n\nfunction setEquiv(a, b, opts, channel) {\n if ($setSize(a) !== $setSize(b)) {\n return false;\n }\n var iA = getIterator(a);\n var iB = getIterator(b);\n var resultA;\n var resultB;\n var set;\n while ((resultA = iA.next()) && !resultA.done) {\n if (resultA.value && typeof resultA.value === 'object') {\n if (!set) { set = new $Set(); }\n $setAdd(set, resultA.value);\n } else if (!$setHas(b, resultA.value)) {\n if (opts.strict) { return false; }\n if (!setMightHaveLoosePrim(a, b, resultA.value)) {\n return false;\n }\n if (!set) { set = new $Set(); }\n $setAdd(set, resultA.value);\n }\n }\n if (set) {\n while ((resultB = iB.next()) && !resultB.done) {\n // We have to check if a primitive value is already matching and only if it's not, go hunting for it.\n if (resultB.value && typeof resultB.value === 'object') {\n if (!setHasEqualElement(set, resultB.value, opts.strict, channel)) {\n return false;\n }\n } else if (\n !opts.strict\n && !$setHas(a, resultB.value)\n && !setHasEqualElement(set, resultB.value, opts.strict, channel)\n ) {\n return false;\n }\n }\n return $setSize(set) === 0;\n }\n return true;\n}\n\nfunction mapEquiv(a, b, opts, channel) {\n if ($mapSize(a) !== $mapSize(b)) {\n return false;\n }\n var iA = getIterator(a);\n var iB = getIterator(b);\n var resultA;\n var resultB;\n var set;\n var key;\n var item1;\n var item2;\n while ((resultA = iA.next()) && !resultA.done) {\n key = resultA.value[0];\n item1 = resultA.value[1];\n if (key && typeof key === 'object') {\n if (!set) { set = new $Set(); }\n $setAdd(set, key);\n } else {\n item2 = $mapGet(b, key);\n if ((typeof item2 === 'undefined' && !$mapHas(b, key)) || !internalDeepEqual(item1, item2, opts, channel)) {\n if (opts.strict) {\n return false;\n }\n if (!mapMightHaveLoosePrim(a, b, key, item1, opts, channel)) {\n return false;\n }\n if (!set) { set = new $Set(); }\n $setAdd(set, key);\n }\n }\n }\n\n if (set) {\n while ((resultB = iB.next()) && !resultB.done) {\n key = resultB.value[0];\n item2 = resultB.value[1];\n if (key && typeof key === 'object') {\n if (!mapHasEqualEntry(set, a, key, item2, opts, channel)) {\n return false;\n }\n } else if (\n !opts.strict\n && (!a.has(key) || !internalDeepEqual($mapGet(a, key), item2, opts, channel))\n && !mapHasEqualEntry(set, a, key, item2, assign({}, opts, { strict: false }), channel)\n ) {\n return false;\n }\n }\n return $setSize(set) === 0;\n }\n return true;\n}\n\nfunction objEquiv(a, b, opts, channel) {\n /* eslint max-statements: [2, 100], max-lines-per-function: [2, 120], max-depth: [2, 5] */\n var i, key;\n\n if (typeof a !== typeof b) { return false; }\n if (a == null || b == null) { return false; }\n\n if ($objToString(a) !== $objToString(b)) { return false; }\n\n if (isArguments(a) !== isArguments(b)) { return false; }\n\n var aIsArray = isArray(a);\n var bIsArray = isArray(b);\n if (aIsArray !== bIsArray) { return false; }\n\n // TODO: replace when a cross-realm brand check is available\n var aIsError = a instanceof Error;\n var bIsError = b instanceof Error;\n if (aIsError !== bIsError) { return false; }\n if (aIsError || bIsError) {\n if (a.name !== b.name || a.message !== b.message) { return false; }\n }\n\n var aIsRegex = isRegex(a);\n var bIsRegex = isRegex(b);\n if (aIsRegex !== bIsRegex) { return false; }\n if ((aIsRegex || bIsRegex) && (a.source !== b.source || flags(a) !== flags(b))) {\n return false;\n }\n\n var aIsDate = isDate(a);\n var bIsDate = isDate(b);\n if (aIsDate !== bIsDate) { return false; }\n if (aIsDate || bIsDate) { // && would work too, because both are true or both false here\n if ($getTime(a) !== $getTime(b)) { return false; }\n }\n if (opts.strict && gPO && gPO(a) !== gPO(b)) { return false; }\n\n if (whichTypedArray(a) !== whichTypedArray(b)) {\n return false;\n }\n\n var aIsBuffer = isBuffer(a);\n var bIsBuffer = isBuffer(b);\n if (aIsBuffer !== bIsBuffer) { return false; }\n if (aIsBuffer || bIsBuffer) { // && would work too, because both are true or both false here\n if (a.length !== b.length) { return false; }\n for (i = 0; i < a.length; i++) {\n if (a[i] !== b[i]) { return false; }\n }\n return true;\n }\n\n if (typeof a !== typeof b) { return false; }\n\n var ka = objectKeys(a);\n var kb = objectKeys(b);\n // having the same number of owned properties (keys incorporates hasOwnProperty)\n if (ka.length !== kb.length) { return false; }\n\n // the same set of keys (although not necessarily the same order),\n ka.sort();\n kb.sort();\n // ~~~cheap key test\n for (i = ka.length - 1; i >= 0; i--) {\n if (ka[i] != kb[i]) { return false; } // eslint-disable-line eqeqeq\n }\n\n // equivalent values for every corresponding key, and ~~~possibly expensive deep test\n for (i = ka.length - 1; i >= 0; i--) {\n key = ka[i];\n if (!internalDeepEqual(a[key], b[key], opts, channel)) { return false; }\n }\n\n var aCollection = whichCollection(a);\n var bCollection = whichCollection(b);\n if (aCollection !== bCollection) {\n return false;\n }\n if (aCollection === 'Set' || bCollection === 'Set') { // aCollection === bCollection\n return setEquiv(a, b, opts, channel);\n }\n if (aCollection === 'Map') { // aCollection === bCollection\n return mapEquiv(a, b, opts, channel);\n }\n\n return true;\n}\n\nmodule.exports = function deepEqual(a, b, opts) {\n return internalDeepEqual(a, b, opts, getSideChannel());\n};\n","var toString = {}.toString;\n\nmodule.exports = Array.isArray || function (arr) {\n return toString.call(arr) == '[object Array]';\n};\n","'use strict';\n\nvar keys = require('object-keys');\nvar hasSymbols = typeof Symbol === 'function' && typeof Symbol('foo') === 'symbol';\n\nvar toStr = Object.prototype.toString;\nvar concat = Array.prototype.concat;\nvar origDefineProperty = Object.defineProperty;\n\nvar isFunction = function (fn) {\n\treturn typeof fn === 'function' && toStr.call(fn) === '[object Function]';\n};\n\nvar arePropertyDescriptorsSupported = function () {\n\tvar obj = {};\n\ttry {\n\t\torigDefineProperty(obj, 'x', { enumerable: false, value: obj });\n\t\t// eslint-disable-next-line no-unused-vars, no-restricted-syntax\n\t\tfor (var _ in obj) { // jscs:ignore disallowUnusedVariables\n\t\t\treturn false;\n\t\t}\n\t\treturn obj.x === obj;\n\t} catch (e) { /* this is IE 8. */\n\t\treturn false;\n\t}\n};\nvar supportsDescriptors = origDefineProperty && arePropertyDescriptorsSupported();\n\nvar defineProperty = function (object, name, value, predicate) {\n\tif (name in object && (!isFunction(predicate) || !predicate())) {\n\t\treturn;\n\t}\n\tif (supportsDescriptors) {\n\t\torigDefineProperty(object, name, {\n\t\t\tconfigurable: true,\n\t\t\tenumerable: false,\n\t\t\tvalue: value,\n\t\t\twritable: true\n\t\t});\n\t} else {\n\t\tobject[name] = value;\n\t}\n};\n\nvar defineProperties = function (object, map) {\n\tvar predicates = arguments.length > 2 ? arguments[2] : {};\n\tvar props = keys(map);\n\tif (hasSymbols) {\n\t\tprops = concat.call(props, Object.getOwnPropertySymbols(map));\n\t}\n\tfor (var i = 0; i < props.length; i += 1) {\n\t\tdefineProperty(object, props[i], map[props[i]], predicates[props[i]]);\n\t}\n};\n\ndefineProperties.supportsDescriptors = !!supportsDescriptors;\n\nmodule.exports = defineProperties;\n","'use strict';\n\nvar GetIntrinsic = require('get-intrinsic');\n\nvar $gOPD = GetIntrinsic('%Object.getOwnPropertyDescriptor%', true);\nif ($gOPD) {\n\ttry {\n\t\t$gOPD([], 'length');\n\t} catch (e) {\n\t\t// IE 8 has a broken gOPD\n\t\t$gOPD = null;\n\t}\n}\n\nmodule.exports = $gOPD;\n","'use strict';\n\n/* eslint global-require: 0 */\n// the code is structured this way so that bundlers can\n// alias out `has-symbols` to `() => true` or `() => false` if your target\n// environments' Symbol capabilities are known, and then use\n// dead code elimination on the rest of this module.\n//\n// Similarly, `isarray` can be aliased to `Array.isArray` if\n// available in all target environments.\n\nvar isArguments = require('is-arguments');\n\nif (require('has-symbols')() || require('has-symbols/shams')()) {\n\tvar $iterator = Symbol.iterator;\n\t// Symbol is available natively or shammed\n\t// natively:\n\t// - Chrome >= 38\n\t// - Edge 12-14?, Edge >= 15 for sure\n\t// - FF >= 36\n\t// - Safari >= 9\n\t// - node >= 0.12\n\tmodule.exports = function getIterator(iterable) {\n\t\t// alternatively, `iterable[$iterator]?.()`\n\t\tif (iterable != null && typeof iterable[$iterator] !== 'undefined') {\n\t\t\treturn iterable[$iterator]();\n\t\t}\n\t\tif (isArguments(iterable)) {\n\t\t\t// arguments objects lack Symbol.iterator\n\t\t\t// - node 0.12\n\t\t\treturn Array.prototype[$iterator].call(iterable);\n\t\t}\n\t};\n} else {\n\t// Symbol is not available, native or shammed\n\tvar isArray = require('isarray');\n\tvar isString = require('is-string');\n\tvar GetIntrinsic = require('get-intrinsic');\n\tvar $Map = GetIntrinsic('%Map%', true);\n\tvar $Set = GetIntrinsic('%Set%', true);\n\tvar callBound = require('call-bind/callBound');\n\tvar $arrayPush = callBound('Array.prototype.push');\n\tvar $charCodeAt = callBound('String.prototype.charCodeAt');\n\tvar $stringSlice = callBound('String.prototype.slice');\n\n\tvar advanceStringIndex = function advanceStringIndex(S, index) {\n\t\tvar length = S.length;\n\t\tif ((index + 1) >= length) {\n\t\t\treturn index + 1;\n\t\t}\n\n\t\tvar first = $charCodeAt(S, index);\n\t\tif (first < 0xD800 || first > 0xDBFF) {\n\t\t\treturn index + 1;\n\t\t}\n\n\t\tvar second = $charCodeAt(S, index + 1);\n\t\tif (second < 0xDC00 || second > 0xDFFF) {\n\t\t\treturn index + 1;\n\t\t}\n\n\t\treturn index + 2;\n\t};\n\n\tvar getArrayIterator = function getArrayIterator(arraylike) {\n\t\tvar i = 0;\n\t\treturn {\n\t\t\tnext: function next() {\n\t\t\t\tvar done = i >= arraylike.length;\n\t\t\t\tvar value;\n\t\t\t\tif (!done) {\n\t\t\t\t\tvalue = arraylike[i];\n\t\t\t\t\ti += 1;\n\t\t\t\t}\n\t\t\t\treturn {\n\t\t\t\t\tdone: done,\n\t\t\t\t\tvalue: value\n\t\t\t\t};\n\t\t\t}\n\t\t};\n\t};\n\n\tvar getNonCollectionIterator = function getNonCollectionIterator(iterable, noPrimordialCollections) {\n\t\tif (isArray(iterable) || isArguments(iterable)) {\n\t\t\treturn getArrayIterator(iterable);\n\t\t}\n\t\tif (isString(iterable)) {\n\t\t\tvar i = 0;\n\t\t\treturn {\n\t\t\t\tnext: function next() {\n\t\t\t\t\tvar nextIndex = advanceStringIndex(iterable, i);\n\t\t\t\t\tvar value = $stringSlice(iterable, i, nextIndex);\n\t\t\t\t\ti = nextIndex;\n\t\t\t\t\treturn {\n\t\t\t\t\t\tdone: nextIndex > iterable.length,\n\t\t\t\t\t\tvalue: value\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t};\n\t\t}\n\n\t\t// es6-shim and es-shims' es-map use a string \"_es6-shim iterator_\" property on different iterables, such as MapIterator.\n\t\tif (noPrimordialCollections && typeof iterable['_es6-shim iterator_'] !== 'undefined') {\n\t\t\treturn iterable['_es6-shim iterator_']();\n\t\t}\n\t};\n\n\tif (!$Map && !$Set) {\n\t\t// the only language iterables are Array, String, arguments\n\t\t// - Safari <= 6.0\n\t\t// - Chrome < 38\n\t\t// - node < 0.12\n\t\t// - FF < 13\n\t\t// - IE < 11\n\t\t// - Edge < 11\n\n\t\tmodule.exports = function getIterator(iterable) {\n\t\t\tif (iterable != null) {\n\t\t\t\treturn getNonCollectionIterator(iterable, true);\n\t\t\t}\n\t\t};\n\t} else {\n\t\t// either Map or Set are available, but Symbol is not\n\t\t// - es6-shim on an ES5 browser\n\t\t// - Safari 6.2 (maybe 6.1?)\n\t\t// - FF v[13, 36)\n\t\t// - IE 11\n\t\t// - Edge 11\n\t\t// - Safari v[6, 9)\n\n\t\tvar isMap = require('is-map');\n\t\tvar isSet = require('is-set');\n\n\t\t// Firefox >= 27, IE 11, Safari 6.2 - 9, Edge 11, es6-shim in older envs, all have forEach\n\t\tvar $mapForEach = callBound('Map.prototype.forEach', true);\n\t\tvar $setForEach = callBound('Set.prototype.forEach', true);\n\t\tif (typeof process === 'undefined' || !process.versions || !process.versions.node) { // \"if is not node\"\n\n\t\t\t// Firefox 17 - 26 has `.iterator()`, whose iterator `.next()` either\n\t\t\t// returns a value, or throws a StopIteration object. These browsers\n\t\t\t// do not have any other mechanism for iteration.\n\t\t\tvar $mapIterator = callBound('Map.prototype.iterator', true);\n\t\t\tvar $setIterator = callBound('Set.prototype.iterator', true);\n\t\t\tvar getStopIterationIterator = function (iterator) {\n\t\t\t\tvar done = false;\n\t\t\t\treturn {\n\t\t\t\t\tnext: function next() {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\tdone: done,\n\t\t\t\t\t\t\t\tvalue: done ? undefined : iterator.next()\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\t\tdone = true;\n\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\tdone: true,\n\t\t\t\t\t\t\t\tvalue: undefined\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t};\n\t\t}\n\t\t// Firefox 27-35, and some older es6-shim versions, use a string \"@@iterator\" property\n\t\t// this returns a proper iterator object, so we should use it instead of forEach.\n\t\t// newer es6-shim versions use a string \"_es6-shim iterator_\" property.\n\t\tvar $mapAtAtIterator = callBound('Map.prototype.@@iterator', true) || callBound('Map.prototype._es6-shim iterator_', true);\n\t\tvar $setAtAtIterator = callBound('Set.prototype.@@iterator', true) || callBound('Set.prototype._es6-shim iterator_', true);\n\n\t\tvar getCollectionIterator = function getCollectionIterator(iterable) {\n\t\t\tif (isMap(iterable)) {\n\t\t\t\tif ($mapIterator) {\n\t\t\t\t\treturn getStopIterationIterator($mapIterator(iterable));\n\t\t\t\t}\n\t\t\t\tif ($mapAtAtIterator) {\n\t\t\t\t\treturn $mapAtAtIterator(iterable);\n\t\t\t\t}\n\t\t\t\tif ($mapForEach) {\n\t\t\t\t\tvar entries = [];\n\t\t\t\t\t$mapForEach(iterable, function (v, k) {\n\t\t\t\t\t\t$arrayPush(entries, [k, v]);\n\t\t\t\t\t});\n\t\t\t\t\treturn getArrayIterator(entries);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (isSet(iterable)) {\n\t\t\t\tif ($setIterator) {\n\t\t\t\t\treturn getStopIterationIterator($setIterator(iterable));\n\t\t\t\t}\n\t\t\t\tif ($setAtAtIterator) {\n\t\t\t\t\treturn $setAtAtIterator(iterable);\n\t\t\t\t}\n\t\t\t\tif ($setForEach) {\n\t\t\t\t\tvar values = [];\n\t\t\t\t\t$setForEach(iterable, function (v) {\n\t\t\t\t\t\t$arrayPush(values, v);\n\t\t\t\t\t});\n\t\t\t\t\treturn getArrayIterator(values);\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\tmodule.exports = function getIterator(iterable) {\n\t\t\treturn getCollectionIterator(iterable) || getNonCollectionIterator(iterable);\n\t\t};\n\t}\n}\n","var toString = {}.toString;\n\nmodule.exports = Array.isArray || function (arr) {\n return toString.call(arr) == '[object Array]';\n};\n","\nvar hasOwn = Object.prototype.hasOwnProperty;\nvar toString = Object.prototype.toString;\n\nmodule.exports = function forEach (obj, fn, ctx) {\n if (toString.call(fn) !== '[object Function]') {\n throw new TypeError('iterator must be a function');\n }\n var l = obj.length;\n if (l === +l) {\n for (var i = 0; i < l; i++) {\n fn.call(ctx, obj[i], i, obj);\n }\n } else {\n for (var k in obj) {\n if (hasOwn.call(obj, k)) {\n fn.call(ctx, obj[k], k, obj);\n }\n }\n }\n};\n\n","'use strict';\n\n/* eslint no-invalid-this: 1 */\n\nvar ERROR_MESSAGE = 'Function.prototype.bind called on incompatible ';\nvar slice = Array.prototype.slice;\nvar toStr = Object.prototype.toString;\nvar funcType = '[object Function]';\n\nmodule.exports = function bind(that) {\n var target = this;\n if (typeof target !== 'function' || toStr.call(target) !== funcType) {\n throw new TypeError(ERROR_MESSAGE + target);\n }\n var args = slice.call(arguments, 1);\n\n var bound;\n var binder = function () {\n if (this instanceof bound) {\n var result = target.apply(\n this,\n args.concat(slice.call(arguments))\n );\n if (Object(result) === result) {\n return result;\n }\n return this;\n } else {\n return target.apply(\n that,\n args.concat(slice.call(arguments))\n );\n }\n };\n\n var boundLength = Math.max(0, target.length - args.length);\n var boundArgs = [];\n for (var i = 0; i < boundLength; i++) {\n boundArgs.push('$' + i);\n }\n\n bound = Function('binder', 'return function (' + boundArgs.join(',') + '){ return binder.apply(this,arguments); }')(binder);\n\n if (target.prototype) {\n var Empty = function Empty() {};\n Empty.prototype = target.prototype;\n bound.prototype = new Empty();\n Empty.prototype = null;\n }\n\n return bound;\n};\n","'use strict';\n\nvar implementation = require('./implementation');\n\nmodule.exports = Function.prototype.bind || implementation;\n","'use strict';\n\nvar undefined;\n\nvar $SyntaxError = SyntaxError;\nvar $Function = Function;\nvar $TypeError = TypeError;\n\n// eslint-disable-next-line consistent-return\nvar getEvalledConstructor = function (expressionSyntax) {\n\ttry {\n\t\treturn $Function('\"use strict\"; return (' + expressionSyntax + ').constructor;')();\n\t} catch (e) {}\n};\n\nvar $gOPD = Object.getOwnPropertyDescriptor;\nif ($gOPD) {\n\ttry {\n\t\t$gOPD({}, '');\n\t} catch (e) {\n\t\t$gOPD = null; // this is IE 8, which has a broken gOPD\n\t}\n}\n\nvar throwTypeError = function () {\n\tthrow new $TypeError();\n};\nvar ThrowTypeError = $gOPD\n\t? (function () {\n\t\ttry {\n\t\t\t// eslint-disable-next-line no-unused-expressions, no-caller, no-restricted-properties\n\t\t\targuments.callee; // IE 8 does not throw here\n\t\t\treturn throwTypeError;\n\t\t} catch (calleeThrows) {\n\t\t\ttry {\n\t\t\t\t// IE 8 throws on Object.getOwnPropertyDescriptor(arguments, '')\n\t\t\t\treturn $gOPD(arguments, 'callee').get;\n\t\t\t} catch (gOPDthrows) {\n\t\t\t\treturn throwTypeError;\n\t\t\t}\n\t\t}\n\t}())\n\t: throwTypeError;\n\nvar hasSymbols = require('has-symbols')();\n\nvar getProto = Object.getPrototypeOf || function (x) { return x.__proto__; }; // eslint-disable-line no-proto\n\nvar needsEval = {};\n\nvar TypedArray = typeof Uint8Array === 'undefined' ? undefined : getProto(Uint8Array);\n\nvar INTRINSICS = {\n\t'%AggregateError%': typeof AggregateError === 'undefined' ? undefined : AggregateError,\n\t'%Array%': Array,\n\t'%ArrayBuffer%': typeof ArrayBuffer === 'undefined' ? undefined : ArrayBuffer,\n\t'%ArrayIteratorPrototype%': hasSymbols ? getProto([][Symbol.iterator]()) : undefined,\n\t'%AsyncFromSyncIteratorPrototype%': undefined,\n\t'%AsyncFunction%': needsEval,\n\t'%AsyncGenerator%': needsEval,\n\t'%AsyncGeneratorFunction%': needsEval,\n\t'%AsyncIteratorPrototype%': needsEval,\n\t'%Atomics%': typeof Atomics === 'undefined' ? undefined : Atomics,\n\t'%BigInt%': typeof BigInt === 'undefined' ? undefined : BigInt,\n\t'%Boolean%': Boolean,\n\t'%DataView%': typeof DataView === 'undefined' ? undefined : DataView,\n\t'%Date%': Date,\n\t'%decodeURI%': decodeURI,\n\t'%decodeURIComponent%': decodeURIComponent,\n\t'%encodeURI%': encodeURI,\n\t'%encodeURIComponent%': encodeURIComponent,\n\t'%Error%': Error,\n\t'%eval%': eval, // eslint-disable-line no-eval\n\t'%EvalError%': EvalError,\n\t'%Float32Array%': typeof Float32Array === 'undefined' ? undefined : Float32Array,\n\t'%Float64Array%': typeof Float64Array === 'undefined' ? undefined : Float64Array,\n\t'%FinalizationRegistry%': typeof FinalizationRegistry === 'undefined' ? undefined : FinalizationRegistry,\n\t'%Function%': $Function,\n\t'%GeneratorFunction%': needsEval,\n\t'%Int8Array%': typeof Int8Array === 'undefined' ? undefined : Int8Array,\n\t'%Int16Array%': typeof Int16Array === 'undefined' ? undefined : Int16Array,\n\t'%Int32Array%': typeof Int32Array === 'undefined' ? undefined : Int32Array,\n\t'%isFinite%': isFinite,\n\t'%isNaN%': isNaN,\n\t'%IteratorPrototype%': hasSymbols ? getProto(getProto([][Symbol.iterator]())) : undefined,\n\t'%JSON%': typeof JSON === 'object' ? JSON : undefined,\n\t'%Map%': typeof Map === 'undefined' ? undefined : Map,\n\t'%MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols ? undefined : getProto(new Map()[Symbol.iterator]()),\n\t'%Math%': Math,\n\t'%Number%': Number,\n\t'%Object%': Object,\n\t'%parseFloat%': parseFloat,\n\t'%parseInt%': parseInt,\n\t'%Promise%': typeof Promise === 'undefined' ? undefined : Promise,\n\t'%Proxy%': typeof Proxy === 'undefined' ? undefined : Proxy,\n\t'%RangeError%': RangeError,\n\t'%ReferenceError%': ReferenceError,\n\t'%Reflect%': typeof Reflect === 'undefined' ? undefined : Reflect,\n\t'%RegExp%': RegExp,\n\t'%Set%': typeof Set === 'undefined' ? undefined : Set,\n\t'%SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols ? undefined : getProto(new Set()[Symbol.iterator]()),\n\t'%SharedArrayBuffer%': typeof SharedArrayBuffer === 'undefined' ? undefined : SharedArrayBuffer,\n\t'%String%': String,\n\t'%StringIteratorPrototype%': hasSymbols ? getProto(''[Symbol.iterator]()) : undefined,\n\t'%Symbol%': hasSymbols ? Symbol : undefined,\n\t'%SyntaxError%': $SyntaxError,\n\t'%ThrowTypeError%': ThrowTypeError,\n\t'%TypedArray%': TypedArray,\n\t'%TypeError%': $TypeError,\n\t'%Uint8Array%': typeof Uint8Array === 'undefined' ? undefined : Uint8Array,\n\t'%Uint8ClampedArray%': typeof Uint8ClampedArray === 'undefined' ? undefined : Uint8ClampedArray,\n\t'%Uint16Array%': typeof Uint16Array === 'undefined' ? undefined : Uint16Array,\n\t'%Uint32Array%': typeof Uint32Array === 'undefined' ? undefined : Uint32Array,\n\t'%URIError%': URIError,\n\t'%WeakMap%': typeof WeakMap === 'undefined' ? undefined : WeakMap,\n\t'%WeakRef%': typeof WeakRef === 'undefined' ? undefined : WeakRef,\n\t'%WeakSet%': typeof WeakSet === 'undefined' ? undefined : WeakSet\n};\n\nvar doEval = function doEval(name) {\n\tvar value;\n\tif (name === '%AsyncFunction%') {\n\t\tvalue = getEvalledConstructor('async function () {}');\n\t} else if (name === '%GeneratorFunction%') {\n\t\tvalue = getEvalledConstructor('function* () {}');\n\t} else if (name === '%AsyncGeneratorFunction%') {\n\t\tvalue = getEvalledConstructor('async function* () {}');\n\t} else if (name === '%AsyncGenerator%') {\n\t\tvar fn = doEval('%AsyncGeneratorFunction%');\n\t\tif (fn) {\n\t\t\tvalue = fn.prototype;\n\t\t}\n\t} else if (name === '%AsyncIteratorPrototype%') {\n\t\tvar gen = doEval('%AsyncGenerator%');\n\t\tif (gen) {\n\t\t\tvalue = getProto(gen.prototype);\n\t\t}\n\t}\n\n\tINTRINSICS[name] = value;\n\n\treturn value;\n};\n\nvar LEGACY_ALIASES = {\n\t'%ArrayBufferPrototype%': ['ArrayBuffer', 'prototype'],\n\t'%ArrayPrototype%': ['Array', 'prototype'],\n\t'%ArrayProto_entries%': ['Array', 'prototype', 'entries'],\n\t'%ArrayProto_forEach%': ['Array', 'prototype', 'forEach'],\n\t'%ArrayProto_keys%': ['Array', 'prototype', 'keys'],\n\t'%ArrayProto_values%': ['Array', 'prototype', 'values'],\n\t'%AsyncFunctionPrototype%': ['AsyncFunction', 'prototype'],\n\t'%AsyncGenerator%': ['AsyncGeneratorFunction', 'prototype'],\n\t'%AsyncGeneratorPrototype%': ['AsyncGeneratorFunction', 'prototype', 'prototype'],\n\t'%BooleanPrototype%': ['Boolean', 'prototype'],\n\t'%DataViewPrototype%': ['DataView', 'prototype'],\n\t'%DatePrototype%': ['Date', 'prototype'],\n\t'%ErrorPrototype%': ['Error', 'prototype'],\n\t'%EvalErrorPrototype%': ['EvalError', 'prototype'],\n\t'%Float32ArrayPrototype%': ['Float32Array', 'prototype'],\n\t'%Float64ArrayPrototype%': ['Float64Array', 'prototype'],\n\t'%FunctionPrototype%': ['Function', 'prototype'],\n\t'%Generator%': ['GeneratorFunction', 'prototype'],\n\t'%GeneratorPrototype%': ['GeneratorFunction', 'prototype', 'prototype'],\n\t'%Int8ArrayPrototype%': ['Int8Array', 'prototype'],\n\t'%Int16ArrayPrototype%': ['Int16Array', 'prototype'],\n\t'%Int32ArrayPrototype%': ['Int32Array', 'prototype'],\n\t'%JSONParse%': ['JSON', 'parse'],\n\t'%JSONStringify%': ['JSON', 'stringify'],\n\t'%MapPrototype%': ['Map', 'prototype'],\n\t'%NumberPrototype%': ['Number', 'prototype'],\n\t'%ObjectPrototype%': ['Object', 'prototype'],\n\t'%ObjProto_toString%': ['Object', 'prototype', 'toString'],\n\t'%ObjProto_valueOf%': ['Object', 'prototype', 'valueOf'],\n\t'%PromisePrototype%': ['Promise', 'prototype'],\n\t'%PromiseProto_then%': ['Promise', 'prototype', 'then'],\n\t'%Promise_all%': ['Promise', 'all'],\n\t'%Promise_reject%': ['Promise', 'reject'],\n\t'%Promise_resolve%': ['Promise', 'resolve'],\n\t'%RangeErrorPrototype%': ['RangeError', 'prototype'],\n\t'%ReferenceErrorPrototype%': ['ReferenceError', 'prototype'],\n\t'%RegExpPrototype%': ['RegExp', 'prototype'],\n\t'%SetPrototype%': ['Set', 'prototype'],\n\t'%SharedArrayBufferPrototype%': ['SharedArrayBuffer', 'prototype'],\n\t'%StringPrototype%': ['String', 'prototype'],\n\t'%SymbolPrototype%': ['Symbol', 'prototype'],\n\t'%SyntaxErrorPrototype%': ['SyntaxError', 'prototype'],\n\t'%TypedArrayPrototype%': ['TypedArray', 'prototype'],\n\t'%TypeErrorPrototype%': ['TypeError', 'prototype'],\n\t'%Uint8ArrayPrototype%': ['Uint8Array', 'prototype'],\n\t'%Uint8ClampedArrayPrototype%': ['Uint8ClampedArray', 'prototype'],\n\t'%Uint16ArrayPrototype%': ['Uint16Array', 'prototype'],\n\t'%Uint32ArrayPrototype%': ['Uint32Array', 'prototype'],\n\t'%URIErrorPrototype%': ['URIError', 'prototype'],\n\t'%WeakMapPrototype%': ['WeakMap', 'prototype'],\n\t'%WeakSetPrototype%': ['WeakSet', 'prototype']\n};\n\nvar bind = require('function-bind');\nvar hasOwn = require('has');\nvar $concat = bind.call(Function.call, Array.prototype.concat);\nvar $spliceApply = bind.call(Function.apply, Array.prototype.splice);\nvar $replace = bind.call(Function.call, String.prototype.replace);\nvar $strSlice = bind.call(Function.call, String.prototype.slice);\n\n/* adapted from https://github.com/lodash/lodash/blob/4.17.15/dist/lodash.js#L6735-L6744 */\nvar rePropName = /[^%.[\\]]+|\\[(?:(-?\\d+(?:\\.\\d+)?)|([\"'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|%$))/g;\nvar reEscapeChar = /\\\\(\\\\)?/g; /** Used to match backslashes in property paths. */\nvar stringToPath = function stringToPath(string) {\n\tvar first = $strSlice(string, 0, 1);\n\tvar last = $strSlice(string, -1);\n\tif (first === '%' && last !== '%') {\n\t\tthrow new $SyntaxError('invalid intrinsic syntax, expected closing `%`');\n\t} else if (last === '%' && first !== '%') {\n\t\tthrow new $SyntaxError('invalid intrinsic syntax, expected opening `%`');\n\t}\n\tvar result = [];\n\t$replace(string, rePropName, function (match, number, quote, subString) {\n\t\tresult[result.length] = quote ? $replace(subString, reEscapeChar, '$1') : number || match;\n\t});\n\treturn result;\n};\n/* end adaptation */\n\nvar getBaseIntrinsic = function getBaseIntrinsic(name, allowMissing) {\n\tvar intrinsicName = name;\n\tvar alias;\n\tif (hasOwn(LEGACY_ALIASES, intrinsicName)) {\n\t\talias = LEGACY_ALIASES[intrinsicName];\n\t\tintrinsicName = '%' + alias[0] + '%';\n\t}\n\n\tif (hasOwn(INTRINSICS, intrinsicName)) {\n\t\tvar value = INTRINSICS[intrinsicName];\n\t\tif (value === needsEval) {\n\t\t\tvalue = doEval(intrinsicName);\n\t\t}\n\t\tif (typeof value === 'undefined' && !allowMissing) {\n\t\t\tthrow new $TypeError('intrinsic ' + name + ' exists, but is not available. Please file an issue!');\n\t\t}\n\n\t\treturn {\n\t\t\talias: alias,\n\t\t\tname: intrinsicName,\n\t\t\tvalue: value\n\t\t};\n\t}\n\n\tthrow new $SyntaxError('intrinsic ' + name + ' does not exist!');\n};\n\nmodule.exports = function GetIntrinsic(name, allowMissing) {\n\tif (typeof name !== 'string' || name.length === 0) {\n\t\tthrow new $TypeError('intrinsic name must be a non-empty string');\n\t}\n\tif (arguments.length > 1 && typeof allowMissing !== 'boolean') {\n\t\tthrow new $TypeError('\"allowMissing\" argument must be a boolean');\n\t}\n\n\tvar parts = stringToPath(name);\n\tvar intrinsicBaseName = parts.length > 0 ? parts[0] : '';\n\n\tvar intrinsic = getBaseIntrinsic('%' + intrinsicBaseName + '%', allowMissing);\n\tvar intrinsicRealName = intrinsic.name;\n\tvar value = intrinsic.value;\n\tvar skipFurtherCaching = false;\n\n\tvar alias = intrinsic.alias;\n\tif (alias) {\n\t\tintrinsicBaseName = alias[0];\n\t\t$spliceApply(parts, $concat([0, 1], alias));\n\t}\n\n\tfor (var i = 1, isOwn = true; i < parts.length; i += 1) {\n\t\tvar part = parts[i];\n\t\tvar first = $strSlice(part, 0, 1);\n\t\tvar last = $strSlice(part, -1);\n\t\tif (\n\t\t\t(\n\t\t\t\t(first === '\"' || first === \"'\" || first === '`')\n\t\t\t\t|| (last === '\"' || last === \"'\" || last === '`')\n\t\t\t)\n\t\t\t&& first !== last\n\t\t) {\n\t\t\tthrow new $SyntaxError('property names with quotes must have matching quotes');\n\t\t}\n\t\tif (part === 'constructor' || !isOwn) {\n\t\t\tskipFurtherCaching = true;\n\t\t}\n\n\t\tintrinsicBaseName += '.' + part;\n\t\tintrinsicRealName = '%' + intrinsicBaseName + '%';\n\n\t\tif (hasOwn(INTRINSICS, intrinsicRealName)) {\n\t\t\tvalue = INTRINSICS[intrinsicRealName];\n\t\t} else if (value != null) {\n\t\t\tif (!(part in value)) {\n\t\t\t\tif (!allowMissing) {\n\t\t\t\t\tthrow new $TypeError('base intrinsic for ' + name + ' exists, but the property is not available.');\n\t\t\t\t}\n\t\t\t\treturn void undefined;\n\t\t\t}\n\t\t\tif ($gOPD && (i + 1) >= parts.length) {\n\t\t\t\tvar desc = $gOPD(value, part);\n\t\t\t\tisOwn = !!desc;\n\n\t\t\t\t// By convention, when a data property is converted to an accessor\n\t\t\t\t// property to emulate a data property that does not suffer from\n\t\t\t\t// the override mistake, that accessor's getter is marked with\n\t\t\t\t// an `originalValue` property. Here, when we detect this, we\n\t\t\t\t// uphold the illusion by pretending to see that original data\n\t\t\t\t// property, i.e., returning the value rather than the getter\n\t\t\t\t// itself.\n\t\t\t\tif (isOwn && 'get' in desc && !('originalValue' in desc.get)) {\n\t\t\t\t\tvalue = desc.get;\n\t\t\t\t} else {\n\t\t\t\t\tvalue = value[part];\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tisOwn = hasOwn(value, part);\n\t\t\t\tvalue = value[part];\n\t\t\t}\n\n\t\t\tif (isOwn && !skipFurtherCaching) {\n\t\t\t\tINTRINSICS[intrinsicRealName] = value;\n\t\t\t}\n\t\t}\n\t}\n\treturn value;\n};\n","var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.findInternal=function(a,b,c){a instanceof String&&(a=String(a));for(var d=a.length,e=0;e<d;e++){var f=a[e];if(b.call(c,f,e,a))return{i:e,v:f}}return{i:-1,v:void 0}};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.SIMPLE_FROUND_POLYFILL=!1;\n$jscomp.defineProperty=$jscomp.ASSUME_ES5||\"function\"==typeof Object.defineProperties?Object.defineProperty:function(a,b,c){a!=Array.prototype&&a!=Object.prototype&&(a[b]=c.value)};$jscomp.getGlobal=function(a){return\"undefined\"!=typeof window&&window===a?a:\"undefined\"!=typeof global&&null!=global?global:a};$jscomp.global=$jscomp.getGlobal(this);\n$jscomp.polyfill=function(a,b,c,d){if(b){c=$jscomp.global;a=a.split(\".\");for(d=0;d<a.length-1;d++){var e=a[d];e in c||(c[e]={});c=c[e]}a=a[a.length-1];d=c[a];b=b(d);b!=d&&null!=b&&$jscomp.defineProperty(c,a,{configurable:!0,writable:!0,value:b})}};$jscomp.polyfill(\"Array.prototype.findIndex\",function(a){return a?a:function(a,c){return $jscomp.findInternal(this,a,c).i}},\"es6\",\"es3\");\n$jscomp.checkStringArgs=function(a,b,c){if(null==a)throw new TypeError(\"The 'this' value for String.prototype.\"+c+\" must not be null or undefined\");if(b instanceof RegExp)throw new TypeError(\"First argument to String.prototype.\"+c+\" must not be a regular expression\");return a+\"\"};\n$jscomp.polyfill(\"String.prototype.endsWith\",function(a){return a?a:function(a,c){var b=$jscomp.checkStringArgs(this,a,\"endsWith\");a+=\"\";void 0===c&&(c=b.length);c=Math.max(0,Math.min(c|0,b.length));for(var e=a.length;0<e&&0<c;)if(b[--c]!=a[--e])return!1;return 0>=e}},\"es6\",\"es3\");$jscomp.polyfill(\"Array.prototype.find\",function(a){return a?a:function(a,c){return $jscomp.findInternal(this,a,c).v}},\"es6\",\"es3\");\n$jscomp.polyfill(\"String.prototype.startsWith\",function(a){return a?a:function(a,c){var b=$jscomp.checkStringArgs(this,a,\"startsWith\");a+=\"\";var e=b.length,f=a.length;c=Math.max(0,Math.min(c|0,b.length));for(var g=0;g<f&&c<e;)if(b[c++]!=a[g++])return!1;return g>=f}},\"es6\",\"es3\");\n$jscomp.polyfill(\"String.prototype.repeat\",function(a){return a?a:function(a){var b=$jscomp.checkStringArgs(this,null,\"repeat\");if(0>a||1342177279<a)throw new RangeError(\"Invalid count value\");a|=0;for(var d=\"\";a;)if(a&1&&(d+=b),a>>>=1)b+=b;return d}},\"es6\",\"es3\");var COMPILED=!0,goog=goog||{};goog.global=this||self;goog.isDef=function(a){return void 0!==a};goog.isString=function(a){return\"string\"==typeof a};goog.isBoolean=function(a){return\"boolean\"==typeof a};\ngoog.isNumber=function(a){return\"number\"==typeof a};goog.exportPath_=function(a,b,c){a=a.split(\".\");c=c||goog.global;a[0]in c||\"undefined\"==typeof c.execScript||c.execScript(\"var \"+a[0]);for(var d;a.length&&(d=a.shift());)!a.length&&goog.isDef(b)?c[d]=b:c=c[d]&&c[d]!==Object.prototype[d]?c[d]:c[d]={}};\ngoog.define=function(a,b){if(!COMPILED){var c=goog.global.CLOSURE_UNCOMPILED_DEFINES,d=goog.global.CLOSURE_DEFINES;c&&void 0===c.nodeType&&Object.prototype.hasOwnProperty.call(c,a)?b=c[a]:d&&void 0===d.nodeType&&Object.prototype.hasOwnProperty.call(d,a)&&(b=d[a])}return b};goog.FEATURESET_YEAR=2012;goog.DEBUG=!0;goog.LOCALE=\"en\";goog.TRUSTED_SITE=!0;goog.STRICT_MODE_COMPATIBLE=!1;goog.DISALLOW_TEST_ONLY_CODE=COMPILED&&!goog.DEBUG;goog.ENABLE_CHROME_APP_SAFE_SCRIPT_LOADING=!1;\ngoog.provide=function(a){if(goog.isInModuleLoader_())throw Error(\"goog.provide cannot be used within a module.\");if(!COMPILED&&goog.isProvided_(a))throw Error('Namespace \"'+a+'\" already declared.');goog.constructNamespace_(a)};goog.constructNamespace_=function(a,b){if(!COMPILED){delete goog.implicitNamespaces_[a];for(var c=a;(c=c.substring(0,c.lastIndexOf(\".\")))&&!goog.getObjectByName(c);)goog.implicitNamespaces_[c]=!0}goog.exportPath_(a,b)};\ngoog.getScriptNonce=function(a){if(a&&a!=goog.global)return goog.getScriptNonce_(a.document);null===goog.cspNonce_&&(goog.cspNonce_=goog.getScriptNonce_(goog.global.document));return goog.cspNonce_};goog.NONCE_PATTERN_=/^[\\w+/_-]+[=]{0,2}$/;goog.cspNonce_=null;goog.getScriptNonce_=function(a){return(a=a.querySelector&&a.querySelector(\"script[nonce]\"))&&(a=a.nonce||a.getAttribute(\"nonce\"))&&goog.NONCE_PATTERN_.test(a)?a:\"\"};goog.VALID_MODULE_RE_=/^[a-zA-Z_$][a-zA-Z0-9._$]*$/;\ngoog.module=function(a){if(!goog.isString(a)||!a||-1==a.search(goog.VALID_MODULE_RE_))throw Error(\"Invalid module identifier\");if(!goog.isInGoogModuleLoader_())throw Error(\"Module \"+a+\" has been loaded incorrectly. Note, modules cannot be loaded as normal scripts. They require some kind of pre-processing step. You're likely trying to load a module via a script tag or as a part of a concatenated bundle without rewriting the module. For more info see: https://github.com/google/closure-library/wiki/goog.module:-an-ES6-module-like-alternative-to-goog.provide.\");\nif(goog.moduleLoaderState_.moduleName)throw Error(\"goog.module may only be called once per module.\");goog.moduleLoaderState_.moduleName=a;if(!COMPILED){if(goog.isProvided_(a))throw Error('Namespace \"'+a+'\" already declared.');delete goog.implicitNamespaces_[a]}};goog.module.get=function(a){return goog.module.getInternal_(a)};\ngoog.module.getInternal_=function(a){if(!COMPILED){if(a in goog.loadedModules_)return goog.loadedModules_[a].exports;if(!goog.implicitNamespaces_[a])return a=goog.getObjectByName(a),null!=a?a:null}return null};goog.ModuleType={ES6:\"es6\",GOOG:\"goog\"};goog.moduleLoaderState_=null;goog.isInModuleLoader_=function(){return goog.isInGoogModuleLoader_()||goog.isInEs6ModuleLoader_()};goog.isInGoogModuleLoader_=function(){return!!goog.moduleLoaderState_&&goog.moduleLoaderState_.type==goog.ModuleType.GOOG};\ngoog.isInEs6ModuleLoader_=function(){if(goog.moduleLoaderState_&&goog.moduleLoaderState_.type==goog.ModuleType.ES6)return!0;var a=goog.global.$jscomp;return a?\"function\"!=typeof a.getCurrentModulePath?!1:!!a.getCurrentModulePath():!1};\ngoog.module.declareLegacyNamespace=function(){if(!COMPILED&&!goog.isInGoogModuleLoader_())throw Error(\"goog.module.declareLegacyNamespace must be called from within a goog.module\");if(!COMPILED&&!goog.moduleLoaderState_.moduleName)throw Error(\"goog.module must be called prior to goog.module.declareLegacyNamespace.\");goog.moduleLoaderState_.declareLegacyNamespace=!0};\ngoog.declareModuleId=function(a){if(!COMPILED){if(!goog.isInEs6ModuleLoader_())throw Error(\"goog.declareModuleId may only be called from within an ES6 module\");if(goog.moduleLoaderState_&&goog.moduleLoaderState_.moduleName)throw Error(\"goog.declareModuleId may only be called once per module.\");if(a in goog.loadedModules_)throw Error('Module with namespace \"'+a+'\" already exists.');}if(goog.moduleLoaderState_)goog.moduleLoaderState_.moduleName=a;else{var b=goog.global.$jscomp;if(!b||\"function\"!=typeof b.getCurrentModulePath)throw Error('Module with namespace \"'+\na+'\" has been loaded incorrectly.');b=b.require(b.getCurrentModulePath());goog.loadedModules_[a]={exports:b,type:goog.ModuleType.ES6,moduleId:a}}};goog.setTestOnly=function(a){if(goog.DISALLOW_TEST_ONLY_CODE)throw a=a||\"\",Error(\"Importing test-only code into non-debug environment\"+(a?\": \"+a:\".\"));};goog.forwardDeclare=function(a){};\nCOMPILED||(goog.isProvided_=function(a){return a in goog.loadedModules_||!goog.implicitNamespaces_[a]&&goog.isDefAndNotNull(goog.getObjectByName(a))},goog.implicitNamespaces_={\"goog.module\":!0});goog.getObjectByName=function(a,b){a=a.split(\".\");b=b||goog.global;for(var c=0;c<a.length;c++)if(b=b[a[c]],!goog.isDefAndNotNull(b))return null;return b};goog.globalize=function(a,b){b=b||goog.global;for(var c in a)b[c]=a[c]};\ngoog.addDependency=function(a,b,c,d){!COMPILED&&goog.DEPENDENCIES_ENABLED&&goog.debugLoader_.addDependency(a,b,c,d)};goog.ENABLE_DEBUG_LOADER=!0;goog.logToConsole_=function(a){goog.global.console&&goog.global.console.error(a)};\ngoog.require=function(a){if(!COMPILED){goog.ENABLE_DEBUG_LOADER&&goog.debugLoader_.requested(a);if(goog.isProvided_(a)){if(goog.isInModuleLoader_())return goog.module.getInternal_(a)}else if(goog.ENABLE_DEBUG_LOADER){var b=goog.moduleLoaderState_;goog.moduleLoaderState_=null;try{goog.debugLoader_.load_(a)}finally{goog.moduleLoaderState_=b}}return null}};goog.requireType=function(a){return{}};goog.basePath=\"\";goog.nullFunction=function(){};\ngoog.abstractMethod=function(){throw Error(\"unimplemented abstract method\");};goog.addSingletonGetter=function(a){a.instance_=void 0;a.getInstance=function(){if(a.instance_)return a.instance_;goog.DEBUG&&(goog.instantiatedSingletons_[goog.instantiatedSingletons_.length]=a);return a.instance_=new a}};goog.instantiatedSingletons_=[];goog.LOAD_MODULE_USING_EVAL=!0;goog.SEAL_MODULE_EXPORTS=goog.DEBUG;goog.loadedModules_={};goog.DEPENDENCIES_ENABLED=!COMPILED&&goog.ENABLE_DEBUG_LOADER;goog.TRANSPILE=\"detect\";\ngoog.ASSUME_ES_MODULES_TRANSPILED=!1;goog.TRANSPILE_TO_LANGUAGE=\"\";goog.TRANSPILER=\"transpile.js\";goog.hasBadLetScoping=null;goog.useSafari10Workaround=function(){if(null==goog.hasBadLetScoping){try{var a=!eval('\"use strict\";let x = 1; function f() { return typeof x; };f() == \"number\";')}catch(b){a=!1}goog.hasBadLetScoping=a}return goog.hasBadLetScoping};goog.workaroundSafari10EvalBug=function(a){return\"(function(){\"+a+\"\\n;})();\\n\"};\ngoog.loadModule=function(a){var b=goog.moduleLoaderState_;try{goog.moduleLoaderState_={moduleName:\"\",declareLegacyNamespace:!1,type:goog.ModuleType.GOOG};if(goog.isFunction(a))var c=a.call(void 0,{});else if(goog.isString(a))goog.useSafari10Workaround()&&(a=goog.workaroundSafari10EvalBug(a)),c=goog.loadModuleFromSource_.call(void 0,a);else throw Error(\"Invalid module definition\");var d=goog.moduleLoaderState_.moduleName;if(goog.isString(d)&&d)goog.moduleLoaderState_.declareLegacyNamespace?goog.constructNamespace_(d,\nc):goog.SEAL_MODULE_EXPORTS&&Object.seal&&\"object\"==typeof c&&null!=c&&Object.seal(c),goog.loadedModules_[d]={exports:c,type:goog.ModuleType.GOOG,moduleId:goog.moduleLoaderState_.moduleName};else throw Error('Invalid module name \"'+d+'\"');}finally{goog.moduleLoaderState_=b}};goog.loadModuleFromSource_=function(a){eval(a);return{}};goog.normalizePath_=function(a){a=a.split(\"/\");for(var b=0;b<a.length;)\".\"==a[b]?a.splice(b,1):b&&\"..\"==a[b]&&a[b-1]&&\"..\"!=a[b-1]?a.splice(--b,2):b++;return a.join(\"/\")};\ngoog.loadFileSync_=function(a){if(goog.global.CLOSURE_LOAD_FILE_SYNC)return goog.global.CLOSURE_LOAD_FILE_SYNC(a);try{var b=new goog.global.XMLHttpRequest;b.open(\"get\",a,!1);b.send();return 0==b.status||200==b.status?b.responseText:null}catch(c){return null}};\ngoog.transpile_=function(a,b,c){var d=goog.global.$jscomp;d||(goog.global.$jscomp=d={});var e=d.transpile;if(!e){var f=goog.basePath+goog.TRANSPILER,g=goog.loadFileSync_(f);if(g){(function(){(0,eval)(g+\"\\n//# sourceURL=\"+f)}).call(goog.global);if(goog.global.$gwtExport&&goog.global.$gwtExport.$jscomp&&!goog.global.$gwtExport.$jscomp.transpile)throw Error('The transpiler did not properly export the \"transpile\" method. $gwtExport: '+JSON.stringify(goog.global.$gwtExport));goog.global.$jscomp.transpile=\ngoog.global.$gwtExport.$jscomp.transpile;d=goog.global.$jscomp;e=d.transpile}}e||(e=d.transpile=function(a,b){goog.logToConsole_(b+\" requires transpilation but no transpiler was found.\");return a});return e(a,b,c)};\ngoog.typeOf=function(a){var b=typeof a;if(\"object\"==b)if(a){if(a instanceof Array)return\"array\";if(a instanceof Object)return b;var c=Object.prototype.toString.call(a);if(\"[object Window]\"==c)return\"object\";if(\"[object Array]\"==c||\"number\"==typeof a.length&&\"undefined\"!=typeof a.splice&&\"undefined\"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable(\"splice\"))return\"array\";if(\"[object Function]\"==c||\"undefined\"!=typeof a.call&&\"undefined\"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable(\"call\"))return\"function\"}else return\"null\";\nelse if(\"function\"==b&&\"undefined\"==typeof a.call)return\"object\";return b};goog.isNull=function(a){return null===a};goog.isDefAndNotNull=function(a){return null!=a};goog.isArray=function(a){return\"array\"==goog.typeOf(a)};goog.isArrayLike=function(a){var b=goog.typeOf(a);return\"array\"==b||\"object\"==b&&\"number\"==typeof a.length};goog.isDateLike=function(a){return goog.isObject(a)&&\"function\"==typeof a.getFullYear};goog.isFunction=function(a){return\"function\"==goog.typeOf(a)};\ngoog.isObject=function(a){var b=typeof a;return\"object\"==b&&null!=a||\"function\"==b};goog.getUid=function(a){return a[goog.UID_PROPERTY_]||(a[goog.UID_PROPERTY_]=++goog.uidCounter_)};goog.hasUid=function(a){return!!a[goog.UID_PROPERTY_]};goog.removeUid=function(a){null!==a&&\"removeAttribute\"in a&&a.removeAttribute(goog.UID_PROPERTY_);try{delete a[goog.UID_PROPERTY_]}catch(b){}};goog.UID_PROPERTY_=\"closure_uid_\"+(1E9*Math.random()>>>0);goog.uidCounter_=0;goog.getHashCode=goog.getUid;\ngoog.removeHashCode=goog.removeUid;goog.cloneObject=function(a){var b=goog.typeOf(a);if(\"object\"==b||\"array\"==b){if(\"function\"===typeof a.clone)return a.clone();b=\"array\"==b?[]:{};for(var c in a)b[c]=goog.cloneObject(a[c]);return b}return a};goog.bindNative_=function(a,b,c){return a.call.apply(a.bind,arguments)};\ngoog.bindJs_=function(a,b,c){if(!a)throw Error();if(2<arguments.length){var d=Array.prototype.slice.call(arguments,2);return function(){var c=Array.prototype.slice.call(arguments);Array.prototype.unshift.apply(c,d);return a.apply(b,c)}}return function(){return a.apply(b,arguments)}};goog.bind=function(a,b,c){Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf(\"native code\")?goog.bind=goog.bindNative_:goog.bind=goog.bindJs_;return goog.bind.apply(null,arguments)};\ngoog.partial=function(a,b){var c=Array.prototype.slice.call(arguments,1);return function(){var b=c.slice();b.push.apply(b,arguments);return a.apply(this,b)}};goog.mixin=function(a,b){for(var c in b)a[c]=b[c]};goog.now=goog.TRUSTED_SITE&&Date.now||function(){return+new Date};\ngoog.globalEval=function(a){if(goog.global.execScript)goog.global.execScript(a,\"JavaScript\");else if(goog.global.eval){if(null==goog.evalWorksForGlobals_){try{goog.global.eval(\"var _evalTest_ = 1;\")}catch(d){}if(\"undefined\"!=typeof goog.global._evalTest_){try{delete goog.global._evalTest_}catch(d){}goog.evalWorksForGlobals_=!0}else goog.evalWorksForGlobals_=!1}if(goog.evalWorksForGlobals_)goog.global.eval(a);else{var b=goog.global.document,c=b.createElement(\"SCRIPT\");c.type=\"text/javascript\";c.defer=\n!1;c.appendChild(b.createTextNode(a));b.head.appendChild(c);b.head.removeChild(c)}}else throw Error(\"goog.globalEval not available\");};goog.evalWorksForGlobals_=null;\ngoog.getCssName=function(a,b){if(\".\"==String(a).charAt(0))throw Error('className passed in goog.getCssName must not start with \".\". You passed: '+a);var c=function(a){return goog.cssNameMapping_[a]||a},d=function(a){a=a.split(\"-\");for(var b=[],d=0;d<a.length;d++)b.push(c(a[d]));return b.join(\"-\")};d=goog.cssNameMapping_?\"BY_WHOLE\"==goog.cssNameMappingStyle_?c:d:function(a){return a};a=b?a+\"-\"+d(b):d(a);return goog.global.CLOSURE_CSS_NAME_MAP_FN?goog.global.CLOSURE_CSS_NAME_MAP_FN(a):a};\ngoog.setCssNameMapping=function(a,b){goog.cssNameMapping_=a;goog.cssNameMappingStyle_=b};!COMPILED&&goog.global.CLOSURE_CSS_NAME_MAPPING&&(goog.cssNameMapping_=goog.global.CLOSURE_CSS_NAME_MAPPING);goog.getMsg=function(a,b,c){c&&c.html&&(a=a.replace(/</g,\"<\"));b&&(a=a.replace(/\\{\\$([^}]+)}/g,function(a,c){return null!=b&&c in b?b[c]:a}));return a};goog.getMsgWithFallback=function(a,b){return a};goog.exportSymbol=function(a,b,c){goog.exportPath_(a,b,c)};\ngoog.exportProperty=function(a,b,c){a[b]=c};goog.inherits=function(a,b){function c(){}c.prototype=b.prototype;a.superClass_=b.prototype;a.prototype=new c;a.prototype.constructor=a;a.base=function(a,c,f){for(var d=Array(arguments.length-2),e=2;e<arguments.length;e++)d[e-2]=arguments[e];return b.prototype[c].apply(a,d)}};\ngoog.base=function(a,b,c){var d=arguments.callee.caller;if(goog.STRICT_MODE_COMPATIBLE||goog.DEBUG&&!d)throw Error(\"arguments.caller not defined. goog.base() cannot be used with strict mode code. See http://www.ecma-international.org/ecma-262/5.1/#sec-C\");if(\"undefined\"!==typeof d.superClass_){for(var e=Array(arguments.length-1),f=1;f<arguments.length;f++)e[f-1]=arguments[f];return d.superClass_.constructor.apply(a,e)}if(\"string\"!=typeof b&&\"symbol\"!=typeof b)throw Error(\"method names provided to goog.base must be a string or a symbol\");\ne=Array(arguments.length-2);for(f=2;f<arguments.length;f++)e[f-2]=arguments[f];f=!1;for(var g=a.constructor.prototype;g;g=Object.getPrototypeOf(g))if(g[b]===d)f=!0;else if(f)return g[b].apply(a,e);if(a[b]===d)return a.constructor.prototype[b].apply(a,e);throw Error(\"goog.base called from a method of one name to a method of a different name\");};goog.scope=function(a){if(goog.isInModuleLoader_())throw Error(\"goog.scope is not supported within a module.\");a.call(goog.global)};\nCOMPILED||(goog.global.COMPILED=COMPILED);goog.defineClass=function(a,b){var c=b.constructor,d=b.statics;c&&c!=Object.prototype.constructor||(c=function(){throw Error(\"cannot instantiate an interface (no constructor defined).\");});c=goog.defineClass.createSealingConstructor_(c,a);a&&goog.inherits(c,a);delete b.constructor;delete b.statics;goog.defineClass.applyProperties_(c.prototype,b);null!=d&&(d instanceof Function?d(c):goog.defineClass.applyProperties_(c,d));return c};\ngoog.defineClass.SEAL_CLASS_INSTANCES=goog.DEBUG;goog.defineClass.createSealingConstructor_=function(a,b){if(!goog.defineClass.SEAL_CLASS_INSTANCES)return a;var c=!goog.defineClass.isUnsealable_(b),d=function(){var b=a.apply(this,arguments)||this;b[goog.UID_PROPERTY_]=b[goog.UID_PROPERTY_];this.constructor===d&&c&&Object.seal instanceof Function&&Object.seal(b);return b};return d};goog.defineClass.isUnsealable_=function(a){return a&&a.prototype&&a.prototype[goog.UNSEALABLE_CONSTRUCTOR_PROPERTY_]};\ngoog.defineClass.OBJECT_PROTOTYPE_FIELDS_=\"constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf\".split(\" \");goog.defineClass.applyProperties_=function(a,b){for(var c in b)Object.prototype.hasOwnProperty.call(b,c)&&(a[c]=b[c]);for(var d=0;d<goog.defineClass.OBJECT_PROTOTYPE_FIELDS_.length;d++)c=goog.defineClass.OBJECT_PROTOTYPE_FIELDS_[d],Object.prototype.hasOwnProperty.call(b,c)&&(a[c]=b[c])};\ngoog.tagUnsealableClass=function(a){!COMPILED&&goog.defineClass.SEAL_CLASS_INSTANCES&&(a.prototype[goog.UNSEALABLE_CONSTRUCTOR_PROPERTY_]=!0)};goog.UNSEALABLE_CONSTRUCTOR_PROPERTY_=\"goog_defineClass_legacy_unsealable\";\n!COMPILED&&goog.DEPENDENCIES_ENABLED&&(goog.inHtmlDocument_=function(){var a=goog.global.document;return null!=a&&\"write\"in a},goog.isDocumentLoading_=function(){var a=goog.global.document;return a.attachEvent?\"complete\"!=a.readyState:\"loading\"==a.readyState},goog.findBasePath_=function(){if(goog.isDef(goog.global.CLOSURE_BASE_PATH)&&goog.isString(goog.global.CLOSURE_BASE_PATH))goog.basePath=goog.global.CLOSURE_BASE_PATH;else if(goog.inHtmlDocument_()){var a=goog.global.document,b=a.currentScript;\na=b?[b]:a.getElementsByTagName(\"SCRIPT\");for(b=a.length-1;0<=b;--b){var c=a[b].src,d=c.lastIndexOf(\"?\");d=-1==d?c.length:d;if(\"base.js\"==c.substr(d-7,7)){goog.basePath=c.substr(0,d-7);break}}}},goog.findBasePath_(),goog.Transpiler=function(){this.requiresTranspilation_=null;this.transpilationTarget_=goog.TRANSPILE_TO_LANGUAGE},goog.Transpiler.prototype.createRequiresTranspilation_=function(){function a(a,b){e?d[a]=!0:b()?(c=a,d[a]=!1):e=d[a]=!0}function b(a){try{return!!eval(a)}catch(h){return!1}}\nvar c=\"es3\",d={es3:!1},e=!1,f=goog.global.navigator&&goog.global.navigator.userAgent?goog.global.navigator.userAgent:\"\";a(\"es5\",function(){return b(\"[1,].length==1\")});a(\"es6\",function(){return f.match(/Edge\\/(\\d+)(\\.\\d)*/i)?!1:b('(()=>{\"use strict\";class X{constructor(){if(new.target!=String)throw 1;this.x=42}}let q=Reflect.construct(X,[],String);if(q.x!=42||!(q instanceof String))throw 1;for(const a of[2,3]){if(a==2)continue;function f(z={a}){let a=0;return z.a}{function f(){return 0;}}return f()==3}})()')});\na(\"es7\",function(){return b(\"2 ** 2 == 4\")});a(\"es8\",function(){return b(\"async () => 1, true\")});a(\"es9\",function(){return b(\"({...rest} = {}), true\")});a(\"es_next\",function(){return!1});return{target:c,map:d}},goog.Transpiler.prototype.needsTranspile=function(a,b){if(\"always\"==goog.TRANSPILE)return!0;if(\"never\"==goog.TRANSPILE)return!1;if(!this.requiresTranspilation_){var c=this.createRequiresTranspilation_();this.requiresTranspilation_=c.map;this.transpilationTarget_=this.transpilationTarget_||\nc.target}if(a in this.requiresTranspilation_)return this.requiresTranspilation_[a]?!0:!goog.inHtmlDocument_()||\"es6\"!=b||\"noModule\"in goog.global.document.createElement(\"script\")?!1:!0;throw Error(\"Unknown language mode: \"+a);},goog.Transpiler.prototype.transpile=function(a,b){return goog.transpile_(a,b,this.transpilationTarget_)},goog.transpiler_=new goog.Transpiler,goog.protectScriptTag_=function(a){return a.replace(/<\\/(SCRIPT)/ig,\"\\\\x3c/$1\")},goog.DebugLoader_=function(){this.dependencies_={};\nthis.idToPath_={};this.written_={};this.loadingDeps_=[];this.depsToLoad_=[];this.paused_=!1;this.factory_=new goog.DependencyFactory(goog.transpiler_);this.deferredCallbacks_={};this.deferredQueue_=[]},goog.DebugLoader_.prototype.bootstrap=function(a,b){function c(){d&&(goog.global.setTimeout(d,0),d=null)}var d=b;if(a.length){b=[];for(var e=0;e<a.length;e++){var f=this.getPathFromDeps_(a[e]);if(!f)throw Error(\"Unregonized namespace: \"+a[e]);b.push(this.dependencies_[f])}f=goog.require;var g=0;for(e=\n0;e<a.length;e++)f(a[e]),b[e].onLoad(function(){++g==a.length&&c()})}else c()},goog.DebugLoader_.prototype.loadClosureDeps=function(){this.depsToLoad_.push(this.factory_.createDependency(goog.normalizePath_(goog.basePath+\"deps.js\"),\"deps.js\",[],[],{},!1));this.loadDeps_()},goog.DebugLoader_.prototype.requested=function(a,b){(a=this.getPathFromDeps_(a))&&(b||this.areDepsLoaded_(this.dependencies_[a].requires))&&(b=this.deferredCallbacks_[a])&&(delete this.deferredCallbacks_[a],b())},goog.DebugLoader_.prototype.setDependencyFactory=\nfunction(a){this.factory_=a},goog.DebugLoader_.prototype.load_=function(a){if(this.getPathFromDeps_(a)){var b=this,c=[],d=function(a){var e=b.getPathFromDeps_(a);if(!e)throw Error(\"Bad dependency path or symbol: \"+a);if(!b.written_[e]){b.written_[e]=!0;a=b.dependencies_[e];for(e=0;e<a.requires.length;e++)goog.isProvided_(a.requires[e])||d(a.requires[e]);c.push(a)}};d(a);a=!!this.depsToLoad_.length;this.depsToLoad_=this.depsToLoad_.concat(c);this.paused_||a||this.loadDeps_()}else throw a=\"goog.require could not find: \"+\na,goog.logToConsole_(a),Error(a);},goog.DebugLoader_.prototype.loadDeps_=function(){for(var a=this,b=this.paused_;this.depsToLoad_.length&&!b;)(function(){var c=!1,d=a.depsToLoad_.shift(),e=!1;a.loading_(d);var f={pause:function(){if(c)throw Error(\"Cannot call pause after the call to load.\");b=!0},resume:function(){c?a.resume_():b=!1},loaded:function(){if(e)throw Error(\"Double call to loaded.\");e=!0;a.loaded_(d)},pending:function(){for(var b=[],c=0;c<a.loadingDeps_.length;c++)b.push(a.loadingDeps_[c]);\nreturn b},setModuleState:function(a){goog.moduleLoaderState_={type:a,moduleName:\"\",declareLegacyNamespace:!1}},registerEs6ModuleExports:function(a,b,c){c&&(goog.loadedModules_[c]={exports:b,type:goog.ModuleType.ES6,moduleId:c||\"\"})},registerGoogModuleExports:function(a,b){goog.loadedModules_[a]={exports:b,type:goog.ModuleType.GOOG,moduleId:a}},clearModuleState:function(){goog.moduleLoaderState_=null},defer:function(b){if(c)throw Error(\"Cannot register with defer after the call to load.\");a.defer_(d,\nb)},areDepsLoaded:function(){return a.areDepsLoaded_(d.requires)}};try{d.load(f)}finally{c=!0}})();b&&this.pause_()},goog.DebugLoader_.prototype.pause_=function(){this.paused_=!0},goog.DebugLoader_.prototype.resume_=function(){this.paused_&&(this.paused_=!1,this.loadDeps_())},goog.DebugLoader_.prototype.loading_=function(a){this.loadingDeps_.push(a)},goog.DebugLoader_.prototype.loaded_=function(a){for(var b=0;b<this.loadingDeps_.length;b++)if(this.loadingDeps_[b]==a){this.loadingDeps_.splice(b,1);\nbreak}for(b=0;b<this.deferredQueue_.length;b++)if(this.deferredQueue_[b]==a.path){this.deferredQueue_.splice(b,1);break}if(this.loadingDeps_.length==this.deferredQueue_.length&&!this.depsToLoad_.length)for(;this.deferredQueue_.length;)this.requested(this.deferredQueue_.shift(),!0);a.loaded()},goog.DebugLoader_.prototype.areDepsLoaded_=function(a){for(var b=0;b<a.length;b++){var c=this.getPathFromDeps_(a[b]);if(!c||!(c in this.deferredCallbacks_||goog.isProvided_(a[b])))return!1}return!0},goog.DebugLoader_.prototype.getPathFromDeps_=\nfunction(a){return a in this.idToPath_?this.idToPath_[a]:a in this.dependencies_?a:null},goog.DebugLoader_.prototype.defer_=function(a,b){this.deferredCallbacks_[a.path]=b;this.deferredQueue_.push(a.path)},goog.LoadController=function(){},goog.LoadController.prototype.pause=function(){},goog.LoadController.prototype.resume=function(){},goog.LoadController.prototype.loaded=function(){},goog.LoadController.prototype.pending=function(){},goog.LoadController.prototype.registerEs6ModuleExports=function(a,\nb,c){},goog.LoadController.prototype.setModuleState=function(a){},goog.LoadController.prototype.clearModuleState=function(){},goog.LoadController.prototype.defer=function(a){},goog.LoadController.prototype.areDepsLoaded=function(){},goog.Dependency=function(a,b,c,d,e){this.path=a;this.relativePath=b;this.provides=c;this.requires=d;this.loadFlags=e;this.loaded_=!1;this.loadCallbacks_=[]},goog.Dependency.prototype.getPathName=function(){var a=this.path,b=a.indexOf(\"://\");0<=b&&(a=a.substring(b+3),b=\na.indexOf(\"/\"),0<=b&&(a=a.substring(b+1)));return a},goog.Dependency.prototype.onLoad=function(a){this.loaded_?a():this.loadCallbacks_.push(a)},goog.Dependency.prototype.loaded=function(){this.loaded_=!0;var a=this.loadCallbacks_;this.loadCallbacks_=[];for(var b=0;b<a.length;b++)a[b]()},goog.Dependency.defer_=!1,goog.Dependency.callbackMap_={},goog.Dependency.registerCallback_=function(a){var b=Math.random().toString(32);goog.Dependency.callbackMap_[b]=a;return b},goog.Dependency.unregisterCallback_=\nfunction(a){delete goog.Dependency.callbackMap_[a]},goog.Dependency.callback_=function(a,b){if(a in goog.Dependency.callbackMap_){for(var c=goog.Dependency.callbackMap_[a],d=[],e=1;e<arguments.length;e++)d.push(arguments[e]);c.apply(void 0,d)}else throw Error(\"Callback key \"+a+\" does not exist (was base.js loaded more than once?).\");},goog.Dependency.prototype.load=function(a){if(goog.global.CLOSURE_IMPORT_SCRIPT)goog.global.CLOSURE_IMPORT_SCRIPT(this.path)?a.loaded():a.pause();else if(goog.inHtmlDocument_()){var b=\ngoog.global.document;if(\"complete\"==b.readyState&&!goog.ENABLE_CHROME_APP_SAFE_SCRIPT_LOADING){if(/\\bdeps.js$/.test(this.path)){a.loaded();return}throw Error('Cannot write \"'+this.path+'\" after document load');}if(!goog.ENABLE_CHROME_APP_SAFE_SCRIPT_LOADING&&goog.isDocumentLoading_()){var c=goog.Dependency.registerCallback_(function(b){goog.DebugLoader_.IS_OLD_IE_&&\"complete\"!=b.readyState||(goog.Dependency.unregisterCallback_(c),a.loaded())}),d=!goog.DebugLoader_.IS_OLD_IE_&&goog.getScriptNonce()?\n' nonce=\"'+goog.getScriptNonce()+'\"':\"\";d='<script src=\"'+this.path+'\" '+(goog.DebugLoader_.IS_OLD_IE_?\"onreadystatechange\":\"onload\")+\"=\\\"goog.Dependency.callback_('\"+c+'\\', this)\" type=\"text/javascript\" '+(goog.Dependency.defer_?\"defer\":\"\")+d+\">\\x3c/script>\";b.write(goog.TRUSTED_TYPES_POLICY_?goog.TRUSTED_TYPES_POLICY_.createHTML(d):d)}else{var e=b.createElement(\"script\");e.defer=goog.Dependency.defer_;e.async=!1;e.type=\"text/javascript\";(d=goog.getScriptNonce())&&e.setAttribute(\"nonce\",d);goog.DebugLoader_.IS_OLD_IE_?\n(a.pause(),e.onreadystatechange=function(){if(\"loaded\"==e.readyState||\"complete\"==e.readyState)a.loaded(),a.resume()}):e.onload=function(){e.onload=null;a.loaded()};e.src=goog.TRUSTED_TYPES_POLICY_?goog.TRUSTED_TYPES_POLICY_.createScriptURL(this.path):this.path;b.head.appendChild(e)}}else goog.logToConsole_(\"Cannot use default debug loader outside of HTML documents.\"),\"deps.js\"==this.relativePath?(goog.logToConsole_(\"Consider setting CLOSURE_IMPORT_SCRIPT before loading base.js, or setting CLOSURE_NO_DEPS to true.\"),\na.loaded()):a.pause()},goog.Es6ModuleDependency=function(a,b,c,d,e){goog.Dependency.call(this,a,b,c,d,e)},goog.inherits(goog.Es6ModuleDependency,goog.Dependency),goog.Es6ModuleDependency.prototype.load=function(a){function b(a,b){a=b?'<script type=\"module\" crossorigin>'+b+\"\\x3c/script>\":'<script type=\"module\" crossorigin src=\"'+a+'\">\\x3c/script>';d.write(goog.TRUSTED_TYPES_POLICY_?goog.TRUSTED_TYPES_POLICY_.createHTML(a):a)}function c(a,b){var c=d.createElement(\"script\");c.defer=!0;c.async=!1;c.type=\n\"module\";c.setAttribute(\"crossorigin\",!0);var e=goog.getScriptNonce();e&&c.setAttribute(\"nonce\",e);b?c.textContent=goog.TRUSTED_TYPES_POLICY_?goog.TRUSTED_TYPES_POLICY_.createScript(b):b:c.src=goog.TRUSTED_TYPES_POLICY_?goog.TRUSTED_TYPES_POLICY_.createScriptURL(a):a;d.head.appendChild(c)}if(goog.global.CLOSURE_IMPORT_SCRIPT)goog.global.CLOSURE_IMPORT_SCRIPT(this.path)?a.loaded():a.pause();else if(goog.inHtmlDocument_()){var d=goog.global.document,e=this;if(goog.isDocumentLoading_()){var f=b;goog.Dependency.defer_=\n!0}else f=c;var g=goog.Dependency.registerCallback_(function(){goog.Dependency.unregisterCallback_(g);a.setModuleState(goog.ModuleType.ES6)});f(void 0,'goog.Dependency.callback_(\"'+g+'\")');f(this.path,void 0);var h=goog.Dependency.registerCallback_(function(b){goog.Dependency.unregisterCallback_(h);a.registerEs6ModuleExports(e.path,b,goog.moduleLoaderState_.moduleName)});f(void 0,'import * as m from \"'+this.path+'\"; goog.Dependency.callback_(\"'+h+'\", m)');var k=goog.Dependency.registerCallback_(function(){goog.Dependency.unregisterCallback_(k);\na.clearModuleState();a.loaded()});f(void 0,'goog.Dependency.callback_(\"'+k+'\")')}else goog.logToConsole_(\"Cannot use default debug loader outside of HTML documents.\"),a.pause()},goog.TransformedDependency=function(a,b,c,d,e){goog.Dependency.call(this,a,b,c,d,e);this.contents_=null;this.lazyFetch_=!goog.inHtmlDocument_()||!(\"noModule\"in goog.global.document.createElement(\"script\"))},goog.inherits(goog.TransformedDependency,goog.Dependency),goog.TransformedDependency.prototype.load=function(a){function b(){e.contents_=\ngoog.loadFileSync_(e.path);e.contents_&&(e.contents_=e.transform(e.contents_),e.contents_&&(e.contents_+=\"\\n//# sourceURL=\"+e.path))}function c(){e.lazyFetch_&&b();if(e.contents_){f&&a.setModuleState(goog.ModuleType.ES6);try{var c=e.contents_;e.contents_=null;goog.globalEval(c);if(f)var d=goog.moduleLoaderState_.moduleName}finally{f&&a.clearModuleState()}f&&goog.global.$jscomp.require.ensure([e.getPathName()],function(){a.registerEs6ModuleExports(e.path,goog.global.$jscomp.require(e.getPathName()),\nd)});a.loaded()}}function d(){var a=goog.global.document,b=goog.Dependency.registerCallback_(function(){goog.Dependency.unregisterCallback_(b);c()}),d='<script type=\"text/javascript\">'+goog.protectScriptTag_('goog.Dependency.callback_(\"'+b+'\");')+\"\\x3c/script>\";a.write(goog.TRUSTED_TYPES_POLICY_?goog.TRUSTED_TYPES_POLICY_.createHTML(d):d)}var e=this;if(goog.global.CLOSURE_IMPORT_SCRIPT)b(),this.contents_&&goog.global.CLOSURE_IMPORT_SCRIPT(\"\",this.contents_)?(this.contents_=null,a.loaded()):a.pause();\nelse{var f=this.loadFlags.module==goog.ModuleType.ES6;this.lazyFetch_||b();var g=1<a.pending().length,h=g&&goog.DebugLoader_.IS_OLD_IE_;g=goog.Dependency.defer_&&(g||goog.isDocumentLoading_());if(h||g)a.defer(function(){c()});else{var k=goog.global.document;h=goog.inHtmlDocument_()&&\"ActiveXObject\"in goog.global;if(f&&goog.inHtmlDocument_()&&goog.isDocumentLoading_()&&!h){goog.Dependency.defer_=!0;a.pause();var l=k.onreadystatechange;k.onreadystatechange=function(){\"interactive\"==k.readyState&&(k.onreadystatechange=\nl,c(),a.resume());goog.isFunction(l)&&l.apply(void 0,arguments)}}else!goog.DebugLoader_.IS_OLD_IE_&&goog.inHtmlDocument_()&&goog.isDocumentLoading_()?d():c()}}},goog.TransformedDependency.prototype.transform=function(a){},goog.TranspiledDependency=function(a,b,c,d,e,f){goog.TransformedDependency.call(this,a,b,c,d,e);this.transpiler=f},goog.inherits(goog.TranspiledDependency,goog.TransformedDependency),goog.TranspiledDependency.prototype.transform=function(a){return this.transpiler.transpile(a,this.getPathName())},\ngoog.PreTranspiledEs6ModuleDependency=function(a,b,c,d,e){goog.TransformedDependency.call(this,a,b,c,d,e)},goog.inherits(goog.PreTranspiledEs6ModuleDependency,goog.TransformedDependency),goog.PreTranspiledEs6ModuleDependency.prototype.transform=function(a){return a},goog.GoogModuleDependency=function(a,b,c,d,e,f,g){goog.TransformedDependency.call(this,a,b,c,d,e);this.needsTranspile_=f;this.transpiler_=g},goog.inherits(goog.GoogModuleDependency,goog.TransformedDependency),goog.GoogModuleDependency.prototype.transform=\nfunction(a){this.needsTranspile_&&(a=this.transpiler_.transpile(a,this.getPathName()));return goog.LOAD_MODULE_USING_EVAL&&goog.isDef(goog.global.JSON)?\"goog.loadModule(\"+goog.global.JSON.stringify(a+\"\\n//# sourceURL=\"+this.path+\"\\n\")+\");\":'goog.loadModule(function(exports) {\"use strict\";'+a+\"\\n;return exports});\\n//# sourceURL=\"+this.path+\"\\n\"},goog.DebugLoader_.IS_OLD_IE_=!(goog.global.atob||!goog.global.document||!goog.global.document.all),goog.DebugLoader_.prototype.addDependency=function(a,b,\nc,d){b=b||[];a=a.replace(/\\\\/g,\"/\");var e=goog.normalizePath_(goog.basePath+a);d&&\"boolean\"!==typeof d||(d=d?{module:goog.ModuleType.GOOG}:{});c=this.factory_.createDependency(e,a,b,c,d,goog.transpiler_.needsTranspile(d.lang||\"es3\",d.module));this.dependencies_[e]=c;for(c=0;c<b.length;c++)this.idToPath_[b[c]]=e;this.idToPath_[a]=e},goog.DependencyFactory=function(a){this.transpiler=a},goog.DependencyFactory.prototype.createDependency=function(a,b,c,d,e,f){return e.module==goog.ModuleType.GOOG?new goog.GoogModuleDependency(a,\nb,c,d,e,f,this.transpiler):f?new goog.TranspiledDependency(a,b,c,d,e,this.transpiler):e.module==goog.ModuleType.ES6?\"never\"==goog.TRANSPILE&&goog.ASSUME_ES_MODULES_TRANSPILED?new goog.PreTranspiledEs6ModuleDependency(a,b,c,d,e):new goog.Es6ModuleDependency(a,b,c,d,e):new goog.Dependency(a,b,c,d,e)},goog.debugLoader_=new goog.DebugLoader_,goog.loadClosureDeps=function(){goog.debugLoader_.loadClosureDeps()},goog.setDependencyFactory=function(a){goog.debugLoader_.setDependencyFactory(a)},goog.global.CLOSURE_NO_DEPS||\ngoog.debugLoader_.loadClosureDeps(),goog.bootstrap=function(a,b){goog.debugLoader_.bootstrap(a,b)});goog.TRUSTED_TYPES_POLICY_NAME=\"\";goog.identity_=function(a){return a};goog.createTrustedTypesPolicy=function(a){var b=null;if(\"undefined\"===typeof TrustedTypes||!TrustedTypes.createPolicy)return b;try{b=TrustedTypes.createPolicy(a,{createHTML:goog.identity_,createScript:goog.identity_,createScriptURL:goog.identity_,createURL:goog.identity_})}catch(c){goog.logToConsole_(c.message)}return b};\ngoog.TRUSTED_TYPES_POLICY_=goog.TRUSTED_TYPES_POLICY_NAME?goog.createTrustedTypesPolicy(goog.TRUSTED_TYPES_POLICY_NAME+\"#base\"):null;goog.object={};goog.object.is=function(a,b){return a===b?0!==a||1/a===1/b:a!==a&&b!==b};goog.object.forEach=function(a,b,c){for(var d in a)b.call(c,a[d],d,a)};goog.object.filter=function(a,b,c){var d={},e;for(e in a)b.call(c,a[e],e,a)&&(d[e]=a[e]);return d};goog.object.map=function(a,b,c){var d={},e;for(e in a)d[e]=b.call(c,a[e],e,a);return d};goog.object.some=function(a,b,c){for(var d in a)if(b.call(c,a[d],d,a))return!0;return!1};\ngoog.object.every=function(a,b,c){for(var d in a)if(!b.call(c,a[d],d,a))return!1;return!0};goog.object.getCount=function(a){var b=0,c;for(c in a)b++;return b};goog.object.getAnyKey=function(a){for(var b in a)return b};goog.object.getAnyValue=function(a){for(var b in a)return a[b]};goog.object.contains=function(a,b){return goog.object.containsValue(a,b)};goog.object.getValues=function(a){var b=[],c=0,d;for(d in a)b[c++]=a[d];return b};\ngoog.object.getKeys=function(a){var b=[],c=0,d;for(d in a)b[c++]=d;return b};goog.object.getValueByKeys=function(a,b){var c=goog.isArrayLike(b),d=c?b:arguments;for(c=c?0:1;c<d.length;c++){if(null==a)return;a=a[d[c]]}return a};goog.object.containsKey=function(a,b){return null!==a&&b in a};goog.object.containsValue=function(a,b){for(var c in a)if(a[c]==b)return!0;return!1};goog.object.findKey=function(a,b,c){for(var d in a)if(b.call(c,a[d],d,a))return d};\ngoog.object.findValue=function(a,b,c){return(b=goog.object.findKey(a,b,c))&&a[b]};goog.object.isEmpty=function(a){for(var b in a)return!1;return!0};goog.object.clear=function(a){for(var b in a)delete a[b]};goog.object.remove=function(a,b){var c;(c=b in a)&&delete a[b];return c};goog.object.add=function(a,b,c){if(null!==a&&b in a)throw Error('The object already contains the key \"'+b+'\"');goog.object.set(a,b,c)};goog.object.get=function(a,b,c){return null!==a&&b in a?a[b]:c};\ngoog.object.set=function(a,b,c){a[b]=c};goog.object.setIfUndefined=function(a,b,c){return b in a?a[b]:a[b]=c};goog.object.setWithReturnValueIfNotSet=function(a,b,c){if(b in a)return a[b];c=c();return a[b]=c};goog.object.equals=function(a,b){for(var c in a)if(!(c in b)||a[c]!==b[c])return!1;for(var d in b)if(!(d in a))return!1;return!0};goog.object.clone=function(a){var b={},c;for(c in a)b[c]=a[c];return b};\ngoog.object.unsafeClone=function(a){var b=goog.typeOf(a);if(\"object\"==b||\"array\"==b){if(goog.isFunction(a.clone))return a.clone();b=\"array\"==b?[]:{};for(var c in a)b[c]=goog.object.unsafeClone(a[c]);return b}return a};goog.object.transpose=function(a){var b={},c;for(c in a)b[a[c]]=c;return b};goog.object.PROTOTYPE_FIELDS_=\"constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf\".split(\" \");\ngoog.object.extend=function(a,b){for(var c,d,e=1;e<arguments.length;e++){d=arguments[e];for(c in d)a[c]=d[c];for(var f=0;f<goog.object.PROTOTYPE_FIELDS_.length;f++)c=goog.object.PROTOTYPE_FIELDS_[f],Object.prototype.hasOwnProperty.call(d,c)&&(a[c]=d[c])}};\ngoog.object.create=function(a){var b=arguments.length;if(1==b&&goog.isArray(arguments[0]))return goog.object.create.apply(null,arguments[0]);if(b%2)throw Error(\"Uneven number of arguments\");for(var c={},d=0;d<b;d+=2)c[arguments[d]]=arguments[d+1];return c};goog.object.createSet=function(a){var b=arguments.length;if(1==b&&goog.isArray(arguments[0]))return goog.object.createSet.apply(null,arguments[0]);for(var c={},d=0;d<b;d++)c[arguments[d]]=!0;return c};\ngoog.object.createImmutableView=function(a){var b=a;Object.isFrozen&&!Object.isFrozen(a)&&(b=Object.create(a),Object.freeze(b));return b};goog.object.isImmutableView=function(a){return!!Object.isFrozen&&Object.isFrozen(a)};\ngoog.object.getAllPropertyNames=function(a,b,c){if(!a)return[];if(!Object.getOwnPropertyNames||!Object.getPrototypeOf)return goog.object.getKeys(a);for(var d={};a&&(a!==Object.prototype||b)&&(a!==Function.prototype||c);){for(var e=Object.getOwnPropertyNames(a),f=0;f<e.length;f++)d[e[f]]=!0;a=Object.getPrototypeOf(a)}return goog.object.getKeys(d)};goog.object.getSuperClass=function(a){return(a=Object.getPrototypeOf(a.prototype))&&a.constructor};goog.debug={};goog.debug.Error=function(a){if(Error.captureStackTrace)Error.captureStackTrace(this,goog.debug.Error);else{var b=Error().stack;b&&(this.stack=b)}a&&(this.message=String(a));this.reportErrorToServer=!0};goog.inherits(goog.debug.Error,Error);goog.debug.Error.prototype.name=\"CustomError\";goog.dom={};goog.dom.NodeType={ELEMENT:1,ATTRIBUTE:2,TEXT:3,CDATA_SECTION:4,ENTITY_REFERENCE:5,ENTITY:6,PROCESSING_INSTRUCTION:7,COMMENT:8,DOCUMENT:9,DOCUMENT_TYPE:10,DOCUMENT_FRAGMENT:11,NOTATION:12};goog.asserts={};goog.asserts.ENABLE_ASSERTS=goog.DEBUG;goog.asserts.AssertionError=function(a,b){goog.debug.Error.call(this,goog.asserts.subs_(a,b));this.messagePattern=a};goog.inherits(goog.asserts.AssertionError,goog.debug.Error);goog.asserts.AssertionError.prototype.name=\"AssertionError\";goog.asserts.DEFAULT_ERROR_HANDLER=function(a){throw a;};goog.asserts.errorHandler_=goog.asserts.DEFAULT_ERROR_HANDLER;\ngoog.asserts.subs_=function(a,b){a=a.split(\"%s\");for(var c=\"\",d=a.length-1,e=0;e<d;e++)c+=a[e]+(e<b.length?b[e]:\"%s\");return c+a[d]};goog.asserts.doAssertFailure_=function(a,b,c,d){var e=\"Assertion failed\";if(c){e+=\": \"+c;var f=d}else a&&(e+=\": \"+a,f=b);a=new goog.asserts.AssertionError(\"\"+e,f||[]);goog.asserts.errorHandler_(a)};goog.asserts.setErrorHandler=function(a){goog.asserts.ENABLE_ASSERTS&&(goog.asserts.errorHandler_=a)};\ngoog.asserts.assert=function(a,b,c){goog.asserts.ENABLE_ASSERTS&&!a&&goog.asserts.doAssertFailure_(\"\",null,b,Array.prototype.slice.call(arguments,2));return a};goog.asserts.assertExists=function(a,b,c){goog.asserts.ENABLE_ASSERTS&&null==a&&goog.asserts.doAssertFailure_(\"Expected to exist: %s.\",[a],b,Array.prototype.slice.call(arguments,2));return a};\ngoog.asserts.fail=function(a,b){goog.asserts.ENABLE_ASSERTS&&goog.asserts.errorHandler_(new goog.asserts.AssertionError(\"Failure\"+(a?\": \"+a:\"\"),Array.prototype.slice.call(arguments,1)))};goog.asserts.assertNumber=function(a,b,c){goog.asserts.ENABLE_ASSERTS&&!goog.isNumber(a)&&goog.asserts.doAssertFailure_(\"Expected number but got %s: %s.\",[goog.typeOf(a),a],b,Array.prototype.slice.call(arguments,2));return a};\ngoog.asserts.assertString=function(a,b,c){goog.asserts.ENABLE_ASSERTS&&!goog.isString(a)&&goog.asserts.doAssertFailure_(\"Expected string but got %s: %s.\",[goog.typeOf(a),a],b,Array.prototype.slice.call(arguments,2));return a};goog.asserts.assertFunction=function(a,b,c){goog.asserts.ENABLE_ASSERTS&&!goog.isFunction(a)&&goog.asserts.doAssertFailure_(\"Expected function but got %s: %s.\",[goog.typeOf(a),a],b,Array.prototype.slice.call(arguments,2));return a};\ngoog.asserts.assertObject=function(a,b,c){goog.asserts.ENABLE_ASSERTS&&!goog.isObject(a)&&goog.asserts.doAssertFailure_(\"Expected object but got %s: %s.\",[goog.typeOf(a),a],b,Array.prototype.slice.call(arguments,2));return a};goog.asserts.assertArray=function(a,b,c){goog.asserts.ENABLE_ASSERTS&&!goog.isArray(a)&&goog.asserts.doAssertFailure_(\"Expected array but got %s: %s.\",[goog.typeOf(a),a],b,Array.prototype.slice.call(arguments,2));return a};\ngoog.asserts.assertBoolean=function(a,b,c){goog.asserts.ENABLE_ASSERTS&&!goog.isBoolean(a)&&goog.asserts.doAssertFailure_(\"Expected boolean but got %s: %s.\",[goog.typeOf(a),a],b,Array.prototype.slice.call(arguments,2));return a};goog.asserts.assertElement=function(a,b,c){!goog.asserts.ENABLE_ASSERTS||goog.isObject(a)&&a.nodeType==goog.dom.NodeType.ELEMENT||goog.asserts.doAssertFailure_(\"Expected Element but got %s: %s.\",[goog.typeOf(a),a],b,Array.prototype.slice.call(arguments,2));return a};\ngoog.asserts.assertInstanceof=function(a,b,c,d){!goog.asserts.ENABLE_ASSERTS||a instanceof b||goog.asserts.doAssertFailure_(\"Expected instanceof %s but got %s.\",[goog.asserts.getType_(b),goog.asserts.getType_(a)],c,Array.prototype.slice.call(arguments,3));return a};goog.asserts.assertFinite=function(a,b,c){!goog.asserts.ENABLE_ASSERTS||\"number\"==typeof a&&isFinite(a)||goog.asserts.doAssertFailure_(\"Expected %s to be a finite number but it is not.\",[a],b,Array.prototype.slice.call(arguments,2));return a};\ngoog.asserts.assertObjectPrototypeIsIntact=function(){for(var a in Object.prototype)goog.asserts.fail(a+\" should not be enumerable in Object.prototype.\")};goog.asserts.getType_=function(a){return a instanceof Function?a.displayName||a.name||\"unknown type name\":a instanceof Object?a.constructor.displayName||a.constructor.name||Object.prototype.toString.call(a):null===a?\"null\":typeof a};var jspb={BinaryConstants:{},ConstBinaryMessage:function(){},BinaryMessage:function(){}};jspb.BinaryConstants.FieldType={INVALID:-1,DOUBLE:1,FLOAT:2,INT64:3,UINT64:4,INT32:5,FIXED64:6,FIXED32:7,BOOL:8,STRING:9,GROUP:10,MESSAGE:11,BYTES:12,UINT32:13,ENUM:14,SFIXED32:15,SFIXED64:16,SINT32:17,SINT64:18,FHASH64:30,VHASH64:31};jspb.BinaryConstants.WireType={INVALID:-1,VARINT:0,FIXED64:1,DELIMITED:2,START_GROUP:3,END_GROUP:4,FIXED32:5};\njspb.BinaryConstants.FieldTypeToWireType=function(a){var b=jspb.BinaryConstants.FieldType,c=jspb.BinaryConstants.WireType;switch(a){case b.INT32:case b.INT64:case b.UINT32:case b.UINT64:case b.SINT32:case b.SINT64:case b.BOOL:case b.ENUM:case b.VHASH64:return c.VARINT;case b.DOUBLE:case b.FIXED64:case b.SFIXED64:case b.FHASH64:return c.FIXED64;case b.STRING:case b.MESSAGE:case b.BYTES:return c.DELIMITED;case b.FLOAT:case b.FIXED32:case b.SFIXED32:return c.FIXED32;default:return c.INVALID}};\njspb.BinaryConstants.INVALID_FIELD_NUMBER=-1;jspb.BinaryConstants.FLOAT32_EPS=1.401298464324817E-45;jspb.BinaryConstants.FLOAT32_MIN=1.1754943508222875E-38;jspb.BinaryConstants.FLOAT32_MAX=3.4028234663852886E38;jspb.BinaryConstants.FLOAT64_EPS=4.9E-324;jspb.BinaryConstants.FLOAT64_MIN=2.2250738585072014E-308;jspb.BinaryConstants.FLOAT64_MAX=1.7976931348623157E308;jspb.BinaryConstants.TWO_TO_20=1048576;jspb.BinaryConstants.TWO_TO_23=8388608;jspb.BinaryConstants.TWO_TO_31=2147483648;\njspb.BinaryConstants.TWO_TO_32=4294967296;jspb.BinaryConstants.TWO_TO_52=4503599627370496;jspb.BinaryConstants.TWO_TO_63=0x7fffffffffffffff;jspb.BinaryConstants.TWO_TO_64=1.8446744073709552E19;jspb.BinaryConstants.ZERO_HASH=\"\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\";goog.array={};goog.NATIVE_ARRAY_PROTOTYPES=goog.TRUSTED_SITE;goog.array.ASSUME_NATIVE_FUNCTIONS=2012<goog.FEATURESET_YEAR;goog.array.peek=function(a){return a[a.length-1]};goog.array.last=goog.array.peek;\ngoog.array.indexOf=goog.NATIVE_ARRAY_PROTOTYPES&&(goog.array.ASSUME_NATIVE_FUNCTIONS||Array.prototype.indexOf)?function(a,b,c){goog.asserts.assert(null!=a.length);return Array.prototype.indexOf.call(a,b,c)}:function(a,b,c){c=null==c?0:0>c?Math.max(0,a.length+c):c;if(goog.isString(a))return goog.isString(b)&&1==b.length?a.indexOf(b,c):-1;for(;c<a.length;c++)if(c in a&&a[c]===b)return c;return-1};\ngoog.array.lastIndexOf=goog.NATIVE_ARRAY_PROTOTYPES&&(goog.array.ASSUME_NATIVE_FUNCTIONS||Array.prototype.lastIndexOf)?function(a,b,c){goog.asserts.assert(null!=a.length);return Array.prototype.lastIndexOf.call(a,b,null==c?a.length-1:c)}:function(a,b,c){c=null==c?a.length-1:c;0>c&&(c=Math.max(0,a.length+c));if(goog.isString(a))return goog.isString(b)&&1==b.length?a.lastIndexOf(b,c):-1;for(;0<=c;c--)if(c in a&&a[c]===b)return c;return-1};\ngoog.array.forEach=goog.NATIVE_ARRAY_PROTOTYPES&&(goog.array.ASSUME_NATIVE_FUNCTIONS||Array.prototype.forEach)?function(a,b,c){goog.asserts.assert(null!=a.length);Array.prototype.forEach.call(a,b,c)}:function(a,b,c){for(var d=a.length,e=goog.isString(a)?a.split(\"\"):a,f=0;f<d;f++)f in e&&b.call(c,e[f],f,a)};goog.array.forEachRight=function(a,b,c){var d=a.length,e=goog.isString(a)?a.split(\"\"):a;for(--d;0<=d;--d)d in e&&b.call(c,e[d],d,a)};\ngoog.array.filter=goog.NATIVE_ARRAY_PROTOTYPES&&(goog.array.ASSUME_NATIVE_FUNCTIONS||Array.prototype.filter)?function(a,b,c){goog.asserts.assert(null!=a.length);return Array.prototype.filter.call(a,b,c)}:function(a,b,c){for(var d=a.length,e=[],f=0,g=goog.isString(a)?a.split(\"\"):a,h=0;h<d;h++)if(h in g){var k=g[h];b.call(c,k,h,a)&&(e[f++]=k)}return e};\ngoog.array.map=goog.NATIVE_ARRAY_PROTOTYPES&&(goog.array.ASSUME_NATIVE_FUNCTIONS||Array.prototype.map)?function(a,b,c){goog.asserts.assert(null!=a.length);return Array.prototype.map.call(a,b,c)}:function(a,b,c){for(var d=a.length,e=Array(d),f=goog.isString(a)?a.split(\"\"):a,g=0;g<d;g++)g in f&&(e[g]=b.call(c,f[g],g,a));return e};\ngoog.array.reduce=goog.NATIVE_ARRAY_PROTOTYPES&&(goog.array.ASSUME_NATIVE_FUNCTIONS||Array.prototype.reduce)?function(a,b,c,d){goog.asserts.assert(null!=a.length);d&&(b=goog.bind(b,d));return Array.prototype.reduce.call(a,b,c)}:function(a,b,c,d){var e=c;goog.array.forEach(a,function(c,g){e=b.call(d,e,c,g,a)});return e};\ngoog.array.reduceRight=goog.NATIVE_ARRAY_PROTOTYPES&&(goog.array.ASSUME_NATIVE_FUNCTIONS||Array.prototype.reduceRight)?function(a,b,c,d){goog.asserts.assert(null!=a.length);goog.asserts.assert(null!=b);d&&(b=goog.bind(b,d));return Array.prototype.reduceRight.call(a,b,c)}:function(a,b,c,d){var e=c;goog.array.forEachRight(a,function(c,g){e=b.call(d,e,c,g,a)});return e};\ngoog.array.some=goog.NATIVE_ARRAY_PROTOTYPES&&(goog.array.ASSUME_NATIVE_FUNCTIONS||Array.prototype.some)?function(a,b,c){goog.asserts.assert(null!=a.length);return Array.prototype.some.call(a,b,c)}:function(a,b,c){for(var d=a.length,e=goog.isString(a)?a.split(\"\"):a,f=0;f<d;f++)if(f in e&&b.call(c,e[f],f,a))return!0;return!1};\ngoog.array.every=goog.NATIVE_ARRAY_PROTOTYPES&&(goog.array.ASSUME_NATIVE_FUNCTIONS||Array.prototype.every)?function(a,b,c){goog.asserts.assert(null!=a.length);return Array.prototype.every.call(a,b,c)}:function(a,b,c){for(var d=a.length,e=goog.isString(a)?a.split(\"\"):a,f=0;f<d;f++)if(f in e&&!b.call(c,e[f],f,a))return!1;return!0};goog.array.count=function(a,b,c){var d=0;goog.array.forEach(a,function(a,f,g){b.call(c,a,f,g)&&++d},c);return d};\ngoog.array.find=function(a,b,c){b=goog.array.findIndex(a,b,c);return 0>b?null:goog.isString(a)?a.charAt(b):a[b]};goog.array.findIndex=function(a,b,c){for(var d=a.length,e=goog.isString(a)?a.split(\"\"):a,f=0;f<d;f++)if(f in e&&b.call(c,e[f],f,a))return f;return-1};goog.array.findRight=function(a,b,c){b=goog.array.findIndexRight(a,b,c);return 0>b?null:goog.isString(a)?a.charAt(b):a[b]};\ngoog.array.findIndexRight=function(a,b,c){var d=a.length,e=goog.isString(a)?a.split(\"\"):a;for(--d;0<=d;d--)if(d in e&&b.call(c,e[d],d,a))return d;return-1};goog.array.contains=function(a,b){return 0<=goog.array.indexOf(a,b)};goog.array.isEmpty=function(a){return 0==a.length};goog.array.clear=function(a){if(!goog.isArray(a))for(var b=a.length-1;0<=b;b--)delete a[b];a.length=0};goog.array.insert=function(a,b){goog.array.contains(a,b)||a.push(b)};\ngoog.array.insertAt=function(a,b,c){goog.array.splice(a,c,0,b)};goog.array.insertArrayAt=function(a,b,c){goog.partial(goog.array.splice,a,c,0).apply(null,b)};goog.array.insertBefore=function(a,b,c){var d;2==arguments.length||0>(d=goog.array.indexOf(a,c))?a.push(b):goog.array.insertAt(a,b,d)};goog.array.remove=function(a,b){b=goog.array.indexOf(a,b);var c;(c=0<=b)&&goog.array.removeAt(a,b);return c};\ngoog.array.removeLast=function(a,b){b=goog.array.lastIndexOf(a,b);return 0<=b?(goog.array.removeAt(a,b),!0):!1};goog.array.removeAt=function(a,b){goog.asserts.assert(null!=a.length);return 1==Array.prototype.splice.call(a,b,1).length};goog.array.removeIf=function(a,b,c){b=goog.array.findIndex(a,b,c);return 0<=b?(goog.array.removeAt(a,b),!0):!1};goog.array.removeAllIf=function(a,b,c){var d=0;goog.array.forEachRight(a,function(e,f){b.call(c,e,f,a)&&goog.array.removeAt(a,f)&&d++});return d};\ngoog.array.concat=function(a){return Array.prototype.concat.apply([],arguments)};goog.array.join=function(a){return Array.prototype.concat.apply([],arguments)};goog.array.toArray=function(a){var b=a.length;if(0<b){for(var c=Array(b),d=0;d<b;d++)c[d]=a[d];return c}return[]};goog.array.clone=goog.array.toArray;goog.array.extend=function(a,b){for(var c=1;c<arguments.length;c++){var d=arguments[c];if(goog.isArrayLike(d)){var e=a.length||0,f=d.length||0;a.length=e+f;for(var g=0;g<f;g++)a[e+g]=d[g]}else a.push(d)}};\ngoog.array.splice=function(a,b,c,d){goog.asserts.assert(null!=a.length);return Array.prototype.splice.apply(a,goog.array.slice(arguments,1))};goog.array.slice=function(a,b,c){goog.asserts.assert(null!=a.length);return 2>=arguments.length?Array.prototype.slice.call(a,b):Array.prototype.slice.call(a,b,c)};\ngoog.array.removeDuplicates=function(a,b,c){b=b||a;var d=function(a){return goog.isObject(a)?\"o\"+goog.getUid(a):(typeof a).charAt(0)+a};c=c||d;d={};for(var e=0,f=0;f<a.length;){var g=a[f++],h=c(g);Object.prototype.hasOwnProperty.call(d,h)||(d[h]=!0,b[e++]=g)}b.length=e};goog.array.binarySearch=function(a,b,c){return goog.array.binarySearch_(a,c||goog.array.defaultCompare,!1,b)};goog.array.binarySelect=function(a,b,c){return goog.array.binarySearch_(a,b,!0,void 0,c)};\ngoog.array.binarySearch_=function(a,b,c,d,e){for(var f=0,g=a.length,h;f<g;){var k=f+g>>1;var l=c?b.call(e,a[k],k,a):b(d,a[k]);0<l?f=k+1:(g=k,h=!l)}return h?f:~f};goog.array.sort=function(a,b){a.sort(b||goog.array.defaultCompare)};goog.array.stableSort=function(a,b){for(var c=Array(a.length),d=0;d<a.length;d++)c[d]={index:d,value:a[d]};var e=b||goog.array.defaultCompare;goog.array.sort(c,function(a,b){return e(a.value,b.value)||a.index-b.index});for(d=0;d<a.length;d++)a[d]=c[d].value};\ngoog.array.sortByKey=function(a,b,c){var d=c||goog.array.defaultCompare;goog.array.sort(a,function(a,c){return d(b(a),b(c))})};goog.array.sortObjectsByKey=function(a,b,c){goog.array.sortByKey(a,function(a){return a[b]},c)};goog.array.isSorted=function(a,b,c){b=b||goog.array.defaultCompare;for(var d=1;d<a.length;d++){var e=b(a[d-1],a[d]);if(0<e||0==e&&c)return!1}return!0};\ngoog.array.equals=function(a,b,c){if(!goog.isArrayLike(a)||!goog.isArrayLike(b)||a.length!=b.length)return!1;var d=a.length;c=c||goog.array.defaultCompareEquality;for(var e=0;e<d;e++)if(!c(a[e],b[e]))return!1;return!0};goog.array.compare3=function(a,b,c){c=c||goog.array.defaultCompare;for(var d=Math.min(a.length,b.length),e=0;e<d;e++){var f=c(a[e],b[e]);if(0!=f)return f}return goog.array.defaultCompare(a.length,b.length)};goog.array.defaultCompare=function(a,b){return a>b?1:a<b?-1:0};\ngoog.array.inverseDefaultCompare=function(a,b){return-goog.array.defaultCompare(a,b)};goog.array.defaultCompareEquality=function(a,b){return a===b};goog.array.binaryInsert=function(a,b,c){c=goog.array.binarySearch(a,b,c);return 0>c?(goog.array.insertAt(a,b,-(c+1)),!0):!1};goog.array.binaryRemove=function(a,b,c){b=goog.array.binarySearch(a,b,c);return 0<=b?goog.array.removeAt(a,b):!1};\ngoog.array.bucket=function(a,b,c){for(var d={},e=0;e<a.length;e++){var f=a[e],g=b.call(c,f,e,a);goog.isDef(g)&&(d[g]||(d[g]=[])).push(f)}return d};goog.array.toObject=function(a,b,c){var d={};goog.array.forEach(a,function(e,f){d[b.call(c,e,f,a)]=e});return d};goog.array.range=function(a,b,c){var d=[],e=0,f=a;c=c||1;void 0!==b&&(e=a,f=b);if(0>c*(f-e))return[];if(0<c)for(a=e;a<f;a+=c)d.push(a);else for(a=e;a>f;a+=c)d.push(a);return d};\ngoog.array.repeat=function(a,b){for(var c=[],d=0;d<b;d++)c[d]=a;return c};goog.array.flatten=function(a){for(var b=[],c=0;c<arguments.length;c++){var d=arguments[c];if(goog.isArray(d))for(var e=0;e<d.length;e+=8192){var f=goog.array.slice(d,e,e+8192);f=goog.array.flatten.apply(null,f);for(var g=0;g<f.length;g++)b.push(f[g])}else b.push(d)}return b};\ngoog.array.rotate=function(a,b){goog.asserts.assert(null!=a.length);a.length&&(b%=a.length,0<b?Array.prototype.unshift.apply(a,a.splice(-b,b)):0>b&&Array.prototype.push.apply(a,a.splice(0,-b)));return a};goog.array.moveItem=function(a,b,c){goog.asserts.assert(0<=b&&b<a.length);goog.asserts.assert(0<=c&&c<a.length);b=Array.prototype.splice.call(a,b,1);Array.prototype.splice.call(a,c,0,b[0])};\ngoog.array.zip=function(a){if(!arguments.length)return[];for(var b=[],c=arguments[0].length,d=1;d<arguments.length;d++)arguments[d].length<c&&(c=arguments[d].length);for(d=0;d<c;d++){for(var e=[],f=0;f<arguments.length;f++)e.push(arguments[f][d]);b.push(e)}return b};goog.array.shuffle=function(a,b){b=b||Math.random;for(var c=a.length-1;0<c;c--){var d=Math.floor(b()*(c+1)),e=a[c];a[c]=a[d];a[d]=e}};goog.array.copyByIndex=function(a,b){var c=[];goog.array.forEach(b,function(b){c.push(a[b])});return c};\ngoog.array.concatMap=function(a,b,c){return goog.array.concat.apply([],goog.array.map(a,b,c))};goog.crypt={};goog.crypt.stringToByteArray=function(a){for(var b=[],c=0,d=0;d<a.length;d++){var e=a.charCodeAt(d);255<e&&(b[c++]=e&255,e>>=8);b[c++]=e}return b};goog.crypt.byteArrayToString=function(a){if(8192>=a.length)return String.fromCharCode.apply(null,a);for(var b=\"\",c=0;c<a.length;c+=8192){var d=goog.array.slice(a,c,c+8192);b+=String.fromCharCode.apply(null,d)}return b};\ngoog.crypt.byteArrayToHex=function(a,b){return goog.array.map(a,function(a){a=a.toString(16);return 1<a.length?a:\"0\"+a}).join(b||\"\")};goog.crypt.hexToByteArray=function(a){goog.asserts.assert(0==a.length%2,\"Key string length must be multiple of 2\");for(var b=[],c=0;c<a.length;c+=2)b.push(parseInt(a.substring(c,c+2),16));return b};\ngoog.crypt.stringToUtf8ByteArray=function(a){for(var b=[],c=0,d=0;d<a.length;d++){var e=a.charCodeAt(d);128>e?b[c++]=e:(2048>e?b[c++]=e>>6|192:(55296==(e&64512)&&d+1<a.length&&56320==(a.charCodeAt(d+1)&64512)?(e=65536+((e&1023)<<10)+(a.charCodeAt(++d)&1023),b[c++]=e>>18|240,b[c++]=e>>12&63|128):b[c++]=e>>12|224,b[c++]=e>>6&63|128),b[c++]=e&63|128)}return b};\ngoog.crypt.utf8ByteArrayToString=function(a){for(var b=[],c=0,d=0;c<a.length;){var e=a[c++];if(128>e)b[d++]=String.fromCharCode(e);else if(191<e&&224>e){var f=a[c++];b[d++]=String.fromCharCode((e&31)<<6|f&63)}else if(239<e&&365>e){f=a[c++];var g=a[c++],h=a[c++];e=((e&7)<<18|(f&63)<<12|(g&63)<<6|h&63)-65536;b[d++]=String.fromCharCode(55296+(e>>10));b[d++]=String.fromCharCode(56320+(e&1023))}else f=a[c++],g=a[c++],b[d++]=String.fromCharCode((e&15)<<12|(f&63)<<6|g&63)}return b.join(\"\")};\ngoog.crypt.xorByteArray=function(a,b){goog.asserts.assert(a.length==b.length,\"XOR array lengths must match\");for(var c=[],d=0;d<a.length;d++)c.push(a[d]^b[d]);return c};goog.dom.asserts={};goog.dom.asserts.assertIsLocation=function(a){if(goog.asserts.ENABLE_ASSERTS){var b=goog.dom.asserts.getWindow_(a);b&&(!a||!(a instanceof b.Location)&&a instanceof b.Element)&&goog.asserts.fail(\"Argument is not a Location (or a non-Element mock); got: %s\",goog.dom.asserts.debugStringForType_(a))}return a};\ngoog.dom.asserts.assertIsElementType_=function(a,b){if(goog.asserts.ENABLE_ASSERTS){var c=goog.dom.asserts.getWindow_(a);c&&\"undefined\"!=typeof c[b]&&(a&&(a instanceof c[b]||!(a instanceof c.Location||a instanceof c.Element))||goog.asserts.fail(\"Argument is not a %s (or a non-Element, non-Location mock); got: %s\",b,goog.dom.asserts.debugStringForType_(a)))}return a};goog.dom.asserts.assertIsHTMLAnchorElement=function(a){return goog.dom.asserts.assertIsElementType_(a,\"HTMLAnchorElement\")};\ngoog.dom.asserts.assertIsHTMLButtonElement=function(a){return goog.dom.asserts.assertIsElementType_(a,\"HTMLButtonElement\")};goog.dom.asserts.assertIsHTMLLinkElement=function(a){return goog.dom.asserts.assertIsElementType_(a,\"HTMLLinkElement\")};goog.dom.asserts.assertIsHTMLImageElement=function(a){return goog.dom.asserts.assertIsElementType_(a,\"HTMLImageElement\")};goog.dom.asserts.assertIsHTMLAudioElement=function(a){return goog.dom.asserts.assertIsElementType_(a,\"HTMLAudioElement\")};\ngoog.dom.asserts.assertIsHTMLVideoElement=function(a){return goog.dom.asserts.assertIsElementType_(a,\"HTMLVideoElement\")};goog.dom.asserts.assertIsHTMLInputElement=function(a){return goog.dom.asserts.assertIsElementType_(a,\"HTMLInputElement\")};goog.dom.asserts.assertIsHTMLTextAreaElement=function(a){return goog.dom.asserts.assertIsElementType_(a,\"HTMLTextAreaElement\")};goog.dom.asserts.assertIsHTMLCanvasElement=function(a){return goog.dom.asserts.assertIsElementType_(a,\"HTMLCanvasElement\")};\ngoog.dom.asserts.assertIsHTMLEmbedElement=function(a){return goog.dom.asserts.assertIsElementType_(a,\"HTMLEmbedElement\")};goog.dom.asserts.assertIsHTMLFormElement=function(a){return goog.dom.asserts.assertIsElementType_(a,\"HTMLFormElement\")};goog.dom.asserts.assertIsHTMLFrameElement=function(a){return goog.dom.asserts.assertIsElementType_(a,\"HTMLFrameElement\")};goog.dom.asserts.assertIsHTMLIFrameElement=function(a){return goog.dom.asserts.assertIsElementType_(a,\"HTMLIFrameElement\")};\ngoog.dom.asserts.assertIsHTMLObjectElement=function(a){return goog.dom.asserts.assertIsElementType_(a,\"HTMLObjectElement\")};goog.dom.asserts.assertIsHTMLScriptElement=function(a){return goog.dom.asserts.assertIsElementType_(a,\"HTMLScriptElement\")};\ngoog.dom.asserts.debugStringForType_=function(a){if(goog.isObject(a))try{return a.constructor.displayName||a.constructor.name||Object.prototype.toString.call(a)}catch(b){return\"<object could not be stringified>\"}else return void 0===a?\"undefined\":null===a?\"null\":typeof a};goog.dom.asserts.getWindow_=function(a){try{var b=a&&a.ownerDocument,c=b&&(b.defaultView||b.parentWindow);c=c||goog.global;if(c.Element&&c.Location)return c}catch(d){}return null};goog.functions={};goog.functions.constant=function(a){return function(){return a}};goog.functions.FALSE=function(){return!1};goog.functions.TRUE=function(){return!0};goog.functions.NULL=function(){return null};goog.functions.identity=function(a,b){return a};goog.functions.error=function(a){return function(){throw Error(a);}};goog.functions.fail=function(a){return function(){throw a;}};\ngoog.functions.lock=function(a,b){b=b||0;return function(){return a.apply(this,Array.prototype.slice.call(arguments,0,b))}};goog.functions.nth=function(a){return function(){return arguments[a]}};goog.functions.partialRight=function(a,b){var c=Array.prototype.slice.call(arguments,1);return function(){var b=Array.prototype.slice.call(arguments);b.push.apply(b,c);return a.apply(this,b)}};goog.functions.withReturnValue=function(a,b){return goog.functions.sequence(a,goog.functions.constant(b))};\ngoog.functions.equalTo=function(a,b){return function(c){return b?a==c:a===c}};goog.functions.compose=function(a,b){var c=arguments,d=c.length;return function(){var a;d&&(a=c[d-1].apply(this,arguments));for(var b=d-2;0<=b;b--)a=c[b].call(this,a);return a}};goog.functions.sequence=function(a){var b=arguments,c=b.length;return function(){for(var a,e=0;e<c;e++)a=b[e].apply(this,arguments);return a}};\ngoog.functions.and=function(a){var b=arguments,c=b.length;return function(){for(var a=0;a<c;a++)if(!b[a].apply(this,arguments))return!1;return!0}};goog.functions.or=function(a){var b=arguments,c=b.length;return function(){for(var a=0;a<c;a++)if(b[a].apply(this,arguments))return!0;return!1}};goog.functions.not=function(a){return function(){return!a.apply(this,arguments)}};\ngoog.functions.create=function(a,b){var c=function(){};c.prototype=a.prototype;c=new c;a.apply(c,Array.prototype.slice.call(arguments,1));return c};goog.functions.CACHE_RETURN_VALUE=!0;goog.functions.cacheReturnValue=function(a){var b=!1,c;return function(){if(!goog.functions.CACHE_RETURN_VALUE)return a();b||(c=a(),b=!0);return c}};goog.functions.once=function(a){var b=a;return function(){if(b){var a=b;b=null;a()}}};\ngoog.functions.debounce=function(a,b,c){var d=0;return function(e){goog.global.clearTimeout(d);var f=arguments;d=goog.global.setTimeout(function(){a.apply(c,f)},b)}};goog.functions.throttle=function(a,b,c){var d=0,e=!1,f=[],g=function(){d=0;e&&(e=!1,h())},h=function(){d=goog.global.setTimeout(g,b);a.apply(c,f)};return function(a){f=arguments;d?e=!0:h()}};goog.functions.rateLimit=function(a,b,c){var d=0,e=function(){d=0};return function(f){d||(d=goog.global.setTimeout(e,b),a.apply(c,arguments))}};goog.dom.HtmlElement=function(){};goog.dom.TagName=function(a){this.tagName_=a};goog.dom.TagName.prototype.toString=function(){return this.tagName_};goog.dom.TagName.A=new goog.dom.TagName(\"A\");goog.dom.TagName.ABBR=new goog.dom.TagName(\"ABBR\");goog.dom.TagName.ACRONYM=new goog.dom.TagName(\"ACRONYM\");goog.dom.TagName.ADDRESS=new goog.dom.TagName(\"ADDRESS\");goog.dom.TagName.APPLET=new goog.dom.TagName(\"APPLET\");goog.dom.TagName.AREA=new goog.dom.TagName(\"AREA\");goog.dom.TagName.ARTICLE=new goog.dom.TagName(\"ARTICLE\");\ngoog.dom.TagName.ASIDE=new goog.dom.TagName(\"ASIDE\");goog.dom.TagName.AUDIO=new goog.dom.TagName(\"AUDIO\");goog.dom.TagName.B=new goog.dom.TagName(\"B\");goog.dom.TagName.BASE=new goog.dom.TagName(\"BASE\");goog.dom.TagName.BASEFONT=new goog.dom.TagName(\"BASEFONT\");goog.dom.TagName.BDI=new goog.dom.TagName(\"BDI\");goog.dom.TagName.BDO=new goog.dom.TagName(\"BDO\");goog.dom.TagName.BIG=new goog.dom.TagName(\"BIG\");goog.dom.TagName.BLOCKQUOTE=new goog.dom.TagName(\"BLOCKQUOTE\");goog.dom.TagName.BODY=new goog.dom.TagName(\"BODY\");\ngoog.dom.TagName.BR=new goog.dom.TagName(\"BR\");goog.dom.TagName.BUTTON=new goog.dom.TagName(\"BUTTON\");goog.dom.TagName.CANVAS=new goog.dom.TagName(\"CANVAS\");goog.dom.TagName.CAPTION=new goog.dom.TagName(\"CAPTION\");goog.dom.TagName.CENTER=new goog.dom.TagName(\"CENTER\");goog.dom.TagName.CITE=new goog.dom.TagName(\"CITE\");goog.dom.TagName.CODE=new goog.dom.TagName(\"CODE\");goog.dom.TagName.COL=new goog.dom.TagName(\"COL\");goog.dom.TagName.COLGROUP=new goog.dom.TagName(\"COLGROUP\");\ngoog.dom.TagName.COMMAND=new goog.dom.TagName(\"COMMAND\");goog.dom.TagName.DATA=new goog.dom.TagName(\"DATA\");goog.dom.TagName.DATALIST=new goog.dom.TagName(\"DATALIST\");goog.dom.TagName.DD=new goog.dom.TagName(\"DD\");goog.dom.TagName.DEL=new goog.dom.TagName(\"DEL\");goog.dom.TagName.DETAILS=new goog.dom.TagName(\"DETAILS\");goog.dom.TagName.DFN=new goog.dom.TagName(\"DFN\");goog.dom.TagName.DIALOG=new goog.dom.TagName(\"DIALOG\");goog.dom.TagName.DIR=new goog.dom.TagName(\"DIR\");goog.dom.TagName.DIV=new goog.dom.TagName(\"DIV\");\ngoog.dom.TagName.DL=new goog.dom.TagName(\"DL\");goog.dom.TagName.DT=new goog.dom.TagName(\"DT\");goog.dom.TagName.EM=new goog.dom.TagName(\"EM\");goog.dom.TagName.EMBED=new goog.dom.TagName(\"EMBED\");goog.dom.TagName.FIELDSET=new goog.dom.TagName(\"FIELDSET\");goog.dom.TagName.FIGCAPTION=new goog.dom.TagName(\"FIGCAPTION\");goog.dom.TagName.FIGURE=new goog.dom.TagName(\"FIGURE\");goog.dom.TagName.FONT=new goog.dom.TagName(\"FONT\");goog.dom.TagName.FOOTER=new goog.dom.TagName(\"FOOTER\");goog.dom.TagName.FORM=new goog.dom.TagName(\"FORM\");\ngoog.dom.TagName.FRAME=new goog.dom.TagName(\"FRAME\");goog.dom.TagName.FRAMESET=new goog.dom.TagName(\"FRAMESET\");goog.dom.TagName.H1=new goog.dom.TagName(\"H1\");goog.dom.TagName.H2=new goog.dom.TagName(\"H2\");goog.dom.TagName.H3=new goog.dom.TagName(\"H3\");goog.dom.TagName.H4=new goog.dom.TagName(\"H4\");goog.dom.TagName.H5=new goog.dom.TagName(\"H5\");goog.dom.TagName.H6=new goog.dom.TagName(\"H6\");goog.dom.TagName.HEAD=new goog.dom.TagName(\"HEAD\");goog.dom.TagName.HEADER=new goog.dom.TagName(\"HEADER\");\ngoog.dom.TagName.HGROUP=new goog.dom.TagName(\"HGROUP\");goog.dom.TagName.HR=new goog.dom.TagName(\"HR\");goog.dom.TagName.HTML=new goog.dom.TagName(\"HTML\");goog.dom.TagName.I=new goog.dom.TagName(\"I\");goog.dom.TagName.IFRAME=new goog.dom.TagName(\"IFRAME\");goog.dom.TagName.IMG=new goog.dom.TagName(\"IMG\");goog.dom.TagName.INPUT=new goog.dom.TagName(\"INPUT\");goog.dom.TagName.INS=new goog.dom.TagName(\"INS\");goog.dom.TagName.ISINDEX=new goog.dom.TagName(\"ISINDEX\");goog.dom.TagName.KBD=new goog.dom.TagName(\"KBD\");\ngoog.dom.TagName.KEYGEN=new goog.dom.TagName(\"KEYGEN\");goog.dom.TagName.LABEL=new goog.dom.TagName(\"LABEL\");goog.dom.TagName.LEGEND=new goog.dom.TagName(\"LEGEND\");goog.dom.TagName.LI=new goog.dom.TagName(\"LI\");goog.dom.TagName.LINK=new goog.dom.TagName(\"LINK\");goog.dom.TagName.MAIN=new goog.dom.TagName(\"MAIN\");goog.dom.TagName.MAP=new goog.dom.TagName(\"MAP\");goog.dom.TagName.MARK=new goog.dom.TagName(\"MARK\");goog.dom.TagName.MATH=new goog.dom.TagName(\"MATH\");goog.dom.TagName.MENU=new goog.dom.TagName(\"MENU\");\ngoog.dom.TagName.MENUITEM=new goog.dom.TagName(\"MENUITEM\");goog.dom.TagName.META=new goog.dom.TagName(\"META\");goog.dom.TagName.METER=new goog.dom.TagName(\"METER\");goog.dom.TagName.NAV=new goog.dom.TagName(\"NAV\");goog.dom.TagName.NOFRAMES=new goog.dom.TagName(\"NOFRAMES\");goog.dom.TagName.NOSCRIPT=new goog.dom.TagName(\"NOSCRIPT\");goog.dom.TagName.OBJECT=new goog.dom.TagName(\"OBJECT\");goog.dom.TagName.OL=new goog.dom.TagName(\"OL\");goog.dom.TagName.OPTGROUP=new goog.dom.TagName(\"OPTGROUP\");\ngoog.dom.TagName.OPTION=new goog.dom.TagName(\"OPTION\");goog.dom.TagName.OUTPUT=new goog.dom.TagName(\"OUTPUT\");goog.dom.TagName.P=new goog.dom.TagName(\"P\");goog.dom.TagName.PARAM=new goog.dom.TagName(\"PARAM\");goog.dom.TagName.PICTURE=new goog.dom.TagName(\"PICTURE\");goog.dom.TagName.PRE=new goog.dom.TagName(\"PRE\");goog.dom.TagName.PROGRESS=new goog.dom.TagName(\"PROGRESS\");goog.dom.TagName.Q=new goog.dom.TagName(\"Q\");goog.dom.TagName.RP=new goog.dom.TagName(\"RP\");goog.dom.TagName.RT=new goog.dom.TagName(\"RT\");\ngoog.dom.TagName.RTC=new goog.dom.TagName(\"RTC\");goog.dom.TagName.RUBY=new goog.dom.TagName(\"RUBY\");goog.dom.TagName.S=new goog.dom.TagName(\"S\");goog.dom.TagName.SAMP=new goog.dom.TagName(\"SAMP\");goog.dom.TagName.SCRIPT=new goog.dom.TagName(\"SCRIPT\");goog.dom.TagName.SECTION=new goog.dom.TagName(\"SECTION\");goog.dom.TagName.SELECT=new goog.dom.TagName(\"SELECT\");goog.dom.TagName.SMALL=new goog.dom.TagName(\"SMALL\");goog.dom.TagName.SOURCE=new goog.dom.TagName(\"SOURCE\");goog.dom.TagName.SPAN=new goog.dom.TagName(\"SPAN\");\ngoog.dom.TagName.STRIKE=new goog.dom.TagName(\"STRIKE\");goog.dom.TagName.STRONG=new goog.dom.TagName(\"STRONG\");goog.dom.TagName.STYLE=new goog.dom.TagName(\"STYLE\");goog.dom.TagName.SUB=new goog.dom.TagName(\"SUB\");goog.dom.TagName.SUMMARY=new goog.dom.TagName(\"SUMMARY\");goog.dom.TagName.SUP=new goog.dom.TagName(\"SUP\");goog.dom.TagName.SVG=new goog.dom.TagName(\"SVG\");goog.dom.TagName.TABLE=new goog.dom.TagName(\"TABLE\");goog.dom.TagName.TBODY=new goog.dom.TagName(\"TBODY\");goog.dom.TagName.TD=new goog.dom.TagName(\"TD\");\ngoog.dom.TagName.TEMPLATE=new goog.dom.TagName(\"TEMPLATE\");goog.dom.TagName.TEXTAREA=new goog.dom.TagName(\"TEXTAREA\");goog.dom.TagName.TFOOT=new goog.dom.TagName(\"TFOOT\");goog.dom.TagName.TH=new goog.dom.TagName(\"TH\");goog.dom.TagName.THEAD=new goog.dom.TagName(\"THEAD\");goog.dom.TagName.TIME=new goog.dom.TagName(\"TIME\");goog.dom.TagName.TITLE=new goog.dom.TagName(\"TITLE\");goog.dom.TagName.TR=new goog.dom.TagName(\"TR\");goog.dom.TagName.TRACK=new goog.dom.TagName(\"TRACK\");goog.dom.TagName.TT=new goog.dom.TagName(\"TT\");\ngoog.dom.TagName.U=new goog.dom.TagName(\"U\");goog.dom.TagName.UL=new goog.dom.TagName(\"UL\");goog.dom.TagName.VAR=new goog.dom.TagName(\"VAR\");goog.dom.TagName.VIDEO=new goog.dom.TagName(\"VIDEO\");goog.dom.TagName.WBR=new goog.dom.TagName(\"WBR\");goog.dom.tags={};goog.dom.tags.VOID_TAGS_={area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0};goog.dom.tags.isVoidTag=function(a){return!0===goog.dom.tags.VOID_TAGS_[a]};goog.html={};goog.html.trustedtypes={};goog.html.trustedtypes.PRIVATE_DO_NOT_ACCESS_OR_ELSE_POLICY=goog.TRUSTED_TYPES_POLICY_NAME?goog.createTrustedTypesPolicy(goog.TRUSTED_TYPES_POLICY_NAME+\"#html\"):null;goog.string={};goog.string.TypedString=function(){};goog.string.Const=function(a,b){this.stringConstValueWithSecurityContract__googStringSecurityPrivate_=a===goog.string.Const.GOOG_STRING_CONSTRUCTOR_TOKEN_PRIVATE_&&b||\"\";this.STRING_CONST_TYPE_MARKER__GOOG_STRING_SECURITY_PRIVATE_=goog.string.Const.TYPE_MARKER_};goog.string.Const.prototype.implementsGoogStringTypedString=!0;goog.string.Const.prototype.getTypedStringValue=function(){return this.stringConstValueWithSecurityContract__googStringSecurityPrivate_};\ngoog.string.Const.prototype.toString=function(){return\"Const{\"+this.stringConstValueWithSecurityContract__googStringSecurityPrivate_+\"}\"};goog.string.Const.unwrap=function(a){if(a instanceof goog.string.Const&&a.constructor===goog.string.Const&&a.STRING_CONST_TYPE_MARKER__GOOG_STRING_SECURITY_PRIVATE_===goog.string.Const.TYPE_MARKER_)return a.stringConstValueWithSecurityContract__googStringSecurityPrivate_;goog.asserts.fail(\"expected object of type Const, got '\"+a+\"'\");return\"type_error:Const\"};\ngoog.string.Const.from=function(a){return new goog.string.Const(goog.string.Const.GOOG_STRING_CONSTRUCTOR_TOKEN_PRIVATE_,a)};goog.string.Const.TYPE_MARKER_={};goog.string.Const.GOOG_STRING_CONSTRUCTOR_TOKEN_PRIVATE_={};goog.string.Const.EMPTY=goog.string.Const.from(\"\");goog.html.SafeScript=function(){this.privateDoNotAccessOrElseSafeScriptWrappedValue_=\"\";this.SAFE_SCRIPT_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_=goog.html.SafeScript.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_};goog.html.SafeScript.prototype.implementsGoogStringTypedString=!0;goog.html.SafeScript.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_={};goog.html.SafeScript.fromConstant=function(a){a=goog.string.Const.unwrap(a);return 0===a.length?goog.html.SafeScript.EMPTY:goog.html.SafeScript.createSafeScriptSecurityPrivateDoNotAccessOrElse(a)};\ngoog.html.SafeScript.fromConstantAndArgs=function(a,b){for(var c=[],d=1;d<arguments.length;d++)c.push(goog.html.SafeScript.stringify_(arguments[d]));return goog.html.SafeScript.createSafeScriptSecurityPrivateDoNotAccessOrElse(\"(\"+goog.string.Const.unwrap(a)+\")(\"+c.join(\", \")+\");\")};goog.html.SafeScript.fromJson=function(a){return goog.html.SafeScript.createSafeScriptSecurityPrivateDoNotAccessOrElse(goog.html.SafeScript.stringify_(a))};goog.html.SafeScript.prototype.getTypedStringValue=function(){return this.privateDoNotAccessOrElseSafeScriptWrappedValue_.toString()};\ngoog.DEBUG&&(goog.html.SafeScript.prototype.toString=function(){return\"SafeScript{\"+this.privateDoNotAccessOrElseSafeScriptWrappedValue_+\"}\"});goog.html.SafeScript.unwrap=function(a){return goog.html.SafeScript.unwrapTrustedScript(a).toString()};\ngoog.html.SafeScript.unwrapTrustedScript=function(a){if(a instanceof goog.html.SafeScript&&a.constructor===goog.html.SafeScript&&a.SAFE_SCRIPT_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_===goog.html.SafeScript.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_)return a.privateDoNotAccessOrElseSafeScriptWrappedValue_;goog.asserts.fail(\"expected object of type SafeScript, got '\"+a+\"' of type \"+goog.typeOf(a));return\"type_error:SafeScript\"};\ngoog.html.SafeScript.stringify_=function(a){return JSON.stringify(a).replace(/</g,\"\\\\x3c\")};goog.html.SafeScript.createSafeScriptSecurityPrivateDoNotAccessOrElse=function(a){return(new goog.html.SafeScript).initSecurityPrivateDoNotAccessOrElse_(a)};\ngoog.html.SafeScript.prototype.initSecurityPrivateDoNotAccessOrElse_=function(a){this.privateDoNotAccessOrElseSafeScriptWrappedValue_=goog.html.trustedtypes.PRIVATE_DO_NOT_ACCESS_OR_ELSE_POLICY?goog.html.trustedtypes.PRIVATE_DO_NOT_ACCESS_OR_ELSE_POLICY.createScript(a):a;return this};goog.html.SafeScript.EMPTY=goog.html.SafeScript.createSafeScriptSecurityPrivateDoNotAccessOrElse(\"\");goog.fs={};goog.fs.url={};goog.fs.url.createObjectUrl=function(a){return goog.fs.url.getUrlObject_().createObjectURL(a)};goog.fs.url.revokeObjectUrl=function(a){goog.fs.url.getUrlObject_().revokeObjectURL(a)};goog.fs.url.getUrlObject_=function(){var a=goog.fs.url.findUrlObject_();if(null!=a)return a;throw Error(\"This browser doesn't seem to support blob URLs\");};\ngoog.fs.url.findUrlObject_=function(){return goog.isDef(goog.global.URL)&&goog.isDef(goog.global.URL.createObjectURL)?goog.global.URL:goog.isDef(goog.global.webkitURL)&&goog.isDef(goog.global.webkitURL.createObjectURL)?goog.global.webkitURL:goog.isDef(goog.global.createObjectURL)?goog.global:null};goog.fs.url.browserSupportsObjectUrls=function(){return null!=goog.fs.url.findUrlObject_()};goog.i18n={};goog.i18n.bidi={};goog.i18n.bidi.FORCE_RTL=!1;\ngoog.i18n.bidi.IS_RTL=goog.i18n.bidi.FORCE_RTL||(\"ar\"==goog.LOCALE.substring(0,2).toLowerCase()||\"fa\"==goog.LOCALE.substring(0,2).toLowerCase()||\"he\"==goog.LOCALE.substring(0,2).toLowerCase()||\"iw\"==goog.LOCALE.substring(0,2).toLowerCase()||\"ps\"==goog.LOCALE.substring(0,2).toLowerCase()||\"sd\"==goog.LOCALE.substring(0,2).toLowerCase()||\"ug\"==goog.LOCALE.substring(0,2).toLowerCase()||\"ur\"==goog.LOCALE.substring(0,2).toLowerCase()||\"yi\"==goog.LOCALE.substring(0,2).toLowerCase())&&(2==goog.LOCALE.length||\n\"-\"==goog.LOCALE.substring(2,3)||\"_\"==goog.LOCALE.substring(2,3))||3<=goog.LOCALE.length&&\"ckb\"==goog.LOCALE.substring(0,3).toLowerCase()&&(3==goog.LOCALE.length||\"-\"==goog.LOCALE.substring(3,4)||\"_\"==goog.LOCALE.substring(3,4))||7<=goog.LOCALE.length&&(\"-\"==goog.LOCALE.substring(2,3)||\"_\"==goog.LOCALE.substring(2,3))&&(\"adlm\"==goog.LOCALE.substring(3,7).toLowerCase()||\"arab\"==goog.LOCALE.substring(3,7).toLowerCase()||\"hebr\"==goog.LOCALE.substring(3,7).toLowerCase()||\"nkoo\"==goog.LOCALE.substring(3,\n7).toLowerCase()||\"rohg\"==goog.LOCALE.substring(3,7).toLowerCase()||\"thaa\"==goog.LOCALE.substring(3,7).toLowerCase())||8<=goog.LOCALE.length&&(\"-\"==goog.LOCALE.substring(3,4)||\"_\"==goog.LOCALE.substring(3,4))&&(\"adlm\"==goog.LOCALE.substring(4,8).toLowerCase()||\"arab\"==goog.LOCALE.substring(4,8).toLowerCase()||\"hebr\"==goog.LOCALE.substring(4,8).toLowerCase()||\"nkoo\"==goog.LOCALE.substring(4,8).toLowerCase()||\"rohg\"==goog.LOCALE.substring(4,8).toLowerCase()||\"thaa\"==goog.LOCALE.substring(4,8).toLowerCase());\ngoog.i18n.bidi.Format={LRE:\"\\u202a\",RLE:\"\\u202b\",PDF:\"\\u202c\",LRM:\"\\u200e\",RLM:\"\\u200f\"};goog.i18n.bidi.Dir={LTR:1,RTL:-1,NEUTRAL:0};goog.i18n.bidi.RIGHT=\"right\";goog.i18n.bidi.LEFT=\"left\";goog.i18n.bidi.I18N_RIGHT=goog.i18n.bidi.IS_RTL?goog.i18n.bidi.LEFT:goog.i18n.bidi.RIGHT;goog.i18n.bidi.I18N_LEFT=goog.i18n.bidi.IS_RTL?goog.i18n.bidi.RIGHT:goog.i18n.bidi.LEFT;\ngoog.i18n.bidi.toDir=function(a,b){return\"number\"==typeof a?0<a?goog.i18n.bidi.Dir.LTR:0>a?goog.i18n.bidi.Dir.RTL:b?null:goog.i18n.bidi.Dir.NEUTRAL:null==a?null:a?goog.i18n.bidi.Dir.RTL:goog.i18n.bidi.Dir.LTR};goog.i18n.bidi.ltrChars_=\"A-Za-z\\u00c0-\\u00d6\\u00d8-\\u00f6\\u00f8-\\u02b8\\u0300-\\u0590\\u0900-\\u1fff\\u200e\\u2c00-\\ud801\\ud804-\\ud839\\ud83c-\\udbff\\uf900-\\ufb1c\\ufe00-\\ufe6f\\ufefd-\\uffff\";goog.i18n.bidi.rtlChars_=\"\\u0591-\\u06ef\\u06fa-\\u08ff\\u200f\\ud802-\\ud803\\ud83a-\\ud83b\\ufb1d-\\ufdff\\ufe70-\\ufefc\";\ngoog.i18n.bidi.htmlSkipReg_=/<[^>]*>|&[^;]+;/g;goog.i18n.bidi.stripHtmlIfNeeded_=function(a,b){return b?a.replace(goog.i18n.bidi.htmlSkipReg_,\"\"):a};goog.i18n.bidi.rtlCharReg_=new RegExp(\"[\"+goog.i18n.bidi.rtlChars_+\"]\");goog.i18n.bidi.ltrCharReg_=new RegExp(\"[\"+goog.i18n.bidi.ltrChars_+\"]\");goog.i18n.bidi.hasAnyRtl=function(a,b){return goog.i18n.bidi.rtlCharReg_.test(goog.i18n.bidi.stripHtmlIfNeeded_(a,b))};goog.i18n.bidi.hasRtlChar=goog.i18n.bidi.hasAnyRtl;\ngoog.i18n.bidi.hasAnyLtr=function(a,b){return goog.i18n.bidi.ltrCharReg_.test(goog.i18n.bidi.stripHtmlIfNeeded_(a,b))};goog.i18n.bidi.ltrRe_=new RegExp(\"^[\"+goog.i18n.bidi.ltrChars_+\"]\");goog.i18n.bidi.rtlRe_=new RegExp(\"^[\"+goog.i18n.bidi.rtlChars_+\"]\");goog.i18n.bidi.isRtlChar=function(a){return goog.i18n.bidi.rtlRe_.test(a)};goog.i18n.bidi.isLtrChar=function(a){return goog.i18n.bidi.ltrRe_.test(a)};goog.i18n.bidi.isNeutralChar=function(a){return!goog.i18n.bidi.isLtrChar(a)&&!goog.i18n.bidi.isRtlChar(a)};\ngoog.i18n.bidi.ltrDirCheckRe_=new RegExp(\"^[^\"+goog.i18n.bidi.rtlChars_+\"]*[\"+goog.i18n.bidi.ltrChars_+\"]\");goog.i18n.bidi.rtlDirCheckRe_=new RegExp(\"^[^\"+goog.i18n.bidi.ltrChars_+\"]*[\"+goog.i18n.bidi.rtlChars_+\"]\");goog.i18n.bidi.startsWithRtl=function(a,b){return goog.i18n.bidi.rtlDirCheckRe_.test(goog.i18n.bidi.stripHtmlIfNeeded_(a,b))};goog.i18n.bidi.isRtlText=goog.i18n.bidi.startsWithRtl;\ngoog.i18n.bidi.startsWithLtr=function(a,b){return goog.i18n.bidi.ltrDirCheckRe_.test(goog.i18n.bidi.stripHtmlIfNeeded_(a,b))};goog.i18n.bidi.isLtrText=goog.i18n.bidi.startsWithLtr;goog.i18n.bidi.isRequiredLtrRe_=/^http:\\/\\/.*/;goog.i18n.bidi.isNeutralText=function(a,b){a=goog.i18n.bidi.stripHtmlIfNeeded_(a,b);return goog.i18n.bidi.isRequiredLtrRe_.test(a)||!goog.i18n.bidi.hasAnyLtr(a)&&!goog.i18n.bidi.hasAnyRtl(a)};\ngoog.i18n.bidi.ltrExitDirCheckRe_=new RegExp(\"[\"+goog.i18n.bidi.ltrChars_+\"][^\"+goog.i18n.bidi.rtlChars_+\"]*$\");goog.i18n.bidi.rtlExitDirCheckRe_=new RegExp(\"[\"+goog.i18n.bidi.rtlChars_+\"][^\"+goog.i18n.bidi.ltrChars_+\"]*$\");goog.i18n.bidi.endsWithLtr=function(a,b){return goog.i18n.bidi.ltrExitDirCheckRe_.test(goog.i18n.bidi.stripHtmlIfNeeded_(a,b))};goog.i18n.bidi.isLtrExitText=goog.i18n.bidi.endsWithLtr;\ngoog.i18n.bidi.endsWithRtl=function(a,b){return goog.i18n.bidi.rtlExitDirCheckRe_.test(goog.i18n.bidi.stripHtmlIfNeeded_(a,b))};goog.i18n.bidi.isRtlExitText=goog.i18n.bidi.endsWithRtl;goog.i18n.bidi.rtlLocalesRe_=/^(ar|ckb|dv|he|iw|fa|nqo|ps|sd|ug|ur|yi|.*[-_](Adlm|Arab|Hebr|Nkoo|Rohg|Thaa))(?!.*[-_](Latn|Cyrl)($|-|_))($|-|_)/i;goog.i18n.bidi.isRtlLanguage=function(a){return goog.i18n.bidi.rtlLocalesRe_.test(a)};goog.i18n.bidi.bracketGuardTextRe_=/(\\(.*?\\)+)|(\\[.*?\\]+)|(\\{.*?\\}+)|(<.*?>+)/g;\ngoog.i18n.bidi.guardBracketInText=function(a,b){b=(void 0===b?goog.i18n.bidi.hasAnyRtl(a):b)?goog.i18n.bidi.Format.RLM:goog.i18n.bidi.Format.LRM;return a.replace(goog.i18n.bidi.bracketGuardTextRe_,b+\"$&\"+b)};goog.i18n.bidi.enforceRtlInHtml=function(a){return\"<\"==a.charAt(0)?a.replace(/<\\w+/,\"$& dir=rtl\"):\"\\n<span dir=rtl>\"+a+\"</span>\"};goog.i18n.bidi.enforceRtlInText=function(a){return goog.i18n.bidi.Format.RLE+a+goog.i18n.bidi.Format.PDF};\ngoog.i18n.bidi.enforceLtrInHtml=function(a){return\"<\"==a.charAt(0)?a.replace(/<\\w+/,\"$& dir=ltr\"):\"\\n<span dir=ltr>\"+a+\"</span>\"};goog.i18n.bidi.enforceLtrInText=function(a){return goog.i18n.bidi.Format.LRE+a+goog.i18n.bidi.Format.PDF};goog.i18n.bidi.dimensionsRe_=/:\\s*([.\\d][.\\w]*)\\s+([.\\d][.\\w]*)\\s+([.\\d][.\\w]*)\\s+([.\\d][.\\w]*)/g;goog.i18n.bidi.leftRe_=/left/gi;goog.i18n.bidi.rightRe_=/right/gi;goog.i18n.bidi.tempRe_=/%%%%/g;\ngoog.i18n.bidi.mirrorCSS=function(a){return a.replace(goog.i18n.bidi.dimensionsRe_,\":$1 $4 $3 $2\").replace(goog.i18n.bidi.leftRe_,\"%%%%\").replace(goog.i18n.bidi.rightRe_,goog.i18n.bidi.LEFT).replace(goog.i18n.bidi.tempRe_,goog.i18n.bidi.RIGHT)};goog.i18n.bidi.doubleQuoteSubstituteRe_=/([\\u0591-\\u05f2])\"/g;goog.i18n.bidi.singleQuoteSubstituteRe_=/([\\u0591-\\u05f2])'/g;\ngoog.i18n.bidi.normalizeHebrewQuote=function(a){return a.replace(goog.i18n.bidi.doubleQuoteSubstituteRe_,\"$1\\u05f4\").replace(goog.i18n.bidi.singleQuoteSubstituteRe_,\"$1\\u05f3\")};goog.i18n.bidi.wordSeparatorRe_=/\\s+/;goog.i18n.bidi.hasNumeralsRe_=/[\\d\\u06f0-\\u06f9]/;goog.i18n.bidi.rtlDetectionThreshold_=.4;\ngoog.i18n.bidi.estimateDirection=function(a,b){var c=0,d=0,e=!1;a=goog.i18n.bidi.stripHtmlIfNeeded_(a,b).split(goog.i18n.bidi.wordSeparatorRe_);for(b=0;b<a.length;b++){var f=a[b];goog.i18n.bidi.startsWithRtl(f)?(c++,d++):goog.i18n.bidi.isRequiredLtrRe_.test(f)?e=!0:goog.i18n.bidi.hasAnyLtr(f)?d++:goog.i18n.bidi.hasNumeralsRe_.test(f)&&(e=!0)}return 0==d?e?goog.i18n.bidi.Dir.LTR:goog.i18n.bidi.Dir.NEUTRAL:c/d>goog.i18n.bidi.rtlDetectionThreshold_?goog.i18n.bidi.Dir.RTL:goog.i18n.bidi.Dir.LTR};\ngoog.i18n.bidi.detectRtlDirectionality=function(a,b){return goog.i18n.bidi.estimateDirection(a,b)==goog.i18n.bidi.Dir.RTL};goog.i18n.bidi.setElementDirAndAlign=function(a,b){a&&(b=goog.i18n.bidi.toDir(b))&&(a.style.textAlign=b==goog.i18n.bidi.Dir.RTL?goog.i18n.bidi.RIGHT:goog.i18n.bidi.LEFT,a.dir=b==goog.i18n.bidi.Dir.RTL?\"rtl\":\"ltr\")};\ngoog.i18n.bidi.setElementDirByTextDirectionality=function(a,b){switch(goog.i18n.bidi.estimateDirection(b)){case goog.i18n.bidi.Dir.LTR:a.dir=\"ltr\";break;case goog.i18n.bidi.Dir.RTL:a.dir=\"rtl\";break;default:a.removeAttribute(\"dir\")}};goog.i18n.bidi.DirectionalString=function(){};goog.html.TrustedResourceUrl=function(){this.privateDoNotAccessOrElseTrustedResourceUrlWrappedValue_=\"\";this.trustedURL_=null;this.TRUSTED_RESOURCE_URL_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_=goog.html.TrustedResourceUrl.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_};goog.html.TrustedResourceUrl.prototype.implementsGoogStringTypedString=!0;goog.html.TrustedResourceUrl.prototype.getTypedStringValue=function(){return this.privateDoNotAccessOrElseTrustedResourceUrlWrappedValue_.toString()};\ngoog.html.TrustedResourceUrl.prototype.implementsGoogI18nBidiDirectionalString=!0;goog.html.TrustedResourceUrl.prototype.getDirection=function(){return goog.i18n.bidi.Dir.LTR};\ngoog.html.TrustedResourceUrl.prototype.cloneWithParams=function(a,b){var c=goog.html.TrustedResourceUrl.unwrap(this);c=goog.html.TrustedResourceUrl.URL_PARAM_PARSER_.exec(c);var d=c[3]||\"\";return goog.html.TrustedResourceUrl.createTrustedResourceUrlSecurityPrivateDoNotAccessOrElse(c[1]+goog.html.TrustedResourceUrl.stringifyParams_(\"?\",c[2]||\"\",a)+goog.html.TrustedResourceUrl.stringifyParams_(\"#\",d,b))};\ngoog.DEBUG&&(goog.html.TrustedResourceUrl.prototype.toString=function(){return\"TrustedResourceUrl{\"+this.privateDoNotAccessOrElseTrustedResourceUrlWrappedValue_+\"}\"});goog.html.TrustedResourceUrl.unwrap=function(a){return goog.html.TrustedResourceUrl.unwrapTrustedScriptURL(a).toString()};\ngoog.html.TrustedResourceUrl.unwrapTrustedScriptURL=function(a){if(a instanceof goog.html.TrustedResourceUrl&&a.constructor===goog.html.TrustedResourceUrl&&a.TRUSTED_RESOURCE_URL_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_===goog.html.TrustedResourceUrl.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_)return a.privateDoNotAccessOrElseTrustedResourceUrlWrappedValue_;goog.asserts.fail(\"expected object of type TrustedResourceUrl, got '\"+a+\"' of type \"+goog.typeOf(a));return\"type_error:TrustedResourceUrl\"};\ngoog.html.TrustedResourceUrl.unwrapTrustedURL=function(a){return a.trustedURL_?a.trustedURL_:goog.html.TrustedResourceUrl.unwrap(a)};\ngoog.html.TrustedResourceUrl.format=function(a,b){var c=goog.string.Const.unwrap(a);if(!goog.html.TrustedResourceUrl.BASE_URL_.test(c))throw Error(\"Invalid TrustedResourceUrl format: \"+c);a=c.replace(goog.html.TrustedResourceUrl.FORMAT_MARKER_,function(a,e){if(!Object.prototype.hasOwnProperty.call(b,e))throw Error('Found marker, \"'+e+'\", in format string, \"'+c+'\", but no valid label mapping found in args: '+JSON.stringify(b));a=b[e];return a instanceof goog.string.Const?goog.string.Const.unwrap(a):\nencodeURIComponent(String(a))});return goog.html.TrustedResourceUrl.createTrustedResourceUrlSecurityPrivateDoNotAccessOrElse(a)};goog.html.TrustedResourceUrl.FORMAT_MARKER_=/%{(\\w+)}/g;goog.html.TrustedResourceUrl.BASE_URL_=/^((https:)?\\/\\/[0-9a-z.:[\\]-]+\\/|\\/[^/\\\\]|[^:/\\\\%]+\\/|[^:/\\\\%]*[?#]|about:blank#)/i;goog.html.TrustedResourceUrl.URL_PARAM_PARSER_=/^([^?#]*)(\\?[^#]*)?(#[\\s\\S]*)?/;\ngoog.html.TrustedResourceUrl.formatWithParams=function(a,b,c,d){return goog.html.TrustedResourceUrl.format(a,b).cloneWithParams(c,d)};goog.html.TrustedResourceUrl.fromConstant=function(a){return goog.html.TrustedResourceUrl.createTrustedResourceUrlSecurityPrivateDoNotAccessOrElse(goog.string.Const.unwrap(a))};goog.html.TrustedResourceUrl.fromConstants=function(a){for(var b=\"\",c=0;c<a.length;c++)b+=goog.string.Const.unwrap(a[c]);return goog.html.TrustedResourceUrl.createTrustedResourceUrlSecurityPrivateDoNotAccessOrElse(b)};\ngoog.html.TrustedResourceUrl.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_={};\ngoog.html.TrustedResourceUrl.createTrustedResourceUrlSecurityPrivateDoNotAccessOrElse=function(a){var b=new goog.html.TrustedResourceUrl;b.privateDoNotAccessOrElseTrustedResourceUrlWrappedValue_=goog.html.trustedtypes.PRIVATE_DO_NOT_ACCESS_OR_ELSE_POLICY?goog.html.trustedtypes.PRIVATE_DO_NOT_ACCESS_OR_ELSE_POLICY.createScriptURL(a):a;goog.html.trustedtypes.PRIVATE_DO_NOT_ACCESS_OR_ELSE_POLICY&&(b.trustedURL_=goog.html.trustedtypes.PRIVATE_DO_NOT_ACCESS_OR_ELSE_POLICY.createURL(a));return b};\ngoog.html.TrustedResourceUrl.stringifyParams_=function(a,b,c){if(null==c)return b;if(goog.isString(c))return c?a+encodeURIComponent(c):\"\";for(var d in c){var e=c[d];e=goog.isArray(e)?e:[e];for(var f=0;f<e.length;f++){var g=e[f];null!=g&&(b||(b=a),b+=(b.length>a.length?\"&\":\"\")+encodeURIComponent(d)+\"=\"+encodeURIComponent(String(g)))}}return b};goog.string.internal={};goog.string.internal.startsWith=function(a,b){return 0==a.lastIndexOf(b,0)};goog.string.internal.endsWith=function(a,b){var c=a.length-b.length;return 0<=c&&a.indexOf(b,c)==c};goog.string.internal.caseInsensitiveStartsWith=function(a,b){return 0==goog.string.internal.caseInsensitiveCompare(b,a.substr(0,b.length))};goog.string.internal.caseInsensitiveEndsWith=function(a,b){return 0==goog.string.internal.caseInsensitiveCompare(b,a.substr(a.length-b.length,b.length))};\ngoog.string.internal.caseInsensitiveEquals=function(a,b){return a.toLowerCase()==b.toLowerCase()};goog.string.internal.isEmptyOrWhitespace=function(a){return/^[\\s\\xa0]*$/.test(a)};goog.string.internal.trim=goog.TRUSTED_SITE&&String.prototype.trim?function(a){return a.trim()}:function(a){return/^[\\s\\xa0]*([\\s\\S]*?)[\\s\\xa0]*$/.exec(a)[1]};goog.string.internal.caseInsensitiveCompare=function(a,b){a=String(a).toLowerCase();b=String(b).toLowerCase();return a<b?-1:a==b?0:1};\ngoog.string.internal.newLineToBr=function(a,b){return a.replace(/(\\r\\n|\\r|\\n)/g,b?\"<br />\":\"<br>\")};\ngoog.string.internal.htmlEscape=function(a,b){if(b)a=a.replace(goog.string.internal.AMP_RE_,\"&\").replace(goog.string.internal.LT_RE_,\"<\").replace(goog.string.internal.GT_RE_,\">\").replace(goog.string.internal.QUOT_RE_,\""\").replace(goog.string.internal.SINGLE_QUOTE_RE_,\"'\").replace(goog.string.internal.NULL_RE_,\"�\");else{if(!goog.string.internal.ALL_RE_.test(a))return a;-1!=a.indexOf(\"&\")&&(a=a.replace(goog.string.internal.AMP_RE_,\"&\"));-1!=a.indexOf(\"<\")&&(a=a.replace(goog.string.internal.LT_RE_,\n\"<\"));-1!=a.indexOf(\">\")&&(a=a.replace(goog.string.internal.GT_RE_,\">\"));-1!=a.indexOf('\"')&&(a=a.replace(goog.string.internal.QUOT_RE_,\""\"));-1!=a.indexOf(\"'\")&&(a=a.replace(goog.string.internal.SINGLE_QUOTE_RE_,\"'\"));-1!=a.indexOf(\"\\x00\")&&(a=a.replace(goog.string.internal.NULL_RE_,\"�\"))}return a};goog.string.internal.AMP_RE_=/&/g;goog.string.internal.LT_RE_=/</g;goog.string.internal.GT_RE_=/>/g;goog.string.internal.QUOT_RE_=/\"/g;goog.string.internal.SINGLE_QUOTE_RE_=/'/g;\ngoog.string.internal.NULL_RE_=/\\x00/g;goog.string.internal.ALL_RE_=/[\\x00&<>\"']/;goog.string.internal.whitespaceEscape=function(a,b){return goog.string.internal.newLineToBr(a.replace(/ /g,\"  \"),b)};goog.string.internal.contains=function(a,b){return-1!=a.indexOf(b)};goog.string.internal.caseInsensitiveContains=function(a,b){return goog.string.internal.contains(a.toLowerCase(),b.toLowerCase())};\ngoog.string.internal.compareVersions=function(a,b){var c=0;a=goog.string.internal.trim(String(a)).split(\".\");b=goog.string.internal.trim(String(b)).split(\".\");for(var d=Math.max(a.length,b.length),e=0;0==c&&e<d;e++){var f=a[e]||\"\",g=b[e]||\"\";do{f=/(\\d*)(\\D*)(.*)/.exec(f)||[\"\",\"\",\"\",\"\"];g=/(\\d*)(\\D*)(.*)/.exec(g)||[\"\",\"\",\"\",\"\"];if(0==f[0].length&&0==g[0].length)break;c=0==f[1].length?0:parseInt(f[1],10);var h=0==g[1].length?0:parseInt(g[1],10);c=goog.string.internal.compareElements_(c,h)||goog.string.internal.compareElements_(0==\nf[2].length,0==g[2].length)||goog.string.internal.compareElements_(f[2],g[2]);f=f[3];g=g[3]}while(0==c)}return c};goog.string.internal.compareElements_=function(a,b){return a<b?-1:a>b?1:0};goog.html.SafeUrl=function(){this.privateDoNotAccessOrElseSafeUrlWrappedValue_=\"\";this.SAFE_URL_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_=goog.html.SafeUrl.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_};goog.html.SafeUrl.INNOCUOUS_STRING=\"about:invalid#zClosurez\";goog.html.SafeUrl.prototype.implementsGoogStringTypedString=!0;goog.html.SafeUrl.prototype.getTypedStringValue=function(){return this.privateDoNotAccessOrElseSafeUrlWrappedValue_.toString()};\ngoog.html.SafeUrl.prototype.implementsGoogI18nBidiDirectionalString=!0;goog.html.SafeUrl.prototype.getDirection=function(){return goog.i18n.bidi.Dir.LTR};goog.DEBUG&&(goog.html.SafeUrl.prototype.toString=function(){return\"SafeUrl{\"+this.privateDoNotAccessOrElseSafeUrlWrappedValue_+\"}\"});goog.html.SafeUrl.unwrap=function(a){return goog.html.SafeUrl.unwrapTrustedURL(a).toString()};\ngoog.html.SafeUrl.unwrapTrustedURL=function(a){if(a instanceof goog.html.SafeUrl&&a.constructor===goog.html.SafeUrl&&a.SAFE_URL_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_===goog.html.SafeUrl.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_)return a.privateDoNotAccessOrElseSafeUrlWrappedValue_;goog.asserts.fail(\"expected object of type SafeUrl, got '\"+a+\"' of type \"+goog.typeOf(a));return\"type_error:SafeUrl\"};goog.html.SafeUrl.fromConstant=function(a){return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(goog.string.Const.unwrap(a))};\ngoog.html.SAFE_MIME_TYPE_PATTERN_=/^(?:audio\\/(?:3gpp2|3gpp|aac|L16|midi|mp3|mp4|mpeg|oga|ogg|opus|x-m4a|x-wav|wav|webm)|image\\/(?:bmp|gif|jpeg|jpg|png|tiff|webp|x-icon)|text\\/csv|video\\/(?:mpeg|mp4|ogg|webm|quicktime))(?:;\\w+=(?:\\w+|\"[\\w;=]+\"))*$/i;goog.html.SafeUrl.isSafeMimeType=function(a){return goog.html.SAFE_MIME_TYPE_PATTERN_.test(a)};goog.html.SafeUrl.fromBlob=function(a){a=goog.html.SAFE_MIME_TYPE_PATTERN_.test(a.type)?goog.fs.url.createObjectUrl(a):goog.html.SafeUrl.INNOCUOUS_STRING;return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(a)};\ngoog.html.DATA_URL_PATTERN_=/^data:([^,]*);base64,[a-z0-9+\\/]+=*$/i;goog.html.SafeUrl.fromDataUrl=function(a){a=a.replace(/(%0A|%0D)/g,\"\");var b=a.match(goog.html.DATA_URL_PATTERN_);b=b&&goog.html.SAFE_MIME_TYPE_PATTERN_.test(b[1]);return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(b?a:goog.html.SafeUrl.INNOCUOUS_STRING)};goog.html.SafeUrl.fromTelUrl=function(a){goog.string.internal.caseInsensitiveStartsWith(a,\"tel:\")||(a=goog.html.SafeUrl.INNOCUOUS_STRING);return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(a)};\ngoog.html.SIP_URL_PATTERN_=/^sip[s]?:[+a-z0-9_.!$%&'*\\/=^`{|}~-]+@([a-z0-9-]+\\.)+[a-z0-9]{2,63}$/i;goog.html.SafeUrl.fromSipUrl=function(a){goog.html.SIP_URL_PATTERN_.test(decodeURIComponent(a))||(a=goog.html.SafeUrl.INNOCUOUS_STRING);return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(a)};goog.html.SafeUrl.fromFacebookMessengerUrl=function(a){goog.string.internal.caseInsensitiveStartsWith(a,\"fb-messenger://share\")||(a=goog.html.SafeUrl.INNOCUOUS_STRING);return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(a)};\ngoog.html.SafeUrl.fromWhatsAppUrl=function(a){goog.string.internal.caseInsensitiveStartsWith(a,\"whatsapp://send\")||(a=goog.html.SafeUrl.INNOCUOUS_STRING);return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(a)};goog.html.SafeUrl.fromSmsUrl=function(a){goog.string.internal.caseInsensitiveStartsWith(a,\"sms:\")&&goog.html.SafeUrl.isSmsUrlBodyValid_(a)||(a=goog.html.SafeUrl.INNOCUOUS_STRING);return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(a)};\ngoog.html.SafeUrl.isSmsUrlBodyValid_=function(a){var b=a.indexOf(\"#\");0<b&&(a=a.substring(0,b));b=a.match(/[?&]body=/gi);if(!b)return!0;if(1<b.length)return!1;a=a.match(/[?&]body=([^&]*)/)[1];if(!a)return!0;try{decodeURIComponent(a)}catch(c){return!1}return/^(?:[a-z0-9\\-_.~]|%[0-9a-f]{2})+$/i.test(a)};goog.html.SafeUrl.fromSshUrl=function(a){goog.string.internal.caseInsensitiveStartsWith(a,\"ssh://\")||(a=goog.html.SafeUrl.INNOCUOUS_STRING);return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(a)};\ngoog.html.SafeUrl.sanitizeChromeExtensionUrl=function(a,b){return goog.html.SafeUrl.sanitizeExtensionUrl_(/^chrome-extension:\\/\\/([^\\/]+)\\//,a,b)};goog.html.SafeUrl.sanitizeFirefoxExtensionUrl=function(a,b){return goog.html.SafeUrl.sanitizeExtensionUrl_(/^moz-extension:\\/\\/([^\\/]+)\\//,a,b)};goog.html.SafeUrl.sanitizeEdgeExtensionUrl=function(a,b){return goog.html.SafeUrl.sanitizeExtensionUrl_(/^ms-browser-extension:\\/\\/([^\\/]+)\\//,a,b)};\ngoog.html.SafeUrl.sanitizeExtensionUrl_=function(a,b,c){(a=a.exec(b))?(a=a[1],-1==(c instanceof goog.string.Const?[goog.string.Const.unwrap(c)]:c.map(function(a){return goog.string.Const.unwrap(a)})).indexOf(a)&&(b=goog.html.SafeUrl.INNOCUOUS_STRING)):b=goog.html.SafeUrl.INNOCUOUS_STRING;return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(b)};goog.html.SafeUrl.fromTrustedResourceUrl=function(a){return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(goog.html.TrustedResourceUrl.unwrap(a))};\ngoog.html.SAFE_URL_PATTERN_=/^(?:(?:https?|mailto|ftp):|[^:/?#]*(?:[/?#]|$))/i;goog.html.SafeUrl.SAFE_URL_PATTERN=goog.html.SAFE_URL_PATTERN_;goog.html.SafeUrl.sanitize=function(a){if(a instanceof goog.html.SafeUrl)return a;a=\"object\"==typeof a&&a.implementsGoogStringTypedString?a.getTypedStringValue():String(a);goog.html.SAFE_URL_PATTERN_.test(a)||(a=goog.html.SafeUrl.INNOCUOUS_STRING);return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(a)};\ngoog.html.SafeUrl.sanitizeAssertUnchanged=function(a,b){if(a instanceof goog.html.SafeUrl)return a;a=\"object\"==typeof a&&a.implementsGoogStringTypedString?a.getTypedStringValue():String(a);if(b&&/^data:/i.test(a)&&(b=goog.html.SafeUrl.fromDataUrl(a),b.getTypedStringValue()==a))return b;goog.asserts.assert(goog.html.SAFE_URL_PATTERN_.test(a),\"%s does not match the safe URL pattern\",a)||(a=goog.html.SafeUrl.INNOCUOUS_STRING);return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(a)};\ngoog.html.SafeUrl.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_={};goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse=function(a){var b=new goog.html.SafeUrl;b.privateDoNotAccessOrElseSafeUrlWrappedValue_=goog.html.trustedtypes.PRIVATE_DO_NOT_ACCESS_OR_ELSE_POLICY?goog.html.trustedtypes.PRIVATE_DO_NOT_ACCESS_OR_ELSE_POLICY.createURL(a):a;return b};goog.html.SafeUrl.ABOUT_BLANK=goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(\"about:blank\");goog.html.SafeStyle=function(){this.privateDoNotAccessOrElseSafeStyleWrappedValue_=\"\";this.SAFE_STYLE_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_=goog.html.SafeStyle.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_};goog.html.SafeStyle.prototype.implementsGoogStringTypedString=!0;goog.html.SafeStyle.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_={};\ngoog.html.SafeStyle.fromConstant=function(a){a=goog.string.Const.unwrap(a);if(0===a.length)return goog.html.SafeStyle.EMPTY;goog.asserts.assert(goog.string.internal.endsWith(a,\";\"),\"Last character of style string is not ';': \"+a);goog.asserts.assert(goog.string.internal.contains(a,\":\"),\"Style string must contain at least one ':', to specify a \\\"name: value\\\" pair: \"+a);return goog.html.SafeStyle.createSafeStyleSecurityPrivateDoNotAccessOrElse(a)};\ngoog.html.SafeStyle.prototype.getTypedStringValue=function(){return this.privateDoNotAccessOrElseSafeStyleWrappedValue_};goog.DEBUG&&(goog.html.SafeStyle.prototype.toString=function(){return\"SafeStyle{\"+this.privateDoNotAccessOrElseSafeStyleWrappedValue_+\"}\"});\ngoog.html.SafeStyle.unwrap=function(a){if(a instanceof goog.html.SafeStyle&&a.constructor===goog.html.SafeStyle&&a.SAFE_STYLE_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_===goog.html.SafeStyle.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_)return a.privateDoNotAccessOrElseSafeStyleWrappedValue_;goog.asserts.fail(\"expected object of type SafeStyle, got '\"+a+\"' of type \"+goog.typeOf(a));return\"type_error:SafeStyle\"};goog.html.SafeStyle.createSafeStyleSecurityPrivateDoNotAccessOrElse=function(a){return(new goog.html.SafeStyle).initSecurityPrivateDoNotAccessOrElse_(a)};\ngoog.html.SafeStyle.prototype.initSecurityPrivateDoNotAccessOrElse_=function(a){this.privateDoNotAccessOrElseSafeStyleWrappedValue_=a;return this};goog.html.SafeStyle.EMPTY=goog.html.SafeStyle.createSafeStyleSecurityPrivateDoNotAccessOrElse(\"\");goog.html.SafeStyle.INNOCUOUS_STRING=\"zClosurez\";\ngoog.html.SafeStyle.create=function(a){var b=\"\",c;for(c in a){if(!/^[-_a-zA-Z0-9]+$/.test(c))throw Error(\"Name allows only [-_a-zA-Z0-9], got: \"+c);var d=a[c];null!=d&&(d=goog.isArray(d)?goog.array.map(d,goog.html.SafeStyle.sanitizePropertyValue_).join(\" \"):goog.html.SafeStyle.sanitizePropertyValue_(d),b+=c+\":\"+d+\";\")}return b?goog.html.SafeStyle.createSafeStyleSecurityPrivateDoNotAccessOrElse(b):goog.html.SafeStyle.EMPTY};\ngoog.html.SafeStyle.sanitizePropertyValue_=function(a){if(a instanceof goog.html.SafeUrl)return'url(\"'+goog.html.SafeUrl.unwrap(a).replace(/</g,\"%3c\").replace(/[\\\\\"]/g,\"\\\\$&\")+'\")';a=a instanceof goog.string.Const?goog.string.Const.unwrap(a):goog.html.SafeStyle.sanitizePropertyValueString_(String(a));if(/[{;}]/.test(a))throw new goog.asserts.AssertionError(\"Value does not allow [{;}], got: %s.\",[a]);return a};\ngoog.html.SafeStyle.sanitizePropertyValueString_=function(a){var b=a.replace(goog.html.SafeStyle.FUNCTIONS_RE_,\"$1\").replace(goog.html.SafeStyle.FUNCTIONS_RE_,\"$1\").replace(goog.html.SafeStyle.URL_RE_,\"url\");if(goog.html.SafeStyle.VALUE_RE_.test(b)){if(goog.html.SafeStyle.COMMENT_RE_.test(a))return goog.asserts.fail(\"String value disallows comments, got: \"+a),goog.html.SafeStyle.INNOCUOUS_STRING;if(!goog.html.SafeStyle.hasBalancedQuotes_(a))return goog.asserts.fail(\"String value requires balanced quotes, got: \"+\na),goog.html.SafeStyle.INNOCUOUS_STRING;if(!goog.html.SafeStyle.hasBalancedSquareBrackets_(a))return goog.asserts.fail(\"String value requires balanced square brackets and one identifier per pair of brackets, got: \"+a),goog.html.SafeStyle.INNOCUOUS_STRING}else return goog.asserts.fail(\"String value allows only \"+goog.html.SafeStyle.VALUE_ALLOWED_CHARS_+\" and simple functions, got: \"+a),goog.html.SafeStyle.INNOCUOUS_STRING;return goog.html.SafeStyle.sanitizeUrl_(a)};\ngoog.html.SafeStyle.hasBalancedQuotes_=function(a){for(var b=!0,c=!0,d=0;d<a.length;d++){var e=a.charAt(d);\"'\"==e&&c?b=!b:'\"'==e&&b&&(c=!c)}return b&&c};goog.html.SafeStyle.hasBalancedSquareBrackets_=function(a){for(var b=!0,c=/^[-_a-zA-Z0-9]$/,d=0;d<a.length;d++){var e=a.charAt(d);if(\"]\"==e){if(b)return!1;b=!0}else if(\"[\"==e){if(!b)return!1;b=!1}else if(!b&&!c.test(e))return!1}return b};goog.html.SafeStyle.VALUE_ALLOWED_CHARS_=\"[-,.\\\"'%_!# a-zA-Z0-9\\\\[\\\\]]\";\ngoog.html.SafeStyle.VALUE_RE_=new RegExp(\"^\"+goog.html.SafeStyle.VALUE_ALLOWED_CHARS_+\"+$\");goog.html.SafeStyle.URL_RE_=/\\b(url\\([ \\t\\n]*)('[ -&(-\\[\\]-~]*'|\"[ !#-\\[\\]-~]*\"|[!#-&*-\\[\\]-~]*)([ \\t\\n]*\\))/g;goog.html.SafeStyle.FUNCTIONS_RE_=/\\b(hsl|hsla|rgb|rgba|matrix|calc|minmax|fit-content|repeat|(rotate|scale|translate)(X|Y|Z|3d)?)\\([-+*/0-9a-z.%\\[\\], ]+\\)/g;goog.html.SafeStyle.COMMENT_RE_=/\\/\\*/;\ngoog.html.SafeStyle.sanitizeUrl_=function(a){return a.replace(goog.html.SafeStyle.URL_RE_,function(a,c,d,e){var b=\"\";d=d.replace(/^(['\"])(.*)\\1$/,function(a,c,d){b=c;return d});a=goog.html.SafeUrl.sanitize(d).getTypedStringValue();return c+b+a+b+e})};goog.html.SafeStyle.concat=function(a){var b=\"\",c=function(a){goog.isArray(a)?goog.array.forEach(a,c):b+=goog.html.SafeStyle.unwrap(a)};goog.array.forEach(arguments,c);return b?goog.html.SafeStyle.createSafeStyleSecurityPrivateDoNotAccessOrElse(b):goog.html.SafeStyle.EMPTY};goog.html.SafeStyleSheet=function(){this.privateDoNotAccessOrElseSafeStyleSheetWrappedValue_=\"\";this.SAFE_STYLE_SHEET_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_=goog.html.SafeStyleSheet.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_};goog.html.SafeStyleSheet.prototype.implementsGoogStringTypedString=!0;goog.html.SafeStyleSheet.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_={};\ngoog.html.SafeStyleSheet.createRule=function(a,b){if(goog.string.internal.contains(a,\"<\"))throw Error(\"Selector does not allow '<', got: \"+a);var c=a.replace(/('|\")((?!\\1)[^\\r\\n\\f\\\\]|\\\\[\\s\\S])*\\1/g,\"\");if(!/^[-_a-zA-Z0-9#.:* ,>+~[\\]()=^$|]+$/.test(c))throw Error(\"Selector allows only [-_a-zA-Z0-9#.:* ,>+~[\\\\]()=^$|] and strings, got: \"+a);if(!goog.html.SafeStyleSheet.hasBalancedBrackets_(c))throw Error(\"() and [] in selector must be balanced, got: \"+a);b instanceof goog.html.SafeStyle||(b=goog.html.SafeStyle.create(b));\na=a+\"{\"+goog.html.SafeStyle.unwrap(b).replace(/</g,\"\\\\3C \")+\"}\";return goog.html.SafeStyleSheet.createSafeStyleSheetSecurityPrivateDoNotAccessOrElse(a)};goog.html.SafeStyleSheet.hasBalancedBrackets_=function(a){for(var b={\"(\":\")\",\"[\":\"]\"},c=[],d=0;d<a.length;d++){var e=a[d];if(b[e])c.push(b[e]);else if(goog.object.contains(b,e)&&c.pop()!=e)return!1}return 0==c.length};\ngoog.html.SafeStyleSheet.concat=function(a){var b=\"\",c=function(a){goog.isArray(a)?goog.array.forEach(a,c):b+=goog.html.SafeStyleSheet.unwrap(a)};goog.array.forEach(arguments,c);return goog.html.SafeStyleSheet.createSafeStyleSheetSecurityPrivateDoNotAccessOrElse(b)};\ngoog.html.SafeStyleSheet.fromConstant=function(a){a=goog.string.Const.unwrap(a);if(0===a.length)return goog.html.SafeStyleSheet.EMPTY;goog.asserts.assert(!goog.string.internal.contains(a,\"<\"),\"Forbidden '<' character in style sheet string: \"+a);return goog.html.SafeStyleSheet.createSafeStyleSheetSecurityPrivateDoNotAccessOrElse(a)};goog.html.SafeStyleSheet.prototype.getTypedStringValue=function(){return this.privateDoNotAccessOrElseSafeStyleSheetWrappedValue_};\ngoog.DEBUG&&(goog.html.SafeStyleSheet.prototype.toString=function(){return\"SafeStyleSheet{\"+this.privateDoNotAccessOrElseSafeStyleSheetWrappedValue_+\"}\"});\ngoog.html.SafeStyleSheet.unwrap=function(a){if(a instanceof goog.html.SafeStyleSheet&&a.constructor===goog.html.SafeStyleSheet&&a.SAFE_STYLE_SHEET_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_===goog.html.SafeStyleSheet.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_)return a.privateDoNotAccessOrElseSafeStyleSheetWrappedValue_;goog.asserts.fail(\"expected object of type SafeStyleSheet, got '\"+a+\"' of type \"+goog.typeOf(a));return\"type_error:SafeStyleSheet\"};\ngoog.html.SafeStyleSheet.createSafeStyleSheetSecurityPrivateDoNotAccessOrElse=function(a){return(new goog.html.SafeStyleSheet).initSecurityPrivateDoNotAccessOrElse_(a)};goog.html.SafeStyleSheet.prototype.initSecurityPrivateDoNotAccessOrElse_=function(a){this.privateDoNotAccessOrElseSafeStyleSheetWrappedValue_=a;return this};goog.html.SafeStyleSheet.EMPTY=goog.html.SafeStyleSheet.createSafeStyleSheetSecurityPrivateDoNotAccessOrElse(\"\");goog.labs={};goog.labs.userAgent={};goog.labs.userAgent.util={};goog.labs.userAgent.util.getNativeUserAgentString_=function(){var a=goog.labs.userAgent.util.getNavigator_();return a&&(a=a.userAgent)?a:\"\"};goog.labs.userAgent.util.getNavigator_=function(){return goog.global.navigator};goog.labs.userAgent.util.userAgent_=goog.labs.userAgent.util.getNativeUserAgentString_();goog.labs.userAgent.util.setUserAgent=function(a){goog.labs.userAgent.util.userAgent_=a||goog.labs.userAgent.util.getNativeUserAgentString_()};\ngoog.labs.userAgent.util.getUserAgent=function(){return goog.labs.userAgent.util.userAgent_};goog.labs.userAgent.util.matchUserAgent=function(a){var b=goog.labs.userAgent.util.getUserAgent();return goog.string.internal.contains(b,a)};goog.labs.userAgent.util.matchUserAgentIgnoreCase=function(a){var b=goog.labs.userAgent.util.getUserAgent();return goog.string.internal.caseInsensitiveContains(b,a)};\ngoog.labs.userAgent.util.extractVersionTuples=function(a){for(var b=/(\\w[\\w ]+)\\/([^\\s]+)\\s*(?:\\((.*?)\\))?/g,c=[],d;d=b.exec(a);)c.push([d[1],d[2],d[3]||void 0]);return c};goog.labs.userAgent.browser={};goog.labs.userAgent.browser.matchOpera_=function(){return goog.labs.userAgent.util.matchUserAgent(\"Opera\")};goog.labs.userAgent.browser.matchIE_=function(){return goog.labs.userAgent.util.matchUserAgent(\"Trident\")||goog.labs.userAgent.util.matchUserAgent(\"MSIE\")};goog.labs.userAgent.browser.matchEdgeHtml_=function(){return goog.labs.userAgent.util.matchUserAgent(\"Edge\")};goog.labs.userAgent.browser.matchEdgeChromium_=function(){return goog.labs.userAgent.util.matchUserAgent(\"Edg/\")};\ngoog.labs.userAgent.browser.matchOperaChromium_=function(){return goog.labs.userAgent.util.matchUserAgent(\"OPR\")};goog.labs.userAgent.browser.matchFirefox_=function(){return goog.labs.userAgent.util.matchUserAgent(\"Firefox\")||goog.labs.userAgent.util.matchUserAgent(\"FxiOS\")};\ngoog.labs.userAgent.browser.matchSafari_=function(){return goog.labs.userAgent.util.matchUserAgent(\"Safari\")&&!(goog.labs.userAgent.browser.matchChrome_()||goog.labs.userAgent.browser.matchCoast_()||goog.labs.userAgent.browser.matchOpera_()||goog.labs.userAgent.browser.matchEdgeHtml_()||goog.labs.userAgent.browser.matchEdgeChromium_()||goog.labs.userAgent.browser.matchOperaChromium_()||goog.labs.userAgent.browser.matchFirefox_()||goog.labs.userAgent.browser.isSilk()||goog.labs.userAgent.util.matchUserAgent(\"Android\"))};\ngoog.labs.userAgent.browser.matchCoast_=function(){return goog.labs.userAgent.util.matchUserAgent(\"Coast\")};goog.labs.userAgent.browser.matchIosWebview_=function(){return(goog.labs.userAgent.util.matchUserAgent(\"iPad\")||goog.labs.userAgent.util.matchUserAgent(\"iPhone\"))&&!goog.labs.userAgent.browser.matchSafari_()&&!goog.labs.userAgent.browser.matchChrome_()&&!goog.labs.userAgent.browser.matchCoast_()&&!goog.labs.userAgent.browser.matchFirefox_()&&goog.labs.userAgent.util.matchUserAgent(\"AppleWebKit\")};\ngoog.labs.userAgent.browser.matchChrome_=function(){return(goog.labs.userAgent.util.matchUserAgent(\"Chrome\")||goog.labs.userAgent.util.matchUserAgent(\"CriOS\"))&&!goog.labs.userAgent.browser.matchEdgeHtml_()};goog.labs.userAgent.browser.matchAndroidBrowser_=function(){return goog.labs.userAgent.util.matchUserAgent(\"Android\")&&!(goog.labs.userAgent.browser.isChrome()||goog.labs.userAgent.browser.isFirefox()||goog.labs.userAgent.browser.isOpera()||goog.labs.userAgent.browser.isSilk())};\ngoog.labs.userAgent.browser.isOpera=goog.labs.userAgent.browser.matchOpera_;goog.labs.userAgent.browser.isIE=goog.labs.userAgent.browser.matchIE_;goog.labs.userAgent.browser.isEdge=goog.labs.userAgent.browser.matchEdgeHtml_;goog.labs.userAgent.browser.isEdgeChromium=goog.labs.userAgent.browser.matchEdgeChromium_;goog.labs.userAgent.browser.isOperaChromium=goog.labs.userAgent.browser.matchOperaChromium_;goog.labs.userAgent.browser.isFirefox=goog.labs.userAgent.browser.matchFirefox_;\ngoog.labs.userAgent.browser.isSafari=goog.labs.userAgent.browser.matchSafari_;goog.labs.userAgent.browser.isCoast=goog.labs.userAgent.browser.matchCoast_;goog.labs.userAgent.browser.isIosWebview=goog.labs.userAgent.browser.matchIosWebview_;goog.labs.userAgent.browser.isChrome=goog.labs.userAgent.browser.matchChrome_;goog.labs.userAgent.browser.isAndroidBrowser=goog.labs.userAgent.browser.matchAndroidBrowser_;goog.labs.userAgent.browser.isSilk=function(){return goog.labs.userAgent.util.matchUserAgent(\"Silk\")};\ngoog.labs.userAgent.browser.getVersion=function(){function a(a){a=goog.array.find(a,d);return c[a]||\"\"}var b=goog.labs.userAgent.util.getUserAgent();if(goog.labs.userAgent.browser.isIE())return goog.labs.userAgent.browser.getIEVersion_(b);b=goog.labs.userAgent.util.extractVersionTuples(b);var c={};goog.array.forEach(b,function(a){c[a[0]]=a[1]});var d=goog.partial(goog.object.containsKey,c);return goog.labs.userAgent.browser.isOpera()?a([\"Version\",\"Opera\"]):goog.labs.userAgent.browser.isEdge()?a([\"Edge\"]):\ngoog.labs.userAgent.browser.isEdgeChromium()?a([\"Edg\"]):goog.labs.userAgent.browser.isChrome()?a([\"Chrome\",\"CriOS\"]):(b=b[2])&&b[1]||\"\"};goog.labs.userAgent.browser.isVersionOrHigher=function(a){return 0<=goog.string.internal.compareVersions(goog.labs.userAgent.browser.getVersion(),a)};\ngoog.labs.userAgent.browser.getIEVersion_=function(a){var b=/rv: *([\\d\\.]*)/.exec(a);if(b&&b[1])return b[1];b=\"\";var c=/MSIE +([\\d\\.]+)/.exec(a);if(c&&c[1])if(a=/Trident\\/(\\d.\\d)/.exec(a),\"7.0\"==c[1])if(a&&a[1])switch(a[1]){case \"4.0\":b=\"8.0\";break;case \"5.0\":b=\"9.0\";break;case \"6.0\":b=\"10.0\";break;case \"7.0\":b=\"11.0\"}else b=\"7.0\";else b=c[1];return b};goog.html.SafeHtml=function(){this.privateDoNotAccessOrElseSafeHtmlWrappedValue_=\"\";this.SAFE_HTML_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_=goog.html.SafeHtml.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_;this.dir_=null};goog.html.SafeHtml.prototype.implementsGoogI18nBidiDirectionalString=!0;goog.html.SafeHtml.prototype.getDirection=function(){return this.dir_};goog.html.SafeHtml.prototype.implementsGoogStringTypedString=!0;goog.html.SafeHtml.prototype.getTypedStringValue=function(){return this.privateDoNotAccessOrElseSafeHtmlWrappedValue_.toString()};\ngoog.DEBUG&&(goog.html.SafeHtml.prototype.toString=function(){return\"SafeHtml{\"+this.privateDoNotAccessOrElseSafeHtmlWrappedValue_+\"}\"});goog.html.SafeHtml.unwrap=function(a){return goog.html.SafeHtml.unwrapTrustedHTML(a).toString()};\ngoog.html.SafeHtml.unwrapTrustedHTML=function(a){if(a instanceof goog.html.SafeHtml&&a.constructor===goog.html.SafeHtml&&a.SAFE_HTML_TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_===goog.html.SafeHtml.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_)return a.privateDoNotAccessOrElseSafeHtmlWrappedValue_;goog.asserts.fail(\"expected object of type SafeHtml, got '\"+a+\"' of type \"+goog.typeOf(a));return\"type_error:SafeHtml\"};\ngoog.html.SafeHtml.htmlEscape=function(a){if(a instanceof goog.html.SafeHtml)return a;var b=\"object\"==typeof a,c=null;b&&a.implementsGoogI18nBidiDirectionalString&&(c=a.getDirection());a=b&&a.implementsGoogStringTypedString?a.getTypedStringValue():String(a);return goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse(goog.string.internal.htmlEscape(a),c)};\ngoog.html.SafeHtml.htmlEscapePreservingNewlines=function(a){if(a instanceof goog.html.SafeHtml)return a;a=goog.html.SafeHtml.htmlEscape(a);return goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse(goog.string.internal.newLineToBr(goog.html.SafeHtml.unwrap(a)),a.getDirection())};\ngoog.html.SafeHtml.htmlEscapePreservingNewlinesAndSpaces=function(a){if(a instanceof goog.html.SafeHtml)return a;a=goog.html.SafeHtml.htmlEscape(a);return goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse(goog.string.internal.whitespaceEscape(goog.html.SafeHtml.unwrap(a)),a.getDirection())};goog.html.SafeHtml.from=goog.html.SafeHtml.htmlEscape;goog.html.SafeHtml.VALID_NAMES_IN_TAG_=/^[a-zA-Z0-9-]+$/;\ngoog.html.SafeHtml.URL_ATTRIBUTES_={action:!0,cite:!0,data:!0,formaction:!0,href:!0,manifest:!0,poster:!0,src:!0};goog.html.SafeHtml.NOT_ALLOWED_TAG_NAMES_={APPLET:!0,BASE:!0,EMBED:!0,IFRAME:!0,LINK:!0,MATH:!0,META:!0,OBJECT:!0,SCRIPT:!0,STYLE:!0,SVG:!0,TEMPLATE:!0};goog.html.SafeHtml.create=function(a,b,c){goog.html.SafeHtml.verifyTagName(String(a));return goog.html.SafeHtml.createSafeHtmlTagSecurityPrivateDoNotAccessOrElse(String(a),b,c)};\ngoog.html.SafeHtml.verifyTagName=function(a){if(!goog.html.SafeHtml.VALID_NAMES_IN_TAG_.test(a))throw Error(\"Invalid tag name <\"+a+\">.\");if(a.toUpperCase()in goog.html.SafeHtml.NOT_ALLOWED_TAG_NAMES_)throw Error(\"Tag name <\"+a+\"> is not allowed for SafeHtml.\");};\ngoog.html.SafeHtml.createIframe=function(a,b,c,d){a&&goog.html.TrustedResourceUrl.unwrap(a);var e={};e.src=a||null;e.srcdoc=b&&goog.html.SafeHtml.unwrap(b);a=goog.html.SafeHtml.combineAttributes(e,{sandbox:\"\"},c);return goog.html.SafeHtml.createSafeHtmlTagSecurityPrivateDoNotAccessOrElse(\"iframe\",a,d)};\ngoog.html.SafeHtml.createSandboxIframe=function(a,b,c,d){if(!goog.html.SafeHtml.canUseSandboxIframe())throw Error(\"The browser does not support sandboxed iframes.\");var e={};e.src=a?goog.html.SafeUrl.unwrap(goog.html.SafeUrl.sanitize(a)):null;e.srcdoc=b||null;e.sandbox=\"\";a=goog.html.SafeHtml.combineAttributes(e,{},c);return goog.html.SafeHtml.createSafeHtmlTagSecurityPrivateDoNotAccessOrElse(\"iframe\",a,d)};\ngoog.html.SafeHtml.canUseSandboxIframe=function(){return goog.global.HTMLIFrameElement&&\"sandbox\"in goog.global.HTMLIFrameElement.prototype};goog.html.SafeHtml.createScriptSrc=function(a,b){goog.html.TrustedResourceUrl.unwrap(a);a=goog.html.SafeHtml.combineAttributes({src:a},{},b);return goog.html.SafeHtml.createSafeHtmlTagSecurityPrivateDoNotAccessOrElse(\"script\",a)};\ngoog.html.SafeHtml.createScript=function(a,b){for(var c in b){var d=c.toLowerCase();if(\"language\"==d||\"src\"==d||\"text\"==d||\"type\"==d)throw Error('Cannot set \"'+d+'\" attribute');}c=\"\";a=goog.array.concat(a);for(d=0;d<a.length;d++)c+=goog.html.SafeScript.unwrap(a[d]);a=goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse(c,goog.i18n.bidi.Dir.NEUTRAL);return goog.html.SafeHtml.createSafeHtmlTagSecurityPrivateDoNotAccessOrElse(\"script\",b,a)};\ngoog.html.SafeHtml.createStyle=function(a,b){b=goog.html.SafeHtml.combineAttributes({type:\"text/css\"},{},b);var c=\"\";a=goog.array.concat(a);for(var d=0;d<a.length;d++)c+=goog.html.SafeStyleSheet.unwrap(a[d]);a=goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse(c,goog.i18n.bidi.Dir.NEUTRAL);return goog.html.SafeHtml.createSafeHtmlTagSecurityPrivateDoNotAccessOrElse(\"style\",b,a)};\ngoog.html.SafeHtml.createMetaRefresh=function(a,b){a=goog.html.SafeUrl.unwrap(goog.html.SafeUrl.sanitize(a));(goog.labs.userAgent.browser.isIE()||goog.labs.userAgent.browser.isEdge())&&goog.string.internal.contains(a,\";\")&&(a=\"'\"+a.replace(/'/g,\"%27\")+\"'\");return goog.html.SafeHtml.createSafeHtmlTagSecurityPrivateDoNotAccessOrElse(\"meta\",{\"http-equiv\":\"refresh\",content:(b||0)+\"; url=\"+a})};\ngoog.html.SafeHtml.getAttrNameAndValue_=function(a,b,c){if(c instanceof goog.string.Const)c=goog.string.Const.unwrap(c);else if(\"style\"==b.toLowerCase())c=goog.html.SafeHtml.getStyleValue_(c);else{if(/^on/i.test(b))throw Error('Attribute \"'+b+'\" requires goog.string.Const value, \"'+c+'\" given.');if(b.toLowerCase()in goog.html.SafeHtml.URL_ATTRIBUTES_)if(c instanceof goog.html.TrustedResourceUrl)c=goog.html.TrustedResourceUrl.unwrap(c);else if(c instanceof goog.html.SafeUrl)c=goog.html.SafeUrl.unwrap(c);\nelse if(goog.isString(c))c=goog.html.SafeUrl.sanitize(c).getTypedStringValue();else throw Error('Attribute \"'+b+'\" on tag \"'+a+'\" requires goog.html.SafeUrl, goog.string.Const, or string, value \"'+c+'\" given.');}c.implementsGoogStringTypedString&&(c=c.getTypedStringValue());goog.asserts.assert(goog.isString(c)||goog.isNumber(c),\"String or number value expected, got \"+typeof c+\" with value: \"+c);return b+'=\"'+goog.string.internal.htmlEscape(String(c))+'\"'};\ngoog.html.SafeHtml.getStyleValue_=function(a){if(!goog.isObject(a))throw Error('The \"style\" attribute requires goog.html.SafeStyle or map of style properties, '+typeof a+\" given: \"+a);a instanceof goog.html.SafeStyle||(a=goog.html.SafeStyle.create(a));return goog.html.SafeStyle.unwrap(a)};goog.html.SafeHtml.createWithDir=function(a,b,c,d){b=goog.html.SafeHtml.create(b,c,d);b.dir_=a;return b};\ngoog.html.SafeHtml.join=function(a,b){a=goog.html.SafeHtml.htmlEscape(a);var c=a.getDirection(),d=[],e=function(a){goog.isArray(a)?goog.array.forEach(a,e):(a=goog.html.SafeHtml.htmlEscape(a),d.push(goog.html.SafeHtml.unwrap(a)),a=a.getDirection(),c==goog.i18n.bidi.Dir.NEUTRAL?c=a:a!=goog.i18n.bidi.Dir.NEUTRAL&&c!=a&&(c=null))};goog.array.forEach(b,e);return goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse(d.join(goog.html.SafeHtml.unwrap(a)),c)};\ngoog.html.SafeHtml.concat=function(a){return goog.html.SafeHtml.join(goog.html.SafeHtml.EMPTY,Array.prototype.slice.call(arguments))};goog.html.SafeHtml.concatWithDir=function(a,b){var c=goog.html.SafeHtml.concat(goog.array.slice(arguments,1));c.dir_=a;return c};goog.html.SafeHtml.TYPE_MARKER_GOOG_HTML_SECURITY_PRIVATE_={};goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse=function(a,b){return(new goog.html.SafeHtml).initSecurityPrivateDoNotAccessOrElse_(a,b)};\ngoog.html.SafeHtml.prototype.initSecurityPrivateDoNotAccessOrElse_=function(a,b){this.privateDoNotAccessOrElseSafeHtmlWrappedValue_=goog.html.trustedtypes.PRIVATE_DO_NOT_ACCESS_OR_ELSE_POLICY?goog.html.trustedtypes.PRIVATE_DO_NOT_ACCESS_OR_ELSE_POLICY.createHTML(a):a;this.dir_=b;return this};\ngoog.html.SafeHtml.createSafeHtmlTagSecurityPrivateDoNotAccessOrElse=function(a,b,c){var d=null;var e=\"<\"+a+goog.html.SafeHtml.stringifyAttributes(a,b);goog.isDefAndNotNull(c)?goog.isArray(c)||(c=[c]):c=[];goog.dom.tags.isVoidTag(a.toLowerCase())?(goog.asserts.assert(!c.length,\"Void tag <\"+a+\"> does not allow content.\"),e+=\">\"):(d=goog.html.SafeHtml.concat(c),e+=\">\"+goog.html.SafeHtml.unwrap(d)+\"</\"+a+\">\",d=d.getDirection());(a=b&&b.dir)&&(d=/^(ltr|rtl|auto)$/i.test(a)?goog.i18n.bidi.Dir.NEUTRAL:\nnull);return goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse(e,d)};goog.html.SafeHtml.stringifyAttributes=function(a,b){var c=\"\";if(b)for(var d in b){if(!goog.html.SafeHtml.VALID_NAMES_IN_TAG_.test(d))throw Error('Invalid attribute name \"'+d+'\".');var e=b[d];goog.isDefAndNotNull(e)&&(c+=\" \"+goog.html.SafeHtml.getAttrNameAndValue_(a,d,e))}return c};\ngoog.html.SafeHtml.combineAttributes=function(a,b,c){var d={},e;for(e in a)goog.asserts.assert(e.toLowerCase()==e,\"Must be lower case\"),d[e]=a[e];for(e in b)goog.asserts.assert(e.toLowerCase()==e,\"Must be lower case\"),d[e]=b[e];for(e in c){var f=e.toLowerCase();if(f in a)throw Error('Cannot override \"'+f+'\" attribute, got \"'+e+'\" with value \"'+c[e]+'\"');f in b&&delete d[f];d[e]=c[e]}return d};\ngoog.html.SafeHtml.DOCTYPE_HTML=goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse(\"<!DOCTYPE html>\",goog.i18n.bidi.Dir.NEUTRAL);goog.html.SafeHtml.EMPTY=goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse(\"\",goog.i18n.bidi.Dir.NEUTRAL);goog.html.SafeHtml.BR=goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse(\"<br>\",goog.i18n.bidi.Dir.NEUTRAL);goog.html.uncheckedconversions={};goog.html.uncheckedconversions.safeHtmlFromStringKnownToSatisfyTypeContract=function(a,b,c){goog.asserts.assertString(goog.string.Const.unwrap(a),\"must provide justification\");goog.asserts.assert(!goog.string.internal.isEmptyOrWhitespace(goog.string.Const.unwrap(a)),\"must provide non-empty justification\");return goog.html.SafeHtml.createSafeHtmlSecurityPrivateDoNotAccessOrElse(b,c||null)};\ngoog.html.uncheckedconversions.safeScriptFromStringKnownToSatisfyTypeContract=function(a,b){goog.asserts.assertString(goog.string.Const.unwrap(a),\"must provide justification\");goog.asserts.assert(!goog.string.internal.isEmptyOrWhitespace(goog.string.Const.unwrap(a)),\"must provide non-empty justification\");return goog.html.SafeScript.createSafeScriptSecurityPrivateDoNotAccessOrElse(b)};\ngoog.html.uncheckedconversions.safeStyleFromStringKnownToSatisfyTypeContract=function(a,b){goog.asserts.assertString(goog.string.Const.unwrap(a),\"must provide justification\");goog.asserts.assert(!goog.string.internal.isEmptyOrWhitespace(goog.string.Const.unwrap(a)),\"must provide non-empty justification\");return goog.html.SafeStyle.createSafeStyleSecurityPrivateDoNotAccessOrElse(b)};\ngoog.html.uncheckedconversions.safeStyleSheetFromStringKnownToSatisfyTypeContract=function(a,b){goog.asserts.assertString(goog.string.Const.unwrap(a),\"must provide justification\");goog.asserts.assert(!goog.string.internal.isEmptyOrWhitespace(goog.string.Const.unwrap(a)),\"must provide non-empty justification\");return goog.html.SafeStyleSheet.createSafeStyleSheetSecurityPrivateDoNotAccessOrElse(b)};\ngoog.html.uncheckedconversions.safeUrlFromStringKnownToSatisfyTypeContract=function(a,b){goog.asserts.assertString(goog.string.Const.unwrap(a),\"must provide justification\");goog.asserts.assert(!goog.string.internal.isEmptyOrWhitespace(goog.string.Const.unwrap(a)),\"must provide non-empty justification\");return goog.html.SafeUrl.createSafeUrlSecurityPrivateDoNotAccessOrElse(b)};\ngoog.html.uncheckedconversions.trustedResourceUrlFromStringKnownToSatisfyTypeContract=function(a,b){goog.asserts.assertString(goog.string.Const.unwrap(a),\"must provide justification\");goog.asserts.assert(!goog.string.internal.isEmptyOrWhitespace(goog.string.Const.unwrap(a)),\"must provide non-empty justification\");return goog.html.TrustedResourceUrl.createTrustedResourceUrlSecurityPrivateDoNotAccessOrElse(b)};goog.dom.safe={};goog.dom.safe.InsertAdjacentHtmlPosition={AFTERBEGIN:\"afterbegin\",AFTEREND:\"afterend\",BEFOREBEGIN:\"beforebegin\",BEFOREEND:\"beforeend\"};goog.dom.safe.insertAdjacentHtml=function(a,b,c){a.insertAdjacentHTML(b,goog.html.SafeHtml.unwrapTrustedHTML(c))};goog.dom.safe.SET_INNER_HTML_DISALLOWED_TAGS_={MATH:!0,SCRIPT:!0,STYLE:!0,SVG:!0,TEMPLATE:!0};\ngoog.dom.safe.isInnerHtmlCleanupRecursive_=goog.functions.cacheReturnValue(function(){if(goog.DEBUG&&\"undefined\"===typeof document)return!1;var a=document.createElement(\"div\"),b=document.createElement(\"div\");b.appendChild(document.createElement(\"div\"));a.appendChild(b);if(goog.DEBUG&&!a.firstChild)return!1;b=a.firstChild.firstChild;a.innerHTML=goog.html.SafeHtml.unwrapTrustedHTML(goog.html.SafeHtml.EMPTY);return!b.parentElement});\ngoog.dom.safe.unsafeSetInnerHtmlDoNotUseOrElse=function(a,b){if(goog.dom.safe.isInnerHtmlCleanupRecursive_())for(;a.lastChild;)a.removeChild(a.lastChild);a.innerHTML=goog.html.SafeHtml.unwrapTrustedHTML(b)};\ngoog.dom.safe.setInnerHtml=function(a,b){if(goog.asserts.ENABLE_ASSERTS){var c=a.tagName.toUpperCase();if(goog.dom.safe.SET_INNER_HTML_DISALLOWED_TAGS_[c])throw Error(\"goog.dom.safe.setInnerHtml cannot be used to set content of \"+a.tagName+\".\");}goog.dom.safe.unsafeSetInnerHtmlDoNotUseOrElse(a,b)};goog.dom.safe.setOuterHtml=function(a,b){a.outerHTML=goog.html.SafeHtml.unwrapTrustedHTML(b)};\ngoog.dom.safe.setFormElementAction=function(a,b){b=b instanceof goog.html.SafeUrl?b:goog.html.SafeUrl.sanitizeAssertUnchanged(b);goog.dom.asserts.assertIsHTMLFormElement(a).action=goog.html.SafeUrl.unwrapTrustedURL(b)};goog.dom.safe.setButtonFormAction=function(a,b){b=b instanceof goog.html.SafeUrl?b:goog.html.SafeUrl.sanitizeAssertUnchanged(b);goog.dom.asserts.assertIsHTMLButtonElement(a).formAction=goog.html.SafeUrl.unwrapTrustedURL(b)};\ngoog.dom.safe.setInputFormAction=function(a,b){b=b instanceof goog.html.SafeUrl?b:goog.html.SafeUrl.sanitizeAssertUnchanged(b);goog.dom.asserts.assertIsHTMLInputElement(a).formAction=goog.html.SafeUrl.unwrapTrustedURL(b)};goog.dom.safe.setStyle=function(a,b){a.style.cssText=goog.html.SafeStyle.unwrap(b)};goog.dom.safe.documentWrite=function(a,b){a.write(goog.html.SafeHtml.unwrapTrustedHTML(b))};\ngoog.dom.safe.setAnchorHref=function(a,b){goog.dom.asserts.assertIsHTMLAnchorElement(a);b=b instanceof goog.html.SafeUrl?b:goog.html.SafeUrl.sanitizeAssertUnchanged(b);a.href=goog.html.SafeUrl.unwrapTrustedURL(b)};goog.dom.safe.setImageSrc=function(a,b){goog.dom.asserts.assertIsHTMLImageElement(a);if(!(b instanceof goog.html.SafeUrl)){var c=/^data:image\\//i.test(b);b=goog.html.SafeUrl.sanitizeAssertUnchanged(b,c)}a.src=goog.html.SafeUrl.unwrapTrustedURL(b)};\ngoog.dom.safe.setAudioSrc=function(a,b){goog.dom.asserts.assertIsHTMLAudioElement(a);if(!(b instanceof goog.html.SafeUrl)){var c=/^data:audio\\//i.test(b);b=goog.html.SafeUrl.sanitizeAssertUnchanged(b,c)}a.src=goog.html.SafeUrl.unwrapTrustedURL(b)};goog.dom.safe.setVideoSrc=function(a,b){goog.dom.asserts.assertIsHTMLVideoElement(a);if(!(b instanceof goog.html.SafeUrl)){var c=/^data:video\\//i.test(b);b=goog.html.SafeUrl.sanitizeAssertUnchanged(b,c)}a.src=goog.html.SafeUrl.unwrapTrustedURL(b)};\ngoog.dom.safe.setEmbedSrc=function(a,b){goog.dom.asserts.assertIsHTMLEmbedElement(a);a.src=goog.html.TrustedResourceUrl.unwrapTrustedScriptURL(b)};goog.dom.safe.setFrameSrc=function(a,b){goog.dom.asserts.assertIsHTMLFrameElement(a);a.src=goog.html.TrustedResourceUrl.unwrapTrustedURL(b)};goog.dom.safe.setIframeSrc=function(a,b){goog.dom.asserts.assertIsHTMLIFrameElement(a);a.src=goog.html.TrustedResourceUrl.unwrapTrustedURL(b)};\ngoog.dom.safe.setIframeSrcdoc=function(a,b){goog.dom.asserts.assertIsHTMLIFrameElement(a);a.srcdoc=goog.html.SafeHtml.unwrapTrustedHTML(b)};\ngoog.dom.safe.setLinkHrefAndRel=function(a,b,c){goog.dom.asserts.assertIsHTMLLinkElement(a);a.rel=c;goog.string.internal.caseInsensitiveContains(c,\"stylesheet\")?(goog.asserts.assert(b instanceof goog.html.TrustedResourceUrl,'URL must be TrustedResourceUrl because \"rel\" contains \"stylesheet\"'),a.href=goog.html.TrustedResourceUrl.unwrapTrustedURL(b)):a.href=b instanceof goog.html.TrustedResourceUrl?goog.html.TrustedResourceUrl.unwrapTrustedURL(b):b instanceof goog.html.SafeUrl?goog.html.SafeUrl.unwrapTrustedURL(b):\ngoog.html.SafeUrl.unwrapTrustedURL(goog.html.SafeUrl.sanitizeAssertUnchanged(b))};goog.dom.safe.setObjectData=function(a,b){goog.dom.asserts.assertIsHTMLObjectElement(a);a.data=goog.html.TrustedResourceUrl.unwrapTrustedScriptURL(b)};goog.dom.safe.setScriptSrc=function(a,b){goog.dom.asserts.assertIsHTMLScriptElement(a);a.src=goog.html.TrustedResourceUrl.unwrapTrustedScriptURL(b);(b=goog.getScriptNonce())&&a.setAttribute(\"nonce\",b)};\ngoog.dom.safe.setScriptContent=function(a,b){goog.dom.asserts.assertIsHTMLScriptElement(a);a.text=goog.html.SafeScript.unwrapTrustedScript(b);(b=goog.getScriptNonce())&&a.setAttribute(\"nonce\",b)};goog.dom.safe.setLocationHref=function(a,b){goog.dom.asserts.assertIsLocation(a);b=b instanceof goog.html.SafeUrl?b:goog.html.SafeUrl.sanitizeAssertUnchanged(b);a.href=goog.html.SafeUrl.unwrapTrustedURL(b)};\ngoog.dom.safe.assignLocation=function(a,b){goog.dom.asserts.assertIsLocation(a);b=b instanceof goog.html.SafeUrl?b:goog.html.SafeUrl.sanitizeAssertUnchanged(b);a.assign(goog.html.SafeUrl.unwrapTrustedURL(b))};goog.dom.safe.replaceLocation=function(a,b){goog.dom.asserts.assertIsLocation(a);b=b instanceof goog.html.SafeUrl?b:goog.html.SafeUrl.sanitizeAssertUnchanged(b);a.replace(goog.html.SafeUrl.unwrapTrustedURL(b))};\ngoog.dom.safe.openInWindow=function(a,b,c,d,e){a=a instanceof goog.html.SafeUrl?a:goog.html.SafeUrl.sanitizeAssertUnchanged(a);return(b||goog.global).open(goog.html.SafeUrl.unwrapTrustedURL(a),c?goog.string.Const.unwrap(c):\"\",d,e)};goog.dom.safe.parseFromStringHtml=function(a,b){return goog.dom.safe.parseFromString(a,b,\"text/html\")};goog.dom.safe.parseFromString=function(a,b,c){return a.parseFromString(goog.html.SafeHtml.unwrapTrustedHTML(b),c)};\ngoog.dom.safe.createImageFromBlob=function(a){if(!/^image\\/.*/g.test(a.type))throw Error(\"goog.dom.safe.createImageFromBlob only accepts MIME type image/.*.\");var b=goog.global.URL.createObjectURL(a);a=new goog.global.Image;a.onload=function(){goog.global.URL.revokeObjectURL(b)};goog.dom.safe.setImageSrc(a,goog.html.uncheckedconversions.safeUrlFromStringKnownToSatisfyTypeContract(goog.string.Const.from(\"Image blob URL.\"),b));return a};goog.string.DETECT_DOUBLE_ESCAPING=!1;goog.string.FORCE_NON_DOM_HTML_UNESCAPING=!1;goog.string.Unicode={NBSP:\"\\u00a0\"};goog.string.startsWith=goog.string.internal.startsWith;goog.string.endsWith=goog.string.internal.endsWith;goog.string.caseInsensitiveStartsWith=goog.string.internal.caseInsensitiveStartsWith;goog.string.caseInsensitiveEndsWith=goog.string.internal.caseInsensitiveEndsWith;goog.string.caseInsensitiveEquals=goog.string.internal.caseInsensitiveEquals;\ngoog.string.subs=function(a,b){for(var c=a.split(\"%s\"),d=\"\",e=Array.prototype.slice.call(arguments,1);e.length&&1<c.length;)d+=c.shift()+e.shift();return d+c.join(\"%s\")};goog.string.collapseWhitespace=function(a){return a.replace(/[\\s\\xa0]+/g,\" \").replace(/^\\s+|\\s+$/g,\"\")};goog.string.isEmptyOrWhitespace=goog.string.internal.isEmptyOrWhitespace;goog.string.isEmptyString=function(a){return 0==a.length};goog.string.isEmpty=goog.string.isEmptyOrWhitespace;goog.string.isEmptyOrWhitespaceSafe=function(a){return goog.string.isEmptyOrWhitespace(goog.string.makeSafe(a))};\ngoog.string.isEmptySafe=goog.string.isEmptyOrWhitespaceSafe;goog.string.isBreakingWhitespace=function(a){return!/[^\\t\\n\\r ]/.test(a)};goog.string.isAlpha=function(a){return!/[^a-zA-Z]/.test(a)};goog.string.isNumeric=function(a){return!/[^0-9]/.test(a)};goog.string.isAlphaNumeric=function(a){return!/[^a-zA-Z0-9]/.test(a)};goog.string.isSpace=function(a){return\" \"==a};goog.string.isUnicodeChar=function(a){return 1==a.length&&\" \"<=a&&\"~\">=a||\"\\u0080\"<=a&&\"\\ufffd\">=a};\ngoog.string.stripNewlines=function(a){return a.replace(/(\\r\\n|\\r|\\n)+/g,\" \")};goog.string.canonicalizeNewlines=function(a){return a.replace(/(\\r\\n|\\r|\\n)/g,\"\\n\")};goog.string.normalizeWhitespace=function(a){return a.replace(/\\xa0|\\s/g,\" \")};goog.string.normalizeSpaces=function(a){return a.replace(/\\xa0|[ \\t]+/g,\" \")};goog.string.collapseBreakingSpaces=function(a){return a.replace(/[\\t\\r\\n ]+/g,\" \").replace(/^[\\t\\r\\n ]+|[\\t\\r\\n ]+$/g,\"\")};goog.string.trim=goog.string.internal.trim;\ngoog.string.trimLeft=function(a){return a.replace(/^[\\s\\xa0]+/,\"\")};goog.string.trimRight=function(a){return a.replace(/[\\s\\xa0]+$/,\"\")};goog.string.caseInsensitiveCompare=goog.string.internal.caseInsensitiveCompare;\ngoog.string.numberAwareCompare_=function(a,b,c){if(a==b)return 0;if(!a)return-1;if(!b)return 1;for(var d=a.toLowerCase().match(c),e=b.toLowerCase().match(c),f=Math.min(d.length,e.length),g=0;g<f;g++){c=d[g];var h=e[g];if(c!=h)return a=parseInt(c,10),!isNaN(a)&&(b=parseInt(h,10),!isNaN(b)&&a-b)?a-b:c<h?-1:1}return d.length!=e.length?d.length-e.length:a<b?-1:1};goog.string.intAwareCompare=function(a,b){return goog.string.numberAwareCompare_(a,b,/\\d+|\\D+/g)};\ngoog.string.floatAwareCompare=function(a,b){return goog.string.numberAwareCompare_(a,b,/\\d+|\\.\\d+|\\D+/g)};goog.string.numerateCompare=goog.string.floatAwareCompare;goog.string.urlEncode=function(a){return encodeURIComponent(String(a))};goog.string.urlDecode=function(a){return decodeURIComponent(a.replace(/\\+/g,\" \"))};goog.string.newLineToBr=goog.string.internal.newLineToBr;\ngoog.string.htmlEscape=function(a,b){a=goog.string.internal.htmlEscape(a,b);goog.string.DETECT_DOUBLE_ESCAPING&&(a=a.replace(goog.string.E_RE_,\"e\"));return a};goog.string.E_RE_=/e/g;goog.string.unescapeEntities=function(a){return goog.string.contains(a,\"&\")?!goog.string.FORCE_NON_DOM_HTML_UNESCAPING&&\"document\"in goog.global?goog.string.unescapeEntitiesUsingDom_(a):goog.string.unescapePureXmlEntities_(a):a};\ngoog.string.unescapeEntitiesWithDocument=function(a,b){return goog.string.contains(a,\"&\")?goog.string.unescapeEntitiesUsingDom_(a,b):a};\ngoog.string.unescapeEntitiesUsingDom_=function(a,b){var c={\"&\":\"&\",\"<\":\"<\",\">\":\">\",\""\":'\"'};var d=b?b.createElement(\"div\"):goog.global.document.createElement(\"div\");return a.replace(goog.string.HTML_ENTITY_PATTERN_,function(a,b){var e=c[a];if(e)return e;\"#\"==b.charAt(0)&&(b=Number(\"0\"+b.substr(1)),isNaN(b)||(e=String.fromCharCode(b)));e||(goog.dom.safe.setInnerHtml(d,goog.html.uncheckedconversions.safeHtmlFromStringKnownToSatisfyTypeContract(goog.string.Const.from(\"Single HTML entity.\"),\na+\" \")),e=d.firstChild.nodeValue.slice(0,-1));return c[a]=e})};goog.string.unescapePureXmlEntities_=function(a){return a.replace(/&([^;]+);/g,function(a,c){switch(c){case \"amp\":return\"&\";case \"lt\":return\"<\";case \"gt\":return\">\";case \"quot\":return'\"';default:return\"#\"!=c.charAt(0)||(c=Number(\"0\"+c.substr(1)),isNaN(c))?a:String.fromCharCode(c)}})};goog.string.HTML_ENTITY_PATTERN_=/&([^;\\s<&]+);?/g;goog.string.whitespaceEscape=function(a,b){return goog.string.newLineToBr(a.replace(/ /g,\"  \"),b)};\ngoog.string.preserveSpaces=function(a){return a.replace(/(^|[\\n ]) /g,\"$1\"+goog.string.Unicode.NBSP)};goog.string.stripQuotes=function(a,b){for(var c=b.length,d=0;d<c;d++){var e=1==c?b:b.charAt(d);if(a.charAt(0)==e&&a.charAt(a.length-1)==e)return a.substring(1,a.length-1)}return a};goog.string.truncate=function(a,b,c){c&&(a=goog.string.unescapeEntities(a));a.length>b&&(a=a.substring(0,b-3)+\"...\");c&&(a=goog.string.htmlEscape(a));return a};\ngoog.string.truncateMiddle=function(a,b,c,d){c&&(a=goog.string.unescapeEntities(a));if(d&&a.length>b){d>b&&(d=b);var e=a.length-d;a=a.substring(0,b-d)+\"...\"+a.substring(e)}else a.length>b&&(d=Math.floor(b/2),e=a.length-d,a=a.substring(0,d+b%2)+\"...\"+a.substring(e));c&&(a=goog.string.htmlEscape(a));return a};goog.string.specialEscapeChars_={\"\\x00\":\"\\\\0\",\"\\b\":\"\\\\b\",\"\\f\":\"\\\\f\",\"\\n\":\"\\\\n\",\"\\r\":\"\\\\r\",\"\\t\":\"\\\\t\",\"\\x0B\":\"\\\\x0B\",'\"':'\\\\\"',\"\\\\\":\"\\\\\\\\\",\"<\":\"\\\\u003C\"};goog.string.jsEscapeCache_={\"'\":\"\\\\'\"};\ngoog.string.quote=function(a){a=String(a);for(var b=['\"'],c=0;c<a.length;c++){var d=a.charAt(c),e=d.charCodeAt(0);b[c+1]=goog.string.specialEscapeChars_[d]||(31<e&&127>e?d:goog.string.escapeChar(d))}b.push('\"');return b.join(\"\")};goog.string.escapeString=function(a){for(var b=[],c=0;c<a.length;c++)b[c]=goog.string.escapeChar(a.charAt(c));return b.join(\"\")};\ngoog.string.escapeChar=function(a){if(a in goog.string.jsEscapeCache_)return goog.string.jsEscapeCache_[a];if(a in goog.string.specialEscapeChars_)return goog.string.jsEscapeCache_[a]=goog.string.specialEscapeChars_[a];var b=a.charCodeAt(0);if(31<b&&127>b)var c=a;else{if(256>b){if(c=\"\\\\x\",16>b||256<b)c+=\"0\"}else c=\"\\\\u\",4096>b&&(c+=\"0\");c+=b.toString(16).toUpperCase()}return goog.string.jsEscapeCache_[a]=c};goog.string.contains=goog.string.internal.contains;goog.string.caseInsensitiveContains=goog.string.internal.caseInsensitiveContains;\ngoog.string.countOf=function(a,b){return a&&b?a.split(b).length-1:0};goog.string.removeAt=function(a,b,c){var d=a;0<=b&&b<a.length&&0<c&&(d=a.substr(0,b)+a.substr(b+c,a.length-b-c));return d};goog.string.remove=function(a,b){return a.replace(b,\"\")};goog.string.removeAll=function(a,b){b=new RegExp(goog.string.regExpEscape(b),\"g\");return a.replace(b,\"\")};goog.string.replaceAll=function(a,b,c){b=new RegExp(goog.string.regExpEscape(b),\"g\");return a.replace(b,c.replace(/\\$/g,\"$$$$\"))};\ngoog.string.regExpEscape=function(a){return String(a).replace(/([-()\\[\\]{}+?*.$\\^|,:#<!\\\\])/g,\"\\\\$1\").replace(/\\x08/g,\"\\\\x08\")};goog.string.repeat=String.prototype.repeat?function(a,b){return a.repeat(b)}:function(a,b){return Array(b+1).join(a)};goog.string.padNumber=function(a,b,c){a=goog.isDef(c)?a.toFixed(c):String(a);c=a.indexOf(\".\");-1==c&&(c=a.length);return goog.string.repeat(\"0\",Math.max(0,b-c))+a};goog.string.makeSafe=function(a){return null==a?\"\":String(a)};\ngoog.string.buildString=function(a){return Array.prototype.join.call(arguments,\"\")};goog.string.getRandomString=function(){return Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^goog.now()).toString(36)};goog.string.compareVersions=goog.string.internal.compareVersions;goog.string.hashCode=function(a){for(var b=0,c=0;c<a.length;++c)b=31*b+a.charCodeAt(c)>>>0;return b};goog.string.uniqueStringCounter_=2147483648*Math.random()|0;\ngoog.string.createUniqueString=function(){return\"goog_\"+goog.string.uniqueStringCounter_++};goog.string.toNumber=function(a){var b=Number(a);return 0==b&&goog.string.isEmptyOrWhitespace(a)?NaN:b};goog.string.isLowerCamelCase=function(a){return/^[a-z]+([A-Z][a-z]*)*$/.test(a)};goog.string.isUpperCamelCase=function(a){return/^([A-Z][a-z]*)+$/.test(a)};goog.string.toCamelCase=function(a){return String(a).replace(/\\-([a-z])/g,function(a,c){return c.toUpperCase()})};\ngoog.string.toSelectorCase=function(a){return String(a).replace(/([A-Z])/g,\"-$1\").toLowerCase()};goog.string.toTitleCase=function(a,b){b=goog.isString(b)?goog.string.regExpEscape(b):\"\\\\s\";return a.replace(new RegExp(\"(^\"+(b?\"|[\"+b+\"]+\":\"\")+\")([a-z])\",\"g\"),function(a,b,e){return b+e.toUpperCase()})};goog.string.capitalize=function(a){return String(a.charAt(0)).toUpperCase()+String(a.substr(1)).toLowerCase()};\ngoog.string.parseInt=function(a){isFinite(a)&&(a=String(a));return goog.isString(a)?/^\\s*-?0x/i.test(a)?parseInt(a,16):parseInt(a,10):NaN};goog.string.splitLimit=function(a,b,c){a=a.split(b);for(var d=[];0<c&&a.length;)d.push(a.shift()),c--;a.length&&d.push(a.join(b));return d};goog.string.lastComponent=function(a,b){if(b)\"string\"==typeof b&&(b=[b]);else return a;for(var c=-1,d=0;d<b.length;d++)if(\"\"!=b[d]){var e=a.lastIndexOf(b[d]);e>c&&(c=e)}return-1==c?a:a.slice(c+1)};\ngoog.string.editDistance=function(a,b){var c=[],d=[];if(a==b)return 0;if(!a.length||!b.length)return Math.max(a.length,b.length);for(var e=0;e<b.length+1;e++)c[e]=e;for(e=0;e<a.length;e++){d[0]=e+1;for(var f=0;f<b.length;f++)d[f+1]=Math.min(d[f]+1,c[f+1]+1,c[f]+Number(a[e]!=b[f]));for(f=0;f<c.length;f++)c[f]=d[f]}return d[b.length]};goog.labs.userAgent.engine={};goog.labs.userAgent.engine.isPresto=function(){return goog.labs.userAgent.util.matchUserAgent(\"Presto\")};goog.labs.userAgent.engine.isTrident=function(){return goog.labs.userAgent.util.matchUserAgent(\"Trident\")||goog.labs.userAgent.util.matchUserAgent(\"MSIE\")};goog.labs.userAgent.engine.isEdge=function(){return goog.labs.userAgent.util.matchUserAgent(\"Edge\")};\ngoog.labs.userAgent.engine.isWebKit=function(){return goog.labs.userAgent.util.matchUserAgentIgnoreCase(\"WebKit\")&&!goog.labs.userAgent.engine.isEdge()};goog.labs.userAgent.engine.isGecko=function(){return goog.labs.userAgent.util.matchUserAgent(\"Gecko\")&&!goog.labs.userAgent.engine.isWebKit()&&!goog.labs.userAgent.engine.isTrident()&&!goog.labs.userAgent.engine.isEdge()};\ngoog.labs.userAgent.engine.getVersion=function(){var a=goog.labs.userAgent.util.getUserAgent();if(a){a=goog.labs.userAgent.util.extractVersionTuples(a);var b=goog.labs.userAgent.engine.getEngineTuple_(a);if(b)return\"Gecko\"==b[0]?goog.labs.userAgent.engine.getVersionForKey_(a,\"Firefox\"):b[1];a=a[0];var c;if(a&&(c=a[2])&&(c=/Trident\\/([^\\s;]+)/.exec(c)))return c[1]}return\"\"};\ngoog.labs.userAgent.engine.getEngineTuple_=function(a){if(!goog.labs.userAgent.engine.isEdge())return a[1];for(var b=0;b<a.length;b++){var c=a[b];if(\"Edge\"==c[0])return c}};goog.labs.userAgent.engine.isVersionOrHigher=function(a){return 0<=goog.string.compareVersions(goog.labs.userAgent.engine.getVersion(),a)};goog.labs.userAgent.engine.getVersionForKey_=function(a,b){return(a=goog.array.find(a,function(a){return b==a[0]}))&&a[1]||\"\"};goog.labs.userAgent.platform={};goog.labs.userAgent.platform.isAndroid=function(){return goog.labs.userAgent.util.matchUserAgent(\"Android\")};goog.labs.userAgent.platform.isIpod=function(){return goog.labs.userAgent.util.matchUserAgent(\"iPod\")};goog.labs.userAgent.platform.isIphone=function(){return goog.labs.userAgent.util.matchUserAgent(\"iPhone\")&&!goog.labs.userAgent.util.matchUserAgent(\"iPod\")&&!goog.labs.userAgent.util.matchUserAgent(\"iPad\")};goog.labs.userAgent.platform.isIpad=function(){return goog.labs.userAgent.util.matchUserAgent(\"iPad\")};\ngoog.labs.userAgent.platform.isIos=function(){return goog.labs.userAgent.platform.isIphone()||goog.labs.userAgent.platform.isIpad()||goog.labs.userAgent.platform.isIpod()};goog.labs.userAgent.platform.isMacintosh=function(){return goog.labs.userAgent.util.matchUserAgent(\"Macintosh\")};goog.labs.userAgent.platform.isLinux=function(){return goog.labs.userAgent.util.matchUserAgent(\"Linux\")};goog.labs.userAgent.platform.isWindows=function(){return goog.labs.userAgent.util.matchUserAgent(\"Windows\")};\ngoog.labs.userAgent.platform.isChromeOS=function(){return goog.labs.userAgent.util.matchUserAgent(\"CrOS\")};goog.labs.userAgent.platform.isChromecast=function(){return goog.labs.userAgent.util.matchUserAgent(\"CrKey\")};goog.labs.userAgent.platform.isKaiOS=function(){return goog.labs.userAgent.util.matchUserAgentIgnoreCase(\"KaiOS\")};goog.labs.userAgent.platform.isGo2Phone=function(){return goog.labs.userAgent.util.matchUserAgentIgnoreCase(\"GAFP\")};\ngoog.labs.userAgent.platform.getVersion=function(){var a=goog.labs.userAgent.util.getUserAgent(),b=\"\";goog.labs.userAgent.platform.isWindows()?(b=/Windows (?:NT|Phone) ([0-9.]+)/,b=(a=b.exec(a))?a[1]:\"0.0\"):goog.labs.userAgent.platform.isIos()?(b=/(?:iPhone|iPod|iPad|CPU)\\s+OS\\s+(\\S+)/,b=(a=b.exec(a))&&a[1].replace(/_/g,\".\")):goog.labs.userAgent.platform.isMacintosh()?(b=/Mac OS X ([0-9_.]+)/,b=(a=b.exec(a))?a[1].replace(/_/g,\".\"):\"10\"):goog.labs.userAgent.platform.isKaiOS()?(b=/(?:KaiOS)\\/(\\S+)/i,\nb=(a=b.exec(a))&&a[1]):goog.labs.userAgent.platform.isAndroid()?(b=/Android\\s+([^\\);]+)(\\)|;)/,b=(a=b.exec(a))&&a[1]):goog.labs.userAgent.platform.isChromeOS()&&(b=/(?:CrOS\\s+(?:i686|x86_64)\\s+([0-9.]+))/,b=(a=b.exec(a))&&a[1]);return b||\"\"};goog.labs.userAgent.platform.isVersionOrHigher=function(a){return 0<=goog.string.compareVersions(goog.labs.userAgent.platform.getVersion(),a)};goog.reflect={};goog.reflect.object=function(a,b){return b};goog.reflect.objectProperty=function(a,b){return a};goog.reflect.sinkValue=function(a){goog.reflect.sinkValue[\" \"](a);return a};goog.reflect.sinkValue[\" \"]=goog.nullFunction;goog.reflect.canAccessProperty=function(a,b){try{return goog.reflect.sinkValue(a[b]),!0}catch(c){}return!1};goog.reflect.cache=function(a,b,c,d){d=d?d(b):b;return Object.prototype.hasOwnProperty.call(a,d)?a[d]:a[d]=c(b)};goog.userAgent={};goog.userAgent.ASSUME_IE=!1;goog.userAgent.ASSUME_EDGE=!1;goog.userAgent.ASSUME_GECKO=!1;goog.userAgent.ASSUME_WEBKIT=!1;goog.userAgent.ASSUME_MOBILE_WEBKIT=!1;goog.userAgent.ASSUME_OPERA=!1;goog.userAgent.ASSUME_ANY_VERSION=!1;goog.userAgent.BROWSER_KNOWN_=goog.userAgent.ASSUME_IE||goog.userAgent.ASSUME_EDGE||goog.userAgent.ASSUME_GECKO||goog.userAgent.ASSUME_MOBILE_WEBKIT||goog.userAgent.ASSUME_WEBKIT||goog.userAgent.ASSUME_OPERA;goog.userAgent.getUserAgentString=function(){return goog.labs.userAgent.util.getUserAgent()};\ngoog.userAgent.getNavigatorTyped=function(){return goog.global.navigator||null};goog.userAgent.getNavigator=function(){return goog.userAgent.getNavigatorTyped()};goog.userAgent.OPERA=goog.userAgent.BROWSER_KNOWN_?goog.userAgent.ASSUME_OPERA:goog.labs.userAgent.browser.isOpera();goog.userAgent.IE=goog.userAgent.BROWSER_KNOWN_?goog.userAgent.ASSUME_IE:goog.labs.userAgent.browser.isIE();goog.userAgent.EDGE=goog.userAgent.BROWSER_KNOWN_?goog.userAgent.ASSUME_EDGE:goog.labs.userAgent.engine.isEdge();\ngoog.userAgent.EDGE_OR_IE=goog.userAgent.EDGE||goog.userAgent.IE;goog.userAgent.GECKO=goog.userAgent.BROWSER_KNOWN_?goog.userAgent.ASSUME_GECKO:goog.labs.userAgent.engine.isGecko();goog.userAgent.WEBKIT=goog.userAgent.BROWSER_KNOWN_?goog.userAgent.ASSUME_WEBKIT||goog.userAgent.ASSUME_MOBILE_WEBKIT:goog.labs.userAgent.engine.isWebKit();goog.userAgent.isMobile_=function(){return goog.userAgent.WEBKIT&&goog.labs.userAgent.util.matchUserAgent(\"Mobile\")};\ngoog.userAgent.MOBILE=goog.userAgent.ASSUME_MOBILE_WEBKIT||goog.userAgent.isMobile_();goog.userAgent.SAFARI=goog.userAgent.WEBKIT;goog.userAgent.determinePlatform_=function(){var a=goog.userAgent.getNavigatorTyped();return a&&a.platform||\"\"};goog.userAgent.PLATFORM=goog.userAgent.determinePlatform_();goog.userAgent.ASSUME_MAC=!1;goog.userAgent.ASSUME_WINDOWS=!1;goog.userAgent.ASSUME_LINUX=!1;goog.userAgent.ASSUME_X11=!1;goog.userAgent.ASSUME_ANDROID=!1;goog.userAgent.ASSUME_IPHONE=!1;\ngoog.userAgent.ASSUME_IPAD=!1;goog.userAgent.ASSUME_IPOD=!1;goog.userAgent.ASSUME_KAIOS=!1;goog.userAgent.ASSUME_GO2PHONE=!1;goog.userAgent.PLATFORM_KNOWN_=goog.userAgent.ASSUME_MAC||goog.userAgent.ASSUME_WINDOWS||goog.userAgent.ASSUME_LINUX||goog.userAgent.ASSUME_X11||goog.userAgent.ASSUME_ANDROID||goog.userAgent.ASSUME_IPHONE||goog.userAgent.ASSUME_IPAD||goog.userAgent.ASSUME_IPOD;goog.userAgent.MAC=goog.userAgent.PLATFORM_KNOWN_?goog.userAgent.ASSUME_MAC:goog.labs.userAgent.platform.isMacintosh();\ngoog.userAgent.WINDOWS=goog.userAgent.PLATFORM_KNOWN_?goog.userAgent.ASSUME_WINDOWS:goog.labs.userAgent.platform.isWindows();goog.userAgent.isLegacyLinux_=function(){return goog.labs.userAgent.platform.isLinux()||goog.labs.userAgent.platform.isChromeOS()};goog.userAgent.LINUX=goog.userAgent.PLATFORM_KNOWN_?goog.userAgent.ASSUME_LINUX:goog.userAgent.isLegacyLinux_();goog.userAgent.isX11_=function(){var a=goog.userAgent.getNavigatorTyped();return!!a&&goog.string.contains(a.appVersion||\"\",\"X11\")};\ngoog.userAgent.X11=goog.userAgent.PLATFORM_KNOWN_?goog.userAgent.ASSUME_X11:goog.userAgent.isX11_();goog.userAgent.ANDROID=goog.userAgent.PLATFORM_KNOWN_?goog.userAgent.ASSUME_ANDROID:goog.labs.userAgent.platform.isAndroid();goog.userAgent.IPHONE=goog.userAgent.PLATFORM_KNOWN_?goog.userAgent.ASSUME_IPHONE:goog.labs.userAgent.platform.isIphone();goog.userAgent.IPAD=goog.userAgent.PLATFORM_KNOWN_?goog.userAgent.ASSUME_IPAD:goog.labs.userAgent.platform.isIpad();\ngoog.userAgent.IPOD=goog.userAgent.PLATFORM_KNOWN_?goog.userAgent.ASSUME_IPOD:goog.labs.userAgent.platform.isIpod();goog.userAgent.IOS=goog.userAgent.PLATFORM_KNOWN_?goog.userAgent.ASSUME_IPHONE||goog.userAgent.ASSUME_IPAD||goog.userAgent.ASSUME_IPOD:goog.labs.userAgent.platform.isIos();goog.userAgent.KAIOS=goog.userAgent.PLATFORM_KNOWN_?goog.userAgent.ASSUME_KAIOS:goog.labs.userAgent.platform.isKaiOS();goog.userAgent.GO2PHONE=goog.userAgent.PLATFORM_KNOWN_?goog.userAgent.ASSUME_GO2PHONE:goog.labs.userAgent.platform.isGo2Phone();\ngoog.userAgent.determineVersion_=function(){var a=\"\",b=goog.userAgent.getVersionRegexResult_();b&&(a=b?b[1]:\"\");return goog.userAgent.IE&&(b=goog.userAgent.getDocumentMode_(),null!=b&&b>parseFloat(a))?String(b):a};\ngoog.userAgent.getVersionRegexResult_=function(){var a=goog.userAgent.getUserAgentString();if(goog.userAgent.GECKO)return/rv:([^\\);]+)(\\)|;)/.exec(a);if(goog.userAgent.EDGE)return/Edge\\/([\\d\\.]+)/.exec(a);if(goog.userAgent.IE)return/\\b(?:MSIE|rv)[: ]([^\\);]+)(\\)|;)/.exec(a);if(goog.userAgent.WEBKIT)return/WebKit\\/(\\S+)/.exec(a);if(goog.userAgent.OPERA)return/(?:Version)[ \\/]?(\\S+)/.exec(a)};goog.userAgent.getDocumentMode_=function(){var a=goog.global.document;return a?a.documentMode:void 0};\ngoog.userAgent.VERSION=goog.userAgent.determineVersion_();goog.userAgent.compare=function(a,b){return goog.string.compareVersions(a,b)};goog.userAgent.isVersionOrHigherCache_={};goog.userAgent.isVersionOrHigher=function(a){return goog.userAgent.ASSUME_ANY_VERSION||goog.reflect.cache(goog.userAgent.isVersionOrHigherCache_,a,function(){return 0<=goog.string.compareVersions(goog.userAgent.VERSION,a)})};goog.userAgent.isVersion=goog.userAgent.isVersionOrHigher;\ngoog.userAgent.isDocumentModeOrHigher=function(a){return Number(goog.userAgent.DOCUMENT_MODE)>=a};goog.userAgent.isDocumentMode=goog.userAgent.isDocumentModeOrHigher;goog.userAgent.DOCUMENT_MODE=function(){if(goog.global.document&&goog.userAgent.IE)return goog.userAgent.getDocumentMode_()}();goog.userAgent.product={};goog.userAgent.product.ASSUME_FIREFOX=!1;goog.userAgent.product.ASSUME_IPHONE=!1;goog.userAgent.product.ASSUME_IPAD=!1;goog.userAgent.product.ASSUME_ANDROID=!1;goog.userAgent.product.ASSUME_CHROME=!1;goog.userAgent.product.ASSUME_SAFARI=!1;\ngoog.userAgent.product.PRODUCT_KNOWN_=goog.userAgent.ASSUME_IE||goog.userAgent.ASSUME_EDGE||goog.userAgent.ASSUME_OPERA||goog.userAgent.product.ASSUME_FIREFOX||goog.userAgent.product.ASSUME_IPHONE||goog.userAgent.product.ASSUME_IPAD||goog.userAgent.product.ASSUME_ANDROID||goog.userAgent.product.ASSUME_CHROME||goog.userAgent.product.ASSUME_SAFARI;goog.userAgent.product.OPERA=goog.userAgent.OPERA;goog.userAgent.product.IE=goog.userAgent.IE;goog.userAgent.product.EDGE=goog.userAgent.EDGE;\ngoog.userAgent.product.FIREFOX=goog.userAgent.product.PRODUCT_KNOWN_?goog.userAgent.product.ASSUME_FIREFOX:goog.labs.userAgent.browser.isFirefox();goog.userAgent.product.isIphoneOrIpod_=function(){return goog.labs.userAgent.platform.isIphone()||goog.labs.userAgent.platform.isIpod()};goog.userAgent.product.IPHONE=goog.userAgent.product.PRODUCT_KNOWN_?goog.userAgent.product.ASSUME_IPHONE:goog.userAgent.product.isIphoneOrIpod_();\ngoog.userAgent.product.IPAD=goog.userAgent.product.PRODUCT_KNOWN_?goog.userAgent.product.ASSUME_IPAD:goog.labs.userAgent.platform.isIpad();goog.userAgent.product.ANDROID=goog.userAgent.product.PRODUCT_KNOWN_?goog.userAgent.product.ASSUME_ANDROID:goog.labs.userAgent.browser.isAndroidBrowser();goog.userAgent.product.CHROME=goog.userAgent.product.PRODUCT_KNOWN_?goog.userAgent.product.ASSUME_CHROME:goog.labs.userAgent.browser.isChrome();\ngoog.userAgent.product.isSafariDesktop_=function(){return goog.labs.userAgent.browser.isSafari()&&!goog.labs.userAgent.platform.isIos()};goog.userAgent.product.SAFARI=goog.userAgent.product.PRODUCT_KNOWN_?goog.userAgent.product.ASSUME_SAFARI:goog.userAgent.product.isSafariDesktop_();goog.crypt.base64={};goog.crypt.base64.DEFAULT_ALPHABET_COMMON_=\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\";goog.crypt.base64.ENCODED_VALS=goog.crypt.base64.DEFAULT_ALPHABET_COMMON_+\"+/=\";goog.crypt.base64.ENCODED_VALS_WEBSAFE=goog.crypt.base64.DEFAULT_ALPHABET_COMMON_+\"-_.\";goog.crypt.base64.Alphabet={DEFAULT:0,NO_PADDING:1,WEBSAFE:2,WEBSAFE_DOT_PADDING:3,WEBSAFE_NO_PADDING:4};goog.crypt.base64.paddingChars_=\"=.\";\ngoog.crypt.base64.isPadding_=function(a){return goog.string.contains(goog.crypt.base64.paddingChars_,a)};goog.crypt.base64.byteToCharMaps_={};goog.crypt.base64.charToByteMap_=null;goog.crypt.base64.ASSUME_NATIVE_SUPPORT_=goog.userAgent.GECKO||goog.userAgent.WEBKIT&&!goog.userAgent.product.SAFARI||goog.userAgent.OPERA;goog.crypt.base64.HAS_NATIVE_ENCODE_=goog.crypt.base64.ASSUME_NATIVE_SUPPORT_||\"function\"==typeof goog.global.btoa;\ngoog.crypt.base64.HAS_NATIVE_DECODE_=goog.crypt.base64.ASSUME_NATIVE_SUPPORT_||!goog.userAgent.product.SAFARI&&!goog.userAgent.IE&&\"function\"==typeof goog.global.atob;\ngoog.crypt.base64.encodeByteArray=function(a,b){goog.asserts.assert(goog.isArrayLike(a),\"encodeByteArray takes an array as a parameter\");void 0===b&&(b=goog.crypt.base64.Alphabet.DEFAULT);goog.crypt.base64.init_();b=goog.crypt.base64.byteToCharMaps_[b];for(var c=[],d=0;d<a.length;d+=3){var e=a[d],f=d+1<a.length,g=f?a[d+1]:0,h=d+2<a.length,k=h?a[d+2]:0,l=e>>2;e=(e&3)<<4|g>>4;g=(g&15)<<2|k>>6;k&=63;h||(k=64,f||(g=64));c.push(b[l],b[e],b[g]||\"\",b[k]||\"\")}return c.join(\"\")};\ngoog.crypt.base64.encodeString=function(a,b){return goog.crypt.base64.HAS_NATIVE_ENCODE_&&!b?goog.global.btoa(a):goog.crypt.base64.encodeByteArray(goog.crypt.stringToByteArray(a),b)};goog.crypt.base64.decodeString=function(a,b){if(goog.crypt.base64.HAS_NATIVE_DECODE_&&!b)return goog.global.atob(a);var c=\"\";goog.crypt.base64.decodeStringInternal_(a,function(a){c+=String.fromCharCode(a)});return c};\ngoog.crypt.base64.decodeStringToByteArray=function(a,b){var c=[];goog.crypt.base64.decodeStringInternal_(a,function(a){c.push(a)});return c};\ngoog.crypt.base64.decodeStringToUint8Array=function(a){goog.asserts.assert(!goog.userAgent.IE||goog.userAgent.isVersionOrHigher(\"10\"),\"Browser does not support typed arrays\");var b=a.length,c=3*b/4;c%3?c=Math.floor(c):goog.crypt.base64.isPadding_(a[b-1])&&(c=goog.crypt.base64.isPadding_(a[b-2])?c-2:c-1);var d=new Uint8Array(c),e=0;goog.crypt.base64.decodeStringInternal_(a,function(a){d[e++]=a});return d.subarray(0,e)};\ngoog.crypt.base64.decodeStringInternal_=function(a,b){function c(b){for(;d<a.length;){var c=a.charAt(d++),e=goog.crypt.base64.charToByteMap_[c];if(null!=e)return e;if(!goog.string.isEmptyOrWhitespace(c))throw Error(\"Unknown base64 encoding at char: \"+c);}return b}goog.crypt.base64.init_();for(var d=0;;){var e=c(-1),f=c(0),g=c(64),h=c(64);if(64===h&&-1===e)break;b(e<<2|f>>4);64!=g&&(b(f<<4&240|g>>2),64!=h&&b(g<<6&192|h))}};\ngoog.crypt.base64.init_=function(){if(!goog.crypt.base64.charToByteMap_){goog.crypt.base64.charToByteMap_={};for(var a=goog.crypt.base64.DEFAULT_ALPHABET_COMMON_.split(\"\"),b=[\"+/=\",\"+/\",\"-_=\",\"-_.\",\"-_\"],c=0;5>c;c++){var d=a.concat(b[c].split(\"\"));goog.crypt.base64.byteToCharMaps_[c]=d;for(var e=0;e<d.length;e++){var f=d[e],g=goog.crypt.base64.charToByteMap_[f];void 0===g?goog.crypt.base64.charToByteMap_[f]=e:goog.asserts.assert(g===e)}}}};jspb.utils={};jspb.utils.split64Low=0;jspb.utils.split64High=0;jspb.utils.splitUint64=function(a){var b=a>>>0;a=Math.floor((a-b)/jspb.BinaryConstants.TWO_TO_32)>>>0;jspb.utils.split64Low=b;jspb.utils.split64High=a};jspb.utils.splitInt64=function(a){var b=0>a;a=Math.abs(a);var c=a>>>0;a=Math.floor((a-c)/jspb.BinaryConstants.TWO_TO_32);a>>>=0;b&&(a=~a>>>0,c=(~c>>>0)+1,4294967295<c&&(c=0,a++,4294967295<a&&(a=0)));jspb.utils.split64Low=c;jspb.utils.split64High=a};\njspb.utils.splitZigzag64=function(a){var b=0>a;a=2*Math.abs(a);jspb.utils.splitUint64(a);a=jspb.utils.split64Low;var c=jspb.utils.split64High;b&&(0==a?0==c?c=a=4294967295:(c--,a=4294967295):a--);jspb.utils.split64Low=a;jspb.utils.split64High=c};\njspb.utils.splitFloat32=function(a){var b=0>a?1:0;a=b?-a:a;if(0===a)0<1/a?(jspb.utils.split64High=0,jspb.utils.split64Low=0):(jspb.utils.split64High=0,jspb.utils.split64Low=2147483648);else if(isNaN(a))jspb.utils.split64High=0,jspb.utils.split64Low=2147483647;else if(a>jspb.BinaryConstants.FLOAT32_MAX)jspb.utils.split64High=0,jspb.utils.split64Low=(b<<31|2139095040)>>>0;else if(a<jspb.BinaryConstants.FLOAT32_MIN)a=Math.round(a/Math.pow(2,-149)),jspb.utils.split64High=0,jspb.utils.split64Low=(b<<31|\na)>>>0;else{var c=Math.floor(Math.log(a)/Math.LN2);a*=Math.pow(2,-c);a=Math.round(a*jspb.BinaryConstants.TWO_TO_23);16777216<=a&&++c;jspb.utils.split64High=0;jspb.utils.split64Low=(b<<31|c+127<<23|a&8388607)>>>0}};\njspb.utils.splitFloat64=function(a){var b=0>a?1:0;a=b?-a:a;if(0===a)jspb.utils.split64High=0<1/a?0:2147483648,jspb.utils.split64Low=0;else if(isNaN(a))jspb.utils.split64High=2147483647,jspb.utils.split64Low=4294967295;else if(a>jspb.BinaryConstants.FLOAT64_MAX)jspb.utils.split64High=(b<<31|2146435072)>>>0,jspb.utils.split64Low=0;else if(a<jspb.BinaryConstants.FLOAT64_MIN){var c=a/Math.pow(2,-1074);a=c/jspb.BinaryConstants.TWO_TO_32;jspb.utils.split64High=(b<<31|a)>>>0;jspb.utils.split64Low=c>>>0}else{c=\na;var d=0;if(2<=c)for(;2<=c&&1023>d;)d++,c/=2;else for(;1>c&&-1022<d;)c*=2,d--;c=a*Math.pow(2,-d);a=c*jspb.BinaryConstants.TWO_TO_20&1048575;c=c*jspb.BinaryConstants.TWO_TO_52>>>0;jspb.utils.split64High=(b<<31|d+1023<<20|a)>>>0;jspb.utils.split64Low=c}};\njspb.utils.splitHash64=function(a){var b=a.charCodeAt(0),c=a.charCodeAt(1),d=a.charCodeAt(2),e=a.charCodeAt(3),f=a.charCodeAt(4),g=a.charCodeAt(5),h=a.charCodeAt(6);a=a.charCodeAt(7);jspb.utils.split64Low=b+(c<<8)+(d<<16)+(e<<24)>>>0;jspb.utils.split64High=f+(g<<8)+(h<<16)+(a<<24)>>>0};jspb.utils.joinUint64=function(a,b){return b*jspb.BinaryConstants.TWO_TO_32+(a>>>0)};\njspb.utils.joinInt64=function(a,b){var c=b&2147483648;c&&(a=~a+1>>>0,b=~b>>>0,0==a&&(b=b+1>>>0));a=jspb.utils.joinUint64(a,b);return c?-a:a};jspb.utils.toZigzag64=function(a,b,c){var d=b>>31;return c(a<<1^d,(b<<1|a>>>31)^d)};jspb.utils.joinZigzag64=function(a,b){return jspb.utils.fromZigzag64(a,b,jspb.utils.joinInt64)};jspb.utils.fromZigzag64=function(a,b,c){var d=-(a&1);return c((a>>>1|b<<31)^d,b>>>1^d)};\njspb.utils.joinFloat32=function(a,b){b=2*(a>>31)+1;var c=a>>>23&255;a&=8388607;return 255==c?a?NaN:Infinity*b:0==c?b*Math.pow(2,-149)*a:b*Math.pow(2,c-150)*(a+Math.pow(2,23))};jspb.utils.joinFloat64=function(a,b){var c=2*(b>>31)+1,d=b>>>20&2047;a=jspb.BinaryConstants.TWO_TO_32*(b&1048575)+a;return 2047==d?a?NaN:Infinity*c:0==d?c*Math.pow(2,-1074)*a:c*Math.pow(2,d-1075)*(a+jspb.BinaryConstants.TWO_TO_52)};\njspb.utils.joinHash64=function(a,b){return String.fromCharCode(a>>>0&255,a>>>8&255,a>>>16&255,a>>>24&255,b>>>0&255,b>>>8&255,b>>>16&255,b>>>24&255)};jspb.utils.DIGITS=\"0123456789abcdef\".split(\"\");jspb.utils.ZERO_CHAR_CODE_=48;jspb.utils.A_CHAR_CODE_=97;\njspb.utils.joinUnsignedDecimalString=function(a,b){function c(a,b){a=a?String(a):\"\";return b?\"0000000\".slice(a.length)+a:a}if(2097151>=b)return\"\"+jspb.utils.joinUint64(a,b);var d=(a>>>24|b<<8)>>>0&16777215;b=b>>16&65535;a=(a&16777215)+6777216*d+6710656*b;d+=8147497*b;b*=2;1E7<=a&&(d+=Math.floor(a/1E7),a%=1E7);1E7<=d&&(b+=Math.floor(d/1E7),d%=1E7);return c(b,0)+c(d,b)+c(a,1)};\njspb.utils.joinSignedDecimalString=function(a,b){var c=b&2147483648;c&&(a=~a+1>>>0,b=~b+(0==a?1:0)>>>0);a=jspb.utils.joinUnsignedDecimalString(a,b);return c?\"-\"+a:a};jspb.utils.hash64ToDecimalString=function(a,b){jspb.utils.splitHash64(a);a=jspb.utils.split64Low;var c=jspb.utils.split64High;return b?jspb.utils.joinSignedDecimalString(a,c):jspb.utils.joinUnsignedDecimalString(a,c)};\njspb.utils.hash64ArrayToDecimalStrings=function(a,b){for(var c=Array(a.length),d=0;d<a.length;d++)c[d]=jspb.utils.hash64ToDecimalString(a[d],b);return c};\njspb.utils.decimalStringToHash64=function(a){function b(a,b){for(var c=0;8>c&&(1!==a||0<b);c++)b=a*e[c]+b,e[c]=b&255,b>>>=8}function c(){for(var a=0;8>a;a++)e[a]=~e[a]&255}goog.asserts.assert(0<a.length);var d=!1;\"-\"===a[0]&&(d=!0,a=a.slice(1));for(var e=[0,0,0,0,0,0,0,0],f=0;f<a.length;f++)b(10,a.charCodeAt(f)-jspb.utils.ZERO_CHAR_CODE_);d&&(c(),b(1,1));return goog.crypt.byteArrayToString(e)};jspb.utils.splitDecimalString=function(a){jspb.utils.splitHash64(jspb.utils.decimalStringToHash64(a))};\njspb.utils.toHexDigit_=function(a){return String.fromCharCode(10>a?jspb.utils.ZERO_CHAR_CODE_+a:jspb.utils.A_CHAR_CODE_-10+a)};jspb.utils.fromHexCharCode_=function(a){return a>=jspb.utils.A_CHAR_CODE_?a-jspb.utils.A_CHAR_CODE_+10:a-jspb.utils.ZERO_CHAR_CODE_};jspb.utils.hash64ToHexString=function(a){var b=Array(18);b[0]=\"0\";b[1]=\"x\";for(var c=0;8>c;c++){var d=a.charCodeAt(7-c);b[2*c+2]=jspb.utils.toHexDigit_(d>>4);b[2*c+3]=jspb.utils.toHexDigit_(d&15)}return b.join(\"\")};\njspb.utils.hexStringToHash64=function(a){a=a.toLowerCase();goog.asserts.assert(18==a.length);goog.asserts.assert(\"0\"==a[0]);goog.asserts.assert(\"x\"==a[1]);for(var b=\"\",c=0;8>c;c++){var d=jspb.utils.fromHexCharCode_(a.charCodeAt(2*c+2)),e=jspb.utils.fromHexCharCode_(a.charCodeAt(2*c+3));b=String.fromCharCode(16*d+e)+b}return b};\njspb.utils.hash64ToNumber=function(a,b){jspb.utils.splitHash64(a);a=jspb.utils.split64Low;var c=jspb.utils.split64High;return b?jspb.utils.joinInt64(a,c):jspb.utils.joinUint64(a,c)};jspb.utils.numberToHash64=function(a){jspb.utils.splitInt64(a);return jspb.utils.joinHash64(jspb.utils.split64Low,jspb.utils.split64High)};jspb.utils.countVarints=function(a,b,c){for(var d=0,e=b;e<c;e++)d+=a[e]>>7;return c-b-d};\njspb.utils.countVarintFields=function(a,b,c,d){var e=0;d=8*d+jspb.BinaryConstants.WireType.VARINT;if(128>d)for(;b<c&&a[b++]==d;)for(e++;;){var f=a[b++];if(0==(f&128))break}else for(;b<c;){for(f=d;128<f;){if(a[b]!=(f&127|128))return e;b++;f>>=7}if(a[b++]!=f)break;for(e++;f=a[b++],0!=(f&128););}return e};jspb.utils.countFixedFields_=function(a,b,c,d,e){var f=0;if(128>d)for(;b<c&&a[b++]==d;)f++,b+=e;else for(;b<c;){for(var g=d;128<g;){if(a[b++]!=(g&127|128))return f;g>>=7}if(a[b++]!=g)break;f++;b+=e}return f};\njspb.utils.countFixed32Fields=function(a,b,c,d){return jspb.utils.countFixedFields_(a,b,c,8*d+jspb.BinaryConstants.WireType.FIXED32,4)};jspb.utils.countFixed64Fields=function(a,b,c,d){return jspb.utils.countFixedFields_(a,b,c,8*d+jspb.BinaryConstants.WireType.FIXED64,8)};\njspb.utils.countDelimitedFields=function(a,b,c,d){var e=0;for(d=8*d+jspb.BinaryConstants.WireType.DELIMITED;b<c;){for(var f=d;128<f;){if(a[b++]!=(f&127|128))return e;f>>=7}if(a[b++]!=f)break;e++;for(var g=0,h=1;f=a[b++],g+=(f&127)*h,h*=128,0!=(f&128););b+=g}return e};jspb.utils.debugBytesToTextFormat=function(a){var b='\"';if(a){a=jspb.utils.byteSourceToUint8Array(a);for(var c=0;c<a.length;c++)b+=\"\\\\x\",16>a[c]&&(b+=\"0\"),b+=a[c].toString(16)}return b+'\"'};\njspb.utils.debugScalarToTextFormat=function(a){return\"string\"===typeof a?goog.string.quote(a):a.toString()};jspb.utils.stringToByteArray=function(a){for(var b=new Uint8Array(a.length),c=0;c<a.length;c++){var d=a.charCodeAt(c);if(255<d)throw Error(\"Conversion error: string contains codepoint outside of byte range\");b[c]=d}return b};\njspb.utils.byteSourceToUint8Array=function(a){if(a.constructor===Uint8Array)return a;if(a.constructor===ArrayBuffer||\"undefined\"!=typeof Buffer&&a.constructor===Buffer||a.constructor===Array)return new Uint8Array(a);if(a.constructor===String)return goog.crypt.base64.decodeStringToUint8Array(a);goog.asserts.fail(\"Type not convertible to Uint8Array.\");return new Uint8Array(0)};jspb.BinaryDecoder=function(a,b,c){this.bytes_=null;this.cursor_=this.end_=this.start_=0;this.error_=!1;a&&this.setBlock(a,b,c)};jspb.BinaryDecoder.instanceCache_=[];jspb.BinaryDecoder.alloc=function(a,b,c){if(jspb.BinaryDecoder.instanceCache_.length){var d=jspb.BinaryDecoder.instanceCache_.pop();a&&d.setBlock(a,b,c);return d}return new jspb.BinaryDecoder(a,b,c)};jspb.BinaryDecoder.prototype.free=function(){this.clear();100>jspb.BinaryDecoder.instanceCache_.length&&jspb.BinaryDecoder.instanceCache_.push(this)};\njspb.BinaryDecoder.prototype.clone=function(){return jspb.BinaryDecoder.alloc(this.bytes_,this.start_,this.end_-this.start_)};jspb.BinaryDecoder.prototype.clear=function(){this.bytes_=null;this.cursor_=this.end_=this.start_=0;this.error_=!1};jspb.BinaryDecoder.prototype.getBuffer=function(){return this.bytes_};\njspb.BinaryDecoder.prototype.setBlock=function(a,b,c){this.bytes_=jspb.utils.byteSourceToUint8Array(a);this.start_=void 0!==b?b:0;this.end_=void 0!==c?this.start_+c:this.bytes_.length;this.cursor_=this.start_};jspb.BinaryDecoder.prototype.getEnd=function(){return this.end_};jspb.BinaryDecoder.prototype.setEnd=function(a){this.end_=a};jspb.BinaryDecoder.prototype.reset=function(){this.cursor_=this.start_};jspb.BinaryDecoder.prototype.getCursor=function(){return this.cursor_};\njspb.BinaryDecoder.prototype.setCursor=function(a){this.cursor_=a};jspb.BinaryDecoder.prototype.advance=function(a){this.cursor_+=a;goog.asserts.assert(this.cursor_<=this.end_)};jspb.BinaryDecoder.prototype.atEnd=function(){return this.cursor_==this.end_};jspb.BinaryDecoder.prototype.pastEnd=function(){return this.cursor_>this.end_};jspb.BinaryDecoder.prototype.getError=function(){return this.error_||0>this.cursor_||this.cursor_>this.end_};\njspb.BinaryDecoder.prototype.readSplitVarint64=function(a){for(var b=128,c=0,d=0,e=0;4>e&&128<=b;e++)b=this.bytes_[this.cursor_++],c|=(b&127)<<7*e;128<=b&&(b=this.bytes_[this.cursor_++],c|=(b&127)<<28,d|=(b&127)>>4);if(128<=b)for(e=0;5>e&&128<=b;e++)b=this.bytes_[this.cursor_++],d|=(b&127)<<7*e+3;if(128>b)return a(c>>>0,d>>>0);goog.asserts.fail(\"Failed to read varint, encoding is invalid.\");this.error_=!0};\njspb.BinaryDecoder.prototype.readSplitZigzagVarint64=function(a){return this.readSplitVarint64(function(b,c){return jspb.utils.fromZigzag64(b,c,a)})};jspb.BinaryDecoder.prototype.readSplitFixed64=function(a){var b=this.bytes_,c=this.cursor_;this.cursor_+=8;for(var d=0,e=0,f=c+7;f>=c;f--)d=d<<8|b[f],e=e<<8|b[f+4];return a(d,e)};jspb.BinaryDecoder.prototype.skipVarint=function(){for(;this.bytes_[this.cursor_]&128;)this.cursor_++;this.cursor_++};\njspb.BinaryDecoder.prototype.unskipVarint=function(a){for(;128<a;)this.cursor_--,a>>>=7;this.cursor_--};\njspb.BinaryDecoder.prototype.readUnsignedVarint32=function(){var a=this.bytes_;var b=a[this.cursor_+0];var c=b&127;if(128>b)return this.cursor_+=1,goog.asserts.assert(this.cursor_<=this.end_),c;b=a[this.cursor_+1];c|=(b&127)<<7;if(128>b)return this.cursor_+=2,goog.asserts.assert(this.cursor_<=this.end_),c;b=a[this.cursor_+2];c|=(b&127)<<14;if(128>b)return this.cursor_+=3,goog.asserts.assert(this.cursor_<=this.end_),c;b=a[this.cursor_+3];c|=(b&127)<<21;if(128>b)return this.cursor_+=4,goog.asserts.assert(this.cursor_<=\nthis.end_),c;b=a[this.cursor_+4];c|=(b&15)<<28;if(128>b)return this.cursor_+=5,goog.asserts.assert(this.cursor_<=this.end_),c>>>0;this.cursor_+=5;128<=a[this.cursor_++]&&128<=a[this.cursor_++]&&128<=a[this.cursor_++]&&128<=a[this.cursor_++]&&128<=a[this.cursor_++]&&goog.asserts.assert(!1);goog.asserts.assert(this.cursor_<=this.end_);return c};jspb.BinaryDecoder.prototype.readSignedVarint32=jspb.BinaryDecoder.prototype.readUnsignedVarint32;jspb.BinaryDecoder.prototype.readUnsignedVarint32String=function(){return this.readUnsignedVarint32().toString()};\njspb.BinaryDecoder.prototype.readSignedVarint32String=function(){return this.readSignedVarint32().toString()};jspb.BinaryDecoder.prototype.readZigzagVarint32=function(){var a=this.readUnsignedVarint32();return a>>>1^-(a&1)};jspb.BinaryDecoder.prototype.readUnsignedVarint64=function(){return this.readSplitVarint64(jspb.utils.joinUint64)};jspb.BinaryDecoder.prototype.readUnsignedVarint64String=function(){return this.readSplitVarint64(jspb.utils.joinUnsignedDecimalString)};\njspb.BinaryDecoder.prototype.readSignedVarint64=function(){return this.readSplitVarint64(jspb.utils.joinInt64)};jspb.BinaryDecoder.prototype.readSignedVarint64String=function(){return this.readSplitVarint64(jspb.utils.joinSignedDecimalString)};jspb.BinaryDecoder.prototype.readZigzagVarint64=function(){return this.readSplitVarint64(jspb.utils.joinZigzag64)};jspb.BinaryDecoder.prototype.readZigzagVarintHash64=function(){return this.readSplitZigzagVarint64(jspb.utils.joinHash64)};\njspb.BinaryDecoder.prototype.readZigzagVarint64String=function(){return this.readSplitZigzagVarint64(jspb.utils.joinSignedDecimalString)};jspb.BinaryDecoder.prototype.readUint8=function(){var a=this.bytes_[this.cursor_+0];this.cursor_+=1;goog.asserts.assert(this.cursor_<=this.end_);return a};jspb.BinaryDecoder.prototype.readUint16=function(){var a=this.bytes_[this.cursor_+0],b=this.bytes_[this.cursor_+1];this.cursor_+=2;goog.asserts.assert(this.cursor_<=this.end_);return a<<0|b<<8};\njspb.BinaryDecoder.prototype.readUint32=function(){var a=this.bytes_[this.cursor_+0],b=this.bytes_[this.cursor_+1],c=this.bytes_[this.cursor_+2],d=this.bytes_[this.cursor_+3];this.cursor_+=4;goog.asserts.assert(this.cursor_<=this.end_);return(a<<0|b<<8|c<<16|d<<24)>>>0};jspb.BinaryDecoder.prototype.readUint64=function(){var a=this.readUint32(),b=this.readUint32();return jspb.utils.joinUint64(a,b)};\njspb.BinaryDecoder.prototype.readUint64String=function(){var a=this.readUint32(),b=this.readUint32();return jspb.utils.joinUnsignedDecimalString(a,b)};jspb.BinaryDecoder.prototype.readInt8=function(){var a=this.bytes_[this.cursor_+0];this.cursor_+=1;goog.asserts.assert(this.cursor_<=this.end_);return a<<24>>24};\njspb.BinaryDecoder.prototype.readInt16=function(){var a=this.bytes_[this.cursor_+0],b=this.bytes_[this.cursor_+1];this.cursor_+=2;goog.asserts.assert(this.cursor_<=this.end_);return(a<<0|b<<8)<<16>>16};jspb.BinaryDecoder.prototype.readInt32=function(){var a=this.bytes_[this.cursor_+0],b=this.bytes_[this.cursor_+1],c=this.bytes_[this.cursor_+2],d=this.bytes_[this.cursor_+3];this.cursor_+=4;goog.asserts.assert(this.cursor_<=this.end_);return a<<0|b<<8|c<<16|d<<24};\njspb.BinaryDecoder.prototype.readInt64=function(){var a=this.readUint32(),b=this.readUint32();return jspb.utils.joinInt64(a,b)};jspb.BinaryDecoder.prototype.readInt64String=function(){var a=this.readUint32(),b=this.readUint32();return jspb.utils.joinSignedDecimalString(a,b)};jspb.BinaryDecoder.prototype.readFloat=function(){var a=this.readUint32();return jspb.utils.joinFloat32(a,0)};\njspb.BinaryDecoder.prototype.readDouble=function(){var a=this.readUint32(),b=this.readUint32();return jspb.utils.joinFloat64(a,b)};jspb.BinaryDecoder.prototype.readBool=function(){return!!this.bytes_[this.cursor_++]};jspb.BinaryDecoder.prototype.readEnum=function(){return this.readSignedVarint32()};\njspb.BinaryDecoder.prototype.readString=function(a){var b=this.bytes_,c=this.cursor_;a=c+a;for(var d=[],e=\"\";c<a;){var f=b[c++];if(128>f)d.push(f);else if(192>f)continue;else if(224>f){var g=b[c++];d.push((f&31)<<6|g&63)}else if(240>f){g=b[c++];var h=b[c++];d.push((f&15)<<12|(g&63)<<6|h&63)}else if(248>f){g=b[c++];h=b[c++];var k=b[c++];f=(f&7)<<18|(g&63)<<12|(h&63)<<6|k&63;f-=65536;d.push((f>>10&1023)+55296,(f&1023)+56320)}8192<=d.length&&(e+=String.fromCharCode.apply(null,d),d.length=0)}e+=goog.crypt.byteArrayToString(d);\nthis.cursor_=c;return e};jspb.BinaryDecoder.prototype.readStringWithLength=function(){var a=this.readUnsignedVarint32();return this.readString(a)};jspb.BinaryDecoder.prototype.readBytes=function(a){if(0>a||this.cursor_+a>this.bytes_.length)return this.error_=!0,goog.asserts.fail(\"Invalid byte length!\"),new Uint8Array(0);var b=this.bytes_.subarray(this.cursor_,this.cursor_+a);this.cursor_+=a;goog.asserts.assert(this.cursor_<=this.end_);return b};jspb.BinaryDecoder.prototype.readVarintHash64=function(){return this.readSplitVarint64(jspb.utils.joinHash64)};\njspb.BinaryDecoder.prototype.readFixedHash64=function(){var a=this.bytes_,b=this.cursor_,c=a[b+0],d=a[b+1],e=a[b+2],f=a[b+3],g=a[b+4],h=a[b+5],k=a[b+6];a=a[b+7];this.cursor_+=8;return String.fromCharCode(c,d,e,f,g,h,k,a)};jspb.BinaryReader=function(a,b,c){this.decoder_=jspb.BinaryDecoder.alloc(a,b,c);this.fieldCursor_=this.decoder_.getCursor();this.nextField_=jspb.BinaryConstants.INVALID_FIELD_NUMBER;this.nextWireType_=jspb.BinaryConstants.WireType.INVALID;this.error_=!1;this.readCallbacks_=null};jspb.BinaryReader.instanceCache_=[];\njspb.BinaryReader.alloc=function(a,b,c){if(jspb.BinaryReader.instanceCache_.length){var d=jspb.BinaryReader.instanceCache_.pop();a&&d.decoder_.setBlock(a,b,c);return d}return new jspb.BinaryReader(a,b,c)};jspb.BinaryReader.prototype.alloc=jspb.BinaryReader.alloc;\njspb.BinaryReader.prototype.free=function(){this.decoder_.clear();this.nextField_=jspb.BinaryConstants.INVALID_FIELD_NUMBER;this.nextWireType_=jspb.BinaryConstants.WireType.INVALID;this.error_=!1;this.readCallbacks_=null;100>jspb.BinaryReader.instanceCache_.length&&jspb.BinaryReader.instanceCache_.push(this)};jspb.BinaryReader.prototype.getFieldCursor=function(){return this.fieldCursor_};jspb.BinaryReader.prototype.getCursor=function(){return this.decoder_.getCursor()};\njspb.BinaryReader.prototype.getBuffer=function(){return this.decoder_.getBuffer()};jspb.BinaryReader.prototype.getFieldNumber=function(){return this.nextField_};jspb.BinaryReader.prototype.getWireType=function(){return this.nextWireType_};jspb.BinaryReader.prototype.isDelimited=function(){return this.nextWireType_==jspb.BinaryConstants.WireType.DELIMITED};jspb.BinaryReader.prototype.isEndGroup=function(){return this.nextWireType_==jspb.BinaryConstants.WireType.END_GROUP};\njspb.BinaryReader.prototype.getError=function(){return this.error_||this.decoder_.getError()};jspb.BinaryReader.prototype.setBlock=function(a,b,c){this.decoder_.setBlock(a,b,c);this.nextField_=jspb.BinaryConstants.INVALID_FIELD_NUMBER;this.nextWireType_=jspb.BinaryConstants.WireType.INVALID};jspb.BinaryReader.prototype.reset=function(){this.decoder_.reset();this.nextField_=jspb.BinaryConstants.INVALID_FIELD_NUMBER;this.nextWireType_=jspb.BinaryConstants.WireType.INVALID};\njspb.BinaryReader.prototype.advance=function(a){this.decoder_.advance(a)};\njspb.BinaryReader.prototype.nextField=function(){if(this.decoder_.atEnd())return!1;if(this.getError())return goog.asserts.fail(\"Decoder hit an error\"),!1;this.fieldCursor_=this.decoder_.getCursor();var a=this.decoder_.readUnsignedVarint32(),b=a>>>3;a&=7;if(a!=jspb.BinaryConstants.WireType.VARINT&&a!=jspb.BinaryConstants.WireType.FIXED32&&a!=jspb.BinaryConstants.WireType.FIXED64&&a!=jspb.BinaryConstants.WireType.DELIMITED&&a!=jspb.BinaryConstants.WireType.START_GROUP&&a!=jspb.BinaryConstants.WireType.END_GROUP)return goog.asserts.fail(\"Invalid wire type: %s (at position %s)\",\na,this.fieldCursor_),this.error_=!0,!1;this.nextField_=b;this.nextWireType_=a;return!0};jspb.BinaryReader.prototype.unskipHeader=function(){this.decoder_.unskipVarint(this.nextField_<<3|this.nextWireType_)};jspb.BinaryReader.prototype.skipMatchingFields=function(){var a=this.nextField_;for(this.unskipHeader();this.nextField()&&this.getFieldNumber()==a;)this.skipField();this.decoder_.atEnd()||this.unskipHeader()};\njspb.BinaryReader.prototype.skipVarintField=function(){this.nextWireType_!=jspb.BinaryConstants.WireType.VARINT?(goog.asserts.fail(\"Invalid wire type for skipVarintField\"),this.skipField()):this.decoder_.skipVarint()};jspb.BinaryReader.prototype.skipDelimitedField=function(){if(this.nextWireType_!=jspb.BinaryConstants.WireType.DELIMITED)goog.asserts.fail(\"Invalid wire type for skipDelimitedField\"),this.skipField();else{var a=this.decoder_.readUnsignedVarint32();this.decoder_.advance(a)}};\njspb.BinaryReader.prototype.skipFixed32Field=function(){this.nextWireType_!=jspb.BinaryConstants.WireType.FIXED32?(goog.asserts.fail(\"Invalid wire type for skipFixed32Field\"),this.skipField()):this.decoder_.advance(4)};jspb.BinaryReader.prototype.skipFixed64Field=function(){this.nextWireType_!=jspb.BinaryConstants.WireType.FIXED64?(goog.asserts.fail(\"Invalid wire type for skipFixed64Field\"),this.skipField()):this.decoder_.advance(8)};\njspb.BinaryReader.prototype.skipGroup=function(){var a=this.nextField_;do{if(!this.nextField()){goog.asserts.fail(\"Unmatched start-group tag: stream EOF\");this.error_=!0;break}if(this.nextWireType_==jspb.BinaryConstants.WireType.END_GROUP){this.nextField_!=a&&(goog.asserts.fail(\"Unmatched end-group tag\"),this.error_=!0);break}this.skipField()}while(1)};\njspb.BinaryReader.prototype.skipField=function(){switch(this.nextWireType_){case jspb.BinaryConstants.WireType.VARINT:this.skipVarintField();break;case jspb.BinaryConstants.WireType.FIXED64:this.skipFixed64Field();break;case jspb.BinaryConstants.WireType.DELIMITED:this.skipDelimitedField();break;case jspb.BinaryConstants.WireType.FIXED32:this.skipFixed32Field();break;case jspb.BinaryConstants.WireType.START_GROUP:this.skipGroup();break;default:goog.asserts.fail(\"Invalid wire encoding for field.\")}};\njspb.BinaryReader.prototype.registerReadCallback=function(a,b){null===this.readCallbacks_&&(this.readCallbacks_={});goog.asserts.assert(!this.readCallbacks_[a]);this.readCallbacks_[a]=b};jspb.BinaryReader.prototype.runReadCallback=function(a){goog.asserts.assert(null!==this.readCallbacks_);a=this.readCallbacks_[a];goog.asserts.assert(a);return a(this)};\njspb.BinaryReader.prototype.readAny=function(a){this.nextWireType_=jspb.BinaryConstants.FieldTypeToWireType(a);var b=jspb.BinaryConstants.FieldType;switch(a){case b.DOUBLE:return this.readDouble();case b.FLOAT:return this.readFloat();case b.INT64:return this.readInt64();case b.UINT64:return this.readUint64();case b.INT32:return this.readInt32();case b.FIXED64:return this.readFixed64();case b.FIXED32:return this.readFixed32();case b.BOOL:return this.readBool();case b.STRING:return this.readString();\ncase b.GROUP:goog.asserts.fail(\"Group field type not supported in readAny()\");case b.MESSAGE:goog.asserts.fail(\"Message field type not supported in readAny()\");case b.BYTES:return this.readBytes();case b.UINT32:return this.readUint32();case b.ENUM:return this.readEnum();case b.SFIXED32:return this.readSfixed32();case b.SFIXED64:return this.readSfixed64();case b.SINT32:return this.readSint32();case b.SINT64:return this.readSint64();case b.FHASH64:return this.readFixedHash64();case b.VHASH64:return this.readVarintHash64();\ndefault:goog.asserts.fail(\"Invalid field type in readAny()\")}return 0};jspb.BinaryReader.prototype.readMessage=function(a,b){goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.DELIMITED);var c=this.decoder_.getEnd(),d=this.decoder_.readUnsignedVarint32();d=this.decoder_.getCursor()+d;this.decoder_.setEnd(d);b(a,this);this.decoder_.setCursor(d);this.decoder_.setEnd(c)};\njspb.BinaryReader.prototype.readGroup=function(a,b,c){goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.START_GROUP);goog.asserts.assert(this.nextField_==a);c(b,this);this.error_||this.nextWireType_==jspb.BinaryConstants.WireType.END_GROUP||(goog.asserts.fail(\"Group submessage did not end with an END_GROUP tag\"),this.error_=!0)};\njspb.BinaryReader.prototype.getFieldDecoder=function(){goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.DELIMITED);var a=this.decoder_.readUnsignedVarint32(),b=this.decoder_.getCursor(),c=b+a;a=jspb.BinaryDecoder.alloc(this.decoder_.getBuffer(),b,a);this.decoder_.setCursor(c);return a};jspb.BinaryReader.prototype.readInt32=function(){goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT);return this.decoder_.readSignedVarint32()};\njspb.BinaryReader.prototype.readInt32String=function(){goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT);return this.decoder_.readSignedVarint32String()};jspb.BinaryReader.prototype.readInt64=function(){goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT);return this.decoder_.readSignedVarint64()};jspb.BinaryReader.prototype.readInt64String=function(){goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT);return this.decoder_.readSignedVarint64String()};\njspb.BinaryReader.prototype.readUint32=function(){goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT);return this.decoder_.readUnsignedVarint32()};jspb.BinaryReader.prototype.readUint32String=function(){goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT);return this.decoder_.readUnsignedVarint32String()};jspb.BinaryReader.prototype.readUint64=function(){goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT);return this.decoder_.readUnsignedVarint64()};\njspb.BinaryReader.prototype.readUint64String=function(){goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT);return this.decoder_.readUnsignedVarint64String()};jspb.BinaryReader.prototype.readSint32=function(){goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT);return this.decoder_.readZigzagVarint32()};jspb.BinaryReader.prototype.readSint64=function(){goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT);return this.decoder_.readZigzagVarint64()};\njspb.BinaryReader.prototype.readSint64String=function(){goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT);return this.decoder_.readZigzagVarint64String()};jspb.BinaryReader.prototype.readFixed32=function(){goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.FIXED32);return this.decoder_.readUint32()};jspb.BinaryReader.prototype.readFixed64=function(){goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.FIXED64);return this.decoder_.readUint64()};\njspb.BinaryReader.prototype.readFixed64String=function(){goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.FIXED64);return this.decoder_.readUint64String()};jspb.BinaryReader.prototype.readSfixed32=function(){goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.FIXED32);return this.decoder_.readInt32()};jspb.BinaryReader.prototype.readSfixed32String=function(){goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.FIXED32);return this.decoder_.readInt32().toString()};\njspb.BinaryReader.prototype.readSfixed64=function(){goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.FIXED64);return this.decoder_.readInt64()};jspb.BinaryReader.prototype.readSfixed64String=function(){goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.FIXED64);return this.decoder_.readInt64String()};jspb.BinaryReader.prototype.readFloat=function(){goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.FIXED32);return this.decoder_.readFloat()};\njspb.BinaryReader.prototype.readDouble=function(){goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.FIXED64);return this.decoder_.readDouble()};jspb.BinaryReader.prototype.readBool=function(){goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT);return!!this.decoder_.readUnsignedVarint32()};jspb.BinaryReader.prototype.readEnum=function(){goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT);return this.decoder_.readSignedVarint64()};\njspb.BinaryReader.prototype.readString=function(){goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.DELIMITED);var a=this.decoder_.readUnsignedVarint32();return this.decoder_.readString(a)};jspb.BinaryReader.prototype.readBytes=function(){goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.DELIMITED);var a=this.decoder_.readUnsignedVarint32();return this.decoder_.readBytes(a)};\njspb.BinaryReader.prototype.readVarintHash64=function(){goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT);return this.decoder_.readVarintHash64()};jspb.BinaryReader.prototype.readSintHash64=function(){goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT);return this.decoder_.readZigzagVarintHash64()};jspb.BinaryReader.prototype.readSplitVarint64=function(a){goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT);return this.decoder_.readSplitVarint64(a)};\njspb.BinaryReader.prototype.readSplitZigzagVarint64=function(a){goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.VARINT);return this.decoder_.readSplitVarint64(function(b,c){return jspb.utils.fromZigzag64(b,c,a)})};jspb.BinaryReader.prototype.readFixedHash64=function(){goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.FIXED64);return this.decoder_.readFixedHash64()};\njspb.BinaryReader.prototype.readSplitFixed64=function(a){goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.FIXED64);return this.decoder_.readSplitFixed64(a)};jspb.BinaryReader.prototype.readPackedField_=function(a){goog.asserts.assert(this.nextWireType_==jspb.BinaryConstants.WireType.DELIMITED);var b=this.decoder_.readUnsignedVarint32();b=this.decoder_.getCursor()+b;for(var c=[];this.decoder_.getCursor()<b;)c.push(a.call(this.decoder_));return c};\njspb.BinaryReader.prototype.readPackedInt32=function(){return this.readPackedField_(this.decoder_.readSignedVarint32)};jspb.BinaryReader.prototype.readPackedInt32String=function(){return this.readPackedField_(this.decoder_.readSignedVarint32String)};jspb.BinaryReader.prototype.readPackedInt64=function(){return this.readPackedField_(this.decoder_.readSignedVarint64)};jspb.BinaryReader.prototype.readPackedInt64String=function(){return this.readPackedField_(this.decoder_.readSignedVarint64String)};\njspb.BinaryReader.prototype.readPackedUint32=function(){return this.readPackedField_(this.decoder_.readUnsignedVarint32)};jspb.BinaryReader.prototype.readPackedUint32String=function(){return this.readPackedField_(this.decoder_.readUnsignedVarint32String)};jspb.BinaryReader.prototype.readPackedUint64=function(){return this.readPackedField_(this.decoder_.readUnsignedVarint64)};jspb.BinaryReader.prototype.readPackedUint64String=function(){return this.readPackedField_(this.decoder_.readUnsignedVarint64String)};\njspb.BinaryReader.prototype.readPackedSint32=function(){return this.readPackedField_(this.decoder_.readZigzagVarint32)};jspb.BinaryReader.prototype.readPackedSint64=function(){return this.readPackedField_(this.decoder_.readZigzagVarint64)};jspb.BinaryReader.prototype.readPackedSint64String=function(){return this.readPackedField_(this.decoder_.readZigzagVarint64String)};jspb.BinaryReader.prototype.readPackedFixed32=function(){return this.readPackedField_(this.decoder_.readUint32)};\njspb.BinaryReader.prototype.readPackedFixed64=function(){return this.readPackedField_(this.decoder_.readUint64)};jspb.BinaryReader.prototype.readPackedFixed64String=function(){return this.readPackedField_(this.decoder_.readUint64String)};jspb.BinaryReader.prototype.readPackedSfixed32=function(){return this.readPackedField_(this.decoder_.readInt32)};jspb.BinaryReader.prototype.readPackedSfixed64=function(){return this.readPackedField_(this.decoder_.readInt64)};\njspb.BinaryReader.prototype.readPackedSfixed64String=function(){return this.readPackedField_(this.decoder_.readInt64String)};jspb.BinaryReader.prototype.readPackedFloat=function(){return this.readPackedField_(this.decoder_.readFloat)};jspb.BinaryReader.prototype.readPackedDouble=function(){return this.readPackedField_(this.decoder_.readDouble)};jspb.BinaryReader.prototype.readPackedBool=function(){return this.readPackedField_(this.decoder_.readBool)};jspb.BinaryReader.prototype.readPackedEnum=function(){return this.readPackedField_(this.decoder_.readEnum)};\njspb.BinaryReader.prototype.readPackedVarintHash64=function(){return this.readPackedField_(this.decoder_.readVarintHash64)};jspb.BinaryReader.prototype.readPackedFixedHash64=function(){return this.readPackedField_(this.decoder_.readFixedHash64)};jspb.BinaryEncoder=function(){this.buffer_=[]};jspb.BinaryEncoder.prototype.length=function(){return this.buffer_.length};jspb.BinaryEncoder.prototype.end=function(){var a=this.buffer_;this.buffer_=[];return a};\njspb.BinaryEncoder.prototype.writeSplitVarint64=function(a,b){goog.asserts.assert(a==Math.floor(a));goog.asserts.assert(b==Math.floor(b));goog.asserts.assert(0<=a&&a<jspb.BinaryConstants.TWO_TO_32);for(goog.asserts.assert(0<=b&&b<jspb.BinaryConstants.TWO_TO_32);0<b||127<a;)this.buffer_.push(a&127|128),a=(a>>>7|b<<25)>>>0,b>>>=7;this.buffer_.push(a)};\njspb.BinaryEncoder.prototype.writeSplitFixed64=function(a,b){goog.asserts.assert(a==Math.floor(a));goog.asserts.assert(b==Math.floor(b));goog.asserts.assert(0<=a&&a<jspb.BinaryConstants.TWO_TO_32);goog.asserts.assert(0<=b&&b<jspb.BinaryConstants.TWO_TO_32);this.writeUint32(a);this.writeUint32(b)};\njspb.BinaryEncoder.prototype.writeUnsignedVarint32=function(a){goog.asserts.assert(a==Math.floor(a));for(goog.asserts.assert(0<=a&&a<jspb.BinaryConstants.TWO_TO_32);127<a;)this.buffer_.push(a&127|128),a>>>=7;this.buffer_.push(a)};\njspb.BinaryEncoder.prototype.writeSignedVarint32=function(a){goog.asserts.assert(a==Math.floor(a));goog.asserts.assert(a>=-jspb.BinaryConstants.TWO_TO_31&&a<jspb.BinaryConstants.TWO_TO_31);if(0<=a)this.writeUnsignedVarint32(a);else{for(var b=0;9>b;b++)this.buffer_.push(a&127|128),a>>=7;this.buffer_.push(1)}};\njspb.BinaryEncoder.prototype.writeUnsignedVarint64=function(a){goog.asserts.assert(a==Math.floor(a));goog.asserts.assert(0<=a&&a<jspb.BinaryConstants.TWO_TO_64);jspb.utils.splitInt64(a);this.writeSplitVarint64(jspb.utils.split64Low,jspb.utils.split64High)};\njspb.BinaryEncoder.prototype.writeSignedVarint64=function(a){goog.asserts.assert(a==Math.floor(a));goog.asserts.assert(a>=-jspb.BinaryConstants.TWO_TO_63&&a<jspb.BinaryConstants.TWO_TO_63);jspb.utils.splitInt64(a);this.writeSplitVarint64(jspb.utils.split64Low,jspb.utils.split64High)};\njspb.BinaryEncoder.prototype.writeZigzagVarint32=function(a){goog.asserts.assert(a==Math.floor(a));goog.asserts.assert(a>=-jspb.BinaryConstants.TWO_TO_31&&a<jspb.BinaryConstants.TWO_TO_31);this.writeUnsignedVarint32((a<<1^a>>31)>>>0)};jspb.BinaryEncoder.prototype.writeZigzagVarint64=function(a){goog.asserts.assert(a==Math.floor(a));goog.asserts.assert(a>=-jspb.BinaryConstants.TWO_TO_63&&a<jspb.BinaryConstants.TWO_TO_63);jspb.utils.splitZigzag64(a);this.writeSplitVarint64(jspb.utils.split64Low,jspb.utils.split64High)};\njspb.BinaryEncoder.prototype.writeZigzagVarint64String=function(a){this.writeZigzagVarintHash64(jspb.utils.decimalStringToHash64(a))};jspb.BinaryEncoder.prototype.writeZigzagVarintHash64=function(a){var b=this;jspb.utils.splitHash64(a);jspb.utils.toZigzag64(jspb.utils.split64Low,jspb.utils.split64High,function(a,d){b.writeSplitVarint64(a>>>0,d>>>0)})};\njspb.BinaryEncoder.prototype.writeUint8=function(a){goog.asserts.assert(a==Math.floor(a));goog.asserts.assert(0<=a&&256>a);this.buffer_.push(a>>>0&255)};jspb.BinaryEncoder.prototype.writeUint16=function(a){goog.asserts.assert(a==Math.floor(a));goog.asserts.assert(0<=a&&65536>a);this.buffer_.push(a>>>0&255);this.buffer_.push(a>>>8&255)};\njspb.BinaryEncoder.prototype.writeUint32=function(a){goog.asserts.assert(a==Math.floor(a));goog.asserts.assert(0<=a&&a<jspb.BinaryConstants.TWO_TO_32);this.buffer_.push(a>>>0&255);this.buffer_.push(a>>>8&255);this.buffer_.push(a>>>16&255);this.buffer_.push(a>>>24&255)};jspb.BinaryEncoder.prototype.writeUint64=function(a){goog.asserts.assert(a==Math.floor(a));goog.asserts.assert(0<=a&&a<jspb.BinaryConstants.TWO_TO_64);jspb.utils.splitUint64(a);this.writeUint32(jspb.utils.split64Low);this.writeUint32(jspb.utils.split64High)};\njspb.BinaryEncoder.prototype.writeInt8=function(a){goog.asserts.assert(a==Math.floor(a));goog.asserts.assert(-128<=a&&128>a);this.buffer_.push(a>>>0&255)};jspb.BinaryEncoder.prototype.writeInt16=function(a){goog.asserts.assert(a==Math.floor(a));goog.asserts.assert(-32768<=a&&32768>a);this.buffer_.push(a>>>0&255);this.buffer_.push(a>>>8&255)};\njspb.BinaryEncoder.prototype.writeInt32=function(a){goog.asserts.assert(a==Math.floor(a));goog.asserts.assert(a>=-jspb.BinaryConstants.TWO_TO_31&&a<jspb.BinaryConstants.TWO_TO_31);this.buffer_.push(a>>>0&255);this.buffer_.push(a>>>8&255);this.buffer_.push(a>>>16&255);this.buffer_.push(a>>>24&255)};\njspb.BinaryEncoder.prototype.writeInt64=function(a){goog.asserts.assert(a==Math.floor(a));goog.asserts.assert(a>=-jspb.BinaryConstants.TWO_TO_63&&a<jspb.BinaryConstants.TWO_TO_63);jspb.utils.splitInt64(a);this.writeSplitFixed64(jspb.utils.split64Low,jspb.utils.split64High)};\njspb.BinaryEncoder.prototype.writeInt64String=function(a){goog.asserts.assert(a==Math.floor(a));goog.asserts.assert(+a>=-jspb.BinaryConstants.TWO_TO_63&&+a<jspb.BinaryConstants.TWO_TO_63);jspb.utils.splitHash64(jspb.utils.decimalStringToHash64(a));this.writeSplitFixed64(jspb.utils.split64Low,jspb.utils.split64High)};\njspb.BinaryEncoder.prototype.writeFloat=function(a){goog.asserts.assert(Infinity===a||-Infinity===a||isNaN(a)||a>=-jspb.BinaryConstants.FLOAT32_MAX&&a<=jspb.BinaryConstants.FLOAT32_MAX);jspb.utils.splitFloat32(a);this.writeUint32(jspb.utils.split64Low)};\njspb.BinaryEncoder.prototype.writeDouble=function(a){goog.asserts.assert(Infinity===a||-Infinity===a||isNaN(a)||a>=-jspb.BinaryConstants.FLOAT64_MAX&&a<=jspb.BinaryConstants.FLOAT64_MAX);jspb.utils.splitFloat64(a);this.writeUint32(jspb.utils.split64Low);this.writeUint32(jspb.utils.split64High)};jspb.BinaryEncoder.prototype.writeBool=function(a){goog.asserts.assert(\"boolean\"===typeof a||\"number\"===typeof a);this.buffer_.push(a?1:0)};\njspb.BinaryEncoder.prototype.writeEnum=function(a){goog.asserts.assert(a==Math.floor(a));goog.asserts.assert(a>=-jspb.BinaryConstants.TWO_TO_31&&a<jspb.BinaryConstants.TWO_TO_31);this.writeSignedVarint32(a)};jspb.BinaryEncoder.prototype.writeBytes=function(a){this.buffer_.push.apply(this.buffer_,a)};jspb.BinaryEncoder.prototype.writeVarintHash64=function(a){jspb.utils.splitHash64(a);this.writeSplitVarint64(jspb.utils.split64Low,jspb.utils.split64High)};\njspb.BinaryEncoder.prototype.writeFixedHash64=function(a){jspb.utils.splitHash64(a);this.writeUint32(jspb.utils.split64Low);this.writeUint32(jspb.utils.split64High)};\njspb.BinaryEncoder.prototype.writeString=function(a){for(var b=this.buffer_.length,c=0;c<a.length;c++){var d=a.charCodeAt(c);if(128>d)this.buffer_.push(d);else if(2048>d)this.buffer_.push(d>>6|192),this.buffer_.push(d&63|128);else if(65536>d)if(55296<=d&&56319>=d&&c+1<a.length){var e=a.charCodeAt(c+1);56320<=e&&57343>=e&&(d=1024*(d-55296)+e-56320+65536,this.buffer_.push(d>>18|240),this.buffer_.push(d>>12&63|128),this.buffer_.push(d>>6&63|128),this.buffer_.push(d&63|128),c++)}else this.buffer_.push(d>>\n12|224),this.buffer_.push(d>>6&63|128),this.buffer_.push(d&63|128)}return this.buffer_.length-b};jspb.arith={};jspb.arith.UInt64=function(a,b){this.lo=a;this.hi=b};jspb.arith.UInt64.prototype.cmp=function(a){return this.hi<a.hi||this.hi==a.hi&&this.lo<a.lo?-1:this.hi==a.hi&&this.lo==a.lo?0:1};jspb.arith.UInt64.prototype.rightShift=function(){return new jspb.arith.UInt64((this.lo>>>1|(this.hi&1)<<31)>>>0,this.hi>>>1>>>0)};jspb.arith.UInt64.prototype.leftShift=function(){return new jspb.arith.UInt64(this.lo<<1>>>0,(this.hi<<1|this.lo>>>31)>>>0)};\njspb.arith.UInt64.prototype.msb=function(){return!!(this.hi&2147483648)};jspb.arith.UInt64.prototype.lsb=function(){return!!(this.lo&1)};jspb.arith.UInt64.prototype.zero=function(){return 0==this.lo&&0==this.hi};jspb.arith.UInt64.prototype.add=function(a){return new jspb.arith.UInt64((this.lo+a.lo&4294967295)>>>0>>>0,((this.hi+a.hi&4294967295)>>>0)+(4294967296<=this.lo+a.lo?1:0)>>>0)};\njspb.arith.UInt64.prototype.sub=function(a){return new jspb.arith.UInt64((this.lo-a.lo&4294967295)>>>0>>>0,((this.hi-a.hi&4294967295)>>>0)-(0>this.lo-a.lo?1:0)>>>0)};jspb.arith.UInt64.mul32x32=function(a,b){var c=a&65535;a>>>=16;var d=b&65535,e=b>>>16;b=c*d+65536*(c*e&65535)+65536*(a*d&65535);for(c=a*e+(c*e>>>16)+(a*d>>>16);4294967296<=b;)b-=4294967296,c+=1;return new jspb.arith.UInt64(b>>>0,c>>>0)};\njspb.arith.UInt64.prototype.mul=function(a){var b=jspb.arith.UInt64.mul32x32(this.lo,a);a=jspb.arith.UInt64.mul32x32(this.hi,a);a.hi=a.lo;a.lo=0;return b.add(a)};\njspb.arith.UInt64.prototype.div=function(a){if(0==a)return[];var b=new jspb.arith.UInt64(0,0),c=new jspb.arith.UInt64(this.lo,this.hi);a=new jspb.arith.UInt64(a,0);for(var d=new jspb.arith.UInt64(1,0);!a.msb();)a=a.leftShift(),d=d.leftShift();for(;!d.zero();)0>=a.cmp(c)&&(b=b.add(d),c=c.sub(a)),a=a.rightShift(),d=d.rightShift();return[b,c]};jspb.arith.UInt64.prototype.toString=function(){for(var a=\"\",b=this;!b.zero();){b=b.div(10);var c=b[0];a=b[1].lo+a;b=c}\"\"==a&&(a=\"0\");return a};\njspb.arith.UInt64.fromString=function(a){for(var b=new jspb.arith.UInt64(0,0),c=new jspb.arith.UInt64(0,0),d=0;d<a.length;d++){if(\"0\">a[d]||\"9\"<a[d])return null;var e=parseInt(a[d],10);c.lo=e;b=b.mul(10).add(c)}return b};jspb.arith.UInt64.prototype.clone=function(){return new jspb.arith.UInt64(this.lo,this.hi)};jspb.arith.Int64=function(a,b){this.lo=a;this.hi=b};\njspb.arith.Int64.prototype.add=function(a){return new jspb.arith.Int64((this.lo+a.lo&4294967295)>>>0>>>0,((this.hi+a.hi&4294967295)>>>0)+(4294967296<=this.lo+a.lo?1:0)>>>0)};jspb.arith.Int64.prototype.sub=function(a){return new jspb.arith.Int64((this.lo-a.lo&4294967295)>>>0>>>0,((this.hi-a.hi&4294967295)>>>0)-(0>this.lo-a.lo?1:0)>>>0)};jspb.arith.Int64.prototype.clone=function(){return new jspb.arith.Int64(this.lo,this.hi)};\njspb.arith.Int64.prototype.toString=function(){var a=0!=(this.hi&2147483648),b=new jspb.arith.UInt64(this.lo,this.hi);a&&(b=(new jspb.arith.UInt64(0,0)).sub(b));return(a?\"-\":\"\")+b.toString()};jspb.arith.Int64.fromString=function(a){var b=0<a.length&&\"-\"==a[0];b&&(a=a.substring(1));a=jspb.arith.UInt64.fromString(a);if(null===a)return null;b&&(a=(new jspb.arith.UInt64(0,0)).sub(a));return new jspb.arith.Int64(a.lo,a.hi)};jspb.BinaryWriter=function(){this.blocks_=[];this.totalLength_=0;this.encoder_=new jspb.BinaryEncoder;this.bookmarks_=[]};jspb.BinaryWriter.prototype.appendUint8Array_=function(a){var b=this.encoder_.end();this.blocks_.push(b);this.blocks_.push(a);this.totalLength_+=b.length+a.length};\njspb.BinaryWriter.prototype.beginDelimited_=function(a){this.writeFieldHeader_(a,jspb.BinaryConstants.WireType.DELIMITED);a=this.encoder_.end();this.blocks_.push(a);this.totalLength_+=a.length;a.push(this.totalLength_);return a};jspb.BinaryWriter.prototype.endDelimited_=function(a){var b=a.pop();b=this.totalLength_+this.encoder_.length()-b;for(goog.asserts.assert(0<=b);127<b;)a.push(b&127|128),b>>>=7,this.totalLength_++;a.push(b);this.totalLength_++};\njspb.BinaryWriter.prototype.writeSerializedMessage=function(a,b,c){this.appendUint8Array_(a.subarray(b,c))};jspb.BinaryWriter.prototype.maybeWriteSerializedMessage=function(a,b,c){null!=a&&null!=b&&null!=c&&this.writeSerializedMessage(a,b,c)};jspb.BinaryWriter.prototype.reset=function(){this.blocks_=[];this.encoder_.end();this.totalLength_=0;this.bookmarks_=[]};\njspb.BinaryWriter.prototype.getResultBuffer=function(){goog.asserts.assert(0==this.bookmarks_.length);for(var a=new Uint8Array(this.totalLength_+this.encoder_.length()),b=this.blocks_,c=b.length,d=0,e=0;e<c;e++){var f=b[e];a.set(f,d);d+=f.length}b=this.encoder_.end();a.set(b,d);d+=b.length;goog.asserts.assert(d==a.length);this.blocks_=[a];return a};jspb.BinaryWriter.prototype.getResultBase64String=function(a){return goog.crypt.base64.encodeByteArray(this.getResultBuffer(),a)};\njspb.BinaryWriter.prototype.beginSubMessage=function(a){this.bookmarks_.push(this.beginDelimited_(a))};jspb.BinaryWriter.prototype.endSubMessage=function(){goog.asserts.assert(0<=this.bookmarks_.length);this.endDelimited_(this.bookmarks_.pop())};jspb.BinaryWriter.prototype.writeFieldHeader_=function(a,b){goog.asserts.assert(1<=a&&a==Math.floor(a));this.encoder_.writeUnsignedVarint32(8*a+b)};\njspb.BinaryWriter.prototype.writeAny=function(a,b,c){var d=jspb.BinaryConstants.FieldType;switch(a){case d.DOUBLE:this.writeDouble(b,c);break;case d.FLOAT:this.writeFloat(b,c);break;case d.INT64:this.writeInt64(b,c);break;case d.UINT64:this.writeUint64(b,c);break;case d.INT32:this.writeInt32(b,c);break;case d.FIXED64:this.writeFixed64(b,c);break;case d.FIXED32:this.writeFixed32(b,c);break;case d.BOOL:this.writeBool(b,c);break;case d.STRING:this.writeString(b,c);break;case d.GROUP:goog.asserts.fail(\"Group field type not supported in writeAny()\");\nbreak;case d.MESSAGE:goog.asserts.fail(\"Message field type not supported in writeAny()\");break;case d.BYTES:this.writeBytes(b,c);break;case d.UINT32:this.writeUint32(b,c);break;case d.ENUM:this.writeEnum(b,c);break;case d.SFIXED32:this.writeSfixed32(b,c);break;case d.SFIXED64:this.writeSfixed64(b,c);break;case d.SINT32:this.writeSint32(b,c);break;case d.SINT64:this.writeSint64(b,c);break;case d.FHASH64:this.writeFixedHash64(b,c);break;case d.VHASH64:this.writeVarintHash64(b,c);break;default:goog.asserts.fail(\"Invalid field type in writeAny()\")}};\njspb.BinaryWriter.prototype.writeUnsignedVarint32_=function(a,b){null!=b&&(this.writeFieldHeader_(a,jspb.BinaryConstants.WireType.VARINT),this.encoder_.writeUnsignedVarint32(b))};jspb.BinaryWriter.prototype.writeSignedVarint32_=function(a,b){null!=b&&(this.writeFieldHeader_(a,jspb.BinaryConstants.WireType.VARINT),this.encoder_.writeSignedVarint32(b))};jspb.BinaryWriter.prototype.writeUnsignedVarint64_=function(a,b){null!=b&&(this.writeFieldHeader_(a,jspb.BinaryConstants.WireType.VARINT),this.encoder_.writeUnsignedVarint64(b))};\njspb.BinaryWriter.prototype.writeSignedVarint64_=function(a,b){null!=b&&(this.writeFieldHeader_(a,jspb.BinaryConstants.WireType.VARINT),this.encoder_.writeSignedVarint64(b))};jspb.BinaryWriter.prototype.writeZigzagVarint32_=function(a,b){null!=b&&(this.writeFieldHeader_(a,jspb.BinaryConstants.WireType.VARINT),this.encoder_.writeZigzagVarint32(b))};jspb.BinaryWriter.prototype.writeZigzagVarint64_=function(a,b){null!=b&&(this.writeFieldHeader_(a,jspb.BinaryConstants.WireType.VARINT),this.encoder_.writeZigzagVarint64(b))};\njspb.BinaryWriter.prototype.writeZigzagVarint64String_=function(a,b){null!=b&&(this.writeFieldHeader_(a,jspb.BinaryConstants.WireType.VARINT),this.encoder_.writeZigzagVarint64String(b))};jspb.BinaryWriter.prototype.writeZigzagVarintHash64_=function(a,b){null!=b&&(this.writeFieldHeader_(a,jspb.BinaryConstants.WireType.VARINT),this.encoder_.writeZigzagVarintHash64(b))};\njspb.BinaryWriter.prototype.writeInt32=function(a,b){null!=b&&(goog.asserts.assert(b>=-jspb.BinaryConstants.TWO_TO_31&&b<jspb.BinaryConstants.TWO_TO_31),this.writeSignedVarint32_(a,b))};jspb.BinaryWriter.prototype.writeInt32String=function(a,b){null!=b&&(b=parseInt(b,10),goog.asserts.assert(b>=-jspb.BinaryConstants.TWO_TO_31&&b<jspb.BinaryConstants.TWO_TO_31),this.writeSignedVarint32_(a,b))};\njspb.BinaryWriter.prototype.writeInt64=function(a,b){null!=b&&(goog.asserts.assert(b>=-jspb.BinaryConstants.TWO_TO_63&&b<jspb.BinaryConstants.TWO_TO_63),this.writeSignedVarint64_(a,b))};jspb.BinaryWriter.prototype.writeInt64String=function(a,b){null!=b&&(b=jspb.arith.Int64.fromString(b),this.writeFieldHeader_(a,jspb.BinaryConstants.WireType.VARINT),this.encoder_.writeSplitVarint64(b.lo,b.hi))};\njspb.BinaryWriter.prototype.writeUint32=function(a,b){null!=b&&(goog.asserts.assert(0<=b&&b<jspb.BinaryConstants.TWO_TO_32),this.writeUnsignedVarint32_(a,b))};jspb.BinaryWriter.prototype.writeUint32String=function(a,b){null!=b&&(b=parseInt(b,10),goog.asserts.assert(0<=b&&b<jspb.BinaryConstants.TWO_TO_32),this.writeUnsignedVarint32_(a,b))};jspb.BinaryWriter.prototype.writeUint64=function(a,b){null!=b&&(goog.asserts.assert(0<=b&&b<jspb.BinaryConstants.TWO_TO_64),this.writeUnsignedVarint64_(a,b))};\njspb.BinaryWriter.prototype.writeUint64String=function(a,b){null!=b&&(b=jspb.arith.UInt64.fromString(b),this.writeFieldHeader_(a,jspb.BinaryConstants.WireType.VARINT),this.encoder_.writeSplitVarint64(b.lo,b.hi))};jspb.BinaryWriter.prototype.writeSint32=function(a,b){null!=b&&(goog.asserts.assert(b>=-jspb.BinaryConstants.TWO_TO_31&&b<jspb.BinaryConstants.TWO_TO_31),this.writeZigzagVarint32_(a,b))};\njspb.BinaryWriter.prototype.writeSint64=function(a,b){null!=b&&(goog.asserts.assert(b>=-jspb.BinaryConstants.TWO_TO_63&&b<jspb.BinaryConstants.TWO_TO_63),this.writeZigzagVarint64_(a,b))};jspb.BinaryWriter.prototype.writeSintHash64=function(a,b){null!=b&&this.writeZigzagVarintHash64_(a,b)};jspb.BinaryWriter.prototype.writeSint64String=function(a,b){null!=b&&this.writeZigzagVarint64String_(a,b)};\njspb.BinaryWriter.prototype.writeFixed32=function(a,b){null!=b&&(goog.asserts.assert(0<=b&&b<jspb.BinaryConstants.TWO_TO_32),this.writeFieldHeader_(a,jspb.BinaryConstants.WireType.FIXED32),this.encoder_.writeUint32(b))};jspb.BinaryWriter.prototype.writeFixed64=function(a,b){null!=b&&(goog.asserts.assert(0<=b&&b<jspb.BinaryConstants.TWO_TO_64),this.writeFieldHeader_(a,jspb.BinaryConstants.WireType.FIXED64),this.encoder_.writeUint64(b))};\njspb.BinaryWriter.prototype.writeFixed64String=function(a,b){null!=b&&(b=jspb.arith.UInt64.fromString(b),this.writeFieldHeader_(a,jspb.BinaryConstants.WireType.FIXED64),this.encoder_.writeSplitFixed64(b.lo,b.hi))};jspb.BinaryWriter.prototype.writeSfixed32=function(a,b){null!=b&&(goog.asserts.assert(b>=-jspb.BinaryConstants.TWO_TO_31&&b<jspb.BinaryConstants.TWO_TO_31),this.writeFieldHeader_(a,jspb.BinaryConstants.WireType.FIXED32),this.encoder_.writeInt32(b))};\njspb.BinaryWriter.prototype.writeSfixed64=function(a,b){null!=b&&(goog.asserts.assert(b>=-jspb.BinaryConstants.TWO_TO_63&&b<jspb.BinaryConstants.TWO_TO_63),this.writeFieldHeader_(a,jspb.BinaryConstants.WireType.FIXED64),this.encoder_.writeInt64(b))};jspb.BinaryWriter.prototype.writeSfixed64String=function(a,b){null!=b&&(b=jspb.arith.Int64.fromString(b),this.writeFieldHeader_(a,jspb.BinaryConstants.WireType.FIXED64),this.encoder_.writeSplitFixed64(b.lo,b.hi))};\njspb.BinaryWriter.prototype.writeFloat=function(a,b){null!=b&&(this.writeFieldHeader_(a,jspb.BinaryConstants.WireType.FIXED32),this.encoder_.writeFloat(b))};jspb.BinaryWriter.prototype.writeDouble=function(a,b){null!=b&&(this.writeFieldHeader_(a,jspb.BinaryConstants.WireType.FIXED64),this.encoder_.writeDouble(b))};\njspb.BinaryWriter.prototype.writeBool=function(a,b){null!=b&&(goog.asserts.assert(\"boolean\"===typeof b||\"number\"===typeof b),this.writeFieldHeader_(a,jspb.BinaryConstants.WireType.VARINT),this.encoder_.writeBool(b))};jspb.BinaryWriter.prototype.writeEnum=function(a,b){null!=b&&(goog.asserts.assert(b>=-jspb.BinaryConstants.TWO_TO_31&&b<jspb.BinaryConstants.TWO_TO_31),this.writeFieldHeader_(a,jspb.BinaryConstants.WireType.VARINT),this.encoder_.writeSignedVarint32(b))};\njspb.BinaryWriter.prototype.writeString=function(a,b){null!=b&&(a=this.beginDelimited_(a),this.encoder_.writeString(b),this.endDelimited_(a))};jspb.BinaryWriter.prototype.writeBytes=function(a,b){null!=b&&(b=jspb.utils.byteSourceToUint8Array(b),this.writeFieldHeader_(a,jspb.BinaryConstants.WireType.DELIMITED),this.encoder_.writeUnsignedVarint32(b.length),this.appendUint8Array_(b))};jspb.BinaryWriter.prototype.writeMessage=function(a,b,c){null!=b&&(a=this.beginDelimited_(a),c(b,this),this.endDelimited_(a))};\njspb.BinaryWriter.prototype.writeMessageSet=function(a,b,c){null!=b&&(this.writeFieldHeader_(1,jspb.BinaryConstants.WireType.START_GROUP),this.writeFieldHeader_(2,jspb.BinaryConstants.WireType.VARINT),this.encoder_.writeSignedVarint32(a),a=this.beginDelimited_(3),c(b,this),this.endDelimited_(a),this.writeFieldHeader_(1,jspb.BinaryConstants.WireType.END_GROUP))};\njspb.BinaryWriter.prototype.writeGroup=function(a,b,c){null!=b&&(this.writeFieldHeader_(a,jspb.BinaryConstants.WireType.START_GROUP),c(b,this),this.writeFieldHeader_(a,jspb.BinaryConstants.WireType.END_GROUP))};jspb.BinaryWriter.prototype.writeFixedHash64=function(a,b){null!=b&&(goog.asserts.assert(8==b.length),this.writeFieldHeader_(a,jspb.BinaryConstants.WireType.FIXED64),this.encoder_.writeFixedHash64(b))};\njspb.BinaryWriter.prototype.writeVarintHash64=function(a,b){null!=b&&(goog.asserts.assert(8==b.length),this.writeFieldHeader_(a,jspb.BinaryConstants.WireType.VARINT),this.encoder_.writeVarintHash64(b))};jspb.BinaryWriter.prototype.writeSplitFixed64=function(a,b,c){this.writeFieldHeader_(a,jspb.BinaryConstants.WireType.FIXED64);this.encoder_.writeSplitFixed64(b,c)};\njspb.BinaryWriter.prototype.writeSplitVarint64=function(a,b,c){this.writeFieldHeader_(a,jspb.BinaryConstants.WireType.VARINT);this.encoder_.writeSplitVarint64(b,c)};jspb.BinaryWriter.prototype.writeSplitZigzagVarint64=function(a,b,c){this.writeFieldHeader_(a,jspb.BinaryConstants.WireType.VARINT);var d=this.encoder_;jspb.utils.toZigzag64(b,c,function(a,b){d.writeSplitVarint64(a>>>0,b>>>0)})};\njspb.BinaryWriter.prototype.writeRepeatedInt32=function(a,b){if(null!=b)for(var c=0;c<b.length;c++)this.writeSignedVarint32_(a,b[c])};jspb.BinaryWriter.prototype.writeRepeatedInt32String=function(a,b){if(null!=b)for(var c=0;c<b.length;c++)this.writeInt32String(a,b[c])};jspb.BinaryWriter.prototype.writeRepeatedInt64=function(a,b){if(null!=b)for(var c=0;c<b.length;c++)this.writeSignedVarint64_(a,b[c])};\njspb.BinaryWriter.prototype.writeRepeatedSplitFixed64=function(a,b,c,d){if(null!=b)for(var e=0;e<b.length;e++)this.writeSplitFixed64(a,c(b[e]),d(b[e]))};jspb.BinaryWriter.prototype.writeRepeatedSplitVarint64=function(a,b,c,d){if(null!=b)for(var e=0;e<b.length;e++)this.writeSplitVarint64(a,c(b[e]),d(b[e]))};jspb.BinaryWriter.prototype.writeRepeatedSplitZigzagVarint64=function(a,b,c,d){if(null!=b)for(var e=0;e<b.length;e++)this.writeSplitZigzagVarint64(a,c(b[e]),d(b[e]))};\njspb.BinaryWriter.prototype.writeRepeatedInt64String=function(a,b){if(null!=b)for(var c=0;c<b.length;c++)this.writeInt64String(a,b[c])};jspb.BinaryWriter.prototype.writeRepeatedUint32=function(a,b){if(null!=b)for(var c=0;c<b.length;c++)this.writeUnsignedVarint32_(a,b[c])};jspb.BinaryWriter.prototype.writeRepeatedUint32String=function(a,b){if(null!=b)for(var c=0;c<b.length;c++)this.writeUint32String(a,b[c])};\njspb.BinaryWriter.prototype.writeRepeatedUint64=function(a,b){if(null!=b)for(var c=0;c<b.length;c++)this.writeUnsignedVarint64_(a,b[c])};jspb.BinaryWriter.prototype.writeRepeatedUint64String=function(a,b){if(null!=b)for(var c=0;c<b.length;c++)this.writeUint64String(a,b[c])};jspb.BinaryWriter.prototype.writeRepeatedSint32=function(a,b){if(null!=b)for(var c=0;c<b.length;c++)this.writeZigzagVarint32_(a,b[c])};\njspb.BinaryWriter.prototype.writeRepeatedSint64=function(a,b){if(null!=b)for(var c=0;c<b.length;c++)this.writeZigzagVarint64_(a,b[c])};jspb.BinaryWriter.prototype.writeRepeatedSint64String=function(a,b){if(null!=b)for(var c=0;c<b.length;c++)this.writeZigzagVarint64String_(a,b[c])};jspb.BinaryWriter.prototype.writeRepeatedSintHash64=function(a,b){if(null!=b)for(var c=0;c<b.length;c++)this.writeZigzagVarintHash64_(a,b[c])};\njspb.BinaryWriter.prototype.writeRepeatedFixed32=function(a,b){if(null!=b)for(var c=0;c<b.length;c++)this.writeFixed32(a,b[c])};jspb.BinaryWriter.prototype.writeRepeatedFixed64=function(a,b){if(null!=b)for(var c=0;c<b.length;c++)this.writeFixed64(a,b[c])};jspb.BinaryWriter.prototype.writeRepeatedFixed64String=function(a,b){if(null!=b)for(var c=0;c<b.length;c++)this.writeFixed64String(a,b[c])};\njspb.BinaryWriter.prototype.writeRepeatedSfixed32=function(a,b){if(null!=b)for(var c=0;c<b.length;c++)this.writeSfixed32(a,b[c])};jspb.BinaryWriter.prototype.writeRepeatedSfixed64=function(a,b){if(null!=b)for(var c=0;c<b.length;c++)this.writeSfixed64(a,b[c])};jspb.BinaryWriter.prototype.writeRepeatedSfixed64String=function(a,b){if(null!=b)for(var c=0;c<b.length;c++)this.writeSfixed64String(a,b[c])};\njspb.BinaryWriter.prototype.writeRepeatedFloat=function(a,b){if(null!=b)for(var c=0;c<b.length;c++)this.writeFloat(a,b[c])};jspb.BinaryWriter.prototype.writeRepeatedDouble=function(a,b){if(null!=b)for(var c=0;c<b.length;c++)this.writeDouble(a,b[c])};jspb.BinaryWriter.prototype.writeRepeatedBool=function(a,b){if(null!=b)for(var c=0;c<b.length;c++)this.writeBool(a,b[c])};jspb.BinaryWriter.prototype.writeRepeatedEnum=function(a,b){if(null!=b)for(var c=0;c<b.length;c++)this.writeEnum(a,b[c])};\njspb.BinaryWriter.prototype.writeRepeatedString=function(a,b){if(null!=b)for(var c=0;c<b.length;c++)this.writeString(a,b[c])};jspb.BinaryWriter.prototype.writeRepeatedBytes=function(a,b){if(null!=b)for(var c=0;c<b.length;c++)this.writeBytes(a,b[c])};jspb.BinaryWriter.prototype.writeRepeatedMessage=function(a,b,c){if(null!=b)for(var d=0;d<b.length;d++){var e=this.beginDelimited_(a);c(b[d],this);this.endDelimited_(e)}};\njspb.BinaryWriter.prototype.writeRepeatedGroup=function(a,b,c){if(null!=b)for(var d=0;d<b.length;d++)this.writeFieldHeader_(a,jspb.BinaryConstants.WireType.START_GROUP),c(b[d],this),this.writeFieldHeader_(a,jspb.BinaryConstants.WireType.END_GROUP)};jspb.BinaryWriter.prototype.writeRepeatedFixedHash64=function(a,b){if(null!=b)for(var c=0;c<b.length;c++)this.writeFixedHash64(a,b[c])};\njspb.BinaryWriter.prototype.writeRepeatedVarintHash64=function(a,b){if(null!=b)for(var c=0;c<b.length;c++)this.writeVarintHash64(a,b[c])};jspb.BinaryWriter.prototype.writePackedInt32=function(a,b){if(null!=b&&b.length){a=this.beginDelimited_(a);for(var c=0;c<b.length;c++)this.encoder_.writeSignedVarint32(b[c]);this.endDelimited_(a)}};\njspb.BinaryWriter.prototype.writePackedInt32String=function(a,b){if(null!=b&&b.length){a=this.beginDelimited_(a);for(var c=0;c<b.length;c++)this.encoder_.writeSignedVarint32(parseInt(b[c],10));this.endDelimited_(a)}};jspb.BinaryWriter.prototype.writePackedInt64=function(a,b){if(null!=b&&b.length){a=this.beginDelimited_(a);for(var c=0;c<b.length;c++)this.encoder_.writeSignedVarint64(b[c]);this.endDelimited_(a)}};\njspb.BinaryWriter.prototype.writePackedSplitFixed64=function(a,b,c,d){if(null!=b){a=this.beginDelimited_(a);for(var e=0;e<b.length;e++)this.encoder_.writeSplitFixed64(c(b[e]),d(b[e]));this.endDelimited_(a)}};jspb.BinaryWriter.prototype.writePackedSplitVarint64=function(a,b,c,d){if(null!=b){a=this.beginDelimited_(a);for(var e=0;e<b.length;e++)this.encoder_.writeSplitVarint64(c(b[e]),d(b[e]));this.endDelimited_(a)}};\njspb.BinaryWriter.prototype.writePackedSplitZigzagVarint64=function(a,b,c,d){if(null!=b){a=this.beginDelimited_(a);for(var e=this.encoder_,f=0;f<b.length;f++)jspb.utils.toZigzag64(c(b[f]),d(b[f]),function(a,b){e.writeSplitVarint64(a>>>0,b>>>0)});this.endDelimited_(a)}};jspb.BinaryWriter.prototype.writePackedInt64String=function(a,b){if(null!=b&&b.length){a=this.beginDelimited_(a);for(var c=0;c<b.length;c++){var d=jspb.arith.Int64.fromString(b[c]);this.encoder_.writeSplitVarint64(d.lo,d.hi)}this.endDelimited_(a)}};\njspb.BinaryWriter.prototype.writePackedUint32=function(a,b){if(null!=b&&b.length){a=this.beginDelimited_(a);for(var c=0;c<b.length;c++)this.encoder_.writeUnsignedVarint32(b[c]);this.endDelimited_(a)}};jspb.BinaryWriter.prototype.writePackedUint32String=function(a,b){if(null!=b&&b.length){a=this.beginDelimited_(a);for(var c=0;c<b.length;c++)this.encoder_.writeUnsignedVarint32(parseInt(b[c],10));this.endDelimited_(a)}};\njspb.BinaryWriter.prototype.writePackedUint64=function(a,b){if(null!=b&&b.length){a=this.beginDelimited_(a);for(var c=0;c<b.length;c++)this.encoder_.writeUnsignedVarint64(b[c]);this.endDelimited_(a)}};jspb.BinaryWriter.prototype.writePackedUint64String=function(a,b){if(null!=b&&b.length){a=this.beginDelimited_(a);for(var c=0;c<b.length;c++){var d=jspb.arith.UInt64.fromString(b[c]);this.encoder_.writeSplitVarint64(d.lo,d.hi)}this.endDelimited_(a)}};\njspb.BinaryWriter.prototype.writePackedSint32=function(a,b){if(null!=b&&b.length){a=this.beginDelimited_(a);for(var c=0;c<b.length;c++)this.encoder_.writeZigzagVarint32(b[c]);this.endDelimited_(a)}};jspb.BinaryWriter.prototype.writePackedSint64=function(a,b){if(null!=b&&b.length){a=this.beginDelimited_(a);for(var c=0;c<b.length;c++)this.encoder_.writeZigzagVarint64(b[c]);this.endDelimited_(a)}};\njspb.BinaryWriter.prototype.writePackedSint64String=function(a,b){if(null!=b&&b.length){a=this.beginDelimited_(a);for(var c=0;c<b.length;c++)this.encoder_.writeZigzagVarintHash64(jspb.utils.decimalStringToHash64(b[c]));this.endDelimited_(a)}};jspb.BinaryWriter.prototype.writePackedSintHash64=function(a,b){if(null!=b&&b.length){a=this.beginDelimited_(a);for(var c=0;c<b.length;c++)this.encoder_.writeZigzagVarintHash64(b[c]);this.endDelimited_(a)}};\njspb.BinaryWriter.prototype.writePackedFixed32=function(a,b){if(null!=b&&b.length)for(this.writeFieldHeader_(a,jspb.BinaryConstants.WireType.DELIMITED),this.encoder_.writeUnsignedVarint32(4*b.length),a=0;a<b.length;a++)this.encoder_.writeUint32(b[a])};jspb.BinaryWriter.prototype.writePackedFixed64=function(a,b){if(null!=b&&b.length)for(this.writeFieldHeader_(a,jspb.BinaryConstants.WireType.DELIMITED),this.encoder_.writeUnsignedVarint32(8*b.length),a=0;a<b.length;a++)this.encoder_.writeUint64(b[a])};\njspb.BinaryWriter.prototype.writePackedFixed64String=function(a,b){if(null!=b&&b.length)for(this.writeFieldHeader_(a,jspb.BinaryConstants.WireType.DELIMITED),this.encoder_.writeUnsignedVarint32(8*b.length),a=0;a<b.length;a++){var c=jspb.arith.UInt64.fromString(b[a]);this.encoder_.writeSplitFixed64(c.lo,c.hi)}};\njspb.BinaryWriter.prototype.writePackedSfixed32=function(a,b){if(null!=b&&b.length)for(this.writeFieldHeader_(a,jspb.BinaryConstants.WireType.DELIMITED),this.encoder_.writeUnsignedVarint32(4*b.length),a=0;a<b.length;a++)this.encoder_.writeInt32(b[a])};jspb.BinaryWriter.prototype.writePackedSfixed64=function(a,b){if(null!=b&&b.length)for(this.writeFieldHeader_(a,jspb.BinaryConstants.WireType.DELIMITED),this.encoder_.writeUnsignedVarint32(8*b.length),a=0;a<b.length;a++)this.encoder_.writeInt64(b[a])};\njspb.BinaryWriter.prototype.writePackedSfixed64String=function(a,b){if(null!=b&&b.length)for(this.writeFieldHeader_(a,jspb.BinaryConstants.WireType.DELIMITED),this.encoder_.writeUnsignedVarint32(8*b.length),a=0;a<b.length;a++)this.encoder_.writeInt64String(b[a])};jspb.BinaryWriter.prototype.writePackedFloat=function(a,b){if(null!=b&&b.length)for(this.writeFieldHeader_(a,jspb.BinaryConstants.WireType.DELIMITED),this.encoder_.writeUnsignedVarint32(4*b.length),a=0;a<b.length;a++)this.encoder_.writeFloat(b[a])};\njspb.BinaryWriter.prototype.writePackedDouble=function(a,b){if(null!=b&&b.length)for(this.writeFieldHeader_(a,jspb.BinaryConstants.WireType.DELIMITED),this.encoder_.writeUnsignedVarint32(8*b.length),a=0;a<b.length;a++)this.encoder_.writeDouble(b[a])};jspb.BinaryWriter.prototype.writePackedBool=function(a,b){if(null!=b&&b.length)for(this.writeFieldHeader_(a,jspb.BinaryConstants.WireType.DELIMITED),this.encoder_.writeUnsignedVarint32(b.length),a=0;a<b.length;a++)this.encoder_.writeBool(b[a])};\njspb.BinaryWriter.prototype.writePackedEnum=function(a,b){if(null!=b&&b.length){a=this.beginDelimited_(a);for(var c=0;c<b.length;c++)this.encoder_.writeEnum(b[c]);this.endDelimited_(a)}};jspb.BinaryWriter.prototype.writePackedFixedHash64=function(a,b){if(null!=b&&b.length)for(this.writeFieldHeader_(a,jspb.BinaryConstants.WireType.DELIMITED),this.encoder_.writeUnsignedVarint32(8*b.length),a=0;a<b.length;a++)this.encoder_.writeFixedHash64(b[a])};\njspb.BinaryWriter.prototype.writePackedVarintHash64=function(a,b){if(null!=b&&b.length){a=this.beginDelimited_(a);for(var c=0;c<b.length;c++)this.encoder_.writeVarintHash64(b[c]);this.endDelimited_(a)}};jspb.Map=function(a,b){this.arr_=a;this.valueCtor_=b;this.map_={};this.arrClean=!0;0<this.arr_.length&&this.loadFromArray_()};jspb.Map.prototype.loadFromArray_=function(){for(var a=0;a<this.arr_.length;a++){var b=this.arr_[a],c=b[0];this.map_[c.toString()]=new jspb.Map.Entry_(c,b[1])}this.arrClean=!0};\njspb.Map.prototype.toArray=function(){if(this.arrClean){if(this.valueCtor_){var a=this.map_,b;for(b in a)if(Object.prototype.hasOwnProperty.call(a,b)){var c=a[b].valueWrapper;c&&c.toArray()}}}else{this.arr_.length=0;a=this.stringKeys_();a.sort();for(b=0;b<a.length;b++){var d=this.map_[a[b]];(c=d.valueWrapper)&&c.toArray();this.arr_.push([d.key,d.value])}this.arrClean=!0}return this.arr_};\njspb.Map.prototype.toObject=function(a,b){for(var c=this.toArray(),d=[],e=0;e<c.length;e++){var f=this.map_[c[e][0].toString()];this.wrapEntry_(f);var g=f.valueWrapper;g?(goog.asserts.assert(b),d.push([f.key,b(a,g)])):d.push([f.key,f.value])}return d};jspb.Map.fromObject=function(a,b,c){b=new jspb.Map([],b);for(var d=0;d<a.length;d++){var e=a[d][0],f=c(a[d][1]);b.set(e,f)}return b};jspb.Map.ArrayIteratorIterable_=function(a){this.idx_=0;this.arr_=a};\njspb.Map.ArrayIteratorIterable_.prototype.next=function(){return this.idx_<this.arr_.length?{done:!1,value:this.arr_[this.idx_++]}:{done:!0,value:void 0}};\"undefined\"!=typeof Symbol&&(jspb.Map.ArrayIteratorIterable_.prototype[Symbol.iterator]=function(){return this});jspb.Map.prototype.getLength=function(){return this.stringKeys_().length};jspb.Map.prototype.clear=function(){this.map_={};this.arrClean=!1};\njspb.Map.prototype.del=function(a){a=a.toString();var b=this.map_.hasOwnProperty(a);delete this.map_[a];this.arrClean=!1;return b};jspb.Map.prototype.getEntryList=function(){var a=[],b=this.stringKeys_();b.sort();for(var c=0;c<b.length;c++){var d=this.map_[b[c]];a.push([d.key,d.value])}return a};jspb.Map.prototype.entries=function(){var a=[],b=this.stringKeys_();b.sort();for(var c=0;c<b.length;c++){var d=this.map_[b[c]];a.push([d.key,this.wrapEntry_(d)])}return new jspb.Map.ArrayIteratorIterable_(a)};\njspb.Map.prototype.keys=function(){var a=[],b=this.stringKeys_();b.sort();for(var c=0;c<b.length;c++)a.push(this.map_[b[c]].key);return new jspb.Map.ArrayIteratorIterable_(a)};jspb.Map.prototype.values=function(){var a=[],b=this.stringKeys_();b.sort();for(var c=0;c<b.length;c++)a.push(this.wrapEntry_(this.map_[b[c]]));return new jspb.Map.ArrayIteratorIterable_(a)};\njspb.Map.prototype.forEach=function(a,b){var c=this.stringKeys_();c.sort();for(var d=0;d<c.length;d++){var e=this.map_[c[d]];a.call(b,this.wrapEntry_(e),e.key,this)}};jspb.Map.prototype.set=function(a,b){var c=new jspb.Map.Entry_(a);this.valueCtor_?(c.valueWrapper=b,c.value=b.toArray()):c.value=b;this.map_[a.toString()]=c;this.arrClean=!1;return this};jspb.Map.prototype.wrapEntry_=function(a){return this.valueCtor_?(a.valueWrapper||(a.valueWrapper=new this.valueCtor_(a.value)),a.valueWrapper):a.value};\njspb.Map.prototype.get=function(a){if(a=this.map_[a.toString()])return this.wrapEntry_(a)};jspb.Map.prototype.has=function(a){return a.toString()in this.map_};jspb.Map.prototype.serializeBinary=function(a,b,c,d,e){var f=this.stringKeys_();f.sort();for(var g=0;g<f.length;g++){var h=this.map_[f[g]];b.beginSubMessage(a);c.call(b,1,h.key);this.valueCtor_?d.call(b,2,this.wrapEntry_(h),e):d.call(b,2,h.value);b.endSubMessage()}};\njspb.Map.deserializeBinary=function(a,b,c,d,e,f,g){for(;b.nextField()&&!b.isEndGroup();){var h=b.getFieldNumber();1==h?f=c.call(b):2==h&&(a.valueCtor_?(goog.asserts.assert(e),g||(g=new a.valueCtor_),d.call(b,g,e)):g=d.call(b))}goog.asserts.assert(void 0!=f);goog.asserts.assert(void 0!=g);a.set(f,g)};jspb.Map.prototype.stringKeys_=function(){var a=this.map_,b=[],c;for(c in a)Object.prototype.hasOwnProperty.call(a,c)&&b.push(c);return b};\njspb.Map.Entry_=function(a,b){this.key=a;this.value=b;this.valueWrapper=void 0};jspb.ExtensionFieldInfo=function(a,b,c,d,e){this.fieldIndex=a;this.fieldName=b;this.ctor=c;this.toObjectFn=d;this.isRepeated=e};jspb.ExtensionFieldBinaryInfo=function(a,b,c,d,e,f){this.fieldInfo=a;this.binaryReaderFn=b;this.binaryWriterFn=c;this.binaryMessageSerializeFn=d;this.binaryMessageDeserializeFn=e;this.isPacked=f};jspb.ExtensionFieldInfo.prototype.isMessageType=function(){return!!this.ctor};jspb.Message=function(){};jspb.Message.GENERATE_TO_OBJECT=!0;jspb.Message.GENERATE_FROM_OBJECT=!goog.DISALLOW_TEST_ONLY_CODE;\njspb.Message.GENERATE_TO_STRING=!0;jspb.Message.ASSUME_LOCAL_ARRAYS=!1;jspb.Message.SERIALIZE_EMPTY_TRAILING_FIELDS=!0;jspb.Message.SUPPORTS_UINT8ARRAY_=\"function\"==typeof Uint8Array;jspb.Message.prototype.getJsPbMessageId=function(){return this.messageId_};jspb.Message.getIndex_=function(a,b){return b+a.arrayIndexOffset_};jspb.Message.hiddenES6Property_=function(){};jspb.Message.getFieldNumber_=function(a,b){return b-a.arrayIndexOffset_};\njspb.Message.initialize=function(a,b,c,d,e,f){a.wrappers_=null;b||(b=c?[c]:[]);a.messageId_=c?String(c):void 0;a.arrayIndexOffset_=0===c?-1:0;a.array=b;jspb.Message.initPivotAndExtensionObject_(a,d);a.convertedPrimitiveFields_={};jspb.Message.SERIALIZE_EMPTY_TRAILING_FIELDS||(a.repeatedFields=e);if(e)for(b=0;b<e.length;b++)c=e[b],c<a.pivot_?(c=jspb.Message.getIndex_(a,c),a.array[c]=a.array[c]||jspb.Message.EMPTY_LIST_SENTINEL_):(jspb.Message.maybeInitEmptyExtensionObject_(a),a.extensionObject_[c]=\na.extensionObject_[c]||jspb.Message.EMPTY_LIST_SENTINEL_);if(f&&f.length)for(b=0;b<f.length;b++)jspb.Message.computeOneofCase(a,f[b])};jspb.Message.EMPTY_LIST_SENTINEL_=goog.DEBUG&&Object.freeze?Object.freeze([]):[];jspb.Message.isArray_=function(a){return jspb.Message.ASSUME_LOCAL_ARRAYS?a instanceof Array:Array.isArray(a)};jspb.Message.isExtensionObject_=function(a){return null!==a&&\"object\"==typeof a&&!jspb.Message.isArray_(a)&&!(jspb.Message.SUPPORTS_UINT8ARRAY_&&a instanceof Uint8Array)};\njspb.Message.initPivotAndExtensionObject_=function(a,b){var c=a.array.length,d=-1;if(c&&(d=c-1,c=a.array[d],jspb.Message.isExtensionObject_(c))){a.pivot_=jspb.Message.getFieldNumber_(a,d);a.extensionObject_=c;return}-1<b?(a.pivot_=Math.max(b,jspb.Message.getFieldNumber_(a,d+1)),a.extensionObject_=null):a.pivot_=Number.MAX_VALUE};jspb.Message.maybeInitEmptyExtensionObject_=function(a){var b=jspb.Message.getIndex_(a,a.pivot_);a.array[b]||(a.extensionObject_=a.array[b]={})};\njspb.Message.toObjectList=function(a,b,c){for(var d=[],e=0;e<a.length;e++)d[e]=b.call(a[e],c,a[e]);return d};jspb.Message.toObjectExtension=function(a,b,c,d,e){for(var f in c){var g=c[f],h=d.call(a,g);if(null!=h){for(var k in g.fieldName)if(g.fieldName.hasOwnProperty(k))break;b[k]=g.toObjectFn?g.isRepeated?jspb.Message.toObjectList(h,g.toObjectFn,e):g.toObjectFn(e,h):h}}};\njspb.Message.serializeBinaryExtensions=function(a,b,c,d){for(var e in c){var f=c[e],g=f.fieldInfo;if(!f.binaryWriterFn)throw Error(\"Message extension present that was generated without binary serialization support\");var h=d.call(a,g);if(null!=h)if(g.isMessageType())if(f.binaryMessageSerializeFn)f.binaryWriterFn.call(b,g.fieldIndex,h,f.binaryMessageSerializeFn);else throw Error(\"Message extension present holding submessage without binary support enabled, and message is being serialized to binary format\");\nelse f.binaryWriterFn.call(b,g.fieldIndex,h)}};jspb.Message.readBinaryExtension=function(a,b,c,d,e){var f=c[b.getFieldNumber()];if(f){c=f.fieldInfo;if(!f.binaryReaderFn)throw Error(\"Deserializing extension whose generated code does not support binary format\");if(c.isMessageType()){var g=new c.ctor;f.binaryReaderFn.call(b,g,f.binaryMessageDeserializeFn)}else g=f.binaryReaderFn.call(b);c.isRepeated&&!f.isPacked?(b=d.call(a,c))?b.push(g):e.call(a,c,[g]):e.call(a,c,g)}else b.skipField()};\njspb.Message.getField=function(a,b){if(b<a.pivot_){b=jspb.Message.getIndex_(a,b);var c=a.array[b];return c===jspb.Message.EMPTY_LIST_SENTINEL_?a.array[b]=[]:c}if(a.extensionObject_)return c=a.extensionObject_[b],c===jspb.Message.EMPTY_LIST_SENTINEL_?a.extensionObject_[b]=[]:c};jspb.Message.getRepeatedField=function(a,b){return jspb.Message.getField(a,b)};jspb.Message.getOptionalFloatingPointField=function(a,b){a=jspb.Message.getField(a,b);return null==a?a:+a};\njspb.Message.getBooleanField=function(a,b){a=jspb.Message.getField(a,b);return null==a?a:!!a};jspb.Message.getRepeatedFloatingPointField=function(a,b){var c=jspb.Message.getRepeatedField(a,b);a.convertedPrimitiveFields_||(a.convertedPrimitiveFields_={});if(!a.convertedPrimitiveFields_[b]){for(var d=0;d<c.length;d++)c[d]=+c[d];a.convertedPrimitiveFields_[b]=!0}return c};\njspb.Message.getRepeatedBooleanField=function(a,b){var c=jspb.Message.getRepeatedField(a,b);a.convertedPrimitiveFields_||(a.convertedPrimitiveFields_={});if(!a.convertedPrimitiveFields_[b]){for(var d=0;d<c.length;d++)c[d]=!!c[d];a.convertedPrimitiveFields_[b]=!0}return c};\njspb.Message.bytesAsB64=function(a){if(null==a||\"string\"===typeof a)return a;if(jspb.Message.SUPPORTS_UINT8ARRAY_&&a instanceof Uint8Array)return goog.crypt.base64.encodeByteArray(a);goog.asserts.fail(\"Cannot coerce to b64 string: \"+goog.typeOf(a));return null};jspb.Message.bytesAsU8=function(a){if(null==a||a instanceof Uint8Array)return a;if(\"string\"===typeof a)return goog.crypt.base64.decodeStringToUint8Array(a);goog.asserts.fail(\"Cannot coerce to Uint8Array: \"+goog.typeOf(a));return null};\njspb.Message.bytesListAsB64=function(a){jspb.Message.assertConsistentTypes_(a);return a.length&&\"string\"!==typeof a[0]?goog.array.map(a,jspb.Message.bytesAsB64):a};jspb.Message.bytesListAsU8=function(a){jspb.Message.assertConsistentTypes_(a);return!a.length||a[0]instanceof Uint8Array?a:goog.array.map(a,jspb.Message.bytesAsU8)};\njspb.Message.assertConsistentTypes_=function(a){if(goog.DEBUG&&a&&1<a.length){var b=goog.typeOf(a[0]);goog.array.forEach(a,function(a){goog.typeOf(a)!=b&&goog.asserts.fail(\"Inconsistent type in JSPB repeated field array. Got \"+goog.typeOf(a)+\" expected \"+b)})}};jspb.Message.getFieldWithDefault=function(a,b,c){a=jspb.Message.getField(a,b);return null==a?c:a};jspb.Message.getBooleanFieldWithDefault=function(a,b,c){a=jspb.Message.getBooleanField(a,b);return null==a?c:a};\njspb.Message.getFloatingPointFieldWithDefault=function(a,b,c){a=jspb.Message.getOptionalFloatingPointField(a,b);return null==a?c:a};jspb.Message.getFieldProto3=jspb.Message.getFieldWithDefault;jspb.Message.getMapField=function(a,b,c,d){a.wrappers_||(a.wrappers_={});if(b in a.wrappers_)return a.wrappers_[b];var e=jspb.Message.getField(a,b);if(!e){if(c)return;e=[];jspb.Message.setField(a,b,e)}return a.wrappers_[b]=new jspb.Map(e,d)};\njspb.Message.setField=function(a,b,c){goog.asserts.assertInstanceof(a,jspb.Message);b<a.pivot_?a.array[jspb.Message.getIndex_(a,b)]=c:(jspb.Message.maybeInitEmptyExtensionObject_(a),a.extensionObject_[b]=c);return a};jspb.Message.setProto3IntField=function(a,b,c){return jspb.Message.setFieldIgnoringDefault_(a,b,c,0)};jspb.Message.setProto3FloatField=function(a,b,c){return jspb.Message.setFieldIgnoringDefault_(a,b,c,0)};\njspb.Message.setProto3BooleanField=function(a,b,c){return jspb.Message.setFieldIgnoringDefault_(a,b,c,!1)};jspb.Message.setProto3StringField=function(a,b,c){return jspb.Message.setFieldIgnoringDefault_(a,b,c,\"\")};jspb.Message.setProto3BytesField=function(a,b,c){return jspb.Message.setFieldIgnoringDefault_(a,b,c,\"\")};jspb.Message.setProto3EnumField=function(a,b,c){return jspb.Message.setFieldIgnoringDefault_(a,b,c,0)};\njspb.Message.setProto3StringIntField=function(a,b,c){return jspb.Message.setFieldIgnoringDefault_(a,b,c,\"0\")};jspb.Message.setFieldIgnoringDefault_=function(a,b,c,d){goog.asserts.assertInstanceof(a,jspb.Message);c!==d?jspb.Message.setField(a,b,c):b<a.pivot_?a.array[jspb.Message.getIndex_(a,b)]=null:(jspb.Message.maybeInitEmptyExtensionObject_(a),delete a.extensionObject_[b]);return a};\njspb.Message.addToRepeatedField=function(a,b,c,d){goog.asserts.assertInstanceof(a,jspb.Message);b=jspb.Message.getRepeatedField(a,b);void 0!=d?b.splice(d,0,c):b.push(c);return a};jspb.Message.setOneofField=function(a,b,c,d){goog.asserts.assertInstanceof(a,jspb.Message);(c=jspb.Message.computeOneofCase(a,c))&&c!==b&&void 0!==d&&(a.wrappers_&&c in a.wrappers_&&(a.wrappers_[c]=void 0),jspb.Message.setField(a,c,void 0));return jspb.Message.setField(a,b,d)};\njspb.Message.computeOneofCase=function(a,b){for(var c,d,e=0;e<b.length;e++){var f=b[e],g=jspb.Message.getField(a,f);null!=g&&(c=f,d=g,jspb.Message.setField(a,f,void 0))}return c?(jspb.Message.setField(a,c,d),c):0};jspb.Message.getWrapperField=function(a,b,c,d){a.wrappers_||(a.wrappers_={});if(!a.wrappers_[c]){var e=jspb.Message.getField(a,c);if(d||e)a.wrappers_[c]=new b(e)}return a.wrappers_[c]};\njspb.Message.getRepeatedWrapperField=function(a,b,c){jspb.Message.wrapRepeatedField_(a,b,c);b=a.wrappers_[c];b==jspb.Message.EMPTY_LIST_SENTINEL_&&(b=a.wrappers_[c]=[]);return b};jspb.Message.wrapRepeatedField_=function(a,b,c){a.wrappers_||(a.wrappers_={});if(!a.wrappers_[c]){for(var d=jspb.Message.getRepeatedField(a,c),e=[],f=0;f<d.length;f++)e[f]=new b(d[f]);a.wrappers_[c]=e}};\njspb.Message.setWrapperField=function(a,b,c){goog.asserts.assertInstanceof(a,jspb.Message);a.wrappers_||(a.wrappers_={});var d=c?c.toArray():c;a.wrappers_[b]=c;return jspb.Message.setField(a,b,d)};jspb.Message.setOneofWrapperField=function(a,b,c,d){goog.asserts.assertInstanceof(a,jspb.Message);a.wrappers_||(a.wrappers_={});var e=d?d.toArray():d;a.wrappers_[b]=d;return jspb.Message.setOneofField(a,b,c,e)};\njspb.Message.setRepeatedWrapperField=function(a,b,c){goog.asserts.assertInstanceof(a,jspb.Message);a.wrappers_||(a.wrappers_={});c=c||[];for(var d=[],e=0;e<c.length;e++)d[e]=c[e].toArray();a.wrappers_[b]=c;return jspb.Message.setField(a,b,d)};\njspb.Message.addToRepeatedWrapperField=function(a,b,c,d,e){jspb.Message.wrapRepeatedField_(a,d,b);var f=a.wrappers_[b];f||(f=a.wrappers_[b]=[]);c=c?c:new d;a=jspb.Message.getRepeatedField(a,b);void 0!=e?(f.splice(e,0,c),a.splice(e,0,c.toArray())):(f.push(c),a.push(c.toArray()));return c};jspb.Message.toMap=function(a,b,c,d){for(var e={},f=0;f<a.length;f++)e[b.call(a[f])]=c?c.call(a[f],d,a[f]):a[f];return e};\njspb.Message.prototype.syncMapFields_=function(){if(this.wrappers_)for(var a in this.wrappers_){var b=this.wrappers_[a];if(Array.isArray(b))for(var c=0;c<b.length;c++)b[c]&&b[c].toArray();else b&&b.toArray()}};jspb.Message.prototype.toArray=function(){this.syncMapFields_();return this.array};jspb.Message.GENERATE_TO_STRING&&(jspb.Message.prototype.toString=function(){this.syncMapFields_();return this.array.toString()});\njspb.Message.prototype.getExtension=function(a){if(this.extensionObject_){this.wrappers_||(this.wrappers_={});var b=a.fieldIndex;if(a.isRepeated){if(a.isMessageType())return this.wrappers_[b]||(this.wrappers_[b]=goog.array.map(this.extensionObject_[b]||[],function(b){return new a.ctor(b)})),this.wrappers_[b]}else if(a.isMessageType())return!this.wrappers_[b]&&this.extensionObject_[b]&&(this.wrappers_[b]=new a.ctor(this.extensionObject_[b])),this.wrappers_[b];return this.extensionObject_[b]}};\njspb.Message.prototype.setExtension=function(a,b){this.wrappers_||(this.wrappers_={});jspb.Message.maybeInitEmptyExtensionObject_(this);var c=a.fieldIndex;a.isRepeated?(b=b||[],a.isMessageType()?(this.wrappers_[c]=b,this.extensionObject_[c]=goog.array.map(b,function(a){return a.toArray()})):this.extensionObject_[c]=b):a.isMessageType()?(this.wrappers_[c]=b,this.extensionObject_[c]=b?b.toArray():b):this.extensionObject_[c]=b;return this};\njspb.Message.difference=function(a,b){if(!(a instanceof b.constructor))throw Error(\"Messages have different types.\");var c=a.toArray();b=b.toArray();var d=[],e=0,f=c.length>b.length?c.length:b.length;a.getJsPbMessageId()&&(d[0]=a.getJsPbMessageId(),e=1);for(;e<f;e++)jspb.Message.compareFields(c[e],b[e])||(d[e]=b[e]);return new a.constructor(d)};jspb.Message.equals=function(a,b){return a==b||!(!a||!b)&&a instanceof b.constructor&&jspb.Message.compareFields(a.toArray(),b.toArray())};\njspb.Message.compareExtensions=function(a,b){a=a||{};b=b||{};var c={},d;for(d in a)c[d]=0;for(d in b)c[d]=0;for(d in c)if(!jspb.Message.compareFields(a[d],b[d]))return!1;return!0};\njspb.Message.compareFields=function(a,b){if(a==b)return!0;if(!goog.isObject(a)||!goog.isObject(b))return\"number\"===typeof a&&isNaN(a)||\"number\"===typeof b&&isNaN(b)?String(a)==String(b):!1;if(a.constructor!=b.constructor)return!1;if(jspb.Message.SUPPORTS_UINT8ARRAY_&&a.constructor===Uint8Array){if(a.length!=b.length)return!1;for(var c=0;c<a.length;c++)if(a[c]!=b[c])return!1;return!0}if(a.constructor===Array){var d=void 0,e=void 0,f=Math.max(a.length,b.length);for(c=0;c<f;c++){var g=a[c],h=b[c];g&&\ng.constructor==Object&&(goog.asserts.assert(void 0===d),goog.asserts.assert(c===a.length-1),d=g,g=void 0);h&&h.constructor==Object&&(goog.asserts.assert(void 0===e),goog.asserts.assert(c===b.length-1),e=h,h=void 0);if(!jspb.Message.compareFields(g,h))return!1}return d||e?(d=d||{},e=e||{},jspb.Message.compareExtensions(d,e)):!0}if(a.constructor===Object)return jspb.Message.compareExtensions(a,b);throw Error(\"Invalid type in JSPB array\");};jspb.Message.prototype.cloneMessage=function(){return jspb.Message.cloneMessage(this)};\njspb.Message.prototype.clone=function(){return jspb.Message.cloneMessage(this)};jspb.Message.clone=function(a){return jspb.Message.cloneMessage(a)};jspb.Message.cloneMessage=function(a){return new a.constructor(jspb.Message.clone_(a.toArray()))};\njspb.Message.copyInto=function(a,b){goog.asserts.assertInstanceof(a,jspb.Message);goog.asserts.assertInstanceof(b,jspb.Message);goog.asserts.assert(a.constructor==b.constructor,\"Copy source and target message should have the same type.\");a=jspb.Message.clone(a);for(var c=b.toArray(),d=a.toArray(),e=c.length=0;e<d.length;e++)c[e]=d[e];b.wrappers_=a.wrappers_;b.extensionObject_=a.extensionObject_};\njspb.Message.clone_=function(a){if(Array.isArray(a)){for(var b=Array(a.length),c=0;c<a.length;c++){var d=a[c];null!=d&&(b[c]=\"object\"==typeof d?jspb.Message.clone_(goog.asserts.assert(d)):d)}return b}if(jspb.Message.SUPPORTS_UINT8ARRAY_&&a instanceof Uint8Array)return new Uint8Array(a);b={};for(c in a)d=a[c],null!=d&&(b[c]=\"object\"==typeof d?jspb.Message.clone_(goog.asserts.assert(d)):d);return b};jspb.Message.registerMessageType=function(a,b){b.messageId=a};jspb.Message.messageSetExtensions={};\njspb.Message.messageSetExtensionsBinary={};jspb.Export={};\"object\"===typeof exports&&(exports.Map=jspb.Map,exports.Message=jspb.Message,exports.BinaryReader=jspb.BinaryReader,exports.BinaryWriter=jspb.BinaryWriter,exports.ExtensionFieldInfo=jspb.ExtensionFieldInfo,exports.ExtensionFieldBinaryInfo=jspb.ExtensionFieldBinaryInfo,exports.exportSymbol=goog.exportSymbol,exports.inherits=goog.inherits,exports.object={extend:goog.object.extend},exports.typeOf=goog.typeOf);\n","'use strict';\n\nvar $BigInt = global.BigInt;\n\nmodule.exports = function hasNativeBigInts() {\n\treturn typeof $BigInt === 'function'\n\t\t&& typeof BigInt === 'function'\n\t\t&& typeof $BigInt(42) === 'bigint' // eslint-disable-line no-magic-numbers\n\t\t&& typeof BigInt(42) === 'bigint'; // eslint-disable-line no-magic-numbers\n};\n","'use strict';\n\nvar origSymbol = typeof Symbol !== 'undefined' && Symbol;\nvar hasSymbolSham = require('./shams');\n\nmodule.exports = function hasNativeSymbols() {\n\tif (typeof origSymbol !== 'function') { return false; }\n\tif (typeof Symbol !== 'function') { return false; }\n\tif (typeof origSymbol('foo') !== 'symbol') { return false; }\n\tif (typeof Symbol('bar') !== 'symbol') { return false; }\n\n\treturn hasSymbolSham();\n};\n","'use strict';\n\n/* eslint complexity: [2, 18], max-statements: [2, 33] */\nmodule.exports = function hasSymbols() {\n\tif (typeof Symbol !== 'function' || typeof Object.getOwnPropertySymbols !== 'function') { return false; }\n\tif (typeof Symbol.iterator === 'symbol') { return true; }\n\n\tvar obj = {};\n\tvar sym = Symbol('test');\n\tvar symObj = Object(sym);\n\tif (typeof sym === 'string') { return false; }\n\n\tif (Object.prototype.toString.call(sym) !== '[object Symbol]') { return false; }\n\tif (Object.prototype.toString.call(symObj) !== '[object Symbol]') { return false; }\n\n\t// temp disabled per https://github.com/ljharb/object.assign/issues/17\n\t// if (sym instanceof Symbol) { return false; }\n\t// temp disabled per https://github.com/WebReflection/get-own-property-symbols/issues/4\n\t// if (!(symObj instanceof Symbol)) { return false; }\n\n\t// if (typeof Symbol.prototype.toString !== 'function') { return false; }\n\t// if (String(sym) !== Symbol.prototype.toString.call(sym)) { return false; }\n\n\tvar symVal = 42;\n\tobj[sym] = symVal;\n\tfor (sym in obj) { return false; } // eslint-disable-line no-restricted-syntax, no-unreachable-loop\n\tif (typeof Object.keys === 'function' && Object.keys(obj).length !== 0) { return false; }\n\n\tif (typeof Object.getOwnPropertyNames === 'function' && Object.getOwnPropertyNames(obj).length !== 0) { return false; }\n\n\tvar syms = Object.getOwnPropertySymbols(obj);\n\tif (syms.length !== 1 || syms[0] !== sym) { return false; }\n\n\tif (!Object.prototype.propertyIsEnumerable.call(obj, sym)) { return false; }\n\n\tif (typeof Object.getOwnPropertyDescriptor === 'function') {\n\t\tvar descriptor = Object.getOwnPropertyDescriptor(obj, sym);\n\t\tif (descriptor.value !== symVal || descriptor.enumerable !== true) { return false; }\n\t}\n\n\treturn true;\n};\n","'use strict';\n\nvar hasSymbols = require('has-symbols/shams');\n\nmodule.exports = function hasToStringTagShams() {\n\treturn hasSymbols() && !!Symbol.toStringTag;\n};\n","'use strict';\n\nvar bind = require('function-bind');\n\nmodule.exports = bind.call(Function.call, Object.prototype.hasOwnProperty);\n","'use strict';\n\nvar hasToStringTag = require('has-tostringtag/shams')();\nvar callBound = require('call-bind/callBound');\n\nvar $toString = callBound('Object.prototype.toString');\n\nvar isStandardArguments = function isArguments(value) {\n\tif (hasToStringTag && value && typeof value === 'object' && Symbol.toStringTag in value) {\n\t\treturn false;\n\t}\n\treturn $toString(value) === '[object Arguments]';\n};\n\nvar isLegacyArguments = function isArguments(value) {\n\tif (isStandardArguments(value)) {\n\t\treturn true;\n\t}\n\treturn value !== null &&\n\t\ttypeof value === 'object' &&\n\t\ttypeof value.length === 'number' &&\n\t\tvalue.length >= 0 &&\n\t\t$toString(value) !== '[object Array]' &&\n\t\t$toString(value.callee) === '[object Function]';\n};\n\nvar supportsStandardArguments = (function () {\n\treturn isStandardArguments(arguments);\n}());\n\nisStandardArguments.isLegacyArguments = isLegacyArguments; // for tests\n\nmodule.exports = supportsStandardArguments ? isStandardArguments : isLegacyArguments;\n","'use strict';\n\nvar hasBigInts = require('has-bigints')();\n\nif (hasBigInts) {\n\tvar bigIntValueOf = BigInt.prototype.valueOf;\n\tvar tryBigInt = function tryBigIntObject(value) {\n\t\ttry {\n\t\t\tbigIntValueOf.call(value);\n\t\t\treturn true;\n\t\t} catch (e) {\n\t\t}\n\t\treturn false;\n\t};\n\n\tmodule.exports = function isBigInt(value) {\n\t\tif (\n\t\t\tvalue === null\n\t\t\t|| typeof value === 'undefined'\n\t\t\t|| typeof value === 'boolean'\n\t\t\t|| typeof value === 'string'\n\t\t\t|| typeof value === 'number'\n\t\t\t|| typeof value === 'symbol'\n\t\t\t|| typeof value === 'function'\n\t\t) {\n\t\t\treturn false;\n\t\t}\n\t\tif (typeof value === 'bigint') {\n\t\t\treturn true;\n\t\t}\n\n\t\treturn tryBigInt(value);\n\t};\n} else {\n\tmodule.exports = function isBigInt(value) {\n\t\treturn false && value;\n\t};\n}\n","'use strict';\n\nvar callBound = require('call-bind/callBound');\nvar $boolToStr = callBound('Boolean.prototype.toString');\nvar $toString = callBound('Object.prototype.toString');\n\nvar tryBooleanObject = function booleanBrandCheck(value) {\n\ttry {\n\t\t$boolToStr(value);\n\t\treturn true;\n\t} catch (e) {\n\t\treturn false;\n\t}\n};\nvar boolClass = '[object Boolean]';\nvar hasToStringTag = require('has-tostringtag/shams')();\n\nmodule.exports = function isBoolean(value) {\n\tif (typeof value === 'boolean') {\n\t\treturn true;\n\t}\n\tif (value === null || typeof value !== 'object') {\n\t\treturn false;\n\t}\n\treturn hasToStringTag && Symbol.toStringTag in value ? tryBooleanObject(value) : $toString(value) === boolClass;\n};\n","/*!\n * Determine if an object is a Buffer\n *\n * @author Feross Aboukhadijeh <https://feross.org>\n * @license MIT\n */\n\n// The _isBuffer check is for Safari 5-7 support, because it's missing\n// Object.prototype.constructor. Remove this eventually\nmodule.exports = function (obj) {\n return obj != null && (isBuffer(obj) || isSlowBuffer(obj) || !!obj._isBuffer)\n}\n\nfunction isBuffer (obj) {\n return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj)\n}\n\n// For Node v0.10 support. Remove this eventually.\nfunction isSlowBuffer (obj) {\n return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0))\n}\n","'use strict';\n\nvar getDay = Date.prototype.getDay;\nvar tryDateObject = function tryDateGetDayCall(value) {\n\ttry {\n\t\tgetDay.call(value);\n\t\treturn true;\n\t} catch (e) {\n\t\treturn false;\n\t}\n};\n\nvar toStr = Object.prototype.toString;\nvar dateClass = '[object Date]';\nvar hasToStringTag = require('has-tostringtag/shams')();\n\nmodule.exports = function isDateObject(value) {\n\tif (typeof value !== 'object' || value === null) {\n\t\treturn false;\n\t}\n\treturn hasToStringTag ? tryDateObject(value) : toStr.call(value) === dateClass;\n};\n","'use strict';\n\nvar $Map = typeof Map === 'function' && Map.prototype ? Map : null;\nvar $Set = typeof Set === 'function' && Set.prototype ? Set : null;\n\nvar exported;\n\nif (!$Map) {\n\t// eslint-disable-next-line no-unused-vars\n\texported = function isMap(x) {\n\t\t// `Map` is not present in this environment.\n\t\treturn false;\n\t};\n}\n\nvar $mapHas = $Map ? Map.prototype.has : null;\nvar $setHas = $Set ? Set.prototype.has : null;\nif (!exported && !$mapHas) {\n\t// eslint-disable-next-line no-unused-vars\n\texported = function isMap(x) {\n\t\t// `Map` does not have a `has` method\n\t\treturn false;\n\t};\n}\n\nmodule.exports = exported || function isMap(x) {\n\tif (!x || typeof x !== 'object') {\n\t\treturn false;\n\t}\n\ttry {\n\t\t$mapHas.call(x);\n\t\tif ($setHas) {\n\t\t\ttry {\n\t\t\t\t$setHas.call(x);\n\t\t\t} catch (e) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn x instanceof $Map; // core-js workaround, pre-v2.5.0\n\t} catch (e) {}\n\treturn false;\n};\n","'use strict';\n\nvar numToStr = Number.prototype.toString;\nvar tryNumberObject = function tryNumberObject(value) {\n\ttry {\n\t\tnumToStr.call(value);\n\t\treturn true;\n\t} catch (e) {\n\t\treturn false;\n\t}\n};\nvar toStr = Object.prototype.toString;\nvar numClass = '[object Number]';\nvar hasToStringTag = require('has-tostringtag/shams')();\n\nmodule.exports = function isNumberObject(value) {\n\tif (typeof value === 'number') {\n\t\treturn true;\n\t}\n\tif (typeof value !== 'object') {\n\t\treturn false;\n\t}\n\treturn hasToStringTag ? tryNumberObject(value) : toStr.call(value) === numClass;\n};\n","'use strict';\n\nvar callBound = require('call-bind/callBound');\nvar hasToStringTag = require('has-tostringtag/shams')();\nvar has;\nvar $exec;\nvar isRegexMarker;\nvar badStringifier;\n\nif (hasToStringTag) {\n\thas = callBound('Object.prototype.hasOwnProperty');\n\t$exec = callBound('RegExp.prototype.exec');\n\tisRegexMarker = {};\n\n\tvar throwRegexMarker = function () {\n\t\tthrow isRegexMarker;\n\t};\n\tbadStringifier = {\n\t\ttoString: throwRegexMarker,\n\t\tvalueOf: throwRegexMarker\n\t};\n\n\tif (typeof Symbol.toPrimitive === 'symbol') {\n\t\tbadStringifier[Symbol.toPrimitive] = throwRegexMarker;\n\t}\n}\n\nvar $toString = callBound('Object.prototype.toString');\nvar gOPD = Object.getOwnPropertyDescriptor;\nvar regexClass = '[object RegExp]';\n\nmodule.exports = hasToStringTag\n\t// eslint-disable-next-line consistent-return\n\t? function isRegex(value) {\n\t\tif (!value || typeof value !== 'object') {\n\t\t\treturn false;\n\t\t}\n\n\t\tvar descriptor = gOPD(value, 'lastIndex');\n\t\tvar hasLastIndexDataProperty = descriptor && has(descriptor, 'value');\n\t\tif (!hasLastIndexDataProperty) {\n\t\t\treturn false;\n\t\t}\n\n\t\ttry {\n\t\t\t$exec(value, badStringifier);\n\t\t} catch (e) {\n\t\t\treturn e === isRegexMarker;\n\t\t}\n\t}\n\t: function isRegex(value) {\n\t\t// In older browsers, typeof regex incorrectly returns 'function'\n\t\tif (!value || (typeof value !== 'object' && typeof value !== 'function')) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn $toString(value) === regexClass;\n\t};\n","'use strict';\n\nvar $Map = typeof Map === 'function' && Map.prototype ? Map : null;\nvar $Set = typeof Set === 'function' && Set.prototype ? Set : null;\n\nvar exported;\n\nif (!$Set) {\n\t// eslint-disable-next-line no-unused-vars\n\texported = function isSet(x) {\n\t\t// `Set` is not present in this environment.\n\t\treturn false;\n\t};\n}\n\nvar $mapHas = $Map ? Map.prototype.has : null;\nvar $setHas = $Set ? Set.prototype.has : null;\nif (!exported && !$setHas) {\n\t// eslint-disable-next-line no-unused-vars\n\texported = function isSet(x) {\n\t\t// `Set` does not have a `has` method\n\t\treturn false;\n\t};\n}\n\nmodule.exports = exported || function isSet(x) {\n\tif (!x || typeof x !== 'object') {\n\t\treturn false;\n\t}\n\ttry {\n\t\t$setHas.call(x);\n\t\tif ($mapHas) {\n\t\t\ttry {\n\t\t\t\t$mapHas.call(x);\n\t\t\t} catch (e) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn x instanceof $Set; // core-js workaround, pre-v2.5.0\n\t} catch (e) {}\n\treturn false;\n};\n","'use strict';\n\nvar strValue = String.prototype.valueOf;\nvar tryStringObject = function tryStringObject(value) {\n\ttry {\n\t\tstrValue.call(value);\n\t\treturn true;\n\t} catch (e) {\n\t\treturn false;\n\t}\n};\nvar toStr = Object.prototype.toString;\nvar strClass = '[object String]';\nvar hasToStringTag = require('has-tostringtag/shams')();\n\nmodule.exports = function isString(value) {\n\tif (typeof value === 'string') {\n\t\treturn true;\n\t}\n\tif (typeof value !== 'object') {\n\t\treturn false;\n\t}\n\treturn hasToStringTag ? tryStringObject(value) : toStr.call(value) === strClass;\n};\n","'use strict';\n\nvar toStr = Object.prototype.toString;\nvar hasSymbols = require('has-symbols')();\n\nif (hasSymbols) {\n\tvar symToStr = Symbol.prototype.toString;\n\tvar symStringRegex = /^Symbol\\(.*\\)$/;\n\tvar isSymbolObject = function isRealSymbolObject(value) {\n\t\tif (typeof value.valueOf() !== 'symbol') {\n\t\t\treturn false;\n\t\t}\n\t\treturn symStringRegex.test(symToStr.call(value));\n\t};\n\n\tmodule.exports = function isSymbol(value) {\n\t\tif (typeof value === 'symbol') {\n\t\t\treturn true;\n\t\t}\n\t\tif (toStr.call(value) !== '[object Symbol]') {\n\t\t\treturn false;\n\t\t}\n\t\ttry {\n\t\t\treturn isSymbolObject(value);\n\t\t} catch (e) {\n\t\t\treturn false;\n\t\t}\n\t};\n} else {\n\n\tmodule.exports = function isSymbol(value) {\n\t\t// this environment does not support Symbols.\n\t\treturn false && value;\n\t};\n}\n","'use strict';\n\nvar forEach = require('foreach');\nvar availableTypedArrays = require('available-typed-arrays');\nvar callBound = require('call-bind/callBound');\n\nvar $toString = callBound('Object.prototype.toString');\nvar hasToStringTag = require('has-tostringtag/shams')();\n\nvar g = typeof globalThis === 'undefined' ? global : globalThis;\nvar typedArrays = availableTypedArrays();\n\nvar $indexOf = callBound('Array.prototype.indexOf', true) || function indexOf(array, value) {\n\tfor (var i = 0; i < array.length; i += 1) {\n\t\tif (array[i] === value) {\n\t\t\treturn i;\n\t\t}\n\t}\n\treturn -1;\n};\nvar $slice = callBound('String.prototype.slice');\nvar toStrTags = {};\nvar gOPD = require('es-abstract/helpers/getOwnPropertyDescriptor');\nvar getPrototypeOf = Object.getPrototypeOf; // require('getprototypeof');\nif (hasToStringTag && gOPD && getPrototypeOf) {\n\tforEach(typedArrays, function (typedArray) {\n\t\tvar arr = new g[typedArray]();\n\t\tif (Symbol.toStringTag in arr) {\n\t\t\tvar proto = getPrototypeOf(arr);\n\t\t\tvar descriptor = gOPD(proto, Symbol.toStringTag);\n\t\t\tif (!descriptor) {\n\t\t\t\tvar superProto = getPrototypeOf(proto);\n\t\t\t\tdescriptor = gOPD(superProto, Symbol.toStringTag);\n\t\t\t}\n\t\t\ttoStrTags[typedArray] = descriptor.get;\n\t\t}\n\t});\n}\n\nvar tryTypedArrays = function tryAllTypedArrays(value) {\n\tvar anyTrue = false;\n\tforEach(toStrTags, function (getter, typedArray) {\n\t\tif (!anyTrue) {\n\t\t\ttry {\n\t\t\t\tanyTrue = getter.call(value) === typedArray;\n\t\t\t} catch (e) { /**/ }\n\t\t}\n\t});\n\treturn anyTrue;\n};\n\nmodule.exports = function isTypedArray(value) {\n\tif (!value || typeof value !== 'object') { return false; }\n\tif (!hasToStringTag || !(Symbol.toStringTag in value)) {\n\t\tvar tag = $slice($toString(value), 8, -1);\n\t\treturn $indexOf(typedArrays, tag) > -1;\n\t}\n\tif (!gOPD) { return false; }\n\treturn tryTypedArrays(value);\n};\n","'use strict';\n\nvar $WeakMap = typeof WeakMap === 'function' && WeakMap.prototype ? WeakMap : null;\nvar $WeakSet = typeof WeakSet === 'function' && WeakSet.prototype ? WeakSet : null;\n\nvar exported;\n\nif (!$WeakMap) {\n\t// eslint-disable-next-line no-unused-vars\n\texported = function isWeakMap(x) {\n\t\t// `WeakMap` is not present in this environment.\n\t\treturn false;\n\t};\n}\n\nvar $mapHas = $WeakMap ? $WeakMap.prototype.has : null;\nvar $setHas = $WeakSet ? $WeakSet.prototype.has : null;\nif (!exported && !$mapHas) {\n\t// eslint-disable-next-line no-unused-vars\n\texported = function isWeakMap(x) {\n\t\t// `WeakMap` does not have a `has` method\n\t\treturn false;\n\t};\n}\n\nmodule.exports = exported || function isWeakMap(x) {\n\tif (!x || typeof x !== 'object') {\n\t\treturn false;\n\t}\n\ttry {\n\t\t$mapHas.call(x, $mapHas);\n\t\tif ($setHas) {\n\t\t\ttry {\n\t\t\t\t$setHas.call(x, $setHas);\n\t\t\t} catch (e) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn x instanceof $WeakMap; // core-js workaround, pre-v3\n\t} catch (e) {}\n\treturn false;\n};\n","'use strict';\n\nvar GetIntrinsic = require('get-intrinsic');\nvar callBound = require('call-bind/callBound');\n\nvar $WeakSet = GetIntrinsic('%WeakSet%', true);\n\nvar $setHas = callBound('WeakSet.prototype.has', true);\n\nif ($setHas) {\n\tvar $mapHas = callBound('WeakMap.prototype.has', true);\n\n\tmodule.exports = function isWeakSet(x) {\n\t\tif (!x || typeof x !== 'object') {\n\t\t\treturn false;\n\t\t}\n\t\ttry {\n\t\t\t$setHas(x, $setHas);\n\t\t\tif ($mapHas) {\n\t\t\t\ttry {\n\t\t\t\t\t$mapHas(x, $mapHas);\n\t\t\t\t} catch (e) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn x instanceof $WeakSet; // core-js workaround, pre-v3\n\t\t} catch (e) {}\n\t\treturn false;\n\t};\n} else {\n\t// eslint-disable-next-line no-unused-vars\n\tmodule.exports = function isWeakSet(x) {\n\t\t// `WeakSet` does not exist, or does not have a `has` method\n\t\treturn false;\n\t};\n}\n","var map = require(\"./map\");\n\nvar getCountryCode = function(localeString) {\n var components = localeString.split(\"_\");\n if (components.length == 2) {\n return components.pop();\n }\n components = localeString.split(\"-\");\n if (components.length == 2) {\n return components.pop();\n }\n return localeString;\n}\n\nexports.getCurrency = function(locale) {\n var countryCode = getCountryCode(locale).toUpperCase();\n if (countryCode in map) {\n return map[countryCode];\n }\n return null;\n}\n\nexports.getLocales = function(currencyCode) {\n currencyCode = currencyCode.toUpperCase();\n var locales = [];\n for (countryCode in map) {\n if (map[countryCode] === currencyCode) {\n locales.push(countryCode);\n }\n }\n return locales;\n}","// Generated using ShowCurrencies.java\nvar map = {\nAD: 'EUR',\nAE: 'AED',\nAF: 'AFN',\nAG: 'XCD',\nAI: 'XCD',\nAL: 'ALL',\nAM: 'AMD',\nAN: 'ANG',\nAO: 'AOA',\nAR: 'ARS',\nAS: 'USD',\nAT: 'EUR',\nAU: 'AUD',\nAW: 'AWG',\nAX: 'EUR',\nAZ: 'AZN',\nBA: 'BAM',\nBB: 'BBD',\nBD: 'BDT',\nBE: 'EUR',\nBF: 'XOF',\nBG: 'BGN',\nBH: 'BHD',\nBI: 'BIF',\nBJ: 'XOF',\nBL: 'EUR',\nBM: 'BMD',\nBN: 'BND',\nBO: 'BOB',\nBQ: 'USD',\nBR: 'BRL',\nBS: 'BSD',\nBT: 'BTN',\nBV: 'NOK',\nBW: 'BWP',\nBY: 'BYR',\nBZ: 'BZD',\nCA: 'CAD',\nCC: 'AUD',\nCD: 'CDF',\nCF: 'XAF',\nCG: 'XAF',\nCH: 'CHF',\nCI: 'XOF',\nCK: 'NZD',\nCL: 'CLP',\nCM: 'XAF',\nCN: 'CNY',\nCO: 'COP',\nCR: 'CRC',\nCU: 'CUP',\nCV: 'CVE',\nCW: 'ANG',\nCX: 'AUD',\nCY: 'EUR',\nCZ: 'CZK',\nDE: 'EUR',\nDJ: 'DJF',\nDK: 'DKK',\nDM: 'XCD',\nDO: 'DOP',\nDZ: 'DZD',\nEC: 'USD',\nEE: 'EUR',\nEG: 'EGP',\nEH: 'MAD',\nER: 'ERN',\nES: 'EUR',\nET: 'ETB',\nFI: 'EUR',\nFJ: 'FJD',\nFK: 'FKP',\nFM: 'USD',\nFO: 'DKK',\nFR: 'EUR',\nGA: 'XAF',\nGB: 'GBP',\nGD: 'XCD',\nGE: 'GEL',\nGF: 'EUR',\nGG: 'GBP',\nGH: 'GHS',\nGI: 'GIP',\nGL: 'DKK',\nGM: 'GMD',\nGN: 'GNF',\nGP: 'EUR',\nGQ: 'XAF',\nGR: 'EUR',\nGS: 'GBP',\nGT: 'GTQ',\nG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',\nPY: 'PYG',\nQA: 'QAR',\nRE: 'EUR',\nRO: 'RON',\nRS: 'RSD',\nRU: 'RUB',\nRW: 'RWF',\nSA: 'SAR',\nSB: 'SBD',\nSC: 'SCR',\nSD: 'SDG',\nSE: 'SEK',\nSG: 'SGD',\nSH: 'SHP',\nSI: 'EUR',\nSJ: 'NOK',\nSK: 'EUR',\nSL: 'SLL',\nSM: 'EUR',\nSN: 'XOF',\nSO: 'SOS',\nSR: 'SRD',\nST: 'STD',\nSV: 'SVC',\nSX: 'ANG',\nSY: 'SYP',\nSZ: 'SZL',\nTC: 'USD',\nTD: 'XAF',\nTF: 'EUR',\nTG: 'XOF',\nTH: 'THB',\nTJ: 'TJS',\nTK: 'NZD',\nTL: 'USD',\nTM: 'TMT',\nTN: 'TND',\nTO: 'TOP',\nTR: 'TRY',\nTT: 'TTD',\nTV: 'AUD',\nTW: 'TWD',\nTZ: 'TZS',\nUA: 'UAH',\nUG: 'UGX',\nUM: 'USD',\nUS: 'USD',\nUY: 'UYU',\nUZ: 'UZS',\nVA: 'EUR',\nVC: 'XCD',\nVE: 'VEF',\nVG: 'USD',\nVI: 'USD',\nVN: 'VND',\nVU: 'VUV',\nWF: 'XPF',\nWS: 'WST',\nYE: 'YER',\nYT: 'EUR',\nZA: 'ZAR',\nZM: 'ZMK',\nZW: 'ZWL'\n};\n\nmodule.exports = map;","'use strict'\n\n// A linked list to keep track of recently-used-ness\nconst Yallist = require('yallist')\n\nconst MAX = Symbol('max')\nconst LENGTH = Symbol('length')\nconst LENGTH_CALCULATOR = Symbol('lengthCalculator')\nconst ALLOW_STALE = Symbol('allowStale')\nconst MAX_AGE = Symbol('maxAge')\nconst DISPOSE = Symbol('dispose')\nconst NO_DISPOSE_ON_SET = Symbol('noDisposeOnSet')\nconst LRU_LIST = Symbol('lruList')\nconst CACHE = Symbol('cache')\nconst UPDATE_AGE_ON_GET = Symbol('updateAgeOnGet')\n\nconst naiveLength = () => 1\n\n// lruList is a yallist where the head is the youngest\n// item, and the tail is the oldest. the list contains the Hit\n// objects as the entries.\n// Each Hit object has a reference to its Yallist.Node. This\n// never changes.\n//\n// cache is a Map (or PseudoMap) that matches the keys to\n// the Yallist.Node object.\nclass LRUCache {\n constructor (options) {\n if (typeof options === 'number')\n options = { max: options }\n\n if (!options)\n options = {}\n\n if (options.max && (typeof options.max !== 'number' || options.max < 0))\n throw new TypeError('max must be a non-negative number')\n // Kind of weird to have a default max of Infinity, but oh well.\n const max = this[MAX] = options.max || Infinity\n\n const lc = options.length || naiveLength\n this[LENGTH_CALCULATOR] = (typeof lc !== 'function') ? naiveLength : lc\n this[ALLOW_STALE] = options.stale || false\n if (options.maxAge && typeof options.maxAge !== 'number')\n throw new TypeError('maxAge must be a number')\n this[MAX_AGE] = options.maxAge || 0\n this[DISPOSE] = options.dispose\n this[NO_DISPOSE_ON_SET] = options.noDisposeOnSet || false\n this[UPDATE_AGE_ON_GET] = options.updateAgeOnGet || false\n this.reset()\n }\n\n // resize the cache when the max changes.\n set max (mL) {\n if (typeof mL !== 'number' || mL < 0)\n throw new TypeError('max must be a non-negative number')\n\n this[MAX] = mL || Infinity\n trim(this)\n }\n get max () {\n return this[MAX]\n }\n\n set allowStale (allowStale) {\n this[ALLOW_STALE] = !!allowStale\n }\n get allowStale () {\n return this[ALLOW_STALE]\n }\n\n set maxAge (mA) {\n if (typeof mA !== 'number')\n throw new TypeError('maxAge must be a non-negative number')\n\n this[MAX_AGE] = mA\n trim(this)\n }\n get maxAge () {\n return this[MAX_AGE]\n }\n\n // resize the cache when the lengthCalculator changes.\n set lengthCalculator (lC) {\n if (typeof lC !== 'function')\n lC = naiveLength\n\n if (lC !== this[LENGTH_CALCULATOR]) {\n this[LENGTH_CALCULATOR] = lC\n this[LENGTH] = 0\n this[LRU_LIST].forEach(hit => {\n hit.length = this[LENGTH_CALCULATOR](hit.value, hit.key)\n this[LENGTH] += hit.length\n })\n }\n trim(this)\n }\n get lengthCalculator () { return this[LENGTH_CALCULATOR] }\n\n get length () { return this[LENGTH] }\n get itemCount () { return this[LRU_LIST].length }\n\n rforEach (fn, thisp) {\n thisp = thisp || this\n for (let walker = this[LRU_LIST].tail; walker !== null;) {\n const prev = walker.prev\n forEachStep(this, fn, walker, thisp)\n walker = prev\n }\n }\n\n forEach (fn, thisp) {\n thisp = thisp || this\n for (let walker = this[LRU_LIST].head; walker !== null;) {\n const next = walker.next\n forEachStep(this, fn, walker, thisp)\n walker = next\n }\n }\n\n keys () {\n return this[LRU_LIST].toArray().map(k => k.key)\n }\n\n values () {\n return this[LRU_LIST].toArray().map(k => k.value)\n }\n\n reset () {\n if (this[DISPOSE] &&\n this[LRU_LIST] &&\n this[LRU_LIST].length) {\n this[LRU_LIST].forEach(hit => this[DISPOSE](hit.key, hit.value))\n }\n\n this[CACHE] = new Map() // hash of items by key\n this[LRU_LIST] = new Yallist() // list of items in order of use recency\n this[LENGTH] = 0 // length of items in the list\n }\n\n dump () {\n return this[LRU_LIST].map(hit =>\n isStale(this, hit) ? false : {\n k: hit.key,\n v: hit.value,\n e: hit.now + (hit.maxAge || 0)\n }).toArray().filter(h => h)\n }\n\n dumpLru () {\n return this[LRU_LIST]\n }\n\n set (key, value, maxAge) {\n maxAge = maxAge || this[MAX_AGE]\n\n if (maxAge && typeof maxAge !== 'number')\n throw new TypeError('maxAge must be a number')\n\n const now = maxAge ? Date.now() : 0\n const len = this[LENGTH_CALCULATOR](value, key)\n\n if (this[CACHE].has(key)) {\n if (len > this[MAX]) {\n del(this, this[CACHE].get(key))\n return false\n }\n\n const node = this[CACHE].get(key)\n const item = node.value\n\n // dispose of the old one before overwriting\n // split out into 2 ifs for better coverage tracking\n if (this[DISPOSE]) {\n if (!this[NO_DISPOSE_ON_SET])\n this[DISPOSE](key, item.value)\n }\n\n item.now = now\n item.maxAge = maxAge\n item.value = value\n this[LENGTH] += len - item.length\n item.length = len\n this.get(key)\n trim(this)\n return true\n }\n\n const hit = new Entry(key, value, len, now, maxAge)\n\n // oversized objects fall out of cache automatically.\n if (hit.length > this[MAX]) {\n if (this[DISPOSE])\n this[DISPOSE](key, value)\n\n return false\n }\n\n this[LENGTH] += hit.length\n this[LRU_LIST].unshift(hit)\n this[CACHE].set(key, this[LRU_LIST].head)\n trim(this)\n return true\n }\n\n has (key) {\n if (!this[CACHE].has(key)) return false\n const hit = this[CACHE].get(key).value\n return !isStale(this, hit)\n }\n\n get (key) {\n return get(this, key, true)\n }\n\n peek (key) {\n return get(this, key, false)\n }\n\n pop () {\n const node = this[LRU_LIST].tail\n if (!node)\n return null\n\n del(this, node)\n return node.value\n }\n\n del (key) {\n del(this, this[CACHE].get(key))\n }\n\n load (arr) {\n // reset the cache\n this.reset()\n\n const now = Date.now()\n // A previous serialized cache has the most recent items first\n for (let l = arr.length - 1; l >= 0; l--) {\n const hit = arr[l]\n const expiresAt = hit.e || 0\n if (expiresAt === 0)\n // the item was created without expiration in a non aged cache\n this.set(hit.k, hit.v)\n else {\n const maxAge = expiresAt - now\n // dont add already expired items\n if (maxAge > 0) {\n this.set(hit.k, hit.v, maxAge)\n }\n }\n }\n }\n\n prune () {\n this[CACHE].forEach((value, key) => get(this, key, false))\n }\n}\n\nconst get = (self, key, doUse) => {\n const node = self[CACHE].get(key)\n if (node) {\n const hit = node.value\n if (isStale(self, hit)) {\n del(self, node)\n if (!self[ALLOW_STALE])\n return undefined\n } else {\n if (doUse) {\n if (self[UPDATE_AGE_ON_GET])\n node.value.now = Date.now()\n self[LRU_LIST].unshiftNode(node)\n }\n }\n return hit.value\n }\n}\n\nconst isStale = (self, hit) => {\n if (!hit || (!hit.maxAge && !self[MAX_AGE]))\n return false\n\n const diff = Date.now() - hit.now\n return hit.maxAge ? diff > hit.maxAge\n : self[MAX_AGE] && (diff > self[MAX_AGE])\n}\n\nconst trim = self => {\n if (self[LENGTH] > self[MAX]) {\n for (let walker = self[LRU_LIST].tail;\n self[LENGTH] > self[MAX] && walker !== null;) {\n // We know that we're about to delete this one, and also\n // what the next least recently used key will be, so just\n // go ahead and set it now.\n const prev = walker.prev\n del(self, walker)\n walker = prev\n }\n }\n}\n\nconst del = (self, node) => {\n if (node) {\n const hit = node.value\n if (self[DISPOSE])\n self[DISPOSE](hit.key, hit.value)\n\n self[LENGTH] -= hit.length\n self[CACHE].delete(hit.key)\n self[LRU_LIST].removeNode(node)\n }\n}\n\nclass Entry {\n constructor (key, value, length, now, maxAge) {\n this.key = key\n this.value = value\n this.length = length\n this.now = now\n this.maxAge = maxAge || 0\n }\n}\n\nconst forEachStep = (self, fn, node, thisp) => {\n let hit = node.value\n if (isStale(self, hit)) {\n del(self, node)\n if (!self[ALLOW_STALE])\n hit = undefined\n }\n if (hit)\n fn.call(thisp, hit.value, hit.key, self)\n}\n\nmodule.exports = LRUCache\n","'use strict'\nmodule.exports = function (Yallist) {\n Yallist.prototype[Symbol.iterator] = function* () {\n for (let walker = this.head; walker; walker = walker.next) {\n yield walker.value\n }\n }\n}\n","'use strict'\nmodule.exports = Yallist\n\nYallist.Node = Node\nYallist.create = Yallist\n\nfunction Yallist (list) {\n var self = this\n if (!(self instanceof Yallist)) {\n self = new Yallist()\n }\n\n self.tail = null\n self.head = null\n self.length = 0\n\n if (list && typeof list.forEach === 'function') {\n list.forEach(function (item) {\n self.push(item)\n })\n } else if (arguments.length > 0) {\n for (var i = 0, l = arguments.length; i < l; i++) {\n self.push(arguments[i])\n }\n }\n\n return self\n}\n\nYallist.prototype.removeNode = function (node) {\n if (node.list !== this) {\n throw new Error('removing node which does not belong to this list')\n }\n\n var next = node.next\n var prev = node.prev\n\n if (next) {\n next.prev = prev\n }\n\n if (prev) {\n prev.next = next\n }\n\n if (node === this.head) {\n this.head = next\n }\n if (node === this.tail) {\n this.tail = prev\n }\n\n node.list.length--\n node.next = null\n node.prev = null\n node.list = null\n\n return next\n}\n\nYallist.prototype.unshiftNode = function (node) {\n if (node === this.head) {\n return\n }\n\n if (node.list) {\n node.list.removeNode(node)\n }\n\n var head = this.head\n node.list = this\n node.next = head\n if (head) {\n head.prev = node\n }\n\n this.head = node\n if (!this.tail) {\n this.tail = node\n }\n this.length++\n}\n\nYallist.prototype.pushNode = function (node) {\n if (node === this.tail) {\n return\n }\n\n if (node.list) {\n node.list.removeNode(node)\n }\n\n var tail = this.tail\n node.list = this\n node.prev = tail\n if (tail) {\n tail.next = node\n }\n\n this.tail = node\n if (!this.head) {\n this.head = node\n }\n this.length++\n}\n\nYallist.prototype.push = function () {\n for (var i = 0, l = arguments.length; i < l; i++) {\n push(this, arguments[i])\n }\n return this.length\n}\n\nYallist.prototype.unshift = function () {\n for (var i = 0, l = arguments.length; i < l; i++) {\n unshift(this, arguments[i])\n }\n return this.length\n}\n\nYallist.prototype.pop = function () {\n if (!this.tail) {\n return undefined\n }\n\n var res = this.tail.value\n this.tail = this.tail.prev\n if (this.tail) {\n this.tail.next = null\n } else {\n this.head = null\n }\n this.length--\n return res\n}\n\nYallist.prototype.shift = function () {\n if (!this.head) {\n return undefined\n }\n\n var res = this.head.value\n this.head = this.head.next\n if (this.head) {\n this.head.prev = null\n } else {\n this.tail = null\n }\n this.length--\n return res\n}\n\nYallist.prototype.forEach = function (fn, thisp) {\n thisp = thisp || this\n for (var walker = this.head, i = 0; walker !== null; i++) {\n fn.call(thisp, walker.value, i, this)\n walker = walker.next\n }\n}\n\nYallist.prototype.forEachReverse = function (fn, thisp) {\n thisp = thisp || this\n for (var walker = this.tail, i = this.length - 1; walker !== null; i--) {\n fn.call(thisp, walker.value, i, this)\n walker = walker.prev\n }\n}\n\nYallist.prototype.get = function (n) {\n for (var i = 0, walker = this.head; walker !== null && i < n; i++) {\n // abort out of the list early if we hit a cycle\n walker = walker.next\n }\n if (i === n && walker !== null) {\n return walker.value\n }\n}\n\nYallist.prototype.getReverse = function (n) {\n for (var i = 0, walker = this.tail; walker !== null && i < n; i++) {\n // abort out of the list early if we hit a cycle\n walker = walker.prev\n }\n if (i === n && walker !== null) {\n return walker.value\n }\n}\n\nYallist.prototype.map = function (fn, thisp) {\n thisp = thisp || this\n var res = new Yallist()\n for (var walker = this.head; walker !== null;) {\n res.push(fn.call(thisp, walker.value, this))\n walker = walker.next\n }\n return res\n}\n\nYallist.prototype.mapReverse = function (fn, thisp) {\n thisp = thisp || this\n var res = new Yallist()\n for (var walker = this.tail; walker !== null;) {\n res.push(fn.call(thisp, walker.value, this))\n walker = walker.prev\n }\n return res\n}\n\nYallist.prototype.reduce = function (fn, initial) {\n var acc\n var walker = this.head\n if (arguments.length > 1) {\n acc = initial\n } else if (this.head) {\n walker = this.head.next\n acc = this.head.value\n } else {\n throw new TypeError('Reduce of empty list with no initial value')\n }\n\n for (var i = 0; walker !== null; i++) {\n acc = fn(acc, walker.value, i)\n walker = walker.next\n }\n\n return acc\n}\n\nYallist.prototype.reduceReverse = function (fn, initial) {\n var acc\n var walker = this.tail\n if (arguments.length > 1) {\n acc = initial\n } else if (this.tail) {\n walker = this.tail.prev\n acc = this.tail.value\n } else {\n throw new TypeError('Reduce of empty list with no initial value')\n }\n\n for (var i = this.length - 1; walker !== null; i--) {\n acc = fn(acc, walker.value, i)\n walker = walker.prev\n }\n\n return acc\n}\n\nYallist.prototype.toArray = function () {\n var arr = new Array(this.length)\n for (var i = 0, walker = this.head; walker !== null; i++) {\n arr[i] = walker.value\n walker = walker.next\n }\n return arr\n}\n\nYallist.prototype.toArrayReverse = function () {\n var arr = new Array(this.length)\n for (var i = 0, walker = this.tail; walker !== null; i++) {\n arr[i] = walker.value\n walker = walker.prev\n }\n return arr\n}\n\nYallist.prototype.slice = function (from, to) {\n to = to || this.length\n if (to < 0) {\n to += this.length\n }\n from = from || 0\n if (from < 0) {\n from += this.length\n }\n var ret = new Yallist()\n if (to < from || to < 0) {\n return ret\n }\n if (from < 0) {\n from = 0\n }\n if (to > this.length) {\n to = this.length\n }\n for (var i = 0, walker = this.head; walker !== null && i < from; i++) {\n walker = walker.next\n }\n for (; walker !== null && i < to; i++, walker = walker.next) {\n ret.push(walker.value)\n }\n return ret\n}\n\nYallist.prototype.sliceReverse = function (from, to) {\n to = to || this.length\n if (to < 0) {\n to += this.length\n }\n from = from || 0\n if (from < 0) {\n from += this.length\n }\n var ret = new Yallist()\n if (to < from || to < 0) {\n return ret\n }\n if (from < 0) {\n from = 0\n }\n if (to > this.length) {\n to = this.length\n }\n for (var i = this.length, walker = this.tail; walker !== null && i > to; i--) {\n walker = walker.prev\n }\n for (; walker !== null && i > from; i--, walker = walker.prev) {\n ret.push(walker.value)\n }\n return ret\n}\n\nYallist.prototype.splice = function (start, deleteCount /*, ...nodes */) {\n if (start > this.length) {\n start = this.length - 1\n }\n if (start < 0) {\n start = this.length + start;\n }\n\n for (var i = 0, walker = this.head; walker !== null && i < start; i++) {\n walker = walker.next\n }\n\n var ret = []\n for (var i = 0; walker && i < deleteCount; i++) {\n ret.push(walker.value)\n walker = this.removeNode(walker)\n }\n if (walker === null) {\n walker = this.tail\n }\n\n if (walker !== this.head && walker !== this.tail) {\n walker = walker.prev\n }\n\n for (var i = 2; i < arguments.length; i++) {\n walker = insert(this, walker, arguments[i])\n }\n return ret;\n}\n\nYallist.prototype.reverse = function () {\n var head = this.head\n var tail = this.tail\n for (var walker = head; walker !== null; walker = walker.prev) {\n var p = walker.prev\n walker.prev = walker.next\n walker.next = p\n }\n this.head = tail\n this.tail = head\n return this\n}\n\nfunction insert (self, node, value) {\n var inserted = node === self.head ?\n new Node(value, null, node, self) :\n new Node(value, node, node.next, self)\n\n if (inserted.next === null) {\n self.tail = inserted\n }\n if (inserted.prev === null) {\n self.head = inserted\n }\n\n self.length++\n\n return inserted\n}\n\nfunction push (self, item) {\n self.tail = new Node(item, self.tail, null, self)\n if (!self.head) {\n self.head = self.tail\n }\n self.length++\n}\n\nfunction unshift (self, item) {\n self.head = new Node(item, null, self.head, self)\n if (!self.tail) {\n self.tail = self.head\n }\n self.length++\n}\n\nfunction Node (value, prev, next, list) {\n if (!(this instanceof Node)) {\n return new Node(value, prev, next, list)\n }\n\n this.list = list\n this.value = value\n\n if (prev) {\n prev.next = this\n this.prev = prev\n } else {\n this.prev = null\n }\n\n if (next) {\n next.prev = this\n this.next = next\n } else {\n this.next = null\n }\n}\n\ntry {\n // add if support for Symbol.iterator is present\n require('./iterator.js')(Yallist)\n} catch (er) {}\n","(function(){\r\n var crypt = require('crypt'),\r\n utf8 = require('charenc').utf8,\r\n isBuffer = require('is-buffer'),\r\n bin = require('charenc').bin,\r\n\r\n // The core\r\n md5 = function (message, options) {\r\n // Convert to byte array\r\n if (message.constructor == String)\r\n if (options && options.encoding === 'binary')\r\n message = bin.stringToBytes(message);\r\n else\r\n message = utf8.stringToBytes(message);\r\n else if (isBuffer(message))\r\n message = Array.prototype.slice.call(message, 0);\r\n else if (!Array.isArray(message) && message.constructor !== Uint8Array)\r\n message = message.toString();\r\n // else, assume byte array already\r\n\r\n var m = crypt.bytesToWords(message),\r\n l = message.length * 8,\r\n a = 1732584193,\r\n b = -271733879,\r\n c = -1732584194,\r\n d = 271733878;\r\n\r\n // Swap endian\r\n for (var i = 0; i < m.length; i++) {\r\n m[i] = ((m[i] << 8) | (m[i] >>> 24)) & 0x00FF00FF |\r\n ((m[i] << 24) | (m[i] >>> 8)) & 0xFF00FF00;\r\n }\r\n\r\n // Padding\r\n m[l >>> 5] |= 0x80 << (l % 32);\r\n m[(((l + 64) >>> 9) << 4) + 14] = l;\r\n\r\n // Method shortcuts\r\n var FF = md5._ff,\r\n GG = md5._gg,\r\n HH = md5._hh,\r\n II = md5._ii;\r\n\r\n for (var i = 0; i < m.length; i += 16) {\r\n\r\n var aa = a,\r\n bb = b,\r\n cc = c,\r\n dd = d;\r\n\r\n a = FF(a, b, c, d, m[i+ 0], 7, -680876936);\r\n d = FF(d, a, b, c, m[i+ 1], 12, -389564586);\r\n c = FF(c, d, a, b, m[i+ 2], 17, 606105819);\r\n b = FF(b, c, d, a, m[i+ 3], 22, -1044525330);\r\n a = FF(a, b, c, d, m[i+ 4], 7, -176418897);\r\n d = FF(d, a, b, c, m[i+ 5], 12, 1200080426);\r\n c = FF(c, d, a, b, m[i+ 6], 17, -1473231341);\r\n b = FF(b, c, d, a, m[i+ 7], 22, -45705983);\r\n a = FF(a, b, c, d, m[i+ 8], 7, 1770035416);\r\n d = FF(d, a, b, c, m[i+ 9], 12, -1958414417);\r\n c = FF(c, d, a, b, m[i+10], 17, -42063);\r\n b = FF(b, c, d, a, m[i+11], 22, -1990404162);\r\n a = FF(a, b, c, d, m[i+12], 7, 1804603682);\r\n d = FF(d, a, b, c, m[i+13], 12, -40341101);\r\n c = FF(c, d, a, b, m[i+14], 17, -1502002290);\r\n b = FF(b, c, d, a, m[i+15], 22, 1236535329);\r\n\r\n a = GG(a, b, c, d, m[i+ 1], 5, -165796510);\r\n d = GG(d, a, b, c, m[i+ 6], 9, -1069501632);\r\n c = GG(c, d, a, b, m[i+11], 14, 643717713);\r\n b = GG(b, c, d, a, m[i+ 0], 20, -373897302);\r\n a = GG(a, b, c, d, m[i+ 5], 5, -701558691);\r\n d = GG(d, a, b, c, m[i+10], 9, 38016083);\r\n c = GG(c, d, a, b, m[i+15], 14, -660478335);\r\n b = GG(b, c, d, a, m[i+ 4], 20, -405537848);\r\n a = GG(a, b, c, d, m[i+ 9], 5, 568446438);\r\n d = GG(d, a, b, c, m[i+14], 9, -1019803690);\r\n c = GG(c, d, a, b, m[i+ 3], 14, -187363961);\r\n b = GG(b, c, d, a, m[i+ 8], 20, 1163531501);\r\n a = GG(a, b, c, d, m[i+13], 5, -1444681467);\r\n d = GG(d, a, b, c, m[i+ 2], 9, -51403784);\r\n c = GG(c, d, a, b, m[i+ 7], 14, 1735328473);\r\n b = GG(b, c, d, a, m[i+12], 20, -1926607734);\r\n\r\n a = HH(a, b, c, d, m[i+ 5], 4, -378558);\r\n d = HH(d, a, b, c, m[i+ 8], 11, -2022574463);\r\n c = HH(c, d, a, b, m[i+11], 16, 1839030562);\r\n b = HH(b, c, d, a, m[i+14], 23, -35309556);\r\n a = HH(a, b, c, d, m[i+ 1], 4, -1530992060);\r\n d = HH(d, a, b, c, m[i+ 4], 11, 1272893353);\r\n c = HH(c, d, a, b, m[i+ 7], 16, -155497632);\r\n b = HH(b, c, d, a, m[i+10], 23, -1094730640);\r\n a = HH(a, b, c, d, m[i+13], 4, 681279174);\r\n d = HH(d, a, b, c, m[i+ 0], 11, -358537222);\r\n c = HH(c, d, a, b, m[i+ 3], 16, -722521979);\r\n b = HH(b, c, d, a, m[i+ 6], 23, 76029189);\r\n a = HH(a, b, c, d, m[i+ 9], 4, -640364487);\r\n d = HH(d, a, b, c, m[i+12], 11, -421815835);\r\n c = HH(c, d, a, b, m[i+15], 16, 530742520);\r\n b = HH(b, c, d, a, m[i+ 2], 23, -995338651);\r\n\r\n a = II(a, b, c, d, m[i+ 0], 6, -198630844);\r\n d = II(d, a, b, c, m[i+ 7], 10, 1126891415);\r\n c = II(c, d, a, b, m[i+14], 15, -1416354905);\r\n b = II(b, c, d, a, m[i+ 5], 21, -57434055);\r\n a = II(a, b, c, d, m[i+12], 6, 1700485571);\r\n d = II(d, a, b, c, m[i+ 3], 10, -1894986606);\r\n c = II(c, d, a, b, m[i+10], 15, -1051523);\r\n b = II(b, c, d, a, m[i+ 1], 21, -2054922799);\r\n a = II(a, b, c, d, m[i+ 8], 6, 1873313359);\r\n d = II(d, a, b, c, m[i+15], 10, -30611744);\r\n c = II(c, d, a, b, m[i+ 6], 15, -1560198380);\r\n b = II(b, c, d, a, m[i+13], 21, 1309151649);\r\n a = II(a, b, c, d, m[i+ 4], 6, -145523070);\r\n d = II(d, a, b, c, m[i+11], 10, -1120210379);\r\n c = II(c, d, a, b, m[i+ 2], 15, 718787259);\r\n b = II(b, c, d, a, m[i+ 9], 21, -343485551);\r\n\r\n a = (a + aa) >>> 0;\r\n b = (b + bb) >>> 0;\r\n c = (c + cc) >>> 0;\r\n d = (d + dd) >>> 0;\r\n }\r\n\r\n return crypt.endian([a, b, c, d]);\r\n };\r\n\r\n // Auxiliary functions\r\n md5._ff = function (a, b, c, d, x, s, t) {\r\n var n = a + (b & c | ~b & d) + (x >>> 0) + t;\r\n return ((n << s) | (n >>> (32 - s))) + b;\r\n };\r\n md5._gg = function (a, b, c, d, x, s, t) {\r\n var n = a + (b & d | c & ~d) + (x >>> 0) + t;\r\n return ((n << s) | (n >>> (32 - s))) + b;\r\n };\r\n md5._hh = function (a, b, c, d, x, s, t) {\r\n var n = a + (b ^ c ^ d) + (x >>> 0) + t;\r\n return ((n << s) | (n >>> (32 - s))) + b;\r\n };\r\n md5._ii = function (a, b, c, d, x, s, t) {\r\n var n = a + (c ^ (b | ~d)) + (x >>> 0) + t;\r\n return ((n << s) | (n >>> (32 - s))) + b;\r\n };\r\n\r\n // Package private blocksize\r\n md5._blocksize = 16;\r\n md5._digestsize = 16;\r\n\r\n module.exports = function (message, options) {\r\n if (message === undefined || message === null)\r\n throw new Error('Illegal argument ' + message);\r\n\r\n var digestbytes = crypt.wordsToBytes(md5(message, options));\r\n return options && options.asBytes ? digestbytes :\r\n options && options.asString ? bin.bytesToString(digestbytes) :\r\n crypt.bytesToHex(digestbytes);\r\n };\r\n\r\n})();\r\n","var simpleIsEqual = function simpleIsEqual(a, b) {\n return a === b;\n};\n\nfunction index (resultFn, isEqual) {\n if (isEqual === void 0) {\n isEqual = simpleIsEqual;\n }\n\n var lastThis;\n var lastArgs = [];\n var lastResult;\n var calledOnce = false;\n\n var isNewArgEqualToLast = function isNewArgEqualToLast(newArg, index) {\n return isEqual(newArg, lastArgs[index], index);\n };\n\n var result = function result() {\n for (var _len = arguments.length, newArgs = new Array(_len), _key = 0; _key < _len; _key++) {\n newArgs[_key] = arguments[_key];\n }\n\n if (calledOnce && lastThis === this && newArgs.length === lastArgs.length && newArgs.every(isNewArgEqualToLast)) {\n return lastResult;\n }\n\n lastResult = resultFn.apply(this, newArgs);\n calledOnce = true;\n lastThis = this;\n lastArgs = newArgs;\n return lastResult;\n };\n\n return result;\n}\n\nexport default index;\n","(function(){\n var _global = this;\n\n /**\n * JS Implementation of MurmurHash2\n *\n * @author <a href=\"mailto:gary.court@gmail.com\">Gary Court</a>\n * @see http://github.com/garycourt/murmurhash-js\n * @author <a href=\"mailto:aappleby@gmail.com\">Austin Appleby</a>\n * @see http://sites.google.com/site/murmurhash/\n *\n * @param {string} str ASCII only\n * @param {number} seed Positive integer only\n * @return {number} 32-bit positive integer hash\n */\n function MurmurHashV2(str, seed) {\n var\n l = str.length,\n h = seed ^ l,\n i = 0,\n k;\n\n while (l >= 4) {\n k =\n ((str.charCodeAt(i) & 0xff)) |\n ((str.charCodeAt(++i) & 0xff) << 8) |\n ((str.charCodeAt(++i) & 0xff) << 16) |\n ((str.charCodeAt(++i) & 0xff) << 24);\n\n k = (((k & 0xffff) * 0x5bd1e995) + ((((k >>> 16) * 0x5bd1e995) & 0xffff) << 16));\n k ^= k >>> 24;\n k = (((k & 0xffff) * 0x5bd1e995) + ((((k >>> 16) * 0x5bd1e995) & 0xffff) << 16));\n\n h = (((h & 0xffff) * 0x5bd1e995) + ((((h >>> 16) * 0x5bd1e995) & 0xffff) << 16)) ^ k;\n\n l -= 4;\n ++i;\n }\n\n switch (l) {\n case 3: h ^= (str.charCodeAt(i + 2) & 0xff) << 16;\n case 2: h ^= (str.charCodeAt(i + 1) & 0xff) << 8;\n case 1: h ^= (str.charCodeAt(i) & 0xff);\n h = (((h & 0xffff) * 0x5bd1e995) + ((((h >>> 16) * 0x5bd1e995) & 0xffff) << 16));\n }\n\n h ^= h >>> 13;\n h = (((h & 0xffff) * 0x5bd1e995) + ((((h >>> 16) * 0x5bd1e995) & 0xffff) << 16));\n h ^= h >>> 15;\n\n return h >>> 0;\n };\n\n /**\n * JS Implementation of MurmurHash3 (r136) (as of May 20, 2011)\n *\n * @author <a href=\"mailto:gary.court@gmail.com\">Gary Court</a>\n * @see http://github.com/garycourt/murmurhash-js\n * @author <a href=\"mailto:aappleby@gmail.com\">Austin Appleby</a>\n * @see http://sites.google.com/site/murmurhash/\n *\n * @param {string} key ASCII only\n * @param {number} seed Positive integer only\n * @return {number} 32-bit positive integer hash\n */\n function MurmurHashV3(key, seed) {\n var remainder, bytes, h1, h1b, c1, c1b, c2, c2b, k1, i;\n\n remainder = key.length & 3; // key.length % 4\n bytes = key.length - remainder;\n h1 = seed;\n c1 = 0xcc9e2d51;\n c2 = 0x1b873593;\n i = 0;\n\n while (i < bytes) {\n k1 =\n ((key.charCodeAt(i) & 0xff)) |\n ((key.charCodeAt(++i) & 0xff) << 8) |\n ((key.charCodeAt(++i) & 0xff) << 16) |\n ((key.charCodeAt(++i) & 0xff) << 24);\n ++i;\n\n k1 = ((((k1 & 0xffff) * c1) + ((((k1 >>> 16) * c1) & 0xffff) << 16))) & 0xffffffff;\n k1 = (k1 << 15) | (k1 >>> 17);\n k1 = ((((k1 & 0xffff) * c2) + ((((k1 >>> 16) * c2) & 0xffff) << 16))) & 0xffffffff;\n\n h1 ^= k1;\n h1 = (h1 << 13) | (h1 >>> 19);\n h1b = ((((h1 & 0xffff) * 5) + ((((h1 >>> 16) * 5) & 0xffff) << 16))) & 0xffffffff;\n h1 = (((h1b & 0xffff) + 0x6b64) + ((((h1b >>> 16) + 0xe654) & 0xffff) << 16));\n }\n\n k1 = 0;\n\n switch (remainder) {\n case 3: k1 ^= (key.charCodeAt(i + 2) & 0xff) << 16;\n case 2: k1 ^= (key.charCodeAt(i + 1) & 0xff) << 8;\n case 1: k1 ^= (key.charCodeAt(i) & 0xff);\n\n k1 = (((k1 & 0xffff) * c1) + ((((k1 >>> 16) * c1) & 0xffff) << 16)) & 0xffffffff;\n k1 = (k1 << 15) | (k1 >>> 17);\n k1 = (((k1 & 0xffff) * c2) + ((((k1 >>> 16) * c2) & 0xffff) << 16)) & 0xffffffff;\n h1 ^= k1;\n }\n\n h1 ^= key.length;\n\n h1 ^= h1 >>> 16;\n h1 = (((h1 & 0xffff) * 0x85ebca6b) + ((((h1 >>> 16) * 0x85ebca6b) & 0xffff) << 16)) & 0xffffffff;\n h1 ^= h1 >>> 13;\n h1 = ((((h1 & 0xffff) * 0xc2b2ae35) + ((((h1 >>> 16) * 0xc2b2ae35) & 0xffff) << 16))) & 0xffffffff;\n h1 ^= h1 >>> 16;\n\n return h1 >>> 0;\n }\n\n var murmur = MurmurHashV3;\n murmur.v2 = MurmurHashV2;\n murmur.v3 = MurmurHashV3;\n\n if (typeof(module) != 'undefined') {\n module.exports = murmur;\n } else {\n var _previousRoot = _global.murmur;\n murmur.noConflict = function() {\n _global.murmur = _previousRoot;\n return murmur;\n }\n _global.murmur = murmur;\n }\n}());\n","/*\nobject-assign\n(c) Sindre Sorhus\n@license MIT\n*/\n\n'use strict';\n/* eslint-disable no-unused-vars */\nvar getOwnPropertySymbols = Object.getOwnPropertySymbols;\nvar hasOwnProperty = Object.prototype.hasOwnProperty;\nvar propIsEnumerable = Object.prototype.propertyIsEnumerable;\n\nfunction toObject(val) {\n\tif (val === null || val === undefined) {\n\t\tthrow new TypeError('Object.assign cannot be called with null or undefined');\n\t}\n\n\treturn Object(val);\n}\n\nfunction shouldUseNative() {\n\ttry {\n\t\tif (!Object.assign) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// Detect buggy property enumeration order in older V8 versions.\n\n\t\t// https://bugs.chromium.org/p/v8/issues/detail?id=4118\n\t\tvar test1 = new String('abc'); // eslint-disable-line no-new-wrappers\n\t\ttest1[5] = 'de';\n\t\tif (Object.getOwnPropertyNames(test1)[0] === '5') {\n\t\t\treturn false;\n\t\t}\n\n\t\t// https://bugs.chromium.org/p/v8/issues/detail?id=3056\n\t\tvar test2 = {};\n\t\tfor (var i = 0; i < 10; i++) {\n\t\t\ttest2['_' + String.fromCharCode(i)] = i;\n\t\t}\n\t\tvar order2 = Object.getOwnPropertyNames(test2).map(function (n) {\n\t\t\treturn test2[n];\n\t\t});\n\t\tif (order2.join('') !== '0123456789') {\n\t\t\treturn false;\n\t\t}\n\n\t\t// https://bugs.chromium.org/p/v8/issues/detail?id=3056\n\t\tvar test3 = {};\n\t\t'abcdefghijklmnopqrst'.split('').forEach(function (letter) {\n\t\t\ttest3[letter] = letter;\n\t\t});\n\t\tif (Object.keys(Object.assign({}, test3)).join('') !==\n\t\t\t\t'abcdefghijklmnopqrst') {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t} catch (err) {\n\t\t// We don't expect any of the above to throw, but better to be safe.\n\t\treturn false;\n\t}\n}\n\nmodule.exports = shouldUseNative() ? Object.assign : function (target, source) {\n\tvar from;\n\tvar to = toObject(target);\n\tvar symbols;\n\n\tfor (var s = 1; s < arguments.length; s++) {\n\t\tfrom = Object(arguments[s]);\n\n\t\tfor (var key in from) {\n\t\t\tif (hasOwnProperty.call(from, key)) {\n\t\t\t\tto[key] = from[key];\n\t\t\t}\n\t\t}\n\n\t\tif (getOwnPropertySymbols) {\n\t\t\tsymbols = getOwnPropertySymbols(from);\n\t\t\tfor (var i = 0; i < symbols.length; i++) {\n\t\t\t\tif (propIsEnumerable.call(from, symbols[i])) {\n\t\t\t\t\tto[symbols[i]] = from[symbols[i]];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn to;\n};\n","var hasMap = typeof Map === 'function' && Map.prototype;\nvar mapSizeDescriptor = Object.getOwnPropertyDescriptor && hasMap ? Object.getOwnPropertyDescriptor(Map.prototype, 'size') : null;\nvar mapSize = hasMap && mapSizeDescriptor && typeof mapSizeDescriptor.get === 'function' ? mapSizeDescriptor.get : null;\nvar mapForEach = hasMap && Map.prototype.forEach;\nvar hasSet = typeof Set === 'function' && Set.prototype;\nvar setSizeDescriptor = Object.getOwnPropertyDescriptor && hasSet ? Object.getOwnPropertyDescriptor(Set.prototype, 'size') : null;\nvar setSize = hasSet && setSizeDescriptor && typeof setSizeDescriptor.get === 'function' ? setSizeDescriptor.get : null;\nvar setForEach = hasSet && Set.prototype.forEach;\nvar hasWeakMap = typeof WeakMap === 'function' && WeakMap.prototype;\nvar weakMapHas = hasWeakMap ? WeakMap.prototype.has : null;\nvar hasWeakSet = typeof WeakSet === 'function' && WeakSet.prototype;\nvar weakSetHas = hasWeakSet ? WeakSet.prototype.has : null;\nvar hasWeakRef = typeof WeakRef === 'function' && WeakRef.prototype;\nvar weakRefDeref = hasWeakRef ? WeakRef.prototype.deref : null;\nvar booleanValueOf = Boolean.prototype.valueOf;\nvar objectToString = Object.prototype.toString;\nvar functionToString = Function.prototype.toString;\nvar $match = String.prototype.match;\nvar $slice = String.prototype.slice;\nvar $replace = String.prototype.replace;\nvar $toUpperCase = String.prototype.toUpperCase;\nvar $toLowerCase = String.prototype.toLowerCase;\nvar $test = RegExp.prototype.test;\nvar $concat = Array.prototype.concat;\nvar $join = Array.prototype.join;\nvar $arrSlice = Array.prototype.slice;\nvar $floor = Math.floor;\nvar bigIntValueOf = typeof BigInt === 'function' ? BigInt.prototype.valueOf : null;\nvar gOPS = Object.getOwnPropertySymbols;\nvar symToString = typeof Symbol === 'function' && typeof Symbol.iterator === 'symbol' ? Symbol.prototype.toString : null;\nvar hasShammedSymbols = typeof Symbol === 'function' && typeof Symbol.iterator === 'object';\n// ie, `has-tostringtag/shams\nvar toStringTag = typeof Symbol === 'function' && Symbol.toStringTag && (typeof Symbol.toStringTag === hasShammedSymbols ? 'object' : 'symbol')\n ? Symbol.toStringTag\n : null;\nvar isEnumerable = Object.prototype.propertyIsEnumerable;\n\nvar gPO = (typeof Reflect === 'function' ? Reflect.getPrototypeOf : Object.getPrototypeOf) || (\n [].__proto__ === Array.prototype // eslint-disable-line no-proto\n ? function (O) {\n return O.__proto__; // eslint-disable-line no-proto\n }\n : null\n);\n\nfunction addNumericSeparator(num, str) {\n if (\n num === Infinity\n || num === -Infinity\n || num !== num\n || (num && num > -1000 && num < 1000)\n || $test.call(/e/, str)\n ) {\n return str;\n }\n var sepRegex = /[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;\n if (typeof num === 'number') {\n var int = num < 0 ? -$floor(-num) : $floor(num); // trunc(num)\n if (int !== num) {\n var intStr = String(int);\n var dec = $slice.call(str, intStr.length + 1);\n return $replace.call(intStr, sepRegex, '$&_') + '.' + $replace.call($replace.call(dec, /([0-9]{3})/g, '$&_'), /_$/, '');\n }\n }\n return $replace.call(str, sepRegex, '$&_');\n}\n\nvar inspectCustom = require('./util.inspect').custom;\nvar inspectSymbol = inspectCustom && isSymbol(inspectCustom) ? inspectCustom : null;\n\nmodule.exports = function inspect_(obj, options, depth, seen) {\n var opts = options || {};\n\n if (has(opts, 'quoteStyle') && (opts.quoteStyle !== 'single' && opts.quoteStyle !== 'double')) {\n throw new TypeError('option \"quoteStyle\" must be \"single\" or \"double\"');\n }\n if (\n has(opts, 'maxStringLength') && (typeof opts.maxStringLength === 'number'\n ? opts.maxStringLength < 0 && opts.maxStringLength !== Infinity\n : opts.maxStringLength !== null\n )\n ) {\n throw new TypeError('option \"maxStringLength\", if provided, must be a positive integer, Infinity, or `null`');\n }\n var customInspect = has(opts, 'customInspect') ? opts.customInspect : true;\n if (typeof customInspect !== 'boolean' && customInspect !== 'symbol') {\n throw new TypeError('option \"customInspect\", if provided, must be `true`, `false`, or `\\'symbol\\'`');\n }\n\n if (\n has(opts, 'indent')\n && opts.indent !== null\n && opts.indent !== '\\t'\n && !(parseInt(opts.indent, 10) === opts.indent && opts.indent > 0)\n ) {\n throw new TypeError('option \"indent\" must be \"\\\\t\", an integer > 0, or `null`');\n }\n if (has(opts, 'numericSeparator') && typeof opts.numericSeparator !== 'boolean') {\n throw new TypeError('option \"numericSeparator\", if provided, must be `true` or `false`');\n }\n var numericSeparator = opts.numericSeparator;\n\n if (typeof obj === 'undefined') {\n return 'undefined';\n }\n if (obj === null) {\n return 'null';\n }\n if (typeof obj === 'boolean') {\n return obj ? 'true' : 'false';\n }\n\n if (typeof obj === 'string') {\n return inspectString(obj, opts);\n }\n if (typeof obj === 'number') {\n if (obj === 0) {\n return Infinity / obj > 0 ? '0' : '-0';\n }\n var str = String(obj);\n return numericSeparator ? addNumericSeparator(obj, str) : str;\n }\n if (typeof obj === 'bigint') {\n var bigIntStr = String(obj) + 'n';\n return numericSeparator ? addNumericSeparator(obj, bigIntStr) : bigIntStr;\n }\n\n var maxDepth = typeof opts.depth === 'undefined' ? 5 : opts.depth;\n if (typeof depth === 'undefined') { depth = 0; }\n if (depth >= maxDepth && maxDepth > 0 && typeof obj === 'object') {\n return isArray(obj) ? '[Array]' : '[Object]';\n }\n\n var indent = getIndent(opts, depth);\n\n if (typeof seen === 'undefined') {\n seen = [];\n } else if (indexOf(seen, obj) >= 0) {\n return '[Circular]';\n }\n\n function inspect(value, from, noIndent) {\n if (from) {\n seen = $arrSlice.call(seen);\n seen.push(from);\n }\n if (noIndent) {\n var newOpts = {\n depth: opts.depth\n };\n if (has(opts, 'quoteStyle')) {\n newOpts.quoteStyle = opts.quoteStyle;\n }\n return inspect_(value, newOpts, depth + 1, seen);\n }\n return inspect_(value, opts, depth + 1, seen);\n }\n\n if (typeof obj === 'function') {\n var name = nameOf(obj);\n var keys = arrObjKeys(obj, inspect);\n return '[Function' + (name ? ': ' + name : ' (anonymous)') + ']' + (keys.length > 0 ? ' { ' + $join.call(keys, ', ') + ' }' : '');\n }\n if (isSymbol(obj)) {\n var symString = hasShammedSymbols ? $replace.call(String(obj), /^(Symbol\\(.*\\))_[^)]*$/, '$1') : symToString.call(obj);\n return typeof obj === 'object' && !hasShammedSymbols ? markBoxed(symString) : symString;\n }\n if (isElement(obj)) {\n var s = '<' + $toLowerCase.call(String(obj.nodeName));\n var attrs = obj.attributes || [];\n for (var i = 0; i < attrs.length; i++) {\n s += ' ' + attrs[i].name + '=' + wrapQuotes(quote(attrs[i].value), 'double', opts);\n }\n s += '>';\n if (obj.childNodes && obj.childNodes.length) { s += '...'; }\n s += '</' + $toLowerCase.call(String(obj.nodeName)) + '>';\n return s;\n }\n if (isArray(obj)) {\n if (obj.length === 0) { return '[]'; }\n var xs = arrObjKeys(obj, inspect);\n if (indent && !singleLineValues(xs)) {\n return '[' + indentedJoin(xs, indent) + ']';\n }\n return '[ ' + $join.call(xs, ', ') + ' ]';\n }\n if (isError(obj)) {\n var parts = arrObjKeys(obj, inspect);\n if ('cause' in obj && !isEnumerable.call(obj, 'cause')) {\n return '{ [' + String(obj) + '] ' + $join.call($concat.call('[cause]: ' + inspect(obj.cause), parts), ', ') + ' }';\n }\n if (parts.length === 0) { return '[' + String(obj) + ']'; }\n return '{ [' + String(obj) + '] ' + $join.call(parts, ', ') + ' }';\n }\n if (typeof obj === 'object' && customInspect) {\n if (inspectSymbol && typeof obj[inspectSymbol] === 'function') {\n return obj[inspectSymbol]();\n } else if (customInspect !== 'symbol' && typeof obj.inspect === 'function') {\n return obj.inspect();\n }\n }\n if (isMap(obj)) {\n var mapParts = [];\n mapForEach.call(obj, function (value, key) {\n mapParts.push(inspect(key, obj, true) + ' => ' + inspect(value, obj));\n });\n return collectionOf('Map', mapSize.call(obj), mapParts, indent);\n }\n if (isSet(obj)) {\n var setParts = [];\n setForEach.call(obj, function (value) {\n setParts.push(inspect(value, obj));\n });\n return collectionOf('Set', setSize.call(obj), setParts, indent);\n }\n if (isWeakMap(obj)) {\n return weakCollectionOf('WeakMap');\n }\n if (isWeakSet(obj)) {\n return weakCollectionOf('WeakSet');\n }\n if (isWeakRef(obj)) {\n return weakCollectionOf('WeakRef');\n }\n if (isNumber(obj)) {\n return markBoxed(inspect(Number(obj)));\n }\n if (isBigInt(obj)) {\n return markBoxed(inspect(bigIntValueOf.call(obj)));\n }\n if (isBoolean(obj)) {\n return markBoxed(booleanValueOf.call(obj));\n }\n if (isString(obj)) {\n return markBoxed(inspect(String(obj)));\n }\n if (!isDate(obj) && !isRegExp(obj)) {\n var ys = arrObjKeys(obj, inspect);\n var isPlainObject = gPO ? gPO(obj) === Object.prototype : obj instanceof Object || obj.constructor === Object;\n var protoTag = obj instanceof Object ? '' : 'null prototype';\n var stringTag = !isPlainObject && toStringTag && Object(obj) === obj && toStringTag in obj ? $slice.call(toStr(obj), 8, -1) : protoTag ? 'Object' : '';\n var constructorTag = isPlainObject || typeof obj.constructor !== 'function' ? '' : obj.constructor.name ? obj.constructor.name + ' ' : '';\n var tag = constructorTag + (stringTag || protoTag ? '[' + $join.call($concat.call([], stringTag || [], protoTag || []), ': ') + '] ' : '');\n if (ys.length === 0) { return tag + '{}'; }\n if (indent) {\n return tag + '{' + indentedJoin(ys, indent) + '}';\n }\n return tag + '{ ' + $join.call(ys, ', ') + ' }';\n }\n return String(obj);\n};\n\nfunction wrapQuotes(s, defaultStyle, opts) {\n var quoteChar = (opts.quoteStyle || defaultStyle) === 'double' ? '\"' : \"'\";\n return quoteChar + s + quoteChar;\n}\n\nfunction quote(s) {\n return $replace.call(String(s), /\"/g, '"');\n}\n\nfunction isArray(obj) { return toStr(obj) === '[object Array]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }\nfunction isDate(obj) { return toStr(obj) === '[object Date]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }\nfunction isRegExp(obj) { return toStr(obj) === '[object RegExp]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }\nfunction isError(obj) { return toStr(obj) === '[object Error]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }\nfunction isString(obj) { return toStr(obj) === '[object String]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }\nfunction isNumber(obj) { return toStr(obj) === '[object Number]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }\nfunction isBoolean(obj) { return toStr(obj) === '[object Boolean]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }\n\n// Symbol and BigInt do have Symbol.toStringTag by spec, so that can't be used to eliminate false positives\nfunction isSymbol(obj) {\n if (hasShammedSymbols) {\n return obj && typeof obj === 'object' && obj instanceof Symbol;\n }\n if (typeof obj === 'symbol') {\n return true;\n }\n if (!obj || typeof obj !== 'object' || !symToString) {\n return false;\n }\n try {\n symToString.call(obj);\n return true;\n } catch (e) {}\n return false;\n}\n\nfunction isBigInt(obj) {\n if (!obj || typeof obj !== 'object' || !bigIntValueOf) {\n return false;\n }\n try {\n bigIntValueOf.call(obj);\n return true;\n } catch (e) {}\n return false;\n}\n\nvar hasOwn = Object.prototype.hasOwnProperty || function (key) { return key in this; };\nfunction has(obj, key) {\n return hasOwn.call(obj, key);\n}\n\nfunction toStr(obj) {\n return objectToString.call(obj);\n}\n\nfunction nameOf(f) {\n if (f.name) { return f.name; }\n var m = $match.call(functionToString.call(f), /^function\\s*([\\w$]+)/);\n if (m) { return m[1]; }\n return null;\n}\n\nfunction indexOf(xs, x) {\n if (xs.indexOf) { return xs.indexOf(x); }\n for (var i = 0, l = xs.length; i < l; i++) {\n if (xs[i] === x) { return i; }\n }\n return -1;\n}\n\nfunction isMap(x) {\n if (!mapSize || !x || typeof x !== 'object') {\n return false;\n }\n try {\n mapSize.call(x);\n try {\n setSize.call(x);\n } catch (s) {\n return true;\n }\n return x instanceof Map; // core-js workaround, pre-v2.5.0\n } catch (e) {}\n return false;\n}\n\nfunction isWeakMap(x) {\n if (!weakMapHas || !x || typeof x !== 'object') {\n return false;\n }\n try {\n weakMapHas.call(x, weakMapHas);\n try {\n weakSetHas.call(x, weakSetHas);\n } catch (s) {\n return true;\n }\n return x instanceof WeakMap; // core-js workaround, pre-v2.5.0\n } catch (e) {}\n return false;\n}\n\nfunction isWeakRef(x) {\n if (!weakRefDeref || !x || typeof x !== 'object') {\n return false;\n }\n try {\n weakRefDeref.call(x);\n return true;\n } catch (e) {}\n return false;\n}\n\nfunction isSet(x) {\n if (!setSize || !x || typeof x !== 'object') {\n return false;\n }\n try {\n setSize.call(x);\n try {\n mapSize.call(x);\n } catch (m) {\n return true;\n }\n return x instanceof Set; // core-js workaround, pre-v2.5.0\n } catch (e) {}\n return false;\n}\n\nfunction isWeakSet(x) {\n if (!weakSetHas || !x || typeof x !== 'object') {\n return false;\n }\n try {\n weakSetHas.call(x, weakSetHas);\n try {\n weakMapHas.call(x, weakMapHas);\n } catch (s) {\n return true;\n }\n return x instanceof WeakSet; // core-js workaround, pre-v2.5.0\n } catch (e) {}\n return false;\n}\n\nfunction isElement(x) {\n if (!x || typeof x !== 'object') { return false; }\n if (typeof HTMLElement !== 'undefined' && x instanceof HTMLElement) {\n return true;\n }\n return typeof x.nodeName === 'string' && typeof x.getAttribute === 'function';\n}\n\nfunction inspectString(str, opts) {\n if (str.length > opts.maxStringLength) {\n var remaining = str.length - opts.maxStringLength;\n var trailer = '... ' + remaining + ' more character' + (remaining > 1 ? 's' : '');\n return inspectString($slice.call(str, 0, opts.maxStringLength), opts) + trailer;\n }\n // eslint-disable-next-line no-control-regex\n var s = $replace.call($replace.call(str, /(['\\\\])/g, '\\\\$1'), /[\\x00-\\x1f]/g, lowbyte);\n return wrapQuotes(s, 'single', opts);\n}\n\nfunction lowbyte(c) {\n var n = c.charCodeAt(0);\n var x = {\n 8: 'b',\n 9: 't',\n 10: 'n',\n 12: 'f',\n 13: 'r'\n }[n];\n if (x) { return '\\\\' + x; }\n return '\\\\x' + (n < 0x10 ? '0' : '') + $toUpperCase.call(n.toString(16));\n}\n\nfunction markBoxed(str) {\n return 'Object(' + str + ')';\n}\n\nfunction weakCollectionOf(type) {\n return type + ' { ? }';\n}\n\nfunction collectionOf(type, size, entries, indent) {\n var joinedEntries = indent ? indentedJoin(entries, indent) : $join.call(entries, ', ');\n return type + ' (' + size + ') {' + joinedEntries + '}';\n}\n\nfunction singleLineValues(xs) {\n for (var i = 0; i < xs.length; i++) {\n if (indexOf(xs[i], '\\n') >= 0) {\n return false;\n }\n }\n return true;\n}\n\nfunction getIndent(opts, depth) {\n var baseIndent;\n if (opts.indent === '\\t') {\n baseIndent = '\\t';\n } else if (typeof opts.indent === 'number' && opts.indent > 0) {\n baseIndent = $join.call(Array(opts.indent + 1), ' ');\n } else {\n return null;\n }\n return {\n base: baseIndent,\n prev: $join.call(Array(depth + 1), baseIndent)\n };\n}\n\nfunction indentedJoin(xs, indent) {\n if (xs.length === 0) { return ''; }\n var lineJoiner = '\\n' + indent.prev + indent.base;\n return lineJoiner + $join.call(xs, ',' + lineJoiner) + '\\n' + indent.prev;\n}\n\nfunction arrObjKeys(obj, inspect) {\n var isArr = isArray(obj);\n var xs = [];\n if (isArr) {\n xs.length = obj.length;\n for (var i = 0; i < obj.length; i++) {\n xs[i] = has(obj, i) ? inspect(obj[i], obj) : '';\n }\n }\n var syms = typeof gOPS === 'function' ? gOPS(obj) : [];\n var symMap;\n if (hasShammedSymbols) {\n symMap = {};\n for (var k = 0; k < syms.length; k++) {\n symMap['$' + syms[k]] = syms[k];\n }\n }\n\n for (var key in obj) { // eslint-disable-line no-restricted-syntax\n if (!has(obj, key)) { continue; } // eslint-disable-line no-restricted-syntax, no-continue\n if (isArr && String(Number(key)) === key && key < obj.length) { continue; } // eslint-disable-line no-restricted-syntax, no-continue\n if (hasShammedSymbols && symMap['$' + key] instanceof Symbol) {\n // this is to prevent shammed Symbols, which are stored as strings, from being included in the string key section\n continue; // eslint-disable-line no-restricted-syntax, no-continue\n } else if ($test.call(/[^\\w$]/, key)) {\n xs.push(inspect(key, obj) + ': ' + inspect(obj[key], obj));\n } else {\n xs.push(key + ': ' + inspect(obj[key], obj));\n }\n }\n if (typeof gOPS === 'function') {\n for (var j = 0; j < syms.length; j++) {\n if (isEnumerable.call(obj, syms[j])) {\n xs.push('[' + inspect(syms[j]) + ']: ' + inspect(obj[syms[j]], obj));\n }\n }\n }\n return xs;\n}\n","module.exports = require('util').inspect;\n","'use strict';\n\nvar numberIsNaN = function (value) {\n\treturn value !== value;\n};\n\nmodule.exports = function is(a, b) {\n\tif (a === 0 && b === 0) {\n\t\treturn 1 / a === 1 / b;\n\t}\n\tif (a === b) {\n\t\treturn true;\n\t}\n\tif (numberIsNaN(a) && numberIsNaN(b)) {\n\t\treturn true;\n\t}\n\treturn false;\n};\n\n","'use strict';\n\nvar define = require('define-properties');\nvar callBind = require('call-bind');\n\nvar implementation = require('./implementation');\nvar getPolyfill = require('./polyfill');\nvar shim = require('./shim');\n\nvar polyfill = callBind(getPolyfill(), Object);\n\ndefine(polyfill, {\n\tgetPolyfill: getPolyfill,\n\timplementation: implementation,\n\tshim: shim\n});\n\nmodule.exports = polyfill;\n","'use strict';\n\nvar implementation = require('./implementation');\n\nmodule.exports = function getPolyfill() {\n\treturn typeof Object.is === 'function' ? Object.is : implementation;\n};\n","'use strict';\n\nvar getPolyfill = require('./polyfill');\nvar define = require('define-properties');\n\nmodule.exports = function shimObjectIs() {\n\tvar polyfill = getPolyfill();\n\tdefine(Object, { is: polyfill }, {\n\t\tis: function testObjectIs() {\n\t\t\treturn Object.is !== polyfill;\n\t\t}\n\t});\n\treturn polyfill;\n};\n","'use strict';\n\nvar keysShim;\nif (!Object.keys) {\n\t// modified from https://github.com/es-shims/es5-shim\n\tvar has = Object.prototype.hasOwnProperty;\n\tvar toStr = Object.prototype.toString;\n\tvar isArgs = require('./isArguments'); // eslint-disable-line global-require\n\tvar isEnumerable = Object.prototype.propertyIsEnumerable;\n\tvar hasDontEnumBug = !isEnumerable.call({ toString: null }, 'toString');\n\tvar hasProtoEnumBug = isEnumerable.call(function () {}, 'prototype');\n\tvar dontEnums = [\n\t\t'toString',\n\t\t'toLocaleString',\n\t\t'valueOf',\n\t\t'hasOwnProperty',\n\t\t'isPrototypeOf',\n\t\t'propertyIsEnumerable',\n\t\t'constructor'\n\t];\n\tvar equalsConstructorPrototype = function (o) {\n\t\tvar ctor = o.constructor;\n\t\treturn ctor && ctor.prototype === o;\n\t};\n\tvar excludedKeys = {\n\t\t$applicationCache: true,\n\t\t$console: true,\n\t\t$external: true,\n\t\t$frame: true,\n\t\t$frameElement: true,\n\t\t$frames: true,\n\t\t$innerHeight: true,\n\t\t$innerWidth: true,\n\t\t$onmozfullscreenchange: true,\n\t\t$onmozfullscreenerror: true,\n\t\t$outerHeight: true,\n\t\t$outerWidth: true,\n\t\t$pageXOffset: true,\n\t\t$pageYOffset: true,\n\t\t$parent: true,\n\t\t$scrollLeft: true,\n\t\t$scrollTop: true,\n\t\t$scrollX: true,\n\t\t$scrollY: true,\n\t\t$self: true,\n\t\t$webkitIndexedDB: true,\n\t\t$webkitStorageInfo: true,\n\t\t$window: true\n\t};\n\tvar hasAutomationEqualityBug = (function () {\n\t\t/* global window */\n\t\tif (typeof window === 'undefined') { return false; }\n\t\tfor (var k in window) {\n\t\t\ttry {\n\t\t\t\tif (!excludedKeys['$' + k] && has.call(window, k) && window[k] !== null && typeof window[k] === 'object') {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tequalsConstructorPrototype(window[k]);\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} catch (e) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}());\n\tvar equalsConstructorPrototypeIfNotBuggy = function (o) {\n\t\t/* global window */\n\t\tif (typeof window === 'undefined' || !hasAutomationEqualityBug) {\n\t\t\treturn equalsConstructorPrototype(o);\n\t\t}\n\t\ttry {\n\t\t\treturn equalsConstructorPrototype(o);\n\t\t} catch (e) {\n\t\t\treturn false;\n\t\t}\n\t};\n\n\tkeysShim = function keys(object) {\n\t\tvar isObject = object !== null && typeof object === 'object';\n\t\tvar isFunction = toStr.call(object) === '[object Function]';\n\t\tvar isArguments = isArgs(object);\n\t\tvar isString = isObject && toStr.call(object) === '[object String]';\n\t\tvar theKeys = [];\n\n\t\tif (!isObject && !isFunction && !isArguments) {\n\t\t\tthrow new TypeError('Object.keys called on a non-object');\n\t\t}\n\n\t\tvar skipProto = hasProtoEnumBug && isFunction;\n\t\tif (isString && object.length > 0 && !has.call(object, 0)) {\n\t\t\tfor (var i = 0; i < object.length; ++i) {\n\t\t\t\ttheKeys.push(String(i));\n\t\t\t}\n\t\t}\n\n\t\tif (isArguments && object.length > 0) {\n\t\t\tfor (var j = 0; j < object.length; ++j) {\n\t\t\t\ttheKeys.push(String(j));\n\t\t\t}\n\t\t} else {\n\t\t\tfor (var name in object) {\n\t\t\t\tif (!(skipProto && name === 'prototype') && has.call(object, name)) {\n\t\t\t\t\ttheKeys.push(String(name));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (hasDontEnumBug) {\n\t\t\tvar skipConstructor = equalsConstructorPrototypeIfNotBuggy(object);\n\n\t\t\tfor (var k = 0; k < dontEnums.length; ++k) {\n\t\t\t\tif (!(skipConstructor && dontEnums[k] === 'constructor') && has.call(object, dontEnums[k])) {\n\t\t\t\t\ttheKeys.push(dontEnums[k]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn theKeys;\n\t};\n}\nmodule.exports = keysShim;\n","'use strict';\n\nvar slice = Array.prototype.slice;\nvar isArgs = require('./isArguments');\n\nvar origKeys = Object.keys;\nvar keysShim = origKeys ? function keys(o) { return origKeys(o); } : require('./implementation');\n\nvar originalKeys = Object.keys;\n\nkeysShim.shim = function shimObjectKeys() {\n\tif (Object.keys) {\n\t\tvar keysWorksWithArguments = (function () {\n\t\t\t// Safari 5.0 bug\n\t\t\tvar args = Object.keys(arguments);\n\t\t\treturn args && args.length === arguments.length;\n\t\t}(1, 2));\n\t\tif (!keysWorksWithArguments) {\n\t\t\tObject.keys = function keys(object) { // eslint-disable-line func-name-matching\n\t\t\t\tif (isArgs(object)) {\n\t\t\t\t\treturn originalKeys(slice.call(object));\n\t\t\t\t}\n\t\t\t\treturn originalKeys(object);\n\t\t\t};\n\t\t}\n\t} else {\n\t\tObject.keys = keysShim;\n\t}\n\treturn Object.keys || keysShim;\n};\n\nmodule.exports = keysShim;\n","'use strict';\n\nvar toStr = Object.prototype.toString;\n\nmodule.exports = function isArguments(value) {\n\tvar str = toStr.call(value);\n\tvar isArgs = str === '[object Arguments]';\n\tif (!isArgs) {\n\t\tisArgs = str !== '[object Array]' &&\n\t\t\tvalue !== null &&\n\t\t\ttypeof value === 'object' &&\n\t\t\ttypeof value.length === 'number' &&\n\t\t\tvalue.length >= 0 &&\n\t\t\ttoStr.call(value.callee) === '[object Function]';\n\t}\n\treturn isArgs;\n};\n","'use strict';\n\n// modified from https://github.com/es-shims/es6-shim\nvar keys = require('object-keys');\nvar canBeObject = function (obj) {\n\treturn typeof obj !== 'undefined' && obj !== null;\n};\nvar hasSymbols = require('has-symbols/shams')();\nvar callBound = require('call-bind/callBound');\nvar toObject = Object;\nvar $push = callBound('Array.prototype.push');\nvar $propIsEnumerable = callBound('Object.prototype.propertyIsEnumerable');\nvar originalGetSymbols = hasSymbols ? Object.getOwnPropertySymbols : null;\n\n// eslint-disable-next-line no-unused-vars\nmodule.exports = function assign(target, source1) {\n\tif (!canBeObject(target)) { throw new TypeError('target must be an object'); }\n\tvar objTarget = toObject(target);\n\tvar s, source, i, props, syms, value, key;\n\tfor (s = 1; s < arguments.length; ++s) {\n\t\tsource = toObject(arguments[s]);\n\t\tprops = keys(source);\n\t\tvar getSymbols = hasSymbols && (Object.getOwnPropertySymbols || originalGetSymbols);\n\t\tif (getSymbols) {\n\t\t\tsyms = getSymbols(source);\n\t\t\tfor (i = 0; i < syms.length; ++i) {\n\t\t\t\tkey = syms[i];\n\t\t\t\tif ($propIsEnumerable(source, key)) {\n\t\t\t\t\t$push(props, key);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor (i = 0; i < props.length; ++i) {\n\t\t\tkey = props[i];\n\t\t\tvalue = source[key];\n\t\t\tif ($propIsEnumerable(source, key)) {\n\t\t\t\tobjTarget[key] = value;\n\t\t\t}\n\t\t}\n\t}\n\treturn objTarget;\n};\n","'use strict';\n\nvar defineProperties = require('define-properties');\nvar callBind = require('call-bind');\n\nvar implementation = require('./implementation');\nvar getPolyfill = require('./polyfill');\nvar shim = require('./shim');\n\nvar polyfill = callBind.apply(getPolyfill());\n// eslint-disable-next-line no-unused-vars\nvar bound = function assign(target, source1) {\n\treturn polyfill(Object, arguments);\n};\n\ndefineProperties(bound, {\n\tgetPolyfill: getPolyfill,\n\timplementation: implementation,\n\tshim: shim\n});\n\nmodule.exports = bound;\n","'use strict';\n\nvar implementation = require('./implementation');\n\nvar lacksProperEnumerationOrder = function () {\n\tif (!Object.assign) {\n\t\treturn false;\n\t}\n\t/*\n\t * v8, specifically in node 4.x, has a bug with incorrect property enumeration order\n\t * note: this does not detect the bug unless there's 20 characters\n\t */\n\tvar str = 'abcdefghijklmnopqrst';\n\tvar letters = str.split('');\n\tvar map = {};\n\tfor (var i = 0; i < letters.length; ++i) {\n\t\tmap[letters[i]] = letters[i];\n\t}\n\tvar obj = Object.assign({}, map);\n\tvar actual = '';\n\tfor (var k in obj) {\n\t\tactual += k;\n\t}\n\treturn str !== actual;\n};\n\nvar assignHasPendingExceptions = function () {\n\tif (!Object.assign || !Object.preventExtensions) {\n\t\treturn false;\n\t}\n\t/*\n\t * Firefox 37 still has \"pending exception\" logic in its Object.assign implementation,\n\t * which is 72% slower than our shim, and Firefox 40's native implementation.\n\t */\n\tvar thrower = Object.preventExtensions({ 1: 2 });\n\ttry {\n\t\tObject.assign(thrower, 'xy');\n\t} catch (e) {\n\t\treturn thrower[1] === 'y';\n\t}\n\treturn false;\n};\n\nmodule.exports = function getPolyfill() {\n\tif (!Object.assign) {\n\t\treturn implementation;\n\t}\n\tif (lacksProperEnumerationOrder()) {\n\t\treturn implementation;\n\t}\n\tif (assignHasPendingExceptions()) {\n\t\treturn implementation;\n\t}\n\treturn Object.assign;\n};\n","'use strict';\n\nvar define = require('define-properties');\nvar getPolyfill = require('./polyfill');\n\nmodule.exports = function shimAssign() {\n\tvar polyfill = getPolyfill();\n\tdefine(\n\t\tObject,\n\t\t{ assign: polyfill },\n\t\t{ assign: function () { return Object.assign !== polyfill; } }\n\t);\n\treturn polyfill;\n};\n","'use strict';\n\nvar $Object = Object;\nvar $TypeError = TypeError;\n\nmodule.exports = function flags() {\n\tif (this != null && this !== $Object(this)) {\n\t\tthrow new $TypeError('RegExp.prototype.flags getter called on non-object');\n\t}\n\tvar result = '';\n\tif (this.hasIndices) {\n\t\tresult += 'd';\n\t}\n\tif (this.global) {\n\t\tresult += 'g';\n\t}\n\tif (this.ignoreCase) {\n\t\tresult += 'i';\n\t}\n\tif (this.multiline) {\n\t\tresult += 'm';\n\t}\n\tif (this.dotAll) {\n\t\tresult += 's';\n\t}\n\tif (this.unicode) {\n\t\tresult += 'u';\n\t}\n\tif (this.sticky) {\n\t\tresult += 'y';\n\t}\n\treturn result;\n};\n","'use strict';\n\nvar define = require('define-properties');\nvar callBind = require('call-bind');\n\nvar implementation = require('./implementation');\nvar getPolyfill = require('./polyfill');\nvar shim = require('./shim');\n\nvar flagsBound = callBind(getPolyfill());\n\ndefine(flagsBound, {\n\tgetPolyfill: getPolyfill,\n\timplementation: implementation,\n\tshim: shim\n});\n\nmodule.exports = flagsBound;\n","'use strict';\n\nvar implementation = require('./implementation');\n\nvar supportsDescriptors = require('define-properties').supportsDescriptors;\nvar $gOPD = Object.getOwnPropertyDescriptor;\n\nmodule.exports = function getPolyfill() {\n\tif (supportsDescriptors && (/a/mig).flags === 'gim') {\n\t\tvar descriptor = $gOPD(RegExp.prototype, 'flags');\n\t\tif (descriptor && typeof descriptor.get === 'function' && typeof (/a/).dotAll === 'boolean') {\n\t\t\treturn descriptor.get;\n\t\t}\n\t}\n\treturn implementation;\n};\n","'use strict';\n\nvar supportsDescriptors = require('define-properties').supportsDescriptors;\nvar getPolyfill = require('./polyfill');\nvar gOPD = Object.getOwnPropertyDescriptor;\nvar defineProperty = Object.defineProperty;\nvar TypeErr = TypeError;\nvar getProto = Object.getPrototypeOf;\nvar regex = /a/;\n\nmodule.exports = function shimFlags() {\n\tif (!supportsDescriptors || !getProto) {\n\t\tthrow new TypeErr('RegExp.prototype.flags requires a true ES5 environment that supports property descriptors');\n\t}\n\tvar polyfill = getPolyfill();\n\tvar proto = getProto(regex);\n\tvar descriptor = gOPD(proto, 'flags');\n\tif (!descriptor || descriptor.get !== polyfill) {\n\t\tdefineProperty(proto, 'flags', {\n\t\t\tconfigurable: true,\n\t\t\tenumerable: false,\n\t\t\tget: polyfill\n\t\t});\n\t}\n\treturn polyfill;\n};\n","'use strict';\n\nvar GetIntrinsic = require('get-intrinsic');\nvar callBound = require('call-bind/callBound');\nvar inspect = require('object-inspect');\n\nvar $TypeError = GetIntrinsic('%TypeError%');\nvar $WeakMap = GetIntrinsic('%WeakMap%', true);\nvar $Map = GetIntrinsic('%Map%', true);\n\nvar $weakMapGet = callBound('WeakMap.prototype.get', true);\nvar $weakMapSet = callBound('WeakMap.prototype.set', true);\nvar $weakMapHas = callBound('WeakMap.prototype.has', true);\nvar $mapGet = callBound('Map.prototype.get', true);\nvar $mapSet = callBound('Map.prototype.set', true);\nvar $mapHas = callBound('Map.prototype.has', true);\n\n/*\n * This function traverses the list returning the node corresponding to the\n * given key.\n *\n * That node is also moved to the head of the list, so that if it's accessed\n * again we don't need to traverse the whole list. By doing so, all the recently\n * used nodes can be accessed relatively quickly.\n */\nvar listGetNode = function (list, key) { // eslint-disable-line consistent-return\n\tfor (var prev = list, curr; (curr = prev.next) !== null; prev = curr) {\n\t\tif (curr.key === key) {\n\t\t\tprev.next = curr.next;\n\t\t\tcurr.next = list.next;\n\t\t\tlist.next = curr; // eslint-disable-line no-param-reassign\n\t\t\treturn curr;\n\t\t}\n\t}\n};\n\nvar listGet = function (objects, key) {\n\tvar node = listGetNode(objects, key);\n\treturn node && node.value;\n};\nvar listSet = function (objects, key, value) {\n\tvar node = listGetNode(objects, key);\n\tif (node) {\n\t\tnode.value = value;\n\t} else {\n\t\t// Prepend the new node to the beginning of the list\n\t\tobjects.next = { // eslint-disable-line no-param-reassign\n\t\t\tkey: key,\n\t\t\tnext: objects.next,\n\t\t\tvalue: value\n\t\t};\n\t}\n};\nvar listHas = function (objects, key) {\n\treturn !!listGetNode(objects, key);\n};\n\nmodule.exports = function getSideChannel() {\n\tvar $wm;\n\tvar $m;\n\tvar $o;\n\tvar channel = {\n\t\tassert: function (key) {\n\t\t\tif (!channel.has(key)) {\n\t\t\t\tthrow new $TypeError('Side channel does not contain ' + inspect(key));\n\t\t\t}\n\t\t},\n\t\tget: function (key) { // eslint-disable-line consistent-return\n\t\t\tif ($WeakMap && key && (typeof key === 'object' || typeof key === 'function')) {\n\t\t\t\tif ($wm) {\n\t\t\t\t\treturn $weakMapGet($wm, key);\n\t\t\t\t}\n\t\t\t} else if ($Map) {\n\t\t\t\tif ($m) {\n\t\t\t\t\treturn $mapGet($m, key);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif ($o) { // eslint-disable-line no-lonely-if\n\t\t\t\t\treturn listGet($o, key);\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\thas: function (key) {\n\t\t\tif ($WeakMap && key && (typeof key === 'object' || typeof key === 'function')) {\n\t\t\t\tif ($wm) {\n\t\t\t\t\treturn $weakMapHas($wm, key);\n\t\t\t\t}\n\t\t\t} else if ($Map) {\n\t\t\t\tif ($m) {\n\t\t\t\t\treturn $mapHas($m, key);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif ($o) { // eslint-disable-line no-lonely-if\n\t\t\t\t\treturn listHas($o, key);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn false;\n\t\t},\n\t\tset: function (key, value) {\n\t\t\tif ($WeakMap && key && (typeof key === 'object' || typeof key === 'function')) {\n\t\t\t\tif (!$wm) {\n\t\t\t\t\t$wm = new $WeakMap();\n\t\t\t\t}\n\t\t\t\t$weakMapSet($wm, key, value);\n\t\t\t} else if ($Map) {\n\t\t\t\tif (!$m) {\n\t\t\t\t\t$m = new $Map();\n\t\t\t\t}\n\t\t\t\t$mapSet($m, key, value);\n\t\t\t} else {\n\t\t\t\tif (!$o) {\n\t\t\t\t\t/*\n\t\t\t\t\t * Initialize the linked list as an empty node, so that we don't have\n\t\t\t\t\t * to special-case handling of the first node: we can always refer to\n\t\t\t\t\t * it as (previous node).next, instead of something like (list).head\n\t\t\t\t\t */\n\t\t\t\t\t$o = { key: {}, next: null };\n\t\t\t\t}\n\t\t\t\tlistSet($o, key, value);\n\t\t\t}\n\t\t}\n\t};\n\treturn channel;\n};\n","'use strict';\nmodule.exports = path => {\n\tconst isExtendedLengthPath = /^\\\\\\\\\\?\\\\/.test(path);\n\tconst hasNonAscii = /[^\\u0000-\\u0080]+/.test(path); // eslint-disable-line no-control-regex\n\n\tif (isExtendedLengthPath || hasNonAscii) {\n\t\treturn path;\n\t}\n\n\treturn path.replace(/\\\\/g, '/');\n};\n","var v1 = require('./v1');\nvar v4 = require('./v4');\n\nvar uuid = v4;\nuuid.v1 = v1;\nuuid.v4 = v4;\n\nmodule.exports = uuid;\n","/**\n * Convert array of 16 byte values to UUID string format of the form:\n * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX\n */\nvar byteToHex = [];\nfor (var i = 0; i < 256; ++i) {\n byteToHex[i] = (i + 0x100).toString(16).substr(1);\n}\n\nfunction bytesToUuid(buf, offset) {\n var i = offset || 0;\n var bth = byteToHex;\n // join used to fix memory issue caused by concatenation: https://bugs.chromium.org/p/v8/issues/detail?id=3175#c4\n return ([bth[buf[i++]], bth[buf[i++]], \n\tbth[buf[i++]], bth[buf[i++]], '-',\n\tbth[buf[i++]], bth[buf[i++]], '-',\n\tbth[buf[i++]], bth[buf[i++]], '-',\n\tbth[buf[i++]], bth[buf[i++]], '-',\n\tbth[buf[i++]], bth[buf[i++]],\n\tbth[buf[i++]], bth[buf[i++]],\n\tbth[buf[i++]], bth[buf[i++]]]).join('');\n}\n\nmodule.exports = bytesToUuid;\n","// Unique ID creation requires a high quality random # generator. In node.js\n// this is pretty straight-forward - we use the crypto API.\n\nvar crypto = require('crypto');\n\nmodule.exports = function nodeRNG() {\n return crypto.randomBytes(16);\n};\n","var rng = require('./lib/rng');\nvar bytesToUuid = require('./lib/bytesToUuid');\n\n// **`v1()` - Generate time-based UUID**\n//\n// Inspired by https://github.com/LiosK/UUID.js\n// and http://docs.python.org/library/uuid.html\n\nvar _nodeId;\nvar _clockseq;\n\n// Previous uuid creation time\nvar _lastMSecs = 0;\nvar _lastNSecs = 0;\n\n// See https://github.com/broofa/node-uuid for API details\nfunction v1(options, buf, offset) {\n var i = buf && offset || 0;\n var b = buf || [];\n\n options = options || {};\n var node = options.node || _nodeId;\n var clockseq = options.clockseq !== undefined ? options.clockseq : _clockseq;\n\n // node and clockseq need to be initialized to random values if they're not\n // specified. We do this lazily to minimize issues related to insufficient\n // system entropy. See #189\n if (node == null || clockseq == null) {\n var seedBytes = rng();\n if (node == null) {\n // Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1)\n node = _nodeId = [\n seedBytes[0] | 0x01,\n seedBytes[1], seedBytes[2], seedBytes[3], seedBytes[4], seedBytes[5]\n ];\n }\n if (clockseq == null) {\n // Per 4.2.2, randomize (14 bit) clockseq\n clockseq = _clockseq = (seedBytes[6] << 8 | seedBytes[7]) & 0x3fff;\n }\n }\n\n // UUID timestamps are 100 nano-second units since the Gregorian epoch,\n // (1582-10-15 00:00). JSNumbers aren't precise enough for this, so\n // time is handled internally as 'msecs' (integer milliseconds) and 'nsecs'\n // (100-nanoseconds offset from msecs) since unix epoch, 1970-01-01 00:00.\n var msecs = options.msecs !== undefined ? options.msecs : new Date().getTime();\n\n // Per 4.2.1.2, use count of uuid's generated during the current clock\n // cycle to simulate higher resolution clock\n var nsecs = options.nsecs !== undefined ? options.nsecs : _lastNSecs + 1;\n\n // Time since last uuid creation (in msecs)\n var dt = (msecs - _lastMSecs) + (nsecs - _lastNSecs)/10000;\n\n // Per 4.2.1.2, Bump clockseq on clock regression\n if (dt < 0 && options.clockseq === undefined) {\n clockseq = clockseq + 1 & 0x3fff;\n }\n\n // Reset nsecs if clock regresses (new clockseq) or we've moved onto a new\n // time interval\n if ((dt < 0 || msecs > _lastMSecs) && options.nsecs === undefined) {\n nsecs = 0;\n }\n\n // Per 4.2.1.2 Throw error if too many uuids are requested\n if (nsecs >= 10000) {\n throw new Error('uuid.v1(): Can\\'t create more than 10M uuids/sec');\n }\n\n _lastMSecs = msecs;\n _lastNSecs = nsecs;\n _clockseq = clockseq;\n\n // Per 4.1.4 - Convert from unix epoch to Gregorian epoch\n msecs += 12219292800000;\n\n // `time_low`\n var tl = ((msecs & 0xfffffff) * 10000 + nsecs) % 0x100000000;\n b[i++] = tl >>> 24 & 0xff;\n b[i++] = tl >>> 16 & 0xff;\n b[i++] = tl >>> 8 & 0xff;\n b[i++] = tl & 0xff;\n\n // `time_mid`\n var tmh = (msecs / 0x100000000 * 10000) & 0xfffffff;\n b[i++] = tmh >>> 8 & 0xff;\n b[i++] = tmh & 0xff;\n\n // `time_high_and_version`\n b[i++] = tmh >>> 24 & 0xf | 0x10; // include version\n b[i++] = tmh >>> 16 & 0xff;\n\n // `clock_seq_hi_and_reserved` (Per 4.2.2 - include variant)\n b[i++] = clockseq >>> 8 | 0x80;\n\n // `clock_seq_low`\n b[i++] = clockseq & 0xff;\n\n // `node`\n for (var n = 0; n < 6; ++n) {\n b[i + n] = node[n];\n }\n\n return buf ? buf : bytesToUuid(b);\n}\n\nmodule.exports = v1;\n","var rng = require('./lib/rng');\nvar bytesToUuid = require('./lib/bytesToUuid');\n\nfunction v4(options, buf, offset) {\n var i = buf && offset || 0;\n\n if (typeof(options) == 'string') {\n buf = options === 'binary' ? new Array(16) : null;\n options = null;\n }\n options = options || {};\n\n var rnds = options.random || (options.rng || rng)();\n\n // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`\n rnds[6] = (rnds[6] & 0x0f) | 0x40;\n rnds[8] = (rnds[8] & 0x3f) | 0x80;\n\n // Copy bytes to buffer, if provided\n if (buf) {\n for (var ii = 0; ii < 16; ++ii) {\n buf[i + ii] = rnds[ii];\n }\n }\n\n return buf || bytesToUuid(rnds);\n}\n\nmodule.exports = v4;\n","'use strict';\n\nvar isString = require('is-string');\nvar isNumber = require('is-number-object');\nvar isBoolean = require('is-boolean-object');\nvar isSymbol = require('is-symbol');\nvar isBigInt = require('is-bigint');\n\n// eslint-disable-next-line consistent-return\nmodule.exports = function whichBoxedPrimitive(value) {\n\t// eslint-disable-next-line eqeqeq\n\tif (value == null || (typeof value !== 'object' && typeof value !== 'function')) {\n\t\treturn null;\n\t}\n\tif (isString(value)) {\n\t\treturn 'String';\n\t}\n\tif (isNumber(value)) {\n\t\treturn 'Number';\n\t}\n\tif (isBoolean(value)) {\n\t\treturn 'Boolean';\n\t}\n\tif (isSymbol(value)) {\n\t\treturn 'Symbol';\n\t}\n\tif (isBigInt(value)) {\n\t\treturn 'BigInt';\n\t}\n};\n","'use strict';\n\nvar isMap = require('is-map');\nvar isSet = require('is-set');\nvar isWeakMap = require('is-weakmap');\nvar isWeakSet = require('is-weakset');\n\nmodule.exports = function whichCollection(value) {\n\tif (value && typeof value === 'object') {\n\t\tif (isMap(value)) {\n\t\t\treturn 'Map';\n\t\t}\n\t\tif (isSet(value)) {\n\t\t\treturn 'Set';\n\t\t}\n\t\tif (isWeakMap(value)) {\n\t\t\treturn 'WeakMap';\n\t\t}\n\t\tif (isWeakSet(value)) {\n\t\t\treturn 'WeakSet';\n\t\t}\n\t}\n\treturn false;\n};\n","'use strict';\n\nvar forEach = require('foreach');\nvar availableTypedArrays = require('available-typed-arrays');\nvar callBound = require('call-bind/callBound');\n\nvar $toString = callBound('Object.prototype.toString');\nvar hasToStringTag = require('has-tostringtag/shams')();\n\nvar g = typeof globalThis === 'undefined' ? global : globalThis;\nvar typedArrays = availableTypedArrays();\n\nvar $slice = callBound('String.prototype.slice');\nvar toStrTags = {};\nvar gOPD = require('es-abstract/helpers/getOwnPropertyDescriptor');\nvar getPrototypeOf = Object.getPrototypeOf; // require('getprototypeof');\nif (hasToStringTag && gOPD && getPrototypeOf) {\n\tforEach(typedArrays, function (typedArray) {\n\t\tif (typeof g[typedArray] === 'function') {\n\t\t\tvar arr = new g[typedArray]();\n\t\t\tif (Symbol.toStringTag in arr) {\n\t\t\t\tvar proto = getPrototypeOf(arr);\n\t\t\t\tvar descriptor = gOPD(proto, Symbol.toStringTag);\n\t\t\t\tif (!descriptor) {\n\t\t\t\t\tvar superProto = getPrototypeOf(proto);\n\t\t\t\t\tdescriptor = gOPD(superProto, Symbol.toStringTag);\n\t\t\t\t}\n\t\t\t\ttoStrTags[typedArray] = descriptor.get;\n\t\t\t}\n\t\t}\n\t});\n}\n\nvar tryTypedArrays = function tryAllTypedArrays(value) {\n\tvar foundName = false;\n\tforEach(toStrTags, function (getter, typedArray) {\n\t\tif (!foundName) {\n\t\t\ttry {\n\t\t\t\tvar name = getter.call(value);\n\t\t\t\tif (name === typedArray) {\n\t\t\t\t\tfoundName = name;\n\t\t\t\t}\n\t\t\t} catch (e) {}\n\t\t}\n\t});\n\treturn foundName;\n};\n\nvar isTypedArray = require('is-typed-array');\n\nmodule.exports = function whichTypedArray(value) {\n\tif (!isTypedArray(value)) { return false; }\n\tif (!hasToStringTag || !(Symbol.toStringTag in value)) { return $slice($toString(value), 8, -1); }\n\treturn tryTypedArrays(value);\n};\n","class Query {\n constructor(state) {\n this.state = {\n filterExpressions: state.filterExpressions || [],\n selectExpressions: state.selectExpressions || [],\n groupExpressions: state.groupExpressions || [],\n orderExpressions: state.orderExpressions || [],\n calculation: false,\n rawMode: false,\n withDead: false,\n validateRefs: true,\n limit: null,\n offset: null,\n ...state\n };\n }\n\n filter(expr) {\n return new Query({\n ...this.state,\n filterExpressions: [...this.state.filterExpressions, expr]\n });\n }\n\n unfilter(exprs) {\n let exprSet = new Set(exprs);\n return new Query({\n ...this.state,\n filterExpressions: this.state.filterExpressions.filter(\n expr => !exprSet.has(Object.keys(expr)[0])\n )\n });\n }\n\n select(exprs = []) {\n if (!Array.isArray(exprs)) {\n exprs = [exprs];\n }\n\n let query = new Query({ ...this.state, selectExpressions: exprs });\n query.state.calculation = false;\n return query;\n }\n\n calculate(expr) {\n let query = this.select({ result: expr });\n query.state.calculation = true;\n return query;\n }\n\n groupBy(exprs) {\n if (!Array.isArray(exprs)) {\n exprs = [exprs];\n }\n\n return new Query({\n ...this.state,\n groupExpressions: [...this.state.groupExpressions, ...exprs]\n });\n }\n\n orderBy(exprs) {\n if (!Array.isArray(exprs)) {\n exprs = [exprs];\n }\n\n return new Query({\n ...this.state,\n orderExpressions: [...this.state.orderExpressions, ...exprs]\n });\n }\n\n limit(num) {\n return new Query({ ...this.state, limit: num });\n }\n\n offset(num) {\n return new Query({ ...this.state, offset: num });\n }\n\n raw() {\n return new Query({ ...this.state, rawMode: true });\n }\n\n withDead() {\n return new Query({ ...this.state, withDead: true });\n }\n\n withoutValidatedRefs() {\n return new Query({ ...this.state, validateRefs: false });\n }\n\n options(opts) {\n return new Query({ ...this.state, tableOptions: opts });\n }\n\n serialize() {\n return this.state;\n }\n}\n\nfunction getPrimaryOrderBy(query, defaultOrderBy) {\n let orderExprs = query.serialize().orderExpressions;\n if (orderExprs.length === 0) {\n if (defaultOrderBy) {\n return { order: 'asc', ...defaultOrderBy };\n }\n return null;\n }\n\n let firstOrder = orderExprs[0];\n if (typeof firstOrder === 'string') {\n return { field: firstOrder, order: 'asc' };\n }\n // Handle this form: { field: 'desc' }\n let [field] = Object.keys(firstOrder);\n return { field, order: firstOrder[field] };\n}\n\nmodule.exports = function q(table) {\n return new Query({ table });\n};\n","// TODO: comment on why it works this way\n\nlet send;\n\nmodule.exports = { send };\n","const q = require('./app/query');\nconst injected = require('./injected');\n\nfunction send(name, args) {\n return injected.send(name, args);\n}\n\nasync function runImport(name, func) {\n await send('api/start-import', { budgetName: name });\n try {\n await func();\n } catch (e) {\n await send('api/abort-import');\n throw e;\n }\n await send('api/finish-import');\n}\n\nasync function loadBudget(budgetId) {\n return send('api/load-budget', { id: budgetId });\n}\n\nasync function batchBudgetUpdates(func) {\n await send('api/batch-budget-start');\n try {\n await func();\n } finally {\n await send('api/batch-budget-end');\n }\n}\n\nfunction runQuery(query) {\n return send('api/query', { query: query.serialize() });\n}\n\nfunction getBudgetMonths() {\n return send('api/budget-months');\n}\n\nfunction getBudgetMonth(month) {\n return send('api/budget-month', { month });\n}\n\nfunction setBudgetAmount(month, categoryId, value) {\n return send('api/budget-set-amount', { month, categoryId, amount: value });\n}\n\nfunction setBudgetCarryover(month, categoryId, flag) {\n return send('api/budget-set-carryover', { month, categoryId, flag });\n}\n\nfunction addTransactions(accountId, transactions) {\n return send('api/transactions-add', { accountId, transactions });\n}\n\nfunction importTransactions(accountId, transactions) {\n return send('api/transactions-import', { accountId, transactions });\n}\n\nfunction getTransactions(accountId, startDate, endDate) {\n return send('api/transactions-get', { accountId, startDate, endDate });\n}\n\nfunction filterTransactions(accountId, text) {\n return send('api/transactions-filter', { accountId, text });\n}\n\nfunction updateTransaction(id, fields) {\n return send('api/transaction-update', { id, fields });\n}\n\nfunction deleteTransaction(id) {\n return send('api/transaction-delete', { id });\n}\n\nfunction getAccounts() {\n return send('api/accounts-get');\n}\n\nfunction createAccount(account, initialBalance) {\n return send('api/account-create', { account, initialBalance });\n}\n\nfunction updateAccount(id, fields) {\n return send('api/account-update', { id, fields });\n}\n\nfunction closeAccount(id, transferAccountId, transferCategoryId) {\n return send('api/account-close', {\n id,\n transferAccountId,\n transferCategoryId\n });\n}\n\nfunction reopenAccount(id) {\n return send('api/account-reopen', { id });\n}\n\nfunction deleteAccount(id) {\n return send('api/account-delete', { id });\n}\n\nfunction getCategoryGroups() {\n return send('api/categories-get', { grouped: true });\n}\n\nfunction createCategoryGroup(group) {\n return send('api/category-group-create', { group });\n}\n\nfunction updateCategoryGroup(id, fields) {\n return send('api/category-group-update', { id, fields });\n}\n\nfunction deleteCategoryGroup(id, transferCategoryId) {\n return send('api/category-group-delete', { id, transferCategoryId });\n}\n\nfunction getCategories() {\n return send('api/categories-get', { grouped: false });\n}\n\nfunction createCategory(category) {\n return send('api/category-create', { category });\n}\n\nfunction updateCategory(id, fields) {\n return send('api/category-update', { id, fields });\n}\n\nfunction deleteCategory(id, transferCategoryId) {\n return send('api/category-delete', { id, transferCategoryId });\n}\n\nfunction getPayees() {\n return send('api/payees-get');\n}\n\nfunction createPayee(payee) {\n return send('api/payee-create', { payee });\n}\n\nfunction updatePayee(id, fields) {\n return send('api/payee-update', { id, fields });\n}\n\nfunction deletePayee(id) {\n return send('api/payee-delete', { id });\n}\n\nfunction getPayeeRules(payeeId) {\n return send('api/payee-rules-get', { payeeId });\n}\n\nfunction createPayeeRule(payeeId, rule) {\n return send('api/payee-rule-create', { payee_id: payeeId, rule });\n}\n\nfunction updatePayeeRule(id, fields) {\n return send('api/payee-rule-update', { id, fields });\n}\n\nfunction deletePayeeRule(id) {\n return send('api/payee-rule-delete', { id });\n}\n\nmodule.exports = {\n runImport,\n\n runQuery,\n q,\n\n loadBudget,\n batchBudgetUpdates,\n getBudgetMonths,\n getBudgetMonth,\n setBudgetAmount,\n setBudgetCarryover,\n\n addTransactions,\n importTransactions,\n filterTransactions,\n getTransactions,\n updateTransaction,\n deleteTransaction,\n\n getAccounts,\n createAccount,\n updateAccount,\n closeAccount,\n reopenAccount,\n deleteAccount,\n\n getCategories,\n createCategoryGroup,\n updateCategoryGroup,\n deleteCategoryGroup,\n createCategory,\n updateCategory,\n deleteCategory,\n\n getPayees,\n createPayee,\n updatePayee,\n deletePayee,\n getPayeeRules,\n createPayeeRule,\n deletePayeeRule,\n updatePayeeRule\n};\n","const d = require('date-fns');\nconst normalizePathSep = require('slash');\nconst uuid = require('uuid');\nconst AdmZip = require('adm-zip');\nconst actual = require('@actual-app/api/methods');\nconst { amountToInteger } = require('@actual-app/api/utils');\n\n// Utils\n\nfunction mapAccountType(type) {\n switch (type) {\n case 'Cash':\n case 'Checking':\n return 'checking';\n case 'CreditCard':\n return 'credit';\n case 'Savings':\n return 'savings';\n case 'InvestmentAccount':\n return 'investment';\n case 'Mortgage':\n return 'mortgage';\n default:\n return 'other';\n }\n}\n\nfunction sortByKey(arr, key) {\n return [...arr].sort((item1, item2) => {\n if (item1[key] < item2[key]) {\n return -1;\n } else if (item1[key] > item2[key]) {\n return 1;\n }\n return 0;\n });\n}\n\nfunction groupBy(arr, keyName) {\n return arr.reduce(function(obj, item) {\n var key = item[keyName];\n if (!obj.hasOwnProperty(key)) {\n obj[key] = [];\n }\n obj[key].push(item);\n return obj;\n }, {});\n}\n\nfunction _parse(value) {\n if (typeof value === 'string') {\n // We don't want parsing to take local timezone into account,\n // which parsing a string does. Pass the integers manually to\n // bypass it.\n\n let [year, month, day] = value.split('-');\n if (day != null) {\n return new Date(parseInt(year), parseInt(month) - 1, parseInt(day));\n } else if (month != null) {\n return new Date(parseInt(year), parseInt(month) - 1, 1);\n } else {\n return new Date(parseInt(year), 0, 1);\n }\n }\n return value;\n}\n\nfunction monthFromDate(date) {\n return d.format(_parse(date), 'yyyy-MM');\n}\n\nfunction getCurrentMonth() {\n return d.format(new Date(), 'yyyy-MM');\n}\n\n// Importer\n\nasync function importAccounts(data, entityIdMap) {\n return Promise.all(\n data.accounts.map(async account => {\n if (!account.isTombstone) {\n const id = await actual.createAccount({\n type: mapAccountType(account.accountType),\n name: account.accountName,\n offbudget: account.onBudget ? false : true,\n closed: account.hidden ? true : false\n });\n entityIdMap.set(account.entityId, id);\n }\n })\n );\n}\n\nasync function importCategories(data, entityIdMap) {\n const masterCategories = sortByKey(data.masterCategories, 'sortableIndex');\n\n await Promise.all(\n masterCategories.map(async masterCategory => {\n if (\n masterCategory.type === 'OUTFLOW' &&\n !masterCategory.isTombstone &&\n masterCategory.subCategories &&\n masterCategory.subCategories.some(cat => !cat.isTombstone) > 0\n ) {\n const id = await actual.createCategoryGroup({\n name: masterCategory.name,\n is_income: false\n });\n entityIdMap.set(masterCategory.entityId, id);\n\n if (masterCategory.subCategories) {\n const subCategories = sortByKey(\n masterCategory.subCategories,\n 'sortableIndex'\n );\n subCategories.reverse();\n\n // This can't be done in parallel because sort order depends\n // on insertion order\n for (let category of subCategories) {\n if (!category.isTombstone) {\n const id = await actual.createCategory({\n name: category.name,\n group_id: entityIdMap.get(category.masterCategoryId)\n });\n entityIdMap.set(category.entityId, id);\n }\n }\n }\n }\n })\n );\n}\n\nasync function importPayees(data, entityIdMap) {\n for (let payee of data.payees) {\n if (!payee.isTombstone) {\n let id = await actual.createPayee({\n name: payee.name,\n category: entityIdMap.get(payee.autoFillCategoryId) || null,\n transfer_acct: entityIdMap.get(payee.targetAccountId) || null\n });\n\n // TODO: import payee rules\n\n entityIdMap.set(payee.entityId, id);\n }\n }\n}\n\nasync function importTransactions(data, entityIdMap) {\n const categories = await actual.getCategories();\n const incomeCategoryId = categories.find(cat => cat.name === 'Income').id;\n const accounts = await actual.getAccounts();\n const payees = await actual.getPayees();\n\n function getCategory(id) {\n if (id == null || id === 'Category/__Split__') {\n return null;\n } else if (\n id === 'Category/__ImmediateIncome__' ||\n id === 'Category/__DeferredIncome__'\n ) {\n return incomeCategoryId;\n }\n return entityIdMap.get(id);\n }\n\n function isOffBudget(acctId) {\n let acct = accounts.find(acct => acct.id === acctId);\n if (!acct) {\n throw new Error('Could not find account for transaction when importing');\n }\n return acct.offbudget;\n }\n\n // Go ahead and generate ids for all of the transactions so we can\n // reliably resolve transfers\n for (let transaction of data.transactions) {\n entityIdMap.set(transaction.entityId, uuid.v4());\n }\n\n let sortOrder = 1;\n let transactionsGrouped = groupBy(data.transactions, 'accountId');\n\n await Promise.all(\n Object.keys(transactionsGrouped).map(async accountId => {\n let transactions = transactionsGrouped[accountId];\n\n let toImport = transactions\n .map(transaction => {\n if (transaction.isTombstone) {\n return;\n }\n\n let id = entityIdMap.get(transaction.entityId);\n let transferId =\n entityIdMap.get(transaction.transferTransactionId) || null;\n\n let payee = null;\n if (transferId) {\n payee = payees.find(\n p =>\n p.transfer_acct === entityIdMap.get(transaction.targetAccountId)\n ).id;\n } else {\n payee = entityIdMap.get(transaction.payeeId);\n }\n\n let newTransaction = {\n id,\n amount: amountToInteger(transaction.amount),\n category: isOffBudget(entityIdMap.get(accountId))\n ? null\n : getCategory(transaction.categoryId),\n date: transaction.date,\n notes: transaction.memo || null,\n payee,\n transfer_id: transferId\n };\n\n newTransaction.subtransactions =\n transaction.subTransactions &&\n transaction.subTransactions.map((t, i) => {\n return {\n amount: amountToInteger(t.amount),\n category: getCategory(t.categoryId)\n };\n });\n\n return newTransaction;\n })\n .filter(x => x);\n\n await actual.addTransactions(entityIdMap.get(accountId), toImport);\n })\n );\n}\n\nfunction fillInBudgets(data, categoryBudgets) {\n // YNAB only contains entries for categories that have been actually\n // budgeted. That would be fine except that we need to set the\n // \"carryover\" flag on each month when carrying debt across months.\n // To make sure our system has a chance to set this flag on each\n // category, make sure a budget exists for every category of every\n // month.\n const budgets = [...categoryBudgets];\n data.masterCategories.forEach(masterCategory => {\n if (masterCategory.subCategories) {\n masterCategory.subCategories.forEach(category => {\n if (!budgets.find(b => b.categoryId === category.entityId)) {\n budgets.push({\n budgeted: 0,\n categoryId: category.entityId\n });\n }\n });\n }\n });\n return budgets;\n}\n\nasync function importBudgets(data, entityIdMap) {\n let budgets = sortByKey(data.monthlyBudgets, 'month');\n let earliestMonth = monthFromDate(budgets[0].month);\n let currentMonth = getCurrentMonth();\n\n await actual.batchBudgetUpdates(async () => {\n const carryoverFlags = {};\n\n for (let budget of budgets) {\n let filled = fillInBudgets(\n data,\n budget.monthlySubCategoryBudgets.filter(b => !b.isTombstone)\n );\n\n await Promise.all(\n filled.map(async catBudget => {\n let amount = amountToInteger(catBudget.budgeted);\n let catId = entityIdMap.get(catBudget.categoryId);\n let month = monthFromDate(budget.month);\n if (!catId) {\n return;\n }\n\n await actual.setBudgetAmount(month, catId, amount);\n\n if (catBudget.overspendingHandling === 'AffectsBuffer') {\n // Turn off the carryover flag so it doesn't propagate\n // to future months\n carryoverFlags[catId] = false;\n } else if (\n catBudget.overspendingHandling === 'Confined' ||\n carryoverFlags[catId]\n ) {\n // Overspending has switched to carryover, set the\n // flag so it propagates to future months\n carryoverFlags[catId] = true;\n\n await actual.setBudgetCarryover(month, catId, true);\n }\n })\n );\n }\n });\n}\n\nfunction estimateRecentness(str) {\n // The \"recentness\" is the total amount of changes that this device\n // is aware of, which is estimated by summing up all of the version\n // numbers that its aware of. This works because version numbers are\n // increasing integers.\n return str.split(',').reduce((total, version) => {\n const [_, number] = version.split('-');\n return total + parseInt(number);\n }, 0);\n}\n\nfunction findLatestDevice(zipped, entries) {\n let devices = entries\n .map(entry => {\n const contents = zipped.readFile(entry).toString('utf8');\n\n let data;\n try {\n data = JSON.parse(contents);\n } catch (e) {\n return null;\n }\n\n if (data.hasFullKnowledge) {\n return {\n deviceGUID: data.deviceGUID,\n shortName: data.shortDeviceId,\n recentness: estimateRecentness(data.knowledge)\n };\n }\n\n return null;\n })\n .filter(x => x);\n\n devices = sortByKey(devices, 'recentness');\n return devices[devices.length - 1].deviceGUID;\n}\n\nasync function doImport(data) {\n const entityIdMap = new Map();\n\n console.log('Importing Accounts...');\n await importAccounts(data, entityIdMap);\n\n console.log('Importing Categories...');\n await importCategories(data, entityIdMap);\n\n console.log('Importing Payees...');\n await importPayees(data, entityIdMap);\n\n console.log('Importing Transactions...');\n await importTransactions(data, entityIdMap);\n\n console.log('Importing Budgets...');\n await importBudgets(data, entityIdMap);\n\n console.log('Setting up...');\n}\n\nfunction getBudgetName(filepath) {\n let unixFilepath = normalizePathSep(filepath);\n\n if (!/\\.zip/.test(unixFilepath)) {\n return null;\n }\n\n unixFilepath = unixFilepath.replace(/\\.zip$/, '').replace(/.ynab4$/, '');\n\n // Most budgets are named like \"Budget~51938D82.ynab4\" but sometimes\n // they are only \"Budget.ynab4\". We only want to grab the name\n // before the ~ if it exists.\n let m = unixFilepath.match(/([^/~]+)[^/]*$/);\n if (!m) {\n return null;\n }\n return m[1];\n}\n\nfunction getFile(entries, path) {\n let files = entries.filter(e => e.entryName === path);\n if (files.length === 0) {\n throw new Error('Could not find file: ' + path);\n }\n if (files.length >= 2) {\n throw new Error('File name matches multiple files: ' + path);\n }\n return files[0];\n}\n\nfunction join(...paths) {\n return paths.slice(1).reduce((full, path) => {\n return full + '/' + path.replace(/^\\//, '');\n }, paths[0].replace(/\\/$/, ''));\n}\n\nasync function importBuffer(filepath, buffer) {\n let budgetName = getBudgetName(filepath);\n\n if (!budgetName) {\n throw new Error('Not a YNAB4 file: ' + filepath);\n }\n\n let zipped = new AdmZip(buffer);\n let entries = zipped.getEntries();\n\n let root = '';\n let dirMatch = entries[0].entryName.match(/([^/]*\\.ynab4)/);\n if (dirMatch) {\n root = dirMatch[1] + '/';\n }\n\n let metaStr = zipped.readFile(getFile(entries, root + 'Budget.ymeta'));\n let meta = JSON.parse(metaStr.toString('utf8'));\n let budgetPath = join(root, meta.relativeDataFolderName);\n\n let deviceFiles = entries.filter(e =>\n e.entryName.startsWith(join(budgetPath, 'devices'))\n );\n let deviceGUID = findLatestDevice(zipped, deviceFiles);\n\n const yfullPath = join(budgetPath, deviceGUID, 'Budget.yfull');\n let contents;\n try {\n contents = zipped.readFile(getFile(entries, yfullPath)).toString('utf8');\n } catch (e) {\n console.log(e);\n throw new Error('Error reading Budget.yfull file');\n }\n\n let data;\n try {\n data = JSON.parse(contents);\n } catch (e) {\n throw new Error('Error parsing Budget.yull file');\n }\n\n return actual.runImport(budgetName, () => doImport(data));\n}\n\nmodule.exports = { importBuffer };\n","function amountToInteger(n) {\n return Math.round(n * 100) | 0;\n}\n\nfunction integerToAmount(n) {\n return parseFloat((n / 100).toFixed(2));\n}\n\nmodule.exports = { amountToInteger, integerToAmount };\n","const d = require('date-fns');\nconst uuid = require('uuid');\nconst actual = require('@actual-app/api/methods');\nconst { amountToInteger } = require('@actual-app/api/utils');\n\nfunction amountFromYnab(amount) {\n // ynabs multiplies amount by 1000 and actual by 100\n // so, this function divides by 10\n return Math.round(amount / 10);\n}\n\nfunction monthFromDate(date) {\n let parts = date.split('-');\n return parts[0] + '-' + parts[1];\n}\n\nfunction mapAccountType(type) {\n switch (type) {\n case 'cash':\n case 'checking':\n return 'checking';\n case 'creditCard':\n case 'lineOfCredit':\n return 'credit';\n case 'savings':\n return 'savings';\n case 'investmentAccount':\n return 'investment';\n case 'mortgage':\n return 'mortgage';\n default:\n return 'other';\n }\n}\n\nfunction sortByKey(arr, key) {\n return [...arr].sort((item1, item2) => {\n if (item1[key] < item2[key]) {\n return -1;\n } else if (item1[key] > item2[key]) {\n return 1;\n }\n return 0;\n });\n}\n\nfunction groupBy(arr, keyName) {\n return arr.reduce(function(obj, item) {\n var key = item[keyName];\n if (!obj.hasOwnProperty(key)) {\n obj[key] = [];\n }\n obj[key].push(item);\n return obj;\n }, {});\n}\n\nfunction importAccounts(data, entityIdMap) {\n return Promise.all(\n data.accounts.map(async account => {\n if (!account.deleted) {\n let id = await actual.createAccount({\n type: mapAccountType(account.type),\n name: account.name,\n offbudget: account.on_budget ? false : true,\n closed: account.closed\n });\n entityIdMap.set(account.id, id);\n }\n })\n );\n}\n\nasync function importCategories(data, entityIdMap) {\n // Hidden categories are put in its own group by YNAB,\n // so it's already handled.\n\n const categories = await actual.getCategories();\n const incomeCatId = categories.find(cat => cat.name === 'Income').id;\n const ynabIncomeCategories = ['To be Budgeted', 'Inflow: Ready to Assign'];\n\n function checkSpecialCat(cat) {\n if (\n cat.category_group_id ===\n data.category_groups.find(\n group => group.name === 'Internal Master Category'\n ).id\n ) {\n if (ynabIncomeCategories.includes(cat.name)) {\n return 'income';\n } else {\n return 'internal';\n }\n } else if (\n cat.category_group_id ===\n data.category_groups.find(group => group.name === 'Credit Card Payments')\n .id\n ) {\n return 'creditCard';\n }\n }\n // Can't be done in parallel to have\n // correct sort order.\n\n for (let group of data.category_groups) {\n if (!group.deleted) {\n // Ignores internal category and credit cards\n if (\n group.name !== 'Internal Master Category' &&\n group.name !== 'Credit Card Payments'\n ) {\n var groupId = await actual.createCategoryGroup({\n name: group.name,\n is_income: false\n });\n entityIdMap.set(group.id, groupId);\n }\n\n let cats = data.categories.filter(\n cat => cat.category_group_id === group.id\n );\n\n for (let cat of cats.reverse()) {\n if (!cat.deleted) {\n let newCategory = {};\n newCategory.name = cat.name;\n\n // Handles special categories. Starting balance is a payee\n // in YNAB so it's handled in importTransactions\n switch (checkSpecialCat(cat)) {\n case 'income': {\n // doesn't create new category, only assigns id\n let id = incomeCatId;\n entityIdMap.set(cat.id, id);\n break;\n }\n case 'creditCard': // ignores it\n case 'internal': // uncategorized is ignored too, handled by actual\n break;\n default: {\n newCategory.group_id = groupId;\n let id = await actual.createCategory(newCategory);\n entityIdMap.set(cat.id, id);\n break;\n }\n }\n }\n }\n }\n }\n}\n\nfunction importPayees(data, entityIdMap) {\n return Promise.all(\n data.payees.map(async payee => {\n if (!payee.deleted) {\n let id = await actual.createPayee({\n name: payee.name\n });\n entityIdMap.set(payee.id, id);\n }\n })\n );\n}\n\nasync function importTransactions(data, entityIdMap) {\n const payees = await actual.getPayees();\n const categories = await actual.getCategories();\n const incomeCatId = categories.find(cat => cat.name === 'Income').id;\n const startingBalanceCatId = categories.find(\n cat => cat.name === 'Starting Balances'\n ).id; //better way to do it?\n const startingPayeeYNAB = data.payees.find(\n payee => payee.name === 'Starting Balance'\n ).id;\n\n let transactionsGrouped = groupBy(data.transactions, 'account_id');\n let subtransactionsGrouped = groupBy(data.subtransactions, 'transaction_id');\n\n // Go ahead and generate ids for all of the transactions so we can\n // reliably resolve transfers\n for (let transaction of data.transactions) {\n entityIdMap.set(transaction.id, uuid.v4());\n }\n\n await Promise.all(\n Object.keys(transactionsGrouped).map(async accountId => {\n let transactions = transactionsGrouped[accountId];\n\n let toImport = transactions\n .map(transaction => {\n if (transaction.deleted) {\n return null;\n }\n\n // Handle subtransactions\n let subtransactions = subtransactionsGrouped[transaction.id];\n if (subtransactions) {\n subtransactions = subtransactions.map(subtrans => {\n return {\n amount: amountFromYnab(subtrans.amount),\n category: entityIdMap.get(subtrans.category_id) || null,\n notes: subtrans.memo\n };\n });\n }\n\n // Add transaction\n let newTransaction = {\n id: entityIdMap.get(transaction.id),\n account: entityIdMap.get(transaction.account_id),\n date: transaction.date,\n amount: amountFromYnab(transaction.amount),\n category: entityIdMap.get(transaction.category_id) || null,\n cleared: ['cleared', 'reconciled'].includes(transaction.cleared),\n notes: transaction.memo || null,\n imported_id: transaction.import_id || null,\n transfer_id:\n entityIdMap.get(transaction.transfer_transaction_id) || null,\n subtransactions: subtransactions\n };\n\n // Handle transfer payee\n if (transaction.transfer_account_id) {\n newTransaction.payee = payees.find(\n p =>\n p.transfer_acct ===\n entityIdMap.get(transaction.transfer_account_id)\n ).id;\n } else {\n newTransaction.payee = entityIdMap.get(transaction.payee_id);\n }\n\n // Handle starting balances\n if (\n transaction.payee_id === startingPayeeYNAB &&\n entityIdMap.get(transaction.category_id) === incomeCatId\n ) {\n newTransaction.category = startingBalanceCatId;\n newTransaction.payee = null;\n }\n return newTransaction;\n })\n .filter(x => x);\n\n await actual.addTransactions(entityIdMap.get(accountId), toImport);\n })\n );\n}\n\nasync function importBudgets(data, entityIdMap) {\n // There should be info in the docs to deal with\n // no credit card category and how YNAB and Actual\n // handle differently the amount To be Budgeted\n // i.e. Actual considers the cc debt while YNAB doesn't\n //\n // Also, there could be a way to set rollover using\n // Deferred Income Subcat and Immediate Income Subcat\n\n let budgets = sortByKey(data.months, 'month');\n\n const internalCatIdYnab = data.category_groups.find(\n group => group.name === 'Internal Master Category'\n ).id;\n const creditcardCatIdYnab = data.category_groups.find(\n group => group.name === 'Credit Card Payments'\n ).id;\n\n await actual.batchBudgetUpdates(async () => {\n for (let budget of budgets) {\n let month = monthFromDate(budget.month);\n\n await Promise.all(\n budget.categories.map(async catBudget => {\n let catId = entityIdMap.get(catBudget.id);\n let amount = catBudget.budgeted / 10;\n\n if (\n !catId ||\n catBudget.category_group_id === internalCatIdYnab ||\n catBudget.category_group_id === creditcardCatIdYnab\n ) {\n return;\n }\n\n await actual.setBudgetAmount(month, catId, amount);\n })\n );\n }\n });\n}\n\n// Utils\n\nasync function doImport(data) {\n const entityIdMap = new Map();\n\n console.log('Importing Accounts...');\n await importAccounts(data, entityIdMap);\n\n console.log('Importing Categories...');\n await importCategories(data, entityIdMap);\n\n console.log('Importing Payees...');\n await importPayees(data, entityIdMap);\n\n console.log('Importing Transactions...');\n await importTransactions(data, entityIdMap);\n\n console.log('Importing Budgets...');\n await importBudgets(data, entityIdMap);\n\n console.log('Setting up...');\n}\n\nasync function importYNAB5(data) {\n if (data.data) {\n data = data.data;\n }\n\n return actual.runImport(data.budget.name, () => doImport(data.budget));\n}\n\nmodule.exports = { importYNAB5 };\n","function amountToInteger(n) {\n return Math.round(n * 100) | 0;\n}\n\nfunction integerToAmount(n) {\n return parseFloat((n / 100).toFixed(2));\n}\n\nmodule.exports = { amountToInteger, integerToAmount };\n","export default async function runMigration(db, uuid) {\n function getValue(node) {\n return node.expr != null ? node.expr : node.cachedValue;\n }\n\n db.execQuery(`\nCREATE TABLE zero_budget_months\n (id TEXT PRIMARY KEY,\n buffered INTEGER DEFAULT 0); \n\nCREATE TABLE zero_budgets\n (id TEXT PRIMARY KEY,\n month INTEGER,\n category TEXT,\n amount INTEGER DEFAULT 0,\n carryover INTEGER DEFAULT 0);\n\nCREATE TABLE reflect_budgets\n (id TEXT PRIMARY KEY,\n month INTEGER,\n category TEXT,\n amount INTEGER DEFAULT 0,\n carryover INTEGER DEFAULT 0);\n\nCREATE TABLE notes\n (id TEXT PRIMARY KEY,\n note TEXT);\n\nCREATE TABLE kvcache (key TEXT PRIMARY KEY, value TEXT);\nCREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);\n`);\n\n // Migrate budget amounts and carryover\n let budget = db.runQuery(\n `SELECT * FROM spreadsheet_cells WHERE name LIKE 'budget%!budget-%'`,\n [],\n true\n );\n db.transaction(() => {\n budget.map(monthBudget => {\n let match = monthBudget.name.match(\n /^(budget-report|budget)(\\d+)!budget-(.+)$/\n );\n if (match == null) {\n console.log('Warning: invalid budget month name', monthBudget.name);\n return;\n }\n\n let type = match[1];\n let month = match[2].slice(0, 4) + '-' + match[2].slice(4);\n let dbmonth = parseInt(match[2]);\n let cat = match[3];\n\n let amount = parseInt(getValue(monthBudget));\n if (isNaN(amount)) {\n amount = 0;\n }\n\n let sheetName = monthBudget.name.split('!')[0];\n let carryover = db.runQuery(\n 'SELECT * FROM spreadsheet_cells WHERE name = ?',\n [`${sheetName}!carryover-${cat}`],\n true\n );\n\n let table = type === 'budget-report' ? 'reflect_budgets' : 'zero_budgets';\n db.runQuery(\n `INSERT INTO ${table} (id, month, category, amount, carryover) VALUES (?, ?, ?, ?, ?)`,\n [\n `${month}-${cat}`,\n dbmonth,\n cat,\n amount,\n carryover.length > 0 && getValue(carryover[0]) === 'true' ? 1 : 0\n ]\n );\n });\n });\n\n // Migrate buffers\n let buffers = db.runQuery(\n `SELECT * FROM spreadsheet_cells WHERE name LIKE 'budget%!buffered'`,\n [],\n true\n );\n db.transaction(() => {\n buffers.map(buffer => {\n let match = buffer.name.match(/^budget(\\d+)!buffered$/);\n if (match) {\n let month = match[1].slice(0, 4) + '-' + match[1].slice(4);\n let amount = parseInt(getValue(buffer));\n if (isNaN(amount)) {\n amount = 0;\n }\n\n db.runQuery(\n `INSERT INTO zero_budget_months (id, buffered) VALUES (?, ?)`,\n [month, amount]\n );\n }\n });\n });\n\n // Migrate notes\n let notes = db.runQuery(\n `SELECT * FROM spreadsheet_cells WHERE name LIKE 'notes!%'`,\n [],\n true\n );\n\n let parseNote = str => {\n try {\n let value = JSON.parse(str);\n return value && value !== '' ? value : null;\n } catch (e) {\n return null;\n }\n };\n\n db.transaction(() => {\n notes.forEach(note => {\n let parsed = parseNote(getValue(note));\n if (parsed) {\n let [, id] = note.name.split('!');\n db.runQuery(`INSERT INTO notes (id, note) VALUES (?, ?)`, [id, parsed]);\n }\n });\n });\n\n db.execQuery(`\n DROP TABLE spreadsheet_cells;\n ANALYZE;\n VACUUM;\n `);\n}\n","var Utils = require(\"./util\");\nvar fs = Utils.FileSystem.require(),\n\tpth = require(\"path\");\n\nfs.existsSync = fs.existsSync || pth.existsSync;\n\nvar ZipEntry = require(\"./zipEntry\"),\n\tZipFile = require(\"./zipFile\");\n\nvar isWin = /^win/.test(process.platform);\n\n\nmodule.exports = function (/*String*/input) {\n\tvar _zip = undefined,\n\t\t_filename = \"\";\n\n\tif (input && typeof input === \"string\") { // load zip file\n\t\tif (fs.existsSync(input)) {\n\t\t\t_filename = input;\n\t\t\t_zip = new ZipFile(input, Utils.Constants.FILE);\n\t\t} else {\n\t\t\tthrow Utils.Errors.INVALID_FILENAME;\n\t\t}\n\t} else if (input && Buffer.isBuffer(input)) { // load buffer\n\t\t_zip = new ZipFile(input, Utils.Constants.BUFFER);\n\t} else { // create new zip file\n\t\t_zip = new ZipFile(null, Utils.Constants.NONE);\n\t}\n\n\tfunction sanitize(prefix, name) {\n\t\tprefix = pth.resolve(pth.normalize(prefix));\n\t\tvar parts = name.split('/');\n\t\tfor (var i = 0, l = parts.length; i < l; i++) {\n\t\t\tvar path = pth.normalize(pth.join(prefix, parts.slice(i, l).join(pth.sep)));\n\t\t\tif (path.indexOf(prefix) === 0) {\n\t\t\t\treturn path;\n\t\t\t}\n\t\t}\n\t\treturn pth.normalize(pth.join(prefix, pth.basename(name)));\n\t}\n\n\tfunction getEntry(/*Object*/entry) {\n\t\tif (entry && _zip) {\n\t\t\tvar item;\n\t\t\t// If entry was given as a file name\n\t\t\tif (typeof entry === \"string\")\n\t\t\t\titem = _zip.getEntry(entry);\n\t\t\t// if entry was given as a ZipEntry object\n\t\t\tif (typeof entry === \"object\" && typeof entry.entryName !== \"undefined\" && typeof entry.header !== \"undefined\")\n\t\t\t\titem = _zip.getEntry(entry.entryName);\n\n\t\t\tif (item) {\n\t\t\t\treturn item;\n\t\t\t}\n\t\t}\n\t\treturn null;\n\t}\n\n\treturn {\n\t\t/**\n\t\t * Extracts the given entry from the archive and returns the content as a Buffer object\n\t\t * @param entry ZipEntry object or String with the full path of the entry\n\t\t *\n\t\t * @return Buffer or Null in case of error\n\t\t */\n\t\treadFile: function (/*Object*/entry) {\n\t\t\tvar item = getEntry(entry);\n\t\t\treturn item && item.getData() || null;\n\t\t},\n\n\t\t/**\n\t\t * Asynchronous readFile\n\t\t * @param entry ZipEntry object or String with the full path of the entry\n\t\t * @param callback\n\t\t *\n\t\t * @return Buffer or Null in case of error\n\t\t */\n\t\treadFileAsync: function (/*Object*/entry, /*Function*/callback) {\n\t\t\tvar item = getEntry(entry);\n\t\t\tif (item) {\n\t\t\t\titem.getDataAsync(callback);\n\t\t\t} else {\n\t\t\t\tcallback(null, \"getEntry failed for:\" + entry)\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Extracts the given entry from the archive and returns the content as plain text in the given encoding\n\t\t * @param entry ZipEntry object or String with the full path of the entry\n\t\t * @param encoding Optional. If no encoding is specified utf8 is used\n\t\t *\n\t\t * @return String\n\t\t */\n\t\treadAsText: function (/*Object*/entry, /*String - Optional*/encoding) {\n\t\t\tvar item = getEntry(entry);\n\t\t\tif (item) {\n\t\t\t\tvar data = item.getData();\n\t\t\t\tif (data && data.length) {\n\t\t\t\t\treturn data.toString(encoding || \"utf8\");\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn \"\";\n\t\t},\n\n\t\t/**\n\t\t * Asynchronous readAsText\n\t\t * @param entry ZipEntry object or String with the full path of the entry\n\t\t * @param callback\n\t\t * @param encoding Optional. If no encoding is specified utf8 is used\n\t\t *\n\t\t * @return String\n\t\t */\n\t\treadAsTextAsync: function (/*Object*/entry, /*Function*/callback, /*String - Optional*/encoding) {\n\t\t\tvar item = getEntry(entry);\n\t\t\tif (item) {\n\t\t\t\titem.getDataAsync(function (data, err) {\n\t\t\t\t\tif (err) {\n\t\t\t\t\t\tcallback(data, err);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (data && data.length) {\n\t\t\t\t\t\tcallback(data.toString(encoding || \"utf8\"));\n\t\t\t\t\t} else {\n\t\t\t\t\t\tcallback(\"\");\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t} else {\n\t\t\t\tcallback(\"\");\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Remove the entry from the file or the entry and all it's nested directories and files if the given entry is a directory\n\t\t *\n\t\t * @param entry\n\t\t */\n\t\tdeleteFile: function (/*Object*/entry) { // @TODO: test deleteFile\n\t\t\tvar item = getEntry(entry);\n\t\t\tif (item) {\n\t\t\t\t_zip.deleteEntry(item.entryName);\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Adds a comment to the zip. The zip must be rewritten after adding the comment.\n\t\t *\n\t\t * @param comment\n\t\t */\n\t\taddZipComment: function (/*String*/comment) { // @TODO: test addZipComment\n\t\t\t_zip.comment = comment;\n\t\t},\n\n\t\t/**\n\t\t * Returns the zip comment\n\t\t *\n\t\t * @return String\n\t\t */\n\t\tgetZipComment: function () {\n\t\t\treturn _zip.comment || '';\n\t\t},\n\n\t\t/**\n\t\t * Adds a comment to a specified zipEntry. The zip must be rewritten after adding the comment\n\t\t * The comment cannot exceed 65535 characters in length\n\t\t *\n\t\t * @param entry\n\t\t * @param comment\n\t\t */\n\t\taddZipEntryComment: function (/*Object*/entry, /*String*/comment) {\n\t\t\tvar item = getEntry(entry);\n\t\t\tif (item) {\n\t\t\t\titem.comment = comment;\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Returns the comment of the specified entry\n\t\t *\n\t\t * @param entry\n\t\t * @return String\n\t\t */\n\t\tgetZipEntryComment: function (/*Object*/entry) {\n\t\t\tvar item = getEntry(entry);\n\t\t\tif (item) {\n\t\t\t\treturn item.comment || '';\n\t\t\t}\n\t\t\treturn ''\n\t\t},\n\n\t\t/**\n\t\t * Updates the content of an existing entry inside the archive. The zip must be rewritten after updating the content\n\t\t *\n\t\t * @param entry\n\t\t * @param content\n\t\t */\n\t\tupdateFile: function (/*Object*/entry, /*Buffer*/content) {\n\t\t\tvar item = getEntry(entry);\n\t\t\tif (item) {\n\t\t\t\titem.setData(content);\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Adds a file from the disk to the archive\n\t\t *\n\t\t * @param localPath File to add to zip\n\t\t * @param zipPath Optional path inside the zip\n\t\t * @param zipName Optional name for the file\n\t\t */\n\t\taddLocalFile: function (/*String*/localPath, /*String*/zipPath, /*String*/zipName) {\n\t\t\tif (fs.existsSync(localPath)) {\n\t\t\t\tif (zipPath) {\n\t\t\t\t\tzipPath = zipPath.split(\"\\\\\").join(\"/\");\n\t\t\t\t\tif (zipPath.charAt(zipPath.length - 1) !== \"/\") {\n\t\t\t\t\t\tzipPath += \"/\";\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tzipPath = \"\";\n\t\t\t\t}\n\t\t\t\tvar p = localPath.split(\"\\\\\").join(\"/\").split(\"/\").pop();\n\n\t\t\t\tif (zipName) {\n\t\t\t\t\tthis.addFile(zipPath + zipName, fs.readFileSync(localPath), \"\", 0)\n\t\t\t\t} else {\n\t\t\t\t\tthis.addFile(zipPath + p, fs.readFileSync(localPath), \"\", 0)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tthrow Utils.Errors.FILE_NOT_FOUND.replace(\"%s\", localPath);\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Adds a local directory and all its nested files and directories to the archive\n\t\t *\n\t\t * @param localPath\n\t\t * @param zipPath optional path inside zip\n\t\t * @param filter optional RegExp or Function if files match will\n\t\t * be included.\n\t\t */\n\t\taddLocalFolder: function (/*String*/localPath, /*String*/zipPath, /*RegExp|Function*/filter) {\n\t\t\tif (filter === undefined) {\n\t\t\t\tfilter = function () {\n\t\t\t\t\treturn true;\n\t\t\t\t};\n\t\t\t} else if (filter instanceof RegExp) {\n\t\t\t\tfilter = function (filter) {\n\t\t\t\t\treturn function (filename) {\n\t\t\t\t\t\treturn filter.test(filename);\n\t\t\t\t\t}\n\t\t\t\t}(filter);\n\t\t\t}\n\n\t\t\tif (zipPath) {\n\t\t\t\tzipPath = zipPath.split(\"\\\\\").join(\"/\");\n\t\t\t\tif (zipPath.charAt(zipPath.length - 1) !== \"/\") {\n\t\t\t\t\tzipPath += \"/\";\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tzipPath = \"\";\n\t\t\t}\n\t\t\t// normalize the path first\n\t\t\tlocalPath = pth.normalize(localPath);\n\t\t\tlocalPath = localPath.split(\"\\\\\").join(\"/\"); //windows fix\n\t\t\tif (localPath.charAt(localPath.length - 1) !== \"/\")\n\t\t\t\tlocalPath += \"/\";\n\n\t\t\tif (fs.existsSync(localPath)) {\n\n\t\t\t\tvar items = Utils.findFiles(localPath),\n\t\t\t\t\tself = this;\n\n\t\t\t\tif (items.length) {\n\t\t\t\t\titems.forEach(function (path) {\n\t\t\t\t\t\tvar p = path.split(\"\\\\\").join(\"/\").replace(new RegExp(localPath.replace(/(\\(|\\))/g, '\\\\$1'), 'i'), \"\"); //windows fix\n\t\t\t\t\t\tif (filter(p)) {\n\t\t\t\t\t\t\tif (p.charAt(p.length - 1) !== \"/\") {\n\t\t\t\t\t\t\t\tself.addFile(zipPath + p, fs.readFileSync(path), \"\", 0)\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tself.addFile(zipPath + p, Buffer.alloc(0), \"\", 0)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tthrow Utils.Errors.FILE_NOT_FOUND.replace(\"%s\", localPath);\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Allows you to create a entry (file or directory) in the zip file.\n\t\t * If you want to create a directory the entryName must end in / and a null buffer should be provided.\n\t\t * Comment and attributes are optional\n\t\t *\n\t\t * @param entryName\n\t\t * @param content\n\t\t * @param comment\n\t\t * @param attr\n\t\t */\n\t\taddFile: function (/*String*/entryName, /*Buffer*/content, /*String*/comment, /*Number*/attr) {\n\t\t\tvar entry = new ZipEntry();\n\t\t\tentry.entryName = entryName;\n\t\t\tentry.comment = comment || \"\";\n\n\t\t\tif (!attr) {\n\t\t\t\tif (entry.isDirectory) {\n\t\t\t\t\tattr = (0o40755 << 16) | 0x10; // (permissions drwxr-xr-x) + (MS-DOS directory flag)\n\t\t\t\t} else {\n\t\t\t\t\tattr = 0o644 << 16; // permissions -r-wr--r--\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tentry.attr = attr;\n\n\t\t\tentry.setData(content);\n\t\t\t_zip.setEntry(entry);\n\t\t},\n\n\t\t/**\n\t\t * Returns an array of ZipEntry objects representing the files and folders inside the archive\n\t\t *\n\t\t * @return Array\n\t\t */\n\t\tgetEntries: function () {\n\t\t\tif (_zip) {\n\t\t\t\treturn _zip.entries;\n\t\t\t} else {\n\t\t\t\treturn [];\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Returns a ZipEntry object representing the file or folder specified by ``name``.\n\t\t *\n\t\t * @param name\n\t\t * @return ZipEntry\n\t\t */\n\t\tgetEntry: function (/*String*/name) {\n\t\t\treturn getEntry(name);\n\t\t},\n\n\t\t/**\n\t\t * Extracts the given entry to the given targetPath\n\t\t * If the entry is a directory inside the archive, the entire directory and it's subdirectories will be extracted\n\t\t *\n\t\t * @param entry ZipEntry object or String with the full path of the entry\n\t\t * @param targetPath Target folder where to write the file\n\t\t * @param maintainEntryPath If maintainEntryPath is true and the entry is inside a folder, the entry folder\n\t\t * will be created in targetPath as well. Default is TRUE\n\t\t * @param overwrite If the file already exists at the target path, the file will be overwriten if this is true.\n\t\t * Default is FALSE\n\t\t *\n\t\t * @return Boolean\n\t\t */\n\t\textractEntryTo: function (/*Object*/entry, /*String*/targetPath, /*Boolean*/maintainEntryPath, /*Boolean*/overwrite) {\n\t\t\toverwrite = overwrite || false;\n\t\t\tmaintainEntryPath = typeof maintainEntryPath === \"undefined\" ? true : maintainEntryPath;\n\n\t\t\tvar item = getEntry(entry);\n\t\t\tif (!item) {\n\t\t\t\tthrow Utils.Errors.NO_ENTRY;\n\t\t\t}\n\n\t\t\tvar entryName = item.entryName;\n\n\t\t\tvar target = sanitize(targetPath, maintainEntryPath ? entryName : pth.basename(entryName));\n\n\t\t\tif (item.isDirectory) {\n\t\t\t\ttarget = pth.resolve(target, \"..\");\n\t\t\t\tvar children = _zip.getEntryChildren(item);\n\t\t\t\tchildren.forEach(function (child) {\n\t\t\t\t\tif (child.isDirectory) return;\n\t\t\t\t\tvar content = child.getData();\n\t\t\t\t\tif (!content) {\n\t\t\t\t\t\tthrow Utils.Errors.CANT_EXTRACT_FILE;\n\t\t\t\t\t}\n\t\t\t\t\tvar childName = sanitize(targetPath, maintainEntryPath ? child.entryName : pth.basename(child.entryName));\n\n\t\t\t\t\tUtils.writeFileTo(childName, content, overwrite);\n\t\t\t\t});\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\tvar content = item.getData();\n\t\t\tif (!content) throw Utils.Errors.CANT_EXTRACT_FILE;\n\n\t\t\tif (fs.existsSync(target) && !overwrite) {\n\t\t\t\tthrow Utils.Errors.CANT_OVERRIDE;\n\t\t\t}\n\t\t\tUtils.writeFileTo(target, content, overwrite);\n\n\t\t\treturn true;\n\t\t},\n\n\t\t/**\n\t\t * Test the archive\n\t\t *\n\t\t */\n\t\ttest: function () {\n\t\t\tif (!_zip) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tfor (var entry in _zip.entries) {\n\t\t\t\ttry {\n\t\t\t\t\tif (entry.isDirectory) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tvar content = _zip.entries[entry].getData();\n\t\t\t\t\tif (!content) {\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t} catch (err) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn true;\n\t\t},\n\n\t\t/**\n\t\t * Extracts the entire archive to the given location\n\t\t *\n\t\t * @param targetPath Target location\n\t\t * @param overwrite If the file already exists at the target path, the file will be overwriten if this is true.\n\t\t * Default is FALSE\n\t\t */\n\t\textractAllTo: function (/*String*/targetPath, /*Boolean*/overwrite) {\n\t\t\toverwrite = overwrite || false;\n\t\t\tif (!_zip) {\n\t\t\t\tthrow Utils.Errors.NO_ZIP;\n\t\t\t}\n\t\t\t_zip.entries.forEach(function (entry) {\n\t\t\t\tvar entryName = sanitize(targetPath, entry.entryName.toString());\n\t\t\t\tif (entry.isDirectory) {\n\t\t\t\t\tUtils.makeDir(entryName);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tvar content = entry.getData();\n\t\t\t\tif (!content) {\n\t\t\t\t\tthrow Utils.Errors.CANT_EXTRACT_FILE;\n\t\t\t\t}\n\t\t\t\tUtils.writeFileTo(entryName, content, overwrite);\n\t\t\t\ttry {\n\t\t\t\t\tfs.utimesSync(entryName, entry.header.time, entry.header.time)\n\t\t\t\t} catch (err) {\n\t\t\t\t\tthrow Utils.Errors.CANT_EXTRACT_FILE;\n\t\t\t\t}\n\t\t\t})\n\t\t},\n\n\t\t/**\n\t\t * Asynchronous extractAllTo\n\t\t *\n\t\t * @param targetPath Target location\n\t\t * @param overwrite If the file already exists at the target path, the file will be overwriten if this is true.\n\t\t * Default is FALSE\n\t\t * @param callback\n\t\t */\n\t\textractAllToAsync: function (/*String*/targetPath, /*Boolean*/overwrite, /*Function*/callback) {\n\t\t\tif (!callback) {\n\t\t\t\tcallback = function() {}\n\t\t\t}\n\t\t\toverwrite = overwrite || false;\n\t\t\tif (!_zip) {\n\t\t\t\tcallback(new Error(Utils.Errors.NO_ZIP));\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tvar entries = _zip.entries;\n\t\t\tvar i = entries.length;\n\t\t\tentries.forEach(function (entry) {\n\t\t\t\tif (i <= 0) return; // Had an error already\n\n\t\t\t\tvar entryName = pth.normalize(entry.entryName.toString());\n\n\t\t\t\tif (entry.isDirectory) {\n\t\t\t\t\tUtils.makeDir(sanitize(targetPath, entryName));\n\t\t\t\t\tif (--i === 0)\n\t\t\t\t\t\tcallback(undefined);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tentry.getDataAsync(function (content, err) {\n\t\t\t\t\tif (i <= 0) return;\n\t\t\t\t\tif (err) {\n\t\t\t\t\t\tcallback(new Error(err));\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tif (!content) {\n\t\t\t\t\t\ti = 0;\n\t\t\t\t\t\tcallback(new Error(Utils.Errors.CANT_EXTRACT_FILE));\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tUtils.writeFileToAsync(sanitize(targetPath, entryName), content, overwrite, function (succ) {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tfs.utimesSync(pth.resolve(targetPath, entryName), entry.header.time, entry.header.time);\n\t\t\t\t\t\t} catch (err) {\n\t\t\t\t\t\t\tcallback(new Error('Unable to set utimes'));\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (i <= 0) return;\n\t\t\t\t\t\tif (!succ) {\n\t\t\t\t\t\t\ti = 0;\n\t\t\t\t\t\t\tcallback(new Error('Unable to write'));\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (--i === 0)\n\t\t\t\t\t\t\tcallback(undefined);\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t})\n\t\t},\n\n\t\t/**\n\t\t * Writes the newly created zip file to disk at the specified location or if a zip was opened and no ``targetFileName`` is provided, it will overwrite the opened zip\n\t\t *\n\t\t * @param targetFileName\n\t\t * @param callback\n\t\t */\n\t\twriteZip: function (/*String*/targetFileName, /*Function*/callback) {\n\t\t\tif (arguments.length === 1) {\n\t\t\t\tif (typeof targetFileName === \"function\") {\n\t\t\t\t\tcallback = targetFileName;\n\t\t\t\t\ttargetFileName = \"\";\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (!targetFileName && _filename) {\n\t\t\t\ttargetFileName = _filename;\n\t\t\t}\n\t\t\tif (!targetFileName) return;\n\n\t\t\tvar zipData = _zip.compressToBuffer();\n\t\t\tif (zipData) {\n\t\t\t\tvar ok = Utils.writeFileTo(targetFileName, zipData, true);\n\t\t\t\tif (typeof callback === 'function') callback(!ok ? new Error(\"failed\") : null, \"\");\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Returns the content of the entire zip file as a Buffer object\n\t\t *\n\t\t * @return Buffer\n\t\t */\n\t\ttoBuffer: function (/*Function*/onSuccess, /*Function*/onFail, /*Function*/onItemStart, /*Function*/onItemEnd) {\n\t\t\tthis.valueOf = 2;\n\t\t\tif (typeof onSuccess === \"function\") {\n\t\t\t\t_zip.toAsyncBuffer(onSuccess, onFail, onItemStart, onItemEnd);\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\treturn _zip.compressToBuffer()\n\t\t}\n\t}\n};\n","var Utils = require(\"../util\"),\n Constants = Utils.Constants;\n\n/* The central directory file header */\nmodule.exports = function () {\n var _verMade = 0x0A,\n _version = 0x0A,\n _flags = 0,\n _method = 0,\n _time = 0,\n _crc = 0,\n _compressedSize = 0,\n _size = 0,\n _fnameLen = 0,\n _extraLen = 0,\n\n _comLen = 0,\n _diskStart = 0,\n _inattr = 0,\n _attr = 0,\n _offset = 0;\n\n var _dataHeader = {};\n\n function setTime(val) {\n val = new Date(val);\n _time = (val.getFullYear() - 1980 & 0x7f) << 25 // b09-16 years from 1980\n | (val.getMonth() + 1) << 21 // b05-08 month\n | val.getDate() << 16 // b00-04 hour\n\n // 2 bytes time\n | val.getHours() << 11 // b11-15 hour\n | val.getMinutes() << 5 // b05-10 minute\n | val.getSeconds() >> 1; // b00-04 seconds divided by 2\n }\n\n setTime(+new Date());\n\n return {\n get made () { return _verMade; },\n set made (val) { _verMade = val; },\n\n get version () { return _version; },\n set version (val) { _version = val },\n\n get flags () { return _flags },\n set flags (val) { _flags = val; },\n\n get method () { return _method; },\n set method (val) { _method = val; },\n\n get time () { return new Date(\n ((_time >> 25) & 0x7f) + 1980,\n ((_time >> 21) & 0x0f) - 1,\n (_time >> 16) & 0x1f,\n (_time >> 11) & 0x1f,\n (_time >> 5) & 0x3f,\n (_time & 0x1f) << 1\n );\n },\n set time (val) {\n setTime(val);\n },\n\n get crc () { return _crc; },\n set crc (val) { _crc = val; },\n\n get compressedSize () { return _compressedSize; },\n set compressedSize (val) { _compressedSize = val; },\n\n get size () { return _size; },\n set size (val) { _size = val; },\n\n get fileNameLength () { return _fnameLen; },\n set fileNameLength (val) { _fnameLen = val; },\n\n get extraLength () { return _extraLen },\n set extraLength (val) { _extraLen = val; },\n\n get commentLength () { return _comLen },\n set commentLength (val) { _comLen = val },\n\n get diskNumStart () { return _diskStart },\n set diskNumStart (val) { _diskStart = val },\n\n get inAttr () { return _inattr },\n set inAttr (val) { _inattr = val },\n\n get attr () { return _attr },\n set attr (val) { _attr = val },\n\n get offset () { return _offset },\n set offset (val) { _offset = val },\n\n get encripted () { return (_flags & 1) === 1 },\n\n get entryHeaderSize () {\n return Constants.CENHDR + _fnameLen + _extraLen + _comLen;\n },\n\n get realDataOffset () {\n return _offset + Constants.LOCHDR + _dataHeader.fnameLen + _dataHeader.extraLen;\n },\n\n get dataHeader () {\n return _dataHeader;\n },\n\n loadDataHeaderFromBinary : function(/*Buffer*/input) {\n var data = input.slice(_offset, _offset + Constants.LOCHDR);\n // 30 bytes and should start with \"PK\\003\\004\"\n if (data.readUInt32LE(0) !== Constants.LOCSIG) {\n throw Utils.Errors.INVALID_LOC;\n }\n _dataHeader = {\n // version needed to extract\n version : data.readUInt16LE(Constants.LOCVER),\n // general purpose bit flag\n flags : data.readUInt16LE(Constants.LOCFLG),\n // compression method\n method : data.readUInt16LE(Constants.LOCHOW),\n // modification time (2 bytes time, 2 bytes date)\n time : data.readUInt32LE(Constants.LOCTIM),\n // uncompressed file crc-32 value\n crc : data.readUInt32LE(Constants.LOCCRC),\n // compressed size\n compressedSize : data.readUInt32LE(Constants.LOCSIZ),\n // uncompressed size\n size : data.readUInt32LE(Constants.LOCLEN),\n // filename length\n fnameLen : data.readUInt16LE(Constants.LOCNAM),\n // extra field length\n extraLen : data.readUInt16LE(Constants.LOCEXT)\n }\n },\n\n loadFromBinary : function(/*Buffer*/data) {\n // data should be 46 bytes and start with \"PK 01 02\"\n if (data.length !== Constants.CENHDR || data.readUInt32LE(0) !== Constants.CENSIG) {\n throw Utils.Errors.INVALID_CEN;\n }\n // version made by\n _verMade = data.readUInt16LE(Constants.CENVEM);\n // version needed to extract\n _version = data.readUInt16LE(Constants.CENVER);\n // encrypt, decrypt flags\n _flags = data.readUInt16LE(Constants.CENFLG);\n // compression method\n _method = data.readUInt16LE(Constants.CENHOW);\n // modification time (2 bytes time, 2 bytes date)\n _time = data.readUInt32LE(Constants.CENTIM);\n // uncompressed file crc-32 value\n _crc = data.readUInt32LE(Constants.CENCRC);\n // compressed size\n _compressedSize = data.readUInt32LE(Constants.CENSIZ);\n // uncompressed size\n _size = data.readUInt32LE(Constants.CENLEN);\n // filename length\n _fnameLen = data.readUInt16LE(Constants.CENNAM);\n // extra field length\n _extraLen = data.readUInt16LE(Constants.CENEXT);\n // file comment length\n _comLen = data.readUInt16LE(Constants.CENCOM);\n // volume number start\n _diskStart = data.readUInt16LE(Constants.CENDSK);\n // internal file attributes\n _inattr = data.readUInt16LE(Constants.CENATT);\n // external file attributes\n _attr = data.readUInt32LE(Constants.CENATX);\n // LOC header offset\n _offset = data.readUInt32LE(Constants.CENOFF);\n },\n\n dataHeaderToBinary : function() {\n // LOC header size (30 bytes)\n var data = Buffer.alloc(Constants.LOCHDR);\n // \"PK\\003\\004\"\n data.writeUInt32LE(Constants.LOCSIG, 0);\n // version needed to extract\n data.writeUInt16LE(_version, Constants.LOCVER);\n // general purpose bit flag\n data.writeUInt16LE(_flags, Constants.LOCFLG);\n // compression method\n data.writeUInt16LE(_method, Constants.LOCHOW);\n // modification time (2 bytes time, 2 bytes date)\n data.writeUInt32LE(_time, Constants.LOCTIM);\n // uncompressed file crc-32 value\n data.writeUInt32LE(_crc, Constants.LOCCRC);\n // compressed size\n data.writeUInt32LE(_compressedSize, Constants.LOCSIZ);\n // uncompressed size\n data.writeUInt32LE(_size, Constants.LOCLEN);\n // filename length\n data.writeUInt16LE(_fnameLen, Constants.LOCNAM);\n // extra field length\n data.writeUInt16LE(_extraLen, Constants.LOCEXT);\n return data;\n },\n\n entryHeaderToBinary : function() {\n // CEN header size (46 bytes)\n var data = Buffer.alloc(Constants.CENHDR + _fnameLen + _extraLen + _comLen);\n // \"PK\\001\\002\"\n data.writeUInt32LE(Constants.CENSIG, 0);\n // version made by\n data.writeUInt16LE(_verMade, Constants.CENVEM);\n // version needed to extract\n data.writeUInt16LE(_version, Constants.CENVER);\n // encrypt, decrypt flags\n data.writeUInt16LE(_flags, Constants.CENFLG);\n // compression method\n data.writeUInt16LE(_method, Constants.CENHOW);\n // modification time (2 bytes time, 2 bytes date)\n data.writeUInt32LE(_time, Constants.CENTIM);\n // uncompressed file crc-32 value\n data.writeUInt32LE(_crc, Constants.CENCRC);\n // compressed size\n data.writeUInt32LE(_compressedSize, Constants.CENSIZ);\n // uncompressed size\n data.writeUInt32LE(_size, Constants.CENLEN);\n // filename length\n data.writeUInt16LE(_fnameLen, Constants.CENNAM);\n // extra field length\n data.writeUInt16LE(_extraLen, Constants.CENEXT);\n // file comment length\n data.writeUInt16LE(_comLen, Constants.CENCOM);\n // volume number start\n data.writeUInt16LE(_diskStart, Constants.CENDSK);\n // internal file attributes\n data.writeUInt16LE(_inattr, Constants.CENATT);\n // external file attributes\n data.writeUInt32LE(_attr, Constants.CENATX);\n // LOC header offset\n data.writeUInt32LE(_offset, Constants.CENOFF);\n // fill all with\n data.fill(0x00, Constants.CENHDR);\n return data;\n },\n\n toString : function() {\n return '{\\n' +\n '\\t\"made\" : ' + _verMade + \",\\n\" +\n '\\t\"version\" : ' + _version + \",\\n\" +\n '\\t\"flags\" : ' + _flags + \",\\n\" +\n '\\t\"method\" : ' + Utils.methodToString(_method) + \",\\n\" +\n '\\t\"time\" : ' + this.time + \",\\n\" +\n '\\t\"crc\" : 0x' + _crc.toString(16).toUpperCase() + \",\\n\" +\n '\\t\"compressedSize\" : ' + _compressedSize + \" bytes,\\n\" +\n '\\t\"size\" : ' + _size + \" bytes,\\n\" +\n '\\t\"fileNameLength\" : ' + _fnameLen + \",\\n\" +\n '\\t\"extraLength\" : ' + _extraLen + \" bytes,\\n\" +\n '\\t\"commentLength\" : ' + _comLen + \" bytes,\\n\" +\n '\\t\"diskNumStart\" : ' + _diskStart + \",\\n\" +\n '\\t\"inAttr\" : ' + _inattr + \",\\n\" +\n '\\t\"attr\" : ' + _attr + \",\\n\" +\n '\\t\"offset\" : ' + _offset + \",\\n\" +\n '\\t\"entryHeaderSize\" : ' + (Constants.CENHDR + _fnameLen + _extraLen + _comLen) + \" bytes\\n\" +\n '}';\n }\n }\n};\n","exports.EntryHeader = require(\"./entryHeader\");\r\nexports.MainHeader = require(\"./mainHeader\");\r\n","var Utils = require(\"../util\"),\n Constants = Utils.Constants;\n\n/* The entries in the end of central directory */\nmodule.exports = function () {\n var _volumeEntries = 0,\n _totalEntries = 0,\n _size = 0,\n _offset = 0,\n _commentLength = 0;\n\n return {\n get diskEntries () { return _volumeEntries },\n set diskEntries (/*Number*/val) { _volumeEntries = _totalEntries = val; },\n\n get totalEntries () { return _totalEntries },\n set totalEntries (/*Number*/val) { _totalEntries = _volumeEntries = val; },\n\n get size () { return _size },\n set size (/*Number*/val) { _size = val; },\n\n get offset () { return _offset },\n set offset (/*Number*/val) { _offset = val; },\n\n get commentLength () { return _commentLength },\n set commentLength (/*Number*/val) { _commentLength = val; },\n\n get mainHeaderSize () {\n return Constants.ENDHDR + _commentLength;\n },\n\n loadFromBinary : function(/*Buffer*/data) {\n // data should be 22 bytes and start with \"PK 05 06\"\n if (data.length !== Constants.ENDHDR || data.readUInt32LE(0) !== Constants.ENDSIG)\n throw Utils.Errors.INVALID_END;\n\n // number of entries on this volume\n _volumeEntries = data.readUInt16LE(Constants.ENDSUB);\n // total number of entries\n _totalEntries = data.readUInt16LE(Constants.ENDTOT);\n // central directory size in bytes\n _size = data.readUInt32LE(Constants.ENDSIZ);\n // offset of first CEN header\n _offset = data.readUInt32LE(Constants.ENDOFF);\n // zip file comment length\n _commentLength = data.readUInt16LE(Constants.ENDCOM);\n },\n\n toBinary : function() {\n var b = Buffer.alloc(Constants.ENDHDR + _commentLength);\n // \"PK 05 06\" signature\n b.writeUInt32LE(Constants.ENDSIG, 0);\n b.writeUInt32LE(0, 4);\n // number of entries on this volume\n b.writeUInt16LE(_volumeEntries, Constants.ENDSUB);\n // total number of entries\n b.writeUInt16LE(_totalEntries, Constants.ENDTOT);\n // central directory size in bytes\n b.writeUInt32LE(_size, Constants.ENDSIZ);\n // offset of first CEN header\n b.writeUInt32LE(_offset, Constants.ENDOFF);\n // zip file comment length\n b.writeUInt16LE(_commentLength, Constants.ENDCOM);\n // fill comment memory with spaces so no garbage is left there\n b.fill(\" \", Constants.ENDHDR);\n\n return b;\n },\n\n toString : function() {\n return '{\\n' +\n '\\t\"diskEntries\" : ' + _volumeEntries + \",\\n\" +\n '\\t\"totalEntries\" : ' + _totalEntries + \",\\n\" +\n '\\t\"size\" : ' + _size + \" bytes,\\n\" +\n '\\t\"offset\" : 0x' + _offset.toString(16).toUpperCase() + \",\\n\" +\n '\\t\"commentLength\" : 0x' + _commentLength + \"\\n\" +\n '}';\n }\n }\n};","module.exports = function (/*Buffer*/inbuf) {\n\n var zlib = require(\"zlib\");\n \n var opts = {chunkSize: (parseInt(inbuf.length / 1024) + 1) * 1024};\n \n return {\n deflate: function () {\n return zlib.deflateRawSync(inbuf, opts);\n },\n\n deflateAsync: function (/*Function*/callback) {\n var tmp = zlib.createDeflateRaw(opts), parts = [], total = 0;\n tmp.on('data', function (data) {\n parts.push(data);\n total += data.length;\n });\n tmp.on('end', function () {\n var buf = Buffer.alloc(total), written = 0;\n buf.fill(0);\n for (var i = 0; i < parts.length; i++) {\n var part = parts[i];\n part.copy(buf, written);\n written += part.length;\n }\n callback && callback(buf);\n });\n tmp.end(inbuf);\n }\n }\n};\n","exports.Deflater = require(\"./deflater\");\r\nexports.Inflater = require(\"./inflater\");","module.exports = function (/*Buffer*/inbuf) {\n\n var zlib = require(\"zlib\");\n\n return {\n inflate: function () {\n return zlib.inflateRawSync(inbuf);\n },\n\n inflateAsync: function (/*Function*/callback) {\n var tmp = zlib.createInflateRaw(), parts = [], total = 0;\n tmp.on('data', function (data) {\n parts.push(data);\n total += data.length;\n });\n tmp.on('end', function () {\n var buf = Buffer.alloc(total), written = 0;\n buf.fill(0);\n for (var i = 0; i < parts.length; i++) {\n var part = parts[i];\n part.copy(buf, written);\n written += part.length;\n }\n callback && callback(buf);\n });\n tmp.end(inbuf);\n }\n }\n};\n","module.exports = {\r\n /* The local file header */\r\n LOCHDR : 30, // LOC header size\r\n LOCSIG : 0x04034b50, // \"PK\\003\\004\"\r\n LOCVER : 4,\t// version needed to extract\r\n LOCFLG : 6, // general purpose bit flag\r\n LOCHOW : 8, // compression method\r\n LOCTIM : 10, // modification time (2 bytes time, 2 bytes date)\r\n LOCCRC : 14, // uncompressed file crc-32 value\r\n LOCSIZ : 18, // compressed size\r\n LOCLEN : 22, // uncompressed size\r\n LOCNAM : 26, // filename length\r\n LOCEXT : 28, // extra field length\r\n\r\n /* The Data descriptor */\r\n EXTSIG : 0x08074b50, // \"PK\\007\\008\"\r\n EXTHDR : 16, // EXT header size\r\n EXTCRC : 4, // uncompressed file crc-32 value\r\n EXTSIZ : 8, // compressed size\r\n EXTLEN : 12, // uncompressed size\r\n\r\n /* The central directory file header */\r\n CENHDR : 46, // CEN header size\r\n CENSIG : 0x02014b50, // \"PK\\001\\002\"\r\n CENVEM : 4, // version made by\r\n CENVER : 6, // version needed to extract\r\n CENFLG : 8, // encrypt, decrypt flags\r\n CENHOW : 10, // compression method\r\n CENTIM : 12, // modification time (2 bytes time, 2 bytes date)\r\n CENCRC : 16, // uncompressed file crc-32 value\r\n CENSIZ : 20, // compressed size\r\n CENLEN : 24, // uncompressed size\r\n CENNAM : 28, // filename length\r\n CENEXT : 30, // extra field length\r\n CENCOM : 32, // file comment length\r\n CENDSK : 34, // volume number start\r\n CENATT : 36, // internal file attributes\r\n CENATX : 38, // external file attributes (host system dependent)\r\n CENOFF : 42, // LOC header offset\r\n\r\n /* The entries in the end of central directory */\r\n ENDHDR : 22, // END header size\r\n ENDSIG : 0x06054b50, // \"PK\\005\\006\"\r\n ENDSUB : 8, // number of entries on this disk\r\n ENDTOT : 10, // total number of entries\r\n ENDSIZ : 12, // central directory size in bytes\r\n ENDOFF : 16, // offset of first CEN header\r\n ENDCOM : 20, // zip file comment length\r\n\r\n /* Compression methods */\r\n STORED : 0, // no compression\r\n SHRUNK : 1, // shrunk\r\n REDUCED1 : 2, // reduced with compression factor 1\r\n REDUCED2 : 3, // reduced with compression factor 2\r\n REDUCED3 : 4, // reduced with compression factor 3\r\n REDUCED4 : 5, // reduced with compression factor 4\r\n IMPLODED : 6, // imploded\r\n // 7 reserved\r\n DEFLATED : 8, // deflated\r\n ENHANCED_DEFLATED: 9, // enhanced deflated\r\n PKWARE : 10,// PKWare DCL imploded\r\n // 11 reserved\r\n BZIP2 : 12, // compressed using BZIP2\r\n // 13 reserved\r\n LZMA : 14, // LZMA\r\n // 15-17 reserved\r\n IBM_TERSE : 18, // compressed using IBM TERSE\r\n IBM_LZ77 : 19, //IBM LZ77 z\r\n\r\n /* General purpose bit flag */\r\n FLG_ENC : 0, // encripted file\r\n FLG_COMP1 : 1, // compression option\r\n FLG_COMP2 : 2, // compression option\r\n FLG_DESC : 4, // data descriptor\r\n FLG_ENH : 8, // enhanced deflation\r\n FLG_STR : 16, // strong encryption\r\n FLG_LNG : 1024, // language encoding\r\n FLG_MSK : 4096, // mask header values\r\n\r\n /* Load type */\r\n FILE : 0,\r\n BUFFER : 1,\r\n NONE : 2,\r\n\r\n /* 4.5 Extensible data fields */\r\n EF_ID : 0,\r\n EF_SIZE : 2,\r\n\r\n /* Header IDs */\r\n ID_ZIP64 : 0x0001,\r\n ID_AVINFO : 0x0007,\r\n ID_PFS : 0x0008,\r\n ID_OS2 : 0x0009,\r\n ID_NTFS : 0x000a,\r\n ID_OPENVMS : 0x000c,\r\n ID_UNIX : 0x000d,\r\n ID_FORK : 0x000e,\r\n ID_PATCH : 0x000f,\r\n ID_X509_PKCS7 : 0x0014,\r\n ID_X509_CERTID_F : 0x0015,\r\n ID_X509_CERTID_C : 0x0016,\r\n ID_STRONGENC : 0x0017,\r\n ID_RECORD_MGT : 0x0018,\r\n ID_X509_PKCS7_RL : 0x0019,\r\n ID_IBM1 : 0x0065,\r\n ID_IBM2 : 0x0066,\r\n ID_POSZIP : 0x4690,\r\n\r\n EF_ZIP64_OR_32 : 0xffffffff,\r\n EF_ZIP64_OR_16 : 0xffff,\r\n EF_ZIP64_SUNCOMP : 0,\r\n EF_ZIP64_SCOMP : 8,\r\n EF_ZIP64_RHO : 16,\r\n EF_ZIP64_DSN : 24\r\n};\r\n","module.exports = {\r\n /* Header error messages */\r\n \"INVALID_LOC\" : \"Invalid LOC header (bad signature)\",\r\n \"INVALID_CEN\" : \"Invalid CEN header (bad signature)\",\r\n \"INVALID_END\" : \"Invalid END header (bad signature)\",\r\n\r\n /* ZipEntry error messages*/\r\n \"NO_DATA\" : \"Nothing to decompress\",\r\n \"BAD_CRC\" : \"CRC32 checksum failed\",\r\n \"FILE_IN_THE_WAY\" : \"There is a file in the way: %s\",\r\n \"UNKNOWN_METHOD\" : \"Invalid/unsupported compression method\",\r\n\r\n /* Inflater error messages */\r\n \"AVAIL_DATA\" : \"inflate::Available inflate data did not terminate\",\r\n \"INVALID_DISTANCE\" : \"inflate::Invalid literal/length or distance code in fixed or dynamic block\",\r\n \"TO_MANY_CODES\" : \"inflate::Dynamic block code description: too many length or distance codes\",\r\n \"INVALID_REPEAT_LEN\" : \"inflate::Dynamic block code description: repeat more than specified lengths\",\r\n \"INVALID_REPEAT_FIRST\" : \"inflate::Dynamic block code description: repeat lengths with no first length\",\r\n \"INCOMPLETE_CODES\" : \"inflate::Dynamic block code description: code lengths codes incomplete\",\r\n \"INVALID_DYN_DISTANCE\": \"inflate::Dynamic block code description: invalid distance code lengths\",\r\n \"INVALID_CODES_LEN\": \"inflate::Dynamic block code description: invalid literal/length code lengths\",\r\n \"INVALID_STORE_BLOCK\" : \"inflate::Stored block length did not match one's complement\",\r\n \"INVALID_BLOCK_TYPE\" : \"inflate::Invalid block type (type == 3)\",\r\n\r\n /* ADM-ZIP error messages */\r\n \"CANT_EXTRACT_FILE\" : \"Could not extract the file\",\r\n \"CANT_OVERRIDE\" : \"Target file already exists\",\r\n \"NO_ZIP\" : \"No zip file was loaded\",\r\n \"NO_ENTRY\" : \"Entry doesn't exist\",\r\n \"DIRECTORY_CONTENT_ERROR\" : \"A directory cannot have content\",\r\n \"FILE_NOT_FOUND\" : \"File not found: %s\",\r\n \"NOT_IMPLEMENTED\" : \"Not implemented\",\r\n \"INVALID_FILENAME\" : \"Invalid filename\",\r\n \"INVALID_FORMAT\" : \"Invalid or unsupported zip format. No END header found\"\r\n};","var fs = require(\"./fileSystem\").require(),\r\n pth = require(\"path\");\r\n\t\r\nfs.existsSync = fs.existsSync || pth.existsSync;\r\n\r\nmodule.exports = function(/*String*/path) {\r\n\r\n var _path = path || \"\",\r\n _permissions = 0,\r\n _obj = newAttr(),\r\n _stat = null;\r\n\r\n function newAttr() {\r\n return {\r\n directory : false,\r\n readonly : false,\r\n hidden : false,\r\n executable : false,\r\n mtime : 0,\r\n atime : 0\r\n }\r\n }\r\n\r\n if (_path && fs.existsSync(_path)) {\r\n _stat = fs.statSync(_path);\r\n _obj.directory = _stat.isDirectory();\r\n _obj.mtime = _stat.mtime;\r\n _obj.atime = _stat.atime;\r\n _obj.executable = !!(1 & parseInt ((_stat.mode & parseInt (\"777\", 8)).toString (8)[0]));\r\n _obj.readonly = !!(2 & parseInt ((_stat.mode & parseInt (\"777\", 8)).toString (8)[0]));\r\n _obj.hidden = pth.basename(_path)[0] === \".\";\r\n } else {\r\n console.warn(\"Invalid path: \" + _path)\r\n }\r\n\r\n return {\r\n\r\n get directory () {\r\n return _obj.directory;\r\n },\r\n\r\n get readOnly () {\r\n return _obj.readonly;\r\n },\r\n\r\n get hidden () {\r\n return _obj.hidden;\r\n },\r\n\r\n get mtime () {\r\n return _obj.mtime;\r\n },\r\n\r\n get atime () {\r\n return _obj.atime;\r\n },\r\n\r\n\r\n get executable () {\r\n return _obj.executable;\r\n },\r\n\r\n decodeAttributes : function(val) {\r\n\r\n },\r\n\r\n encodeAttributes : function (val) {\r\n\r\n },\r\n\r\n toString : function() {\r\n return '{\\n' +\r\n '\\t\"path\" : \"' + _path + \",\\n\" +\r\n '\\t\"isDirectory\" : ' + _obj.directory + \",\\n\" +\r\n '\\t\"isReadOnly\" : ' + _obj.readonly + \",\\n\" +\r\n '\\t\"isHidden\" : ' + _obj.hidden + \",\\n\" +\r\n '\\t\"isExecutable\" : ' + _obj.executable + \",\\n\" +\r\n '\\t\"mTime\" : ' + _obj.mtime + \"\\n\" +\r\n '\\t\"aTime\" : ' + _obj.atime + \"\\n\" +\r\n '}';\r\n }\r\n }\r\n\r\n};\r\n","exports.require = function() {\n var fs = require(\"fs\");\n if (process.versions['electron']) {\n\t try {\n\t originalFs = require(\"original-fs\");\n\t if (Object.keys(originalFs).length > 0) {\n\t fs = originalFs;\n }\n\t } catch (e) {}\n }\n return fs\n};\n","module.exports = require(\"./utils\");\r\nmodule.exports.FileSystem = require(\"./fileSystem\");\r\nmodule.exports.Constants = require(\"./constants\");\r\nmodule.exports.Errors = require(\"./errors\");\r\nmodule.exports.FileAttr = require(\"./fattr\");","var fs = require(\"./fileSystem\").require(),\r\n pth = require('path');\r\n\r\nfs.existsSync = fs.existsSync || pth.existsSync;\r\n\r\nmodule.exports = (function() {\r\n\r\n var crcTable = [],\r\n Constants = require('./constants'),\r\n Errors = require('./errors'),\r\n\r\n PATH_SEPARATOR = pth.sep;\r\n\r\n\r\n function mkdirSync(/*String*/path) {\r\n var resolvedPath = path.split(PATH_SEPARATOR)[0];\r\n path.split(PATH_SEPARATOR).forEach(function(name) {\r\n if (!name || name.substr(-1,1) === \":\") return;\r\n resolvedPath += PATH_SEPARATOR + name;\r\n var stat;\r\n try {\r\n stat = fs.statSync(resolvedPath);\r\n } catch (e) {\r\n fs.mkdirSync(resolvedPath);\r\n }\r\n if (stat && stat.isFile())\r\n throw Errors.FILE_IN_THE_WAY.replace(\"%s\", resolvedPath);\r\n });\r\n }\r\n\r\n function findSync(/*String*/dir, /*RegExp*/pattern, /*Boolean*/recoursive) {\r\n if (typeof pattern === 'boolean') {\r\n recoursive = pattern;\r\n pattern = undefined;\r\n }\r\n var files = [];\r\n fs.readdirSync(dir).forEach(function(file) {\r\n var path = pth.join(dir, file);\r\n\r\n if (fs.statSync(path).isDirectory() && recoursive)\r\n files = files.concat(findSync(path, pattern, recoursive));\r\n\r\n if (!pattern || pattern.test(path)) {\r\n files.push(pth.normalize(path) + (fs.statSync(path).isDirectory() ? PATH_SEPARATOR : \"\"));\r\n }\r\n\r\n });\r\n return files;\r\n }\r\n\r\n return {\r\n makeDir : function(/*String*/path) {\r\n mkdirSync(path);\r\n },\r\n\r\n crc32 : function(buf) {\r\n if (typeof buf === 'string') {\r\n buf = Buffer.alloc(buf.length, buf);\r\n }\r\n var b = Buffer.alloc(4);\r\n if (!crcTable.length) {\r\n for (var n = 0; n < 256; n++) {\r\n var c = n;\r\n for (var k = 8; --k >= 0;) //\r\n if ((c & 1) !== 0) { c = 0xedb88320 ^ (c >>> 1); } else { c = c >>> 1; }\r\n if (c < 0) {\r\n b.writeInt32LE(c, 0);\r\n c = b.readUInt32LE(0);\r\n }\r\n crcTable[n] = c;\r\n }\r\n }\r\n var crc = 0, off = 0, len = buf.length, c1 = ~crc;\r\n while(--len >= 0) c1 = crcTable[(c1 ^ buf[off++]) & 0xff] ^ (c1 >>> 8);\r\n crc = ~c1;\r\n b.writeInt32LE(crc & 0xffffffff, 0);\r\n return b.readUInt32LE(0);\r\n },\r\n\r\n methodToString : function(/*Number*/method) {\r\n switch (method) {\r\n case Constants.STORED:\r\n return 'STORED (' + method + ')';\r\n case Constants.DEFLATED:\r\n return 'DEFLATED (' + method + ')';\r\n default:\r\n return 'UNSUPPORTED (' + method + ')';\r\n }\r\n\r\n },\r\n\r\n writeFileTo : function(/*String*/path, /*Buffer*/content, /*Boolean*/overwrite, /*Number*/attr) {\r\n if (fs.existsSync(path)) {\r\n if (!overwrite)\r\n return false; // cannot overwrite\r\n\r\n var stat = fs.statSync(path);\r\n if (stat.isDirectory()) {\r\n return false;\r\n }\r\n }\r\n var folder = pth.dirname(path);\r\n if (!fs.existsSync(folder)) {\r\n mkdirSync(folder);\r\n }\r\n\r\n var fd;\r\n try {\r\n fd = fs.openSync(path, 'w', 438); // 0666\r\n } catch(e) {\r\n fs.chmodSync(path, 438);\r\n fd = fs.openSync(path, 'w', 438);\r\n }\r\n if (fd) {\r\n try {\r\n fs.writeSync(fd, content, 0, content.length, 0);\r\n }\r\n catch (e){\r\n throw e;\r\n }\r\n finally {\r\n fs.closeSync(fd);\r\n }\r\n }\r\n fs.chmodSync(path, attr || 438);\r\n return true;\r\n },\r\n\r\n writeFileToAsync : function(/*String*/path, /*Buffer*/content, /*Boolean*/overwrite, /*Number*/attr, /*Function*/callback) {\r\n if(typeof attr === 'function') {\r\n callback = attr;\r\n attr = undefined;\r\n }\r\n\r\n fs.exists(path, function(exists) {\r\n if(exists && !overwrite)\r\n return callback(false);\r\n\r\n fs.stat(path, function(err, stat) {\r\n if(exists &&stat.isDirectory()) {\r\n return callback(false);\r\n }\r\n\r\n var folder = pth.dirname(path);\r\n fs.exists(folder, function(exists) {\r\n if(!exists)\r\n mkdirSync(folder);\r\n\r\n fs.open(path, 'w', 438, function(err, fd) {\r\n if(err) {\r\n fs.chmod(path, 438, function() {\r\n fs.open(path, 'w', 438, function(err, fd) {\r\n fs.write(fd, content, 0, content.length, 0, function() {\r\n fs.close(fd, function() {\r\n fs.chmod(path, attr || 438, function() {\r\n callback(true);\r\n })\r\n });\r\n });\r\n });\r\n })\r\n } else {\r\n if(fd) {\r\n fs.write(fd, content, 0, content.length, 0, function() {\r\n fs.close(fd, function() {\r\n fs.chmod(path, attr || 438, function() {\r\n callback(true);\r\n })\r\n });\r\n });\r\n } else {\r\n fs.chmod(path, attr || 438, function() {\r\n callback(true);\r\n })\r\n }\r\n }\r\n });\r\n })\r\n })\r\n })\r\n },\r\n\r\n findFiles : function(/*String*/path) {\r\n return findSync(path, true);\r\n },\r\n\r\n getAttributes : function(/*String*/path) {\r\n\r\n },\r\n\r\n setAttributes : function(/*String*/path) {\r\n\r\n },\r\n\r\n toBuffer : function(input) {\r\n if (Buffer.isBuffer(input)) {\r\n return input;\r\n } else {\r\n if (input.length === 0) {\r\n return Buffer.alloc(0)\r\n }\r\n return Buffer.from(input, 'utf8');\r\n }\r\n },\r\n\r\n Constants : Constants,\r\n Errors : Errors\r\n }\r\n})();\r\n","var Utils = require(\"./util\"),\n Headers = require(\"./headers\"),\n Constants = Utils.Constants,\n Methods = require(\"./methods\");\n\nmodule.exports = function (/*Buffer*/input) {\n\n var _entryHeader = new Headers.EntryHeader(),\n _entryName = Buffer.alloc(0),\n _comment = Buffer.alloc(0),\n _isDirectory = false,\n uncompressedData = null,\n _extra = Buffer.alloc(0);\n\n function getCompressedDataFromZip() {\n if (!input || !Buffer.isBuffer(input)) {\n return Buffer.alloc(0);\n }\n _entryHeader.loadDataHeaderFromBinary(input);\n return input.slice(_entryHeader.realDataOffset, _entryHeader.realDataOffset + _entryHeader.compressedSize)\n }\n\n function crc32OK(data) {\n // if bit 3 (0x08) of the general-purpose flags field is set, then the CRC-32 and file sizes are not known when the header is written\n if ((_entryHeader.flags & 0x8) !== 0x8) {\n if (Utils.crc32(data) !== _entryHeader.dataHeader.crc) {\n return false;\n }\n } else {\n // @TODO: load and check data descriptor header\n // The fields in the local header are filled with zero, and the CRC-32 and size are appended in a 12-byte structure\n // (optionally preceded by a 4-byte signature) immediately after the compressed data:\n }\n return true;\n }\n\n function decompress(/*Boolean*/async, /*Function*/callback, /*String*/pass) {\n if(typeof callback === 'undefined' && typeof async === 'string') {\n pass=async;\n async=void 0;\n }\n if (_isDirectory) {\n if (async && callback) {\n callback(Buffer.alloc(0), Utils.Errors.DIRECTORY_CONTENT_ERROR); //si added error.\n }\n return Buffer.alloc(0);\n }\n\n var compressedData = getCompressedDataFromZip();\n \n if (compressedData.length === 0) {\n if (async && callback) callback(compressedData, Utils.Errors.NO_DATA);//si added error.\n return compressedData;\n }\n\n var data = Buffer.alloc(_entryHeader.size);\n\n switch (_entryHeader.method) {\n case Utils.Constants.STORED:\n compressedData.copy(data);\n if (!crc32OK(data)) {\n if (async && callback) callback(data, Utils.Errors.BAD_CRC);//si added error\n return Utils.Errors.BAD_CRC;\n } else {//si added otherwise did not seem to return data.\n if (async && callback) callback(data);\n return data;\n }\n case Utils.Constants.DEFLATED:\n var inflater = new Methods.Inflater(compressedData);\n if (!async) {\n var result = inflater.inflate(data);\n result.copy(data, 0);\n if (!crc32OK(data)) {\n console.warn(Utils.Errors.BAD_CRC + \" \" + _entryName.toString())\n }\n return data;\n } else {\n inflater.inflateAsync(function(result) {\n result.copy(data, 0);\n if (!crc32OK(data)) {\n if (callback) callback(data, Utils.Errors.BAD_CRC); //si added error\n } else { //si added otherwise did not seem to return data.\n if (callback) callback(data);\n }\n })\n }\n break;\n default:\n if (async && callback) callback(Buffer.alloc(0), Utils.Errors.UNKNOWN_METHOD);\n return Utils.Errors.UNKNOWN_METHOD;\n }\n }\n\n function compress(/*Boolean*/async, /*Function*/callback) {\n if ((!uncompressedData || !uncompressedData.length) && Buffer.isBuffer(input)) {\n // no data set or the data wasn't changed to require recompression\n if (async && callback) callback(getCompressedDataFromZip());\n return getCompressedDataFromZip();\n }\n\n if (uncompressedData.length && !_isDirectory) {\n var compressedData;\n // Local file header\n switch (_entryHeader.method) {\n case Utils.Constants.STORED:\n _entryHeader.compressedSize = _entryHeader.size;\n\n compressedData = Buffer.alloc(uncompressedData.length);\n uncompressedData.copy(compressedData);\n\n if (async && callback) callback(compressedData);\n return compressedData;\n default:\n case Utils.Constants.DEFLATED:\n\n var deflater = new Methods.Deflater(uncompressedData);\n if (!async) {\n var deflated = deflater.deflate();\n _entryHeader.compressedSize = deflated.length;\n return deflated;\n } else {\n deflater.deflateAsync(function(data) {\n compressedData = Buffer.alloc(data.length);\n _entryHeader.compressedSize = data.length;\n data.copy(compressedData);\n callback && callback(compressedData);\n })\n }\n deflater = null;\n break;\n }\n } else {\n if (async && callback) {\n callback(Buffer.alloc(0));\n } else {\n return Buffer.alloc(0);\n }\n }\n }\n\n function readUInt64LE(buffer, offset) {\n return (buffer.readUInt32LE(offset + 4) << 4) + buffer.readUInt32LE(offset);\n }\n\n function parseExtra(data) {\n var offset = 0;\n var signature, size, part;\n while(offset<data.length) {\n signature = data.readUInt16LE(offset);\n offset += 2;\n size = data.readUInt16LE(offset);\n offset += 2;\n part = data.slice(offset, offset+size);\n offset += size;\n if(Constants.ID_ZIP64 === signature) {\n parseZip64ExtendedInformation(part);\n }\n }\n }\n\n //Override header field values with values from the ZIP64 extra field\n function parseZip64ExtendedInformation(data) {\n var size, compressedSize, offset, diskNumStart;\n\n if(data.length >= Constants.EF_ZIP64_SCOMP) {\n size = readUInt64LE(data, Constants.EF_ZIP64_SUNCOMP);\n if(_entryHeader.size === Constants.EF_ZIP64_OR_32) {\n _entryHeader.size = size;\n }\n }\n if(data.length >= Constants.EF_ZIP64_RHO) {\n compressedSize = readUInt64LE(data, Constants.EF_ZIP64_SCOMP);\n if(_entryHeader.compressedSize === Constants.EF_ZIP64_OR_32) {\n _entryHeader.compressedSize = compressedSize;\n }\n }\n if(data.length >= Constants.EF_ZIP64_DSN) {\n offset = readUInt64LE(data, Constants.EF_ZIP64_RHO);\n if(_entryHeader.offset === Constants.EF_ZIP64_OR_32) {\n _entryHeader.offset = offset;\n }\n }\n if(data.length >= Constants.EF_ZIP64_DSN+4) {\n diskNumStart = data.readUInt32LE(Constants.EF_ZIP64_DSN);\n if(_entryHeader.diskNumStart === Constants.EF_ZIP64_OR_16) {\n _entryHeader.diskNumStart = diskNumStart;\n }\n }\n }\n\n\n return {\n get entryName () { return _entryName.toString(); },\n get rawEntryName() { return _entryName; },\n set entryName (val) {\n _entryName = Utils.toBuffer(val);\n var lastChar = _entryName[_entryName.length - 1];\n _isDirectory = (lastChar === 47) || (lastChar === 92);\n _entryHeader.fileNameLength = _entryName.length;\n },\n\n get extra () { return _extra; },\n set extra (val) {\n _extra = val;\n _entryHeader.extraLength = val.length;\n parseExtra(val);\n },\n\n get comment () { return _comment.toString(); },\n set comment (val) {\n _comment = Utils.toBuffer(val);\n _entryHeader.commentLength = _comment.length;\n },\n\n get name () { var n = _entryName.toString(); return _isDirectory ? n.substr(n.length - 1).split(\"/\").pop() : n.split(\"/\").pop(); },\n get isDirectory () { return _isDirectory },\n\n getCompressedData : function() {\n return compress(false, null)\n },\n\n getCompressedDataAsync : function(/*Function*/callback) {\n compress(true, callback)\n },\n\n setData : function(value) {\n uncompressedData = Utils.toBuffer(value);\n if (!_isDirectory && uncompressedData.length) {\n _entryHeader.size = uncompressedData.length;\n _entryHeader.method = Utils.Constants.DEFLATED;\n _entryHeader.crc = Utils.crc32(value);\n _entryHeader.changed = true;\n } else { // folders and blank files should be stored\n _entryHeader.method = Utils.Constants.STORED;\n }\n },\n\n getData : function(pass) {\n if (_entryHeader.changed) {\n\t\t\t\treturn uncompressedData;\n\t\t\t} else {\n\t\t\t\treturn decompress(false, null, pass);\n }\n },\n\n getDataAsync : function(/*Function*/callback, pass) {\n\t\t\tif (_entryHeader.changed) {\n\t\t\t\tcallback(uncompressedData)\n\t\t\t} else {\n\t\t\t\tdecompress(true, callback, pass)\n }\n },\n\n set attr(attr) { _entryHeader.attr = attr; },\n get attr() { return _entryHeader.attr; },\n\n set header(/*Buffer*/data) {\n _entryHeader.loadFromBinary(data);\n },\n\n get header() {\n return _entryHeader;\n },\n\n packHeader : function() {\n var header = _entryHeader.entryHeaderToBinary();\n // add\n _entryName.copy(header, Utils.Constants.CENHDR);\n if (_entryHeader.extraLength) {\n _extra.copy(header, Utils.Constants.CENHDR + _entryName.length)\n }\n if (_entryHeader.commentLength) {\n _comment.copy(header, Utils.Constants.CENHDR + _entryName.length + _entryHeader.extraLength, _comment.length);\n }\n return header;\n },\n\n toString : function() {\n return '{\\n' +\n '\\t\"entryName\" : \"' + _entryName.toString() + \"\\\",\\n\" +\n '\\t\"name\" : \"' + (_isDirectory ? _entryName.toString().replace(/\\/$/, '').split(\"/\").pop() : _entryName.toString().split(\"/\").pop()) + \"\\\",\\n\" +\n '\\t\"comment\" : \"' + _comment.toString() + \"\\\",\\n\" +\n '\\t\"isDirectory\" : ' + _isDirectory + \",\\n\" +\n '\\t\"header\" : ' + _entryHeader.toString().replace(/\\t/mg, \"\\t\\t\").replace(/}/mg, \"\\t}\") + \",\\n\" +\n '\\t\"compressedData\" : <' + (input && input.length + \" bytes buffer\" || \"null\") + \">\\n\" +\n '\\t\"data\" : <' + (uncompressedData && uncompressedData.length + \" bytes buffer\" || \"null\") + \">\\n\" +\n '}';\n }\n }\n};\n","var ZipEntry = require(\"./zipEntry\"),\n\tHeaders = require(\"./headers\"),\n\tUtils = require(\"./util\");\n\nmodule.exports = function (/*String|Buffer*/input, /*Number*/inputType) {\n\tvar entryList = [],\n\t\tentryTable = {},\n\t\t_comment = Buffer.alloc(0),\n\t\tfilename = \"\",\n\t\tfs = Utils.FileSystem.require(),\n\t\tinBuffer = null,\n\t\tmainHeader = new Headers.MainHeader();\n\n\tif (inputType === Utils.Constants.FILE) {\n\t\t// is a filename\n\t\tfilename = input;\n\t\tinBuffer = fs.readFileSync(filename);\n\t\treadMainHeader();\n\t} else if (inputType === Utils.Constants.BUFFER) {\n\t\t// is a memory buffer\n\t\tinBuffer = input;\n\t\treadMainHeader();\n\t} else {\n\t\t// none. is a new file\n\t}\n\n\tfunction readEntries() {\n\t\tentryTable = {};\n\t\tentryList = new Array(mainHeader.diskEntries); // total number of entries\n\t\tvar index = mainHeader.offset; // offset of first CEN header\n\t\tfor (var i = 0; i < entryList.length; i++) {\n\n\t\t\tvar tmp = index,\n\t\t\t\tentry = new ZipEntry(inBuffer);\n\t\t\tentry.header = inBuffer.slice(tmp, tmp += Utils.Constants.CENHDR);\n\n\t\t\tentry.entryName = inBuffer.slice(tmp, tmp += entry.header.fileNameLength);\n\n\t\t\tif (entry.header.extraLength) {\n\t\t\t\tentry.extra = inBuffer.slice(tmp, tmp += entry.header.extraLength);\n\t\t\t}\n\n\t\t\tif (entry.header.commentLength)\n\t\t\t\tentry.comment = inBuffer.slice(tmp, tmp + entry.header.commentLength);\n\n\t\t\tindex += entry.header.entryHeaderSize;\n\n\t\t\tentryList[i] = entry;\n\t\t\tentryTable[entry.entryName] = entry;\n\t\t}\n\t}\n\n\tfunction readMainHeader() {\n\t\tvar i = inBuffer.length - Utils.Constants.ENDHDR, // END header size\n\t\t\tn = Math.max(0, i - 0xFFFF), // 0xFFFF is the max zip file comment length\n\t\t\tendOffset = -1; // Start offset of the END header\n\n\t\tfor (i; i >= n; i--) {\n\t\t\tif (inBuffer[i] !== 0x50) continue; // quick check that the byte is 'P'\n\t\t\tif (inBuffer.readUInt32LE(i) === Utils.Constants.ENDSIG) { // \"PK\\005\\006\"\n\t\t\t\tendOffset = i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif (!~endOffset)\n\t\t\tthrow Utils.Errors.INVALID_FORMAT;\n\n\t\tmainHeader.loadFromBinary(inBuffer.slice(endOffset, endOffset + Utils.Constants.ENDHDR));\n\t\tif (mainHeader.commentLength) {\n\t\t\t_comment = inBuffer.slice(endOffset + Utils.Constants.ENDHDR);\n\t\t}\n\t\treadEntries();\n\t}\n\n\treturn {\n\t\t/**\n\t\t * Returns an array of ZipEntry objects existent in the current opened archive\n\t\t * @return Array\n\t\t */\n\t\tget entries() {\n\t\t\treturn entryList;\n\t\t},\n\n\t\t/**\n\t\t * Archive comment\n\t\t * @return {String}\n\t\t */\n\t\tget comment() {\n\t\t\treturn _comment.toString();\n\t\t},\n\t\tset comment(val) {\n\t\t\tmainHeader.commentLength = val.length;\n\t\t\t_comment = val;\n\t\t},\n\n\t\t/**\n\t\t * Returns a reference to the entry with the given name or null if entry is inexistent\n\t\t *\n\t\t * @param entryName\n\t\t * @return ZipEntry\n\t\t */\n\t\tgetEntry: function (/*String*/entryName) {\n\t\t\treturn entryTable[entryName] || null;\n\t\t},\n\n\t\t/**\n\t\t * Adds the given entry to the entry list\n\t\t *\n\t\t * @param entry\n\t\t */\n\t\tsetEntry: function (/*ZipEntry*/entry) {\n\t\t\tentryList.push(entry);\n\t\t\tentryTable[entry.entryName] = entry;\n\t\t\tmainHeader.totalEntries = entryList.length;\n\t\t},\n\n\t\t/**\n\t\t * Removes the entry with the given name from the entry list.\n\t\t *\n\t\t * If the entry is a directory, then all nested files and directories will be removed\n\t\t * @param entryName\n\t\t */\n\t\tdeleteEntry: function (/*String*/entryName) {\n\t\t\tvar entry = entryTable[entryName];\n\t\t\tif (entry && entry.isDirectory) {\n\t\t\t\tvar _self = this;\n\t\t\t\tthis.getEntryChildren(entry).forEach(function (child) {\n\t\t\t\t\tif (child.entryName !== entryName) {\n\t\t\t\t\t\t_self.deleteEntry(child.entryName)\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t}\n\t\t\tentryList.splice(entryList.indexOf(entry), 1);\n\t\t\tdelete(entryTable[entryName]);\n\t\t\tmainHeader.totalEntries = entryList.length;\n\t\t},\n\n\t\t/**\n\t\t * Iterates and returns all nested files and directories of the given entry\n\t\t *\n\t\t * @param entry\n\t\t * @return Array\n\t\t */\n\t\tgetEntryChildren: function (/*ZipEntry*/entry) {\n\t\t\tif (entry.isDirectory) {\n\t\t\t\tvar list = [],\n\t\t\t\t\tname = entry.entryName,\n\t\t\t\t\tlen = name.length;\n\n\t\t\t\tentryList.forEach(function (zipEntry) {\n\t\t\t\t\tif (zipEntry.entryName.substr(0, len) === name) {\n\t\t\t\t\t\tlist.push(zipEntry);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\treturn list;\n\t\t\t}\n\t\t\treturn []\n\t\t},\n\n\t\t/**\n\t\t * Returns the zip file\n\t\t *\n\t\t * @return Buffer\n\t\t */\n\t\tcompressToBuffer: function () {\n\t\t\tif (entryList.length > 1) {\n\t\t\t\tentryList.sort(function (a, b) {\n\t\t\t\t\tvar nameA = a.entryName.toLowerCase();\n\t\t\t\t\tvar nameB = b.entryName.toLowerCase();\n\t\t\t\t\tif (nameA < nameB) {\n\t\t\t\t\t\treturn -1\n\t\t\t\t\t}\n\t\t\t\t\tif (nameA > nameB) {\n\t\t\t\t\t\treturn 1\n\t\t\t\t\t}\n\t\t\t\t\treturn 0;\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tvar totalSize = 0,\n\t\t\t\tdataBlock = [],\n\t\t\t\tentryHeaders = [],\n\t\t\t\tdindex = 0;\n\n\t\t\tmainHeader.size = 0;\n\t\t\tmainHeader.offset = 0;\n\n\t\t\tentryList.forEach(function (entry) {\n\t\t\t\t// compress data and set local and entry header accordingly. Reason why is called first\n\t\t\t\tvar compressedData = entry.getCompressedData();\n\t\t\t\t// data header\n\t\t\t\tentry.header.offset = dindex;\n\t\t\t\tvar dataHeader = entry.header.dataHeaderToBinary();\n\t\t\t\tvar entryNameLen = entry.rawEntryName.length;\n\t\t\t\tvar extra = entry.extra.toString();\n\t\t\t\tvar postHeader = Buffer.alloc(entryNameLen + extra.length);\n\t\t\t\tentry.rawEntryName.copy(postHeader, 0);\n\t\t\t\tpostHeader.fill(extra, entryNameLen);\n\n\t\t\t\tvar dataLength = dataHeader.length + postHeader.length + compressedData.length;\n\n\t\t\t\tdindex += dataLength;\n\n\t\t\t\tdataBlock.push(dataHeader);\n\t\t\t\tdataBlock.push(postHeader);\n\t\t\t\tdataBlock.push(compressedData);\n\n\t\t\t\tvar entryHeader = entry.packHeader();\n\t\t\t\tentryHeaders.push(entryHeader);\n\t\t\t\tmainHeader.size += entryHeader.length;\n\t\t\t\ttotalSize += (dataLength + entryHeader.length);\n\t\t\t});\n\n\t\t\ttotalSize += mainHeader.mainHeaderSize; // also includes zip file comment length\n\t\t\t// point to end of data and beginning of central directory first record\n\t\t\tmainHeader.offset = dindex;\n\n\t\t\tdindex = 0;\n\t\t\tvar outBuffer = Buffer.alloc(totalSize);\n\t\t\tdataBlock.forEach(function (content) {\n\t\t\t\tcontent.copy(outBuffer, dindex); // write data blocks\n\t\t\t\tdindex += content.length;\n\t\t\t});\n\t\t\tentryHeaders.forEach(function (content) {\n\t\t\t\tcontent.copy(outBuffer, dindex); // write central directory entries\n\t\t\t\tdindex += content.length;\n\t\t\t});\n\n\t\t\tvar mh = mainHeader.toBinary();\n\t\t\tif (_comment) {\n\t\t\t\t_comment.copy(mh, Utils.Constants.ENDHDR); // add zip file comment\n\t\t\t}\n\n\t\t\tmh.copy(outBuffer, dindex); // write main header\n\n\t\t\treturn outBuffer\n\t\t},\n\n\t\ttoAsyncBuffer: function (/*Function*/onSuccess, /*Function*/onFail, /*Function*/onItemStart, /*Function*/onItemEnd) {\n\t\t\tif (entryList.length > 1) {\n\t\t\t\tentryList.sort(function (a, b) {\n\t\t\t\t\tvar nameA = a.entryName.toLowerCase();\n\t\t\t\t\tvar nameB = b.entryName.toLowerCase();\n\t\t\t\t\tif (nameA > nameB) {\n\t\t\t\t\t\treturn -1\n\t\t\t\t\t}\n\t\t\t\t\tif (nameA < nameB) {\n\t\t\t\t\t\treturn 1\n\t\t\t\t\t}\n\t\t\t\t\treturn 0;\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tvar totalSize = 0,\n\t\t\t\tdataBlock = [],\n\t\t\t\tentryHeaders = [],\n\t\t\t\tdindex = 0;\n\n\t\t\tmainHeader.size = 0;\n\t\t\tmainHeader.offset = 0;\n\n\t\t\tvar compress = function (entryList) {\n\t\t\t\tvar self = arguments.callee;\n\t\t\t\tif (entryList.length) {\n\t\t\t\t\tvar entry = entryList.pop();\n\t\t\t\t\tvar name = entry.entryName + entry.extra.toString();\n\t\t\t\t\tif (onItemStart) onItemStart(name);\n\t\t\t\t\tentry.getCompressedDataAsync(function (compressedData) {\n\t\t\t\t\t\tif (onItemEnd) onItemEnd(name);\n\n\t\t\t\t\t\tentry.header.offset = dindex;\n\t\t\t\t\t\t// data header\n\t\t\t\t\t\tvar dataHeader = entry.header.dataHeaderToBinary();\n\t\t\t\t\t\tvar postHeader;\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tpostHeader = Buffer.alloc(name.length, name); // using alloc will work on node 5.x+\n\t\t\t\t\t\t} catch(e){\n\t\t\t\t\t\t\tpostHeader = new Buffer(name); // use deprecated method if alloc fails...\n\t\t\t\t\t\t}\n\t\t\t\t\t\tvar dataLength = dataHeader.length + postHeader.length + compressedData.length;\n\n\t\t\t\t\t\tdindex += dataLength;\n\n\t\t\t\t\t\tdataBlock.push(dataHeader);\n\t\t\t\t\t\tdataBlock.push(postHeader);\n\t\t\t\t\t\tdataBlock.push(compressedData);\n\n\t\t\t\t\t\tvar entryHeader = entry.packHeader();\n\t\t\t\t\t\tentryHeaders.push(entryHeader);\n\t\t\t\t\t\tmainHeader.size += entryHeader.length;\n\t\t\t\t\t\ttotalSize += (dataLength + entryHeader.length);\n\n\t\t\t\t\t\tif (entryList.length) {\n\t\t\t\t\t\t\tself(entryList);\n\t\t\t\t\t\t} else {\n\n\n\t\t\t\t\t\t\ttotalSize += mainHeader.mainHeaderSize; // also includes zip file comment length\n\t\t\t\t\t\t\t// point to end of data and beginning of central directory first record\n\t\t\t\t\t\t\tmainHeader.offset = dindex;\n\n\t\t\t\t\t\t\tdindex = 0;\n\t\t\t\t\t\t\tvar outBuffer = Buffer.alloc(totalSize);\n\t\t\t\t\t\t\tdataBlock.forEach(function (content) {\n\t\t\t\t\t\t\t\tcontent.copy(outBuffer, dindex); // write data blocks\n\t\t\t\t\t\t\t\tdindex += content.length;\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tentryHeaders.forEach(function (content) {\n\t\t\t\t\t\t\t\tcontent.copy(outBuffer, dindex); // write central directory entries\n\t\t\t\t\t\t\t\tdindex += content.length;\n\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t\tvar mh = mainHeader.toBinary();\n\t\t\t\t\t\t\tif (_comment) {\n\t\t\t\t\t\t\t\t_comment.copy(mh, Utils.Constants.ENDHDR); // add zip file comment\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tmh.copy(outBuffer, dindex); // write main header\n\n\t\t\t\t\t\t\tonSuccess(outBuffer);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t};\n\n\t\t\tcompress(entryList);\n\t\t}\n\t}\n};\n","export type EventType = string | symbol;\n\n// An event handler can take an optional event argument\n// and should not return a value\nexport type Handler<T = any> = (event?: T) => void;\nexport type WildcardHandler = (type: EventType, event?: any) => void;\n\n// An array of all currently registered event handlers for a type\nexport type EventHandlerList = Array<Handler>;\nexport type WildCardEventHandlerList = Array<WildcardHandler>;\n\n// A map of event types and their corresponding event handlers.\nexport type EventHandlerMap = Map<EventType, EventHandlerList | WildCardEventHandlerList>;\n\nexport interface Emitter {\n\tall: EventHandlerMap;\n\n\ton<T = any>(type: EventType, handler: Handler<T>): void;\n\ton(type: '*', handler: WildcardHandler): void;\n\n\toff<T = any>(type: EventType, handler: Handler<T>): void;\n\toff(type: '*', handler: WildcardHandler): void;\n\n\temit<T = any>(type: EventType, event?: T): void;\n\temit(type: '*', event?: any): void;\n}\n\n/**\n * Mitt: Tiny (~200b) functional event emitter / pubsub.\n * @name mitt\n * @returns {Mitt}\n */\nexport default function mitt(all?: EventHandlerMap): Emitter {\n\tall = all || new Map();\n\n\treturn {\n\n\t\t/**\n\t\t * A Map of event names to registered handler functions.\n\t\t */\n\t\tall,\n\n\t\t/**\n\t\t * Register an event handler for the given type.\n\t\t * @param {string|symbol} type Type of event to listen for, or `\"*\"` for all events\n\t\t * @param {Function} handler Function to call in response to given event\n\t\t * @memberOf mitt\n\t\t */\n\t\ton<T = any>(type: EventType, handler: Handler<T>) {\n\t\t\tconst handlers = all.get(type);\n\t\t\tconst added = handlers && handlers.push(handler);\n\t\t\tif (!added) {\n\t\t\t\tall.set(type, [handler]);\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Remove an event handler for the given type.\n\t\t * @param {string|symbol} type Type of event to unregister `handler` from, or `\"*\"`\n\t\t * @param {Function} handler Handler function to remove\n\t\t * @memberOf mitt\n\t\t */\n\t\toff<T = any>(type: EventType, handler: Handler<T>) {\n\t\t\tconst handlers = all.get(type);\n\t\t\tif (handlers) {\n\t\t\t\thandlers.splice(handlers.indexOf(handler) >>> 0, 1);\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Invoke all handlers for the given type.\n\t\t * If present, `\"*\"` handlers are invoked after type-matched handlers.\n\t\t *\n\t\t * Note: Manually firing \"*\" handlers is not supported.\n\t\t *\n\t\t * @param {string|symbol} type The event type to invoke\n\t\t * @param {Any} [evt] Any value (object is recommended and powerful), passed to each handler\n\t\t * @memberOf mitt\n\t\t */\n\t\temit<T = any>(type: EventType, evt: T) {\n\t\t\t((all.get(type) || []) as EventHandlerList).slice().map((handler) => { handler(evt); });\n\t\t\t((all.get('*') || []) as WildCardEventHandlerList).slice().map((handler) => { handler(type, evt); });\n\t\t}\n\t};\n}\n","import * as monthUtils from '../shared/months';\nimport * as sheet from '../server/sheet';\nimport * as budget from '../server/budget/base';\nimport * as db from '../server/db';\nimport * as prefs from '../server/prefs';\nimport * as budgetActions from '../server/budget/actions';\nimport { runQuery as aqlQuery } from '../server/aql/schema/run-query';\nimport { batchMessages, setSyncingMode } from '../server/sync';\nimport { runHandler, runMutator } from '../server/mutators';\nimport { addTransactions } from '../server/accounts/sync';\nimport q from '../shared/query';\n\nfunction pickRandom(list) {\n return list[((Math.random() * list.length) | 0) % list.length];\n}\n\nfunction number(start, end) {\n return start + (end - start) * Math.random();\n}\n\nfunction integer(start, end) {\n return number(start, end) | 0;\n}\n\nfunction findMin(items, field) {\n let item = items[0];\n for (let i = 0; i < items.length; i++) {\n if (items[i][field] < item[field]) {\n item = items[i];\n }\n }\n return item;\n}\n\nfunction getStartingBalanceCat(categories) {\n return categories.find(c => c.name === 'Starting Balances').id;\n}\n\nfunction extractCommonThings(payees, groups) {\n let incomePayee = payees.find(p => p.name === 'Deposit');\n let expensePayees = payees.filter(\n p => p.name !== 'Deposit' && p.name !== 'Starting Balance'\n );\n let expenseGroup = groups.find(g => g.is_income === 0);\n let incomeGroup = groups.find(g => g.is_income === 1);\n let categories = expenseGroup.categories.filter(\n c =>\n [\n 'Food',\n 'Restaurants',\n 'Entertainment',\n 'Clothing',\n 'General',\n 'Gift',\n 'Medical'\n ].indexOf(c.name) !== -1\n );\n\n return {\n incomePayee,\n expensePayees: expensePayees.filter(p => !p.bill),\n incomeGroup,\n expenseCategories: categories,\n billCategories: groups.find(g => g.name === 'Bills').categories,\n billPayees: expensePayees.filter(p => p.bill)\n };\n}\n\nasync function fillPrimaryChecking(handlers, account, payees, groups) {\n let {\n incomePayee,\n expensePayees,\n incomeGroup,\n expenseCategories,\n billCategories,\n billPayees\n } = extractCommonThings(payees, groups);\n let numTransactions = integer(100, 200);\n\n let transactions = [];\n for (let i = 0; i < numTransactions; i++) {\n let payee;\n if (Math.random() < 0.09) {\n payee = incomePayee;\n } else {\n payee = pickRandom(expensePayees);\n }\n\n let category;\n if (payee.name === 'Deposit') {\n category = incomeGroup.categories.find(c => c.name === 'Income');\n } else {\n category = pickRandom(expenseCategories);\n }\n\n let amount;\n if (payee.name === 'Deposit') {\n amount = integer(50000, 70000);\n } else {\n amount = integer(0, Math.random() < 0.05 ? -8000 : -700);\n }\n\n let transaction = {\n amount,\n payee: payee.id,\n account: account.id,\n date: monthUtils.subDays(monthUtils.currentDay(), (i / 3) | 0),\n category: category.id\n };\n transactions.push(transaction);\n\n if (Math.random() < 0.2) {\n let a = (transaction.amount / 3) | 0;\n let pick = () =>\n payee === incomePayee\n ? incomeGroup.categories.find(c => c.name === 'Income').id\n : pickRandom(expenseCategories).id;\n transaction.subtransactions = [\n { amount: a, category: pick() },\n { amount: a, category: pick() },\n {\n amount: transaction.amount - a * 2,\n category: pick()\n }\n ];\n }\n }\n\n let earliestMonth = monthUtils.monthFromDate(\n transactions[transactions.length - 1].date\n );\n let months = monthUtils.rangeInclusive(\n earliestMonth,\n monthUtils.currentMonth()\n );\n let currentDay = monthUtils.currentDay();\n for (let month of months) {\n let date = monthUtils.addDays(month, '12');\n if (monthUtils.isBefore(date, currentDay)) {\n transactions.push({\n amount: -10000,\n payee: billPayees.find(p => p.name.toLowerCase().includes('power')).id,\n account: account.id,\n date,\n category: billCategories.find(c => c.name === 'Power').id\n });\n }\n\n date = monthUtils.addDays(month, '18');\n if (monthUtils.isBefore(date, currentDay)) {\n transactions.push({\n amount: -9000,\n payee: billPayees.find(p => p.name.toLowerCase().includes('water')).id,\n account: account.id,\n date,\n category: billCategories.find(c => c.name === 'Water').id\n });\n }\n\n date = monthUtils.addDays(month, '2');\n if (monthUtils.isBefore(date, currentDay)) {\n transactions.push({\n amount: -120000,\n payee: billPayees.find(p => p.name.toLowerCase().includes('housy')).id,\n account: account.id,\n date,\n category: billCategories.find(c => c.name === 'Mortgage').id\n });\n }\n\n date = monthUtils.addDays(month, '20');\n if (monthUtils.isBefore(date, currentDay)) {\n transactions.push({\n amount: -6000,\n payee: billPayees.find(p => p.name.toLowerCase().includes('internet'))\n .id,\n account: account.id,\n date,\n category: billCategories.find(c => c.name === 'Internet').id\n });\n }\n\n date = monthUtils.addDays(month, '23');\n if (monthUtils.isBefore(date, currentDay)) {\n transactions.push({\n amount: -7500,\n payee: billPayees.find(p => p.name.toLowerCase().includes('t-mobile'))\n .id,\n account: account.id,\n date,\n category: billCategories.find(c => c.name === 'Cell').id\n });\n }\n }\n\n let earliestDate = null;\n transactions.forEach(t => {\n if (earliestDate == null || t.date < earliestDate) {\n earliestDate = t.date;\n }\n });\n\n transactions.unshift({\n amount: 100000,\n payee: payees.find(p => p.name === 'Starting Balance').id,\n account: account.id,\n date: earliestDate,\n category: getStartingBalanceCat(incomeGroup.categories),\n starting_balance_flag: true\n });\n\n return addTransactions(account.id, transactions);\n}\n\nasync function fillChecking(handlers, account, payees, groups) {\n let {\n incomePayee,\n expensePayees,\n incomeGroup,\n expenseCategories\n } = extractCommonThings(payees, groups);\n let numTransactions = integer(20, 40);\n\n let transactions = [];\n for (let i = 0; i < numTransactions; i++) {\n let payee;\n if (Math.random() < 0.04) {\n payee = incomePayee;\n } else {\n payee = pickRandom(expensePayees);\n }\n\n let category;\n if (payee.name === 'Deposit') {\n category = incomeGroup.categories.find(c => c.name === 'Income');\n } else {\n category = pickRandom(expenseCategories);\n }\n\n let amount =\n payee.name === 'Deposit' ? integer(50000, 70000) : integer(0, -10000);\n\n transactions.push({\n amount,\n payee: payee.id,\n account: account.id,\n date: monthUtils.subDays(monthUtils.currentDay(), (i * 2) | 0),\n category: category.id\n });\n }\n\n transactions.unshift({\n amount: integer(90000, 120000),\n payee: payees.find(p => p.name === 'Starting Balance').id,\n account: account.id,\n date: transactions[transactions.length - 1].date,\n category: getStartingBalanceCat(incomeGroup.categories),\n starting_balance_flag: true\n });\n\n await handlers['transactions-batch-update']({\n added: transactions,\n fastMode: true\n });\n}\n\nasync function fillInvestment(handlers, account, payees, groups) {\n let {\n incomePayee,\n expensePayees,\n incomeGroup,\n expenseCategories\n } = extractCommonThings(payees, groups);\n\n let numTransactions = integer(10, 30);\n\n let transactions = [];\n for (let i = 0; i < numTransactions; i++) {\n let payee = incomePayee;\n let category = incomeGroup.categories.find(c => c.name === 'Income');\n\n let amount = integer(10000, 20000);\n\n transactions.push({\n amount,\n payee: payee.id,\n account: account.id,\n date: monthUtils.subDays(monthUtils.currentDay(), integer(10, 360)),\n category: category.id\n });\n }\n\n transactions.unshift({\n amount: integer(10000, 20000),\n payee: payees.find(p => p.name === 'Starting Balance').id,\n account: account.id,\n date: findMin(transactions, 'date').date,\n category: getStartingBalanceCat(incomeGroup.categories),\n starting_balance_flag: true\n });\n\n await handlers['transactions-batch-update']({\n added: transactions,\n fastMode: true\n });\n}\n\nasync function fillSavings(handlers, account, payees, groups) {\n let {\n incomePayee,\n expensePayees,\n incomeGroup,\n expenseCategories\n } = extractCommonThings(payees, groups);\n\n let numTransactions = integer(15, 40);\n\n let transactions = [];\n for (let i = 0; i < numTransactions; i++) {\n let payee;\n if (Math.random() < 0.3) {\n payee = incomePayee;\n } else {\n payee = pickRandom(expensePayees);\n }\n let category =\n payee === incomePayee\n ? incomeGroup.categories.find(c => c.name === 'Income')\n : pickRandom(expenseCategories);\n let amount =\n payee === incomePayee ? integer(10000, 80000) : integer(-10000, -2000);\n\n transactions.push({\n amount,\n payee: payee.id,\n account: account.id,\n date: monthUtils.subDays(monthUtils.currentDay(), (i * 5) | 0),\n category: category.id\n });\n }\n\n transactions.unshift({\n amount: 30000,\n payee: payees.find(p => p.name === 'Starting Balance').id,\n account: account.id,\n date: transactions[transactions.length - 1].date,\n category: getStartingBalanceCat(incomeGroup.categories),\n starting_balance_flag: true\n });\n\n await handlers['transactions-batch-update']({\n added: transactions,\n fastMode: true\n });\n}\n\nasync function fillMortgage(handlers, account, payees, groups) {\n let {\n incomePayee,\n expensePayees,\n incomeGroup,\n expenseCategories\n } = extractCommonThings(payees, groups);\n\n let numTransactions = integer(7, 10);\n let amount = integer(100000, 200000);\n let category = incomeGroup.categories.find(c => c.name === 'Income');\n\n let transactions = [\n {\n amount: integer(-3000, -3500) * 100 * 100,\n payee: payees.find(p => p.name === 'Starting Balance').id,\n account: account.id,\n date:\n monthUtils.subMonths(monthUtils.currentDay(), numTransactions) + '-02',\n category: getStartingBalanceCat(incomeGroup.categories),\n starting_balance_flag: true\n }\n ];\n for (let i = 0; i < numTransactions; i++) {\n let payee = incomePayee;\n\n transactions.push({\n amount,\n payee: payee.id,\n account: account.id,\n date: monthUtils.subMonths(monthUtils.currentDay(), i) + '-02',\n category: category.id,\n starting_balance_flag: true\n });\n }\n\n await handlers['transactions-batch-update']({\n added: transactions,\n fastMode: true\n });\n}\n\nasync function fillOther(handlers, account, payees, groups) {\n let {\n incomePayee,\n expensePayees,\n incomeGroup,\n expenseCategories\n } = extractCommonThings(payees, groups);\n\n let numTransactions = integer(3, 6);\n let category = incomeGroup.categories.find(c => c.name === 'Income');\n\n let transactions = [\n {\n amount: integer(3250, 3700) * 100 * 100,\n payee: payees.find(p => p.name === 'Starting Balance').id,\n account: account.id,\n date:\n monthUtils.subMonths(monthUtils.currentDay(), numTransactions) + '-02',\n category: getStartingBalanceCat(incomeGroup.categories),\n starting_balance_flag: true\n }\n ];\n for (let i = 0; i < numTransactions; i++) {\n let payee = incomePayee;\n let amount = integer(4, 9) * 100 * 100;\n\n transactions.push({\n amount,\n payee: payee.id,\n account: account.id,\n date: monthUtils.subMonths(monthUtils.currentDay(), i) + '-02',\n category: category.id\n });\n }\n\n await handlers['transactions-batch-update']({\n added: transactions,\n fastMode: true\n });\n}\n\nasync function createBudget(accounts, payees, groups) {\n let primaryAccount = accounts.find(a => (a.name = 'Bank of America'));\n let earliestDate = (await db.first(\n `SELECT * FROM v_transactions t LEFT JOIN accounts a ON t.account = a.id\n WHERE a.offbudget = 0 AND t.is_child = 0 ORDER BY date ASC LIMIT 1`\n )).date;\n let earliestPrimaryDate = (await db.first(\n `SELECT * FROM v_transactions t LEFT JOIN accounts a ON t.account = a.id\n WHERE a.id = ? AND a.offbudget = 0 AND t.is_child = 0 ORDER BY date ASC LIMIT 1`,\n [primaryAccount.id]\n )).date;\n\n let start = monthUtils.monthFromDate(db.fromDateRepr(earliestDate));\n let end = monthUtils.currentMonth();\n let months = monthUtils.rangeInclusive(start, end);\n\n function category(name) {\n for (let group of groups) {\n let cat = group.categories.find(c => c.name === name);\n if (cat) {\n return cat;\n }\n }\n }\n\n function setBudget(month, category, amount) {\n return budgetActions.setBudget({ month, category: category.id, amount });\n }\n\n function setBudgetIfSpent(month, cat) {\n let spent = sheet.getCellValue(\n monthUtils.sheetForMonth(month),\n `sum-amount-${cat.id}`\n );\n\n if (spent < 0) {\n setBudget(month, cat, -spent);\n }\n }\n\n await runMutator(() =>\n batchMessages(async () => {\n for (let month of months) {\n if (\n month >=\n monthUtils.monthFromDate(db.fromDateRepr(earliestPrimaryDate))\n ) {\n setBudget(month, category('Food'), 40000);\n setBudget(month, category('Restaurants'), 30000);\n setBudget(month, category('Entertainment'), 10000);\n setBudget(month, category('Clothing'), 3000);\n setBudget(month, category('General'), 50000);\n setBudget(month, category('Gift'), 7500);\n setBudget(month, category('Medical'), 10000);\n\n setBudget(month, category('Cell'), 7500);\n setBudget(month, category('Internet'), 6000);\n setBudget(month, category('Mortgage'), 120000);\n setBudget(month, category('Water'), 9000);\n setBudget(month, category('Power'), 10000);\n } else {\n setBudgetIfSpent(month, category('Food'));\n setBudgetIfSpent(month, category('Restaurants'));\n setBudgetIfSpent(month, category('Entertainment'));\n setBudgetIfSpent(month, category('Clothing'));\n setBudgetIfSpent(month, category('General'));\n setBudgetIfSpent(month, category('Gift'));\n setBudgetIfSpent(month, category('Medical'));\n\n setBudgetIfSpent(month, category('Cell'));\n setBudgetIfSpent(month, category('Internet'));\n setBudgetIfSpent(month, category('Mortgage'));\n setBudgetIfSpent(month, category('Water'));\n setBudgetIfSpent(month, category('Power'));\n }\n }\n })\n );\n\n await sheet.waitOnSpreadsheet();\n\n await runMutator(() =>\n batchMessages(async () => {\n let prevSaved = 0;\n for (let month of months) {\n if (\n month >=\n monthUtils.monthFromDate(db.fromDateRepr(earliestPrimaryDate)) &&\n month <= monthUtils.currentMonth()\n ) {\n let sheetName = monthUtils.sheetForMonth(month);\n let toBudget = sheet.getCellValue(sheetName, 'to-budget');\n let available = toBudget - prevSaved;\n\n if (available - 403000 > 0) {\n setBudget(month, category('Savings'), available - 403000);\n budgetActions.setBuffer(month, 403000);\n\n prevSaved += available - 403000;\n } else if (available > 0) {\n budgetActions.setBuffer(month, available);\n }\n }\n }\n })\n );\n\n await sheet.waitOnSpreadsheet();\n\n let sheetName = monthUtils.sheetForMonth(monthUtils.currentMonth());\n let toBudget = sheet.getCellValue(sheetName, 'to-budget');\n if (toBudget < 0) {\n await addTransactions(primaryAccount.id, [\n {\n amount: -toBudget,\n category: category('Income').id,\n date: monthUtils.currentMonth() + '-01'\n }\n ]);\n }\n\n // let sheetName = monthUtils.sheetForMonth(monthUtils.currentMonth());\n // let toBudget = sheet.getCellValue(sheetName, 'to-budget');\n // setBudget(monthUtils.currentMonth(), category('Savings'), toBudget);\n\n await sheet.waitOnSpreadsheet();\n}\n\nexport async function createTestBudget(handlers) {\n setSyncingMode('import');\n\n await db.execQuery('PRAGMA journal_mode = OFF');\n\n // Clear out the default categories. This is fine to do without\n // going through the sync system because we are in import mode and\n // these aren't tracked through messages anyway.\n await db.runQuery('DELETE FROM categories;');\n await db.runQuery('DELETE FROM category_groups');\n\n let accounts = [\n { name: 'Bank of America', type: 'checking' },\n { name: 'Ally Savings', type: 'savings' },\n { name: 'Capital One Checking', type: 'checking' },\n { name: 'HSBC', type: 'checking' },\n { name: 'Vanguard 401k', type: 'investment', offBudget: 1 },\n { name: 'Mortgage', type: 'mortgage', offBudget: 1 },\n { name: 'House Asset', type: 'other', offBudget: 1 },\n { name: 'Roth IRA', type: 'investment', offBudget: 1 }\n ];\n await runMutator(() =>\n batchMessages(async () => {\n for (let account of accounts) {\n account.id = await handlers['account-create'](account);\n }\n })\n );\n\n let payees = [\n { name: 'Starting Balance' },\n { name: 'Kroger' },\n { name: 'Publix' },\n { name: 'Home Depot' },\n { name: 'Movies' },\n { name: 'Online store' },\n { name: 'Deposit' },\n { name: 'Dominion Power', bill: true },\n { name: 'Extra Watery', bill: true },\n { name: 'Housy House', bill: true },\n { name: 'Fast Internet', bill: true },\n { name: 'T-mobile', bill: true }\n ];\n\n await runMutator(() =>\n batchMessages(async () => {\n for (let payee of payees) {\n payee.id = await handlers['payee-create']({ name: payee.name });\n }\n })\n );\n\n let categoryGroups = [\n {\n name: 'Usual Expenses',\n categories: [\n { name: 'Savings' },\n { name: 'Medical' },\n { name: 'Gift' },\n { name: 'General' },\n { name: 'Clothing' },\n { name: 'Entertainment' },\n { name: 'Restaurants' },\n { name: 'Food' }\n ]\n },\n {\n name: 'Bills',\n categories: [\n { name: 'Power' },\n { name: 'Water' },\n { name: 'Mortgage' },\n { name: 'Internet' },\n { name: 'Cell' }\n ]\n },\n {\n name: 'Income',\n is_income: true,\n categories: [\n { name: 'Income', is_income: true },\n { name: 'Misc', is_income: true },\n { name: 'Starting Balances', is_income: true }\n ]\n }\n ];\n\n await runMutator(async () => {\n for (let group of categoryGroups) {\n group.id = await handlers['category-group-create']({\n name: group.name,\n isIncome: group.is_income ? 1 : 0\n });\n\n for (let category of group.categories) {\n category.id = await handlers['category-create']({\n ...category,\n isIncome: category.is_income ? 1 : 0,\n groupId: group.id\n });\n }\n }\n });\n\n let allGroups = (await runHandler(handlers['get-categories'])).grouped;\n\n setSyncingMode('import');\n\n await runMutator(() =>\n batchMessages(async () => {\n for (let account of accounts) {\n switch (account.type) {\n case 'checking':\n if (account.name === 'Bank of America') {\n await fillPrimaryChecking(handlers, account, payees, allGroups);\n } else {\n await fillChecking(handlers, account, payees, allGroups);\n }\n break;\n case 'investment':\n await fillInvestment(handlers, account, payees, allGroups);\n break;\n case 'savings':\n await fillSavings(handlers, account, payees, allGroups);\n break;\n case 'mortgage':\n await fillMortgage(handlers, account, payees, allGroups);\n break;\n case 'other':\n if (account.name === 'House Asset') {\n await fillOther(handlers, account, payees, allGroups);\n } else {\n await fillChecking(handlers, account, payees, allGroups);\n }\n break;\n default:\n }\n }\n })\n );\n\n setSyncingMode('import');\n\n // This checks to see if the primary account is in the negative.\n // This might happen depending on the transactions added, but we\n // don't want to show that as it'd be weird. We modify the latest\n // deposit transaction to force it to be positive\n let primaryAccount = accounts.find(a => (a.name = 'Bank of America'));\n let { data: primaryBalance } = await aqlQuery(\n q('transactions')\n .filter({ account: primaryAccount.id })\n .calculate({ $sum: '$amount' })\n .serialize()\n );\n if (primaryBalance < 0) {\n let { data: results } = await aqlQuery(\n q('transactions')\n .filter({ account: primaryAccount.id, amount: { $gt: 0 } })\n .limit(1)\n .select(['id', 'amount'])\n .serialize()\n );\n let lastDeposit = results[0];\n\n await runHandler(handlers['transaction-update'], {\n ...lastDeposit,\n amount: lastDeposit.amount + -primaryBalance + integer(10000, 20000)\n });\n }\n\n // Bust the cache and reload the spreadsheet\n setSyncingMode('disabled');\n await prefs.savePrefs({ isCached: false });\n await sheet.reloadSpreadsheet(db);\n await budget.createAllBudgets();\n\n await sheet.waitOnSpreadsheet();\n\n // Create a budget\n await createBudget(accounts, payees, allGroups);\n}\n","export function captureException(exc) {\n console.log('[Exception]', exc);\n if (global.SentryClient) {\n global.SentryClient.captureException(exc);\n }\n}\n\nexport function captureBreadcrumb(breadcrumb) {\n if (global.SentryClient) {\n global.SentryClient.addBreadcrumb(breadcrumb);\n }\n}\n","const lootFs = require('../fs');\nconst fs = require('fs');\nconst { join } = require('path');\n\nlet getStorePath = () => join(lootFs.getDataDir(), 'global-store.json');\nlet store;\nlet persisted = true;\n\nfunction init({ persist = true } = {}) {\n if (persist) {\n try {\n store = JSON.parse(fs.readFileSync(getStorePath(), 'utf8'));\n } catch (e) {\n store = {};\n }\n } else {\n store = {};\n }\n\n persisted = persist;\n}\n\nfunction _saveStore() {\n if (persisted) {\n return new Promise(function(resolve, reject) {\n fs.writeFile(getStorePath(), JSON.stringify(store), 'utf8', function(\n err,\n _\n ) {\n return err ? reject(err) : resolve();\n });\n });\n }\n}\n\nfunction getItem(key) {\n return new Promise(function(resolve) {\n return resolve(store[key]);\n });\n}\n\nfunction setItem(key, value) {\n store[key] = value;\n return _saveStore();\n}\n\nfunction removeItem(key) {\n delete store[key];\n return _saveStore();\n}\n\nfunction multiGet(keys) {\n return new Promise(function(resolve) {\n return resolve(\n keys.map(function(key) {\n return [key, store[key]];\n })\n );\n });\n}\n\nfunction multiSet(keyValues) {\n keyValues.forEach(function([key, value]) {\n store[key] = value;\n });\n return _saveStore();\n}\n\nfunction multiRemove(keys) {\n keys.forEach(function(key) {\n delete store[key];\n });\n return _saveStore();\n}\n\nmodule.exports = {\n init,\n getItem,\n setItem,\n removeItem,\n multiGet,\n multiSet,\n multiRemove\n};\n","function init() {}\n\nfunction send(type, args) {\n // Nothing\n}\n\nmodule.exports = { init, send };\n","let fs = require('fs');\nlet fetch = require('node-fetch');\n\nasync function fetchBinary(url, filepath) {\n const res = await fetch(url);\n return new Promise((resolve, reject) => {\n const fileStream = fs.createWriteStream(filepath);\n res.body.pipe(fileStream);\n res.body.on('error', err => {\n reject(err);\n });\n fileStream.on('finish', function() {\n resolve();\n });\n });\n}\n\nmodule.exports = { fetch, fetchBinary };\n","const fs = require('fs');\nconst path = require('path');\n\nlet documentDir;\n\nlet rootPath = path.join(__dirname, '..', '..', '..', '..');\n\nif (__filename.match('bundle')) {\n // The file name is not our filename and indicates that we're in the\n // bundled form. Because of this, the root path is different.\n rootPath = path.join(__dirname, '..');\n}\n\nmodule.exports = {\n init: () => {\n // Nothing to do\n },\n getDataDir: () => {\n if (!process.env.ACTUAL_DATA_DIR) {\n throw new Error('ACTUAL_DATA_DIR env variable is required');\n }\n return process.env.ACTUAL_DATA_DIR;\n },\n _setDocumentDir: dir => (documentDir = dir),\n getDocumentDir: () => {\n if (!documentDir) {\n throw new Error('Document directory is not set');\n }\n return documentDir;\n },\n getBudgetDir: id => {\n if (!id) {\n throw new Error('getDocumentDir: id is falsy: ' + id);\n }\n\n // TODO: This should be better\n //\n // A cheesy safe guard. The id is generated from the budget name,\n // so it provides an entry point for the user to accidentally (or\n // intentionally) access other parts of the system. Always\n // restrict it to only access files within the budget directory by\n // never allowing slashes.\n if (id.match(/[^A-Za-z0-9\\-_]/)) {\n throw new Error(\n `Invalid budget id \"${id}\". Check the id of your budget in the \"Advanced\" section of the settings page.`\n );\n }\n\n return path.join(module.exports.getDocumentDir(), id);\n },\n bundledDatabasePath: path.join(rootPath, 'default-db.sqlite'),\n migrationsPath: path.join(rootPath, 'migrations'),\n demoBudgetPath: path.join(rootPath, 'demo-budget'),\n join: path.join,\n basename: filepath => path.basename(filepath),\n listDir: filepath =>\n new Promise((resolve, reject) => {\n fs.readdir(filepath, (err, files) => {\n if (err) {\n reject(err);\n } else {\n resolve(files);\n }\n });\n }),\n exists: filepath =>\n new Promise(resolve => {\n fs.access(filepath, fs.constants.F_OK, err => {\n return resolve(!err);\n });\n }),\n mkdir: filepath =>\n new Promise((resolve, reject) => {\n fs.mkdir(filepath, err => {\n if (err) {\n reject(err);\n } else {\n resolve();\n }\n });\n }),\n size: filepath =>\n new Promise((resolve, reject) => {\n fs.stat(filepath, (err, stats) => {\n if (err) {\n reject(err);\n } else {\n resolve(stats.size);\n }\n });\n }),\n copyFile: (frompath, topath) => {\n return new Promise((resolve, reject) => {\n const readStream = fs.createReadStream(frompath);\n const writeStream = fs.createWriteStream(topath);\n\n readStream.on('error', reject);\n writeStream.on('error', reject);\n\n writeStream.on('open', () => readStream.pipe(writeStream));\n writeStream.once('close', resolve);\n });\n },\n readFile: (filepath, encoding = 'utf8') => {\n if (encoding === 'binary') {\n // `binary` is not actually a valid encoding, you pass `null` into node if\n // you want a buffer\n encoding = null;\n }\n return new Promise((resolve, reject) => {\n fs.readFile(filepath, encoding, (err, data) => {\n if (err) {\n reject(err);\n } else {\n resolve(data);\n }\n });\n });\n },\n writeFile: (filepath, contents) => {\n return new Promise(function(resolve, reject) {\n fs.writeFile(filepath, contents, 'utf8', function(err, _) {\n return err ? reject(err) : resolve();\n });\n });\n },\n removeFile: filepath => {\n return new Promise(function(resolve, reject) {\n fs.unlink(filepath, err => {\n return err ? reject(err) : resolve();\n });\n });\n },\n removeDir: dirpath => {\n return new Promise(function(resolve, reject) {\n fs.rmdir(dirpath, err => {\n return err ? reject(err) : resolve();\n });\n });\n },\n removeDirRecursively: async dirpath => {\n const f = module.exports;\n if (await f.exists(dirpath)) {\n for (let file of await f.listDir(dirpath)) {\n const fullpath = f.join(dirpath, file);\n if (fs.statSync(fullpath).isDirectory()) {\n await f.removeDirRecursively(fullpath);\n } else {\n await f.removeFile(fullpath);\n }\n }\n\n await f.removeDir(dirpath);\n }\n },\n getModifiedTime: filepath => {\n return new Promise(function(resolve, reject) {\n fs.stat(filepath, (err, stats) => {\n if (err) {\n reject(err);\n } else {\n resolve(new Date(stats.mtime));\n }\n });\n });\n }\n};\n","export default {\n info: (...args) => {\n console.log(...args);\n },\n warn: (...args) => {\n console.warn(...args);\n }\n};\n","const Database = require('better-sqlite3');\n\nfunction verifyParamTypes(sql, arr) {\n arr.forEach(val => {\n if (typeof val !== 'string' && typeof val !== 'number' && val !== null) {\n console.log(sql, arr);\n throw new Error('Invalid field type ' + val + ' for sql ' + sql);\n }\n });\n}\n\nexport async function init() {}\n\nexport function prepare(db, sql) {\n return db.prepare(sql);\n}\n\nexport function runQuery(db, sql, params = [], fetchAll) {\n if (params) {\n verifyParamTypes(sql, params);\n }\n\n let stmt;\n try {\n stmt = typeof sql === 'string' ? db.prepare(sql) : sql;\n } catch (e) {\n console.log('error', sql);\n throw e;\n }\n\n if (fetchAll) {\n try {\n let result = stmt.all(...params);\n return result;\n } catch (e) {\n console.log('error', sql);\n throw e;\n }\n } else {\n try {\n let info = stmt.run(...params);\n return { changes: info.changes, insertId: info.lastInsertRowid };\n } catch (e) {\n // console.log('error', sql);\n throw e;\n }\n }\n}\n\nexport function execQuery(db, sql) {\n db.exec(sql);\n}\n\nexport function transaction(db, fn) {\n db.transaction(fn)();\n}\n\n// **Important**: this is an unsafe function since sqlite executes\n// executes statements sequentially. It would be easy for other code\n// to run statements in between our transaction and get caught up in\n// it. This is rarely used, and only needed for specific cases (like\n// batch importing a bunch of data). Don't use this.\nlet transactionDepth = 0;\nexport async function asyncTransaction(db, fn) {\n // Support nested transactions by \"coalescing\" them into the parent\n // one if one is already started\n if (transactionDepth === 0) {\n db.exec('BEGIN TRANSACTION');\n }\n transactionDepth++;\n\n try {\n await fn();\n } finally {\n transactionDepth--;\n // We always commit because rollback is more dangerous - any\n // queries that ran *in-between* this async function would be\n // lost. Right now we are only using transactions for speed\n // purposes unfortunately\n if (transactionDepth === 0) {\n db.exec('COMMIT');\n }\n }\n}\n\nexport function openDatabase(pathOrBuffer) {\n return new Database(pathOrBuffer);\n}\n\nexport function closeDatabase(db) {\n return db.close();\n}\n\nexport function exportDatabase(db) {\n return db.serialize();\n}\n","const uuid = require('uuid');\n\nmodule.exports = {\n v4: function() {\n return Promise.resolve(uuid.v4());\n },\n\n v4Sync: function() {\n return uuid.v4();\n }\n};\n","import fs from 'fs';\nimport csvStringify from 'csv-stringify/lib/sync';\nimport { runQuery as aqlQuery } from '../aql/schema/run-query';\nimport { integerToAmount } from '../../shared/util';\n\nexport async function exportToCSV(\n transactions,\n accounts,\n categoryGroups,\n payees\n) {\n const accountNamesById = accounts.reduce((reduced, { id, name }) => {\n reduced[id] = name;\n return reduced;\n }, {});\n\n const categoryNamesById = categoryGroups.reduce(\n (reduced, { name, categories: subCategories }) => {\n subCategories.forEach(\n subCategory =>\n (reduced[subCategory.id] = `${name}: ${subCategory.name}`)\n );\n return reduced;\n },\n {}\n );\n\n const payeeNamesById = payees.reduce((reduced, { id, name }) => {\n reduced[id] = name;\n return reduced;\n }, {});\n\n const transactionsForExport = transactions.map(\n ({ account, date, payee, notes, category, amount }) => ({\n Account: accountNamesById[account],\n Date: date,\n Payee: payeeNamesById[payee],\n Notes: notes,\n Category: categoryNamesById[category],\n Amount: amount == null ? 0 : integerToAmount(amount)\n })\n );\n\n return csvStringify(transactionsForExport, { header: true });\n}\n\nexport async function exportQueryToCSV(query) {\n let { data: transactions } = await aqlQuery(\n query\n .select([\n { Id: 'id' },\n { Account: 'account.name' },\n { Date: 'date' },\n { Payee: 'payee.name' },\n { ParentId: 'parent_id' },\n { IsParent: 'is_parent' },\n { Notes: 'notes' },\n { Category: 'category.name' },\n { Amount: 'amount' }\n ])\n .options({ splits: 'all' })\n );\n\n let parentsPayees = new Map();\n for (let trans of transactions) {\n if (trans.IsParent) {\n parentsPayees.set(trans.Id, trans.Payee);\n }\n }\n\n // filter out any parent transactions\n let noParents = transactions.filter(t => !t.IsParent);\n\n // map final properties for export and grab the payee for splits from their parent transaction\n let transactionsForExport = noParents.map(trans => {\n return {\n Account: trans.Account,\n Date: trans.Date,\n Payee: trans.ParentId ? parentsPayees.get(trans.ParentId) : trans.Payee,\n Notes: trans.Notes,\n Category: trans.Category,\n Amount: trans.Amount == null ? 0 : integerToAmount(trans.Amount)\n };\n });\n\n return csvStringify(transactionsForExport, { header: true });\n}\n","import asyncStorage from '../../platform/server/asyncStorage';\nimport * as db from '../db';\nimport { getServer } from '../server-config';\nimport * as bankSync from './sync';\nimport { fromPlaidAccountType } from '../../shared/accounts';\nimport { amountToInteger } from '../../shared/util';\nimport { post } from '../post';\nimport { runMutator } from '../mutators';\nconst uuid = require('../../platform/uuid');\n\nexport async function handoffPublicToken(institution, publicToken) {\n let [[, userId], [, key]] = await asyncStorage.multiGet([\n 'user-id',\n 'user-key'\n ]);\n\n if (institution == null || !institution.institution_id || !institution.name) {\n throw new Error('Invalid institution object');\n }\n\n let id = uuid.v4Sync();\n\n // Make sure to generate an access token first before inserting it\n // into our local database in case it fails\n await post(getServer().PLAID_SERVER + '/handoff_public_token', {\n userId,\n key,\n item_id: id,\n public_token: publicToken\n });\n\n await runMutator(() =>\n db.insertWithUUID('banks', {\n id,\n bank_id: institution.institution_id,\n name: institution.name\n })\n );\n\n return id;\n}\n\nexport async function addAccounts(bankId, accountIds, offbudgetIds = []) {\n let [[, userId], [, userKey]] = await asyncStorage.multiGet([\n 'user-id',\n 'user-key'\n ]);\n\n // Get all the available accounts\n let accounts = await bankSync.getAccounts(userId, userKey, bankId);\n\n // Only add the selected accounts\n accounts = accounts.filter(acct => accountIds.includes(acct.account_id));\n\n return Promise.all(\n accounts.map(async acct => {\n let id = await runMutator(async () => {\n let id = await db.insertAccount({\n account_id: acct.account_id,\n name: acct.name,\n official_name: acct.official_name,\n type: fromPlaidAccountType(acct.type),\n balance_current: amountToInteger(acct.balances.current),\n mask: acct.mask,\n bank: bankId,\n offbudget: offbudgetIds.includes(acct.account_id) ? 1 : 0\n });\n\n // Create a transfer payee\n await db.insertPayee({\n name: '',\n transfer_acct: id\n });\n\n return id;\n });\n\n // Do an initial sync\n await bankSync.syncAccount(userId, userKey, id, acct.account_id, bankId);\n\n return id;\n })\n );\n}\n","import fs from '../../platform/server/fs';\nimport qif2json from './qif2json';\nimport csv2json from 'csv-parse/lib/sync';\nimport { dayFromDate } from '../../shared/months';\nimport { looselyParseAmount } from '../../shared/util';\n\nexport function parseFile(filepath, options) {\n let errors = [];\n let m = filepath.match(/\\.[^.]*$/);\n\n if (m) {\n let ext = m[0];\n\n switch (ext.toLowerCase()) {\n case '.qif':\n return parseQIF(filepath);\n case '.csv':\n return parseCSV(filepath, options);\n case '.ofx':\n case '.qfx':\n return parseOFX(filepath);\n default:\n }\n }\n\n errors.push({\n message: 'Invalid file type',\n internal: ''\n });\n return { errors };\n}\n\nasync function parseCSV(filepath, options = {}) {\n let errors = [];\n let contents = await fs.readFile(filepath);\n\n let data;\n try {\n data = csv2json(contents, {\n columns: true,\n bom: true,\n delimiter: options.delimiter || ',',\n quote: '\"',\n trim: true,\n relax_column_count: true\n });\n } catch (err) {\n errors.push({\n message: 'Failed parsing: ' + err.message,\n internal: err.message\n });\n return { errors, transactions: [] };\n }\n\n return { errors, transactions: data };\n}\n\nasync function parseQIF(filepath) {\n let errors = [];\n let contents = await fs.readFile(filepath);\n\n let data;\n try {\n data = qif2json(contents);\n } catch (err) {\n errors.push({\n message: \"Failed parsing: doesn't look like a valid QIF file.\",\n internal: err.stack\n });\n return { errors, transactions: [] };\n }\n\n return {\n errors,\n transactions: data.transactions.map(trans => ({\n amount: trans.amount != null ? looselyParseAmount(trans.amount) : null,\n date: trans.date,\n payee_name: trans.payee,\n imported_payee: trans.payee,\n notes: trans.memo || null\n }))\n };\n}\n\nasync function parseOFX(filepath) {\n let { getOFXTransactions, initModule } = await import(\n /* webpackChunkName: 'xfo' */ 'node-libofx'\n );\n await initModule();\n\n let errors = [];\n let contents = await fs.readFile(filepath);\n\n let data;\n try {\n data = getOFXTransactions(contents);\n } catch (err) {\n errors.push({\n message: 'Failed importing file',\n internal: err.stack\n });\n return { errors };\n }\n\n return {\n errors,\n transactions: data.map(trans => ({\n amount: trans.amount,\n imported_id: trans.fi_id,\n date: trans.date ? dayFromDate(trans.date * 1000) : null,\n payee_name: trans.name,\n imported_payee: trans.name,\n notes: trans.memo || null\n }))\n };\n}\n","import * as db from '../db';\n\nexport async function createPayee(description) {\n // Check to make sure no payee already exists with exactly the same\n // name\n let row = await db.first(\n `SELECT id FROM payees WHERE LOWER(name) = ? AND tombstone = 0`,\n [description.toLowerCase()]\n );\n\n if (row) {\n return row.id;\n } else {\n return db.insertPayee({ name: description });\n }\n}\n\nexport async function getStartingBalancePayee() {\n let category = await db.first(`\n SELECT * FROM categories\n WHERE is_income = 1 AND\n LOWER(name) = 'starting balances' AND\n tombstone = 0\n `);\n if (category === null) {\n category = await db.first(\n 'SELECT * FROM categories WHERE is_income = 1 AND tombstone = 0'\n );\n }\n\n let id = await createPayee('Starting Balance');\n return {\n id,\n category: category ? category.id : null\n };\n}\n","export default function parse(qif, options) {\n var lines = qif.split('\\n'),\n line = lines.shift(),\n type = /!Type:([^$]*)$/.exec(line.trim()),\n data = {},\n transactions = (data.transactions = []),\n transaction = {};\n\n options = options || {};\n\n if (!type || !type.length) {\n throw new Error('File does not appear to be a valid qif file: ' + line);\n }\n data.type = type[1];\n\n var division = {};\n\n while ((line = lines.shift())) {\n line = line.trim();\n if (line === '^') {\n transactions.push(transaction);\n transaction = {};\n continue;\n }\n switch (line[0]) {\n case 'D':\n transaction.date = line.substring(1);\n break;\n case 'T':\n transaction.amount = line.substring(1);\n break;\n case 'N':\n transaction.number = line.substring(1);\n break;\n case 'M':\n transaction.memo = line.substring(1);\n break;\n case 'A':\n transaction.address = (transaction.address || []).concat(\n line.substring(1)\n );\n break;\n case 'P':\n transaction.payee = line.substring(1).replace(/&/g, '&');\n break;\n case 'L':\n var lArray = line.substring(1).split(':');\n transaction.category = lArray[0];\n if (lArray[1] !== undefined) {\n transaction.subcategory = lArray[1];\n }\n break;\n case 'C':\n transaction.clearedStatus = line.substring(1);\n break;\n case 'S':\n var sArray = line.substring(1).split(':');\n division.category = sArray[0];\n if (sArray[1] !== undefined) {\n division.subcategory = sArray[1];\n }\n break;\n case 'E':\n division.description = line.substring(1);\n break;\n case '$':\n division.amount = parseFloat(line.substring(1));\n if (!(transaction.division instanceof Array)) {\n transaction.division = [];\n }\n transaction.division.push(division);\n division = {};\n\n break;\n\n default:\n throw new Error('Unknown Detail Code: ' + line[0]);\n }\n }\n\n if (Object.keys(transaction).length) {\n transactions.push(transaction);\n }\n\n data.dateFormat = options.dateFormat;\n return data;\n}\n","import { RuleError } from '../errors';\nimport * as dateFns from 'date-fns';\nimport {\n monthFromDate,\n yearFromDate,\n isBefore,\n isAfter,\n addDays,\n subDays,\n format as formatDate,\n parseDate\n} from '../../shared/months';\nimport { fastSetMerge } from '../../shared/util';\nimport { sortNumbers, getApproxNumberThreshold } from '../../shared/rules';\nimport { recurConfigToRSchedule } from '../../shared/schedules';\nimport { Schedule as RSchedule } from '../util/rschedule';\n\nfunction safeNumber(n) {\n return isNaN(n) ? null : n;\n}\n\nfunction safeParseInt(n) {\n return safeNumber(parseInt(n));\n}\n\nfunction assert(test, type, msg) {\n if (!test) {\n throw new RuleError(type, msg);\n }\n}\n\nexport function parseRecurDate(desc) {\n try {\n let rules = recurConfigToRSchedule(desc);\n\n return {\n type: 'recur',\n schedule: new RSchedule({ rrules: rules })\n };\n } catch (e) {\n throw new RuleError('parse-recur-date', e.message);\n }\n}\n\nexport function parseDateString(str) {\n if (typeof str !== 'string') {\n return null;\n } else if (str.length === 10) {\n // YYYY-MM-DD\n if (!dateFns.isValid(dateFns.parseISO(str))) {\n return null;\n }\n\n return { type: 'date', date: str };\n } else if (str.length === 7) {\n // YYYY-MM\n if (!dateFns.isValid(dateFns.parseISO(str + '-01'))) {\n return null;\n }\n\n return { type: 'month', date: str };\n } else if (str.length === 4) {\n // YYYY\n if (!dateFns.isValid(dateFns.parseISO(str + '-01-01'))) {\n return null;\n }\n\n return { type: 'year', date: str };\n }\n\n return null;\n}\n\nexport function parseBetweenAmount(between) {\n let { num1, num2 } = between;\n if (typeof num1 !== 'number' || typeof num2 !== 'number') {\n return null;\n }\n return { type: 'between', num1, num2 };\n}\n\nlet CONDITION_TYPES = {\n date: {\n ops: ['is', 'isapprox', 'gt', 'gte', 'lt', 'lte'],\n nullable: false,\n parse(op, value, fieldName) {\n let parsed =\n typeof value === 'string'\n ? parseDateString(value)\n : value.frequency != null\n ? parseRecurDate(value)\n : null;\n assert(\n parsed,\n 'date-format',\n `Invalid date format (field: ${fieldName})`\n );\n\n // Approximate only works with exact & recurring dates\n if (op === 'isapprox') {\n assert(\n parsed.type === 'date' || parsed.type === 'recur',\n 'date-format',\n `Invalid date value for \"isapprox\" (field: ${fieldName})`\n );\n }\n // These only work with exact dates\n else if (op === 'gt' || op === 'gte' || op === 'lt' || op === 'lte') {\n assert(\n parsed.type === 'date',\n 'date-format',\n `Invalid date value for \"${op}\" (field: ${fieldName})`\n );\n }\n\n return parsed;\n }\n },\n id: {\n ops: ['is', 'contains', 'oneOf'],\n nullable: true,\n parse(op, value, fieldName) {\n if (op === 'oneOf') {\n assert(\n Array.isArray(value),\n 'no-empty-array',\n `oneOf must have an array value (field: ${fieldName})`\n );\n return value;\n }\n return value;\n }\n },\n string: {\n ops: ['is', 'contains', 'oneOf'],\n nullable: false,\n parse(op, value, fieldName) {\n if (op === 'oneOf') {\n assert(\n Array.isArray(value),\n 'no-empty-array',\n `oneOf must have an array value (field: ${fieldName}): ${JSON.stringify(\n value\n )}`\n );\n return value.filter(Boolean).map(val => val.toLowerCase());\n }\n\n if (op === 'contains') {\n assert(\n typeof value === 'string' && value.length > 0,\n 'no-empty-string',\n `contains must have non-empty string (field: ${fieldName})`\n );\n }\n\n return value.toLowerCase();\n }\n },\n number: {\n ops: ['is', 'isapprox', 'isbetween', 'gt', 'gte', 'lt', 'lte'],\n nullable: false,\n parse(op, value, fieldName) {\n let parsed =\n typeof value === 'number'\n ? { type: 'literal', value }\n : parseBetweenAmount(value);\n\n assert(\n parsed != null,\n 'not-number',\n `Value must be a number or between amount: ${JSON.stringify(\n value\n )} (field: ${fieldName})`\n );\n\n if (op === 'isbetween') {\n assert(\n parsed.type === 'between',\n 'number-format',\n `Invalid between value for \"${op}\" (field: ${fieldName})`\n );\n } else {\n assert(\n parsed.type === 'literal',\n 'number-format',\n `Invalid number value for \"${op}\" (field: ${fieldName})`\n );\n }\n\n return parsed;\n }\n },\n boolean: {\n ops: ['is'],\n nullable: false,\n parse(op, value, fieldName) {\n assert(\n typeof value === 'boolean',\n 'not-boolean',\n `Value must be a boolean: ${value} (field: ${fieldName})`\n );\n\n return value;\n }\n }\n};\n\nexport class Condition {\n constructor(op, field, value, options, fieldTypes) {\n let typeName = fieldTypes.get(field);\n assert(typeName, 'internal', 'Invalid condition field: ' + field);\n\n let type = CONDITION_TYPES[typeName];\n\n // It's important to validate rules because a faulty rule might mess\n // up the user's transaction (and be very confusing)\n assert(\n type,\n 'internal',\n `Invalid condition type: ${typeName} (field: ${field})`\n );\n assert(\n type.ops.includes(op),\n 'internal',\n `Invalid condition operator: ${op} (type: ${typeName}, field: ${field})`\n );\n\n if (type.nullable !== true) {\n assert(value != null, 'no-null', `Field cannot be empty: ${field}`);\n }\n\n // For strings, an empty string is equal to null\n if (typeName === 'string' && type.nullable !== true) {\n assert(value !== '', 'no-null', `Field cannot be empty: ${field}`);\n }\n\n this.rawValue = value;\n this.unparsedValue = value;\n this.op = op;\n this.field = field;\n this.value = type.parse ? type.parse(op, value, field) : value;\n this.options = options;\n this.type = typeName;\n }\n\n eval(object) {\n let fieldValue = object[this.field];\n if (fieldValue === undefined) {\n return false;\n }\n\n if (typeof fieldValue === 'string') {\n fieldValue = fieldValue.toLowerCase();\n }\n\n let type = this.type;\n\n if (type === 'number' && this.options) {\n if (this.options.outflow) {\n if (fieldValue > 0) {\n return false;\n }\n\n fieldValue = -fieldValue;\n } else if (this.options.inflow) {\n if (fieldValue < 0) {\n return false;\n }\n }\n }\n\n let extractValue = v => (type === 'number' ? v.value : v);\n\n switch (this.op) {\n case 'isapprox':\n case 'is':\n if (type === 'date') {\n if (fieldValue == null) {\n return false;\n }\n\n if (this.value.type === 'recur') {\n let { schedule } = this.value;\n if (this.op === 'isapprox') {\n let fieldDate = parseDate(fieldValue);\n return schedule.occursBetween(\n dateFns.subDays(fieldDate, 2),\n dateFns.addDays(fieldDate, 2)\n );\n } else {\n return schedule.occursOn({ date: parseDate(fieldValue) });\n }\n } else {\n let { date } = this.value;\n\n if (this.op === 'isapprox') {\n let fullDate = parseDate(date);\n let high = addDays(fullDate, 2);\n let low = subDays(fullDate, 2);\n\n return fieldValue >= low && fieldValue <= high;\n } else {\n switch (this.value.type) {\n case 'date':\n return fieldValue === date;\n case 'month':\n return monthFromDate(fieldValue) === date;\n case 'year':\n return yearFromDate(fieldValue) === date;\n default:\n }\n }\n }\n } else if (type === 'number') {\n let number = this.value.value;\n if (this.op === 'isapprox') {\n let threshold = getApproxNumberThreshold(number);\n return (\n fieldValue >= number - threshold &&\n fieldValue <= number + threshold\n );\n }\n return fieldValue === number;\n }\n\n return fieldValue === this.value;\n case 'isbetween': {\n // The parsing logic already checks that the value is of the\n // right type (only numbers with high and low)\n let [low, high] = sortNumbers(this.value.num1, this.value.num2);\n return fieldValue >= low && fieldValue <= high;\n }\n case 'contains':\n if (fieldValue === null) {\n return false;\n }\n return fieldValue.indexOf(this.value) !== -1;\n case 'oneOf':\n if (fieldValue === null) {\n return false;\n }\n return this.value.indexOf(fieldValue) !== -1;\n case 'gt':\n if (fieldValue === null) {\n return false;\n } else if (type === 'date') {\n return isAfter(fieldValue, this.value.date);\n }\n\n return fieldValue > extractValue(this.value);\n case 'gte':\n if (fieldValue === null) {\n return false;\n } else if (type === 'date') {\n return (\n fieldValue === this.value.date ||\n isAfter(fieldValue, this.value.date)\n );\n }\n\n return fieldValue >= extractValue(this.value);\n case 'lt':\n if (fieldValue === null) {\n return false;\n } else if (type === 'date') {\n return isBefore(fieldValue, this.value.date);\n }\n return fieldValue < extractValue(this.value);\n case 'lte':\n if (fieldValue === null) {\n return false;\n } else if (type === 'date') {\n return (\n fieldValue === this.value.date ||\n isBefore(fieldValue, this.value.date)\n );\n }\n return fieldValue <= extractValue(this.value);\n default:\n }\n\n return false;\n }\n\n getValue() {\n return this.value;\n }\n\n serialize() {\n return {\n op: this.op,\n field: this.field,\n value: this.unparsedValue,\n type: this.type,\n ...(this.options ? { options: this.options } : null)\n };\n }\n}\n\nlet ACTION_OPS = ['set', 'link-schedule'];\n\nexport class Action {\n constructor(op, field, value, options, fieldTypes) {\n assert(\n ACTION_OPS.includes(op),\n 'internal',\n `Invalid action operation: ${op}`\n );\n\n if (op === 'set') {\n let typeName = fieldTypes.get(field);\n assert(typeName, 'internal', `Invalid field for action: ${field}`);\n this.field = field;\n this.type = typeName;\n } else if (op === 'link-schedule') {\n this.field = null;\n this.type = 'id';\n }\n\n this.op = op;\n this.rawValue = value;\n this.value = value;\n this.options = options;\n }\n\n exec(object) {\n switch (this.op) {\n case 'set':\n object[this.field] = this.value;\n break;\n case 'link-schedule':\n object.schedule = this.value;\n break;\n default:\n }\n }\n\n serialize() {\n return {\n op: this.op,\n field: this.field,\n value: this.value,\n type: this.type,\n ...(this.options ? { options: this.options } : null)\n };\n }\n}\n\nexport class Rule {\n constructor({ id, stage, conditions, actions, fieldTypes }) {\n this.id = id;\n this.stage = stage;\n this.conditions = conditions.map(\n c => new Condition(c.op, c.field, c.value, c.options, fieldTypes)\n );\n this.actions = actions.map(\n a => new Action(a.op, a.field, a.value, a.options, fieldTypes)\n );\n }\n\n evalConditions(object) {\n if (this.conditions.length === 0) {\n return false;\n }\n\n return this.conditions.every(condition => {\n return condition.eval(object);\n });\n }\n\n execActions(object) {\n let changes = {};\n this.actions.forEach(action => action.exec(changes));\n return changes;\n }\n\n exec(object) {\n if (this.evalConditions(object)) {\n return this.execActions(object);\n }\n return null;\n }\n\n // Apply is similar to exec but applies the changes for you\n apply(object) {\n let changes = this.exec(object);\n return Object.assign({}, object, changes);\n }\n\n getId() {\n return this.id;\n }\n\n serialize() {\n return {\n id: this.id,\n stage: this.stage,\n conditions: this.conditions.map(c => c.serialize()),\n actions: this.actions.map(a => a.serialize())\n };\n }\n}\n\nexport class RuleIndexer {\n constructor({ field, method }) {\n this.field = field;\n this.method = method;\n this.rules = new Map();\n }\n\n getIndex(key) {\n if (!this.rules.has(key)) {\n this.rules.set(key, new Set());\n }\n return this.rules.get(key);\n }\n\n getIndexForValue(value) {\n return this.getIndex(this.getKey(value) || '*');\n }\n\n getKey(value) {\n if (typeof value === 'string' && value !== '') {\n if (this.method === 'firstchar') {\n return value[0].toLowerCase();\n }\n return value.toLowerCase();\n }\n return null;\n }\n\n getIndexes(rule) {\n let cond = rule.conditions.find(cond => cond.field === this.field);\n let indexes = [];\n\n if (cond && (cond.op === 'oneOf' || cond.op === 'is')) {\n if (cond.op === 'oneOf') {\n cond.value.forEach(val => indexes.push(this.getIndexForValue(val)));\n } else {\n indexes.push(this.getIndexForValue(cond.value));\n }\n } else {\n indexes.push(this.getIndex('*'));\n }\n\n return indexes;\n }\n\n index(rule) {\n let indexes = this.getIndexes(rule);\n indexes.forEach(index => {\n index.add(rule);\n });\n }\n\n remove(rule) {\n let indexes = this.getIndexes(rule);\n indexes.forEach(index => {\n index.delete(rule);\n });\n }\n\n getApplicableRules(object) {\n let indexedRules;\n if (this.field in object) {\n let key = this.getKey(object[this.field]);\n if (key) {\n indexedRules = this.rules.get(key);\n }\n }\n\n return fastSetMerge(\n indexedRules || new Set(),\n this.rules.get('*') || new Set()\n );\n }\n}\n\nconst OP_SCORES = {\n is: 10,\n oneOf: 9,\n isapprox: 5,\n isbetween: 5,\n gt: 1,\n gte: 1,\n lt: 1,\n lte: 1,\n contains: 0\n};\n\nfunction computeScore(rule) {\n let initialScore = rule.conditions.reduce((score, condition) => {\n if (OP_SCORES[condition.op] == null) {\n console.log(`Found invalid operation while ranking: ${condition.op}`);\n return 0;\n }\n\n return score + OP_SCORES[condition.op];\n }, 0);\n\n if (\n rule.conditions.every(\n cond => cond.op === 'is' || cond.op === 'isapprox' || cond.op === 'oneOf'\n )\n ) {\n return initialScore * 2;\n }\n return initialScore;\n}\n\nfunction _rankRules(rules) {\n let scores = new Map();\n rules.forEach(rule => {\n scores.set(rule, computeScore(rule));\n });\n\n // No matter the order of rules, this must always return exactly the same\n // order. That's why rules have ids: if two rules have the same score, it\n // sorts by id\n return [...rules].sort((r1, r2) => {\n let score1 = scores.get(r1);\n let score2 = scores.get(r2);\n if (score1 < score2) {\n return -1;\n } else if (score1 > score2) {\n return 1;\n } else {\n let id1 = r1.getId();\n let id2 = r2.getId();\n return id1 < id2 ? -1 : id1 > id2 ? 1 : 0;\n }\n });\n}\n\nexport function rankRules(rules) {\n let pre = [];\n let normal = [];\n let post = [];\n\n for (let rule of rules) {\n switch (rule.stage) {\n case 'pre':\n pre.push(rule);\n break;\n case 'post':\n post.push(rule);\n break;\n default:\n normal.push(rule);\n }\n }\n\n pre = _rankRules(pre);\n normal = _rankRules(normal);\n post = _rankRules(post);\n\n return pre.concat(normal).concat(post);\n}\n\nexport function migrateIds(rule, mappings) {\n // Go through the in-memory rules and patch up ids that have been\n // \"migrated\" to other ids. This is a little tricky, but a lot\n // easier than trying to keep an up-to-date mapping in the db. This\n // is necessary because ids can be transparently mapped as items are\n // merged/deleted in the system.\n //\n // It's very important here that we look at `rawValue` specifically,\n // and only apply the patches to the other `value` fields. We always\n // need to keep the original id around because undo can walk\n // backwards, and we need to be able to consistently apply a\n // \"projection\" of these mapped values. For example: if we have ids\n // [1, 2] and applying mappings transforms it to [2, 2], if `1` gets\n // mapped to something else there's no way to no to map *only* the\n // first id back to make [1, 2]. Keeping the original value around\n // solves this.\n for (let ci = 0; ci < rule.conditions.length; ci++) {\n let cond = rule.conditions[ci];\n if (cond.type === 'id') {\n switch (cond.op) {\n case 'is':\n cond.value = mappings.get(cond.rawValue) || cond.rawValue;\n cond.unparsedValue = cond.value;\n break;\n case 'oneOf':\n cond.value = cond.rawValue.map(v => mappings.get(v) || v);\n cond.unparsedValue = [...cond.value];\n break;\n default:\n }\n }\n }\n\n for (let ai = 0; ai < rule.actions.length; ai++) {\n let action = rule.actions[ai];\n if (action.type === 'id') {\n if (action.op === 'set') {\n action.value = mappings.get(action.rawValue) || action.rawValue;\n }\n }\n }\n}\n\n// This finds all the rules that reference the `id`\nexport function iterateIds(rules, fieldName, func) {\n let counts = {};\n let i;\n\n ruleiter: for (i = 0; i < rules.length; i++) {\n let rule = rules[i];\n for (let ci = 0; ci < rule.conditions.length; ci++) {\n let cond = rule.conditions[ci];\n if (cond.type === 'id' && cond.field === fieldName) {\n switch (cond.op) {\n case 'is':\n if (func(rule, cond.value)) {\n continue ruleiter;\n }\n break;\n case 'oneOf':\n for (let vi = 0; vi < cond.value.length; vi++) {\n if (func(rule, cond.value[vi])) {\n continue ruleiter;\n }\n }\n break;\n default:\n }\n }\n }\n\n for (let ai = 0; ai < rule.actions.length; ai++) {\n let action = rule.actions[ai];\n if (action.type === 'id' && action.field === fieldName) {\n // Currently `set` is the only op, but if we add more this\n // will need to be extended\n if (action.op === 'set') {\n if (func(rule, action.value)) {\n break;\n }\n }\n }\n }\n }\n}\n","import title from './title';\nimport * as db from '../db';\nimport {\n mergeObjects,\n hasFieldsChanged,\n toRelaxedNumber,\n amountToInteger,\n integerToAmount\n} from '../../shared/util';\nimport {\n makeChild as makeChildTransaction,\n recalculateSplit\n} from '../../shared/transactions';\nimport * as monthUtils from '../../shared/months';\nimport { transactionModel } from '../api-models';\nimport { getServer } from '../server-config';\nimport { batchMessages } from '../sync';\nimport { runMutator } from '../mutators';\nimport { getStartingBalancePayee } from './payees';\nimport * as transfer from './transfer';\nimport { TransactionError } from '../errors';\nimport { runRules } from './transaction-rules';\nimport { batchUpdateTransactions } from './transactions';\n\nconst dateFns = require('date-fns');\nconst { post } = require('../post');\nconst levenshtein = require('damerau-levenshtein');\nconst uuid = require('../../platform/uuid');\n\n// Plaid article about API options:\n// https://support.plaid.com/customer/en/portal/articles/2612155-transactions-returned-per-request\n\nfunction BankSyncError(type, code) {\n return { type: 'BankSyncError', category: type, code };\n}\n\nfunction makeSplitTransaction(trans, subtransactions) {\n // We need to calculate the final state of split transactions\n let { subtransactions: sub, ...parent } = recalculateSplit({\n ...trans,\n is_parent: true,\n subtransactions: subtransactions.map((transaction, idx) =>\n makeChildTransaction(trans, {\n ...transaction,\n sort_order: 0 - idx\n })\n )\n });\n return [parent, ...sub];\n}\n\nfunction getAccountBalance(account) {\n // Debt account types need their balance reversed\n switch (account.type) {\n case 'credit':\n case 'loan':\n return -account.balances.current;\n default:\n return account.balances.current;\n }\n}\n\nasync function updateAccountBalance(id, balance) {\n await db.runQuery('UPDATE accounts SET balance_current = ? WHERE id = ?', [\n amountToInteger(balance),\n id\n ]);\n}\n\nexport async function getAccounts(userId, userKey, id) {\n let res = await post(getServer().PLAID_SERVER + '/accounts', {\n userId,\n key: userKey,\n item_id: id\n });\n\n let { accounts } = res;\n\n accounts.forEach(acct => {\n acct.balances.current = getAccountBalance(acct);\n });\n\n return accounts;\n}\n\nexport function fromPlaid(trans) {\n return {\n imported_id: trans.transaction_id,\n payee_name: trans.name,\n imported_payee: trans.name,\n amount: -amountToInteger(trans.amount),\n date: trans.date\n };\n}\n\nasync function downloadTransactions(\n userId,\n userKey,\n acctId,\n bankId,\n since,\n count\n) {\n let allTransactions = [];\n let accountBalance = null;\n let pageSize = 100;\n let offset = 0;\n let numDownloaded = 0;\n\n while (1) {\n const endDate = monthUtils.currentDay();\n\n const res = await post(getServer().PLAID_SERVER + '/transactions', {\n userId: userId,\n key: userKey,\n item_id: '' + bankId,\n account_id: acctId,\n start_date: since,\n end_date: endDate,\n count: pageSize,\n offset\n });\n\n if (res.error_code) {\n throw BankSyncError(res.error_type, res.error_code);\n }\n\n if (res.transactions.length === 0) {\n break;\n }\n\n numDownloaded += res.transactions.length;\n\n // Remove pending transactions for now - we will handle them in\n // the future.\n allTransactions = allTransactions.concat(\n res.transactions.filter(t => !t.pending)\n );\n accountBalance = getAccountBalance(res.accounts[0]);\n\n if (\n numDownloaded === res.total_transactions ||\n (count != null && allTransactions.length >= count)\n ) {\n break;\n }\n\n offset += pageSize;\n }\n\n allTransactions =\n count != null ? allTransactions.slice(0, count) : allTransactions;\n\n return {\n transactions: allTransactions.map(fromPlaid),\n accountBalance\n };\n}\n\nasync function resolvePayee(trans, payeeName, payeesToCreate) {\n if (trans.payee == null && payeeName) {\n // First check our registry of new payees (to avoid a db access)\n // then check the db for existing payees\n let payee = payeesToCreate.get(payeeName.toLowerCase());\n payee = payee || (await db.getPayeeByName(payeeName));\n\n if (payee != null) {\n return payee.id;\n } else {\n // Otherwise we're going to create a new one\n let newPayee = { id: uuid.v4Sync(), name: payeeName };\n payeesToCreate.set(payeeName.toLowerCase(), newPayee);\n return newPayee.id;\n }\n }\n\n return trans.payee;\n}\n\nasync function normalizeTransactions(\n transactions,\n acctId,\n { rawPayeeName } = {}\n) {\n let payeesToCreate = new Map();\n\n let normalized = [];\n for (let trans of transactions) {\n // Validate the date because we do some stuff with it. The db\n // layer does better validation, but this will give nicer errors\n if (trans.date == null) {\n throw new Error('`date` is required when adding a transaction');\n }\n\n // Strip off the irregular properties\n let { payee_name, subtransactions, ...rest } = trans;\n trans = rest;\n\n if (payee_name) {\n let trimmed = payee_name.trim();\n if (trimmed === '') {\n payee_name = null;\n } else {\n payee_name = rawPayeeName ? trimmed : title(trimmed);\n }\n }\n\n trans.imported_payee = trans.imported_payee || payee_name;\n if (trans.imported_payee) {\n trans.imported_payee = trans.imported_payee.trim();\n }\n\n // It's important to resolve both the account and payee early so\n // when rules are run, they have the right data. Resolving payees\n // also simplifies the payee creation process\n trans.account = acctId;\n trans.payee = await resolvePayee(trans, payee_name, payeesToCreate);\n\n normalized.push({\n payee_name,\n subtransactions: subtransactions\n ? subtransactions.map(t => ({ ...t, account: acctId }))\n : null,\n trans\n });\n }\n\n return { normalized, payeesToCreate };\n}\n\nasync function createNewPayees(payeesToCreate, addsAndUpdates) {\n let usedPayeeIds = new Set(addsAndUpdates.map(t => t.payee));\n\n await batchMessages(async () => {\n for (let payee of payeesToCreate.values()) {\n // Only create the payee if it ended up being used\n if (usedPayeeIds.has(payee.id)) {\n await db.insertPayee(payee);\n }\n }\n });\n}\n\nexport async function reconcileTransactions(acctId, transactions) {\n const hasMatched = new Set();\n const updated = [];\n const added = [];\n\n let { normalized, payeesToCreate } = await normalizeTransactions(\n transactions,\n acctId\n );\n\n // The first pass runs the rules, and preps data for fuzzy matching\n let transactionsStep1 = [];\n for (let { payee_name, trans, subtransactions } of normalized) {\n // Run the rules\n trans = runRules(trans);\n\n let match = null;\n let fuzzyDataset = null;\n\n // First, match with an existing transaction's imported_id. This\n // is the highest fidelity match and should always be attempted\n // first.\n if (trans.imported_id) {\n match = await db.first(\n 'SELECT * FROM v_transactions WHERE imported_id = ? AND account = ?',\n [trans.imported_id, acctId]\n );\n\n // TODO: Pending transactions\n\n if (match) {\n hasMatched.add(match.id);\n }\n }\n\n // If it didn't match, query data needed for fuzzy matching\n if (!match) {\n // Look 1 day ahead and 4 days back when fuzzy matching. This\n // needs to select all fields that need to be read from the\n // matched transaction. See the final pass below for the needed\n // fields.\n fuzzyDataset = await db.all(\n `SELECT id, date, imported_id, payee, category, notes FROM v_transactions\n WHERE date >= ? AND date <= ? AND amount = ? AND account = ? AND is_child = 0`,\n [\n db.toDateRepr(monthUtils.subDays(trans.date, 4)),\n db.toDateRepr(monthUtils.addDays(trans.date, 1)),\n trans.amount || 0,\n acctId\n ]\n );\n }\n\n transactionsStep1.push({\n payee_name,\n trans,\n subtransactions,\n match,\n fuzzyDataset\n });\n }\n\n // Next, do the fuzzy matching. This first pass matches based on the\n // payee id. We do this in multiple passes so that higher fidelity\n // matching always happens first, i.e. a transaction should match\n // match with low fidelity if a later transaction is going to match\n // the same one with high fidelity.\n let transactionsStep2 = transactionsStep1.map(data => {\n if (!data.match && data.fuzzyDataset) {\n // Try to find one where the payees match.\n let match = data.fuzzyDataset.find(\n row => !hasMatched.has(row.id) && data.trans.payee === row.payee\n );\n\n if (match) {\n hasMatched.add(match.id);\n return { ...data, match };\n }\n }\n return data;\n });\n\n // The final fuzzy matching pass. This is the lowest fidelity\n // matching: it just find the first transaction that hasn't been\n // matched yet. Remember the the dataset only contains transactions\n // around the same date with the same amount.\n let transactionsStep3 = transactionsStep2.map(data => {\n if (!data.match && data.fuzzyDataset) {\n let match = data.fuzzyDataset.find(row => !hasMatched.has(row.id));\n if (match) {\n hasMatched.add(match.id);\n return { ...data, match };\n }\n }\n return data;\n });\n\n // Finally, generate & commit the changes\n for (let { payee_name, trans, subtransactions, match } of transactionsStep3) {\n if (match) {\n // TODO: change the above sql query to use aql\n let existing = {\n ...match,\n cleared: match.cleared === 1,\n date: db.fromDateRepr(match.date)\n };\n\n // Update the transaction\n const updates = {\n date: trans.date,\n imported_id: trans.imported_id || null,\n payee: existing.payee || trans.payee || null,\n category: existing.category || trans.category || null,\n imported_payee: trans.imported_payee || null,\n notes: existing.notes || trans.notes || null,\n cleared: trans.cleared != null ? trans.cleared : true\n };\n\n if (hasFieldsChanged(existing, updates, Object.keys(updates))) {\n updated.push({ id: existing.id, ...updates });\n }\n } else {\n // Insert a new transaction\n let finalTransaction = {\n ...trans,\n id: uuid.v4Sync(),\n category: trans.category || null,\n cleared: trans.cleared != null ? trans.cleared : true\n };\n\n if (subtransactions && subtransactions.length > 0) {\n added.push(...makeSplitTransaction(finalTransaction, subtransactions));\n } else {\n added.push(finalTransaction);\n }\n }\n }\n\n await createNewPayees(payeesToCreate, [...added, ...updated]);\n await batchUpdateTransactions({ added, updated });\n\n return {\n added: added.map(trans => trans.id),\n updated: updated.map(trans => trans.id)\n };\n}\n\n// This is similar to `reconcileTransactions` except much simpler: it\n// does not try to match any transactions. It just adds them\nexport async function addTransactions(\n acctId,\n transactions,\n { runTransfers = true } = {}\n) {\n const added = [];\n\n let { normalized, payeesToCreate } = await normalizeTransactions(\n transactions,\n acctId,\n { rawPayeeName: true }\n );\n\n for (let { payee_name, trans, subtransactions } of normalized) {\n // Run the rules\n trans = runRules(trans);\n\n let finalTransaction = {\n id: uuid.v4Sync(),\n ...trans,\n account: acctId,\n cleared: trans.cleared != null ? trans.cleared : true\n };\n\n // Add split transactions if they are given\n if (subtransactions && subtransactions.length > 0) {\n added.push(...makeSplitTransaction(finalTransaction, subtransactions));\n } else {\n added.push(finalTransaction);\n }\n }\n\n await createNewPayees(payeesToCreate, added);\n\n let newTransactions;\n if (runTransfers) {\n let res = await batchUpdateTransactions({ added });\n newTransactions = res.added.map(t => t.id);\n } else {\n await batchMessages(async () => {\n newTransactions = await Promise.all(\n added.map(async trans => db.insertTransaction(trans))\n );\n });\n }\n return newTransactions;\n}\n\nexport async function syncAccount(userId, userKey, id, acctId, bankId) {\n // TODO: Handle the case where transactions exist in the future\n // (that will make start date after end date)\n const latestTransaction = await db.first(\n 'SELECT * FROM v_transactions WHERE account = ? ORDER BY date DESC LIMIT 1',\n [id]\n );\n\n if (latestTransaction) {\n const startingTransaction = await db.first(\n 'SELECT date FROM v_transactions WHERE account = ? ORDER BY date ASC LIMIT 1',\n [id]\n );\n const startingDate = db.fromDateRepr(startingTransaction.date);\n // assert(startingTransaction)\n\n // Get all transactions since the latest transaction, plus any 5\n // days before the latest transaction. This gives us a chance to\n // resolve any transactions that were entered manually.\n //\n // TODO: What this really should do is query the last imported_id\n // and since then\n let date = monthUtils.subDays(db.fromDateRepr(latestTransaction.date), 31);\n\n // Never download transactions before the starting date. This was\n // when the account was added to the system.\n if (date < startingDate) {\n date = startingDate;\n }\n\n let { transactions, accountBalance } = await downloadTransactions(\n userId,\n userKey,\n acctId,\n bankId,\n date\n );\n if (transactions.length === 0) {\n return { added: [], updated: [] };\n }\n\n transactions = transactions.map(trans => ({ ...trans, account: id }));\n\n return runMutator(async () => {\n const result = await reconcileTransactions(id, transactions);\n await updateAccountBalance(id, accountBalance);\n return result;\n });\n } else {\n const acctRow = await db.select('accounts', id);\n\n // Otherwise, download transaction for the last few days if it's an\n // on-budget account, or for the past 30 days if off-budget\n const startingDay = monthUtils.subDays(\n monthUtils.currentDay(),\n acctRow.offbudget === 0 ? 1 : 30\n );\n\n const { transactions } = await downloadTransactions(\n userId,\n userKey,\n acctId,\n bankId,\n dateFns.format(dateFns.parseISO(startingDay), 'yyyy-MM-dd')\n );\n\n // We need to add a transaction that represents the starting\n // balance for everything to balance out. In order to get balance\n // before the first imported transaction, we need to get the\n // current balance from the accounts table and subtract all the\n // imported transactions.\n let currentBalance = acctRow.balance_current;\n\n const previousBalance = transactions.reduce((total, trans) => {\n return total - trans.amount;\n }, currentBalance);\n\n const oldestDate =\n transactions.length > 0\n ? transactions[transactions.length - 1].date\n : monthUtils.currentDay();\n\n let payee = await getStartingBalancePayee();\n\n return runMutator(async () => {\n let initialId = await db.insertTransaction({\n account: id,\n amount: previousBalance,\n category: acctRow.offbudget === 0 ? payee.category : null,\n payee: payee.id,\n date: oldestDate,\n cleared: true,\n starting_balance_flag: true\n });\n\n let result = await reconcileTransactions(id, transactions);\n return {\n ...result,\n added: [initialId, ...result.added]\n };\n });\n }\n}\n","// Utilities\nconst lowerCase = require('./lower-case');\nconst specials = require('./specials');\n\nlet character =\n '[0-9\\u0041-\\u005A\\u0061-\\u007A\\u00AA\\u00B5\\u00BA\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376-\\u0377\\u037A-\\u037D\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u0523\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0621-\\u064A\\u066E-\\u066F\\u0671-\\u06D3\\u06D5\\u06E5-\\u06E6\\u06EE-\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4-\\u07F5\\u07FA\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0972\\u097B-\\u097F\\u0985-\\u098C\\u098F-\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC-\\u09DD\\u09DF-\\u09E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u0EAB\\u0EAD-\\u0EB0\\u0EB2-\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EDC-\\u0EDD\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8B\\u1000-\\u102A\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065-\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10A0-\\u10C5\\u10D0-\\u10FA\\u10FC\\u1100-\\u1159\\u115F-\\u11A2\\u11A8-\\u11F9\\u1200-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u1676\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F0\\u1700-\\u170C\\u170E-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1877\\u1880-\\u18A8\\u18AA\\u1900-\\u191C\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19A9\\u19C1-\\u19C7\\u1A00-\\u1A16\\u1B05-\\u1B33\\u1B45-\\u1B4B\\u1B83-\\u1BA0\\u1BAE-\\u1BAF\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F\\u2090-\\u2094\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2C6F\\u2C71-\\u2C7D\\u2C80-\\u2CE4\\u2D00-\\u2D25\\u2D30-\\u2D65\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2E2F\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31B7\\u31F0-\\u31FF\\u3400\\u4DB5\\u4E00\\u9FC3\\uA000-\\uA48C\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A-\\uA62B\\uA640-\\uA65F\\uA662-\\uA66E\\uA67F-\\uA697\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78C\\uA7FB-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA90A-\\uA925\\uA930-\\uA946\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAC00\\uD7A3\\uF900-\\uFA2D\\uFA30-\\uFA6A\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40-\\uFB41\\uFB43-\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF21-\\uFF3A\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]';\nlet regex = new RegExp(\n `(?:(?:(\\\\s?(?:^|[.\\\\(\\\\)!?;:\"-])\\\\s*)(${character}))|(${character}))(${character}*[’']*${character}*)`,\n 'g'\n);\n\nlet convertToRegExp = specials =>\n specials.map(s => [new RegExp(`\\\\b${s}\\\\b`, 'gi'), s]);\n\nfunction parseMatch(match) {\n const firstCharacter = match[0];\n\n // test first character\n if (/\\s/.test(firstCharacter)) {\n // if whitespace - trim and return\n return match.substr(1);\n }\n if (/[()]/.test(firstCharacter)) {\n // if parens - this shouldn't be replaced\n return null;\n }\n\n return match;\n}\n\nmodule.exports = (str, options = {}) => {\n str = str\n .toLowerCase()\n .replace(regex, (m, lead = '', forced, lower, rest) => {\n const parsedMatch = parseMatch(m);\n if (!parsedMatch) {\n return m;\n }\n if (!forced) {\n const fullLower = lower + rest;\n\n if (lowerCase.has(fullLower)) {\n return parsedMatch;\n }\n }\n\n return lead + (lower || forced).toUpperCase() + rest;\n });\n\n const customSpecials = options.special || [];\n const replace = [...specials, ...customSpecials];\n const replaceRegExp = convertToRegExp(replace);\n\n replaceRegExp.forEach(([pattern, s]) => {\n str = str.replace(pattern, s);\n });\n\n return str;\n};\n","const conjunctions = [\n 'for',\n 'and',\n 'nor',\n 'but',\n 'or',\n 'yet',\n 'so'\n]\n\nconst articles = [\n 'a',\n 'an',\n 'the'\n]\n\nconst prepositions = [\n 'aboard',\n 'about',\n 'above',\n 'across',\n 'after',\n 'against',\n 'along',\n 'amid',\n 'among',\n 'anti',\n 'around',\n 'as',\n 'at',\n 'before',\n 'behind',\n 'below',\n 'beneath',\n 'beside',\n 'besides',\n 'between',\n 'beyond',\n 'but',\n 'by',\n 'concerning',\n 'considering',\n 'despite',\n 'down',\n 'during',\n 'except',\n 'excepting',\n 'excluding',\n 'following',\n 'for',\n 'from',\n 'in',\n 'inside',\n 'into',\n 'like',\n 'minus',\n 'near',\n 'of',\n 'off',\n 'on',\n 'onto',\n 'opposite',\n 'over',\n 'past',\n 'per',\n 'plus',\n 'regarding',\n 'round',\n 'save',\n 'since',\n 'than',\n 'through',\n 'to',\n 'toward',\n 'towards',\n 'under',\n 'underneath',\n 'unlike',\n 'until',\n 'up',\n 'upon',\n 'versus',\n 'via',\n 'with',\n 'within',\n 'without'\n]\n\nmodule.exports = new Set([\n ...conjunctions,\n ...articles,\n ...prepositions\n])\n","const intended = [\n 'CLI',\n 'API',\n 'HTTP',\n 'HTTPS',\n 'JSX',\n 'DNS',\n 'URL',\n 'CI',\n 'CDN',\n 'GitHub',\n 'CSS',\n 'JS',\n 'JavaScript',\n 'TypeScript',\n 'HTML',\n 'WordPress',\n 'JavaScript',\n 'Next.js',\n 'Node.js'\n];\n\nmodule.exports = intended;\n","import * as db from '../db';\nimport {\n Condition,\n Action,\n Rule,\n RuleIndexer,\n rankRules,\n migrateIds,\n iterateIds\n} from './rules';\nimport { getMappings } from '../db/mappings';\nimport { addDays, subDays, parseDate, dayFromDate } from '../../shared/months';\nimport { addSyncListener } from '../sync/index';\nimport { RuleError } from '../errors';\nimport {\n FIELD_TYPES,\n sortNumbers,\n getApproxNumberThreshold\n} from '../../shared/rules';\nimport q from '../../shared/query';\nimport { requiredFields, toDateRepr } from '../models';\nimport { currentDay } from '../../shared/months';\nimport { partitionByField, fastSetMerge } from '../../shared/util';\nimport { setSyncingMode, batchMessages } from '../sync';\nimport { schemaConfig } from '../aql/schema';\nconst uuid = require('../../platform/uuid');\n\n// TODO: Detect if it looks like the user is creating a rename rule\n// and prompt to create it in the pre phase instead\n// * We could also make the \"create rule\" button a dropdown that\n// provides different \"templates\" like \"create renaming rule\"\n\nexport { iterateIds } from './rules';\n\nlet allRules;\nlet unlistenSync;\nlet firstcharIndexer;\nlet payeeIndexer;\n\nexport function resetState() {\n allRules = new Map();\n firstcharIndexer = new RuleIndexer({\n field: 'imported_payee',\n method: 'firstchar'\n });\n payeeIndexer = new RuleIndexer({ field: 'payee' });\n}\n\n// Database functions\n\nfunction invert(obj) {\n return Object.fromEntries(\n Object.entries(obj).map(entry => {\n return [entry[1], entry[0]];\n })\n );\n}\n\nlet internalFields = schemaConfig.views.transactions.fields;\nlet publicFields = invert(schemaConfig.views.transactions.fields);\n\nfunction fromInternalField(obj) {\n return {\n ...obj,\n field: publicFields[obj.field] || obj.field\n };\n}\n\nfunction toInternalField(obj) {\n return {\n ...obj,\n field: internalFields[obj.field] || obj.field\n };\n}\n\nexport const ruleModel = {\n validate(rule, { update } = {}) {\n requiredFields('rules', rule, ['conditions', 'actions'], update);\n\n if (!update || 'stage' in rule) {\n if (\n rule.stage !== 'pre' &&\n rule.stage !== 'post' &&\n rule.stage !== null\n ) {\n throw new Error('Invalid rule stage: ' + rule.stage);\n }\n }\n\n return rule;\n },\n\n toJS(row) {\n function parseArray(str) {\n let value;\n try {\n value = typeof str === 'string' ? JSON.parse(str) : str;\n } catch (e) {\n throw new RuleError('internal', 'Cannot parse rule json');\n }\n\n if (!Array.isArray(value)) {\n throw new RuleError('internal', 'Rule json must be an array');\n }\n return value;\n }\n\n let rule = { ...row };\n rule.conditions = rule.conditions\n ? parseArray(rule.conditions).map(cond => fromInternalField(cond))\n : [];\n rule.actions = rule.actions\n ? parseArray(rule.actions).map(action => fromInternalField(action))\n : [];\n return rule;\n },\n\n fromJS(rule) {\n let row = { ...rule };\n if ('conditions' in row) {\n let conditions = row.conditions.map(cond => toInternalField(cond));\n row.conditions = JSON.stringify(conditions);\n }\n if ('actions' in row) {\n let actions = row.actions.map(action => toInternalField(action));\n row.actions = JSON.stringify(actions);\n }\n return row;\n }\n};\n\nexport function makeRule(data) {\n let rule;\n try {\n rule = new Rule({\n ...ruleModel.toJS(data),\n fieldTypes: FIELD_TYPES\n });\n } catch (e) {\n console.warn('Invalid rule', e);\n if (e instanceof RuleError) {\n return null;\n }\n throw e;\n }\n\n // This is needed because we map ids on the fly, and they might\n // not be persisted into the db. Mappings allow items to\n // transparently merge with other items\n migrateIds(rule, getMappings());\n\n return rule;\n}\n\nexport async function loadRules() {\n resetState();\n\n let rules = await db.all(`\n SELECT * FROM rules\n WHERE conditions IS NOT NULL AND actions IS NOT NULL AND tombstone = 0\n `);\n\n for (let i = 0; i < rules.length; i++) {\n let desc = rules[i];\n // These are old stages, can be removed before release\n if (desc.stage === 'cleanup' || desc.stage === 'modify') {\n desc.stage = 'pre';\n }\n\n let rule = makeRule(desc);\n if (rule) {\n allRules.set(rule.id, rule);\n firstcharIndexer.index(rule);\n payeeIndexer.index(rule);\n }\n }\n\n if (unlistenSync) {\n unlistenSync();\n }\n unlistenSync = addSyncListener(onApplySync);\n}\n\nexport function getRules() {\n // This can simply return the in-memory data\n return [...allRules.values()];\n}\n\nexport async function insertRule(rule) {\n rule = ruleModel.validate(rule);\n return db.insertWithUUID('rules', ruleModel.fromJS(rule));\n}\n\nexport async function updateRule(rule) {\n rule = ruleModel.validate(rule, { update: true });\n return db.update('rules', ruleModel.fromJS(rule));\n}\n\nexport async function deleteRule(rule) {\n let schedule = await db.first('SELECT id FROM schedules WHERE rule = ?', [\n rule.id\n ]);\n\n if (schedule) {\n return false;\n }\n\n return db.delete_('rules', rule.id);\n}\n\n// Sync projections\n\nfunction onApplySync(oldValues, newValues) {\n newValues.forEach((items, table) => {\n if (table === 'rules') {\n items.forEach(newValue => {\n let oldRule = allRules.get(newValue.id);\n\n if (newValue.tombstone === 1) {\n // Deleted, need to remove it from in-memory\n let rule = allRules.get(newValue.id);\n if (rule) {\n allRules.delete(rule.getId());\n firstcharIndexer.remove(rule);\n payeeIndexer.remove(rule);\n }\n } else {\n // Inserted/updated\n let rule = makeRule(newValue);\n if (rule) {\n if (oldRule) {\n firstcharIndexer.remove(oldRule);\n payeeIndexer.remove(oldRule);\n }\n allRules.set(newValue.id, rule);\n firstcharIndexer.index(rule);\n payeeIndexer.index(rule);\n }\n }\n });\n }\n });\n\n // If any of the mapping tables have changed, we need to refresh the\n // ids\n let tables = [...newValues.keys()];\n if (tables.find(table => table.indexOf('mapping') !== -1)) {\n getRules().forEach(rule => {\n migrateIds(rule, getMappings());\n });\n }\n}\n\n// Runner\nexport function runRules(trans) {\n let finalTrans = { ...trans };\n let allChanges = {};\n\n let rules = rankRules(\n fastSetMerge(\n firstcharIndexer.getApplicableRules(trans),\n payeeIndexer.getApplicableRules(trans)\n )\n );\n\n for (let i = 0; i < rules.length; i++) {\n finalTrans = rules[i].apply(finalTrans);\n }\n\n return finalTrans;\n}\n\n// This does the inverse: finds all the transactions matching a rule\nexport function conditionsToAQL(conditions, { recurDateBounds = 100 } = {}) {\n let errors = [];\n\n conditions = conditions\n .map(cond => {\n if (cond instanceof Condition) {\n return cond;\n }\n\n try {\n return new Condition(\n cond.op,\n cond.field,\n cond.value,\n cond.options,\n FIELD_TYPES\n );\n } catch (e) {\n errors.push(e.type || 'internal');\n console.log('conditionsToAQL: invalid condition: ' + e.message);\n return null;\n }\n })\n .filter(Boolean);\n\n // rule -> actualql\n let filters = conditions.map(cond => {\n let { type, field, op, value, options } = cond;\n\n let getValue = value => {\n if (type === 'number') {\n return value.value;\n }\n return value;\n };\n\n let apply = (field, op, value) => {\n if (type === 'number') {\n if (options) {\n if (options.outflow) {\n return {\n $and: [\n { amount: { $lt: 0 } },\n { [field]: { $transform: '$neg', [op]: value } }\n ]\n };\n } else if (options.inflow) {\n return {\n $and: [{ amount: { $gt: 0 } }, { [field]: { [op]: value } }]\n };\n }\n }\n\n return { amount: { [op]: value } };\n } else if (type === 'string') {\n return { [field]: { $transform: '$lower', [op]: value } };\n } else if (type === 'date') {\n return { [field]: { [op]: value.date } };\n }\n return { [field]: { [op]: value } };\n };\n\n switch (op) {\n case 'isapprox':\n case 'is':\n if (type === 'date') {\n if (value.type === 'recur') {\n let dates = value.schedule\n .occurrences({ take: recurDateBounds })\n .toArray()\n .map(d => dayFromDate(d.date));\n\n let compare = d => ({ $eq: d });\n\n return {\n $or: dates.map(d => {\n if (op === 'isapprox') {\n return {\n $and: [\n { date: { $gte: subDays(d, 2) } },\n { date: { $lte: addDays(d, 2) } }\n ]\n };\n }\n return { date: d };\n })\n };\n } else {\n let { date } = value;\n\n if (op === 'isapprox') {\n let fullDate = parseDate(value.date);\n let high = addDays(fullDate, 2);\n let low = subDays(fullDate, 2);\n\n return {\n $and: [{ date: { $gte: low } }, { date: { $lte: high } }]\n };\n } else {\n switch (value.type) {\n case 'date':\n return { date: value.date };\n case 'month': {\n let low = value.date + '-00';\n let high = value.date + '-99';\n return {\n $and: [{ date: { $gte: low } }, { date: { $lte: high } }]\n };\n }\n case 'year': {\n let low = value.date + '-00-00';\n let high = value.date + '-99-99';\n return {\n $and: [{ date: { $gte: low } }, { date: { $lte: high } }]\n };\n }\n default:\n }\n }\n }\n } else if (type === 'number') {\n let number = value.value;\n if (op === 'isapprox') {\n let threshold = getApproxNumberThreshold(number);\n\n return {\n $and: [\n apply(field, '$gte', number - threshold),\n apply(field, '$lte', number + threshold)\n ]\n };\n }\n return apply(field, '$eq', number);\n }\n\n return apply(field, '$eq', value);\n\n case 'isbetween':\n // This operator is only applicable to the specific `between`\n // number type so we don't use `apply`\n let [low, high] = sortNumbers(value.num1, value.num2);\n return {\n [field]: [{ $gte: low }, { $lte: high }]\n };\n case 'contains':\n // Running contains with id will automatically reach into\n // the `name` of the referenced table and do a string match\n return apply(\n type === 'id' ? field + '.name' : field,\n '$like',\n '%' + value + '%'\n );\n case 'oneOf':\n let values = value;\n if (values.length === 0) {\n // This forces it to match nothing\n return { id: null };\n }\n return { $or: values.map(v => apply(field, '$eq', v)) };\n case 'gt':\n return apply(field, '$gt', getValue(value));\n case 'gte':\n return apply(field, '$gte', getValue(value));\n case 'lt':\n return apply(field, '$lt', getValue(value));\n case 'lte':\n return apply(field, '$lte', getValue(value));\n case 'true':\n return apply(field, '$eq', true);\n case 'false':\n return apply(field, '$eq', false);\n default:\n throw new Error('Unhandled operator: ' + op);\n }\n });\n\n return { filters, errors };\n}\n\nexport function applyActions(transactionIds, actions, handlers) {\n let parsedActions = actions\n .map(action => {\n if (action instanceof Action) {\n return action;\n }\n\n try {\n return new Action(\n action.op,\n action.field,\n action.value,\n action.options,\n FIELD_TYPES\n );\n } catch (e) {\n console.log('Action error', e);\n return null;\n }\n })\n .filter(Boolean);\n\n if (parsedActions.length !== actions.length) {\n // An error happened while parsing\n return null;\n }\n\n let updated = transactionIds.map(id => {\n let update = { id };\n for (let action of parsedActions) {\n action.exec(update);\n }\n return update;\n });\n\n return handlers['transactions-batch-update']({ updated });\n}\n\nexport function getRulesForPayee(payeeId) {\n let rules = new Set();\n iterateIds(getRules(), 'payee', (rule, id) => {\n if (id === payeeId) {\n rules.add(rule);\n }\n });\n\n return rankRules([...rules]);\n}\n\nfunction* getIsSetterRules(\n stage,\n condField,\n actionField,\n { condValue, actionValue }\n) {\n let rules = getRules();\n for (let i = 0; i < rules.length; i++) {\n let rule = rules[i];\n\n if (\n rule.stage === stage &&\n rule.actions.length === 1 &&\n rule.actions[0].op === 'set' &&\n rule.actions[0].field === actionField &&\n (actionValue === undefined || rule.actions[0].value === actionValue) &&\n rule.conditions.length === 1 &&\n rule.conditions[0].op === 'is' &&\n rule.conditions[0].field === condField &&\n (condValue === undefined || rule.conditions[0].value === condValue)\n ) {\n yield rule.serialize();\n }\n }\n\n return null;\n}\n\nfunction* getOneOfSetterRules(\n stage,\n condField,\n actionField,\n { condValue, actionValue }\n) {\n let rules = getRules();\n for (let i = 0; i < rules.length; i++) {\n let rule = rules[i];\n\n if (\n rule.stage === stage &&\n rule.actions.length === 1 &&\n rule.actions[0].op === 'set' &&\n rule.actions[0].field === actionField &&\n (actionValue == null || rule.actions[0].value === actionValue) &&\n rule.conditions.length === 1 &&\n rule.conditions[0].op === 'oneOf' &&\n rule.conditions[0].field === condField &&\n (condValue == null || rule.conditions[0].value.indexOf(condValue) !== -1)\n ) {\n yield rule.serialize();\n }\n }\n\n return null;\n}\n\nexport async function updatePayeeRenameRule(fromNames, to) {\n let renameRule = getOneOfSetterRules('pre', 'imported_payee', 'payee', {\n actionValue: to\n }).next().value;\n\n // Note that we don't check for existing rules that set this\n // `imported_payee` to something else. It's important to do\n // that for categories because categories will be changes frequently\n // for the same payee, but renames won't be changed much. It's a use\n // case we could improve in the future, but this is fine for now.\n\n if (renameRule) {\n let condition = renameRule.conditions[0];\n let newValue = [\n ...fastSetMerge(\n new Set(condition.value),\n new Set(fromNames.filter(name => name !== ''))\n )\n ];\n let rule = {\n ...renameRule,\n conditions: [{ ...condition, value: newValue }]\n };\n await updateRule(rule);\n return renameRule.id;\n } else {\n let rule = new Rule({\n stage: 'pre',\n conditions: [{ op: 'oneOf', field: 'imported_payee', value: fromNames }],\n actions: [{ op: 'set', field: 'payee', value: to }],\n fieldTypes: FIELD_TYPES\n });\n return insertRule(rule.serialize());\n }\n}\n\nexport function getProbableCategory(transactions) {\n let scores = new Map();\n\n transactions.forEach(trans => {\n if (trans.category) {\n scores.set(trans.category, (scores.get(trans.category) || 0) + 1);\n }\n });\n\n let winner = transactions.reduce((winner, trans) => {\n let score = scores.get(trans.category);\n if (!winner || score > winner.score) {\n return { score, category: trans.category };\n }\n return winner;\n }, null);\n\n return winner.score >= 3 ? winner.category : null;\n}\n\nexport async function updateCategoryRules(transactions) {\n if (transactions.length === 0) {\n return;\n }\n\n let payeeIds = new Set(transactions.map(trans => trans.payee));\n let transIds = new Set(transactions.map(trans => trans.id));\n\n // It's going to be quickest to get the oldest date and then query\n // all transactions since then so we can work in memory\n let oldestDate = null;\n for (let i = 0; i < transactions.length; i++) {\n if (oldestDate === null || transactions[i].date < oldestDate) {\n oldestDate = transactions[i].date;\n }\n }\n\n // We look 6 months behind to include any other transaction. This\n // makes it so we, 1. don't have to load in all transactions ever\n // and 2. \"forget\" really old transactions which might be nice and\n // 3. don't have to individually run a query for each payee\n oldestDate = subDays(oldestDate, 180);\n\n // Also look 180 days in the future to get any future transactions\n // (this might change when we think about scheduled transactions)\n let register = await db.all(\n `SELECT t.* FROM v_transactions t\n LEFT JOIN accounts a ON a.id = t.account\n WHERE date >= ? AND date <= ? AND is_parent = 0 AND a.closed = 0`,\n [toDateRepr(oldestDate), toDateRepr(addDays(currentDay(), 180))]\n );\n\n let allTransactions = partitionByField(register, 'payee');\n let categoriesToSet = new Map();\n\n for (let payeeId of payeeIds) {\n // Don't do anything if payee is null\n if (payeeId) {\n let latestTrans = (allTransactions.get(payeeId) || []).slice(0, 5);\n\n // Check if one of the latest transactions was one that was\n // updated. We only want to update anything if so.\n if (latestTrans.find(trans => transIds.has(trans.id))) {\n let category = getProbableCategory(latestTrans);\n if (category) {\n categoriesToSet.set(payeeId, category);\n }\n }\n }\n }\n\n await batchMessages(async () => {\n for (let [payeeId, category] of categoriesToSet.entries()) {\n let ruleSetters = [\n ...getIsSetterRules(null, 'payee', 'category', {\n condValue: payeeId\n })\n ];\n\n if (ruleSetters.length > 0) {\n // If there are existing rules, change all of them to the new\n // category (if they aren't already using it). We set all of\n // them because it's possible that multiple rules exist\n // because 2 clients made them independently. Not really a big\n // deal, but to make sure our update gets applied set it to\n // all of them\n for (let rule of ruleSetters) {\n let action = rule.actions[0];\n if (action.value !== category) {\n await updateRule({\n ...rule,\n actions: [{ ...action, value: category }]\n });\n }\n }\n } else {\n // No existing rules, so create one\n let newRule = new Rule({\n stage: null,\n conditions: [{ op: 'is', field: 'payee', value: payeeId }],\n actions: [{ op: 'set', field: 'category', value: category }],\n fieldTypes: FIELD_TYPES\n });\n await insertRule(newRule.serialize());\n }\n }\n });\n}\n\n// This can be removed in the future\nexport async function migrateOldRules() {\n let allPayees = await db.all(\n `SELECT p.*, c.id as category FROM payees p\n LEFT JOIN category_mapping cm ON cm.id = p.category\n LEFT JOIN categories c ON (c.id = cm.transferId AND c.tombstone = 0)\n WHERE p.tombstone = 0 AND transfer_acct IS NULL`\n );\n let allRules = await db.all(\n `SELECT pr.*, pm.targetId as payee_id FROM payee_rules pr\n LEFT JOIN payee_mapping pm ON pm.id = pr.payee_id\n WHERE pr.tombstone = 0`\n );\n\n let payeesById = new Map();\n for (let i = 0; i < allPayees.length; i++) {\n payeesById.set(allPayees[i].id, allPayees[i]);\n }\n\n let rulesByPayeeId = new Map();\n for (let i = 0; i < allRules.length; i++) {\n let item = allRules[i];\n let rules = rulesByPayeeId.get(item.payee_id) || [];\n rules.push(item);\n rulesByPayeeId.set(item.payee_id, rules);\n }\n\n let rules = [];\n\n // Convert payee name rules\n for (let [payeeId, payeeRules] of rulesByPayeeId.entries()) {\n let equals = payeeRules.filter(r => {\n let payee = payeesById.get(r.payee_id);\n\n return (\n (r.type === 'equals' || r.type == null) &&\n (!payee || r.value.toLowerCase() !== payee.name.toLowerCase())\n );\n });\n let contains = payeeRules.filter(r => r.type === 'contains');\n let actions = [{ op: 'set', field: 'payee', value: payeeId }];\n\n if (equals.length > 0) {\n rules.push({\n stage: null,\n conditions: [\n {\n op: 'oneOf',\n field: 'imported_payee',\n value: equals.map(payeeRule => payeeRule.value)\n }\n ],\n actions\n });\n }\n\n if (contains.length > 0) {\n rules = rules.concat(\n contains.map(payeeRule => ({\n stage: null,\n conditions: [\n {\n op: 'contains',\n field: 'imported_payee',\n value: payeeRule.value\n }\n ],\n actions\n }))\n );\n }\n }\n\n // Convert category rules\n let catRules = allPayees\n .filter(p => p.category)\n .reduce((map, payee) => {\n let ids = map.get(payee.category) || new Set();\n ids.add(payee.id);\n map.set(payee.category, ids);\n return map;\n }, new Map());\n\n for (let [catId, payeeIds] of catRules) {\n rules.push({\n stage: null,\n conditions: [\n {\n op: 'oneOf',\n field: 'payee',\n value: [...payeeIds]\n }\n ],\n actions: [\n {\n op: 'set',\n field: 'category',\n value: catId\n }\n ]\n });\n }\n\n // Very important: we never want to sync migration changes, but it\n // still has to run through the syncing layer to make sure\n // projections are correct. This is only OK because we require a\n // sync reset after this.\n let prevMode = setSyncingMode('disabled');\n await batchMessages(async () => {\n for (let rule of rules) {\n await insertRule({\n stage: rule.stage,\n conditions: rule.conditions,\n actions: rule.actions\n });\n }\n\n await db.runQuery('DELETE FROM payee_rules', []);\n });\n setSyncingMode(prevMode);\n}\n","import * as sheet from '../sheet';\nimport { batchMessages } from '../sync';\nimport * as db from '../db';\nimport { incrFetch, whereIn } from '../db/util';\nimport * as transfer from './transfer';\nimport * as rules from './transaction-rules';\nconst connection = require('../../platform/server/connection');\n\nasync function idsWithChildren(ids) {\n let whereIds = whereIn(ids, 'parent_id');\n let rows = await db.all(\n `SELECT id FROM v_transactions_internal WHERE ${whereIds}`\n );\n let set = new Set(ids);\n for (let row of rows) {\n set.add(row.id);\n }\n return [...set];\n}\n\nasync function getTransactionsByIds(ids) {\n // TODO: convert to whereIn\n //\n // or better yet, use ActualQL\n return incrFetch(\n (query, params) => db.selectWithSchema('transactions', query, params),\n ids,\n id => `id = '${id}'`,\n where => `SELECT * FROM v_transactions_internal WHERE ${where}`\n );\n}\n\nexport async function batchUpdateTransactions({\n added,\n deleted,\n updated,\n learnCategories = false,\n detectOrphanPayees = true\n}) {\n // Track the ids of each type of transaction change (see below for why)\n let addedIds = [];\n let updatedIds = updated ? updated.map(u => u.id) : [];\n let deletedIds = deleted ? await idsWithChildren(deleted.map(d => d.id)) : [];\n\n let oldPayees = new Set();\n let accounts = await db.all('SELECT * FROM accounts WHERE tombstone = 0');\n\n // We need to get all the payees of updated transactions _before_\n // making changes\n if (updated) {\n let descUpdatedIds = updated\n .filter(update => update.payee)\n .map(update => update.id);\n\n let transactions = await getTransactionsByIds(descUpdatedIds);\n\n for (let i = 0; i < transactions.length; i++) {\n oldPayees.add(transactions[i].payee);\n }\n }\n\n // Apply all the updates. We can batch this now! This is important\n // and makes bulk updates much faster\n await batchMessages(async () => {\n if (added) {\n addedIds = await Promise.all(\n added.map(async t => db.insertTransaction(t))\n );\n }\n\n if (deleted) {\n await Promise.all(\n // It's important to use `deletedIds` and not `deleted` here\n // because we've expanded it to include children above. The\n // inconsistency of the delete APIs is annoying and should\n // be fixed (it should only take an id)\n deletedIds.map(async id => {\n await db.deleteTransaction({ id });\n })\n );\n }\n\n if (updated) {\n await Promise.all(\n updated.map(async t => {\n if (t.account) {\n // Moving transactions off budget should always clear the\n // category\n let account = accounts.find(acct => acct.id === t.account);\n if (account.offbudget === 1) {\n t.category = null;\n }\n }\n\n await db.updateTransaction(t);\n })\n );\n }\n });\n\n // Get all of the full transactions that were changed. This is\n // needed to run any cascading logic that depends on the full\n // transaction. Things like transfers, analyzing rule updates, and\n // more\n let allAdded = await getTransactionsByIds(addedIds);\n let allUpdated = await getTransactionsByIds(updatedIds);\n let allDeleted = await getTransactionsByIds(deletedIds);\n\n // Post-processing phase: first do any updates to transfers.\n // Transfers update the transactions and we need to return updates\n // to the client so that can apply them. Note that added\n // transactions just return the full transaction.\n let resultAdded = allAdded;\n let resultUpdated;\n\n await batchMessages(async () => {\n await Promise.all(allAdded.map(t => transfer.onInsert(t)));\n\n // Return any updates from here\n resultUpdated = (await Promise.all(\n allUpdated.map(t => transfer.onUpdate(t))\n )).filter(Boolean);\n\n await Promise.all(allDeleted.map(t => transfer.onDelete(t)));\n });\n\n if (learnCategories) {\n // Analyze any updated categories and update rules to learn from\n // the user's activity\n let ids = new Set([\n ...(added ? added.filter(add => add.category).map(add => add.id) : []),\n ...(updated\n ? updated.filter(update => update.category).map(update => update.id)\n : [])\n ]);\n await rules.updateCategoryRules(\n allAdded.concat(allUpdated).filter(trans => ids.has(trans.id))\n );\n }\n\n if (detectOrphanPayees) {\n // Look for any orphaned payees and notify the user about merging\n // them\n\n if (updated) {\n let newPayeeIds = updated.map(u => u.payee).filter(Boolean);\n if (newPayeeIds.length > 0) {\n let allOrphaned = new Set(await db.getOrphanedPayees());\n\n let orphanedIds = [...oldPayees].filter(id => allOrphaned.has(id));\n\n if (orphanedIds.length > 0) {\n connection.send('orphaned-payees', {\n orphanedIds,\n updatedPayeeIds: newPayeeIds\n });\n }\n }\n }\n }\n\n return {\n added: resultAdded,\n updated: resultUpdated\n };\n}\n","import * as db from '../db';\n\nasync function getPayee(acct) {\n return db.first('SELECT * FROM payees WHERE transfer_acct = ?', [acct]);\n}\n\nasync function getTransferredAccount(transaction) {\n if (transaction.payee) {\n let { transfer_acct, id } = await db.first(\n 'SELECT id, transfer_acct FROM v_payees WHERE id = ?',\n [transaction.payee]\n );\n return transfer_acct;\n }\n return null;\n}\n\nasync function clearCategory(transaction, transferAcct) {\n const { offbudget: fromOffBudget } = await db.first(\n 'SELECT offbudget FROM accounts WHERE id = ?',\n [transaction.account]\n );\n const { offbudget: toOffBudget } = await db.first(\n 'SELECT offbudget FROM accounts WHERE id = ?',\n [transferAcct]\n );\n\n // We should clear the category to make sure it's not being\n // accounted for in the budget, unless it should be in the case of\n // transferring from an on-budget to off-budget account\n if (fromOffBudget === toOffBudget) {\n await db.updateTransaction({ id: transaction.id, category: null });\n return true;\n }\n return false;\n}\n\nexport async function addTransfer(transaction, transferredAccount) {\n let { id: fromPayee } = await db.first(\n 'SELECT id FROM payees WHERE transfer_acct = ?',\n [transaction.account]\n );\n\n // We need to enforce certain constraints with child transaction transfers\n if (transaction.parent_id) {\n let row = await db.first(\n `\n SELECT p.id, p.transfer_acct FROM v_transactions t\n LEFT JOIN payees p ON p.id = t.payee\n WHERE t.id = ?\n `,\n [transaction.parent_id]\n );\n\n if (row.transfer_acct) {\n if (row.id !== transaction.payee) {\n // This child transaction is trying to use a transfer payee,\n // but the parent is already using a different transfer payee.\n // This is not allowed, so not only do we do nothing, we clear\n // the payee of the child transaction to make it clear\n await db.updateTransaction({ id: transaction.id, payee: null });\n return { id: transaction.id, payee: null };\n }\n\n // The parent has the same transfer payee, so it \"owns\" the\n // transfer logic\n return null;\n }\n }\n\n const id = await db.insertTransaction({\n account: transferredAccount,\n amount: -transaction.amount,\n payee: fromPayee,\n date: transaction.date,\n transfer_id: transaction.id,\n notes: transaction.notes || null,\n cleared: false\n });\n\n await db.updateTransaction({ id: transaction.id, transfer_id: id });\n const categoryCleared = await clearCategory(transaction, transferredAccount);\n\n return {\n id: transaction.id,\n transfer_id: id,\n ...(categoryCleared ? { category: null } : {})\n };\n}\n\nexport async function removeTransfer(transaction) {\n let transferTrans = await db.getTransaction(transaction.transfer_id);\n if (transferTrans.is_child) {\n // If it's a child transaction, we don't delete it because that\n // would invalidate the whole split transaction. Instead of turn\n // it into a normal transaction\n await db.updateTransaction({\n id: transaction.transfer_id,\n transfer_id: null,\n payee: null\n });\n } else {\n await db.deleteTransaction({ id: transaction.transfer_id });\n }\n await db.updateTransaction({ id: transaction.id, transfer_id: null });\n return { id: transaction.id, transfer_id: null };\n}\n\nexport async function updateTransfer(transaction, transferredAccount) {\n let payee = await getPayee(transaction.account);\n\n await db.updateTransaction({\n id: transaction.transfer_id,\n account: transferredAccount,\n // Make sure to update the payee on the other side in case the\n // user moved this transaction into another account\n payee: payee.id,\n date: transaction.date,\n notes: transaction.notes,\n amount: -transaction.amount\n });\n\n const categoryCleared = await clearCategory(transaction, transferredAccount);\n if (categoryCleared) {\n return { id: transaction.id, category: null };\n }\n}\n\nexport async function onInsert(transaction) {\n let transferredAccount = await getTransferredAccount(transaction);\n\n if (transferredAccount) {\n return addTransfer(transaction, transferredAccount);\n }\n}\n\nexport async function onDelete(transaction) {\n if (transaction.transfer_id) {\n await removeTransfer(transaction);\n }\n}\n\nexport async function onUpdate(transaction) {\n const transferredAccount = await getTransferredAccount(transaction);\n\n if (transferredAccount && !transaction.transfer_id) {\n return addTransfer(transaction, transferredAccount);\n }\n\n if (!transferredAccount && transaction.transfer_id) {\n return removeTransfer(transaction);\n }\n\n if (transferredAccount && transaction.transfer_id) {\n return updateTransfer(transaction, transferredAccount);\n }\n}\n","import * as models from './models';\n\nexport const transactionModel = {\n ...models.transactionModel,\n\n toExternal(transactions, idx, payees) {\n return transactions;\n // function convert(t, payee) {\n // return {\n // id: t.id,\n // account_id: t.acct,\n // amount: t.amount,\n // payee_id: payee ? payee.id : null,\n // payee: payee ? payee.name : null,\n // imported_payee: t.imported_description,\n // category_id: t.category,\n // date: t.date,\n // notes: t.notes,\n // imported_id: t.financial_id,\n // transfer_id: t.transferred_id,\n // cleared: t.cleared\n // };\n // }\n\n // let splits = getAllSplitTransactions(transactions, idx);\n // if (splits) {\n // let payee =\n // splits.parent.description && payees[splits.parent.description];\n\n // return {\n // ...convert(splits.parent, payee),\n // subtransactions: splits.children.map(child => convert(child, payee))\n // };\n // }\n\n // let transaction = transactions[idx];\n // let payee = transaction.description && payees[transaction.description];\n // return convert(transaction, payee);\n },\n\n fromExternal(transaction) {\n let result = {};\n if ('id' in transaction) {\n result.id = transaction.id;\n }\n if ('account_id' in transaction) {\n result.acct = transaction.account_id;\n }\n if ('amount' in transaction) {\n result.amount = transaction.amount;\n }\n if ('payee_id' in transaction) {\n result.description = transaction.payee_id;\n }\n if ('imported_payee' in transaction) {\n result.imported_description = transaction.imported_payee;\n }\n if ('category_id' in transaction) {\n result.category = transaction.category_id;\n }\n if ('date' in transaction) {\n result.date = transaction.date;\n }\n if ('notes' in transaction) {\n result.notes = transaction.notes;\n }\n if ('imported_id' in transaction) {\n result.financial_id = transaction.imported_id;\n }\n if ('transfer_id' in transaction) {\n result.transferred_id = transaction.transfer_id;\n }\n if ('cleared' in transaction) {\n result.cleared = transaction.cleared;\n }\n return result;\n }\n};\n\nexport const accountModel = {\n ...models.accountModel,\n\n toExternal(account) {\n return {\n id: account.id,\n name: account.name,\n type: account.type,\n offbudget: account.offbudget ? true : false,\n closed: account.closed ? true : false\n };\n },\n\n fromExternal(account) {\n let result = { ...account };\n if ('offbudget' in account) {\n result.offbudget = account.offbudget ? 1 : 0;\n }\n if ('closed' in account) {\n result.closed = account.closed ? 1 : 0;\n }\n return result;\n }\n};\n\nexport const categoryModel = {\n ...models.categoryModel,\n\n toExternal(category) {\n return {\n id: category.id,\n name: category.name,\n is_income: category.is_income ? true : false,\n group_id: category.cat_group\n };\n },\n\n fromExternal(category) {\n let { group_id: _, ...result } = category;\n if ('is_income' in category) {\n result.is_income = category.is_income ? 1 : 0;\n }\n if ('group_id' in category) {\n result.cat_group = category.group_id;\n }\n return result;\n }\n};\n\nexport const categoryGroupModel = {\n ...models.categoryGroupModel,\n\n toExternal(group) {\n return {\n id: group.id,\n name: group.name,\n is_income: group.is_income ? true : false,\n categories: group.categories.map(categoryModel.toExternal)\n };\n },\n\n fromExternal(group) {\n let result = { ...group };\n if ('is_income' in group) {\n result.is_income = group.is_income ? 1 : 0;\n }\n if ('categories' in group) {\n result.categories = group.categories.map(categoryModel.fromExternal);\n }\n return result;\n }\n};\n\nexport const payeeModel = {\n ...models.payeeModel,\n\n toExternal(payee) {\n return {\n id: payee.id,\n name: payee.name,\n category: payee.category,\n transfer_acct: payee.transfer_acct\n };\n },\n\n fromExternal(payee) {\n // No translation is needed\n return payee;\n }\n};\n\nexport const payeeRuleModel = {\n ...models.payeeRuleModel,\n\n toExternal(rule) {\n let { tombstone, ...result } = rule;\n return result;\n },\n\n fromExternal(rule) {\n return rule;\n }\n};\n","import { addTransactions } from './accounts/sync';\nimport {\n transactionModel,\n accountModel,\n categoryModel,\n categoryGroupModel,\n payeeModel,\n payeeRuleModel\n} from './api-models';\nimport {\n ungroupTransactions,\n updateTransaction,\n deleteTransaction\n} from '../shared/transactions';\nimport * as db from './db';\nimport * as sheet from './sheet';\nimport * as prefs from './prefs';\nimport * as monthUtils from '../shared/months';\nimport * as update from './update';\nimport * as cloudStorage from './cloud-storage';\nimport { setSyncingMode, batchMessages } from './sync';\nimport { groupById, cleanUUID } from '../shared/util';\nimport { getClock } from './timestamp';\nimport { runMutator } from './mutators';\nimport { integerToAmount } from '../shared/util';\nimport { runQuery as aqlQuery } from './aql/schema/run-query';\nimport q from '../shared/query';\n\nconst { resolveName } = require('./spreadsheet/util');\nconst connection = require('../platform/server/connection');\n\nlet IMPORT_MODE = false;\n\n// This is duplicate from main.js...\nfunction APIError(msg, meta) {\n return { type: 'APIError', message: msg, meta };\n}\n\n// The API is different in two ways: we never want undo enabled, and\n// we also need to notify the UI manually if stuff has changed (if\n// they are connecting to an already running instance, the UI should\n// update). The wrapper handles that.\nfunction withMutation(handler) {\n return args => {\n return runMutator(\n async () => {\n let latestTimestamp = getClock().timestamp.toString();\n let result = await handler(args);\n\n let rows = await db.all(\n 'SELECT DISTINCT dataset FROM messages_crdt WHERE timestamp > ?',\n [latestTimestamp]\n );\n\n // Only send the sync event if anybody else is connected\n if (connection.getNumClients() > 1) {\n connection.send('sync-event', {\n type: 'success',\n tables: rows.map(row => row.dataset)\n });\n }\n\n return result;\n },\n { undoDisabled: true }\n );\n };\n}\n\nlet handlers = {};\n\nasync function validateMonth(month) {\n if (!month.match(/^\\d{4}-\\d{2}$/)) {\n throw APIError('Invalid month format, use YYYY-MM: ' + month);\n }\n\n if (!IMPORT_MODE) {\n let { start, end } = await handlers['get-budget-bounds']();\n let range = monthUtils.range(start, end);\n if (!range.includes(month)) {\n throw APIError('No budget exists for month: ' + month);\n }\n }\n}\n\nasync function validateExpenseCategory(debug, id) {\n if (id == null) {\n throw APIError(`${debug}: category id is required`);\n }\n\n let row = await db.first('SELECT is_income FROM categories WHERE id = ?', [\n id\n ]);\n\n if (!row) {\n throw APIError(`${debug}: category \"${id}\" does not exist`);\n }\n\n if (row.is_income !== 0) {\n throw APIError(`${debug}: category \"${id}\" is not an expense category`);\n }\n}\n\nlet batchPromise = null;\n\nhandlers['api/batch-budget-start'] = async function() {\n if (batchPromise) {\n throw APIError('Cannot start a batch process: batch already started');\n }\n\n // If we are importing, all we need to do is start a raw database\n // transaction. Updating spreadsheet cells doesn't go through the\n // syncing layer in that case.\n if (IMPORT_MODE) {\n db.asyncTransaction(() => {\n return new Promise((resolve, reject) => {\n batchPromise = { resolve, reject };\n });\n });\n } else {\n batchMessages(() => {\n return new Promise((resolve, reject) => {\n batchPromise = { resolve, reject };\n });\n });\n }\n};\n\nhandlers['api/batch-budget-end'] = async function() {\n if (!batchPromise) {\n throw APIError('Cannot end a batch process: no batch started');\n }\n\n batchPromise.resolve();\n batchPromise = null;\n};\n\nhandlers['api/load-budget'] = async function({ id }) {\n let { id: currentId } = prefs.getPrefs() || {};\n\n if (currentId !== id) {\n connection.send('start-load');\n let { error } = await handlers['load-budget']({ id });\n\n if (!error) {\n connection.send('finish-load');\n } else {\n connection.send('show-budgets');\n\n if (error === 'out-of-sync-migrations' || error === 'out-of-sync-data') {\n throw new Error(\n 'This budget cannot be loaded with this version of the app.'\n );\n } else if (error === 'budget-not-found') {\n throw new Error(\n 'Budget \"' +\n id +\n '\" not found. Check the id of your budget in the \"Advanced\" section of the settings page.'\n );\n } else {\n throw new Error('We had an unknown problem opening \"' + id + '\".');\n }\n }\n }\n};\n\nhandlers['api/start-import'] = async function({ budgetName }) {\n // Notify UI to close budget\n await handlers['close-budget']();\n\n // Create the budget\n await handlers['create-budget']({ budgetName, avoidUpload: true });\n\n // Clear out the default expense categories\n await db.runQuery('DELETE FROM categories WHERE is_income = 0');\n await db.runQuery('DELETE FROM category_groups WHERE is_income = 0');\n\n // Turn syncing off\n setSyncingMode('import');\n\n connection.send('start-import');\n IMPORT_MODE = true;\n};\n\nhandlers['api/finish-import'] = async function() {\n sheet.get().markCacheDirty();\n\n // We always need to fully reload the app. Importing doesn't touch\n // the spreadsheet, but we can't just recreate the spreadsheet\n // either; there is other internal state that isn't created\n let { id } = prefs.getPrefs();\n await handlers['close-budget']();\n await handlers['load-budget']({ id });\n\n await handlers['get-budget-bounds']();\n await sheet.waitOnSpreadsheet();\n\n await cloudStorage.upload().catch(err => {});\n\n connection.send('finish-import');\n IMPORT_MODE = false;\n};\n\nhandlers['api/abort-import'] = async function() {\n if (IMPORT_MODE) {\n let { id } = prefs.getPrefs();\n\n await handlers['close-budget']();\n await handlers['delete-budget']({ id });\n connection.send('show-budgets');\n }\n\n IMPORT_MODE = false;\n};\n\nhandlers['api/query'] = async function({ query }) {\n return aqlQuery(query);\n};\n\nhandlers['api/budget-months'] = async function() {\n let { start, end } = await handlers['get-budget-bounds']();\n return monthUtils.range(start, end);\n};\n\nhandlers['api/budget-month'] = async function({ month }) {\n await validateMonth(month);\n\n let groups = await db.getCategoriesGrouped();\n let sheetName = monthUtils.sheetForMonth(month);\n\n function value(name) {\n let v = sheet.get().getCellValue(sheetName, name);\n return v === '' ? 0 : v;\n }\n\n // This is duplicated from main.js because the return format is\n // different (for now)\n return {\n month,\n incomeAvailable: value('available-funds'),\n lastMonthOverspent: value('last-month-overspent'),\n forNextMonth: value('buffered'),\n totalBudgeted: value('total-budgeted'),\n toBudget: value('to-budget'),\n\n fromLastMonth: value('from-last-month'),\n totalIncome: value('total-income'),\n totalSpent: value('total-spent'),\n totalBalance: value('total-leftover'),\n\n categoryGroups: groups.map(group => {\n if (group.is_income) {\n return {\n ...categoryGroupModel.toExternal(group),\n received: value('total-income'),\n\n categories: group.categories.map(cat => ({\n ...categoryModel.toExternal(cat),\n received: value(`sum-amount-${cat.id}`)\n }))\n };\n }\n\n return {\n ...categoryGroupModel.toExternal(group),\n budgeted: value(`group-budget-${group.id}`),\n spent: value(`group-sum-amount-${group.id}`),\n balance: value(`group-leftover-${group.id}`),\n\n categories: group.categories.map(cat => ({\n ...categoryModel.toExternal(cat),\n budgeted: value(`budget-${cat.id}`),\n spent: value(`sum-amount-${cat.id}`),\n balance: value(`leftover-${cat.id}`),\n carryover: value(`carryover-${cat.id}`)\n }))\n };\n })\n };\n};\n\nhandlers['api/budget-set-amount'] = withMutation(async function({\n month,\n categoryId,\n amount\n}) {\n return handlers['budget/budget-amount']({\n month,\n category: categoryId,\n amount\n });\n});\n\nhandlers['api/budget-set-carryover'] = withMutation(async function({\n month,\n categoryId,\n flag\n}) {\n await validateMonth(month);\n await validateExpenseCategory('budget-set-carryover', categoryId);\n return handlers['budget/set-carryover']({\n startMonth: month,\n category: categoryId,\n flag\n });\n});\n\nhandlers['api/transactions-export'] = async function({\n transactions,\n categoryGroups,\n payees\n}) {\n return handlers['transactions-export']({\n transactions,\n categoryGroups,\n payees\n });\n};\n\nhandlers['api/transactions-import'] = withMutation(async function({\n accountId,\n transactions\n}) {\n return handlers['transactions-import']({ accountId, transactions });\n});\n\nhandlers['api/transactions-add'] = withMutation(async function({\n accountId,\n transactions\n}) {\n await addTransactions(accountId, transactions, { runTransfers: false });\n return 'ok';\n});\n\nhandlers['api/transactions-get'] = async function({\n accountId,\n startDate,\n endDate\n}) {\n let { data } = await aqlQuery(\n q('transactions')\n .filter({\n $and: [\n accountId && { account: accountId },\n startDate && { date: { $gte: startDate } },\n endDate && { date: { $lte: endDate } }\n ].filter(Boolean)\n })\n .select('*')\n .options({ splits: 'grouped' })\n );\n return data;\n};\n\nhandlers['api/transactions-filter'] = async function({ text, accountId }) {\n throw new Error('`filterTransactions` is deprecated, use `runQuery` instead');\n};\n\nhandlers['api/transaction-update'] = withMutation(async function({\n id,\n fields\n}) {\n let { data } = await aqlQuery(\n q('transactions')\n .filter({ id })\n .select('*')\n .options({ splits: 'grouped' })\n );\n let transactions = ungroupTransactions(data);\n\n if (transactions.length === 0) {\n return [];\n }\n\n let { diff } = updateTransaction(transactions, fields);\n return handlers['transactions-batch-update'](diff);\n});\n\nhandlers['api/transaction-delete'] = withMutation(async function({ id }) {\n let { data } = await aqlQuery(\n q('transactions')\n .filter({ id })\n .select('*')\n .options({ splits: 'grouped' })\n );\n let transactions = ungroupTransactions(data);\n\n if (transactions.length === 0) {\n return [];\n }\n\n let { diff } = deleteTransaction(transactions, id);\n return handlers['transactions-batch-update'](diff);\n});\n\nhandlers['api/accounts-get'] = async function() {\n let accounts = await db.getAccounts();\n return accounts.map(account => accountModel.toExternal(account));\n};\n\nhandlers['api/account-create'] = withMutation(async function({\n account,\n initialBalance = null\n}) {\n return handlers['account-create']({\n name: account.name,\n type: account.type,\n offBudget: account.offbudget,\n closed: account.closed,\n // Current the API expects an amount but it really should expect\n // an integer\n balance: initialBalance != null ? integerToAmount(initialBalance) : null\n });\n});\n\nhandlers['api/account-update'] = withMutation(async function({ id, fields }) {\n return db.updateAccount({ id, ...accountModel.fromExternal(fields) });\n});\n\nhandlers['api/account-close'] = withMutation(async function({\n id,\n transferAccountId,\n transferCategoryId\n}) {\n return handlers['account-close']({\n id,\n transferAccountId,\n categoryId: transferCategoryId\n });\n});\n\nhandlers['api/account-reopen'] = withMutation(async function({ id }) {\n return handlers['account-reopen']({ id });\n});\n\nhandlers['api/account-delete'] = withMutation(async function({ id }) {\n return handlers['account-close']({ id, forced: true });\n});\n\nhandlers['api/categories-get'] = async function({ grouped } = {}) {\n let result = await handlers['get-categories']();\n return grouped\n ? result.grouped.map(categoryGroupModel.toExternal)\n : result.list.map(categoryModel.toExternal);\n};\n\nhandlers['api/category-group-create'] = withMutation(async function({ group }) {\n return handlers['category-group-create']({ name: group.name });\n});\n\nhandlers['api/category-group-update'] = withMutation(async function({\n id,\n fields\n}) {\n return handlers['category-group-update']({\n id,\n ...categoryGroupModel.fromExternal(fields)\n });\n});\n\nhandlers['api/category-group-delete'] = withMutation(async function({\n id,\n transferCategoryId\n}) {\n return handlers['category-group-delete']({\n id,\n transferId: transferCategoryId\n });\n});\n\nhandlers['api/category-create'] = withMutation(async function({ category }) {\n return handlers['category-create']({\n name: category.name,\n groupId: category.group_id,\n isIncome: category.is_income\n });\n});\n\nhandlers['api/category-update'] = withMutation(async function({ id, fields }) {\n return handlers['category-update']({\n id,\n ...categoryModel.fromExternal(fields)\n });\n});\n\nhandlers['api/category-delete'] = withMutation(async function({\n id,\n transferCategoryId\n}) {\n return handlers['category-delete']({\n id,\n transferId: transferCategoryId\n });\n});\n\nhandlers['api/payees-get'] = async function() {\n let payees = await handlers['payees-get']();\n return payees.map(payeeModel.toExternal);\n};\n\nhandlers['api/payee-create'] = withMutation(async function({ payee }) {\n return handlers['payee-create']({ name: payee.name });\n});\n\nhandlers['api/payee-update'] = withMutation(async function({ id, fields }) {\n return handlers['payees-batch-change']({\n updated: [{ id, ...payeeModel.fromExternal(fields) }]\n });\n});\n\nhandlers['api/payee-delete'] = withMutation(async function({ id }) {\n return handlers['payees-batch-change']({ deleted: [{ id }] });\n});\n\nhandlers['api/payee-rules-get'] = async function({ payeeId }) {\n let rules = await handlers['payees-get-rules']({ id: payeeId });\n return rules.map(payeeRuleModel.toExternal);\n};\n\nhandlers['api/payee-rule-create'] = withMutation(async function({\n payee_id,\n rule\n}) {\n return handlers['payees-add-rule']({\n payee_id,\n type: rule.type,\n value: rule.value || null\n });\n});\n\nhandlers['api/payee-rule-update'] = withMutation(async function({\n id,\n fields\n}) {\n return handlers['payees-update-rule']({\n id,\n ...payeeRuleModel.fromExternal(fields)\n });\n});\n\nhandlers['api/payee-rule-delete'] = withMutation(async function({ id }) {\n return handlers['payees-delete-rule']({ id });\n});\n\nexport default function(serverHandlers) {\n handlers = Object.assign({}, serverHandlers, handlers);\n return handlers;\n}\n","import mitt from 'mitt';\nimport { captureException } from '../platform/exceptions';\n\n// This is a simple helper abstraction for defining methods exposed to\n// the client. It doesn't do much, but checks for naming conflicts and\n// makes it cleaner to combine methods. We call a group of related\n// methods an \"app\".\n\nclass App {\n constructor() {\n this.handlers = {};\n this.services = [];\n this.events = mitt();\n this.unlistenServices = [];\n }\n\n method(name, func) {\n if (this.handlers[name] != null) {\n throw new Error(\n 'Conflicting method name, names must be globally unique: ' + name\n );\n }\n this.handlers[name] = func;\n }\n\n service(func) {\n this.services.push(func);\n }\n\n combine(...apps) {\n for (let app of apps) {\n Object.keys(app.handlers).forEach(name => {\n this.method(name, app.handlers[name]);\n });\n\n app.services.forEach(service => {\n this.service(service);\n });\n\n for (let [name, listeners] of app.events.all.entries()) {\n for (let listener of listeners) {\n this.events.on(name, listener);\n }\n }\n }\n }\n\n startServices() {\n if (this.unlistenServices.length > 0) {\n captureException(\n new Error(\n 'App: startServices called while services are already running'\n )\n );\n }\n this.unlistenServices = this.services.map(service => service());\n }\n\n stopServices() {\n this.unlistenServices.forEach(unlisten => {\n if (unlisten) {\n unlisten();\n }\n });\n this.unlistenServices = [];\n }\n}\n\nexport function createApp() {\n return new App();\n}\n","let _uid = 0;\nfunction resetUid() {\n _uid = 0;\n}\n\nfunction uid(tableName) {\n _uid++;\n return tableName + _uid;\n}\n\nclass CompileError extends Error {}\n\nfunction nativeDateToInt(date) {\n let pad = x => (x < 10 ? '0' : '') + x;\n return date.getFullYear() + pad(date.getMonth() + 1) + pad(date.getDate());\n}\n\nfunction dateToInt(date) {\n return parseInt(date.replace(/-/g, ''));\n}\n\nexport function addTombstone(schema, tableName, tableId, whereStr) {\n let hasTombstone = schema[tableName].tombstone != null;\n return hasTombstone ? `${whereStr} AND ${tableId}.tombstone = 0` : whereStr;\n}\n\nfunction popPath(path) {\n let parts = path.split('.');\n return { path: parts.slice(0, -1).join('.'), field: parts[parts.length - 1] };\n}\n\nfunction isKeyword(str) {\n return str === 'group';\n}\n\nexport function quoteAlias(alias) {\n return alias.indexOf('.') === -1 && !isKeyword(alias) ? alias : `\"${alias}\"`;\n}\n\nfunction typed(value, type, { literal = false } = {}) {\n return { value, type, literal };\n}\n\nfunction getFieldDescription(schema, tableName, field) {\n if (schema[tableName] == null) {\n throw new CompileError(`Table \"${tableName}\" does not exist in the schema`);\n }\n\n let fieldDesc = schema[tableName][field];\n if (fieldDesc == null) {\n throw new CompileError(\n `Field \"${field}\" does not exist in table \"${tableName}\"`\n );\n }\n return fieldDesc;\n}\n\nfunction makePath(state, path) {\n let { schema, paths } = state;\n\n let parts = path.split('.');\n if (parts.length < 2) {\n throw new CompileError('Invalid path: ' + path);\n }\n\n let initialTable = parts[0];\n\n let tableName = parts.slice(1).reduce((tableName, field) => {\n let table = schema[tableName];\n\n if (table == null) {\n throw new CompileError(`Path error: ${tableName} table does not exist`);\n }\n\n if (!table[field] || table[field].ref == null) {\n throw new CompileError(\n `Field not joinable on table ${tableName}: \"${field}\"`\n );\n }\n\n return table[field].ref;\n }, initialTable);\n\n let joinTable;\n let parentParts = parts.slice(0, -1);\n if (parentParts.length === 1) {\n joinTable = parentParts[0];\n } else {\n let parentPath = parentParts.join('.');\n let parentDesc = paths.get(parentPath);\n if (!parentDesc) {\n throw new CompileError('Path does not exist: ' + parentPath);\n }\n joinTable = parentDesc.tableId;\n }\n\n return {\n tableName: tableName,\n tableId: uid(tableName),\n joinField: parts[parts.length - 1],\n joinTable\n };\n}\n\nfunction resolvePath(state, path) {\n let paths = path.split('.');\n let tableId;\n\n paths = paths.reduce(\n (acc, name) => {\n let fullName = acc.context + '.' + name;\n return {\n context: fullName,\n path: [...acc.path, fullName]\n };\n },\n { context: state.implicitTableName, path: [] }\n ).path;\n\n paths.forEach(path => {\n if (!state.paths.get(path)) {\n state.paths.set(path, makePath(state, path));\n }\n });\n\n let pathInfo = state.paths.get(paths[paths.length - 1]);\n return pathInfo;\n}\n\nfunction transformField(state, name) {\n if (typeof name !== 'string') {\n throw new CompileError('Invalid field name, must be a string');\n }\n\n let { path, field } = popPath(name);\n\n let pathInfo;\n if (path === '') {\n pathInfo = {\n tableName: state.implicitTableName,\n tableId: state.implicitTableId\n };\n } else {\n pathInfo = resolvePath(state, path);\n }\n\n let fieldDesc = getFieldDescription(state.schema, pathInfo.tableName, field);\n\n // If this is a field that references an item in another table, that\n // item could have been deleted. If that's the case, we want to\n // return `null` instead of an id pointing to a deleted item. This\n // converts an id reference into a path that pulls the id through a\n // table join which will filter out dead items, resulting in a\n // `null` id if the item is deleted\n if (\n state.validateRefs &&\n fieldDesc.ref &&\n fieldDesc.type === 'id' &&\n field !== 'id'\n ) {\n let refPath = state.implicitTableName + '.' + name;\n let refPathInfo = state.paths.get(refPath);\n\n if (!refPathInfo) {\n refPathInfo = makePath(state, refPath);\n refPathInfo.noMapping = true;\n state.paths.set(refPath, refPathInfo);\n }\n\n field = 'id';\n pathInfo = refPathInfo;\n }\n\n let fieldStr = pathInfo.tableId + '.' + field;\n return typed(fieldStr, fieldDesc.type);\n}\n\nfunction parseDate(str) {\n let m = str.match(/^(\\d{4}-\\d{2}-\\d{2})$/);\n if (m) {\n return typed(dateToInt(m[1]), 'date', { literal: true });\n }\n return null;\n}\n\nfunction parseMonth(str) {\n let m = str.match(/^(\\d{4}-\\d{2})$/);\n if (m) {\n return typed(dateToInt(m[1]), 'date', { literal: true });\n }\n return null;\n}\n\nfunction parseYear(str) {\n let m = str.match(/^(\\d{4})$/);\n if (m) {\n return typed(dateToInt(m[1]), 'date', { literal: true });\n }\n return null;\n}\n\nfunction badDateFormat(str, type) {\n throw new CompileError(`Bad ${type} format: ${str}`);\n}\n\nfunction inferParam(param, type) {\n let existingType = param.paramType;\n if (existingType) {\n let casts = {\n date: ['string'],\n 'date-month': ['date'],\n 'date-year': ['date', 'date-month'],\n id: ['string'],\n float: ['integer']\n };\n\n if (\n existingType !== type &&\n (!casts[type] || !casts[type].includes(existingType))\n ) {\n throw new Error(\n `Parameter \"${name}\" can't convert to ${type} (already inferred as ${existingType})`\n );\n }\n } else {\n param.paramType = type;\n }\n}\n\nfunction castInput(state, expr, type) {\n if (expr.type === type) {\n return expr;\n } else if (expr.type === 'param') {\n inferParam(expr, type);\n return typed(expr.value, type);\n } else if (expr.type === 'null') {\n if (!expr.literal) {\n throw new CompileError(\"A non-literal null doesn't make sense\");\n }\n\n if (type === 'boolean') {\n return typed(0, 'boolean', { literal: true });\n }\n return expr;\n }\n\n // These are all things that can be safely casted automatically\n if (type === 'date') {\n if (expr.type === 'string') {\n if (expr.literal) {\n return parseDate(expr.value) || badDateFormat(expr.value, 'date');\n } else {\n throw new CompileError(\n 'Casting string fields to dates is not supported'\n );\n }\n }\n\n throw new CompileError(`Can't cast ${expr.type} to date`);\n } else if (type === 'date-month') {\n let expr2;\n if (expr.type === 'date') {\n expr2 = expr;\n } else if (expr.type === 'string' || expr.type === 'any') {\n expr2 =\n parseMonth(expr.value) ||\n parseDate(expr.value) ||\n badDateFormat(expr.value, 'date-month');\n } else {\n throw new CompileError(`Can't cast ${expr.type} to date-month`);\n }\n\n if (expr2.literal) {\n return typed(\n dateToInt(expr2.value.toString().slice(0, 6)),\n 'date-month',\n { literal: true }\n );\n } else {\n return typed(\n `CAST(SUBSTR(${expr2.value}, 1, 6) AS integer)`,\n 'date-month'\n );\n }\n } else if (type === 'date-year') {\n let expr2;\n if (expr.type === 'date' || expr.type === 'date-month') {\n expr2 = expr;\n } else if (expr.type === 'string') {\n expr2 =\n parseYear(expr.value) ||\n parseMonth(expr.value) ||\n parseDate(expr.value) ||\n badDateFormat(expr.value, 'date-year');\n } else {\n throw new CompileError(`Can't cast ${expr.type} to date-year`);\n }\n\n if (expr2.literal) {\n return typed(dateToInt(expr2.value.toString().slice(0, 4)), 'date-year', {\n literal: true\n });\n } else {\n return typed(\n `CAST(SUBSTR(${expr2.value}, 1, 4) AS integer)`,\n 'date-year'\n );\n }\n } else if (type === 'id') {\n if (expr.type === 'string') {\n return typed(expr.value, 'id', { literal: expr.literal });\n }\n } else if (type === 'float') {\n if (expr.type === 'integer') {\n return typed(expr.value, 'float', { literal: expr.literal });\n }\n }\n\n if (expr.type === 'any') {\n return typed(expr.value, type, { literal: expr.literal });\n }\n\n throw new CompileError(`Can't convert ${expr.type} to ${type}`);\n}\n\n// TODO: remove state from these functions\nfunction val(state, expr, type) {\n let castedExpr = expr;\n\n // Cast the type if necessary\n if (type) {\n castedExpr = castInput(state, expr, type);\n }\n\n if (castedExpr.literal) {\n if (castedExpr.type === 'id') {\n return `'${castedExpr.value}'`;\n } else if (castedExpr.type === 'string') {\n // Escape quotes\n let value = castedExpr.value.replace(/'/g, \"''\");\n return `'${value}'`;\n }\n }\n\n return castedExpr.value;\n}\n\nfunction valArray(state, arr, types) {\n return arr.map((value, idx) => val(state, value, types ? types[idx] : null));\n}\n\nfunction validateArgLength(arr, min, max) {\n if (max == null) {\n max = min;\n }\n\n if (min != null && arr.length < min) {\n throw new CompileError('Too few arguments');\n }\n if (max != null && arr.length > max) {\n throw new CompileError('Too many arguments');\n }\n}\n\n//// Nice errors\n\nfunction saveStack(type, func) {\n return (state, ...args) => {\n if (state == null || state.compileStack == null) {\n throw new CompileError(\n 'This function cannot track error data. ' +\n 'It needs to accept the compiler state as the first argument.'\n );\n }\n\n state.compileStack.push({ type, args });\n let ret = func(state, ...args);\n state.compileStack.pop();\n return ret;\n };\n}\n\nfunction prettyValue(value) {\n if (typeof value === 'string') {\n return value;\n } else if (value === undefined) {\n return 'undefined';\n }\n\n let str = JSON.stringify(value);\n if (str.length > 70) {\n let expanded = JSON.stringify(value, null, 2);\n return expanded.split('\\n').join('\\n ');\n }\n return str;\n}\n\nfunction getCompileError(error, stack) {\n if (stack.length === 0) {\n return error;\n }\n\n let stackStr = stack\n .slice(1)\n .reverse()\n .map(entry => {\n switch (entry.type) {\n case 'expr':\n case 'function':\n return prettyValue(entry.args[0]);\n case 'op': {\n let [fieldRef, opData] = entry.args;\n return prettyValue({ [fieldRef]: opData });\n }\n case 'value':\n return prettyValue(entry.value);\n default:\n return '';\n }\n })\n .map(str => '\\n ' + str)\n .join('');\n\n const rootMethod = stack[0].type;\n const methodArgs = stack[0].args[0];\n stackStr += `\\n ${rootMethod}(${prettyValue(\n methodArgs.length === 1 ? methodArgs[0] : methodArgs\n )})`;\n\n // In production, hide internal stack traces\n if (process.env.NODE_ENV === 'production') {\n const err = new CompileError();\n err.message = `${error.message}\\n\\nExpression stack:` + stackStr;\n err.stack = null;\n return err;\n }\n\n error.message = `${error.message}\\n\\nExpression stack:` + stackStr;\n return error;\n}\n\n//// Compiler\n\nfunction compileLiteral(value) {\n if (value === undefined) {\n throw new CompileError('`undefined` is not a valid query value');\n } else if (value === null) {\n return typed('NULL', 'null', { literal: true });\n } else if (value instanceof Date) {\n return typed(nativeDateToInt(value), 'date', { literal: true });\n } else if (typeof value === 'string') {\n // Allow user to escape $, and quote the string to make it a\n // string literal in the output\n value = value.replace(/\\\\\\$/g, '$');\n return typed(value, 'string', { literal: true });\n } else if (typeof value === 'boolean') {\n return typed(value ? 1 : 0, 'boolean', { literal: true });\n } else if (typeof value === 'number') {\n return typed(value, (value | 0) === value ? 'integer' : 'float', {\n literal: true\n });\n } else if (Array.isArray(value)) {\n return typed(value, 'array', { literal: true });\n } else {\n throw new CompileError(\n 'Unsupported type of expression: ' + JSON.stringify(value)\n );\n }\n}\n\nconst compileExpr = saveStack('expr', (state, expr) => {\n if (typeof expr === 'string') {\n // Field reference\n if (expr[0] === '$') {\n let fieldRef = expr === '$' ? state.implicitField : expr.slice(1);\n\n if (fieldRef == null || fieldRef === '') {\n throw new CompileError('Invalid field reference: ' + expr);\n }\n\n return transformField(state, fieldRef);\n }\n\n // Named parameter\n if (expr[0] === ':') {\n let param = { value: '?', type: 'param', paramName: expr.slice(1) };\n state.namedParameters.push(param);\n return param;\n }\n }\n\n if (expr !== null) {\n if (Array.isArray(expr)) {\n return compileLiteral(expr);\n } else if (\n typeof expr === 'object' &&\n Object.keys(expr).find(k => k[0] === '$')\n ) {\n // It's a function call\n return compileFunction(state, expr);\n }\n }\n\n return compileLiteral(expr);\n});\n\nfunction assertType(name, data, acceptedTypes) {\n if (acceptedTypes.indexOf(data.type) === -1) {\n throw new CompileError(\n `Invalid type of expression to ${name}, must be one of ${JSON.stringify(\n acceptedTypes\n )}: ${JSON.stringify(data.value)}`\n );\n }\n}\n\nfunction assertArgLength(name, args, len) {\n if (args.length !== len) {\n throw new CompileError(\n `Invalid number of args to ${name}: expected ${len} but received ${args.length}`\n )();\n }\n}\n\nconst compileFunction = saveStack('function', (state, func) => {\n let [name] = Object.keys(func);\n let argExprs = func[name];\n if (!Array.isArray(argExprs)) {\n argExprs = [argExprs];\n }\n\n if (name[0] !== '$') {\n throw new CompileError(\n `Unknown property \"${name}\". Did you mean to call a function? Try prefixing it with $`\n );\n }\n\n let args = argExprs;\n // `$condition` is a special-case where it will be evaluated later\n if (name !== '$condition') {\n args = argExprs.map(arg => compileExpr(state, arg));\n }\n\n switch (name) {\n // aggregate functions\n case '$sum': {\n validateArgLength(args, 1);\n let [arg1] = valArray(state, args, ['float']);\n return typed(`SUM(${arg1})`, args[0].type);\n }\n\n case '$sumOver': {\n let [arg1] = valArray(state, args, ['float']);\n let order = state.orders\n ? 'ORDER BY ' + compileOrderBy(state, state.orders)\n : '';\n\n return typed(\n `(SUM(${arg1}) OVER (${order} ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING))`,\n args[0].type\n );\n }\n\n case '$count': {\n validateArgLength(args, 1);\n let [arg1] = valArray(state, args);\n return typed(`COUNT(${arg1})`, 'integer');\n }\n\n // string functions\n case '$substr': {\n validateArgLength(args, 2, 3);\n let [arg1, arg2, arg3] = valArray(state, args, [\n 'string',\n 'integer',\n 'integer'\n ]);\n return typed(`SUBSTR(${arg1}, ${arg2}, ${arg3})`, 'string');\n }\n case '$lower': {\n validateArgLength(args, 1);\n let [arg1] = valArray(state, args, ['string']);\n return typed(`LOWER(${arg1})`, 'string');\n }\n\n // integer/float functions\n case '$neg': {\n validateArgLength(args, 1);\n let [arg1] = valArray(state, args, ['float']);\n return typed(`(-${val(state, args[0])})`, args[0].type);\n }\n case '$abs': {\n validateArgLength(args, 1);\n let [arg1] = valArray(state, args, ['float']);\n return typed(`ABS(${val(state, args[0])})`, args[0].type);\n }\n case '$idiv': {\n validateArgLength(args, 2);\n let [arg1, arg2] = valArray(state, args, ['integer', 'integer']);\n return typed(\n `(${val(state, args[0])} / ${val(state, args[1])})`,\n args[0].type\n );\n }\n\n // date functions\n case '$month': {\n validateArgLength(args, 1);\n return castInput(state, args[0], 'date-month');\n }\n case '$year': {\n validateArgLength(args, 1);\n return castInput(state, args[0], 'date-year');\n }\n\n // various functions\n case '$condition':\n validateArgLength(args, 1);\n let conds = compileConditions(state, args[0]);\n return typed(conds.join(' AND '), 'boolean');\n\n case '$nocase':\n validateArgLength(args, 1);\n let [arg1] = valArray(state, args, ['string']);\n return typed(`${arg1} COLLATE NOCASE`, args[0].type);\n\n case '$literal': {\n validateArgLength(args, 1);\n if (!args[0].literal) {\n throw new CompileError('Literal not passed to $literal');\n }\n return args[0];\n }\n default:\n throw new CompileError(`Unknown function: ${name}`);\n }\n});\n\nconst compileOp = saveStack('op', (state, fieldRef, opData) => {\n let { $transform, ...opExpr } = opData;\n let [op] = Object.keys(opExpr);\n\n let rhs = compileExpr(state, opData[op]);\n\n let lhs;\n if ($transform) {\n lhs = compileFunction(\n { ...state, implicitField: fieldRef },\n typeof $transform === 'string' ? { [$transform]: '$' } : $transform\n );\n } else {\n lhs = compileExpr(state, '$' + fieldRef);\n }\n\n switch (op) {\n case '$gte': {\n let [left, right] = valArray(state, [lhs, rhs], [null, lhs.type]);\n return `${left} >= ${right}`;\n }\n case '$lte': {\n let [left, right] = valArray(state, [lhs, rhs], [null, lhs.type]);\n return `${left} <= ${right}`;\n }\n case '$gt': {\n let [left, right] = valArray(state, [lhs, rhs], [null, lhs.type]);\n return `${left} > ${right}`;\n }\n case '$lt': {\n let [left, right] = valArray(state, [lhs, rhs], [null, lhs.type]);\n return `${left} < ${right}`;\n }\n case '$eq': {\n if (castInput(state, rhs, lhs.type).type === 'null') {\n return `${val(state, lhs)} IS NULL`;\n }\n\n let [left, right] = valArray(state, [lhs, rhs], [null, lhs.type]);\n\n if (rhs.type === 'param') {\n let orders = state.namedParameters.map(param => {\n return param === rhs || param === lhs ? [param, { ...param }] : param;\n });\n state.namedParameters = [].concat.apply([], orders);\n\n return `CASE\n WHEN ${left} IS NULL THEN ${right} IS NULL\n ELSE ${left} = ${right}\n END`;\n }\n\n return `${left} = ${right}`;\n }\n case '$oneof': {\n let [left, right] = valArray(state, [lhs, rhs], [null, 'array']);\n // Dedupe the ids\n let ids = [...new Set(right)];\n return `${left} IN (` + ids.map(id => `'${id}'`).join(',') + ')';\n }\n case '$like': {\n let [left, right] = valArray(state, [lhs, rhs], ['string', 'string']);\n return `${left} LIKE ${right}`;\n }\n default:\n throw new CompileError(`Unknown operator: ${op}`);\n }\n});\n\nfunction compileConditions(state, conds) {\n if (!Array.isArray(conds)) {\n // Convert the object form `{foo: 1, bar:2}` into the array form\n // `[{foo: 1}, {bar:2}]`\n conds = Object.entries(conds).map(cond => {\n return { [cond[0]]: cond[1] };\n });\n }\n\n return conds.filter(Boolean).reduce((res, condsObj) => {\n let compiled = Object.entries(condsObj)\n .map(([field, cond]) => {\n // Allow a falsy value in the lhs of $and and $or to allow for\n // quick forms like `$or: amount != 0 && ...`\n if (field === '$and') {\n if (!cond) {\n return null;\n }\n return compileAnd(state, cond);\n } else if (field === '$or') {\n if (!cond) {\n return null;\n }\n return compileOr(state, cond);\n }\n\n if (\n typeof cond === 'string' ||\n typeof cond === 'number' ||\n typeof cond === 'boolean' ||\n cond instanceof Date ||\n cond == null\n ) {\n return compileOp(state, field, { $eq: cond });\n }\n\n if (Array.isArray(cond)) {\n // An array of conditions for a field is implicitly an `and`\n return cond.map(c => compileOp(state, field, c)).join(' AND ');\n }\n return compileOp(state, field, cond);\n })\n .filter(Boolean);\n\n return [...res, ...compiled];\n }, []);\n}\n\nfunction compileOr(state, conds) {\n // Same as above\n if (!conds) {\n return '0';\n }\n let res = compileConditions(state, conds);\n if (res.length === 0) {\n return '0';\n }\n return '(' + res.join('\\n OR ') + ')';\n}\n\nfunction compileAnd(state, conds) {\n // Same as above\n if (!conds) {\n return '1';\n }\n let res = compileConditions(state, conds);\n if (res.length === 0) {\n return '1';\n }\n return '(' + res.join('\\n AND ') + ')';\n}\n\nconst compileWhere = saveStack('filter', (state, conds) => {\n return compileAnd(state, conds);\n});\n\nfunction compileJoins(state, tableRef, internalTableFilters) {\n let joins = [];\n state.paths.forEach((desc, path) => {\n let {\n tableName,\n tableId,\n joinField,\n joinTable,\n noMapping\n } = state.paths.get(path);\n\n let on = `${tableId}.id = ${tableRef(joinTable)}.${quoteAlias(joinField)}`;\n\n let filters = internalTableFilters(tableName);\n if (filters.length > 0) {\n on +=\n ' AND ' +\n compileAnd(\n { ...state, implicitTableName: tableName, implicitTableId: tableId },\n filters\n );\n }\n\n joins.push(\n `LEFT JOIN ${\n noMapping ? tableName : tableRef(tableName, true)\n } ${tableId} ON ${addTombstone(state.schema, tableName, tableId, on)}`\n );\n\n if (state.dependencies.indexOf(tableName) === -1) {\n state.dependencies.push(tableName);\n }\n });\n return joins.join('\\n');\n}\n\nfunction expandStar(state, expr) {\n let path;\n let pathInfo;\n if (expr === '*') {\n pathInfo = {\n tableName: state.implicitTableName,\n tableId: state.implicitTableId\n };\n } else if (expr.match(/\\.\\*$/)) {\n let result = popPath(expr);\n path = result.path;\n pathInfo = resolvePath(state, result.path);\n }\n\n let table = state.schema[pathInfo.tableName];\n if (table == null) {\n throw new Error(`Table \"${pathInfo.tableName}\" does not exist`);\n }\n\n return Object.keys(table).map(field => (path ? `${path}.${field}` : field));\n}\n\nconst compileSelect = saveStack(\n 'select',\n (state, exprs, isAggregate, orders) => {\n // Always include the id if it's not an aggregate\n if (!isAggregate && !exprs.includes('id') && !exprs.includes('*')) {\n exprs = exprs.concat(['id']);\n }\n\n let select = exprs.map(expr => {\n if (typeof expr === 'string') {\n if (expr.indexOf('*') !== -1) {\n let fields = expandStar(state, expr);\n\n return fields\n .map(field => {\n let compiled = compileExpr(state, '$' + field);\n state.outputTypes.set(field, compiled.type);\n return compiled.value + ' AS ' + quoteAlias(field);\n })\n .join(', ');\n }\n\n let compiled = compileExpr(state, '$' + expr);\n state.outputTypes.set(expr, compiled.type);\n return compiled.value + ' AS ' + quoteAlias(expr);\n }\n\n let [name, value] = Object.entries(expr)[0];\n if (name[0] === '$') {\n state.compileStack.push({ type: 'value', value: expr });\n throw new CompileError(\n `Invalid field \"${name}\", are you trying to select a function? You need to name the expression`\n );\n }\n\n if (typeof value === 'string') {\n let compiled = compileExpr(state, '$' + value);\n state.outputTypes.set(name, compiled.type);\n return `${compiled.value} AS ${quoteAlias(name)}`;\n }\n\n let compiled = compileFunction({ ...state, orders }, value);\n state.outputTypes.set(name, compiled.type);\n return compiled.value + ` AS ${quoteAlias(name)}`;\n });\n\n return select.join(', ');\n }\n);\n\nconst compileGroupBy = saveStack('groupBy', (state, exprs) => {\n let groupBy = exprs.map(expr => {\n if (typeof expr === 'string') {\n return compileExpr(state, '$' + expr).value;\n }\n\n return compileFunction(state, expr).value;\n });\n\n return groupBy.join(', ');\n});\n\nconst compileOrderBy = saveStack('orderBy', (state, exprs) => {\n let orderBy = exprs.map(expr => {\n let compiled;\n let dir = null;\n\n if (typeof expr === 'string') {\n compiled = compileExpr(state, '$' + expr).value;\n } else {\n let entries = Object.entries(expr);\n let entry = entries[0];\n\n // Check if this is a field reference\n if (entries.length === 1 && entry[0][0] !== '$') {\n dir = entry[1];\n compiled = compileExpr(state, '$' + entry[0]).value;\n } else {\n // Otherwise it's a function\n let { $dir, ...func } = expr;\n dir = $dir;\n compiled = compileFunction(state, func).value;\n }\n }\n\n if (dir != null) {\n if (dir !== 'desc' && dir !== 'asc') {\n throw new CompileError('Invalid order direction: ' + dir);\n }\n return `${compiled} ${dir}`;\n }\n return compiled;\n });\n\n return orderBy.join(', ');\n});\n\nlet AGGREGATE_FUNCTIONS = ['$sum', '$count'];\nfunction isAggregateFunction(expr) {\n if (typeof expr !== 'object' || Array.isArray(expr)) {\n return false;\n }\n\n let [name, argExprs] = Object.entries(expr)[0];\n if (!Array.isArray(argExprs)) {\n argExprs = [argExprs];\n }\n\n if (AGGREGATE_FUNCTIONS.indexOf(name) !== -1) {\n return true;\n }\n\n return argExprs.find(ex => isAggregateFunction(ex));\n}\n\nexport function isAggregateQuery(queryState) {\n // it's aggregate if:\n // either an aggregate function is used in `select`\n // or a `groupBy` exists\n\n if (queryState.groupExpressions.length > 0) {\n return true;\n }\n\n return queryState.selectExpressions.find(expr => {\n if (typeof expr !== 'string') {\n let [name, value] = Object.entries(expr)[0];\n return isAggregateFunction(value);\n }\n return false;\n });\n}\n\nexport function compileQuery(queryState, schema, schemaConfig = {}) {\n let { withDead, validateRefs = true, tableOptions, rawMode } = queryState;\n\n let {\n tableViews = {},\n tableFilters = name => [],\n customizeQuery = queryState => queryState\n } = schemaConfig;\n\n let internalTableFilters = name => {\n let filters = tableFilters(name);\n // These filters cannot join tables and must be simple strings\n for (let filter of filters) {\n if (Array.isArray(filter)) {\n throw new CompileError(\n 'Invalid internal table filter: only object filters are supported'\n );\n }\n if (Object.keys(filter)[0].indexOf('.') !== -1) {\n throw new CompileError(\n 'Invalid internal table filter: field names cannot contain paths'\n );\n }\n }\n return filters;\n };\n\n let tableRef = (name, isJoin) => {\n let view =\n typeof tableViews === 'function'\n ? tableViews(name, { withDead, isJoin, tableOptions })\n : tableViews[name];\n return view || name;\n };\n\n let tableName = queryState.table;\n\n let {\n filterExpressions,\n selectExpressions,\n groupExpressions,\n orderExpressions,\n limit,\n offset,\n calculation\n } = customizeQuery(queryState);\n\n let select = '';\n let where = '';\n let joins = '';\n let groupBy = '';\n let orderBy = '';\n let dependences = [];\n let state = {\n schema,\n implicitTableName: tableName,\n implicitTableId: tableRef(tableName),\n paths: new Map(),\n dependencies: [tableName],\n compileStack: [],\n outputTypes: new Map(),\n validateRefs,\n namedParameters: []\n };\n\n resetUid();\n\n try {\n select = compileSelect(\n state,\n selectExpressions,\n isAggregateQuery(queryState),\n orderExpressions\n );\n\n if (filterExpressions.length > 0) {\n let result = compileWhere(state, filterExpressions);\n where = 'WHERE ' + result;\n } else {\n where = 'WHERE 1';\n }\n\n if (!rawMode) {\n let filters = internalTableFilters(tableName);\n if (filters.length > 0) {\n where += ' AND ' + compileAnd(state, filters);\n }\n }\n\n if (groupExpressions.length > 0) {\n let result = compileGroupBy(state, groupExpressions);\n groupBy = 'GROUP BY ' + result;\n }\n\n // Orders don't matter if doing a single calculation\n if (orderExpressions.length > 0) {\n let result = compileOrderBy(state, orderExpressions);\n orderBy = 'ORDER BY ' + result;\n }\n\n if (state.paths.size > 0) {\n joins = compileJoins(state, tableRef, internalTableFilters);\n }\n } catch (e) {\n if (e instanceof CompileError) {\n throw getCompileError(e, state.compileStack);\n }\n\n throw e;\n }\n\n let sqlPieces = {\n select,\n from: tableRef(tableName),\n joins,\n where,\n groupBy,\n orderBy,\n limit,\n offset\n };\n\n return {\n sqlPieces,\n state\n };\n}\n\nexport function defaultConstructQuery(queryState, state, sqlPieces) {\n let s = sqlPieces;\n\n let where = queryState.withDead\n ? s.where\n : addTombstone(\n state.schema,\n state.implicitTableName,\n state.implicitTableId,\n s.where\n );\n\n return `\n SELECT ${s.select} FROM ${s.from}\n ${s.joins}\n ${where}\n ${s.groupBy}\n ${s.orderBy}\n ${s.limit != null ? `LIMIT ${s.limit}` : ''}\n ${s.offset != null ? `OFFSET ${s.offset}` : ''}\n `;\n}\n\nexport function generateSQLWithState(queryState, schema, schemaConfig) {\n let { sqlPieces, state } = compileQuery(queryState, schema, schemaConfig);\n return { sql: defaultConstructQuery(queryState, state, sqlPieces), state };\n}\n\nexport function generateSQL(queryState) {\n return generateSQLWithState(queryState).sql;\n}\n","import * as db from '../db';\nimport { compileQuery, defaultConstructQuery } from './compiler';\nimport { convertInputType, convertOutputType } from './schema-helpers';\n\n// TODO (compiler):\n// * Properly safeguard all inputs against SQL injection\n// * Functions for incr/decr dates\n// * Support HAVING\n// * Allow creating in-memory tables to run queries against static\n// data\n// * For aggregate functions on selected ids, manually implement\n// them only only support a specific few (sum amount / etc)\n// * Select expressions should be evaluated first, and added to a\n// global \"field lookup\" table that other filter/groupBy/etc\n// expressions can reference\n\nfunction applyTypes(data, outputTypes) {\n for (let i = 0; i < data.length; i++) {\n let item = data[i];\n Object.keys(item).forEach(name => {\n item[name] = convertOutputType(item[name], outputTypes.get(name));\n });\n }\n}\n\nexport async function execQuery(\n queryState,\n state,\n sqlPieces,\n params,\n outputTypes\n) {\n let sql = defaultConstructQuery(queryState, state, sqlPieces);\n let data = await db.all(sql, params);\n applyTypes(data, outputTypes);\n return data;\n}\n\nexport async function runCompiledQuery(\n query,\n pieces,\n state,\n { params = {}, executors = {} } = {}\n) {\n let paramArray = state.namedParameters.map(param => {\n let name = param.paramName;\n if (params[name] === undefined) {\n throw new Error(`Parameter ${name} not provided to query`);\n }\n return convertInputType(params[name], param.paramType);\n });\n\n let data;\n if (executors[state.implicitTableName]) {\n data = await executors[state.implicitTableName](\n state,\n query,\n pieces,\n paramArray,\n state.outputTypes\n );\n } else {\n data = await execQuery(query, state, pieces, paramArray, state.outputTypes);\n }\n\n if (query.calculation) {\n if (data.length > 0) {\n let row = data[0];\n let k = Object.keys(row)[0];\n // TODO: the function being run should be the one to\n // determine the default value, not hardcoded as 0\n data = row[k] || 0;\n } else {\n data = null;\n }\n }\n return data;\n}\n\nexport async function runQuery(schema, schemaConfig, query, options) {\n let { sqlPieces, state } = compileQuery(query, schema, schemaConfig);\n let data = await runCompiledQuery(query, sqlPieces, state, options);\n return { data, dependencies: state.dependencies };\n}\n","import { toDateRepr, fromDateRepr } from '../models';\nimport { dayFromDate } from '../../shared/months';\n\nfunction isRequired(name, fieldDesc) {\n return fieldDesc.required || name === 'id';\n}\n\n// TODO: All of the data type needs to check the input value. This\n// doesn't just convert, it casts. See integer handling.\nexport function convertInputType(value, type) {\n if (value === undefined) {\n throw new Error('Query value cannot be undefined');\n } else if (value === null) {\n if (type === 'boolean') {\n return 0;\n }\n\n return null;\n }\n\n switch (type) {\n case 'date':\n if (value instanceof Date) {\n return toDateRepr(dayFromDate(value));\n } else if (\n value.match(/^\\d{4}-\\d{2}-\\d{2}$/) == null ||\n value.date < '2000-01-01'\n ) {\n throw new Error('Invalid date: ' + value);\n }\n\n return toDateRepr(value);\n case 'date-month':\n return toDateRepr(value.slice(0, 7));\n case 'date-year':\n return toDateRepr(value.slice(0, 4));\n case 'boolean':\n return value ? 1 : 0;\n case 'id':\n if (typeof value !== 'string' && value !== null) {\n throw new Error('Invalid id, must be string: ' + value);\n }\n return value;\n case 'integer':\n if (typeof value === 'number' && (value | 0) === value) {\n return value;\n } else {\n throw new Error(\"Can't convert to integer: \" + JSON.stringify(value));\n }\n case 'json':\n return JSON.stringify(value);\n default:\n }\n return value;\n}\n\nexport function convertOutputType(value, type) {\n if (value === null) {\n if (type === 'boolean') {\n return false;\n }\n return null;\n }\n\n switch (type) {\n case 'date':\n return fromDateRepr(value);\n case 'date-month':\n return fromDateRepr(value).slice(0, 7);\n case 'date-year':\n return fromDateRepr(value).slice(0, 4);\n case 'boolean':\n return value === 1;\n case 'json':\n case 'json/fallback':\n try {\n return JSON.parse(value);\n } catch (e) {\n return type === 'json/fallback' ? value : null;\n }\n default:\n }\n\n return value;\n}\n\nexport function conform(schema, schemaConfig, table, obj, { skipNull } = {}) {\n let tableSchema = schema[table];\n if (tableSchema == null) {\n throw new Error(`Table \"${table}\" does not exist`);\n }\n\n let views = schemaConfig.views || {};\n\n // Rename fields if necessary\n let fieldRef = field => {\n if (views[table] && views[table].fields) {\n return views[table].fields[field] || field;\n }\n return field;\n };\n\n return Object.fromEntries(\n Object.keys(obj)\n .map(field => {\n // Fields that start with an underscore are ignored\n if (field[0] === '_') {\n return null;\n }\n\n let fieldDesc = tableSchema[field];\n if (fieldDesc == null) {\n throw new Error(\n `Field \"${field}\" does not exist on table ${table}: ${JSON.stringify(\n obj\n )}`\n );\n }\n\n if (isRequired(field, fieldDesc) && obj[field] == null) {\n throw new Error(\n `\"${field}\" is required for table \"${table}\": ${JSON.stringify(\n obj\n )}`\n );\n }\n\n // This option removes null values (see `convertForInsert`)\n if (skipNull && obj[field] == null) {\n return null;\n }\n\n return [fieldRef(field), convertInputType(obj[field], fieldDesc.type)];\n })\n .filter(Boolean)\n );\n}\n\nexport function convertForInsert(schema, schemaConfig, table, rawObj) {\n let obj = { ...rawObj };\n\n let tableSchema = schema[table];\n if (tableSchema == null) {\n throw new Error(`Error inserting: table \"${table}\" does not exist`);\n }\n\n // Inserting checks all the fields in the table and adds any default\n // values necessary\n Object.keys(tableSchema).forEach(field => {\n let fieldDesc = tableSchema[field];\n\n if (obj[field] == null) {\n if (fieldDesc.default !== undefined) {\n obj[field] =\n typeof fieldDesc.default === 'function'\n ? fieldDesc.default()\n : fieldDesc.default;\n } else if (isRequired(field, fieldDesc)) {\n // Although this check is also done in `conform`, it only\n // checks the fields in `obj`. For insert, we need to do it\n // here to check that all required fields in the table exist\n throw new Error(\n `\"${field}\" is required for table \"${table}\": ${JSON.stringify(obj)}`\n );\n }\n }\n });\n\n // We use `skipNull` to remove any null values. There's no need to\n // set those when inserting, that will be the default and it reduces\n // the amount of messages generated to sync\n return conform(schema, schemaConfig, table, obj, { skipNull: true });\n}\n\nexport function convertForUpdate(schema, schemaConfig, table, rawObj) {\n let obj = { ...rawObj };\n\n let tableSchema = schema[table];\n if (tableSchema == null) {\n throw new Error(`Error updating: table \"${table}\" does not exist`);\n }\n\n return conform(schema, schemaConfig, table, obj);\n}\n\nexport function convertFromSelect(schema, schemaConfig, table, obj) {\n let tableSchema = schema[table];\n if (tableSchema == null) {\n throw new Error(`Table \"${table}\" does not exist`);\n }\n\n let fields = Object.keys(tableSchema);\n let result = {};\n for (let i = 0; i < fields.length; i++) {\n let fieldName = fields[i];\n let fieldDesc = tableSchema[fieldName];\n\n result[fieldName] = convertOutputType(obj[fieldName], fieldDesc.type);\n }\n return result;\n}\n","import * as db from '../../db';\nimport { whereIn } from '../../db/util';\nimport { groupBy } from '../../../shared/util';\nimport { isAggregateQuery } from '../compiler';\nimport { convertOutputType } from '../schema-helpers';\nimport { execQuery } from '../exec';\n\n// Transactions executor\n\nexport function toGroup(parents, children, mapper = x => x) {\n return parents.reduce((list, parent) => {\n let childs = children.get(parent.id) || [];\n list.push({\n ...mapper(parent),\n subtransactions: childs.map(mapper)\n });\n return list;\n }, []);\n}\n\n// These two queries will return very different things:\n//\n// q('transactions').select({ $count: 'id' })\n// q('transactions', { splits: \"grouped\" }).select({ $count: 'id' })\n//\n// The first will return the count of non-split and child\n// transactions, and the second will return the count of all parent\n// (or non-split) transactions\n\nfunction execTransactions(state, query, sql, params, outputTypes) {\n let tableOptions = query.tableOptions || {};\n let splitType = tableOptions.splits || 'inline';\n\n if (['all', 'inline', 'none', 'grouped'].indexOf(splitType) === -1) {\n throw new Error(`Invalid \"splits\" option for transactions: \"${splitType}\"`);\n }\n\n if (splitType === 'all' || splitType === 'inline' || splitType === 'none') {\n return execTransactionsBasic(\n state,\n query,\n sql,\n params,\n splitType,\n outputTypes\n );\n } else if (splitType === 'grouped') {\n return execTransactionsGrouped(\n state,\n query,\n sql,\n params,\n splitType,\n outputTypes\n );\n }\n}\n\nfunction _isUnhappy(filter) {\n // These fields can be filtered - all split transactions will\n // still be returned regardless\n for (let key of Object.keys(filter)) {\n if (key === '$or' || key === '$and') {\n if (filter[key] && _isUnhappy(filter[key])) {\n return true;\n }\n } else if (!(key.indexOf('account') === 0 || key === 'date')) {\n return true;\n }\n }\n return false;\n}\n\nexport function isHappyPathQuery(queryState) {\n return queryState.filterExpressions.find(_isUnhappy) == null;\n}\n\nasync function execTransactionsGrouped(\n state,\n queryState,\n sql,\n params,\n splitType,\n outputTypes\n) {\n let { table: tableName, withDead } = queryState;\n let whereDead = withDead ? '' : `AND ${sql.from}.tombstone = 0`;\n\n if (isAggregateQuery(queryState)) {\n let allSql = `\n SELECT ${sql.select}\n FROM ${sql.from}\n ${sql.joins}\n ${sql.where} AND is_parent = 0 ${whereDead}\n ${sql.groupBy}\n ${sql.orderBy}\n ${sql.limit != null ? `LIMIT ${sql.limit}` : ''}\n ${sql.offset != null ? `OFFSET ${sql.offset}` : ''}\n `;\n return db.all(allSql);\n }\n\n let rows;\n let matched = null;\n\n if (isHappyPathQuery(queryState)) {\n // This is just an optimization - we can just filter out children\n // directly and only list parents\n let rowSql = `\n SELECT ${sql.from}.id as group_id\n FROM ${sql.from}\n ${sql.joins}\n ${sql.where} AND is_child = 0 ${whereDead}\n ${sql.orderBy}\n ${sql.limit != null ? `LIMIT ${sql.limit}` : ''}\n ${sql.offset != null ? `OFFSET ${sql.offset}` : ''}\n `;\n rows = await db.all(rowSql, params);\n } else {\n // TODO: phew, what a doozy. write docs why it works this way\n //\n // prettier-ignore\n let rowSql = `\n SELECT group_id, matched FROM (\n SELECT\n group_id,\n GROUP_CONCAT(id) as matched\n FROM (\n SELECT ${sql.from}.id, IFNULL(${sql.from}.parent_id, ${sql.from}.id) as group_id\n FROM ${sql.from}\n LEFT JOIN transactions _t2 ON ${sql.from}.is_child = 1 AND _t2.id = ${sql.from}.parent_id\n ${sql.joins}\n ${sql.where} AND ${sql.from}.tombstone = 0 AND IFNULL(_t2.tombstone, 0) = 0\n )\n GROUP BY group_id\n )\n LEFT JOIN ${sql.from} ON ${sql.from}.id = group_id\n ${sql.joins}\n ${sql.orderBy}\n ${sql.limit != null ? `LIMIT ${sql.limit}` : ''}\n ${sql.offset != null ? `OFFSET ${sql.offset}` : ''}\n `;\n\n rows = await db.all(rowSql, params);\n matched = new Set(\n [].concat.apply([], rows.map(row => row.matched.split(',')))\n );\n }\n\n let where = whereIn(\n rows.map(row => row.group_id),\n `IFNULL(${sql.from}.parent_id, ${sql.from}.id)`\n );\n let finalSql = `\n SELECT ${sql.select}, parent_id AS _parent_id FROM ${sql.from}\n ${sql.joins}\n WHERE ${where} ${whereDead}\n ${sql.orderBy}\n `;\n\n let start = Date.now();\n let allRows = await db.all(finalSql);\n\n // Group the parents and children up\n let { parents, children } = allRows.reduce(\n (acc, trans) => {\n let pid = trans._parent_id;\n delete trans._parent_id;\n\n if (pid == null) {\n acc.parents.push(trans);\n } else {\n let arr = acc.children.get(pid) || [];\n arr.push(trans);\n acc.children.set(pid, arr);\n }\n return acc;\n },\n { parents: [], children: new Map() }\n );\n\n let mapper = trans => {\n Object.keys(trans).forEach(name => {\n trans[name] = convertOutputType(trans[name], outputTypes.get(name));\n });\n\n if (matched && !matched.has(trans.id)) {\n trans._unmatched = true;\n }\n return trans;\n };\n\n return toGroup(parents, children, mapper);\n}\n\nasync function execTransactionsBasic(\n state,\n queryState,\n sql,\n params,\n splitType,\n outputTypes\n) {\n let s = { ...sql };\n\n if (splitType !== 'all') {\n if (splitType === 'none') {\n s.where = `${s.where} AND ${s.from}.parent_id IS NULL`;\n } else {\n s.where = `${s.where} AND ${s.from}.is_parent = 0`;\n }\n }\n\n return execQuery(queryState, state, s, params, outputTypes);\n}\n\nexport default {\n transactions: execTransactions\n};\n","function f(type, opts) {\n return { type, ...opts };\n}\n\n// This is the table schema!\n//\n// The schema itself is the public API for querying and updating data.\n// The schema config provides a lot of control over how queries are\n// constructed other metadata used by the executors. The goal is to\n// provide a simple interface to the app, but allow the backend to\n// highly optimize how queries are run.\n//\n// A few notes:\n//\n// * `transactions` is a special table and is has a highly customized\n// executor (see `executors.js`) for performace. It should mostly be\n// transparent to you, but it's worth reading the comments in there if\n// requirements change, especially regarding split transactions.\n//\n// * You should rarely change the schema and only add to it, but it is\n// relatively safe to change if needed. The only problem is changing a\n// public API, but that could be mitigated with an option in schema\n// config to map field name for backwards compatibility.\n//\n// * It's important that the table names here in the schema map to the\n// real tables in sqlite that are updated. Otherwise subscriptions\n// might not work because the dependencies are wrong. If needed in the\n// future, we can provide another option in the schema config to map a\n// table name the internal table that is updated.\n\nexport const schema = {\n transactions: {\n id: f('id'),\n is_parent: f('boolean'),\n is_child: f('boolean'),\n parent_id: f('id'),\n account: f('id', { ref: 'accounts', required: true }),\n category: f('id', { ref: 'categories' }),\n amount: f('integer', { default: 0, required: true }),\n payee: f('id', { ref: 'payees' }),\n notes: f('string'),\n date: f('date', { required: true }),\n imported_id: f('string'),\n error: f('json'),\n imported_payee: f('string'),\n starting_balance_flag: f('boolean'),\n transfer_id: f('id'),\n sort_order: f('float', { default: () => Date.now() }),\n cleared: f('boolean', { default: true }),\n tombstone: f('boolean'),\n schedule: f('id', { ref: 'schedules' })\n // subtransactions is a special field added if the table has the\n // `splits: grouped` option\n },\n payees: {\n id: f('id'),\n name: f('string', { required: true }),\n transfer_acct: f('id', { ref: 'accounts' }),\n tombstone: f('boolean')\n },\n accounts: {\n id: f('id'),\n name: f('string', { required: true }),\n // TODO: enum\n type: f('string'),\n offbudget: f('boolean'),\n closed: f('boolean'),\n sort_order: f('float'),\n tombstone: f('boolean')\n },\n categories: {\n id: f('id'),\n name: f('string'),\n is_income: f('boolean'),\n group: f('id', { ref: 'category_groups' }),\n sort_order: f('float'),\n tombstone: f('boolean')\n },\n category_groups: {\n id: f('id'),\n name: f('string'),\n is_income: f('boolean'),\n sort_order: f('float'),\n tombstone: f('boolean')\n },\n schedules: {\n id: f('id'),\n rule: f('id', { ref: 'rules', required: true }),\n next_date: f('date'),\n completed: f('boolean'),\n posts_transaction: f('boolean'),\n tombstone: f('boolean'),\n\n // These are special fields that are actually pulled from the\n // underlying rule\n _payee: f('id', { ref: 'payees' }),\n _account: f('id', { ref: 'accounts' }),\n _amount: f('json/fallback'),\n _amountOp: f('string'),\n _date: f('json/fallback'),\n _conditions: f('json'),\n _actions: f('json')\n },\n rules: {\n id: f('id'),\n stage: f('string'),\n conditions: f('json'),\n actions: f('json'),\n tombstone: f('boolean')\n },\n notes: {\n id: f('id'),\n note: f('string')\n }\n};\n\nexport const schemaConfig = {\n // Note: these views *must* represent the underlying table that we\n // are mapping here. The compiler makes optimizations with this\n // assumption\n tableViews(name, { isJoin, withDead, tableOptions = {} }) {\n switch (name) {\n case 'transactions': {\n // If joining, we always only show alive transactions. There's\n // no way to configure join behavior yet\n if (isJoin) {\n return 'v_transactions_internal_alive';\n }\n\n let splitType = tableOptions.splits || 'inline';\n // Use the view to exclude dead transactions if using `inline` or `none`\n if (!withDead && (splitType === 'inline' || splitType === 'none')) {\n return 'v_transactions_internal_alive';\n }\n\n // Otherwse we disregard the `withDead` option here and handle\n // that in the executors to improve performance\n return 'v_transactions_internal';\n }\n\n case 'schedules':\n return 'v_schedules';\n\n case 'categories':\n return 'v_categories';\n\n case 'payees':\n return 'v_payees';\n\n default:\n }\n return name;\n },\n\n customizeQuery(queryState) {\n let { table: tableName, tableOptions = {} } = queryState;\n\n function orderBy(orders) {\n // If order was specified, always add id as the last sort to make\n // it deterministic\n if (orders.length > 0) {\n return orders.concat(['id']);\n }\n\n // Otherwise, these are the default orders for each table\n switch (tableName) {\n case 'transactions':\n return [\n { date: 'desc' },\n 'starting_balance_flag',\n { sort_order: 'desc' },\n 'id'\n ];\n case 'payees':\n return [\n { $condition: { transfer_acct: null }, $dir: 'desc' },\n { $nocase: '$name' }\n ];\n case 'accounts':\n return ['sort_order', 'name'];\n case 'schedules':\n return [{ $condition: { completed: true } }, 'next_date'];\n default:\n }\n\n return [];\n }\n\n return {\n ...queryState,\n orderExpressions: orderBy(queryState.orderExpressions)\n };\n },\n\n views: {\n payees: {\n v_payees: internalFields => {\n let fields = internalFields({\n name: 'COALESCE(__accounts.name, _.name)'\n });\n\n return `\n SELECT ${fields} FROM payees _\n LEFT JOIN accounts __accounts ON (_.transfer_acct = __accounts.id AND __accounts.tombstone = 0)\n -- We never want to show transfer payees that are pointing to deleted accounts.\n -- Either this isn't a transfer payee, if the account exists\n WHERE _.transfer_acct IS NULL OR __accounts.id IS NOT NULL\n `;\n }\n },\n\n categories: {\n fields: {\n group: 'cat_group'\n },\n\n v_categories: internalFields => {\n let fields = internalFields({ group: 'cat_group' });\n return `SELECT ${fields} FROM categories _`;\n }\n },\n\n schedules: {\n v_schedules: internalFields => {\n let fields = internalFields({\n next_date: `\n CASE\n WHEN _nd.local_next_date_ts = _nd.base_next_date_ts THEN _nd.local_next_date\n ELSE _nd.base_next_date\n END\n `,\n _payee: `pm.targetId`,\n _account: `json_extract(_rules.conditions, _paths.account || '.value')`,\n _amount: `json_extract(_rules.conditions, _paths.amount || '.value')`,\n _amountOp: `json_extract(_rules.conditions, _paths.amount || '.op')`,\n _date: `json_extract(_rules.conditions, _paths.date || '.value')`,\n _conditions: '_rules.conditions',\n _actions: '_rules.actions'\n });\n\n return `\n SELECT ${fields} FROM schedules _\n LEFT JOIN schedules_next_date _nd ON _nd.schedule_id = _.id\n LEFT JOIN schedules_json_paths _paths ON _paths.schedule_id = _.id\n LEFT JOIN rules _rules ON _rules.id = _.rule\n LEFT JOIN payee_mapping pm ON pm.id = json_extract(_rules.conditions, _paths.payee || '.value')\n `;\n }\n },\n\n transactions: {\n fields: {\n is_parent: 'isParent',\n is_child: 'isChild',\n account: 'acct',\n imported_id: 'financial_id',\n imported_payee: 'imported_description',\n transfer_id: 'transferred_id',\n payee: 'description'\n },\n\n v_transactions_internal: internalFields => {\n // Override some fields to make custom stuff\n let fields = internalFields({\n payee: 'pm.targetId',\n category: `CASE WHEN _.isParent = 1 THEN NULL ELSE cm.transferId END`,\n amount: `IFNULL(_.amount, 0)`,\n parent_id: 'CASE WHEN _.isChild = 0 THEN NULL ELSE _.parent_id END'\n });\n\n return `\n SELECT ${fields} FROM transactions _\n LEFT JOIN category_mapping cm ON cm.id = _.category\n LEFT JOIN payee_mapping pm ON pm.id = _.description\n WHERE\n _.date IS NOT NULL AND\n _.acct IS NOT NULL AND\n (_.isChild = 0 OR _.parent_id IS NOT NULL)\n `;\n },\n\n // We join on t2 to only include valid child transactions. We\n // want to only include ones with valid parents, which is when\n // an alive parent transaction exists\n v_transactions_internal_alive: `\n SELECT _.* FROM v_transactions_internal _\n LEFT JOIN transactions t2 ON (_.is_child = 1 AND t2.id = _.parent_id)\n WHERE IFNULL(_.tombstone, 0) = 0 AND (_.is_child = 0 OR t2.tombstone = 0)\n `,\n\n v_transactions: (_, publicFields) => {\n let fields = publicFields({\n payee: 'p.id',\n category: 'c.id',\n account: 'a.id'\n });\n\n // This adds an order, and also validates any id references by\n // selecting the ids through a join which return null if they\n // are dead\n return `\n SELECT ${fields} FROM v_transactions_internal_alive _\n LEFT JOIN payees p ON (p.id = _.payee AND p.tombstone = 0)\n LEFT JOIN categories c ON (c.id = _.category AND c.tombstone = 0)\n LEFT JOIN accounts a ON (a.id = _.account AND a.tombstone = 0)\n ORDER BY _.date desc, _.starting_balance_flag, _.sort_order desc, _.id;\n `;\n }\n }\n }\n};\n","import { schema, schemaConfig } from './index';\nimport schemaExecutors from './executors';\nimport {\n runQuery as _runQuery,\n runCompiledQuery as _runCompiledQuery\n} from '../exec';\nimport { Query } from '../../../shared/query';\n\nexport function runCompiledQuery(query, sqlPieces, state, params) {\n return _runCompiledQuery(query, sqlPieces, state, {\n params,\n executors: schemaExecutors\n });\n}\n\nexport function runQuery(query, params) {\n if (query instanceof Query) {\n query = query.serialize();\n }\n\n return _runQuery(schema, schemaConfig, query, {\n params,\n executors: schemaExecutors\n });\n}\n","import { quoteAlias } from './compiler';\n\nfunction selectFields(fields) {\n return Object.keys(fields)\n .map(as => {\n let field = fields[as];\n let needsAs = field !== as;\n // If it's just an identifier, we automatically prefix it with\n // `_.` which makes sure it references the root table\n if (!field.match(/[ .]/)) {\n field = `_.${field}`;\n }\n return needsAs ? `${field} AS ${quoteAlias(as)}` : `${field}`;\n })\n .join(', ');\n}\n\nexport function makeViews(schema, schemaConfig) {\n let views = schemaConfig.views;\n let viewStrs = [];\n\n Object.keys(views).forEach(table => {\n let { fields: fieldMappings = {}, ...tableViews } = views[table];\n\n let publicFields = Object.fromEntries(\n Object.keys(schema[table]).map(name => [name, name])\n );\n let internalFields = { ...publicFields, ...fieldMappings };\n\n Object.keys(tableViews).forEach(viewName => {\n let publicMaker = overrides => {\n let fields = { ...publicFields, ...overrides };\n return selectFields(fields);\n };\n let internalMaker = overrides => {\n let fields = { ...internalFields, ...overrides };\n return selectFields(fields);\n };\n\n let sql;\n if (typeof tableViews[viewName] === 'function') {\n sql = tableViews[viewName](internalMaker, publicMaker);\n } else {\n sql = tableViews[viewName];\n }\n sql = sql.trim().replace(/;$/, '');\n\n viewStrs.push(`\n DROP VIEW IF EXISTS ${viewName};\n CREATE VIEW ${viewName} AS ${sql};\n `);\n });\n });\n\n return viewStrs.join('\\n');\n}\n","import fs from '../platform/server/fs';\nimport * as monthUtils from '../shared/months';\nimport * as sqlite from '../platform/server/sqlite';\nimport * as prefs from './prefs';\nimport * as cloudStorage from './cloud-storage';\nconst connection = require('../platform/server/connection');\nconst uuid = require('../platform/uuid');\nconst dateFns = require('date-fns');\n\n// A special backup that represents the latest version of the db that\n// can be reverted to after loading a backup\nconst LATEST_BACKUP_FILENAME = 'db.latest.sqlite';\nlet serviceInterval = null;\n\nexport async function getBackups(id) {\n const budgetDir = fs.getBudgetDir(id);\n const backupDir = fs.join(budgetDir, 'backups');\n\n let paths = [];\n if (await fs.exists(backupDir)) {\n paths = await fs.listDir(backupDir);\n paths = paths.filter(file => file.match(/\\.sqlite$/));\n }\n\n const backups = await Promise.all(\n paths.map(async path => {\n const mtime = await fs.getModifiedTime(fs.join(backupDir, path));\n return {\n id: path,\n date: new Date(mtime)\n };\n })\n );\n\n backups.sort((b1, b2) => {\n if (b1.date < b2.date) {\n return 1;\n } else if (b1.date > b2.date) {\n return -1;\n }\n return 0;\n });\n\n return backups;\n}\n\nexport async function getLatestBackup(id) {\n const budgetDir = fs.getBudgetDir(id);\n if (await fs.exists(fs.join(budgetDir, LATEST_BACKUP_FILENAME))) {\n return {\n id: LATEST_BACKUP_FILENAME,\n date: null,\n isLatest: true\n };\n }\n return null;\n}\n\nexport async function getAvailableBackups(id) {\n let backups = await getBackups(id);\n\n let latestBackup = await getLatestBackup(id);\n if (latestBackup) {\n backups.unshift(latestBackup);\n }\n\n backups = backups.map(backup => ({\n ...backup,\n date: backup.date ? dateFns.format(backup.date, 'yyyy-MM-dd h:mm') : null\n }));\n\n return backups;\n}\n\nexport async function updateBackups(backups) {\n const byDay = backups.reduce((groups, backup) => {\n const day = dateFns.format(backup.date, 'yyyy-MM-dd');\n groups[day] = groups[day] || [];\n groups[day].push(backup);\n return groups;\n }, {});\n\n const removed = [];\n for (let day of Object.keys(byDay)) {\n const dayBackups = byDay[day];\n const isToday = day === monthUtils.currentDay();\n // Allow 3 backups of the current day (so fine-grained edits are\n // kept around). Otherwise only keep around one backup per day.\n // And only keep a total of 10 backups.\n for (let backup of dayBackups.slice(isToday ? 3 : 1)) {\n removed.push(backup.id);\n }\n }\n\n // Get the list of remaining backups and only keep the latest 10\n const currentBackups = backups.filter(backup => !removed.includes(backup.id));\n return removed.concat(currentBackups.slice(10).map(backup => backup.id));\n}\n\nexport async function makeBackup(id) {\n const budgetDir = fs.getBudgetDir(id);\n\n // When making a backup, we no longer consider the user to be\n // viewing any backups. If there exists a \"latest backup\" we should\n // delete it and consider whatever is current as the latest\n if (await fs.exists(fs.join(budgetDir, LATEST_BACKUP_FILENAME))) {\n await fs.removeFile(fs.join(fs.getBudgetDir(id), LATEST_BACKUP_FILENAME));\n }\n\n let backupId = `${uuid.v4Sync()}.sqlite`;\n let backupPath = fs.join(budgetDir, 'backups', backupId);\n\n if (!(await fs.exists(fs.join(budgetDir, 'backups')))) {\n await fs.mkdir(fs.join(budgetDir, 'backups'));\n }\n\n await fs.copyFile(fs.join(budgetDir, 'db.sqlite'), backupPath);\n\n // Remove all the messages from the backup\n const db = sqlite.openDatabase(backupPath);\n await sqlite.runQuery(db, 'DELETE FROM messages_crdt');\n await sqlite.runQuery(db, 'DELETE FROM messages_clock');\n sqlite.closeDatabase(db);\n\n const toRemove = await updateBackups(await getBackups(id));\n for (let id of toRemove) {\n await fs.removeFile(fs.join(budgetDir, 'backups', id));\n }\n\n connection.send('backups-updated', await getAvailableBackups(id));\n}\n\nexport async function loadBackup(id, backupId) {\n const budgetDir = fs.getBudgetDir(id);\n\n if (!(await fs.exists(fs.join(budgetDir, LATEST_BACKUP_FILENAME)))) {\n // If this is the first time we're loading a backup, save the\n // current version so the user can easily revert back to it\n await fs.copyFile(\n fs.join(budgetDir, 'db.sqlite'),\n fs.join(budgetDir, LATEST_BACKUP_FILENAME)\n );\n\n await fs.copyFile(\n fs.join(budgetDir, 'metadata.json'),\n fs.join(budgetDir, 'metadata.latest.json')\n );\n\n // Restart the backup service to make sure the user has the full\n // amount of time to figure out which one they want\n stopBackupService();\n startBackupService(id);\n\n await prefs.loadPrefs(id);\n }\n\n if (backupId === LATEST_BACKUP_FILENAME) {\n console.log('Reverting backup');\n\n // If reverting back to the latest, copy and delete the latest\n // backup\n await fs.copyFile(\n fs.join(budgetDir, LATEST_BACKUP_FILENAME),\n fs.join(budgetDir, 'db.sqlite')\n );\n await fs.copyFile(\n fs.join(budgetDir, 'metadata.latest.json'),\n fs.join(budgetDir, 'metadata.json')\n );\n await fs.removeFile(fs.join(budgetDir, LATEST_BACKUP_FILENAME));\n await fs.removeFile(fs.join(budgetDir, 'metadata.latest.json'));\n\n // Re-upload the new file\n try {\n await cloudStorage.upload();\n } catch (e) {}\n prefs.unloadPrefs();\n } else {\n console.log('Loading backup', backupId);\n\n // This function is only ever called when a budget isn't loaded,\n // so it's safe to load our prefs in. We need to forget about any\n // syncing data if we are loading a backup (the current sync data\n // will be restored if the user reverts to the original version)\n await prefs.loadPrefs(id);\n await prefs.savePrefs({\n groupId: null,\n lastSyncedTimestamp: null,\n lastUploaded: null\n });\n\n // Re-upload the new file\n try {\n await cloudStorage.upload();\n } catch (e) {}\n\n prefs.unloadPrefs();\n\n await fs.copyFile(\n fs.join(budgetDir, 'backups', backupId),\n fs.join(budgetDir, 'db.sqlite')\n );\n }\n}\n\nexport function startBackupService(id) {\n if (serviceInterval) {\n clearInterval(serviceInterval);\n }\n\n // Make a backup every 15 minutes\n serviceInterval = setInterval(async () => {\n console.log('Making backup');\n await makeBackup(id);\n }, 1000 * 60 * 15);\n}\n\nexport function stopBackupService() {\n clearInterval(serviceInterval);\n serviceInterval = null;\n}\n","import * as monthUtils from '../../shared/months';\nimport * as db from '../db';\nimport { batchMessages } from '../sync';\nimport { groupBySingle } from '../../shared/util';\nimport * as prefs from '../prefs';\nimport * as sheet from '../sheet';\n\nasync function getSheetValue(sheetName, cell) {\n const node = await sheet.getCell(sheetName, cell);\n return typeof node.value === 'number' ? node.value : 0;\n}\n\n// We want to only allow the positive movement of money back and\n// forth. buffered should never be allowed to go into the negative,\n// and you shouldn't be allowed to pull non-existant money from\n// leftover.\nfunction calcBufferedAmount(toBudget, buffered, amount) {\n amount = Math.min(Math.max(amount, -buffered), Math.max(toBudget, 0));\n return buffered + amount;\n}\n\nfunction getBudgetTable() {\n let { budgetType } = prefs.getPrefs() || {};\n return budgetType === 'report' ? 'reflect_budgets' : 'zero_budgets';\n}\n\nfunction isReflectBudget() {\n let { budgetType } = prefs.getPrefs();\n return budgetType === 'report';\n}\n\nfunction isZeroBudget() {\n let { budgetType } = prefs.getPrefs();\n return budgetType === 'rollover';\n}\n\nfunction dbMonth(month) {\n return parseInt(month.replace('-', ''));\n}\n\nfunction getBudgetData(table, month) {\n return db.all(\n `\n SELECT b.*, c.is_income FROM v_categories c\n LEFT JOIN ${table} b ON b.category = c.id\n WHERE c.tombstone = 0 AND b.month = ?\n `,\n [month]\n );\n}\n\nfunction getAllMonths(startMonth) {\n let { createdMonths } = sheet.get().meta();\n let latest = null;\n for (let month of createdMonths) {\n if (latest == null || month > latest) {\n latest = month;\n }\n }\n return monthUtils.rangeInclusive(startMonth, latest);\n}\n\n// TODO: Valid month format in all the functions below\n\nexport function getBudget({ category, month }) {\n let table = getBudgetTable();\n let existing = db.firstSync(\n `SELECT * FROM ${table} WHERE month = ? AND category = ?`,\n [dbMonth(month), category]\n );\n return existing ? existing.amount || 0 : 0;\n}\n\nexport function setBudget({ category, month, amount }) {\n if (typeof amount !== 'number') {\n amount = 0;\n }\n const table = getBudgetTable();\n\n let existing = db.firstSync(\n `SELECT id FROM ${table} WHERE month = ? AND category = ?`,\n [dbMonth(month), category]\n );\n if (existing) {\n return db.update(table, { id: existing.id, amount });\n }\n return db.insert(table, {\n id: `${dbMonth(month)}-${category}`,\n month: dbMonth(month),\n category,\n amount\n });\n}\n\nexport function setBuffer(month, amount) {\n let existing = db.firstSync(\n `SELECT id FROM zero_budget_months WHERE id = ?`,\n [month]\n );\n if (existing) {\n return db.update('zero_budget_months', {\n id: existing.id,\n buffered: amount\n });\n }\n return db.insert('zero_budget_months', { id: month, buffered: amount });\n}\n\nfunction setCarryover(table, category, month, flag) {\n let existing = db.firstSync(\n `SELECT id FROM ${table} WHERE month = ? AND category = ?`,\n [month, category]\n );\n if (existing) {\n return db.update(table, { id: existing.id, carryover: flag ? 1 : 0 });\n }\n return db.insert(table, {\n id: `${month}-${category}`,\n month,\n category,\n carryover: flag ? 1 : 0\n });\n}\n\n// Actions\n\nexport async function copyPreviousMonth({ month }) {\n let prevMonth = dbMonth(monthUtils.prevMonth(month));\n let table = getBudgetTable();\n let budgetData = await getBudgetData(table, prevMonth);\n\n await batchMessages(() => {\n budgetData.forEach(prevBudget => {\n if (prevBudget.is_income === 1 && !isReflectBudget()) {\n return;\n }\n setBudget({\n category: prevBudget.category,\n month,\n amount: prevBudget.amount\n });\n });\n });\n}\n\nexport async function setZero({ month }) {\n let categories = await db.all(\n 'SELECT * FROM v_categories WHERE tombstone = 0'\n );\n\n await batchMessages(() => {\n categories.forEach(cat => {\n if (cat.is_income === 1 && !isReflectBudget()) {\n return;\n }\n setBudget({ category: cat.id, month, amount: 0 });\n });\n });\n}\n\nexport async function set3MonthAvg({ month }) {\n let categories = await db.all(\n 'SELECT * FROM v_categories WHERE tombstone = 0'\n );\n\n let prevMonth1 = monthUtils.prevMonth(month);\n let prevMonth2 = monthUtils.prevMonth(prevMonth1);\n let prevMonth3 = monthUtils.prevMonth(prevMonth2);\n\n await batchMessages(async () => {\n for (let cat of categories) {\n if (cat.is_income === 1 && !isReflectBudget()) {\n continue;\n }\n\n let spent1 = await getSheetValue(\n monthUtils.sheetForMonth(prevMonth1),\n 'sum-amount-' + cat.id\n );\n let spent2 = await getSheetValue(\n monthUtils.sheetForMonth(prevMonth2),\n 'sum-amount-' + cat.id\n );\n let spent3 = await getSheetValue(\n monthUtils.sheetForMonth(prevMonth3),\n 'sum-amount-' + cat.id\n );\n\n const avg = ((spent1 + spent2 + spent3) / 3) | 0;\n setBudget({ category: cat.id, month, amount: -avg });\n }\n });\n}\n\nexport async function setAllFuture({ startMonth }) {\n if (!isReflectBudget()) {\n throw new Error('setAllFuture only applies to report budget type');\n }\n let table = getBudgetTable();\n let budgetData = await getBudgetData(table, dbMonth(startMonth));\n let months = getAllMonths(monthUtils.addMonths(startMonth, 1));\n\n batchMessages(() => {\n for (let month of months) {\n budgetData.forEach(budget => {\n if (budget.is_income === 1 && !isReflectBudget()) {\n return;\n }\n setBudget({ category: budget.category, month, amount: budget.amount });\n });\n }\n });\n}\n\nexport async function holdForNextMonth({ month, amount }) {\n let row = await db.first(\n 'SELECT buffered FROM zero_budget_months WHERE id = ?',\n [month]\n );\n\n let sheetName = monthUtils.sheetForMonth(month);\n let toBudget = await getSheetValue(sheetName, 'to-budget');\n\n if (toBudget > 0) {\n let bufferedAmount = calcBufferedAmount(\n toBudget,\n (row && row.buffered) || 0,\n amount\n );\n\n await setBuffer(month, bufferedAmount);\n return true;\n }\n return false;\n}\n\nexport async function holdForFutureMonths({ startMonth, amount }) {\n let months = getAllMonths(startMonth);\n\n await batchMessages(async () => {\n for (let month of months) {\n if (!(await holdForNextMonth({ month, amount }))) {\n break;\n }\n }\n });\n}\n\nexport async function resetHold({ month }) {\n await setBuffer(month, 0);\n}\n\nexport async function coverOverspending({ month, to, from }) {\n let sheetName = monthUtils.sheetForMonth(month);\n let toBudgeted = await getSheetValue(sheetName, 'budget-' + to);\n let leftover = await getSheetValue(sheetName, 'leftover-' + to);\n let leftoverFrom = await getSheetValue(\n sheetName,\n from === 'to-be-budgeted' ? 'to-budget' : 'leftover-' + from\n );\n\n if (leftover >= 0 || leftoverFrom <= 0) {\n return;\n }\n\n let amountCovered = Math.min(-leftover, leftoverFrom);\n\n // If we are covering it from the to be budgeted amount, ignore this\n if (from !== 'to-be-budgeted') {\n const fromBudgeted = await getSheetValue(sheetName, 'budget-' + from);\n await setBudget({\n category: from,\n month,\n amount: fromBudgeted - amountCovered\n });\n }\n\n await setBudget({ category: to, month, amount: toBudgeted + amountCovered });\n}\n\nexport async function transferAvailable({ month, amount, category }) {\n let sheetName = monthUtils.sheetForMonth(month);\n let leftover = await getSheetValue(sheetName, 'to-budget');\n amount = Math.max(Math.min(amount, leftover), 0);\n\n let budgeted = await getSheetValue(sheetName, 'budget-' + category);\n await setBudget({ category, month, amount: budgeted + amount });\n}\n\nexport async function transferCategory({ month, amount, from, to }) {\n const sheetName = monthUtils.sheetForMonth(month);\n const fromBudgeted = await getSheetValue(sheetName, 'budget-' + from);\n\n await setBudget({ category: from, month, amount: fromBudgeted - amount });\n\n // If we are simply moving it back into available cash to budget,\n // don't do anything else\n if (to !== 'to-be-budgeted') {\n const toBudgeted = await getSheetValue(sheetName, 'budget-' + to);\n await setBudget({ category: to, month, amount: toBudgeted + amount });\n }\n}\n\nexport async function setCategoryCarryover({ startMonth, category, flag }) {\n let table = getBudgetTable();\n let months = getAllMonths(startMonth);\n\n await batchMessages(() => {\n for (let month of months) {\n setCarryover(table, category, dbMonth(month), flag);\n }\n });\n}\n","import { createApp } from '../app';\nimport { mutator } from '../mutators';\nimport { undoable } from '../undo';\nimport * as actions from './actions';\n\n\nlet app = createApp();\n\napp.method('budget/budget-amount', mutator(undoable(actions.setBudget)));\napp.method(\n 'budget/copy-previous-month',\n mutator(undoable(actions.copyPreviousMonth))\n);\napp.method('budget/set-zero', mutator(undoable(actions.setZero)));\napp.method('budget/set-3month-avg', mutator(undoable(actions.set3MonthAvg)));\napp.method('budget/set-all-future', mutator(undoable(actions.setAllFuture)));\napp.method(\n 'budget/hold-for-next-month',\n mutator(undoable(actions.holdForNextMonth))\n);\napp.method(\n 'budget/hold-for-future-months',\n mutator(undoable(actions.holdForFutureMonths))\n);\napp.method('budget/reset-hold', mutator(undoable(actions.resetHold)));\napp.method(\n 'budget/cover-overspending',\n mutator(undoable(actions.coverOverspending))\n);\napp.method(\n 'budget/transfer-available',\n mutator(undoable(actions.transferAvailable))\n);\napp.method(\n 'budget/transfer-category',\n mutator(undoable(actions.transferCategory))\n);\napp.method(\n 'budget/set-carryover',\n mutator(undoable(actions.setCategoryCarryover))\n);\n\nexport default app;\n","import * as sheet from '../sheet';\nimport * as db from '../db';\nimport * as monthUtils from '../../shared/months';\nimport { getChangedValues } from '../../shared/util';\nimport { resolveName } from '../spreadsheet/util';\nimport * as report from './report';\nimport * as rollover from './rollover';\nimport { sumAmounts } from './util';\nimport * as budgetActions from '../budget/actions';\n\nfunction mergeUpdates(updates) {\n const merged = {};\n updates.forEach(update => {\n Object.keys(update).forEach(sheet => {\n if (merged[sheet]) {\n merged[sheet] = { ...merged[sheet], ...update[sheet] };\n } else {\n merged[sheet] = update[sheet];\n }\n });\n });\n return merged;\n}\n\nexport function getBudgetType() {\n let meta = sheet.get().meta();\n return meta.budgetType || 'rollover';\n}\n\nexport function getBudgetRange(start, end) {\n start = monthUtils.getMonth(start);\n end = monthUtils.getMonth(end);\n\n // The start date should never be after the end date. If that\n // happened, the month range might be a valid range and weird\n // things happen\n if (start > end) {\n start = end;\n }\n\n // Budgets should exist 3 months before the earliest needed date\n // (either the oldest transaction or the current month if no\n // transactions yet), and a year from the current date. There's no\n // need to ever have budgets outside that range.\n start = monthUtils.subMonths(start, 3);\n end = monthUtils.addMonths(end, 12);\n\n return { start, end, range: monthUtils.rangeInclusive(start, end) };\n}\n\nfunction createCategory(cat, sheetName, prevSheetName, start, end) {\n sheet.get().createDynamic(sheetName, 'sum-amount-' + cat.id, {\n initialValue: 0,\n run: () => {\n // Making this sync is faster!\n let rows = db.runQuery(\n `SELECT SUM(amount) as amount FROM v_transactions_internal_alive t\n LEFT JOIN accounts a ON a.id = t.account\n WHERE t.date >= ${start} AND t.date <= ${end}\n AND category = '${cat.id}' AND a.offbudget = 0`,\n [],\n true\n );\n let row = rows[0];\n let amount = row ? row.amount : 0;\n return amount || 0;\n }\n });\n\n if (getBudgetType() === 'rollover') {\n rollover.createCategory(cat, sheetName, prevSheetName);\n } else {\n report.createCategory(cat, sheetName, prevSheetName);\n }\n}\n\nfunction createCategoryGroup(group, sheetName) {\n sheet.get().createDynamic(sheetName, 'group-sum-amount-' + group.id, {\n initialValue: 0,\n dependencies: group.categories.map(cat => `sum-amount-${cat.id}`),\n run: sumAmounts\n });\n\n if (!group.is_income || getBudgetType() !== 'rollover') {\n sheet.get().createDynamic(sheetName, 'group-budget-' + group.id, {\n initialValue: 0,\n dependencies: group.categories.map(cat => `budget-${cat.id}`),\n run: sumAmounts\n });\n\n sheet.get().createDynamic(sheetName, 'group-leftover-' + group.id, {\n initialValue: 0,\n dependencies: group.categories.map(cat => `leftover-${cat.id}`),\n run: sumAmounts\n });\n }\n}\n\nfunction handleAccountChange(months, oldValue, newValue) {\n if (!oldValue || oldValue.offbudget !== newValue.offbudget) {\n let rows = db.runQuery(\n `\n SELECT DISTINCT(category) as category FROM transactions\n WHERE acct = ?\n `,\n [newValue.id],\n true\n );\n\n months.forEach(month => {\n let sheetName = monthUtils.sheetForMonth(month, getBudgetType());\n\n rows.forEach(row => {\n sheet\n .get()\n .recompute(resolveName(sheetName, 'sum-amount-' + row.category));\n });\n });\n }\n}\n\nfunction handleTransactionChange(transaction, changedFields) {\n if (\n (changedFields.has('date') ||\n changedFields.has('acct') ||\n changedFields.has('amount') ||\n changedFields.has('category') ||\n changedFields.has('tombstone') ||\n changedFields.has('isParent')) &&\n transaction.date &&\n transaction.category\n ) {\n let month = monthUtils.monthFromDate(db.fromDateRepr(transaction.date));\n let sheetName = monthUtils.sheetForMonth(month, getBudgetType());\n\n sheet\n .get()\n .recompute(resolveName(sheetName, 'sum-amount-' + transaction.category));\n }\n}\n\nfunction handleCategoryMappingChange(months, oldValue, newValue) {\n months.forEach(month => {\n let sheetName = monthUtils.sheetForMonth(month, getBudgetType());\n if (oldValue) {\n sheet\n .get()\n .recompute(resolveName(sheetName, 'sum-amount-' + oldValue.transferId));\n }\n sheet\n .get()\n .recompute(resolveName(sheetName, 'sum-amount-' + newValue.transferId));\n });\n}\n\nfunction handleCategoryChange(months, oldValue, newValue) {\n function addDeps(sheetName, groupId, catId) {\n sheet\n .get()\n .addDependencies(sheetName, `group-sum-amount-${groupId}`, [\n `sum-amount-${catId}`\n ]);\n sheet\n .get()\n .addDependencies(sheetName, `group-budget-${groupId}`, [\n `budget-${catId}`\n ]);\n sheet\n .get()\n .addDependencies(sheetName, `group-leftover-${groupId}`, [\n `leftover-${catId}`\n ]);\n }\n\n function removeDeps(sheetName, groupId, catId) {\n sheet\n .get()\n .removeDependencies(sheetName, `group-sum-amount-${groupId}`, [\n `sum-amount-${catId}`\n ]);\n sheet\n .get()\n .removeDependencies(sheetName, `group-budget-${groupId}`, [\n `budget-${catId}`\n ]);\n sheet\n .get()\n .removeDependencies(sheetName, `group-leftover-${groupId}`, [\n `leftover-${catId}`\n ]);\n }\n\n let budgetType = getBudgetType();\n\n if (oldValue && oldValue.tombstone === 0 && newValue.tombstone === 1) {\n let id = newValue.id;\n let groupId = newValue.cat_group;\n\n months.forEach(month => {\n let sheetName = monthUtils.sheetForMonth(month);\n removeDeps(sheetName, groupId, id);\n });\n } else if (\n newValue.tombstone === 0 &&\n (!oldValue || oldValue.tombstone === 1)\n ) {\n if (budgetType === 'rollover') {\n rollover.createBlankCategory(newValue, months);\n }\n\n months.forEach(month => {\n let prevMonth = monthUtils.prevMonth(month);\n let prevSheetName = monthUtils.sheetForMonth(prevMonth, budgetType);\n let sheetName = monthUtils.sheetForMonth(month, budgetType);\n let { start, end } = monthUtils.bounds(month);\n\n createCategory(newValue, sheetName, prevSheetName, start, end);\n\n let id = newValue.id;\n let groupId = newValue.cat_group;\n\n if (getBudgetType() === 'rollover') {\n sheet\n .get()\n .addDependencies(sheetName, 'last-month-overspent', [\n `${prevSheetName}!leftover-${id}`,\n `${prevSheetName}!carryover-${id}`\n ]);\n }\n\n addDeps(sheetName, groupId, id);\n });\n } else if (oldValue && oldValue.cat_group !== newValue.cat_group) {\n // The category moved so we need to update the dependencies\n let id = newValue.id;\n\n months.forEach(month => {\n let sheetName = monthUtils.sheetForMonth(month, budgetType);\n removeDeps(sheetName, oldValue.cat_group, id);\n addDeps(sheetName, newValue.cat_group, id);\n });\n }\n}\n\nfunction handleCategoryGroupChange(months, oldValue, newValue) {\n let budgetType = getBudgetType();\n\n function addDeps(sheetName, groupId) {\n sheet\n .get()\n .addDependencies(sheetName, 'total-budgeted', [\n `group-budget-${groupId}`\n ]);\n sheet\n .get()\n .addDependencies(sheetName, 'total-spent', [\n `group-sum-amount-${groupId}`\n ]);\n sheet\n .get()\n .addDependencies(sheetName, 'total-leftover', [\n `group-leftover-${groupId}`\n ]);\n }\n\n function removeDeps(sheetName, groupId) {\n sheet\n .get()\n .removeDependencies(sheetName, 'total-budgeted', [\n `group-budget-${groupId}`\n ]);\n sheet\n .get()\n .removeDependencies(sheetName, 'total-spent', [\n `group-sum-amount-${groupId}`\n ]);\n sheet\n .get()\n .removeDependencies(sheetName, 'total-leftover', [\n `group-leftover-${groupId}`\n ]);\n }\n\n if (newValue.tombstone === 1 && oldValue && oldValue.tombstone === 0) {\n let id = newValue.id;\n months.forEach(month => {\n let sheetName = monthUtils.sheetForMonth(month, budgetType);\n removeDeps(sheetName, id);\n });\n } else if (\n newValue.tombstone === 0 &&\n (!oldValue || oldValue.tombstone === 1)\n ) {\n let group = newValue;\n\n if (!group.is_income || budgetType !== 'rollover') {\n months.forEach(month => {\n let sheetName = monthUtils.sheetForMonth(month, budgetType);\n\n // Dirty, dirty hack. These functions should not be async, but this is\n // OK because we're leveraging the sync nature of queries. Ideally we\n // wouldn't be querying here. But I think we have to. At least for now\n // we do\n let categories = db.runQuery(\n 'SELECT * FROM categories WHERE tombstone = 0 AND cat_group = ?',\n [group.id],\n true\n );\n createCategoryGroup({ ...group, categories }, sheetName);\n\n addDeps(sheetName, group.id);\n });\n }\n }\n}\n\nfunction handleBudgetMonthChange(budget) {\n let sheetName = monthUtils.sheetForMonth(budget.id);\n sheet.get().set(`${sheetName}!buffered`, budget.buffered);\n}\n\nfunction handleBudgetChange(budget) {\n if (budget.category) {\n let sheetName = monthUtils.sheetForMonth(budget.month.toString());\n sheet\n .get()\n .set(`${sheetName}!budget-${budget.category}`, budget.amount || 0);\n sheet\n .get()\n .set(\n `${sheetName}!carryover-${budget.category}`,\n budget.carryover === 1 ? true : false\n );\n }\n}\n\nexport function triggerBudgetChanges(oldValues, newValues) {\n let { createdMonths = new Set() } = sheet.get().meta();\n sheet.startTransaction();\n\n try {\n newValues.forEach((items, table) => {\n let old = oldValues.get(table);\n\n items.forEach(newValue => {\n let oldValue = old && old.get(newValue.id);\n\n if (table === 'zero_budget_months') {\n handleBudgetMonthChange(newValue);\n } else if (table === 'zero_budgets' || table === 'reflect_budgets') {\n handleBudgetChange(newValue);\n } else if (table === 'transactions') {\n let changed = new Set(\n Object.keys(getChangedValues(oldValue || {}, newValue) || {})\n );\n\n if (oldValue) {\n handleTransactionChange(oldValue, changed);\n }\n handleTransactionChange(newValue, changed);\n } else if (table === 'category_mapping') {\n handleCategoryMappingChange(createdMonths, oldValue, newValue);\n } else if (table === 'categories') {\n handleCategoryChange(createdMonths, oldValue, newValue);\n } else if (table === 'category_groups') {\n handleCategoryGroupChange(createdMonths, oldValue, newValue);\n } else if (table === 'accounts') {\n handleAccountChange(createdMonths, oldValue, newValue);\n }\n });\n });\n } finally {\n sheet.endTransaction();\n }\n}\n\nexport async function doTransfer(categoryIds, transferId) {\n let { createdMonths: months } = sheet.get().meta();\n\n [...months].map(month => {\n let totalValue = categoryIds\n .map(id => {\n return budgetActions.getBudget({ month, category: id });\n })\n .reduce((total, value) => total + value, 0);\n\n let transferValue = budgetActions.getBudget({\n month,\n category: transferId\n });\n\n budgetActions.setBudget({\n month,\n category: transferId,\n amount: totalValue + transferValue\n });\n });\n}\n\nexport async function createBudget(months) {\n const categories = await db.getCategories();\n const groups = await db.getCategoriesGrouped();\n\n sheet.startTransaction();\n let meta = sheet.get().meta();\n meta.createdMonths = meta.createdMonths || new Set();\n\n let budgetType = getBudgetType();\n\n if (budgetType === 'rollover') {\n rollover.createBudget(meta, categories, months);\n }\n\n months.forEach(month => {\n if (!meta.createdMonths.has(month)) {\n let prevMonth = monthUtils.prevMonth(month);\n let { start, end } = monthUtils.bounds(month);\n let sheetName = monthUtils.sheetForMonth(month, budgetType);\n let prevSheetName = monthUtils.sheetForMonth(prevMonth, budgetType);\n\n categories.forEach(cat => {\n createCategory(cat, sheetName, prevSheetName, start, end);\n });\n groups.forEach(group => {\n createCategoryGroup(group, sheetName);\n });\n\n if (budgetType === 'rollover') {\n rollover.createSummary(groups, categories, prevSheetName, sheetName);\n } else {\n report.createSummary(groups, categories, sheetName);\n }\n\n meta.createdMonths.add(month);\n }\n });\n\n sheet.get().setMeta(meta);\n sheet.endTransaction();\n\n // Wait for the spreadsheet to finish computing. Normally this won't\n // do anything (as values are cached) but on first run this need to\n // show the loading screen while it initially sets up.\n await sheet.waitOnSpreadsheet();\n}\n\nexport async function createAllBudgets() {\n let earliestTransaction = await db.first(\n 'SELECT * FROM transactions WHERE isChild=0 AND date IS NOT NULL ORDER BY date ASC LIMIT 1'\n );\n let earliestDate =\n earliestTransaction && db.fromDateRepr(earliestTransaction.date);\n let currentMonth = monthUtils.currentMonth();\n\n // Get the range based off of the earliest transaction and the\n // current month. If no transactions currently exist the current\n // month is also used as the starting month\n let { start, end, range } = getBudgetRange(\n earliestDate || currentMonth,\n currentMonth\n );\n\n let meta = sheet.get().meta();\n let createdMonths = meta.createdMonths || new Set();\n let newMonths = range.filter(m => !createdMonths.has(m));\n\n if (newMonths.length > 0) {\n await createBudget(range);\n }\n\n return { start, end };\n}\n\nexport async function setType(type) {\n let meta = sheet.get().meta();\n if (type === meta.budgetType) {\n return;\n }\n\n meta.budgetType = type;\n meta.createdMonths = new Set();\n\n // Go through and force all the cells to be recomputed\n let nodes = sheet.get().getNodes();\n db.transaction(() => {\n for (let name of nodes.keys()) {\n let [sheetName, cellName] = name.split('!');\n if (sheetName.match(/^budget\\d+/)) {\n sheet.get().deleteCell(sheetName, cellName);\n }\n }\n });\n\n sheet.get().startCacheBarrier();\n sheet.loadUserBudgets(db);\n let bounds = await createAllBudgets();\n sheet.get().endCacheBarrier();\n\n return bounds;\n}\n","import * as sheet from '../sheet';\nimport * as monthUtils from '../../shared/months';\nimport { number, sumAmounts } from './util';\nconst { resolveName } = require('../spreadsheet/util');\n\nexport async function createCategory(cat, sheetName, prevSheetName) {\n sheet.get().createStatic(sheetName, `budget-${cat.id}`, 0);\n\n // This makes the app more robust by \"fixing up\" null budget values.\n // Those should not be allowed, but in case somehow a null value\n // ends up there, we are resilient to it. Preferrably the\n // spreadsheet would have types and be more strict about what is\n // allowed to be set.\n if (sheet.get().getCellValue(sheetName, `budget-${cat.id}`) == null) {\n sheet.get().set(resolveName(sheetName, `budget-${cat.id}`), 0);\n }\n\n sheet.get().createDynamic(sheetName, `leftover-${cat.id}`, {\n initialValue: 0,\n dependencies: [\n `budget-${cat.id}`,\n `sum-amount-${cat.id}`,\n `${prevSheetName}!carryover-${cat.id}`,\n `${prevSheetName}!leftover-${cat.id}`\n ],\n run: (budgeted, sumAmount, prevCarryover, prevLeftover) => {\n if (cat.is_income) {\n return (\n number(budgeted) -\n number(sumAmount) +\n (prevCarryover ? number(prevLeftover) : 0)\n );\n }\n\n return (\n number(budgeted) +\n number(sumAmount) +\n (prevCarryover ? number(prevLeftover) : 0)\n );\n }\n });\n sheet.get().createDynamic(sheetName, `spent-with-carryover-${cat.id}`, {\n initialValue: 0,\n dependencies: [\n `budget-${cat.id}`,\n `sum-amount-${cat.id}`,\n `carryover-${cat.id}`\n ],\n // TODO: Why refresh??\n refresh: true,\n run: (budgeted, sumAmount, carryover) => {\n return carryover\n ? Math.max(0, number(budgeted) + number(sumAmount))\n : sumAmount;\n }\n });\n\n sheet.get().createStatic(sheetName, `carryover-${cat.id}`, false);\n}\n\nexport function createSummary(groups, categories, sheetName) {\n let incomeGroup = groups.filter(group => group.is_income)[0];\n let expenseCategories = categories.filter(cat => !cat.is_income);\n\n sheet.get().createDynamic(sheetName, 'total-budgeted', {\n initialValue: 0,\n dependencies: groups\n .filter(group => !group.is_income)\n .map(group => `group-budget-${group.id}`),\n run: sumAmounts\n });\n\n sheet.get().createDynamic(sheetName, 'total-spent', {\n initialValue: 0,\n refresh: true,\n dependencies: expenseCategories.map(\n cat => `${sheetName}!spent-with-carryover-${cat.id}`\n ),\n run: sumAmounts\n });\n\n sheet.get().createDynamic(sheetName, 'total-income', {\n initialValue: 0,\n dependencies: [`group-sum-amount-${incomeGroup.id}`],\n run: amount => amount\n });\n\n sheet.get().createDynamic(sheetName, 'total-leftover', {\n initialValue: 0,\n dependencies: ['total-budgeted', 'total-spent'],\n run: sumAmounts\n });\n\n sheet.get().createDynamic(sheetName, 'total-budget-income', {\n initialValue: 0,\n dependencies: [`group-budget-${incomeGroup.id}`],\n run: amount => amount\n });\n\n sheet.get().createDynamic(sheetName, 'total-saved', {\n initialValue: 0,\n dependencies: ['total-budget-income', 'total-budgeted'],\n run: (income, budgeted) => {\n return income - budgeted;\n }\n });\n\n sheet.get().createDynamic(sheetName, 'real-saved', {\n initialValue: 0,\n dependencies: ['total-income', 'total-spent'],\n run: (income, spent) => {\n return income - -spent;\n }\n });\n}\n","import * as sheet from '../sheet';\nimport * as monthUtils from '../../shared/months';\nimport { number, sumAmounts, flatten2, unflatten2 } from './util';\nconst { resolveName } = require('../spreadsheet/util');\n\nfunction getBlankSheet(months) {\n let blankMonth = monthUtils.prevMonth(months[0]);\n return monthUtils.sheetForMonth(blankMonth, 'rollover');\n}\n\nexport function createBlankCategory(cat, months) {\n if (months.length > 0) {\n let sheetName = getBlankSheet(months);\n sheet.get().createStatic(sheetName, `carryover-${cat.id}`, false);\n sheet.get().createStatic(sheetName, `leftover-${cat.id}`, 0);\n sheet.get().createStatic(sheetName, `leftover-pos-${cat.id}`, 0);\n }\n}\n\nfunction createBlankMonth(categories, sheetName, months) {\n sheet.get().createStatic(sheetName, 'is-blank', true);\n sheet.get().createStatic(sheetName, 'to-budget', 0);\n sheet.get().createStatic(sheetName, 'buffered', 0);\n\n categories.forEach(cat => createBlankCategory(cat, months));\n}\n\nexport function createCategory(cat, sheetName, prevSheetName) {\n if (!cat.is_income) {\n sheet.get().createStatic(sheetName, `budget-${cat.id}`, 0);\n\n // This makes the app more robust by \"fixing up\" null budget values.\n // Those should not be allowed, but in case somehow a null value\n // ends up there, we are resilient to it. Preferrably the\n // spreadsheet would have types and be more strict about what is\n // allowed to be set.\n if (sheet.get().getCellValue(sheetName, `budget-${cat.id}`) == null) {\n sheet.get().set(resolveName(sheetName, `budget-${cat.id}`), 0);\n }\n\n sheet.get().createStatic(sheetName, `carryover-${cat.id}`, false);\n\n sheet.get().createDynamic(sheetName, `leftover-${cat.id}`, {\n initialValue: 0,\n dependencies: [\n `budget-${cat.id}`,\n `sum-amount-${cat.id}`,\n `${prevSheetName}!carryover-${cat.id}`,\n `${prevSheetName}!leftover-${cat.id}`,\n `${prevSheetName}!leftover-pos-${cat.id}`\n ],\n run: (budgeted, spent, prevCarryover, prevLeftover, prevLeftoverPos) => {\n return (\n number(budgeted) +\n number(spent) +\n (prevCarryover ? number(prevLeftover) : number(prevLeftoverPos))\n );\n }\n });\n\n sheet.get().createDynamic(sheetName, 'leftover-pos-' + cat.id, {\n initialValue: 0,\n dependencies: [`leftover-${cat.id}`],\n run: leftover => {\n return leftover < 0 ? 0 : leftover;\n }\n });\n }\n}\n\nexport function createSummary(groups, categories, prevSheetName, sheetName) {\n let incomeGroup = groups.filter(group => group.is_income)[0];\n let expenseCategories = categories.filter(cat => !cat.is_income);\n\n sheet.get().createStatic(sheetName, 'buffered', 0);\n\n sheet.get().createDynamic(sheetName, 'from-last-month', {\n initialValue: 0,\n dependencies: [`${prevSheetName}!to-budget`, `${prevSheetName}!buffered`],\n run: (toBudget, buffered) => number(toBudget) + number(buffered)\n });\n\n // Alias the group income total to `total-income`\n sheet.get().createDynamic(sheetName, 'total-income', {\n initialValue: 0,\n dependencies: [`group-sum-amount-${incomeGroup.id}`],\n run: amount => amount\n });\n\n sheet.get().createDynamic(sheetName, 'available-funds', {\n initialValue: 0,\n dependencies: ['total-income', 'from-last-month'],\n run: (income, fromLastMonth) => number(income) + number(fromLastMonth)\n });\n\n sheet.get().createDynamic(sheetName, 'last-month-overspent', {\n initialValue: 0,\n dependencies: flatten2(\n expenseCategories.map(cat => [\n `${prevSheetName}!leftover-${cat.id}`,\n `${prevSheetName}!carryover-${cat.id}`\n ])\n ),\n run: (...data) => {\n data = unflatten2(data);\n return data.reduce((total, [leftover, carryover]) => {\n if (carryover) {\n return total;\n }\n return total + Math.min(0, number(leftover));\n }, 0);\n }\n });\n\n sheet.get().createDynamic(sheetName, 'total-budgeted', {\n initialValue: 0,\n dependencies: groups\n .filter(group => !group.is_income)\n .map(group => `group-budget-${group.id}`),\n run: (...amounts) => {\n // Negate budgeted amount\n return -sumAmounts(...amounts);\n }\n });\n\n sheet.get().createDynamic(sheetName, 'buffered', { initialValue: 0 });\n\n sheet.get().createDynamic(sheetName, 'to-budget', {\n initialValue: 0,\n dependencies: [\n 'available-funds',\n 'last-month-overspent',\n 'total-budgeted',\n 'buffered'\n ],\n run: (available, lastOverspent, totalBudgeted, buffered) => {\n return (\n number(available) +\n number(lastOverspent) +\n number(totalBudgeted) -\n number(buffered)\n );\n }\n });\n\n sheet.get().createDynamic(sheetName, 'total-spent', {\n initialValue: 0,\n dependencies: groups\n .filter(group => !group.is_income)\n .map(group => `group-sum-amount-${group.id}`),\n run: sumAmounts\n });\n\n sheet.get().createDynamic(sheetName, 'total-leftover', {\n initialValue: 0,\n dependencies: groups\n .filter(group => !group.is_income)\n .map(group => `group-leftover-${group.id}`),\n run: sumAmounts\n });\n}\n\nexport function createBudget(meta, categories, months) {\n // The spreadsheet is now strict - so we need to fill in some\n // default values for the month before the first month. Only do this\n // if it doesn't already exist\n let blankSheet = getBlankSheet(months);\n if (meta.blankSheet !== blankSheet) {\n sheet.get().clearSheet(meta.blankSheet);\n createBlankMonth(categories, blankSheet, months);\n meta.blankSheet = blankSheet;\n }\n}\n","import { number } from '../spreadsheet/globals';\n\nexport { number } from '../spreadsheet/globals';\n\nexport function sumAmounts(...amounts) {\n return amounts.reduce((total, amount) => {\n return total + number(amount);\n }, 0);\n}\n\nexport function flatten2(arr) {\n return Array.prototype.concat.apply([], arr);\n}\n\nexport function unflatten2(arr) {\n let res = [];\n for (let i = 0; i < arr.length; i += 2) {\n res.push([arr[i], arr[i + 1]]);\n }\n return res;\n}\n\n","import fs from '../platform/server/fs';\nimport asyncStorage from '../platform/server/asyncStorage';\nimport { fetch } from '../platform/server/fetch';\nimport * as monthUtils from '../shared/months';\nimport * as sqlite from '../platform/server/sqlite';\nimport * as prefs from './prefs';\nimport { getServer } from './server-config';\nimport { runMutator } from './mutators';\nimport {\n HTTPError,\n PostError,\n FileDownloadError,\n FileUploadError\n} from './errors';\nimport encryption from './encryption';\nimport { post } from './post';\nlet uuid = require('../platform/uuid');\nlet AdmZip = require('adm-zip');\n\nlet UPLOAD_FREQUENCY_IN_DAYS = 7;\n\nasync function checkHTTPStatus(res) {\n if (res.status !== 200) {\n return res.text().then(str => {\n throw new HTTPError(res.status, str);\n });\n } else {\n return res;\n }\n}\n\nasync function fetchJSON(...args) {\n let res = await fetch(...args);\n res = await checkHTTPStatus(res);\n return res.json();\n}\n\nexport async function checkKey() {\n let userToken = await asyncStorage.getItem('user-token');\n\n let { cloudFileId, encryptKeyId } = prefs.getPrefs();\n\n let res;\n try {\n res = await post(getServer().SYNC_SERVER + '/user-get-key', {\n token: userToken,\n fileId: cloudFileId\n });\n } catch (e) {\n console.log(e);\n return { error: { reason: 'network' } };\n }\n\n // This == comparison is important, they could be null or undefined\n // eslint-disable-next-line\n return {\n valid:\n res.id == encryptKeyId && // eslint-disable-line\n (encryptKeyId == null || encryption.hasKey(encryptKeyId))\n };\n}\n\nexport async function resetSyncState(newKeyState) {\n let userToken = await asyncStorage.getItem('user-token');\n\n let { cloudFileId } = prefs.getPrefs();\n\n if (process.env.IS_BETA) {\n return { error: { reason: 'beta-version' } };\n }\n\n try {\n await post(getServer().SYNC_SERVER + '/reset-user-file', {\n token: userToken,\n fileId: cloudFileId\n });\n } catch (e) {\n if (e instanceof PostError) {\n return {\n error: {\n reason: e.reason === 'unauthorized' ? 'unauthorized' : 'network'\n }\n };\n }\n return { error: { reason: 'internal' } };\n }\n\n if (newKeyState) {\n try {\n await post(getServer().SYNC_SERVER + '/user-create-key', {\n token: userToken,\n fileId: cloudFileId,\n keyId: newKeyState.key.getId(),\n keySalt: newKeyState.salt,\n testContent: newKeyState.testContent\n });\n } catch (e) {\n if (e instanceof PostError) {\n return { error: { reason: 'network' } };\n }\n return { error: { reason: 'internal' } };\n }\n }\n\n return {};\n}\n\nexport async function exportBuffer() {\n let { id, budgetName } = prefs.getPrefs();\n if (!budgetName) {\n return null;\n }\n\n let budgetDir = fs.getBudgetDir(id);\n\n // create zip\n let zipped = new AdmZip();\n\n // We run this in a mutator even though its not mutating anything\n // because we are reading the sqlite file from disk. We want to make\n // sure that we get a valid snapshot of it so we want this to be\n // serialized with all other mutations.\n await runMutator(async () => {\n let rawDbContent = await fs.readFile(\n fs.join(budgetDir, 'db.sqlite'),\n 'binary'\n );\n\n // Do some post-processing of the database. We NEVER upload the cache with\n // the database; this forces new downloads to always recompute everything\n // which is not only safer, but reduces the filesize a lot.\n let memDb = await sqlite.openDatabase(rawDbContent);\n sqlite.execQuery(\n memDb,\n `\n DELETE FROM kvcache;\n DELETE FROM kvcache_key;\n `\n );\n\n let dbContent = sqlite.exportDatabase(memDb);\n sqlite.closeDatabase(memDb);\n\n // mark it as a file that needs a new clock so when a new client\n // downloads it, it'll get set to a unique node\n let meta = JSON.parse(\n await fs.readFile(fs.join(budgetDir, 'metadata.json'))\n );\n\n meta.resetClock = true;\n let metaContent = Buffer.from(JSON.stringify(meta), 'utf8');\n\n zipped.addFile('db.sqlite', dbContent);\n zipped.addFile('metadata.json', metaContent);\n });\n\n return Buffer.from(zipped.toBuffer());\n}\n\nexport async function importBuffer(fileData, buffer) {\n let zipped = new AdmZip(buffer);\n let entries = zipped.getEntries();\n let dbEntry = entries.find(e => e.entryName.includes('db.sqlite'));\n let metaEntry = entries.find(e => e.entryName.includes('metadata.json'));\n\n if (!dbEntry || !metaEntry) {\n throw FileDownloadError('invalid-zip-file');\n }\n\n let dbContent = zipped.readFile(dbEntry);\n let metaContent = zipped.readFile(metaEntry);\n\n let meta;\n try {\n meta = JSON.parse(metaContent.toString('utf8'));\n } catch (err) {\n throw FileDownloadError('invalid-meta-file');\n }\n\n // Update the metadata. The stored file on the server might be\n // out-of-date with a few keys\n meta = {\n ...meta,\n cloudFileId: fileData.fileId,\n groupId: fileData.groupId,\n lastUploaded: monthUtils.currentDay(),\n encryptKeyId: fileData.encryptMeta ? fileData.encryptMeta.keyId : null\n };\n\n let budgetDir = fs.getBudgetDir(meta.id);\n\n if (await fs.exists(budgetDir)) {\n // Don't remove the directory so that backups are retained\n let dbFile = fs.join(budgetDir, 'db.sqlite');\n let metaFile = fs.join(budgetDir, 'metadata.json');\n\n if (await fs.exists(dbFile)) {\n await fs.removeFile(dbFile);\n }\n if (await fs.exists(metaFile)) {\n await fs.removeFile(metaFile);\n }\n } else {\n await fs.mkdir(budgetDir);\n }\n\n await fs.writeFile(fs.join(budgetDir, 'db.sqlite'), dbContent);\n await fs.writeFile(fs.join(budgetDir, 'metadata.json'), JSON.stringify(meta));\n\n return { id: meta.id };\n}\n\nexport async function upload() {\n let userToken = await asyncStorage.getItem('user-token');\n if (!userToken) {\n throw FileUploadError('unauthorized');\n }\n\n // We never change the server from the beta version\n if (process.env.IS_BETA) {\n throw FileUploadError('beta-version');\n }\n\n let zipContent = await exportBuffer();\n if (zipContent == null) {\n return;\n }\n\n let { id, groupId, budgetName, cloudFileId, encryptKeyId } = prefs.getPrefs();\n let uploadContent = zipContent;\n let uploadMeta = null;\n\n // The upload process encrypts with the key tagged in the prefs for\n // the file. It will upload the file and the server is responsible\n // for checking that the key is up-to-date and rejecting it if not\n if (encryptKeyId) {\n let encrypted;\n try {\n encrypted = await encryption.encrypt(zipContent, encryptKeyId);\n } catch (e) {\n throw FileUploadError('encrypt-failure', {\n isMissingKey: e.message === 'missing-key'\n });\n }\n uploadContent = encrypted.value;\n uploadMeta = encrypted.meta;\n }\n\n if (!cloudFileId) {\n cloudFileId = uuid.v4Sync();\n }\n\n let res;\n try {\n res = await fetchJSON(getServer().SYNC_SERVER + '/upload-user-file', {\n method: 'POST',\n headers: {\n 'Content-Length': uploadContent.length,\n 'Content-Type': 'application/encrypted-file',\n 'X-ACTUAL-TOKEN': userToken,\n 'X-ACTUAL-FILE-ID': cloudFileId,\n 'X-ACTUAL-NAME': encodeURIComponent(budgetName),\n 'X-ACTUAL-FORMAT': 2,\n ...(uploadMeta\n ? { 'X-ACTUAL-ENCRYPT-META': JSON.stringify(uploadMeta) }\n : null),\n ...(groupId ? { 'X-ACTUAL-GROUP-ID': groupId } : null)\n },\n body: uploadContent\n });\n } catch (err) {\n console.log('Upload failure', err);\n\n let reason = err instanceof PostError ? err.reason : 'network';\n\n if (err instanceof PostError) {\n throw new FileUploadError(\n err.reason === 'unauthorized' ? 'unauthorized' : err.reason || 'network'\n );\n }\n\n throw FileUploadError('internal');\n }\n\n if (res.status === 'ok') {\n // Only save it if we are still working on the same file\n if (prefs.getPrefs() && prefs.getPrefs().id === id) {\n await prefs.savePrefs({\n lastUploaded: monthUtils.currentDay(),\n cloudFileId,\n groupId: res.groupId\n });\n }\n } else {\n throw FileUploadError('internal');\n }\n}\n\nexport async function possiblyUpload() {\n let { cloudFileId, groupId, lastUploaded, id } = prefs.getPrefs();\n\n let threshold =\n lastUploaded && monthUtils.addDays(lastUploaded, UPLOAD_FREQUENCY_IN_DAYS);\n let currentDay = monthUtils.currentDay();\n\n // We only want to try to upload every UPLOAD_FREQUENCY_IN_DAYS days\n if (lastUploaded && currentDay < threshold) {\n return;\n }\n\n // We only want to upload existing cloud files that are part of a\n // valid group\n if (!cloudFileId || !groupId) {\n return;\n }\n\n // Don't block on uploading\n upload().catch(err => {});\n}\n\nexport async function removeFile(fileId) {\n const [[, userToken]] = await asyncStorage.multiGet(['user-token']);\n\n await post(getServer().SYNC_SERVER + '/delete-user-file', {\n token: userToken,\n fileId\n });\n}\n\nexport async function listRemoteFiles() {\n let userToken = await asyncStorage.getItem('user-token');\n if (!userToken) {\n return null;\n }\n\n let res;\n try {\n res = await fetchJSON(getServer().SYNC_SERVER + '/list-user-files', {\n headers: {\n 'X-ACTUAL-TOKEN': userToken\n }\n });\n } catch (e) {\n console.log('Error', e);\n return null;\n }\n\n if (res.status === 'error') {\n return null;\n }\n\n return res.data.map(file => ({\n ...file,\n hasKey: encryption.hasKey(file.encryptKeyId)\n }));\n}\n\nexport async function download(fileId, replace) {\n let userToken = await asyncStorage.getItem('user-token');\n\n let buffer;\n try {\n buffer = await fetch(getServer().SYNC_SERVER + '/download-user-file', {\n headers: {\n 'X-ACTUAL-TOKEN': userToken,\n 'X-ACTUAL-FILE-ID': fileId\n }\n })\n .then(checkHTTPStatus)\n .then(res => {\n if (res.arrayBuffer) {\n return res.arrayBuffer().then(ab => Buffer.from(ab));\n }\n return res.buffer();\n });\n } catch (err) {\n console.log('Download failure', err);\n throw FileDownloadError('download-failure');\n }\n\n let res;\n try {\n res = await fetchJSON(getServer().SYNC_SERVER + '/get-user-file-info', {\n headers: {\n 'X-ACTUAL-TOKEN': userToken,\n 'X-ACTUAL-FILE-ID': fileId\n }\n });\n } catch (err) {\n throw FileDownloadError('internal', { fileId });\n }\n\n if (res.status !== 'ok') {\n throw FileDownloadError('internal', { fileId });\n }\n let fileData = res.data;\n\n // The download process checks if the server gave us decrypt\n // information. It is assumed that this key has already been loaded\n // in, which is done in a previous step\n if (fileData.encryptMeta) {\n try {\n buffer = await encryption.decrypt(buffer, fileData.encryptMeta);\n } catch (e) {\n throw FileDownloadError('decrypt-failure', {\n isMissingKey: e.message === 'missing-key'\n });\n }\n }\n\n return importBuffer(fileData, buffer, replace);\n}\n","import LRU from 'lru-cache';\nimport * as sqlite from '../../platform/server/sqlite';\nimport fs from '../../platform/server/fs';\nimport { sendMessages, batchMessages } from '../sync';\nimport { schema, schemaConfig } from '../aql/schema';\nimport {\n accountModel,\n categoryModel,\n categoryGroupModel,\n payeeModel,\n payeeRuleModel\n} from '../models';\nimport { groupById } from '../../shared/util';\nimport Timestamp, {\n makeClock,\n setClock,\n serializeClock,\n deserializeClock,\n makeClientId\n} from '../timestamp';\nimport {\n convertForInsert,\n convertForUpdate,\n convertFromSelect\n} from '../aql/schema-helpers';\nimport { shoveSortOrders, SORT_INCREMENT } from './sort';\n\nexport { toDateRepr, fromDateRepr } from '../models';\n\nconst uuid = require('../../platform/uuid');\n\nlet dbPath;\nlet db;\n\n// Util\n\nexport function getDatabasePath() {\n return dbPath;\n}\n\nexport async function openDatabase(id) {\n if (db) {\n await sqlite.closeDatabase(db);\n }\n\n dbPath = fs.join(fs.getBudgetDir(id), 'db.sqlite');\n setDatabase(await sqlite.openDatabase(dbPath));\n\n // await execQuery('PRAGMA journal_mode = WAL');\n}\n\nexport async function reopenDatabase() {\n await sqlite.closeDatabase(db);\n setDatabase(await sqlite.openDatabase(dbPath));\n}\n\nexport async function closeDatabase() {\n if (db) {\n await sqlite.closeDatabase(db);\n setDatabase(null);\n }\n}\n\nexport function setDatabase(db_) {\n db = db_;\n resetQueryCache();\n}\n\nexport function getDatabase() {\n return db;\n}\n\nexport async function loadClock() {\n let row = await first('SELECT * FROM messages_clock');\n if (row) {\n let clock = deserializeClock(row.clock);\n setClock(clock);\n } else {\n // No clock exists yet (first run of the app), so create a default\n // one.\n let timestamp = new Timestamp(0, 0, makeClientId());\n let clock = makeClock(timestamp);\n setClock(clock);\n\n await runQuery('INSERT INTO messages_clock (id, clock) VALUES (?, ?)', [\n 1,\n serializeClock(clock)\n ]);\n }\n}\n\n// Functions\n\nexport function runQuery(sql, params, fetchAll) {\n // const unrecord = perf.record('sqlite');\n const result = sqlite.runQuery(db, sql, params, fetchAll);\n // unrecord();\n return result;\n}\n\nexport function execQuery(sql) {\n sqlite.execQuery(db, sql);\n}\n\n// This manages an LRU cache of prepared query statements. This is\n// only needed in hot spots when you are running lots of queries.\nlet _queryCache = new LRU({ max: 100 });\nexport function cache(sql) {\n let cached = _queryCache.get(sql);\n if (cached) {\n return cached;\n }\n\n let prepared = sqlite.prepare(db, sql);\n _queryCache.set(sql, prepared);\n return prepared;\n}\n\nfunction resetQueryCache() {\n _queryCache = new LRU({ max: 100 });\n}\n\nexport function transaction(fn) {\n return sqlite.transaction(db, fn);\n}\n\nexport function asyncTransaction(fn) {\n return sqlite.asyncTransaction(db, fn);\n}\n\n// This function is marked as async because `runQuery` is no longer\n// async. We return a promise here until we've audited all the code to\n// make sure nothing calls `.then` on this.\nexport async function all(sql, params) {\n return runQuery(sql, params, true);\n}\n\nexport async function first(sql, params) {\n const arr = await runQuery(sql, params, true);\n return arr.length === 0 ? null : arr[0];\n}\n\n// The underlying sql system is now sync, but we can't update `first` yet\n// without auditing all uses of it\nexport function firstSync(sql, params) {\n const arr = runQuery(sql, params, true);\n return arr.length === 0 ? null : arr[0];\n}\n\n// This function is marked as async because `runQuery` is no longer\n// async. We return a promise here until we've audited all the code to\n// make sure nothing calls `.then` on this.\nexport async function run(sql, params) {\n return runQuery(sql, params);\n}\n\nexport async function select(table, id) {\n const rows = await runQuery(\n 'SELECT * FROM ' + table + ' WHERE id = ?',\n [id],\n true\n );\n return rows[0];\n}\n\nexport async function update(table, params) {\n let fields = Object.keys(params).filter(k => k !== 'id');\n\n if (params.id == null) {\n throw new Error('update: id is required');\n }\n\n await sendMessages(\n fields.map(k => {\n return {\n dataset: table,\n row: params.id,\n column: k,\n value: params[k],\n timestamp: Timestamp.send()\n };\n })\n );\n}\n\nexport async function insertWithUUID(table, row) {\n if (!row.id) {\n row = { ...row, id: uuid.v4Sync() };\n }\n\n await insert(table, row);\n\n // We can't rely on the return value of insert because if the\n // primary key is text, sqlite returns the internal row id which we\n // don't care about. We want to return the generated UUID.\n return row.id;\n}\n\nexport async function insert(table, row) {\n let fields = Object.keys(row).filter(k => k !== 'id');\n\n if (row.id == null) {\n throw new Error('insert: id is required');\n }\n\n await sendMessages(\n fields.map(k => {\n return {\n dataset: table,\n row: row.id,\n column: k,\n value: row[k],\n timestamp: Timestamp.send()\n };\n })\n );\n}\n\nexport async function delete_(table, id) {\n await sendMessages([\n {\n dataset: table,\n row: id,\n column: 'tombstone',\n value: 1,\n timestamp: Timestamp.send()\n }\n ]);\n}\n\nexport async function selectWithSchema(table, sql, params) {\n let rows = await runQuery(sql, params, true);\n return rows\n .map(row => convertFromSelect(schema, schemaConfig, table, row))\n .filter(Boolean);\n}\n\nexport async function selectFirstWithSchema(table, sql, params) {\n let rows = await selectWithSchema(table, sql, params);\n return rows.length > 0 ? rows[0] : null;\n}\n\nexport function insertWithSchema(table, row) {\n // Even though `insertWithUUID` does this, we need to do it here so\n // the schema validation passes\n if (!row.id) {\n row = { ...row, id: uuid.v4Sync() };\n }\n\n return insertWithUUID(\n table,\n convertForInsert(schema, schemaConfig, table, row)\n );\n}\n\nexport function updateWithSchema(table, fields) {\n return update(table, convertForUpdate(schema, schemaConfig, table, fields));\n}\n\n// Data-specific functions. Ideally this would be split up into\n// different files\n\nexport async function getCategories() {\n return all(`\n SELECT c.* FROM categories c\n LEFT JOIN category_groups cg ON c.cat_group = cg.id\n WHERE c.tombstone = 0\n ORDER BY cg.sort_order, cg.id, c.sort_order, c.id\n `);\n}\n\nexport async function getCategoriesGrouped() {\n const groups = await all(\n 'SELECT * FROM category_groups WHERE tombstone = 0 ORDER BY is_income, sort_order, id'\n );\n const rows = await all(`\n SELECT * FROM categories WHERE tombstone = 0\n ORDER BY sort_order, id\n `);\n\n return groups.map(group => {\n return {\n ...group,\n categories: rows.filter(row => row.cat_group === group.id)\n };\n });\n}\n\nexport async function insertCategoryGroup(group) {\n const lastGroup = await first(`\n SELECT sort_order FROM category_groups WHERE tombstone = 0 ORDER BY sort_order DESC, id DESC LIMIT 1\n `);\n const sort_order = (lastGroup ? lastGroup.sort_order : 0) + SORT_INCREMENT;\n\n group = {\n ...categoryGroupModel.validate(group),\n sort_order: sort_order\n };\n return insertWithUUID('category_groups', group);\n}\n\nexport function updateCategoryGroup(group) {\n group = categoryGroupModel.validate(group, { update: true });\n return update('category_groups', group);\n}\n\nexport async function moveCategoryGroup(id, targetId) {\n const groups = await all(\n `SELECT id, sort_order FROM category_groups WHERE tombstone = 0 ORDER BY sort_order, id`\n );\n\n const { updates, sort_order } = shoveSortOrders(groups, targetId);\n for (let info of updates) {\n await update('category_groups', info);\n }\n await update('category_groups', { id, sort_order });\n}\n\nexport async function deleteCategoryGroup(group, transferId) {\n const categories = await all('SELECT * FROM categories WHERE cat_group = ?', [\n group.id\n ]);\n\n // Delete all the categories within a group\n await Promise.all(categories.map(cat => deleteCategory(cat, transferId)));\n await delete_('category_groups', group.id);\n}\n\nexport async function insertCategory(category, { atEnd } = {}) {\n let sort_order;\n\n let id_;\n await batchMessages(async () => {\n if (atEnd) {\n const lastCat = await first(`\n SELECT sort_order FROM categories WHERE tombstone = 0 ORDER BY sort_order DESC, id DESC LIMIT 1\n `);\n sort_order = (lastCat ? lastCat.sort_order : 0) + SORT_INCREMENT;\n } else {\n // Unfortunately since we insert at the beginning, we need to shove\n // the sort orders to make sure there's room for it\n const categories = await all(\n `SELECT id, sort_order FROM categories WHERE cat_group = ? AND tombstone = 0 ORDER BY sort_order, id`,\n [category.cat_group]\n );\n\n const { updates, sort_order: order } = shoveSortOrders(\n categories,\n categories.length > 0 ? categories[0].id : null\n );\n for (let info of updates) {\n await update('categories', info);\n }\n sort_order = order;\n }\n\n category = {\n ...categoryModel.validate(category),\n sort_order: sort_order\n };\n\n const id = await insertWithUUID('categories', category);\n // Create an entry in the mapping table that points it to itself\n await insert('category_mapping', { id, transferId: id });\n id_ = id;\n });\n return id_;\n}\n\nexport function updateCategory(category) {\n category = categoryModel.validate(category, { update: true });\n return update('categories', category);\n}\n\nexport async function moveCategory(id, groupId, targetId) {\n if (!groupId) {\n throw new Error('moveCategory: groupId is required');\n }\n\n const categories = await all(\n `SELECT id, sort_order FROM categories WHERE cat_group = ? AND tombstone = 0 ORDER BY sort_order, id`,\n [groupId]\n );\n\n const { updates, sort_order } = shoveSortOrders(categories, targetId);\n for (let info of updates) {\n await update('categories', info);\n }\n await update('categories', { id, sort_order, cat_group: groupId });\n}\n\nexport async function deleteCategory(category, transferId) {\n if (transferId) {\n // We need to update all the deleted categories that currently\n // point to the one we're about to delete so they all are\n // \"forwarded\" to the new transferred category.\n const existingTransfers = await all(\n 'SELECT * FROM category_mapping WHERE transferId = ?',\n [category.id]\n );\n for (let mapping of existingTransfers) {\n await update('category_mapping', { id: mapping.id, transferId });\n }\n\n // Finally, map the category we're about to delete to the new one\n await update('category_mapping', { id: category.id, transferId });\n }\n\n return delete_('categories', category.id);\n}\n\nexport async function getPayee(id) {\n return first(`SELECT * FROM payees WHERE id = ?`, [id]);\n}\n\nexport async function insertPayee(payee) {\n payee = payeeModel.validate(payee);\n let id;\n await batchMessages(async () => {\n id = await insertWithUUID('payees', payee);\n await insert('payee_mapping', { id, targetId: id });\n });\n return id;\n}\n\nexport async function deletePayee(payee) {\n let { transfer_acct } = await first('SELECT * FROM payees WHERE id = ?', [\n payee.id\n ]);\n if (transfer_acct) {\n // You should never be able to delete transfer payees\n return;\n }\n\n // let mappings = await all('SELECT id FROM payee_mapping WHERE targetId = ?', [\n // payee.id\n // ]);\n // await Promise.all(\n // mappings.map(m => update('payee_mapping', { id: m.id, targetId: null }))\n // );\n\n let rules = await all('SELECT * FROM payee_rules WHERE payee_id = ?', [\n payee.id\n ]);\n await Promise.all(rules.map(rule => deletePayeeRule({ id: rule.id })));\n return delete_('payees', payee.id);\n}\n\nexport async function deleteTransferPayee(payee) {\n // This allows deleting transfer payees\n return delete_('payees', payee.id);\n}\n\nexport function updatePayee(payee) {\n payee = payeeModel.validate(payee, { update: true });\n return update('payees', payee);\n}\n\nexport async function mergePayees(target, ids) {\n // Load in payees so we can check some stuff\n let payees = groupById(await all('SELECT * FROM payees'));\n\n // Filter out any transfer payees\n if (payees[target].transfer_acct != null) {\n return;\n }\n ids = ids.filter(id => payees[id].transfer_acct == null);\n\n await batchMessages(async () => {\n await Promise.all(\n ids.map(async id => {\n let mappings = await all(\n 'SELECT id FROM payee_mapping WHERE targetId = ?',\n [id]\n );\n await Promise.all(\n mappings.map(m =>\n update('payee_mapping', { id: m.id, targetId: target })\n )\n );\n })\n );\n\n return Promise.all(\n ids.map(id =>\n Promise.all([\n update('payee_mapping', { id, targetId: target }),\n delete_('payees', id)\n ])\n )\n );\n });\n}\n\nexport function getPayees() {\n return all(`\n SELECT p.*, COALESCE(a.name, p.name) AS name FROM payees p\n LEFT JOIN accounts a ON (p.transfer_acct = a.id AND a.tombstone = 0)\n WHERE p.tombstone = 0 AND (p.transfer_acct IS NULL OR a.id IS NOT NULL)\n ORDER BY p.transfer_acct IS NULL DESC, p.name COLLATE NOCASE\n `);\n}\n\nexport async function getOrphanedPayees() {\n let rows = await all(`\n SELECT p.id FROM payees p\n LEFT JOIN payee_mapping pm ON pm.id = p.id\n LEFT JOIN v_transactions_internal_alive t ON t.payee = pm.targetId\n WHERE p.tombstone = 0 AND p.transfer_acct IS NULL AND t.id IS NULL\n `);\n return rows.map(row => row.id);\n}\n\nexport async function getPayeeByName(name) {\n return first(`SELECT * FROM payees WHERE LOWER(name) = ? AND tombstone = 0`, [\n name.toLowerCase()\n ]);\n}\n\nexport function insertPayeeRule(rule) {\n rule = payeeRuleModel.validate(rule);\n return insertWithUUID('payee_rules', rule);\n}\n\nexport function deletePayeeRule(rule) {\n return delete_('payee_rules', rule.id);\n}\n\nexport function updatePayeeRule(rule) {\n rule = payeeModel.validate(rule, { update: true });\n return update('payee_rules', rule);\n}\n\nexport function getPayeeRules(id) {\n return all(\n `SELECT pr.* FROM payee_rules pr\n LEFT JOIN payee_mapping pm ON pm.id = pr.payee_id\n WHERE pm.targetId = ? AND pr.tombstone = 0`,\n [id]\n );\n}\n\nexport function getAccounts() {\n return all(\n `SELECT a.*, b.name as bankName, b.id as bankId FROM accounts a\n LEFT JOIN banks b ON a.bank = b.id\n WHERE a.tombstone = 0\n ORDER BY sort_order, name`\n );\n}\n\nexport async function insertAccount(account) {\n // Default to checking. Makes it a lot easier for tests and is\n // generally harmless.\n if (account.type === undefined) {\n account = { ...account, type: 'checking' };\n }\n\n const accounts = await all(\n 'SELECT * FROM accounts WHERE offbudget = ? ORDER BY sort_order, name',\n [account.offbudget != null ? account.offbudget : 0]\n );\n\n // Don't pass a target in, it will default to appending at the end\n let { sort_order } = shoveSortOrders(accounts);\n\n account = accountModel.validate({ ...account, sort_order });\n return insertWithUUID('accounts', account);\n}\n\nexport function updateAccount(account) {\n account = accountModel.validate(account, { update: true });\n return update('accounts', account);\n}\n\nexport function deleteAccount(account) {\n return delete_('accounts', account.id);\n}\n\nexport async function moveAccount(id, targetId) {\n let account = await first('SELECT * FROM accounts WHERE id = ?', [id]);\n let accounts;\n if (account.closed) {\n accounts = await all(\n `SELECT id, sort_order FROM accounts WHERE closed = 1 ORDER BY sort_order, name`\n );\n } else {\n accounts = await all(\n `SELECT id, sort_order FROM accounts WHERE tombstone = 0 AND offbudget = ? ORDER BY sort_order, name`,\n [account.offbudget]\n );\n }\n\n const { updates, sort_order } = shoveSortOrders(accounts, targetId);\n await batchMessages(() => {\n for (let info of updates) {\n update('accounts', info);\n }\n update('accounts', { id, sort_order });\n });\n}\n\nexport async function getTransaction(id) {\n let rows = await selectWithSchema(\n 'transactions',\n 'SELECT * FROM v_transactions WHERE id = ?',\n [id]\n );\n return rows[0];\n}\n\nfunction _addFragmentForAccount(accountId, addWhere, options = {}) {\n let { showClosed = false, showOffbudget = true } = options;\n\n let fragment = addWhere ? ' WHERE (' : ' AND ';\n let params = [];\n\n if (accountId) {\n if (accountId === 'offbudget') {\n fragment += 'a.closed = 0 AND a.offbudget = 1 ';\n } else if (accountId === 'budgeted') {\n fragment += 'a.closed = 0 AND a.offbudget = 0 ';\n } else if (accountId === 'uncategorized') {\n fragment += `\n t.category IS NULL AND a.offbudget = 0 AND isParent = 0 AND (\n ta.offbudget IS NULL OR ta.offbudget = 1\n )\n `;\n } else {\n fragment += 'a.id = ? ';\n params.push(accountId);\n }\n } else {\n fragment += showClosed ? '1' : 'a.closed = 0';\n\n if (!showOffbudget) {\n fragment += ' AND a.offbudget = 0';\n }\n }\n\n return { fragment, params };\n}\n\nexport async function getTransactionsByDate(\n accountId,\n startDate,\n endDate,\n options = {}\n) {\n throw new Error('`getTransactionsByDate` is deprecated');\n}\n\nexport async function getTransactions(accountId, arg2) {\n if (arg2 !== undefined) {\n throw new Error(\n '`getTransactions` was given a second argument, it now only takes a single argument `accountId`'\n );\n }\n\n return selectWithSchema(\n 'transactions',\n 'SELECT * FROM v_transactions WHERE account = ?',\n [accountId]\n );\n}\n\nexport function insertTransaction(transaction) {\n return insertWithSchema('transactions', transaction);\n}\n\nexport function updateTransaction(transaction) {\n return updateWithSchema('transactions', transaction);\n}\n\nexport async function deleteTransaction(transaction) {\n return delete_('transactions', transaction.id);\n}\n","import * as db from './index';\nimport { addSyncListener } from '../sync/index';\n\n// This file keeps all the mappings in memory so we can access it\n// synchronously. This is primarily used in the rules system, but\n// there may be other uses in the future. You don't need to worry\n// about this generally; if you are querying transactions, ids are\n// transparently mapped for you. But if you are building something\n// that stores ids and later uses them, you need to remember to map\n// the ids.\n//\n// IMPORTANT: `loadMappings` must be called first before other modules\n// that listen for sync changes. This must be the first sync listener\n// to run in case other listeners use this mapping table; otherwise\n// they might see stale mappings.\n\nlet allMappings;\nlet unlistenSync;\n\nexport async function loadMappings() {\n // The mappings are separated into tables specific to the type of\n // data. But you know, we really could keep a global mapping table.\n let categories = (await db.all('SELECT * FROM category_mapping')).map(r => [\n r.id,\n r.transferId\n ]);\n let payees = (await db.all('SELECT * FROM payee_mapping')).map(r => [\n r.id,\n r.targetId\n ]);\n\n // All ids are unique, so we can just keep a global table of mappings\n allMappings = new Map(categories.concat(payees));\n\n if (unlistenSync) {\n unlistenSync();\n }\n unlistenSync = addSyncListener(onApplySync);\n}\n\nfunction onApplySync(oldValues, newValues) {\n newValues.forEach((items, table) => {\n if (table.indexOf('mapping') !== -1) {\n let field = table === 'category_mapping' ? 'transferId' : 'targetId';\n\n items.forEach(newValue => {\n allMappings.set(newValue.id, newValue[field]);\n });\n }\n });\n}\n\nexport function getMappings() {\n return allMappings;\n}\n\nexport function getMapping(id) {\n return allMappings.get(id) || null;\n}\n","export const SORT_INCREMENT = 16384;\n\nfunction midpoint(items, to) {\n const below = items[to - 1];\n const above = items[to];\n\n if (!below) {\n return above.sort_order / 2;\n } else if (!above) {\n return below.sort_order + SORT_INCREMENT;\n } else {\n return (below.sort_order + above.sort_order) / 2;\n }\n}\n\nexport function shoveSortOrders(items, targetId) {\n const to = items.findIndex(item => item.id === targetId);\n const target = items[to];\n const before = items[to - 1];\n let updates = [];\n\n // If no target is specified, append at the end\n if (!targetId || to === -1) {\n let order;\n if (items.length > 0) {\n // Add a new increment to whatever is the latest sort order\n order = items[items.length - 1].sort_order + SORT_INCREMENT;\n } else {\n // If no items exist, the default is to use the first increment\n order = SORT_INCREMENT;\n }\n\n return { updates, sort_order: order };\n } else {\n if (target.sort_order - (before ? before.sort_order : 0) <= 2) {\n let next = to;\n let order = (items[next].sort_order | 0) + SORT_INCREMENT;\n while (next < items.length) {\n // No need to update it if it's already greater than the current\n // order. This can happen because there may already be large\n // gaps\n if (order <= items[next].sort_order) {\n break;\n }\n\n updates.push({ id: items[next].id, sort_order: order });\n\n next++;\n order += SORT_INCREMENT;\n }\n }\n\n return { updates, sort_order: midpoint(items, to) };\n }\n}\n","export async function incrFetch(\n runQuery,\n terms,\n compare,\n makeQuery,\n params = []\n) {\n let pageCount = 500;\n let results = [];\n\n let fetchedIds = new Set();\n\n for (let i = 0; i < terms.length; i += pageCount) {\n let slice = terms.slice(i, i + pageCount).filter(id => !fetchedIds.has(id));\n if (slice.length > 0) {\n let filter = slice.map(id => compare(id)).join(' OR ');\n let query = makeQuery('(' + filter + ')');\n\n let rows = await runQuery(query, params, true);\n fetchedIds = new Set([...fetchedIds, ...slice]);\n results = results.concat(rows);\n }\n }\n\n return results;\n}\n\nexport function whereIn(ids, field) {\n let ids2 = [...new Set(ids)];\n let filter = `${field} IN (` + ids2.map(id => `'${id}'`).join(',') + ')';\n return filter;\n}\n","let crypto = require('crypto');\n\nlet ENCRYPTION_ALGORITHM = 'aes-256-gcm';\n\nexport async function sha256String(str) {\n return crypto\n .createHash('sha256')\n .update(str)\n .digest('base64');\n}\n\nexport function randomBytes(n) {\n return crypto.randomBytes(n);\n}\n\nexport function encrypt(masterKey, value) {\n let masterKeyBuffer = masterKey.getValue().raw;\n // let iv = createKeyBuffer({ numBytes: 12, secret: masterKeyBuffer });\n let iv = crypto.randomBytes(12);\n let cipher = crypto.createCipheriv(ENCRYPTION_ALGORITHM, masterKeyBuffer, iv);\n let encrypted = cipher.update(value);\n encrypted = Buffer.concat([encrypted, cipher.final()]);\n\n let authTag = cipher.getAuthTag();\n\n return {\n value: encrypted,\n meta: {\n keyId: masterKey.getId(),\n algorithm: ENCRYPTION_ALGORITHM,\n iv: iv.toString('base64'),\n authTag: authTag.toString('base64')\n }\n };\n}\n\nexport function decrypt(masterKey, encrypted, meta) {\n let masterKeyBuffer = masterKey.getValue().raw;\n let { algorithm, iv, authTag } = meta;\n iv = Buffer.from(iv, 'base64');\n\n authTag = Buffer.from(authTag, 'base64');\n\n let decipher = crypto.createDecipheriv(algorithm, masterKeyBuffer, iv);\n decipher.setAuthTag(authTag);\n\n let decrypted = decipher.update(encrypted);\n decrypted = Buffer.concat([decrypted, decipher.final()]);\n return decrypted;\n}\n\nexport function createKey({ secret, salt }) {\n let buffer = createKeyBuffer({ secret, salt });\n return {\n raw: buffer,\n base64: buffer.toString('base64')\n };\n}\n\nexport function importKey(str) {\n return {\n raw: Buffer.from(str, 'base64'),\n base64: str\n };\n}\n\n/**\n * Generates a Buffer of a desired byte length to be used as either an encryption key or an initialization vector.\n *\n * @private\n * @param {Integer} [numBytes = 32] - Optional, number of bytes to fill the Buffer with.\n * @param {String} [secret = <random bytes>] - Optional, a secret to use as a basis for the key generation algorithm.\n * @returns {Buffer}\n */\nfunction createKeyBuffer({ numBytes, secret, salt }) {\n return crypto.pbkdf2Sync(\n secret || crypto.randomBytes(128).toString('base64'),\n salt || crypto.randomBytes(32).toString('base64'),\n 10000,\n numBytes || 32,\n 'sha512'\n );\n}\n","import * as internals from './encryption-internals';\nlet uuid = require('../platform/uuid/index.electron.js');\n\n// A map of all possible master encryption keys to use, keyed by\n// unique id\nlet keys = {};\n\nclass Key {\n constructor({ id, value }) {\n this.id = id || uuid.v4Sync();\n }\n\n async createFromPassword({ password, salt }) {\n this.value = await internals.createKey({ secret: password, salt });\n }\n\n async createFromBase64(str) {\n this.value = await internals.importKey(str);\n }\n\n getId() {\n return this.id;\n }\n\n getValue() {\n return this.value;\n }\n\n serialize() {\n return {\n id: this.id,\n base64: this.value.base64\n };\n }\n}\n\nfunction getKey(keyId) {\n if (keyId == null || keys[keyId] == null) {\n throw new Error('missing-key');\n }\n return keys[keyId];\n}\n\nfunction hasKey(keyId) {\n return keyId in keys;\n}\n\nfunction encrypt(value, keyId) {\n return internals.encrypt(getKey(keyId), value);\n}\n\nfunction decrypt(encrypted, meta) {\n return internals.decrypt(getKey(meta.keyId), encrypted, meta);\n}\n\nfunction randomBytes(n) {\n return internals.randomBytes(n);\n}\n\nasync function loadKey(key) {\n let keyInstance;\n if (!(key instanceof Key)) {\n keyInstance = new Key({ id: key.id });\n await keyInstance.createFromBase64(key.base64);\n } else {\n keyInstance = key;\n }\n\n keys[keyInstance.getId()] = keyInstance;\n}\n\nfunction unloadKey(key) {\n delete keys[key.getId()];\n}\n\nfunction unloadAllKeys() {\n keys = {};\n}\n\nasync function createKey({ id, password, salt }) {\n let key = new Key({ id });\n await key.createFromPassword({ password, salt });\n return key;\n}\n\nexport default {\n decrypt,\n encrypt,\n randomBytes,\n createKey,\n loadKey,\n getKey,\n hasKey,\n unloadKey,\n unloadAllKeys\n};\n","// TODO: normalize error types\nexport class PostError extends Error {\n constructor(reason, meta) {\n super('PostError: ' + reason);\n this.type = 'PostError';\n this.reason = reason;\n this.meta = meta;\n }\n}\n\nexport class HTTPError extends Error {\n constructor(code, body) {\n super(`HTTPError: unsuccessful status code (${code}): ${body}`);\n this.statusCode = code;\n this.responseBody = body;\n }\n}\n\nexport class SyncError extends Error {\n constructor(reason, meta) {\n super('SyncError: ' + reason);\n this.reason = reason;\n this.meta = meta;\n }\n}\n\nexport class TransactionError extends Error {\n // eslint-disable-next-line\n constructor(message) {\n super(message);\n }\n}\n\nexport class RuleError extends Error {\n constructor(type, message) {\n super('RuleError: ' + message);\n this.type = type;\n }\n}\n\nexport function APIError(msg, meta) {\n return { type: 'APIError', message: msg, meta };\n}\n\nexport function FileDownloadError(reason, meta) {\n return { type: 'FileDownloadError', reason, meta };\n}\n\nexport function FileUploadError(reason, meta) {\n return { type: 'FileUploadError', reason, meta };\n}\n\nexport function isCodeError(err) {\n return err instanceof ReferenceError || err instanceof SyntaxError;\n}\n","import { createApp } from './app';\nconst connection = require('../platform/server/connection');\n\n// Main app\nconst app = createApp();\n\napp.events.on('sync', info => {\n connection.send('sync-event', info);\n});\n\nexport default app;\n","import './polyfills';\nimport { differenceInDays } from 'date-fns';\nimport asyncStorage from '../platform/server/asyncStorage';\nimport { captureException, captureBreadcrumb } from '../platform/exceptions';\nimport * as prefs from './prefs';\nimport fs from '../platform/server/fs';\nimport * as sqlite from '../platform/server/sqlite';\nimport logger from '../platform/server/log';\nimport Platform from './platform';\nimport * as db from './db';\nimport * as sheet from './sheet';\nimport { withUndo, clearUndo, undo, redo } from './undo';\nimport { updateVersion } from './update';\nimport { Condition, Action, rankRules } from './accounts/rules';\nimport * as rules from './accounts/transaction-rules';\nimport * as mappings from './db/mappings';\nimport { batchUpdateTransactions } from './accounts/transactions';\nimport { FIELD_TYPES as ruleFieldTypes } from '../shared/rules';\nimport {\n getAvailableBackups,\n loadBackup,\n makeBackup,\n startBackupService,\n stopBackupService\n} from './backups';\nimport { amountToInteger, stringToInteger } from '../shared/util';\nimport * as monthUtils from '../shared/months';\nimport { fromPlaidAccountType } from '../shared/accounts';\nimport * as budget from './budget/base';\nimport * as bankSync from './accounts/sync';\nimport * as link from './accounts/link';\nimport { uniqueFileName, idFromFileName } from './util/budget-name';\nimport { mutator, runHandler } from './mutators';\nimport * as timestamp from './timestamp';\nimport * as merkle from './merkle';\nimport {\n initialFullSync,\n fullSync,\n batchMessages,\n setSyncingMode,\n makeTestMessage,\n clearFullSyncTimeout,\n syncAndReceiveMessages,\n resetSync,\n repairSync\n} from './sync';\nimport * as syncMigrations from './sync/migrate';\nimport { getStartingBalancePayee } from './accounts/payees';\nimport { parseFile } from './accounts/parse-file';\nimport { exportToCSV, exportQueryToCSV } from './accounts/export-to-csv';\nimport { getServer, setServer } from './server-config';\nimport installAPI from './api';\nimport injectAPI from '@actual-app/api/injected';\nimport * as cloudStorage from './cloud-storage';\nimport encryption from './encryption';\nimport * as tracking from './tracking/events';\nimport { get, post } from './post';\nimport { APIError, TransactionError, PostError, RuleError } from './errors';\nimport { createTestBudget } from '../mocks/budget';\nimport { runQuery as aqlQuery } from './aql/schema/run-query';\nimport { Query } from '../shared/query';\nimport q from '../shared/query';\nimport app from './main-app';\n\n// Apps\nimport schedulesApp from './schedules/app';\nimport budgetApp from './budget/app';\nimport notesApp from './notes/app';\nimport toolsApp from './tools/app';\n\nconst YNAB4 = require('@actual-app/import-ynab4/importer');\nconst YNAB5 = require('@actual-app/import-ynab5/importer');\nconst uuid = require('../platform/uuid');\nconst connection = require('../platform/server/connection');\nconst { resolveName, unresolveName } = require('./spreadsheet/util');\nconst SyncPb = require('./sync/proto/sync_pb');\n\n// let indexeddb = require('../platform/server/indexeddb');\n\nlet VERSION;\nlet DEMO_BUDGET_ID = '_demo-budget';\nlet TEST_BUDGET_ID = '_test-budget';\nlet UNCONFIGURED_SERVER = 'https://not-configured/';\n\n// util\n\nfunction onSheetChange({ names }) {\n const nodes = names.map(name => {\n let node = sheet.get()._getNode(name);\n return { name: node.name, value: node.value };\n });\n connection.send('cells-changed', nodes);\n}\n\n// handlers\n\nexport let handlers = {};\n\nhandlers['undo'] = mutator(async function() {\n return undo();\n});\n\nhandlers['redo'] = mutator(function() {\n return redo();\n});\n\nhandlers['transactions-batch-update'] = mutator(async function({\n added,\n deleted,\n updated,\n learnCategories\n}) {\n return withUndo(async () => {\n let result = await batchUpdateTransactions({\n added,\n updated,\n deleted,\n learnCategories\n });\n\n // Return all data updates to the frontend\n return result.updated;\n });\n});\n\nhandlers['transaction-add'] = mutator(async function(transaction) {\n await handlers['transactions-batch-update']({ added: [transaction] });\n return {};\n});\n\nhandlers['transaction-update'] = mutator(async function(transaction) {\n await handlers['transactions-batch-update']({ updated: [transaction] });\n return {};\n});\n\nhandlers['transaction-delete'] = mutator(async function(transaction) {\n await handlers['transactions-batch-update']({ deleted: [transaction] });\n return {};\n});\n\nhandlers['transactions-filter'] = async function({\n term,\n accountId,\n latestDate,\n count,\n notPaged,\n options = {}\n}) {\n return db.getTransactions(\n term,\n accountId,\n latestDate,\n notPaged ? null : count == null ? undefined : count,\n options\n );\n};\n\nhandlers['transactions-parse-file'] = async function({ filepath, options }) {\n return parseFile(filepath, options);\n};\n\nhandlers['transactions-export'] = async function({\n transactions,\n accounts,\n categoryGroups,\n payees\n}) {\n return exportToCSV(transactions, accounts, categoryGroups, payees);\n};\n\nhandlers['transactions-export-query'] = async function({ query: queryState }) {\n return exportQueryToCSV(new Query(queryState));\n};\n\nhandlers['get-categories'] = async function() {\n return {\n grouped: await db.getCategoriesGrouped(),\n list: await db.getCategories()\n };\n};\n\nhandlers['get-earliest-transaction'] = async function() {\n let { data } = await aqlQuery(\n q('transactions')\n .options({ splits: 'none' })\n .orderBy({ date: 'asc' })\n .select('*')\n .limit(1)\n );\n return data[0] || null;\n};\n\nhandlers['get-budget-bounds'] = async function() {\n return budget.createAllBudgets();\n};\n\nhandlers['rollover-budget-month'] = async function({ month }) {\n let groups = await db.getCategoriesGrouped();\n let sheetName = monthUtils.sheetForMonth(month);\n\n function value(name) {\n let v = sheet.getCellValue(sheetName, name);\n return { value: v === '' ? 0 : v, name: resolveName(sheetName, name) };\n }\n\n let values = [\n value('available-funds'),\n value('last-month-overspent'),\n value('buffered'),\n value('total-budgeted'),\n value('to-budget'),\n\n value('from-last-month'),\n value('total-income'),\n value('total-spent'),\n value('total-leftover')\n ];\n\n for (let group of groups) {\n if (group.is_income) {\n values.push(value('total-income'));\n\n for (let cat of group.categories) {\n values.push(value(`sum-amount-${cat.id}`));\n }\n } else {\n values = values.concat([\n value(`group-budget-${group.id}`),\n value(`group-sum-amount-${group.id}`),\n value(`group-leftover-${group.id}`)\n ]);\n\n for (let cat of group.categories) {\n values = values.concat([\n value(`budget-${cat.id}`),\n value(`sum-amount-${cat.id}`),\n value(`leftover-${cat.id}`),\n value(`carryover-${cat.id}`)\n ]);\n }\n }\n }\n\n return values;\n};\n\nhandlers['report-budget-month'] = async function({ month }) {\n let groups = await db.getCategoriesGrouped();\n let sheetName = monthUtils.sheetForMonth(month);\n\n function value(name) {\n let v = sheet.getCellValue(sheetName, name);\n return { value: v === '' ? 0 : v, name: resolveName(sheetName, name) };\n }\n\n let values = [\n value('total-budgeted'),\n value('total-budget-income'),\n value('total-saved'),\n value('total-income'),\n value('total-spent'),\n value('real-saved'),\n value('total-leftover')\n ];\n\n for (let group of groups) {\n values = values.concat([\n value(`group-budget-${group.id}`),\n value(`group-sum-amount-${group.id}`),\n value(`group-leftover-${group.id}`)\n ]);\n\n for (let cat of group.categories) {\n values = values.concat([\n value(`budget-${cat.id}`),\n value(`sum-amount-${cat.id}`),\n value(`leftover-${cat.id}`)\n ]);\n\n if (!group.is_income) {\n values.push(value(`carryover-${cat.id}`));\n }\n }\n }\n\n return values;\n};\n\nhandlers['budget-set-type'] = async function({ type }) {\n if (type !== 'rollover' && type !== 'report') {\n throw new Error('Invalid budget type: ' + type);\n }\n\n // It's already the same; don't do anything\n if (type === prefs.getPrefs().budgetType) {\n return;\n }\n\n // Save prefs\n return prefs.savePrefs({ budgetType: type });\n};\n\nhandlers['category-create'] = mutator(async function({\n name,\n groupId,\n isIncome\n}) {\n return withUndo(async () => {\n if (!groupId) {\n throw APIError('Creating a category: groupId is required');\n }\n\n return db.insertCategory({\n name,\n cat_group: groupId,\n is_income: isIncome ? 1 : 0\n });\n });\n});\n\nhandlers['category-update'] = mutator(async function(category) {\n return withUndo(async () => {\n try {\n await db.updateCategory(category);\n } catch (e) {\n if (e.message.toLowerCase().includes('unique constraint')) {\n return { error: { type: 'category-exists' } };\n }\n throw e;\n }\n return {};\n });\n});\n\nhandlers['category-move'] = mutator(async function({ id, groupId, targetId }) {\n return withUndo(async () => {\n await batchMessages(async () => {\n await db.moveCategory(id, groupId, targetId);\n });\n return 'ok';\n });\n});\n\nhandlers['category-delete'] = mutator(async function({ id, transferId }) {\n return withUndo(async () => {\n let result = {};\n await batchMessages(async () => {\n let row = await db.first(\n 'SELECT is_income FROM categories WHERE id = ?',\n [id]\n );\n if (!row) {\n result = { error: 'no-categories' };\n return;\n }\n\n let transfer =\n transferId &&\n (await db.first('SELECT is_income FROM categories WHERE id = ?', [\n transferId\n ]));\n\n if (!row || (transferId && !transfer)) {\n result = { error: 'no-categories' };\n return;\n } else if (transferId && row.is_income !== transfer.is_income) {\n result = { error: 'category-type' };\n return;\n }\n\n // Update spreadsheet values if it's an expense category\n // TODO: We should do this for income too if it's a reflect budget\n if (row.is_income === 0) {\n if (transferId) {\n await budget.doTransfer([id], transferId);\n }\n }\n\n await db.deleteCategory({ id }, transferId);\n });\n\n return result;\n });\n});\n\nhandlers['category-group-create'] = mutator(async function({ name, isIncome }) {\n return withUndo(async () => {\n return db.insertCategoryGroup({\n name,\n is_income: isIncome ? 1 : 0\n });\n });\n});\n\nhandlers['category-group-update'] = mutator(async function(group) {\n return withUndo(async () => {\n return db.updateCategoryGroup(group);\n });\n});\n\nhandlers['category-group-move'] = mutator(async function({ id, targetId }) {\n return withUndo(async () => {\n await batchMessages(async () => {\n await db.moveCategoryGroup(id, targetId);\n });\n return 'ok';\n });\n});\n\nhandlers['category-group-delete'] = mutator(async function({ id, transferId }) {\n return withUndo(async () => {\n const groupCategories = await db.all(\n 'SELECT id FROM categories WHERE cat_group = ? AND tombstone = 0',\n [id]\n );\n\n return batchMessages(async () => {\n if (transferId) {\n await budget.doTransfer(groupCategories.map(c => c.id), transferId);\n }\n await db.deleteCategoryGroup({ id }, transferId);\n });\n });\n});\n\nhandlers['must-category-transfer'] = async function({ id }) {\n const res = await db.runQuery(\n `SELECT count(t.id) as count FROM transactions t\n LEFT JOIN category_mapping cm ON cm.id = t.category\n WHERE cm.transferId = ? AND t.tombstone = 0`,\n [id],\n true\n );\n\n // If there are transactions with this category, return early since\n // we already know it needs to be tranferred\n if (res[0].count !== 0) {\n return true;\n }\n\n // If there are any non-zero budget values, also force the user to\n // transfer the category.\n return [...sheet.get().meta().createdMonths].some(month => {\n const sheetName = monthUtils.sheetForMonth(month);\n const value = sheet.get().getCellValue(sheetName, 'budget-' + id);\n\n return value !== 0;\n });\n};\n\nhandlers['payee-create'] = mutator(async function({ name }) {\n return withUndo(async () => {\n return db.insertPayee({ name });\n });\n});\n\nhandlers['payees-get'] = async function() {\n return db.getPayees();\n};\n\nhandlers['payees-get-rule-counts'] = async function() {\n let payeeCounts = {};\n let allRules = rules.getRules();\n\n rules.iterateIds(rules.getRules(), 'payee', (rule, id) => {\n if (payeeCounts[id] == null) {\n payeeCounts[id] = 0;\n }\n payeeCounts[id]++;\n });\n\n return payeeCounts;\n};\n\nhandlers['payees-merge'] = mutator(async function({ targetId, mergeIds }) {\n return withUndo(\n async () => {\n return db.mergePayees(targetId, mergeIds);\n },\n { targetId, mergeIds }\n );\n});\n\nhandlers['payees-batch-change'] = mutator(async function({\n added,\n deleted,\n updated\n}) {\n return withUndo(async () => {\n return batchMessages(async () => {\n if (deleted) {\n await Promise.all(deleted.map(p => db.deletePayee(p)));\n }\n\n if (added) {\n await Promise.all(added.map(p => db.insertPayee(p)));\n }\n\n if (updated) {\n await Promise.all(updated.map(p => db.updatePayee(p)));\n }\n });\n });\n});\n\nhandlers['payees-check-orphaned'] = async function({ ids }) {\n let orphaned = new Set(await db.getOrphanedPayees());\n return ids.filter(id => orphaned.has(id));\n};\n\nhandlers['payees-get-rules'] = async function({ id }) {\n return rules.getRulesForPayee(id).map(rule => rule.serialize());\n};\n\nhandlers['payees-delete-rule'] = mutator(async function({ id, payee_id }) {\n return withUndo(\n async () => {\n return await db.deletePayeeRule({ id });\n },\n { payeeId: payee_id }\n );\n});\n\nhandlers['payees-update-rule'] = mutator(async function(rule) {\n return withUndo(\n async () => {\n return await db.updatePayeeRule(rule);\n },\n { payeeId: rule.payee_id }\n );\n});\n\nhandlers['payees-add-rule'] = mutator(async function(rule) {\n return withUndo(\n async () => {\n let id = await db.insertPayeeRule(rule);\n return { ...rule, id };\n },\n { payeeId: rule.payee_id }\n );\n});\n\nfunction validateRule(rule) {\n // Returns an array of errors, the array is the same link as the\n // passed-in `array`, or null if there are no errors\n function runValidation(array, validate) {\n let result = array.map(item => {\n try {\n validate(item);\n } catch (e) {\n if (e instanceof RuleError) {\n console.warn('Invalid rule', e);\n return e.type;\n }\n throw e;\n }\n return null;\n });\n\n return result.some(Boolean) ? result : null;\n }\n\n let conditionErrors = runValidation(\n rule.conditions,\n cond =>\n new Condition(\n cond.op,\n cond.field,\n cond.value,\n cond.options,\n ruleFieldTypes\n )\n );\n\n let actionErrors = runValidation(\n rule.actions,\n action =>\n new Action(\n action.op,\n action.field,\n action.value,\n action.options,\n ruleFieldTypes\n )\n );\n\n if (conditionErrors || actionErrors) {\n return {\n conditionErrors,\n actionErrors\n };\n }\n\n return null;\n}\n\nhandlers['rule-validate'] = async function(rule) {\n let error = validateRule(rule);\n return { error };\n};\n\nhandlers['rule-add'] = mutator(async function(rule) {\n let error = validateRule(rule);\n if (error) {\n return { error };\n }\n\n let id = await rules.insertRule(rule);\n return { id };\n});\n\nhandlers['rule-update'] = mutator(async function(rule) {\n let error = validateRule(rule);\n if (error) {\n return { error };\n }\n\n await rules.updateRule(rule);\n return {};\n});\n\nhandlers['rule-delete'] = mutator(async function(rule) {\n return rules.deleteRule(rule);\n});\n\nhandlers['rule-delete-all'] = mutator(async function(ids) {\n let someDeletionsFailed = false;\n\n await batchMessages(async () => {\n for (let id of ids) {\n let res = await rules.deleteRule({ id });\n if (res === false) {\n someDeletionsFailed = true;\n }\n }\n });\n\n return { someDeletionsFailed };\n});\n\nhandlers['rule-apply-actions'] = mutator(async function({\n transactionIds,\n actions\n}) {\n return rules.applyActions(transactionIds, actions, handlers);\n});\n\nhandlers['rule-add-payee-rename'] = mutator(async function({ fromNames, to }) {\n return rules.updatePayeeRenameRule(fromNames, to);\n});\n\nhandlers['rules-get'] = async function() {\n return rankRules(rules.getRules()).map(rule => rule.serialize());\n};\n\nhandlers['rule-get'] = async function({ id }) {\n let rule = rules.getRules().find(rule => rule.id === id);\n return rule ? rule.serialize() : null;\n};\n\nhandlers['rules-run'] = async function({ transaction }) {\n return rules.runRules(transaction);\n};\n\nhandlers['rules-migrate'] = async function() {\n await rules.migrateOldRules();\n};\n\nhandlers['make-filters-from-conditions'] = async function({ conditions }) {\n return rules.conditionsToAQL(conditions);\n};\n\nhandlers['getCell'] = async function({ sheetName, name }) {\n // Fields is no longer used - hardcode\n let fields = ['name', 'value'];\n let node = sheet.get()._getNode(resolveName(sheetName, name));\n if (fields) {\n let res = {};\n fields.forEach(field => {\n if (field === 'run') {\n res[field] = node._run ? node._run.toString() : null;\n } else {\n res[field] = node[field];\n }\n });\n return res;\n } else {\n return node;\n }\n};\n\nhandlers['getCells'] = async function({ names }) {\n return names.map(name => ({ value: sheet.get()._getNode(name).value }));\n};\n\nhandlers['getCellNamesInSheet'] = async function({ sheetName }) {\n let names = [];\n for (let name of sheet\n .get()\n .getNodes()\n .keys()) {\n let { sheet: nodeSheet, name: nodeName } = unresolveName(name);\n if (nodeSheet === sheetName) {\n names.push(nodeName);\n }\n }\n return names;\n};\n\nhandlers['debugCell'] = async function({ sheetName, name }) {\n let node = sheet.get().getNode(resolveName(sheetName, name));\n return {\n ...node,\n _run: node._run && node._run.toString()\n };\n};\n\nhandlers['create-query'] = async function({ sheetName, name, query }) {\n // Always run it regardless of cache. We don't know anything has changed\n // between the cache value being saved and now\n sheet.get().createQuery(sheetName, name, query);\n return 'ok';\n};\n\nhandlers['query'] = async function(query) {\n if (query.table == null) {\n throw new Error('query has no table, did you forgot to call `.serialize`?');\n }\n\n return aqlQuery(query);\n};\n\nhandlers['bank-delete'] = async function({ id }) {\n const accts = await db.runQuery(\n 'SELECT * FROM accounts WHERE bank = ?',\n [id],\n true\n );\n\n await db.delete_('banks', id);\n await Promise.all(\n accts.map(async acct => {\n // TODO: This will not sync across devices because we are bypassing\n // the \"recorded\" functions\n await db.runQuery('DELETE FROM transactions WHERE acct = ?', [acct.id]);\n await db.delete_('accounts', acct.id);\n })\n );\n return 'ok';\n};\n\nhandlers['account-update'] = mutator(async function({ id, name }) {\n return withUndo(async () => {\n await db.update('accounts', { id, name });\n return {};\n });\n});\n\nhandlers['accounts-get'] = async function() {\n return db.getAccounts();\n};\n\nhandlers['account-properties'] = async function({ id }) {\n const { balance } = await db.first(\n 'SELECT sum(amount) as balance FROM transactions WHERE acct = ? AND isParent = 0 AND tombstone = 0',\n [id]\n );\n const { count } = await db.first(\n 'SELECT count(id) as count FROM transactions WHERE acct = ? AND tombstone = 0',\n [id]\n );\n\n return { balance: balance || 0, numTransactions: count };\n};\n\nhandlers['accounts-link'] = async function({\n institution,\n publicToken,\n accountId,\n upgradingId\n}) {\n let bankId = await link.handoffPublicToken(institution, publicToken);\n\n let [[, userId], [, userKey]] = await asyncStorage.multiGet([\n 'user-id',\n 'user-key'\n ]);\n\n // Get all the available accounts and find the selected one\n let accounts = await bankSync.getAccounts(userId, userKey, bankId);\n let account = accounts.find(acct => acct.account_id === accountId);\n\n await db.update('accounts', {\n id: upgradingId,\n account_id: account.account_id,\n official_name: account.official_name,\n type: fromPlaidAccountType(account.type),\n balance_current: amountToInteger(account.balances.current),\n balance_available: amountToInteger(account.balances.available),\n balance_limit: amountToInteger(account.balances.limit),\n mask: account.mask,\n bank: bankId\n });\n\n await bankSync.syncAccount(\n userId,\n userKey,\n upgradingId,\n account.account_id,\n bankId\n );\n\n connection.send('sync-event', {\n type: 'success',\n tables: ['transactions']\n });\n\n return 'ok';\n};\n\nhandlers['accounts-connect'] = async function({\n institution,\n publicToken,\n accountIds,\n offbudgetIds\n}) {\n let bankId = await link.handoffPublicToken(institution, publicToken);\n let ids = await link.addAccounts(bankId, accountIds, offbudgetIds);\n return ids;\n};\n\nhandlers['account-create'] = mutator(async function({\n name,\n type,\n balance,\n offBudget,\n closed\n}) {\n return withUndo(async () => {\n const id = await db.insertAccount({\n name,\n type,\n offbudget: offBudget ? 1 : 0,\n closed: closed ? 1 : 0\n });\n\n await db.insertPayee({\n name: '',\n transfer_acct: id\n });\n\n if (balance != null) {\n let payee = await getStartingBalancePayee();\n\n await db.insertTransaction({\n account: id,\n amount: amountToInteger(balance),\n category: offBudget ? null : payee.category,\n payee: payee.id,\n date: monthUtils.currentDay(),\n cleared: true,\n starting_balance_flag: true\n });\n }\n\n return id;\n });\n});\n\nhandlers['account-close'] = mutator(async function({\n id,\n transferAccountId,\n categoryId,\n forced\n}) {\n // Unlink the account if it's linked. This makes sure to remove it\n // from Plaid. (This should not be undo-able, as it mutates the\n // remote server and the user will have to link the account again)\n await handlers['account-unlink']({ id });\n\n return withUndo(async () => {\n let account = await db.first(\n 'SELECT * FROM accounts WHERE id = ? AND tombstone = 0',\n [id]\n );\n\n // Do nothing if the account doesn't exist or it's already been\n // closed\n if (!account || account.closed === 1) {\n return;\n }\n\n const { balance, numTransactions } = await handlers['account-properties']({\n id\n });\n\n // If there are no transactions, we can simply delete the account\n if (numTransactions === 0) {\n await db.deleteAccount({ id });\n } else if (forced) {\n let rows = await db.runQuery(\n 'SELECT id, transfer_id FROM v_transactions WHERE account = ?',\n [id],\n true\n );\n\n let { id: payeeId } = await db.first(\n 'SELECT id FROM payees WHERE transfer_acct = ?',\n [id]\n );\n\n await batchMessages(() => {\n // TODO: what this should really do is send a special message that\n // automatically marks the tombstone value for all transactions\n // within an account... or something? This is problematic\n // because another client could easily add new data that\n // should be marked as deleted.\n\n rows.forEach(row => {\n if (row.transfer_id) {\n db.updateTransaction({\n id: row.transfer_id,\n payee: null,\n transfer_id: null\n });\n }\n\n db.deleteTransaction({ id: row.id });\n });\n\n db.deleteAccount({ id });\n db.deleteTransferPayee({ id: payeeId });\n });\n } else {\n if (balance !== 0 && transferAccountId == null) {\n throw APIError('balance is non-zero: transferAccountId is required');\n }\n\n await db.update('accounts', { id, closed: 1 });\n\n // If there is a balance we need to transfer it to the specified\n // account (and possibly categorize it)\n if (balance !== 0) {\n let { id: payeeId } = await db.first(\n 'SELECT id FROM payees WHERE transfer_acct = ?',\n [transferAccountId]\n );\n\n await handlers['transaction-add']({\n id: uuid.v4Sync(),\n payee: payeeId,\n amount: -balance,\n account: id,\n date: monthUtils.currentDay(),\n notes: 'Closing account',\n category: categoryId || null\n });\n }\n }\n });\n});\n\nhandlers['account-reopen'] = mutator(async function({ id }) {\n return withUndo(async () => {\n await db.update('accounts', { id, closed: 0 });\n });\n});\n\nhandlers['account-move'] = mutator(async function({ id, targetId }) {\n return withUndo(async () => {\n await db.moveAccount(id, targetId);\n });\n});\n\nlet stopPolling = false;\n\nhandlers['poll-web-token'] = async function({ token }) {\n let [[, userId], [, key]] = await asyncStorage.multiGet([\n 'user-id',\n 'user-key'\n ]);\n\n let startTime = Date.now();\n stopPolling = false;\n\n async function getData(cb) {\n if (stopPolling) {\n return;\n }\n\n if (Date.now() - startTime >= 1000 * 60 * 10) {\n cb('timeout');\n return;\n }\n\n let data = await post(\n getServer().PLAID_SERVER + '/get-web-token-contents',\n {\n userId,\n key,\n token\n }\n );\n\n if (data) {\n if (data.error) {\n cb('unknown');\n } else {\n cb(null, data);\n }\n } else {\n setTimeout(() => getData(cb), 3000);\n }\n }\n\n return new Promise(resolve => {\n getData((error, data) => {\n if (error) {\n resolve({ error });\n } else {\n resolve({ data });\n }\n });\n });\n};\n\nhandlers['poll-web-token-stop'] = async function() {\n stopPolling = true;\n return 'ok';\n};\n\nhandlers['accounts-sync'] = async function({ id }) {\n let [[, userId], [, userKey]] = await asyncStorage.multiGet([\n 'user-id',\n 'user-key'\n ]);\n let accounts = await db.runQuery(\n `SELECT a.*, b.id as bankId FROM accounts a\n LEFT JOIN banks b ON a.bank = b.id\n WHERE a.tombstone = 0 AND a.closed = 0`,\n [],\n true\n );\n\n if (id) {\n accounts = accounts.filter(acct => acct.id === id);\n }\n\n let errors = [];\n let newTransactions = [];\n let matchedTransactions = [];\n let updatedAccounts = [];\n\n let { groupId } = prefs.getPrefs();\n\n for (var i = 0; i < accounts.length; i++) {\n const acct = accounts[i];\n if (acct.bankId) {\n try {\n const res = await bankSync.syncAccount(\n userId,\n userKey,\n acct.id,\n acct.account_id,\n acct.bankId\n );\n let { added, updated } = res;\n\n newTransactions = newTransactions.concat(added);\n matchedTransactions = matchedTransactions.concat(updated);\n\n if (added.length > 0 || updated.length > 0) {\n updatedAccounts = updatedAccounts.concat(acct.id);\n }\n } catch (err) {\n if (err.type === 'BankSyncError') {\n errors.push({\n type: 'SyncError',\n accountId: acct.id,\n message: 'Failed syncing account \"' + acct.name + '\".',\n category: err.category,\n code: err.code\n });\n } else if (err instanceof PostError && err.reason !== 'internal') {\n errors.push({\n accountId: acct.id,\n message: `Account \"${\n acct.name\n }\" is not linked properly. Please link it again`\n });\n } else {\n errors.push({\n accountId: acct.id,\n message:\n 'There was an internal error. Please email help@actualbudget.com for support.',\n internal: err.stack\n });\n\n err.message = 'Failed syncing account: ' + err.message;\n\n captureException(err);\n }\n }\n }\n }\n\n if (updatedAccounts.length > 0) {\n connection.send('sync-event', {\n type: 'success',\n tables: ['transactions']\n });\n }\n\n return { errors, newTransactions, matchedTransactions, updatedAccounts };\n};\n\nhandlers['transactions-import'] = mutator(function({\n accountId,\n transactions\n}) {\n return withUndo(async () => {\n if (typeof accountId !== 'string') {\n throw APIError('transactions-import: accountId must be an id');\n }\n\n try {\n return await bankSync.reconcileTransactions(accountId, transactions);\n } catch (err) {\n if (err instanceof TransactionError) {\n return { errors: [{ message: err.message }], added: [], updated: [] };\n }\n\n throw err;\n }\n });\n});\n\nhandlers['account-unlink'] = mutator(async function({ id }) {\n let { bank: bankId } = await db.first(\n 'SELECT bank FROM accounts WHERE id = ?',\n [id]\n );\n\n if (!bankId) {\n return 'ok';\n }\n\n await db.updateAccount({\n id,\n account_id: null,\n bank: null,\n balance_current: null,\n balance_available: null,\n balance_limit: null\n });\n\n let { count } = await db.first(\n 'SELECT COUNT(*) as count FROM accounts WHERE bank = ?',\n [bankId]\n );\n\n if (count === 0) {\n // No more accounts are associated with this bank. We can remove\n // it from Plaid.\n\n let [[, userId], [, key]] = await asyncStorage.multiGet([\n 'user-id',\n 'user-key'\n ]);\n\n await post(getServer().PLAID_SERVER + '/remove-access-token', {\n userId,\n key,\n item_id: bankId\n });\n }\n\n return 'ok';\n});\n\nhandlers['make-plaid-public-token'] = async function({ bankId }) {\n let [[, userId], [, userKey]] = await asyncStorage.multiGet([\n 'user-id',\n 'user-key'\n ]);\n\n let data = await post(getServer().PLAID_SERVER + '/make-public-token', {\n userId: userId,\n key: userKey,\n item_id: '' + bankId\n });\n\n if (data.error_code) {\n return { error: '', code: data.error_code, type: data.error_type };\n }\n\n return { linkToken: data.link_token };\n};\n\nhandlers['save-global-prefs'] = async function(prefs) {\n if ('maxMonths' in prefs) {\n await asyncStorage.setItem('max-months', '' + prefs.maxMonths);\n }\n if ('trackUsage' in prefs) {\n tracking.toggle(prefs.trackUsage);\n await asyncStorage.setItem('track-usage', '' + prefs.trackUsage);\n }\n if ('autoUpdate' in prefs) {\n await asyncStorage.setItem('auto-update', '' + prefs.autoUpdate);\n process.send({ type: 'shouldAutoUpdate', flag: prefs.autoUpdate });\n }\n if ('documentDir' in prefs) {\n if (await fs.exists(prefs.documentDir)) {\n await asyncStorage.setItem('document-dir', prefs.documentDir);\n }\n }\n if ('floatingSidebar' in prefs) {\n await asyncStorage.setItem('floating-sidebar', '' + prefs.floatingSidebar);\n }\n return 'ok';\n};\n\nhandlers['load-global-prefs'] = async function() {\n let [\n [, floatingSidebar],\n [, seenTutorial],\n [, maxMonths],\n [, trackUsage],\n [, autoUpdate],\n [, documentDir],\n [, encryptKey]\n ] = await asyncStorage.multiGet([\n 'floating-sidebar',\n 'seen-tutorial',\n 'max-months',\n 'track-usage',\n 'auto-update',\n 'document-dir',\n 'encrypt-key'\n ]);\n return {\n floatingSidebar: floatingSidebar === 'true' ? true : false,\n seenTutorial: seenTutorial === 'true' ? true : false,\n maxMonths: stringToInteger(maxMonths || ''),\n // Default to true\n trackUsage: trackUsage == null || trackUsage === 'true' ? true : false,\n autoUpdate: autoUpdate == null || autoUpdate === 'true' ? true : false,\n documentDir: documentDir || getDefaultDocumentDir(),\n keyId: encryptKey && JSON.parse(encryptKey).id\n };\n};\n\nhandlers['save-prefs'] = async function(prefsToSet) {\n let { cloudFileId } = prefs.getPrefs();\n\n // Need to sync the budget name on the server as well\n if (prefsToSet.budgetName && cloudFileId) {\n let userToken = await asyncStorage.getItem('user-token');\n\n await post(getServer().SYNC_SERVER + '/update-user-filename', {\n token: userToken,\n fileId: cloudFileId,\n name: prefsToSet.budgetName\n });\n }\n\n await prefs.savePrefs(prefsToSet);\n return 'ok';\n};\n\nhandlers['load-prefs'] = async function() {\n return prefs.getPrefs();\n};\n\nhandlers['sync-reset'] = async function() {\n return await resetSync();\n};\n\nhandlers['sync-repair'] = async function() {\n await repairSync();\n};\n\n// A user can only enable/change their key with the file loaded. This\n// will change in the future: during onboarding the user should be\n// able to enable encryption. (Imagine if they are importing data from\n// another source, they should be able to encrypt first)\nhandlers['key-make'] = async function({ password }) {\n if (!prefs.getPrefs()) {\n throw new Error('user-set-key must be called with file loaded');\n }\n\n let cloudFileId = prefs.getPrefs().cloudFileId;\n\n let salt = encryption.randomBytes(32).toString('base64');\n let id = uuid.v4Sync();\n let key = await encryption.createKey({ id, password, salt });\n\n // Load the key\n await encryption.loadKey(key);\n\n // Make some test data to use if the key is valid or not\n let testContent = await makeTestMessage(key.getId());\n\n // Changing your key necessitates a sync reset as well. This will\n // clear all existing encrypted data from the server so you won't\n // have a mix of data encrypted with different keys.\n return await resetSync({\n key,\n salt,\n testContent: JSON.stringify({\n ...testContent,\n value: testContent.value.toString('base64')\n })\n });\n};\n\n// This can be called both while a file is already loaded or not. This\n// will see if a key is valid and if so save it off.\nhandlers['key-test'] = async function({ fileId, password }) {\n let userToken = await asyncStorage.getItem('user-token');\n\n if (fileId == null) {\n fileId = prefs.getPrefs().cloudFileId;\n }\n\n let res;\n try {\n res = await post(getServer().SYNC_SERVER + '/user-get-key', {\n token: userToken,\n fileId\n });\n } catch (e) {\n console.log(e);\n return { error: { reason: 'network' } };\n }\n\n let { id, salt, test } = res;\n\n if (test == null) {\n return { error: { reason: 'old-key-style' } };\n }\n\n test = JSON.parse(test);\n\n let key = await encryption.createKey({ id, password, salt });\n encryption.loadKey(key);\n\n try {\n await encryption.decrypt(Buffer.from(test.value, 'base64'), test.meta);\n } catch (e) {\n console.log(e);\n\n // Unload the key, it's invalid\n encryption.unloadKey(key);\n return { error: { reason: 'decrypt-failure' } };\n }\n\n // Persist key in async storage\n let keys = JSON.parse((await asyncStorage.getItem(`encrypt-keys`)) || '{}');\n keys[fileId] = key.serialize();\n await asyncStorage.setItem('encrypt-keys', JSON.stringify(keys));\n\n // Save the key id in prefs if the are loaded. If they aren't, we\n // are testing a key to download a file and when the file is\n // actually downloaded it will update the prefs with the latest key id\n if (prefs.getPrefs()) {\n await prefs.savePrefs({ encryptKeyId: key.getId() });\n }\n\n return {};\n};\n\nhandlers['should-pitch-subscribe'] = async function() {\n let seenSubscribe = await asyncStorage.getItem('seenSubscribe');\n return seenSubscribe !== 'true';\n};\n\nhandlers['has-pitched-subscribe'] = async function() {\n await asyncStorage.setItem('seenSubscribe', 'true');\n return 'ok';\n};\n\nhandlers['subscribe-needs-bootstrap'] = async function({ url } = {}) {\n if (getServer(url).BASE_SERVER === UNCONFIGURED_SERVER) {\n return { bootstrapped: true };\n }\n\n let res;\n try {\n res = await get(getServer(url).SIGNUP_SERVER + '/needs-bootstrap');\n } catch (err) {\n return { error: 'network-failure' };\n }\n\n try {\n res = JSON.parse(res);\n } catch (err) {\n return { error: 'parse-failure' };\n }\n\n if (res.status === 'error') {\n return { error: res.reason };\n }\n\n return { bootstrapped: res.data.bootstrapped };\n};\n\nhandlers['subscribe-bootstrap'] = async function({ password }) {\n let res;\n try {\n res = await post(getServer().SIGNUP_SERVER + '/bootstrap', { password });\n } catch (err) {\n return { error: err.reason || 'network-failure' };\n }\n\n if (res.token) {\n await asyncStorage.setItem('user-token', res.token);\n return {};\n }\n return { error: 'internal' };\n};\n\nhandlers['subscribe-set-user'] = async function({ token }) {\n await asyncStorage.setItem('user-token', token);\n};\n\nhandlers['subscribe-get-user'] = async function() {\n if (getServer() && getServer().BASE_SERVER === UNCONFIGURED_SERVER) {\n return { offline: false };\n }\n\n let userToken = await asyncStorage.getItem('user-token');\n\n if (userToken) {\n try {\n let res = await get(getServer().SIGNUP_SERVER + '/validate', {\n headers: {\n 'X-ACTUAL-TOKEN': userToken\n }\n });\n res = JSON.parse(res);\n\n if (res.status === 'error') {\n if (res.reason === 'unauthorized') {\n return null;\n }\n return { offline: true };\n }\n\n return { offline: false };\n } catch (e) {\n console.log(e);\n return { offline: true };\n }\n }\n\n return null;\n};\n\nhandlers['subscribe-change-password'] = async function({ password }) {\n let userToken = await asyncStorage.getItem('user-token');\n let res;\n try {\n res = await post(getServer().SIGNUP_SERVER + '/change-password', {\n token: userToken,\n password\n });\n } catch (err) {\n return { error: err.reason || 'network-failure' };\n }\n\n return {};\n};\n\nhandlers['subscribe-sign-in'] = async function({ password }) {\n let res = await post(getServer().SIGNUP_SERVER + '/login', {\n password\n });\n\n if (res.token) {\n await asyncStorage.setItem('user-token', res.token);\n return {};\n }\n\n return { error: 'invalid-password' };\n};\n\nhandlers['subscribe-sign-out'] = async function() {\n encryption.unloadAllKeys();\n await asyncStorage.multiRemove([\n 'user-token',\n 'encrypt-keys',\n 'lastBudget',\n 'readOnly'\n ]);\n return 'ok';\n};\n\nhandlers['get-server-url'] = async function() {\n return getServer() && getServer().BASE_SERVER;\n};\n\nhandlers['set-server-url'] = async function({ url }) {\n if (url != null) {\n // Validate the server is running\n let { error } = await runHandler(handlers['subscribe-needs-bootstrap'], {\n url\n });\n if (error) {\n return { error };\n }\n } else {\n // When the server isn't configured, we just use a placeholder\n url = UNCONFIGURED_SERVER;\n }\n\n asyncStorage.setItem('server-url', url);\n setServer(url);\n return {};\n};\n\nhandlers['sync'] = async function() {\n return fullSync();\n};\n\nhandlers['get-version'] = async function() {\n return { version: VERSION };\n};\n\nhandlers['get-budgets'] = async function() {\n const paths = await fs.listDir(fs.getDocumentDir());\n const budgets = (await Promise.all(\n paths.map(async name => {\n const prefsPath = fs.join(fs.getDocumentDir(), name, 'metadata.json');\n if (await fs.exists(prefsPath)) {\n let prefs;\n try {\n prefs = JSON.parse(await fs.readFile(prefsPath));\n } catch (e) {\n console.log('Error parsing metadata:', e.stack);\n return;\n }\n\n // We treat the directory name as the canonical id so that if\n // the user moves it around/renames/etc, nothing breaks. The\n // id is stored in prefs just for convenience (and the prefs\n // will always update to the latest given id)\n if (name !== DEMO_BUDGET_ID) {\n return {\n id: name,\n cloudFileId: prefs.cloudFileId,\n groupId: prefs.groupId,\n name: prefs.budgetName || '(no name)'\n };\n }\n }\n\n return null;\n })\n )).filter(x => x);\n\n return budgets;\n};\n\nhandlers['get-ynab4-files'] = async function() {\n return YNAB4.findBudgets();\n};\n\nhandlers['get-remote-files'] = async function() {\n return cloudStorage.listRemoteFiles();\n};\n\nhandlers['reset-budget-cache'] = mutator(async function() {\n // Recomputing everything will update the cache\n await sheet.loadUserBudgets(db);\n sheet.get().recomputeAll();\n await sheet.waitOnSpreadsheet();\n});\n\nhandlers['upload-budget'] = async function({ id } = {}) {\n if (id) {\n if (prefs.getPrefs()) {\n throw new Error('upload-budget: id given but prefs already loaded');\n }\n\n await prefs.loadPrefs(id);\n }\n\n try {\n await cloudStorage.upload();\n } catch (e) {\n console.log(e);\n if (e.type === 'FileUploadError') {\n return { error: e };\n }\n captureException(e);\n return { error: { reason: 'internal' } };\n } finally {\n if (id) {\n prefs.unloadPrefs();\n }\n }\n\n return {};\n};\n\nhandlers['download-budget'] = async function({ fileId, replace }) {\n let result;\n try {\n result = await cloudStorage.download(fileId, replace);\n } catch (e) {\n if (e.type === 'FileDownloadError') {\n if (e.reason === 'file-exists' && e.meta.id) {\n await prefs.loadPrefs(e.meta.id);\n let name = prefs.getPrefs().budgetName;\n prefs.unloadPrefs();\n\n e.meta = { ...e.meta, name };\n }\n\n return { error: e };\n } else {\n captureException(e);\n return { error: { reason: 'internal' } };\n }\n }\n\n let id = result.id;\n\n // Load the budget and do a full sync\n result = await loadBudget(result.id, VERSION, { showUpdate: true });\n if (result.error) {\n return { error: { reason: result.error } };\n }\n\n setSyncingMode('enabled');\n await initialFullSync();\n\n await handlers['close-budget']();\n\n return { id };\n};\n\nhandlers['load-budget'] = async function({ id }) {\n let currentPrefs = prefs.getPrefs();\n\n if (currentPrefs) {\n if (currentPrefs.id === id) {\n // If it's already loaded, do nothing\n return {};\n } else {\n // Otherwise, close the currently loaded budget\n await handlers['close-budget']();\n }\n }\n\n let res = await loadBudget(id, VERSION, { showUpdate: true });\n\n async function trackSizes() {\n let getFileSize = async name => {\n let dbFile = fs.join(fs.getBudgetDir(id), name);\n try {\n return await fs.size(dbFile);\n } catch (err) {\n return null;\n }\n };\n\n try {\n let dbSize = await getFileSize('db.sqlite');\n let cacheSize = await getFileSize('cache.sqlite');\n tracking.track('app:load-budget', { size: dbSize, cacheSize });\n } catch (err) {\n console.warn(err);\n }\n }\n trackSizes();\n\n return res;\n};\n\nhandlers['create-demo-budget'] = async function() {\n // Make sure the read only flag isn't leftover (normally it's\n // reset when signing in, but you don't have to sign in for the\n // demo budget)\n await asyncStorage.setItem('readOnly', '');\n\n return handlers['create-budget']({\n budgetName: 'Demo Budget',\n testMode: true,\n testBudgetId: DEMO_BUDGET_ID\n });\n};\n\nhandlers['close-budget'] = async function() {\n captureBreadcrumb({ message: 'Closing budget' });\n\n // The spreadsheet may be running, wait for it to complete\n await sheet.waitOnSpreadsheet();\n sheet.unloadSpreadsheet();\n\n clearFullSyncTimeout();\n await app.stopServices();\n\n await db.closeDatabase();\n\n try {\n await asyncStorage.setItem('lastBudget', '');\n } catch (e) {\n // This might fail if we are shutting down after failing to load a\n // budget. We want to unload whatever has already been loaded but\n // be resilient to anything failing\n }\n\n prefs.unloadPrefs();\n stopBackupService();\n return 'ok';\n};\n\nhandlers['delete-budget'] = async function({ id, cloudFileId }) {\n // If it's a cloud file, you can delete it from the server by\n // passing its cloud id\n if (cloudFileId && !process.env.IS_BETA) {\n await cloudStorage.removeFile(cloudFileId).catch(err => {});\n }\n\n // If a local file exists, you can delete it by passing its local id\n if (id) {\n let budgetDir = fs.getBudgetDir(id);\n await fs.removeDirRecursively(budgetDir);\n }\n\n return 'ok';\n};\n\nhandlers['create-budget'] = async function({\n budgetName,\n avoidUpload,\n testMode,\n testBudgetId\n} = {}) {\n let id;\n if (testMode) {\n budgetName = budgetName || 'Test Budget';\n id = testBudgetId || TEST_BUDGET_ID;\n\n if (await fs.exists(fs.getBudgetDir(id))) {\n await fs.removeDirRecursively(fs.getBudgetDir(id));\n }\n } else {\n // Generate budget name if not given\n if (!budgetName) {\n // Unfortunately we need to load all of the existing files first\n // so we can detect conflicting names.\n let files = await handlers['get-budgets']();\n budgetName = await uniqueFileName(files);\n }\n\n id = await idFromFileName(budgetName);\n }\n\n let budgetDir = fs.getBudgetDir(id);\n await fs.mkdir(budgetDir);\n\n // Create the initial database\n await fs.copyFile(fs.bundledDatabasePath, fs.join(budgetDir, 'db.sqlite'));\n\n // Create the initial prefs file\n await fs.writeFile(\n fs.join(budgetDir, 'metadata.json'),\n JSON.stringify(prefs.getDefaultPrefs(id, budgetName))\n );\n\n // Load it in\n let { error } = await loadBudget(id, VERSION);\n if (error) {\n console.log('Error creating budget: ' + error);\n return { error };\n }\n\n if (!avoidUpload && !testMode) {\n try {\n await cloudStorage.upload();\n } catch (e) {\n // Ignore any errors uploading. If they are offline they should\n // still be able to create files.\n }\n }\n\n if (testMode) {\n await createTestBudget(handlers);\n }\n\n return {};\n};\n\nhandlers['set-tutorial-seen'] = async function() {\n await asyncStorage.setItem('seen-tutorial', 'true');\n return 'ok';\n};\n\nhandlers['import-budget'] = async function({ filepath, type }) {\n try {\n if (!(await fs.exists(filepath))) {\n throw new Error(`File not found at the provided path: ${filepath}`);\n }\n\n let buffer = Buffer.from(await fs.readFile(filepath, 'binary'));\n\n switch (type) {\n case 'ynab4':\n try {\n await YNAB4.importBuffer(filepath, buffer);\n } catch (e) {\n let msg = e.message.toLowerCase();\n if (\n msg.includes('not a ynab4') ||\n msg.includes('could not find file')\n ) {\n return { error: 'not-ynab4' };\n }\n }\n break;\n case 'ynab5':\n let data;\n try {\n data = JSON.parse(buffer.toString());\n } catch (e) {\n return { error: 'parse-error' };\n }\n\n try {\n await YNAB5.importYNAB5(data);\n } catch (e) {\n return { error: 'not-ynab5' };\n }\n break;\n case 'actual':\n // We should pull out import/export into its own app so this\n // can be abstracted out better. Importing Actual files is a\n // special case because we can directly write down the files,\n // but because it doesn't go through the API layer we need to\n // duplicate some of the workflow\n await handlers['close-budget']();\n\n let { id } = await cloudStorage.importBuffer(\n { cloudFileId: null, groupId: null },\n buffer\n );\n\n // We never want to load cached data from imported files, so\n // delete the cache\n let sqliteDb = await sqlite.openDatabase(\n fs.join(fs.getBudgetDir(id), 'db.sqlite')\n );\n sqlite.execQuery(\n sqliteDb,\n `\n DELETE FROM kvcache;\n DELETE FROM kvcache_key;\n `\n );\n sqlite.closeDatabase(sqliteDb);\n\n // Load the budget, force everything to be computed, and try\n // to upload it as a cloud file\n await handlers['load-budget']({ id });\n await handlers['get-budget-bounds']();\n await sheet.waitOnSpreadsheet();\n await cloudStorage.upload().catch(err => {});\n\n break;\n default:\n }\n } catch (err) {\n err.message = 'Error importing budget: ' + err.message;\n captureException(err);\n return { error: 'internal-error' };\n }\n\n return {};\n};\n\nhandlers['export-budget'] = async function() {\n return await cloudStorage.exportBuffer();\n};\n\nasync function loadBudget(id, appVersion, { showUpdate } = {}) {\n let dir;\n try {\n dir = fs.getBudgetDir(id);\n } catch (e) {\n captureException(\n new Error('`getBudgetDir` failed in `loadBudget`: ' + e.message)\n );\n return { error: 'budget-not-found' };\n }\n\n captureBreadcrumb({ message: 'Loading budget ' + dir });\n\n if (!(await fs.exists(dir))) {\n captureException(new Error('budget directory does not exist'));\n return { error: 'budget-not-found' };\n }\n\n try {\n await prefs.loadPrefs(id);\n await db.openDatabase(id);\n } catch (e) {\n captureBreadcrumb({ message: 'Error loading budget ' + id });\n captureException(e);\n await handlers['close-budget']();\n return { error: 'opening-budget' };\n }\n\n // Older versions didn't tag the file with the current user, so do\n // so now\n if (!prefs.getPrefs().userId) {\n let [[, userId]] = await asyncStorage.multiGet(['user-token']);\n prefs.savePrefs({ userId });\n }\n\n let { budgetVersion, budgetId } = prefs.getPrefs();\n\n try {\n await updateVersion(budgetVersion, showUpdate);\n } catch (e) {\n console.warn('Error updating', e);\n let result;\n if (e.message.includes('out-of-sync-migrations')) {\n result = { error: 'out-of-sync-migrations' };\n } else if (e.message.includes('out-of-sync-data')) {\n result = { error: 'out-of-sync-data' };\n } else {\n captureException(e);\n logger.info('Error updating budget ' + id, e);\n console.log('Error updating budget', e);\n result = { error: 'loading-budget' };\n }\n\n await handlers['close-budget']();\n return result;\n }\n\n await db.loadClock();\n\n if (prefs.getPrefs().resetClock) {\n // If we need to generate a fresh clock, we need to generate a new\n // client id. This happens when the database is transferred to a\n // new device.\n //\n // TODO: The client id should be stored elsewhere. It shouldn't\n // work this way, but it's fine for now.\n timestamp.getClock().timestamp.setNode(timestamp.makeClientId());\n await db.runQuery(\n 'INSERT OR REPLACE INTO messages_clock (id, clock) VALUES (1, ?)',\n [timestamp.serializeClock(timestamp.getClock())]\n );\n\n await prefs.savePrefs({ resetClock: false });\n }\n\n if (!Platform.isWeb && !Platform.isMobile && !global.__TESTING__) {\n startBackupService(id);\n }\n\n try {\n await sheet.loadSpreadsheet(db, onSheetChange);\n } catch (e) {\n captureException(e);\n await handlers['close-budget']();\n return { error: 'opening-budget' };\n }\n\n // This is a bit leaky, but we need to set the initial budget type\n sheet.get().meta().budgetType = prefs.getPrefs().budgetType;\n await budget.createAllBudgets();\n\n // Load all the in-memory state\n await mappings.loadMappings();\n await rules.loadRules();\n await syncMigrations.listen();\n await app.startServices();\n\n clearUndo();\n\n // Ensure that syncing is enabled\n if (!global.__TESTING__) {\n if (process.env.IS_BETA || id === DEMO_BUDGET_ID) {\n setSyncingMode('disabled');\n } else if (id === TEST_BUDGET_ID) {\n await asyncStorage.setItem('lastBudget', id);\n } else {\n setSyncingMode('enabled');\n\n await asyncStorage.setItem('lastBudget', id);\n\n // Only upload periodically on desktop\n if (!Platform.isMobile) {\n await cloudStorage.possiblyUpload();\n }\n }\n }\n\n app.events.emit('load-budget', { id });\n\n return {};\n}\n\nhandlers['get-upgrade-notifications'] = async function() {\n let { id } = prefs.getPrefs();\n if (id === TEST_BUDGET_ID || id === DEMO_BUDGET_ID) {\n return [];\n }\n\n let types = ['schedules', 'repair-splits'];\n let unseen = [];\n\n for (let type of types) {\n let key = `notifications.${type}`;\n if (prefs.getPrefs()[key] == null) {\n unseen.push(type);\n }\n }\n\n return unseen;\n};\n\nhandlers['seen-upgrade-notification'] = async function({ type }) {\n let key = `notifications.${type}`;\n prefs.savePrefs({ [key]: true });\n};\n\nhandlers['upload-file-web'] = async function({ filename, contents }) {\n if (!Platform.isWeb) {\n return null;\n }\n\n await fs.writeFile('/uploads/' + filename, contents);\n return 'ok';\n};\n\nhandlers['backups-get'] = async function({ id }) {\n return getAvailableBackups(id);\n};\n\nhandlers['backup-load'] = async function({ id, backupId }) {\n await loadBackup(id, backupId);\n};\n\nhandlers['backup-make'] = async function({ id }) {\n await makeBackup(id);\n};\n\nhandlers['get-last-opened-backup'] = async function() {\n const id = await asyncStorage.getItem('lastBudget');\n if (id && id !== '') {\n const budgetDir = fs.getBudgetDir(id);\n\n // We never want to give back a budget that does not exist on the\n // filesystem anymore, so first check that it exists\n if (await fs.exists(budgetDir)) {\n return id;\n }\n }\n return null;\n};\n\nhandlers['app-focused'] = async function() {\n if (prefs.getPrefs() && prefs.getPrefs().id) {\n // First we sync\n fullSync();\n }\n};\n\nhandlers['track'] = async function({ name, props }) {\n tracking.track(name, props);\n};\n\nhandlers = installAPI(handlers);\n\ninjectAPI.send = (name, args) => runHandler(app.handlers[name], args);\n\n// A hack for now until we clean up everything\napp.handlers = handlers;\napp.combine(schedulesApp, budgetApp, notesApp, toolsApp);\n\nfunction getDefaultDocumentDir() {\n if (Platform.isMobile) {\n // On mobile, unfortunately we need to be backwards compatible\n // with the old folder structure which does not store files inside\n // of an `Actual` directory. In the future, if we really care, we\n // can migrate them, but for now just return the documents dir\n return process.env.ACTUAL_DOCUMENT_DIR;\n }\n return fs.join(process.env.ACTUAL_DOCUMENT_DIR, 'Actual');\n}\n\nasync function setupDocumentsDir() {\n async function ensureExists(dir) {\n // Make sure the document folder exists\n if (!(await fs.exists(dir))) {\n await fs.mkdir(dir);\n }\n }\n\n let documentDir = await asyncStorage.getItem('document-dir');\n\n // Test the existing documents directory to make sure it's a valid\n // path that exists, and if it errors fallback to the default one\n if (documentDir) {\n try {\n await ensureExists(documentDir);\n } catch (e) {\n documentDir = null;\n }\n }\n\n if (!documentDir) {\n documentDir = getDefaultDocumentDir();\n }\n\n await ensureExists(documentDir);\n fs._setDocumentDir(documentDir);\n}\n\nexport async function initApp(version, isDev, socketName) {\n VERSION = version;\n\n await sqlite.init();\n await Promise.all([asyncStorage.init(), fs.init()]);\n await tracking.init();\n await setupDocumentsDir();\n\n let keysStr = await asyncStorage.getItem('encrypt-keys');\n if (keysStr) {\n try {\n let keys = JSON.parse(keysStr);\n\n // Load all the keys\n await Promise.all(\n Object.keys(keys).map(fileId => {\n return encryption.loadKey(keys[fileId]);\n })\n );\n } catch (e) {\n console.log('Error loading key', e);\n throw new Error('load-key-error');\n }\n }\n\n if (isDev) {\n const lastBudget = await asyncStorage.getItem('lastBudget');\n // if (lastBudget) {\n // loadBudget(lastBudget, VERSION);\n // }\n }\n\n const url = await asyncStorage.getItem('server-url');\n if (url) {\n setServer(url);\n }\n\n connection.init(socketName, app.handlers);\n\n tracking.track('app:init', {\n platform: Platform.isMobile ? 'mobile' : Platform.isWeb ? 'web' : 'desktop'\n });\n\n if (!isDev && !Platform.isMobile && !Platform.isWeb) {\n let autoUpdate = await asyncStorage.getItem('auto-update');\n process.send({\n type: 'shouldAutoUpdate',\n flag: autoUpdate == null || autoUpdate === 'true'\n });\n }\n\n if (isDev || process.env.IS_BETA) {\n global.$send = (name, args) => runHandler(app.handlers[name], args);\n global.$query = aqlQuery;\n global.$q = q;\n global.$db = db;\n global.$setSyncingMode = setSyncingMode;\n }\n}\n\nexport async function init({ budgetId, config }) {\n // Get from build\n // eslint-disable-next-line\n VERSION = ACTUAL_APP_VERSION;\n\n let dataDir, serverURL;\n if (config) {\n dataDir = config.dataDir;\n serverURL = config.serverURL;\n } else {\n dataDir = process.env.ACTUAL_DATA_DIR;\n serverURL = process.env.ACTUAL_SERVER_URL;\n }\n\n await sqlite.init();\n await Promise.all([asyncStorage.init({ persist: false }), fs.init()]);\n fs._setDocumentDir(dataDir || process.cwd());\n\n if (serverURL) {\n setServer(serverURL);\n } else {\n // This turns off all server URLs. In this mode we don't want any\n // access to the server, we are doing things locally\n setServer(null);\n\n app.events.on('load-budget', () => {\n setSyncingMode('offline');\n });\n }\n\n if (budgetId) {\n await runHandler(handlers['load-budget'], { id: budgetId });\n }\n\n return lib;\n}\n\n// Export a few things required for the platform\nexport const lib = {\n getDataDir: fs.getDataDir,\n sendMessage: (msg, args) => connection.send(msg, args),\n send: async (name, args) => {\n let res = await runHandler(app.handlers[name], args);\n return res;\n },\n on: (name, func) => app.events.on(name, func),\n syncAndReceiveMessages,\n q,\n db,\n\n // Expose CRDT mechanisms so server can use them\n merkle,\n timestamp,\n SyncProtoBuf: SyncPb\n};\n\nif (process.env.NODE_ENV === 'development' && Platform.isWeb) {\n // Support reloading the backend\n self.addEventListener('message', async e => {\n if (e.data.type === '__actual:shutdown') {\n await sheet.waitOnSpreadsheet();\n await app.stopServices();\n await db.closeDatabase();\n asyncStorage.shutdown();\n fs.shutdown();\n\n setTimeout(() => {\n // Give everything else some time to process shutdown events\n self.close();\n }, 100);\n }\n });\n}\n","// TODO: Ok, several problems:\n//\n// * If nothing matches between two merkle trees, we should fallback\n// * to the last window instead the front one (use 0 instead of the\n// * key)\n//\n// * Need to check to make sure if account exists when handling\n// * transaction changes in syncing\n\nexport function getKeys(trie) {\n return Object.keys(trie).filter(x => x !== 'hash');\n}\n\nexport function keyToTimestamp(key) {\n // 16 is the length of the base 3 value of the current time in\n // minutes. Ensure it's padded to create the full value\n let fullkey = key + '0'.repeat(16 - key.length);\n\n // Parse the base 3 representation\n return parseInt(fullkey, 3) * 1000 * 60;\n}\n\nexport function insert(trie, timestamp) {\n let hash = timestamp.hash();\n let key = Number((timestamp.millis() / 1000 / 60) | 0).toString(3);\n\n trie = Object.assign({}, trie, { hash: trie.hash ^ hash });\n return insertKey(trie, key, hash);\n}\n\nfunction insertKey(trie, key, hash) {\n if (key.length === 0) {\n return trie;\n }\n const c = key[0];\n const n = trie[c] || {};\n return Object.assign({}, trie, {\n [c]: Object.assign({}, n, insertKey(n, key.slice(1), hash), {\n hash: n.hash ^ hash\n })\n });\n}\n\nexport function build(timestamps) {\n let trie = {};\n for (let timestamp of timestamps) {\n insert(trie, timestamp);\n }\n return trie;\n}\n\nexport function diff(trie1, trie2) {\n if (trie1.hash === trie2.hash) {\n return null;\n }\n\n let node1 = trie1;\n let node2 = trie2;\n let k = '';\n\n // This loop will eventually stop when it traverses down to find\n // where the hashes differ, or otherwise when there are no leaves\n // left (this shouldn't happen, if that's the case the hash check at\n // the top of this function should pass)\n while (1) {\n let keyset = new Set([...getKeys(node1), ...getKeys(node2)]);\n let keys = [...keyset.values()];\n keys.sort();\n\n let diffkey = null;\n\n // Traverse down the trie through keys that aren't the same. We\n // traverse down the keys in order. Stop in two cases: either one\n // of the nodes doesn't have the key, or a different key isn't\n // found. For the former case, we have to that because pruning is\n // lossy. We don't know if we've pruned off a changed key so we\n // can't traverse down anymore. For the latter case, it means two\n // things: either we've hit the bottom of the tree, or the changed\n // key has been pruned off. In the latter case we have a \"partial\"\n // key and will fill the rest with 0s. Note that if multiple older\n // messages were added into one trie, it's possible we will\n // generate a time that only encompasses *some* of the those\n // messages. Pruning is lossy, and we traverse down the left-most\n // changed time that we know of, because of pruning it might take\n // multiple passes to sync up a trie.\n for (let i = 0; i < keys.length; i++) {\n let key = keys[i];\n\n if (!node1[key] || !node2[key]) {\n break;\n }\n\n let next1 = node1[key];\n let next2 = node2[key];\n if (next1.hash !== next2.hash) {\n diffkey = key;\n break;\n }\n }\n\n if (!diffkey) {\n return keyToTimestamp(k);\n }\n\n k += diffkey;\n node1 = node1[diffkey] || {};\n node2 = node2[diffkey] || {};\n }\n}\n\nexport function prune(trie, n = 2) {\n // Do nothing if empty\n if (!trie.hash) {\n return trie;\n }\n\n let keys = getKeys(trie);\n keys.sort();\n\n let next = { hash: trie.hash };\n keys = keys.slice(-n).map(k => (next[k] = prune(trie[k], n)));\n\n return next;\n}\n\nexport function debug(trie, k = '', indent = 0) {\n const str =\n ' '.repeat(indent) +\n (k !== '' ? `k: ${k} ` : '') +\n `hash: ${trie.hash || '(empty)'}\\n`;\n return (\n str +\n getKeys(trie)\n .map(key => {\n return debug(trie[key], key, indent + 2);\n })\n .join('')\n );\n}\n","import fs from '../../platform/server/fs';\nimport * as sqlite from '../../platform/server/sqlite';\n\n// We have to bundle in JS migrations manually to avoid having to `eval`\n// them which doesn't play well with CSP. There isn't great, and eventually\n// we can remove this migration.\nimport m1632571489012 from '../../../migrations/1632571489012_remove_cache.js';\n\nconst uuid = require('../../platform/uuid');\n\nlet MIGRATIONS_DIR = fs.migrationsPath;\n\nlet javascriptMigrations = {\n 1632571489012: m1632571489012\n};\n\nexport async function withMigrationsDir(dir, func) {\n let oldDir = MIGRATIONS_DIR;\n MIGRATIONS_DIR = dir;\n await func();\n MIGRATIONS_DIR = oldDir;\n}\n\nexport function getMigrationsDir() {\n return MIGRATIONS_DIR;\n}\n\nfunction getMigrationId(name) {\n return parseInt(name.match(/^(\\d)+/)[0]);\n}\n\nexport function getUpMigration(id, names) {\n for (let m of names) {\n if (getMigrationId(m) === id) {\n return m;\n }\n }\n}\n\nexport async function getAppliedMigrations(db) {\n const rows = await sqlite.runQuery(\n db,\n 'SELECT * FROM __migrations__ ORDER BY id ASC',\n [],\n true\n );\n return rows.map(row => row.id);\n}\n\nexport async function getMigrationList(migrationsDir) {\n const files = await fs.listDir(migrationsDir);\n return files\n .filter(name => name.match(/(\\.sql|\\.js)$/))\n .sort((m1, m2) => {\n const id1 = getMigrationId(m1);\n const id2 = getMigrationId(m2);\n if (id1 < id2) {\n return -1;\n } else if (id1 > id2) {\n return 1;\n }\n return 0;\n });\n}\n\nexport function getPending(appliedIds, all) {\n return all.filter(name => {\n const id = getMigrationId(name);\n return appliedIds.indexOf(id) === -1;\n });\n}\n\nasync function applyJavaScript(db, id) {\n const dbInterface = {\n runQuery: (query, params, fetchAll) =>\n sqlite.runQuery(db, query, params, fetchAll),\n execQuery: query => sqlite.execQuery(db, query),\n transaction: func => sqlite.transaction(db, func)\n };\n\n if (javascriptMigrations[id] == null) {\n throw new Error('Could not find JS migration code to run for ' + id);\n }\n\n let run = javascriptMigrations[id];\n return run(dbInterface, () => uuid.v4Sync());\n}\n\nasync function applySql(db, sql) {\n try {\n await sqlite.execQuery(db, sql);\n } catch (e) {\n console.log('Error applying sql:', sql);\n throw e;\n }\n}\n\nexport async function applyMigration(db, name, migrationsDir) {\n const code = await fs.readFile(fs.join(migrationsDir, name));\n if (name.match(/\\.js$/)) {\n await applyJavaScript(db, getMigrationId(name));\n } else {\n await applySql(db, code);\n }\n await sqlite.runQuery(db, 'INSERT INTO __migrations__ (id) VALUES (?)', [\n getMigrationId(name)\n ]);\n}\n\nfunction checkDatabaseValidity(appliedIds, available) {\n for (let i = 0; i < appliedIds.length; i++) {\n if (\n i >= available.length ||\n appliedIds[i] !== getMigrationId(available[i])\n ) {\n throw new Error('out-of-sync-migrations');\n }\n }\n}\n\nexport async function migrate(db) {\n let appliedIds = await getAppliedMigrations(db);\n let available = await getMigrationList(MIGRATIONS_DIR);\n\n checkDatabaseValidity(appliedIds, available);\n\n const pending = getPending(appliedIds, available);\n\n for (let migration of pending) {\n await applyMigration(db, migration, MIGRATIONS_DIR);\n }\n\n return pending;\n}\n","export function requiredFields(name, row, fields, update) {\n fields.forEach(field => {\n if (update) {\n if (row.hasOwnProperty(field) && row[field] == null) {\n throw new Error(`${name} is missing field ${field}`);\n }\n } else {\n if (!row.hasOwnProperty(field) || row[field] == null) {\n throw new Error(`${name} is missing field ${field}`);\n }\n }\n });\n}\n\nexport function toDateRepr(str) {\n if (typeof str !== 'string') {\n throw new Error('toDateRepr not passed a string: ' + str);\n }\n\n return parseInt(str.replace(/-/g, ''));\n}\n\nexport function fromDateRepr(number) {\n if (typeof number !== 'number') {\n throw new Error('fromDateRepr not passed a number: ' + number);\n }\n\n const dateString = number.toString();\n return (\n dateString.slice(0, 4) +\n '-' +\n dateString.slice(4, 6) +\n '-' +\n dateString.slice(6)\n );\n}\n\nexport const accountModel = {\n validateAccountType(account) {\n const { type } = account;\n if (\n type !== 'checking' &&\n type !== 'savings' &&\n type !== 'investment' &&\n type !== 'credit' &&\n type !== 'mortgage' &&\n type !== 'debt' &&\n type !== 'other'\n ) {\n throw new Error('Invalid account type: ' + type);\n }\n },\n\n validate(account, { update } = {}) {\n if (!update || account.type != null) {\n accountModel.validateAccountType(account);\n }\n\n requiredFields(\n 'account',\n account,\n update ? ['name', 'type', 'offbudget', 'closed'] : ['name', 'type'],\n update\n );\n\n return account;\n }\n};\n\nexport const categoryModel = {\n validate(category, { update } = {}) {\n requiredFields(\n 'category',\n category,\n update ? ['name', 'is_income', 'cat_group'] : ['name', 'cat_group'],\n update\n );\n\n let { sort_order, ...rest } = category;\n return rest;\n }\n};\n\nexport const categoryGroupModel = {\n validate(categoryGroup, { update } = {}) {\n requiredFields(\n 'categoryGroup',\n categoryGroup,\n update ? ['name', 'is_income'] : ['name'],\n update\n );\n\n let { sort_order, ...rest } = categoryGroup;\n return rest;\n }\n};\n\nexport const payeeModel = {\n validate(payee, { update } = {}) {\n requiredFields('payee', payee, ['name'], update);\n return payee;\n }\n};\n\nexport const payeeRuleModel = {\n validateType(rule) {\n const { type } = rule;\n if (type !== 'equals' && type !== 'contains') {\n throw new Error('Invalid rule type: ' + type);\n }\n },\n\n validate(rule, { update } = {}) {\n if (!update || 'type' in rule) {\n payeeRuleModel.validateType(rule);\n }\n\n requiredFields('payee_rules', rule, ['payee_id', 'type'], update);\n return rule;\n }\n};\n\nexport const transactionModel = {\n validate(trans, { update } = {}) {\n requiredFields('transaction', trans, ['date', 'acct'], update);\n\n if ('date' in trans) {\n // Make sure it's the right format, and also do a sanity check.\n // Really old dates can mess up the system and can happen by\n // accident\n if (\n trans.date.match(/^\\d{4}-\\d{2}-\\d{2}$/) == null ||\n trans.date < '2000-01-01'\n ) {\n throw new Error('Invalid transaction date: ' + trans.date);\n }\n }\n\n return trans;\n },\n\n toJS(row) {\n // Check a non-important field that typically wouldn't be passed in\n // manually, and use it as a smoke test to see if this is a\n // fully-formed transaction or not.\n if (!('location' in row)) {\n throw new Error(\n 'A full transaction is required to be passed to `toJS`. Instead got: ' +\n JSON.stringify(row)\n );\n }\n\n let trans = { ...row };\n trans.error = row.error ? JSON.parse(row.error) : null;\n trans.isParent = row.isParent === 1 ? true : false;\n trans.isChild = row.isChild === 1 ? true : false;\n trans.starting_balance_flag =\n row.starting_balance_flag === 1 ? true : false;\n trans.cleared = row.cleared === 1 ? true : false;\n trans.pending = row.pending === 1 ? true : false;\n trans.date = trans.date && fromDateRepr(trans.date);\n return trans;\n },\n\n fromJS(trans) {\n let row = { ...trans };\n if ('error' in row) {\n row.error = trans.error ? JSON.stringify(trans.error) : null;\n }\n if ('isParent' in row) {\n row.isParent = trans.isParent ? 1 : 0;\n }\n if ('isChild' in row) {\n row.isChild = trans.isChild ? 1 : 0;\n }\n if ('cleared' in row) {\n row.cleared = trans.cleared ? 1 : 0;\n }\n if ('pending' in row) {\n row.pending = trans.pending ? 1 : 0;\n }\n if ('starting_balance_flag' in row) {\n row.starting_balance_flag = trans.starting_balance_flag ? 1 : 0;\n }\n if ('date' in row) {\n row.date = toDateRepr(trans.date);\n }\n\n return row;\n }\n};\n","import { sequential } from '../shared/async';\nimport { captureException, captureBreadcrumb } from '../platform/exceptions';\n\nlet runningMethods = new Set();\n\nlet currentContext = null;\nlet mutatingMethods = new WeakMap();\nlet globalMutationsEnabled = false;\n\nlet _latestHandlerNames = [];\n\nexport function mutator(handler) {\n mutatingMethods.set(handler, true);\n return handler;\n}\n\nexport function isMutating(handler) {\n return mutatingMethods.has(handler);\n}\n\nasync function flushRunningMethods() {\n // Give the client some time to invoke new requests\n await wait(200);\n\n while (runningMethods.size > 0) {\n // Wait for all of them\n await Promise.all([...runningMethods.values()]);\n\n // We give clients more time to make other requests. This lets them continue\n // to do an async workflow\n await wait(100);\n }\n}\n\nfunction wait(time) {\n return new Promise(resolve => setTimeout(resolve, time));\n}\n\nexport async function runHandler(handler, args, { undoTag, name } = {}) {\n // For debug reasons, track the latest handlers that have been\n // called\n _latestHandlerNames.push(name);\n if (_latestHandlerNames.length > 5) {\n _latestHandlerNames = _latestHandlerNames.slice(-5);\n }\n\n if (mutatingMethods.has(handler)) {\n return runMutator(() => handler(args), { undoTag });\n }\n\n // When closing a file, it clears out all global state for the file. That\n // means any async workflows currently executed would be cut off. We handle\n // this by letting all async workflows finish executing before closing the\n // file\n if (name === 'close-budget') {\n await flushRunningMethods();\n }\n\n let promise = handler(args);\n runningMethods.add(promise);\n promise.then(() => {\n runningMethods.delete(promise);\n });\n return promise;\n}\n\n// These are useful for tests. Only use them in tests.\nexport function enableGlobalMutations() {\n if (global.__TESTING__) {\n globalMutationsEnabled = true;\n }\n}\n\nexport function disableGlobalMutations() {\n if (global.__TESTING__) {\n globalMutationsEnabled = false;\n }\n}\n\nexport const runMutator = sequential(async (func, initialContext = {}) => {\n currentContext = initialContext;\n return func().finally(() => {\n currentContext = null;\n });\n});\n\nexport function withMutatorContext(context, func) {\n if (currentContext == null && !globalMutationsEnabled) {\n captureBreadcrumb('Recent methods: ' + _latestHandlerNames.join(', '));\n captureException(new Error('withMutatorContext: mutator not running'));\n\n // See comment below. This is not an error right now, but it will\n // be in the future.\n return func();\n }\n\n let prevContext = currentContext;\n currentContext = { ...currentContext, ...context };\n return func().finally(() => {\n currentContext = prevContext;\n });\n}\n\nexport function getMutatorContext() {\n if (currentContext == null) {\n captureBreadcrumb({\n category: 'server',\n message: 'Recent methods: ' + _latestHandlerNames.join(', ')\n });\n // captureException(new Error('getMutatorContext: mutator not running'));\n\n // For now, this is a non-fatal error. It will be in the future,\n // but this is relatively non-critical (undo just won't work) so\n // return an empty context. When we have more confidence that\n // everything is running inside a mutator, throw an error.\n return {};\n }\n\n if (currentContext == null && globalMutationsEnabled) {\n return {};\n }\n return currentContext;\n}\n","import { createApp } from '../app';\nimport * as db from '../db';\n\nlet app = createApp();\n\napp.method('notes-save', async ({ id, note }) => {\n await db.update('notes', { id, note });\n});\n\nexport default app;\n","let enabled = false;\nlet entries = {};\nlet counters = {};\n\nexport function reset() {\n entries = {};\n counters = {};\n}\n\nexport function record(name) {\n const start = Date.now();\n return () => unrecord(name, start);\n}\n\nfunction unrecord(name, start) {\n const end = Date.now();\n\n if (enabled) {\n if (entries[name] == null) {\n entries[name] = [];\n }\n entries[name].push(end - start);\n }\n}\n\nexport function increment(name) {\n if (enabled) {\n if (counters[name] == null) {\n counters[name] = 0;\n }\n counters[name]++;\n }\n}\n\nexport function start() {\n enabled = true;\n}\n\nexport function stop() {\n enabled = false;\n\n console.log('~~ PERFORMANCE REPORT ~~');\n for (let name in entries) {\n const records = entries[name];\n const total = records.reduce((total, n) => total + n / 1000, 0);\n const avg = total / records.length;\n\n console.log(\n `[${name}] count: ${records.length} total: ${total}s avg: ${avg}`\n );\n }\n\n for (let name in counters) {\n console.log(`[${name}] ${counters[name]}`);\n }\n console.log('~~ END REPORT ~~');\n\n reset();\n}\n","export default {\n isMobile: false,\n isWeb: false,\n isDesktop: true\n};\n","// By default, no polyfills are installed\n","import Platform from './platform';\nconst { PostError, HTTPError } = require('./errors');\nconst { fetch } = require('../platform/server/fetch');\n\nfunction throwIfNot200(res, text) {\n if (res.status !== 200) {\n if (res.status === 500) {\n throw new PostError(res.status === 500 ? 'internal' : text);\n }\n\n let contentType = res.headers.get('Content-Type');\n if (contentType.toLowerCase().indexOf('application/json') !== -1) {\n let json = JSON.parse(text);\n throw new PostError(json.reason);\n }\n throw new PostError(text);\n }\n}\n\nexport async function post(url, data) {\n let text;\n let res;\n\n let s = new Error().stack;\n\n try {\n res = await fetch(url, {\n method: 'POST',\n body: JSON.stringify(data),\n headers: {\n 'Content-Type': 'application/json'\n }\n });\n text = await res.text();\n } catch (err) {\n throw new PostError('network-failure');\n }\n\n throwIfNot200(res, text);\n\n try {\n res = JSON.parse(text);\n } catch (err) {\n // Something seriously went wrong. TODO handle errors\n throw new PostError('parse-json', { meta: text });\n }\n\n if (res.status !== 'ok') {\n console.log(\n 'API call failed: ' +\n url +\n '\\nData: ' +\n JSON.stringify(data, null, 2) +\n '\\nResponse: ' +\n JSON.stringify(res, null, 2)\n );\n\n throw new PostError(res.description || res.reason || 'unknown');\n }\n\n return res.data;\n}\n\nexport async function postBinary(url, data, headers) {\n let res;\n try {\n res = await fetch(url, {\n method: 'POST',\n body: Platform.isWeb ? data : Buffer.from(data),\n headers: {\n 'Content-Length': data.length,\n 'Content-Type': 'application/actual-sync',\n ...headers\n }\n });\n } catch (err) {\n throw new PostError('network-failure');\n }\n\n let buffer;\n if (res.arrayBuffer) {\n buffer = Buffer.from(await res.arrayBuffer());\n } else {\n buffer = await res.buffer();\n }\n\n throwIfNot200(res, buffer.toString());\n\n return buffer;\n}\n\nexport function get(url, opts) {\n return fetch(url, opts).then(res => res.text());\n}\n","import { sendMessages } from './sync';\nimport Timestamp from './timestamp';\nconst fs = require('../platform/server/fs');\n\nlet prefs = null;\n\nexport async function loadPrefs(id) {\n if (global.__TESTING__ && !id) {\n prefs = { dummyTestPrefs: true };\n return prefs;\n }\n\n const fullpath = fs.join(fs.getBudgetDir(id), 'metadata.json');\n\n try {\n prefs = JSON.parse(await fs.readFile(fullpath));\n } catch (e) {\n // If the user messed something up, be flexible and allow them to\n // still load the budget database. Default the budget name to the\n // id.\n prefs = { id, budgetName: id };\n }\n\n // No matter what is in `id` field, force it to be the current id.\n // This makes it resilient to users moving around folders, etc\n prefs.id = id;\n return prefs;\n}\n\nexport async function savePrefs(prefsToSet, { avoidSync = false } = {}) {\n Object.assign(prefs, prefsToSet);\n\n if (!avoidSync) {\n // Sync whitelisted prefs\n let messages = Object.keys(prefsToSet)\n .map(key => {\n if (key === 'budgetType' || key === 'budgetName') {\n return {\n dataset: 'prefs',\n row: key,\n column: 'value',\n value: prefsToSet[key],\n timestamp: Timestamp.send()\n };\n }\n return null;\n })\n .filter(x => x);\n\n if (messages.length > 0) {\n await sendMessages(messages);\n }\n }\n\n if (!prefs.dummyTestPrefs) {\n let prefsPath = fs.join(fs.getBudgetDir(prefs.id), 'metadata.json');\n await fs.writeFile(prefsPath, JSON.stringify(prefs));\n }\n}\n\nexport function unloadPrefs() {\n prefs = null;\n}\n\nexport function getPrefs() {\n return prefs;\n}\n\nexport function getDefaultPrefs(id, budgetName) {\n // Add any notifications in here that new users shouldn't see.\n // Without them, a popup will show to explain a new feature.\n return {\n id,\n budgetName,\n 'notifications.schedules': true,\n 'notifications.repair-splits': true\n };\n}\n\nexport async function readPrefs(id) {\n const fullpath = fs.join(fs.getBudgetDir(id), 'metadata.json');\n\n try {\n return JSON.parse(await fs.readFile(fullpath));\n } catch (e) {\n return null;\n }\n}\n","import deepEqual from 'deep-equal';\nimport * as d from 'date-fns';\nimport { createApp } from '../app';\nimport * as db from '../db';\nimport * as prefs from '../prefs';\nimport { toDateRepr } from '../models';\nimport { runQuery as aqlQuery } from '../aql/schema/run-query';\nimport { compileQuery } from '../aql/compiler';\nimport { schema, schemaConfig } from '../aql/schema';\nimport { dayFromDate, currentDay, parseDate } from '../../shared/months';\nimport q from '../../shared/query';\nimport {\n insertRule,\n updateRule,\n getRules,\n ruleModel\n} from '../accounts/transaction-rules';\nimport { Rule, Condition } from '../accounts/rules';\nimport {\n extractScheduleConds,\n recurConfigToRSchedule,\n getHasTransactionsQuery,\n getStatus,\n getScheduledAmount\n} from '../../shared/schedules';\nimport { mutator, runMutator } from '../mutators';\nimport { undoable } from '../undo';\nimport { Schedule as RSchedule } from '../util/rschedule';\nimport { addSyncListener, batchMessages } from '../sync';\nimport { captureBreadcrumb } from '../../platform/exceptions';\nimport { addTransactions } from '../accounts/sync';\nimport { findSchedules } from './find-schedules';\n\nconst connection = require('../../platform/server/connection');\nconst uuid = require('../../platform/uuid');\n\n// Utilities\n\nfunction zip(arr1, arr2) {\n let result = [];\n for (let i = 0; i < arr1.length; i++) {\n result.push([arr1[i], arr2[i]]);\n }\n return result;\n}\n\nexport function updateConditions(conditions, newConditions) {\n let scheduleConds = extractScheduleConds(conditions);\n let newScheduleConds = extractScheduleConds(newConditions);\n\n let replacements = zip(\n Object.values(scheduleConds),\n Object.values(newScheduleConds)\n );\n\n let updated = conditions.map(cond => {\n let r = replacements.find(r => cond === r[0]);\n return r && r[1] ? r[1] : cond;\n });\n\n let added = replacements\n .filter(x => x[0] == null && x[1] != null)\n .map(x => x[1]);\n\n return updated.concat(added);\n}\n\nexport function getNextDate(dateCond, start = new Date()) {\n start = d.startOfDay(start);\n\n let cond = new Condition(\n dateCond.op,\n 'date',\n dateCond.value,\n null,\n new Map(Object.entries({ date: 'date' }))\n );\n let value = cond.getValue();\n\n if (value.type === 'date') {\n return value.date;\n } else if (value.type === 'recur') {\n let dates = value.schedule.occurrences({ start, take: 1 }).toArray();\n\n if (dates.length > 0) {\n let date = dates[0].date;\n return dayFromDate(date);\n }\n }\n return null;\n}\n\nexport async function getRuleForSchedule(id) {\n if (id == null) {\n throw new Error('Schedule not attached to a rule');\n }\n\n let { data: ruleId } = await aqlQuery(\n q('schedules')\n .filter({ id })\n .calculate('rule')\n );\n return getRules().find(rule => rule.id === ruleId);\n}\n\nexport async function fixRuleForSchedule(id) {\n let { data: ruleId } = await aqlQuery(\n q('schedules')\n .filter({ id })\n .calculate('rule')\n );\n\n if (ruleId) {\n // Take the bad rule out of the system so it never causes problems\n // in the future\n await db.delete_('rules', ruleId);\n }\n\n let newId = await insertRule({\n stage: null,\n conditions: [\n { op: 'isapprox', field: 'date', value: currentDay() },\n { op: 'isapprox', field: 'amount', value: 0 }\n ],\n actions: [{ op: 'link-schedule', value: id }]\n });\n\n await db.updateWithSchema('schedules', { id, rule: newId });\n\n return getRules().find(rule => rule.id === newId);\n}\n\nexport async function setNextDate({ id, start, conditions, reset }) {\n if (conditions == null) {\n let rule = await getRuleForSchedule(id);\n if (rule == null) {\n throw new Error('No rule found for schedule');\n }\n conditions = rule.serialize().conditions;\n }\n\n let { date: dateCond } = extractScheduleConds(conditions);\n\n let { data: nextDate } = await aqlQuery(\n q('schedules')\n .filter({ id })\n .calculate('next_date')\n );\n\n // Only do this if a date condition exists\n if (dateCond) {\n let newNextDate = getNextDate(\n dateCond,\n start ? start(nextDate) : new Date()\n );\n\n if (newNextDate !== nextDate) {\n // Our `update` functon requires the id of the item and we don't\n // have it, so we need to query it\n let nd = await db.first(\n 'SELECT id, base_next_date_ts FROM schedules_next_date WHERE schedule_id = ?',\n [id]\n );\n\n await db.update(\n 'schedules_next_date',\n reset\n ? {\n id: nd.id,\n base_next_date: toDateRepr(newNextDate),\n base_next_date_ts: Date.now()\n }\n : {\n id: nd.id,\n local_next_date: toDateRepr(newNextDate),\n local_next_date_ts: nd.base_next_date_ts\n }\n );\n }\n }\n}\n\n// Methods\n\nexport async function createSchedule({ schedule, conditions = [] } = {}) {\n let scheduleId = (schedule && schedule.id) || uuid.v4Sync();\n\n let { date: dateCond } = extractScheduleConds(conditions);\n if (dateCond == null) {\n throw new Error('A date condition is required to create a schedule');\n }\n if (dateCond.value == null) {\n throw new Error('Date is required');\n }\n\n let nextDate = getNextDate(dateCond);\n let nextDateRepr = nextDate ? toDateRepr(nextDate) : null;\n\n // Create the rule here based on the info\n let ruleId;\n ruleId = await insertRule({\n stage: null,\n conditions,\n actions: [{ op: 'link-schedule', value: scheduleId }]\n });\n\n let now = Date.now();\n let nextDateId = await db.insertWithUUID('schedules_next_date', {\n schedule_id: scheduleId,\n local_next_date: nextDateRepr,\n local_next_date_ts: now,\n base_next_date: nextDateRepr,\n base_next_date_ts: now\n });\n\n let id = await db.insertWithSchema('schedules', {\n ...schedule,\n id: scheduleId,\n rule: ruleId\n });\n\n return scheduleId;\n}\n\n// TODO: don't allow deleting rules that link schedules\n\nexport async function updateSchedule({ schedule, conditions, resetNextDate }) {\n if (schedule.rule) {\n throw new Error('You cannot change the rule of a schedule');\n }\n\n // We need the rule if there are conditions\n let rule;\n\n // This must be outside the `batchMessages` call because we change\n // and then read data\n if (conditions) {\n let { date: dateCond } = extractScheduleConds(conditions);\n if (dateCond && dateCond.value == null) {\n throw new Error('Date is required');\n }\n\n // We need to get the full rule to merge in the updated\n // conditions\n rule = await getRuleForSchedule(schedule.id);\n\n if (rule == null) {\n // In the edge case that a rule gets corrupted (either by a bug in\n // the system or user messing with their data), don't crash. We\n // generate a new rule because schedules have to have a rule\n // attached to them.\n rule = await fixRuleForSchedule(schedule.id);\n }\n }\n\n await batchMessages(async () => {\n if (conditions) {\n let oldConditions = rule.serialize().conditions;\n let newConditions = updateConditions(oldConditions, conditions);\n\n await updateRule({ id: rule.id, conditions: newConditions });\n\n // Annoyingly, sometimes it has `type` and sometimes it doesn't\n let stripType = ({ type, ...fields }) => fields;\n\n // Update `next_date` if the user forced it, or if the account\n // or date changed. We check account because we don't update\n // schedules automatically for closed account, and the user\n // might switch accounts from a closed one\n if (\n resetNextDate ||\n !deepEqual(\n oldConditions.find(c => c.field === 'account'),\n oldConditions.find(c => c.field === 'account')\n ) ||\n !deepEqual(\n stripType(oldConditions.find(c => c.field === 'date')),\n stripType(newConditions.find(c => c.field === 'date'))\n )\n ) {\n await setNextDate({\n id: schedule.id,\n conditions: newConditions,\n reset: true\n });\n }\n } else if (resetNextDate) {\n await setNextDate({ id: schedule.id, reset: true });\n }\n\n await db.updateWithSchema('schedules', schedule);\n });\n}\n\nexport async function deleteSchedule({ id }) {\n let { data: ruleId } = await aqlQuery(\n q('schedules')\n .filter({ id })\n .calculate('rule')\n );\n\n await batchMessages(async () => {\n await db.delete_('rules', ruleId);\n await db.delete_('schedules', id);\n });\n}\n\nexport async function skipNextDate({ id }) {\n return setNextDate({\n id,\n start: nextDate => {\n return d.addDays(parseDate(nextDate), 1);\n }\n });\n}\n\n// `schedule` here might not be a saved schedule, so it might not have\n// an id\nexport function getPossibleTransactions({ schedule }) {}\n\nexport function discoverSchedules() {\n return findSchedules();\n}\n\nexport async function getUpcomingDates({ config, count }) {\n let rules = recurConfigToRSchedule(config);\n\n try {\n let schedule = new RSchedule({ rrules: rules });\n\n return schedule\n .occurrences({ start: d.startOfDay(new Date()), take: count })\n .toArray()\n .map(date => dayFromDate(date.date));\n } catch (err) {\n captureBreadcrumb(config);\n throw err;\n }\n}\n\n// Services\n\nfunction onRuleUpdate(rule) {\n let { actions, conditions } =\n rule instanceof Rule ? rule.serialize() : ruleModel.toJS(rule);\n\n if (actions && actions.find(a => a.op === 'link-schedule')) {\n let scheduleId = actions.find(a => a.op === 'link-schedule').value;\n\n if (scheduleId) {\n let conds = extractScheduleConds(conditions);\n\n let payeeIdx = conditions.findIndex(c => c === conds.payee);\n let accountIdx = conditions.findIndex(c => c === conds.account);\n let amountIdx = conditions.findIndex(c => c === conds.amount);\n let dateIdx = conditions.findIndex(c => c === conds.date);\n\n db.runQuery(\n 'INSERT OR REPLACE INTO schedules_json_paths (schedule_id, payee, account, amount, date) VALUES (?, ?, ?, ?, ?)',\n [\n scheduleId,\n payeeIdx === -1 ? null : `$[${payeeIdx}]`,\n accountIdx === -1 ? null : `$[${accountIdx}]`,\n amountIdx === -1 ? null : `$[${amountIdx}]`,\n dateIdx === -1 ? null : `$[${dateIdx}]`\n ]\n );\n }\n }\n}\n\nfunction trackJSONPaths() {\n // Populate the table\n db.transaction(() => {\n getRules().forEach(rule => {\n onRuleUpdate(rule);\n });\n });\n\n return addSyncListener(onApplySync);\n}\n\nfunction onApplySync(oldValues, newValues) {\n let found = false;\n newValues.forEach((items, table) => {\n if (table === 'rules') {\n found = true;\n items.forEach(newValue => {\n onRuleUpdate(newValue);\n });\n }\n });\n}\n\n// This is the service that move schedules forward automatically and\n// posts transactions\n\nasync function postTransactionForSchedule({ id }) {\n let { data } = await aqlQuery(\n q('schedules')\n .filter({ id })\n .select('*')\n );\n let schedule = data[0];\n if (schedule == null || schedule._account == null) {\n return;\n }\n\n let transaction = {\n payee: schedule._payee,\n account: schedule._account,\n amount: getScheduledAmount(schedule._amount),\n date: schedule.next_date,\n schedule: schedule.id,\n cleared: false\n };\n\n if (transaction.account) {\n await addTransactions(transaction.account, [transaction]);\n }\n}\n\n// TODO: make this sequential\n\nexport async function advanceSchedulesService(syncSuccess) {\n // Move all paid schedules\n let { data: schedules } = await aqlQuery(\n q('schedules')\n .filter({ completed: false, '_account.closed': false })\n .select('*')\n );\n let { data: hasTransData } = await aqlQuery(\n getHasTransactionsQuery(schedules)\n );\n let hasTrans = new Set(hasTransData.filter(Boolean).map(row => row.schedule));\n\n let failedToPost = [];\n let didPost = false;\n\n for (let schedule of schedules) {\n let status = getStatus(\n schedule.next_date,\n schedule.completed,\n hasTrans.has(schedule.id)\n );\n\n if (status === 'paid') {\n if (schedule._date) {\n // Move forward recurring schedules\n if (schedule._date.frequency) {\n try {\n await setNextDate({ id: schedule.id });\n } catch (err) {\n // This might error if the rule is corrupted and it can't\n // find the rule\n }\n } else {\n if (schedule._date < currentDay()) {\n // Complete any single schedules\n await updateSchedule({\n schedule: { id: schedule.id, completed: true }\n });\n }\n }\n }\n } else if (\n (status === 'due' || status === 'missed') &&\n schedule.posts_transaction &&\n schedule._account\n ) {\n // Automatically create a transaction for due schedules\n if (syncSuccess) {\n await postTransactionForSchedule({ id: schedule.id });\n\n didPost = true;\n } else {\n failedToPost.push(schedule._payee);\n }\n }\n }\n\n if (failedToPost.length > 0) {\n connection.send('schedules-offline', { payees: failedToPost });\n } else if (didPost) {\n // This forces a full refresh of transactions because it\n // simulates them coming in from a full sync. This not a\n // great API right now, but I think generally the approach\n // is sane to treat them as external sync events.\n connection.send('sync-event', {\n type: 'success',\n tables: ['transactions'],\n syncDisabled: 'false'\n });\n }\n}\n\n// Expose functions to the client\nlet app = createApp();\n\napp.method('schedule/create', mutator(undoable(createSchedule)));\napp.method('schedule/update', mutator(undoable(updateSchedule)));\napp.method('schedule/delete', mutator(undoable(deleteSchedule)));\napp.method('schedule/skip-next-date', mutator(undoable(skipNextDate)));\napp.method(\n 'schedule/post-transaction',\n mutator(undoable(postTransactionForSchedule))\n);\napp.method(\n 'schedule/force-run-service',\n mutator(() => advanceSchedulesService(true))\n);\napp.method('schedule/get-possible-transactions', getPossibleTransactions);\napp.method('schedule/discover', discoverSchedules);\napp.method('schedule/get-upcoming-dates', getUpcomingDates);\n\napp.service(trackJSONPaths);\n\napp.events.on('sync', ({ type, subtype }) => {\n let completeEvent =\n type === 'success' || type === 'error' || type === 'unauthorized';\n\n if (completeEvent && prefs.getPrefs()) {\n let { lastScheduleRun } = prefs.getPrefs();\n\n if (lastScheduleRun !== currentDay()) {\n runMutator(() => advanceSchedulesService(type === 'success'));\n\n prefs.savePrefs({ lastScheduleRun: currentDay() });\n }\n }\n});\n\nexport default app;\n","import * as d from 'date-fns';\nimport * as db from '../db';\nimport { Schedule as RSchedule } from '../util/rschedule';\nimport { groupBy } from '../../shared/util';\nimport { fromDateRepr } from '../models';\nimport { runQuery as aqlQuery } from '../aql/schema/run-query';\nimport q from '../../shared/query';\nimport { getApproxNumberThreshold } from '../../shared/rules';\nimport { recurConfigToRSchedule } from '../../shared/schedules';\nimport { dayFromDate, parseDate, subDays } from '../../shared/months';\nimport { conditionsToAQL } from '../accounts/transaction-rules';\nconst uuid = require('../../platform/uuid');\n\nfunction takeDates(config) {\n let schedule = new RSchedule({ rrules: recurConfigToRSchedule(config) });\n return schedule\n .occurrences({ take: 3 })\n .toArray()\n .map(d => d.date);\n}\n\nasync function getTransactions(date, account) {\n let { data } = await aqlQuery(\n q('transactions')\n .filter({\n account,\n schedule: null,\n // Don't match transfers\n 'payee.transfer_acct': null,\n $and: [\n { date: { $gte: d.subDays(date, 2) } },\n { date: { $lte: d.addDays(date, 2) } }\n ]\n })\n .select('*')\n .options({ splits: 'none' })\n );\n return data;\n}\n\nfunction getRank(day1, day2) {\n let dayDiff = Math.abs(d.differenceInDays(parseDate(day1), parseDate(day2)));\n\n // The amount of days off determines the rank: exact same day\n // is highest rank 1, 1 day off is .5, etc. This will find the\n // best start date that matches all the dates the closest\n return 1 / (dayDiff + 1);\n}\n\nexport function matchSchedules(allOccurs, config, partialMatchRank = 0.5) {\n allOccurs = [...allOccurs].reverse();\n let baseOccur = allOccurs[0];\n let occurs = allOccurs.slice(1);\n let schedules = [];\n\n for (let trans of baseOccur.transactions) {\n let threshold = getApproxNumberThreshold(trans.amount);\n let payee = trans.payee;\n let account = trans.account;\n\n let found = occurs.map(occur => {\n let matched = occur.transactions.find(\n t =>\n t.amount >= trans.amount - threshold &&\n t.amount <= trans.amount + threshold\n );\n matched = matched && matched.payee === payee ? matched : null;\n\n if (matched) {\n return { trans: matched, rank: getRank(occur.date, matched.date) };\n }\n return null;\n });\n\n if (found.indexOf(null) !== -1) {\n continue;\n }\n\n let rank = found.reduce(\n (total, match) => total + match.rank,\n getRank(baseOccur.date, trans.date)\n );\n\n let exactAmount = found.reduce(\n (exact, match) => exact && match.trans.amount === trans.amount,\n true\n );\n\n schedules.push({\n rank,\n amount: trans.amount,\n account: trans.account,\n payee: trans.payee,\n date: config,\n // Exact dates rank as 1, so all of them matches exactly it\n // would equal the number of `allOccurs`\n exactDate: rank === allOccurs.length,\n exactAmount\n });\n }\n\n return schedules;\n}\n\nasync function schedulesForPattern(\n baseStart,\n numDays,\n baseConfig,\n accountId,\n partialMatchRank\n) {\n let schedules = [];\n\n let i = 0;\n for (let i = 0; i < numDays; i++) {\n let start = d.addDays(baseStart, i);\n let config;\n if (typeof baseConfig === 'function') {\n config = baseConfig(start);\n\n if (config === false) {\n // Skip this one\n continue;\n }\n } else {\n config = { ...baseConfig, start };\n }\n\n // Our recur config expects a day string, not a native date format\n config.start = dayFromDate(config.start);\n\n let data = [];\n let dates = takeDates(config);\n for (let date of dates) {\n data.push({\n date: dayFromDate(date),\n transactions: await getTransactions(date, accountId)\n });\n }\n\n schedules = schedules.concat(\n matchSchedules(data, config, partialMatchRank)\n );\n }\n return schedules;\n}\n\nasync function weekly(startDate, accountId) {\n return schedulesForPattern(\n d.subWeeks(parseDate(startDate), 4),\n 7 * 2,\n { frequency: 'weekly' },\n accountId\n );\n}\n\nasync function every2weeks(startDate, accountId) {\n return schedulesForPattern(\n // 6 weeks would cover 3 instances, but we also scan an addition\n // week back\n d.subWeeks(parseDate(startDate), 7),\n 7 * 2,\n { frequency: 'weekly', interval: 2 },\n accountId\n );\n}\n\nasync function monthly(startDate, accountId) {\n return schedulesForPattern(\n d.subMonths(parseDate(startDate), 4),\n 31 * 2,\n start => {\n // 28 is the max number of days that all months are guaranteed\n // to have. We don't want to go any higher than that because\n // we'll end up skipping months that don't have that day.\n // The use cases of end of month days will be covered with the\n // `monthlyLastDay` pattern;\n if (d.getDate(start) > 28) {\n return false;\n }\n return { start, frequency: 'monthly' };\n },\n accountId\n );\n}\n\nasync function monthlyLastDay(startDate, accountId) {\n // We do two separate calls because this pattern doesn't fit into\n // how `schedulesForPattern` works\n let s1 = await schedulesForPattern(\n d.subMonths(parseDate(startDate), 3),\n 1,\n { frequency: 'monthly', patterns: [{ type: 'day', value: -1 }] },\n accountId,\n // Last day patterns should win over day-specific ones that just\n // happen to match\n 0.75\n );\n\n let s2 = await schedulesForPattern(\n d.subMonths(parseDate(startDate), 4),\n 1,\n { frequency: 'monthly', patterns: [{ type: 'day', value: -1 }] },\n accountId,\n 0.75\n );\n\n return s1.concat(s2);\n}\n\nasync function monthly1stor3rd(startDate, accountId) {\n return schedulesForPattern(\n d.subWeeks(parseDate(startDate), 8),\n 14,\n start => {\n let day = d.format(new Date(), 'iiii');\n let dayValue = day.slice(0, 2).toUpperCase();\n\n return {\n start,\n frequency: 'monthly',\n patterns: [{ type: dayValue, value: 1 }, { type: dayValue, value: 3 }]\n };\n },\n accountId\n );\n}\n\nasync function monthly2ndor4th(startDate, accountId) {\n return schedulesForPattern(\n d.subMonths(parseDate(startDate), 8),\n 14,\n start => {\n let day = d.format(new Date(), 'iiii');\n let dayValue = day.slice(0, 2).toUpperCase();\n\n return {\n start,\n frequency: 'monthly',\n patterns: [{ type: dayValue, value: 2 }, { type: dayValue, value: 4 }]\n };\n },\n accountId\n );\n}\n\nasync function findStartDate(schedule) {\n let conditions = schedule._conditions;\n let dateCond = conditions.find(c => c.field === 'date');\n let currentConfig = dateCond.value;\n\n while (1) {\n let prevConfig = currentConfig;\n currentConfig = { ...prevConfig };\n\n switch (currentConfig.frequency) {\n case 'weekly':\n currentConfig.start = dayFromDate(\n d.subWeeks(\n parseDate(currentConfig.start),\n currentConfig.interval || 1\n )\n );\n\n break;\n case 'monthly':\n currentConfig.start = dayFromDate(\n d.subMonths(\n parseDate(currentConfig.start),\n currentConfig.interval || 1\n )\n );\n break;\n case 'yearly':\n currentConfig.start = dayFromDate(\n d.subYears(\n parseDate(currentConfig.start),\n currentConfig.interval || 1\n )\n );\n break;\n default:\n throw new Error('findStartDate: invalid frequency');\n }\n\n let newConditions = conditions.map(c =>\n c.field === 'date' ? { ...c, value: currentConfig } : c\n );\n\n let { filters, errors } = conditionsToAQL(newConditions, {\n recurDateBounds: 1\n });\n if (errors.length > 0) {\n // Somehow we generated an invalid config. Abort the whole\n // process and don't change the date at all\n currentConfig = null;\n break;\n }\n\n let { data } = await aqlQuery(\n q('transactions')\n .filter({ $and: filters })\n .select('*')\n );\n\n if (data.length === 0) {\n // No data, revert back to the last valid value and stop\n currentConfig = prevConfig;\n break;\n }\n }\n\n if (currentConfig) {\n return {\n ...schedule,\n date: currentConfig,\n _conditions: conditions.map(c =>\n c.field === 'date' ? { ...c, value: currentConfig } : c\n )\n };\n }\n return schedule;\n}\n\nexport async function findSchedules() {\n // Patterns to look for:\n // * Weekly\n // * Every two weeks\n // * Monthly on day X\n // * Monthly on every 1st or 3rd day\n // * Monthly on every 2nd or 4th day\n //\n // Search for them approx (+- 2 days) but track which transactions\n // and find the best one...\n\n let { data: accounts } = await aqlQuery(\n q('accounts')\n .filter({ closed: false })\n .select('*')\n );\n\n let allSchedules = [];\n\n for (let account of accounts) {\n // Find latest transaction-ish to start with\n let latestTrans = await db.first(\n 'SELECT * FROM v_transactions WHERE account = ? AND parent_id IS NULL ORDER BY date DESC LIMIT 1',\n [account.id]\n );\n\n if (latestTrans) {\n let latestDate = fromDateRepr(latestTrans.date);\n allSchedules = allSchedules.concat(\n await weekly(latestDate, account.id),\n await every2weeks(latestDate, account.id),\n await monthly(latestDate, account.id),\n await monthlyLastDay(latestDate, account.id),\n await monthly1stor3rd(latestDate, account.id),\n await monthly2ndor4th(latestDate, account.id)\n );\n }\n }\n\n let schedules = [...groupBy(allSchedules, 'payee').entries()].map(\n ([payeeId, schedules]) => {\n schedules.sort((s1, s2) => s2.rank - s1.rank);\n let winner = schedules[0];\n\n // Convert to schedule and return it\n return {\n id: uuid.v4Sync(),\n account: winner.account,\n payee: winner.payee,\n date: winner.date,\n amount: winner.amount,\n _conditions: [\n { op: 'is', field: 'account', value: winner.account },\n { op: 'is', field: 'payee', value: winner.payee },\n {\n op: winner.exactDate ? 'is' : 'isapprox',\n field: 'date',\n value: winner.date\n },\n {\n op: winner.exactAmount ? 'is' : 'isapprox',\n field: 'amount',\n value: winner.amount\n }\n ]\n };\n }\n );\n\n let finalized = [];\n for (let schedule of schedules) {\n finalized.push(await findStartDate(schedule));\n }\n return finalized;\n}\n","import fs from '../platform/server/fs';\n\nlet config = null;\n\nfunction joinURL(base, ...paths) {\n let url = new URL(base);\n url.pathname = fs.join(...paths);\n return url.toString();\n}\n\nexport function setServer(url) {\n if (url == null) {\n config = null;\n } else {\n config = getServer(url);\n }\n}\n\n// `url` is optional; if not given it will provide the global config\nexport function getServer(url) {\n if (url) {\n return {\n BASE_SERVER: url,\n SYNC_SERVER: joinURL(url, '/sync'),\n SIGNUP_SERVER: joinURL(url, '/account'),\n PLAID_SERVER: joinURL(url, '/plaid')\n };\n }\n return config;\n}\n","import Spreadsheet from './spreadsheet/spreadsheet';\nimport * as prefs from './prefs';\nimport { captureBreadcrumb } from '../platform/exceptions';\nimport * as sqlite from '../platform/server/sqlite';\nimport { sheetForMonth } from '../shared/months';\nimport Platform from './platform';\nconst { resolveName } = require('./spreadsheet/util');\n\nlet globalSheet, globalOnChange;\nlet globalCacheDb;\n\nexport function get() {\n return globalSheet;\n}\n\nasync function updateSpreadsheetCache(rawDb, names) {\n await sqlite.transaction(rawDb, () => {\n names.forEach(name => {\n const node = globalSheet._getNode(name);\n\n // Don't cache query nodes yet\n if (node.sql == null) {\n sqlite.runQuery(\n rawDb,\n 'INSERT OR REPLACE INTO kvcache (key, value) VALUES (?, ?)',\n [name, JSON.stringify(node.value)]\n );\n }\n });\n });\n}\n\nfunction setCacheStatus(mainDb, cacheDb, { clean }) {\n if (clean) {\n // Generate random number and stick in both places\n let num = Math.random() * 10000000;\n sqlite.runQuery(\n cacheDb,\n 'INSERT OR REPLACE INTO kvcache_key (id, key) VALUES (1, ?)',\n [num]\n );\n\n if (mainDb) {\n sqlite.runQuery(\n mainDb,\n 'INSERT OR REPLACE INTO kvcache_key (id, key) VALUES (1, ?)',\n [num]\n );\n }\n } else {\n sqlite.runQuery(cacheDb, 'DELETE FROM kvcache_key');\n }\n}\n\nfunction isCacheDirty(mainDb, cacheDb) {\n let rows = sqlite.runQuery(\n cacheDb,\n 'SELECT key FROM kvcache_key WHERE id = 1',\n [],\n true\n );\n let num = rows.length === 0 ? null : rows[0].key;\n\n if (num == null) {\n return true;\n }\n\n if (mainDb) {\n let rows = sqlite.runQuery(\n mainDb,\n 'SELECT key FROM kvcache_key WHERE id = 1',\n [],\n true\n );\n if (rows.length === 0 || rows[0].key !== num) {\n return true;\n }\n }\n\n // Always also check if there is anything in `kvcache`. We ask for one item;\n // if we didn't get back anything it's empty so there is no cache\n rows = sqlite.runQuery(cacheDb, 'SELECT * FROM kvcache LIMIT 1', [], true);\n return rows.length === 0;\n}\n\nexport async function loadSpreadsheet(db, onSheetChange) {\n let cacheEnabled = !global.__TESTING__;\n let mainDb = db.getDatabase();\n let cacheDb;\n\n if (Platform.isDesktop && cacheEnabled) {\n // Desktop apps use a separate database for the cache. This is because it is\n // much more likely to directly work with files on desktop, and this makes\n // it a lot clearer what the true filesize of the main db is (and avoid\n // copying the cache data around).\n let cachePath = db.getDatabasePath().replace(/db\\.sqlite$/, 'cache.sqlite');\n globalCacheDb = cacheDb = sqlite.openDatabase(cachePath);\n\n sqlite.execQuery(\n cacheDb,\n `\n CREATE TABLE IF NOT EXISTS kvcache (key TEXT PRIMARY KEY, value TEXT);\n CREATE TABLE IF NOT EXISTS kvcache_key (id INTEGER PRIMARY KEY, key REAL)\n `\n );\n } else {\n // All other platforms use the same database for cache\n cacheDb = mainDb;\n }\n\n let sheet;\n if (cacheEnabled) {\n sheet = new Spreadsheet(\n updateSpreadsheetCache.bind(null, cacheDb),\n setCacheStatus.bind(null, mainDb, cacheDb)\n );\n } else {\n sheet = new Spreadsheet();\n }\n\n captureBreadcrumb({\n message: 'loading spreaadsheet',\n category: 'server'\n });\n\n globalSheet = sheet;\n globalOnChange = onSheetChange;\n\n if (onSheetChange) {\n sheet.addEventListener('change', onSheetChange);\n }\n\n if (cacheEnabled && !isCacheDirty(mainDb, cacheDb)) {\n let cachedRows = await sqlite.runQuery(\n cacheDb,\n 'SELECT * FROM kvcache',\n [],\n true\n );\n console.log(`Loaded spreadsheet from cache (${cachedRows.length} items)`);\n\n for (let row of cachedRows) {\n let parsed = JSON.parse(row.value);\n sheet.load(row.key, parsed);\n }\n } else {\n console.log('Loading fresh spreadsheet');\n await loadUserBudgets(db);\n }\n\n captureBreadcrumb({\n message: 'loaded spreaadsheet',\n category: 'server'\n });\n\n return sheet;\n}\n\nexport function unloadSpreadsheet() {\n if (globalSheet) {\n // TODO: Should wait for the sheet to finish\n globalSheet.unload();\n globalSheet = null;\n }\n\n if (globalCacheDb) {\n sqlite.closeDatabase(globalCacheDb);\n globalCacheDb = null;\n }\n}\n\nexport async function reloadSpreadsheet(db) {\n if (globalSheet) {\n unloadSpreadsheet();\n return loadSpreadsheet(db, globalOnChange);\n }\n}\n\nexport async function loadUserBudgets(db) {\n let sheet = globalSheet;\n\n // TODO: Clear out the cache here so make sure future loads of the app\n // don't load any extra values that aren't set here\n\n let { budgetType } = prefs.getPrefs() || {};\n\n let table = budgetType === 'report' ? 'reflect_budgets' : 'zero_budgets';\n let budgets = await db.all(`\n SELECT * FROM ${table} b\n LEFT JOIN categories c ON c.id = b.category\n WHERE c.tombstone = 0\n `);\n\n sheet.startTransaction();\n\n // Load all the budget amounts and carryover values\n for (let budget of budgets) {\n if (budget.month && budget.category) {\n let sheetName = `budget${budget.month}`;\n sheet.set(`${sheetName}!budget-${budget.category}`, budget.amount);\n sheet.set(\n `${sheetName}!carryover-${budget.category}`,\n budget.carryover === 1 ? true : false\n );\n }\n }\n\n // For zero-based budgets, load the buffered amounts\n if (budgetType !== 'report') {\n let budgetMonths = await db.all('SELECT * FROM zero_budget_months');\n for (let budgetMonth of budgetMonths) {\n let sheetName = sheetForMonth(budgetMonth.id);\n sheet.set(`${sheetName}!buffered`, budgetMonth.buffered);\n }\n }\n\n sheet.endTransaction();\n}\n\nexport function getCell(sheet, name) {\n return globalSheet._getNode(resolveName(sheet, name));\n}\n\nexport function getCellValue(sheet, name) {\n return globalSheet.getValue(resolveName(sheet, name));\n}\n\nexport function startTransaction() {\n if (globalSheet) {\n globalSheet.startTransaction();\n }\n}\n\nexport function endTransaction() {\n if (globalSheet) {\n globalSheet.endTransaction();\n }\n}\n\nexport function waitOnSpreadsheet() {\n return new Promise(resolve => {\n if (globalSheet) {\n globalSheet.onFinish(resolve);\n } else {\n resolve();\n }\n });\n}\n","function first(arr) {\n return arr[0];\n}\n\nfunction firstValue(arr) {\n const keys = Object.keys(arr[0]);\n return arr[0][keys[0]];\n}\n\nfunction number(v) {\n if (typeof v === 'number') {\n return v;\n } else if (typeof v === 'string') {\n const parsed = parseFloat(v);\n if (isNaN(parsed)) {\n return 0;\n }\n return parsed;\n }\n\n return 0;\n}\n\nfunction min(x, y) {\n return Math.min(x, y);\n}\n\nfunction max(x, y) {\n return Math.max(x, y);\n}\n\nmodule.exports = {\n first,\n firstValue,\n number,\n min,\n max\n};\n","function Graph(serialized) {\n var graph = {\n addNode,\n removeNode,\n adjacent,\n adjacentIncoming,\n addEdge,\n removeEdge,\n removeIncomingEdges,\n topologicalSort,\n generateDOT,\n getEdges\n };\n\n var edges = new Map();\n var incomingEdges = new Map();\n\n function getEdges() {\n return { edges, incomingEdges };\n }\n\n function addNode(node) {\n edges.set(node, adjacent(node));\n incomingEdges.set(node, adjacentIncoming(node));\n return graph;\n }\n\n function removeIncomingEdges(node) {\n const incoming = adjacentIncoming(node);\n incomingEdges.set(node, new Set());\n\n let iter = incoming.values();\n let cur = iter.next();\n while (!cur.done) {\n removeEdge(cur.value, node);\n cur = iter.next();\n }\n }\n\n function removeNode(node) {\n removeIncomingEdges(node);\n edges.delete(node);\n incomingEdges.delete(node);\n }\n\n function adjacent(node) {\n return edges.get(node) || new Set();\n }\n\n function adjacentIncoming(node) {\n return incomingEdges.get(node) || new Set();\n }\n\n // Adds an edge from node u to node v.\n // Implicitly adds the nodes if they were not already added.\n function addEdge(node1, node2) {\n addNode(node1);\n addNode(node2);\n adjacent(node1).add(node2);\n adjacentIncoming(node2).add(node1);\n return graph;\n }\n\n // Removes the edge from node u to node v.\n // Does not remove the nodes.\n // Does nothing if the edge does not exist.\n function removeEdge(node1, node2) {\n if (edges.has(node1)) {\n adjacent(node1).delete(node2);\n }\n if (incomingEdges.has(node2)) {\n adjacentIncoming(node2).delete(node1);\n }\n return graph;\n }\n\n function topologicalSortUntil(name, visited, sorted) {\n visited.add(name);\n\n let iter = adjacent(name).values();\n let cur = iter.next();\n while (!cur.done) {\n if (!visited.has(cur.value)) {\n topologicalSortUntil(cur.value, visited, sorted);\n }\n cur = iter.next();\n }\n\n sorted.unshift(name);\n }\n\n function topologicalSort(sourceNodes) {\n const visited = new Set();\n const sorted = [];\n\n sourceNodes.forEach(name => {\n if (!visited.has(name)) {\n topologicalSortUntil(name, visited, sorted);\n }\n });\n\n return sorted;\n }\n\n function generateDOT() {\n let edgeStrings = [];\n edges.forEach(function(adj, edge) {\n if (adj.length !== 0) {\n edgeStrings.push(`${edge} -> {${adj.join(',')}}`);\n }\n });\n\n return `\n digraph G {\n ${edgeStrings.join('\\n').replace(/!/g, '_')}\n }\n `;\n }\n\n return graph;\n}\n\nmodule.exports = Graph;\n","import mitt from 'mitt';\nimport { schema, schemaConfig } from '../aql/schema';\nimport { compileQuery } from '../aql/compiler';\nimport { runCompiledQuery } from '../aql/schema/run-query';\n\nconst Graph = require('./graph-data-structure');\nconst { unresolveName, resolveName } = require('./util');\n\nexport default class Spreadsheet {\n constructor(saveCache, setCacheStatus) {\n this.graph = new Graph();\n this.nodes = new Map();\n this.transactionDepth = 0;\n this.saveCache = saveCache;\n this.setCacheStatus = setCacheStatus;\n this.dirtyCells = [];\n this.computeQueue = [];\n this.events = mitt();\n this._meta = {\n createdMonths: new Set()\n };\n }\n\n meta() {\n return this._meta;\n }\n\n setMeta(meta) {\n this._meta = meta;\n }\n\n // Spreadsheet interface\n\n _getNode(name) {\n const { sheet } = unresolveName(name);\n\n if (!this.nodes.has(name)) {\n this.nodes.set(name, {\n name,\n expr: null,\n value: null,\n sheet: sheet\n });\n }\n return this.nodes.get(name);\n }\n\n getNode(name) {\n return this._getNode(name);\n }\n\n hasCell(name) {\n return this.nodes.has(name);\n }\n\n add(name, expr, value) {\n this.set(name, expr);\n }\n\n getNodes() {\n return this.nodes;\n }\n\n serialize() {\n return {\n graph: this.graph.getEdges(),\n nodes: [...this.nodes.entries()]\n };\n }\n\n transaction(func) {\n this.startTransaction();\n try {\n func();\n } catch (e) {\n console.log(e);\n }\n return this.endTransaction();\n }\n\n startTransaction() {\n this.transactionDepth++;\n }\n\n endTransaction() {\n this.transactionDepth--;\n\n if (this.transactionDepth === 0) {\n const cells = this.dirtyCells;\n this.dirtyCells = [];\n\n this.queueComputation(this.graph.topologicalSort(cells));\n }\n\n return [];\n }\n\n queueComputation(cellNames) {\n // TODO: Formally write out the different cases when the existing\n // queue is not empty. There should be cases where we can easily\n // optimize this by skipping computations if we know they are\n // going to be computed again. The hard thing is to ensure that\n // the order of computations stays correct\n\n this.computeQueue = this.computeQueue.concat(cellNames);\n\n // Begin running on the next tick so we guarantee that it doesn't finish\n // within the same tick. Since some computations are async, this makes it\n // consistent (otherwise it would only sometimes finish sync)\n Promise.resolve().then(() => {\n if (!this.running) {\n this.runComputations();\n }\n });\n }\n\n runComputations(idx = 0) {\n this.running = true;\n\n while (idx < this.computeQueue.length) {\n let name = this.computeQueue[idx];\n let node;\n let result;\n\n try {\n node = this.getNode(name);\n\n if (node._run) {\n let args = node._dependencies.map(dep => {\n return this.getNode(dep).value;\n });\n\n result = node._run(...args);\n\n if (result instanceof Promise) {\n console.warn(\n 'dynamic cell returned a promise! this is discouraged because errors are not handled properly'\n );\n }\n } else if (node.sql) {\n result = runCompiledQuery(\n node.query,\n node.sql.sqlPieces,\n node.sql.state\n );\n } else {\n idx++;\n continue;\n }\n } catch (e) {\n console.log('Error while evaluating ' + name + ':', e);\n // If an error happens, bail on the rest of the computations\n this.running = false;\n this.computeQueue = [];\n return;\n }\n\n if (result instanceof Promise) {\n // When the cell is finished computing, finish computing the\n // rest\n result.then(\n value => {\n node.value = value;\n this.runComputations(idx + 1);\n },\n err => {\n // TODO: use captureException here\n console.warn(`Failed running ${node.name}!`, err);\n this.runComputations(idx + 1);\n }\n );\n\n return;\n } else {\n node.value = result;\n }\n\n idx++;\n }\n\n // If everything computed in one loop (no async operations) notify\n // the user and empty the queue\n if (idx === this.computeQueue.length) {\n this.events.emit('change', { names: this.computeQueue });\n\n // Cache the updated cells\n if (this.saveCache) {\n this.saveCache(this.computeQueue);\n }\n this.markCacheSafe();\n\n this.running = false;\n this.computeQueue = [];\n }\n }\n\n markCacheSafe() {\n if (!this.cacheBarrier) {\n if (this.setCacheStatus) {\n this.setCacheStatus({ clean: true });\n }\n }\n }\n\n markCacheDirty() {\n if (this.setCacheStatus) {\n this.setCacheStatus({ clean: false });\n }\n }\n\n startCacheBarrier() {\n this.cacheBarrier = true;\n this.markCacheDirty();\n }\n\n endCacheBarrier() {\n this.cacheBarrier = false;\n\n let pendingChange = this.running || this.computeQueue.length > 0;\n if (!pendingChange) {\n this.markCacheSafe();\n }\n }\n\n addEventListener(name, func) {\n this.events.on(name, func);\n return () => this.events.off(name, func);\n }\n\n onFinish(func) {\n if (this.transactionDepth !== 0) {\n throw new Error(\n 'onFinish called while inside a spreadsheet transaction. This is not allowed as it will lead to race conditions'\n );\n }\n\n if (!this.running && this.computeQueue.length === 0) {\n func([]);\n // The remove function does nothing\n return () => {};\n }\n\n let remove = this.addEventListener('change', (...args) => {\n remove();\n return func(...args);\n });\n return remove;\n }\n\n unload() {\n this.events.all.clear();\n }\n\n getValue(name) {\n return this.getNode(name).value;\n }\n\n getExpr(name) {\n return this.getNode(name).expr;\n }\n\n getCellValue(sheet, name) {\n return this.getNode(resolveName(sheet, name)).value;\n }\n\n getCellExpr(sheet, name) {\n return this.getNode(resolveName(sheet, name)).expr;\n }\n\n getCellValueLoose(sheetName, cellName) {\n let name = resolveName(sheetName, cellName);\n if (this.nodes.has(name)) {\n return this.getNode(name).value;\n }\n return null;\n }\n\n bootup(onReady) {\n this.onFinish(() => {\n onReady();\n });\n }\n\n load(name, value) {\n const node = this._getNode(name);\n node.expr = value;\n node.value = value;\n }\n\n create(name, value) {\n return this.transaction(() => {\n const node = this._getNode(name);\n node.expr = value;\n node.value = value;\n this._markDirty(name);\n });\n }\n\n set(name, value) {\n this.create(name, value);\n }\n\n recompute(name) {\n this.transaction(() => {\n this.dirtyCells.push(name);\n });\n }\n\n recomputeAll() {\n // Recompute everything!\n this.transaction(() => {\n this.dirtyCells = [...this.nodes.keys()];\n });\n }\n\n createQuery(sheetName, cellName, query) {\n let name = resolveName(sheetName, cellName);\n let node = this._getNode(name);\n\n if (node.query !== query) {\n node.query = query;\n let { sqlPieces, state } = compileQuery(node.query, schema, schemaConfig);\n node.sql = { sqlPieces, state };\n\n this.transaction(() => {\n this._markDirty(name);\n });\n }\n }\n\n createStatic(sheetName, cellName, initialValue) {\n let name = resolveName(sheetName, cellName);\n let exists = this.nodes.has(name);\n if (!exists) {\n this.create(name, initialValue);\n }\n }\n\n createDynamic(\n sheetName,\n cellName,\n { dependencies = [], run, initialValue, refresh }\n ) {\n let name = resolveName(sheetName, cellName);\n let node = this._getNode(name);\n\n if (node.dynamic) {\n // If it already exists, do nothing\n return;\n }\n\n node.dynamic = true;\n node._run = run;\n\n dependencies = dependencies.map(dep => {\n let resolved;\n if (!unresolveName(dep).sheet) {\n resolved = resolveName(sheetName, dep);\n } else {\n resolved = dep;\n }\n\n return resolved;\n });\n\n node._dependencies = dependencies;\n\n // TODO: diff these\n this.graph.removeIncomingEdges(name);\n dependencies.forEach(dep => {\n this.graph.addEdge(dep, name);\n });\n\n if (node.value == null || refresh) {\n this.transaction(() => {\n node.value = initialValue;\n this._markDirty(name);\n });\n }\n }\n\n clearSheet(sheetName) {\n for (let [name, node] of this.nodes.entries()) {\n if (node.sheet === sheetName) {\n this.nodes.delete(name);\n }\n }\n }\n\n voidCell(sheetName, name, voidValue = null) {\n let node = this.getNode(resolveName(sheetName, name));\n node._run = null;\n node.dynamic = false;\n node.value = voidValue;\n }\n\n deleteCell(sheetName, name) {\n this.voidCell(sheetName, name);\n this.nodes.delete(resolveName(sheetName, name));\n }\n\n addDependencies(sheetName, cellName, deps) {\n let name = resolveName(sheetName, cellName);\n\n deps = deps.map(dep => {\n if (!unresolveName(dep).sheet) {\n return resolveName(sheetName, dep);\n }\n return dep;\n });\n\n let node = this.getNode(name);\n let newDeps = deps.filter(\n dep => (node._dependencies || []).indexOf(dep) === -1\n );\n\n if (newDeps.length > 0) {\n node._dependencies = (node._dependencies || []).concat(newDeps);\n newDeps.forEach(dep => {\n this.graph.addEdge(dep, name);\n });\n this.recompute(name);\n }\n }\n\n removeDependencies(sheetName, cellName, deps) {\n let name = resolveName(sheetName, cellName);\n\n deps = deps.map(dep => {\n if (!unresolveName(dep).sheet) {\n return resolveName(sheetName, dep);\n }\n return dep;\n });\n\n let node = this.getNode(name);\n\n node._dependencies = (node._dependencies || []).filter(\n dep => deps.indexOf(dep) === -1\n );\n\n deps.forEach(dep => {\n this.graph.removeEdge(dep, name);\n });\n this.recompute(name);\n }\n\n _markDirty(name) {\n this.dirtyCells.push(name);\n }\n\n triggerDatabaseChanges(oldValues, newValues) {\n let tables = new Set([...oldValues.keys(), ...newValues.keys()]);\n\n this.startTransaction();\n // TODO: Create an index of deps so we don't have to iterate\n // across all nodes\n this.nodes.forEach(node => {\n if (\n node.sql &&\n node.sql.state.dependencies.some(dep => tables.has(dep))\n ) {\n this._markDirty(node.name);\n }\n });\n this.endTransaction();\n }\n}\n","function unresolveName(name) {\n let idx = name.indexOf('!');\n if (idx !== -1) {\n return {\n sheet: name.slice(0, idx),\n name: name.slice(idx + 1)\n };\n }\n return { sheet: null, name };\n}\n\nfunction resolveName(sheet, name) {\n return sheet + '!' + name;\n}\n\nfunction resolveNamesAsObjects(sheets) {\n const cells = {};\n Object.keys(sheets).forEach(sheetName => {\n const sheet = sheets[sheetName];\n\n Object.keys(sheet).forEach(name => {\n const expr = sheet[name];\n cells[resolveName(sheetName, name)] = expr;\n });\n });\n return cells;\n}\n\nfunction resolveNamesAsArrays(sheets) {\n const cells = [];\n Object.keys(sheets).forEach(sheetName => {\n const sheet = sheets[sheetName];\n\n sheet.forEach(name => {\n const expr = sheet[name];\n cells.push(resolveName(sheetName, name));\n });\n });\n return cells;\n}\n\nmodule.exports = {\n unresolveName,\n resolveName,\n resolveNamesAsObjects,\n resolveNamesAsArrays\n};\n","import encryption from '../encryption';\nimport * as prefs from '../prefs';\nlet { SyncError } = require('../errors');\nlet SyncPb = require('./proto/sync_pb');\n\nfunction coerceBuffer(value) {\n // The web encryption APIs give us back raw Uint8Array... but our\n // encryption code assumes we can work with it as a buffer. This is\n // a leaky abstraction and ideally the our abstraction over the web\n // encryption APIs should do this.\n if (!Buffer.isBuffer(value)) {\n return Buffer.from(value);\n }\n return value;\n}\n\nexport async function encode(groupId, fileId, since, messages) {\n let { encryptKeyId } = prefs.getPrefs();\n let requestPb = new SyncPb.SyncRequest();\n\n for (let i = 0; i < messages.length; i++) {\n let msg = messages[i];\n let envelopePb = new SyncPb.MessageEnvelope();\n envelopePb.setTimestamp(msg.timestamp);\n\n let messagePb = new SyncPb.Message();\n messagePb.setDataset(msg.dataset);\n messagePb.setRow(msg.row);\n messagePb.setColumn(msg.column);\n messagePb.setValue(msg.value);\n let binaryMsg = messagePb.serializeBinary();\n\n if (encryptKeyId) {\n let encrypted = new SyncPb.EncryptedData();\n\n let result;\n try {\n result = await encryption.encrypt(binaryMsg, encryptKeyId);\n } catch (e) {\n throw new SyncError('encrypt-failure', {\n isMissingKey: e.message === 'missing-key'\n });\n }\n\n encrypted.setData(result.value);\n encrypted.setIv(Buffer.from(result.meta.iv, 'base64'));\n encrypted.setAuthtag(Buffer.from(result.meta.authTag, 'base64'));\n\n envelopePb.setContent(encrypted.serializeBinary());\n envelopePb.setIsencrypted(true);\n } else {\n envelopePb.setContent(binaryMsg);\n }\n\n requestPb.addMessages(envelopePb);\n }\n\n requestPb.setGroupid(groupId);\n requestPb.setFileid(fileId);\n requestPb.setKeyid(encryptKeyId);\n requestPb.setSince(since);\n\n return requestPb.serializeBinary();\n}\n\nexport async function decode(data) {\n let { encryptKeyId } = prefs.getPrefs();\n\n let responsePb = SyncPb.SyncResponse.deserializeBinary(data);\n let merkle = JSON.parse(responsePb.getMerkle());\n let list = responsePb.getMessagesList();\n let messages = [];\n\n for (let i = 0; i < list.length; i++) {\n let envelopePb = list[i];\n let timestamp = envelopePb.getTimestamp();\n let encrypted = envelopePb.getIsencrypted();\n let msg;\n\n if (encrypted) {\n let binary = SyncPb.EncryptedData.deserializeBinary(\n envelopePb.getContent()\n );\n\n let decrypted;\n try {\n decrypted = await encryption.decrypt(coerceBuffer(binary.getData()), {\n keyId: encryptKeyId,\n algorithm: 'aes-256-gcm',\n iv: coerceBuffer(binary.getIv()),\n authTag: coerceBuffer(binary.getAuthtag())\n });\n } catch (e) {\n console.log(e);\n throw new SyncError('decrypt-failure', {\n isMissingKey: e.message === 'missing-key'\n });\n }\n\n msg = SyncPb.Message.deserializeBinary(decrypted);\n } else {\n msg = SyncPb.Message.deserializeBinary(envelopePb.getContent());\n }\n\n messages.push({\n timestamp: timestamp,\n dataset: msg.getDataset(),\n row: msg.getRow(),\n column: msg.getColumn(),\n value: msg.getValue()\n });\n }\n\n return { messages, merkle };\n}\n","import { sequential, once } from '../../shared/async';\nimport * as perf from '../perf';\nimport * as prefs from '../prefs';\nimport app from '../main-app';\nimport asyncStorage from '../../platform/server/asyncStorage';\nimport { captureException } from '../../platform/exceptions';\nimport logger from '../../platform/server/log';\nimport { postBinary } from '../post';\nimport * as db from '../db';\nimport * as sheet from '../sheet';\nimport { triggerBudgetChanges, setType as setBudgetType } from '../budget/base';\nimport * as undo from '../undo';\nimport { runMutator } from '../mutators';\nimport { setIn, getIn } from '../../shared/util';\nimport Timestamp, {\n serializeClock,\n deserializeClock,\n getClock\n} from '../timestamp';\nimport * as merkle from '../merkle';\nimport * as encoder from './encoder';\nimport { getServer } from '../server-config';\nimport { rebuildMerkleHash } from './repair';\n\nconst { PostError, SyncError } = require('../errors');\nconst connection = require('../../platform/server/connection');\n\nlet FULL_SYNC_DELAY = 1000;\nlet SYNCING_MODE = 'enabled';\n\nexport function setSyncingMode(mode) {\n let prevMode = SYNCING_MODE;\n switch (mode) {\n case 'enabled':\n SYNCING_MODE = 'enabled';\n break;\n case 'offline':\n SYNCING_MODE = 'offline';\n break;\n case 'disabled':\n SYNCING_MODE = 'disabled';\n break;\n case 'import':\n SYNCING_MODE = 'import';\n break;\n default:\n throw new Error('setSyncingMode: invalid mode: ' + mode);\n }\n return prevMode;\n}\n\nexport function checkSyncingMode(mode) {\n switch (mode) {\n case 'enabled':\n return SYNCING_MODE === 'enabled' || SYNCING_MODE === 'offline';\n case 'disabled':\n return SYNCING_MODE === 'disabled' || SYNCING_MODE === 'import';\n case 'offline':\n return SYNCING_MODE === 'offline';\n case 'import':\n return SYNCING_MODE === 'import';\n default:\n throw new Error('checkSyncingMode: invalid mode: ' + mode);\n }\n}\n\nexport makeTestMessage from './make-test-message';\nexport resetSync from './reset';\nexport repairSync from './repair';\n\nfunction apply(msg, prev) {\n let { dataset, row, column, value } = msg;\n\n if (dataset === 'prefs') {\n // Do nothing, it doesn't exist in the db\n } else {\n try {\n let query;\n if (prev) {\n query = {\n sql: db.cache(`UPDATE ${dataset} SET ${column} = ? WHERE id = ?`),\n params: [value, row]\n };\n } else {\n query = {\n sql: db.cache(`INSERT INTO ${dataset} (id, ${column}) VALUES (?, ?)`),\n params: [row, value]\n };\n }\n\n db.runQuery(query.sql, query.params);\n } catch (e) {\n //console.log(e);\n throw new SyncError('invalid-schema');\n }\n }\n}\n\nasync function fetchAll(table, ids) {\n let results = [];\n\n // TODO: convert to `whereIn`\n\n for (let i = 0; i < ids.length; i += 500) {\n let partIds = ids.slice(i, i + 500);\n let sql;\n let column = `${table}.id`;\n\n // We have to provide *mapped* data so the spreadsheet works. The functions\n // which trigger budget changes based on data changes assumes data has been\n // mapped. The only mapped data that the budget is concerned about is\n // categories. This is kind of annoying, but we manually map it here\n if (table === 'transactions') {\n sql = `\n SELECT t.*, c.transferId AS category\n FROM transactions t\n LEFT JOIN category_mapping c ON c.id = t.category\n `;\n column = 't.id';\n } else {\n sql = `SELECT * FROM ${table}`;\n }\n\n sql += ` WHERE `;\n sql += partIds.map(id => `${column} = ?`).join(' OR ');\n\n try {\n let rows = await db.runQuery(sql, partIds, true);\n results = results.concat(rows);\n } catch (e) {\n throw new SyncError('invalid-schema');\n }\n }\n\n return results;\n}\n\nexport function serializeValue(value) {\n if (value === null) {\n return '0:';\n } else if (typeof value === 'number') {\n return 'N:' + value;\n } else if (typeof value === 'string') {\n return 'S:' + value;\n }\n\n throw new Error('Unserializable value type: ' + JSON.stringify(value));\n}\n\nexport function deserializeValue(value) {\n const type = value[0];\n switch (type) {\n case '0':\n return null;\n case 'N':\n return parseFloat(value.slice(2));\n case 'S':\n return value.slice(2);\n default:\n }\n\n throw new Error('Invalid type key for value: ' + value);\n}\n\nlet _syncListeners = [];\n\nexport function addSyncListener(func) {\n _syncListeners.push(func);\n\n return () => {\n _syncListeners = _syncListeners.filter(f => f !== func);\n };\n}\n\nasync function compareMessages(messages) {\n let newMessages = [];\n\n for (let i = 0; i < messages.length; i++) {\n let message = messages[i];\n let { dataset, row, column, timestamp } = message;\n let timestampStr = timestamp.toString();\n\n let res = db.runQuery(\n db.cache(\n 'SELECT timestamp FROM messages_crdt WHERE dataset = ? AND row = ? AND column = ? AND timestamp >= ?'\n ),\n [dataset, row, column, timestampStr],\n true\n );\n\n // Returned message is any one that is \"later\" than this message,\n // meaning if the result exists this message is an old one\n if (res.length === 0) {\n newMessages.push(message);\n } else if (res[0].timestamp !== timestampStr) {\n newMessages.push({ ...message, old: true });\n }\n }\n\n return newMessages;\n}\n\n// This is the fast path `apply` function when in \"import\" mode.\n// There's no need to run through the whole sync system when\n// importing, but **there is a caveat**: because we don't run sync\n// listeners importers should not rely on any functions that use any\n// projected state (like rules). We can't fire those because they\n// depend on having both old and new data which we don't quere here\nfunction applyMessagesForImport(messages) {\n db.transaction(() => {\n for (let i = 0; i < messages.length; i++) {\n let msg = messages[i];\n let { dataset, row, column, timestamp, value } = msg;\n\n if (!msg.old) {\n try {\n apply(msg);\n } catch (e) {\n apply(msg, true);\n }\n\n if (dataset === 'prefs') {\n throw new Error('Cannot set prefs while importing');\n }\n }\n }\n });\n}\n\nexport const applyMessages = sequential(async messages => {\n if (checkSyncingMode('import')) {\n return applyMessagesForImport(messages);\n } else if (checkSyncingMode('enabled')) {\n // Compare the messages with the existing crdt. This filters out\n // already applied messages and determines if a message is old or\n // not. An \"old\" message doesn't need to be applied, but it still\n // needs to be put into the merkle trie to maintain the hash.\n messages = await compareMessages(messages);\n }\n\n messages = [...messages].sort((m1, m2) => {\n let t1 = m1.timestamp ? m1.timestamp.toString() : '';\n let t2 = m2.timestamp ? m2.timestamp.toString() : '';\n if (t1 < t2) {\n return -1;\n } else if (t1 > t2) {\n return 1;\n }\n return 0;\n });\n\n let idsPerTable = {};\n messages.forEach(msg => {\n if (msg.dataset === 'prefs') {\n return;\n }\n\n if (idsPerTable[msg.dataset] == null) {\n idsPerTable[msg.dataset] = [];\n }\n idsPerTable[msg.dataset].push(msg.row);\n });\n\n async function fetchData() {\n let data = new Map();\n\n for (let table of Object.keys(idsPerTable)) {\n const rows = await fetchAll(table, idsPerTable[table]);\n\n for (let i = 0; i < rows.length; i++) {\n let row = rows[i];\n setIn(data, [table, row.id], row);\n }\n }\n\n return data;\n }\n\n let prefsToSet = {};\n let oldData = await fetchData();\n\n undo.appendMessages(messages, oldData);\n\n // It's important to not mutate the clock while processing the\n // messages. We only want to mutate it if the transaction succeeds.\n // The merkle variable will be updated while applying the messages and\n // we'll apply it afterwards.\n let clock;\n let currentMerkle;\n if (checkSyncingMode('enabled')) {\n clock = getClock();\n currentMerkle = clock.merkle;\n }\n\n if (sheet.get()) {\n sheet.get().startCacheBarrier();\n }\n\n // Now that we have all of the data, go through and apply the\n // messages carefully. This transaction is **crucial**: it\n // guarantees that everything is atomically committed to the\n // database, and if any part of it fails everything aborts and\n // nothing is changed. This is critical to maintain consistency. We\n // also avoid any side effects to in-memory objects, and apply them\n // after this succeeds.\n db.transaction(() => {\n let added = new Set();\n\n for (let i = 0; i < messages.length; i++) {\n let msg = messages[i];\n let { dataset, row, column, timestamp, value } = msg;\n\n if (!msg.old) {\n apply(msg, getIn(oldData, [dataset, row]) || added.has(dataset + row));\n\n if (dataset === 'prefs') {\n prefsToSet[row] = value;\n } else {\n // Keep track of which items have been added it in this sync\n // so it knows whether they already exist in the db or not. We\n // ignore any changes to the spreadsheet.\n added.add(dataset + row);\n }\n }\n\n if (checkSyncingMode('enabled')) {\n db.runQuery(\n db.cache(`INSERT INTO messages_crdt (timestamp, dataset, row, column, value)\n VALUES (?, ?, ?, ?, ?)`),\n [timestamp.toString(), dataset, row, column, serializeValue(value)]\n );\n\n currentMerkle = merkle.insert(currentMerkle, msg.timestamp);\n }\n }\n\n if (checkSyncingMode('enabled')) {\n currentMerkle = merkle.prune(currentMerkle);\n\n // Save the clock in the db first (queries might throw\n // exceptions)\n db.runQuery(\n db.cache(\n 'INSERT OR REPLACE INTO messages_clock (id, clock) VALUES (1, ?)'\n ),\n [serializeClock({ ...clock, merkle: currentMerkle })]\n );\n }\n });\n\n if (checkSyncingMode('enabled')) {\n // The transaction succeeded, so we can update in-memory objects\n // now. Update the in-memory clock.\n clock.merkle = currentMerkle;\n }\n\n // Save any synced prefs\n if (Object.keys(prefsToSet).length > 0) {\n prefs.savePrefs(prefsToSet, { avoidSync: true });\n\n if (prefsToSet.budgetType) {\n setBudgetType(prefsToSet.budgetType);\n }\n\n connection.send('prefs-updated');\n }\n\n let newData = await fetchData();\n\n // In testing, sometimes the spreadsheet isn't loaded, and that's ok\n if (sheet.get()) {\n // Need to clean up these APIs and make them consistent\n sheet.startTransaction();\n triggerBudgetChanges(oldData, newData);\n sheet.get().triggerDatabaseChanges(oldData, newData);\n sheet.endTransaction();\n\n // Allow the cache to be used in the future. At this point it's guaranteed\n // to be up-to-date because we are done mutating any other data\n sheet.get().endCacheBarrier();\n }\n\n _syncListeners.forEach(func => func(oldData, newData));\n\n let tables = getTablesFromMessages(messages.filter(msg => !msg.old));\n app.events.emit('sync', {\n type: 'applied',\n tables,\n data: newData,\n prevData: oldData\n });\n\n return messages;\n});\n\nexport function receiveMessages(messages) {\n messages.forEach(msg => {\n Timestamp.recv(msg.timestamp);\n });\n\n return runMutator(() => applyMessages(messages));\n}\n\nasync function _sendMessages(messages) {\n try {\n await applyMessages(messages);\n } catch (e) {\n if (e instanceof SyncError) {\n if (e.reason === 'invalid-schema') {\n // We know this message came from a local modification, and it\n // couldn't apply, which doesn't make any sense. Must be a bug\n // in the code. Send a specific error type for it for a custom\n // message.\n app.events.emit('sync', {\n type: 'error',\n subtype: 'apply-failure'\n });\n } else {\n app.events.emit('sync', { type: 'error' });\n }\n }\n\n throw e;\n }\n\n await scheduleFullSync();\n}\n\nlet IS_BATCHING = false;\nlet _BATCHED = [];\nexport async function batchMessages(func) {\n if (IS_BATCHING) {\n await func();\n return;\n }\n\n IS_BATCHING = true;\n let batched = [];\n\n try {\n await func();\n // TODO: if it fails, it shouldn't apply them?\n } finally {\n IS_BATCHING = false;\n batched = _BATCHED;\n _BATCHED = [];\n }\n\n if (batched.length > 0) {\n await _sendMessages(batched);\n }\n}\n\nexport async function sendMessages(messages) {\n if (IS_BATCHING) {\n _BATCHED = _BATCHED.concat(messages);\n } else {\n return _sendMessages(messages);\n }\n}\n\nexport function getMessagesSince(since) {\n return db.runQuery(\n 'SELECT timestamp, dataset, row, column, value FROM messages_crdt WHERE timestamp > ?',\n [since],\n true\n );\n}\n\nexport async function syncAndReceiveMessages(messages, since) {\n let localMessages = await getMessagesSince(since);\n await receiveMessages(\n messages.map(msg => ({\n ...msg,\n value: deserializeValue(msg.value),\n timestamp: Timestamp.parse(msg.timestamp)\n }))\n );\n return localMessages;\n}\n\nexport function clearFullSyncTimeout() {\n if (syncTimeout) {\n clearTimeout(syncTimeout);\n syncTimeout = null;\n }\n}\n\nlet syncTimeout = null;\nexport function scheduleFullSync() {\n clearFullSyncTimeout();\n\n if (checkSyncingMode('enabled') && !checkSyncingMode('offline')) {\n if (global.__TESTING__) {\n return fullSync().then(res => {\n if (res.error) {\n throw res.error;\n }\n return res;\n });\n } else {\n syncTimeout = setTimeout(fullSync, FULL_SYNC_DELAY);\n }\n }\n}\n\nfunction getTablesFromMessages(messages) {\n return messages.reduce((acc, message) => {\n let dataset =\n message.dataset === 'schedules_next_date' ? 'schedules' : message.dataset;\n\n if (!acc.includes(dataset)) {\n acc.push(dataset);\n }\n return acc;\n }, []);\n}\n\n// This is different than `fullSync` because it waits for the\n// spreadsheet to finish any processing. This is useful if we want to\n// perform a full sync and wait for everything to finish, usually if\n// you're doing an initial sync before working with a file.\nexport async function initialFullSync() {\n let result = await fullSync();\n if (!result.error) {\n // Make sure to wait for anything in the spreadsheet to process\n await sheet.waitOnSpreadsheet();\n }\n}\n\nexport const fullSync = once(async function() {\n app.events.emit('sync', { type: 'start' });\n let messages;\n\n try {\n messages = await _fullSync(null, 0, null);\n } catch (e) {\n console.log(e);\n\n if (e instanceof SyncError) {\n if (e.reason === 'out-of-sync') {\n captureException(e);\n\n app.events.emit('sync', {\n type: 'error',\n subtype: 'out-of-sync'\n });\n } else if (e.reason === 'invalid-schema') {\n app.events.emit('sync', {\n type: 'error',\n subtype: 'invalid-schema'\n });\n } else if (\n e.reason === 'decrypt-failure' ||\n e.reason === 'encrypt-failure'\n ) {\n app.events.emit('sync', {\n type: 'error',\n subtype: e.reason,\n meta: e.meta\n });\n } else if (e.reason === 'beta-version') {\n app.events.emit('sync', {\n type: 'error',\n subtype: e.reason\n });\n } else {\n app.events.emit('sync', { type: 'error' });\n }\n } else if (e instanceof PostError) {\n console.log(e);\n if (e.reason === 'unauthorized') {\n app.events.emit('sync', { type: 'unauthorized' });\n\n // Set the user into read-only mode\n asyncStorage.setItem('readOnly', 'true');\n } else if (e.reason === 'network-failure') {\n app.events.emit('sync', { type: 'error', subtype: 'network' });\n } else {\n app.events.emit('sync', { type: 'error', subtype: e.reason });\n }\n } else {\n captureException(e);\n // TODO: Send the message to the client and allow them to expand & view it\n app.events.emit('sync', { type: 'error' });\n }\n\n return { error: { message: e.message, reason: e.reason, meta: e.meta } };\n }\n\n let tables = getTablesFromMessages(messages);\n\n app.events.emit('sync', {\n type: 'success',\n tables,\n syncDisabled: checkSyncingMode('disabled')\n });\n return { messages };\n});\n\nasync function _fullSync(sinceTimestamp, count, prevDiffTime) {\n let { cloudFileId, groupId, lastSyncedTimestamp } = prefs.getPrefs() || {};\n\n clearFullSyncTimeout();\n\n if (checkSyncingMode('disabled') || checkSyncingMode('offline')) {\n return [];\n }\n\n // Snapshot the point at which we are currently syncing\n let currentTime = getClock().timestamp.toString();\n\n let since =\n sinceTimestamp ||\n lastSyncedTimestamp ||\n // Default to 5 minutes ago\n new Timestamp(Date.now() - 5 * 60 * 1000, 0, '0').toString();\n\n let messages = getMessagesSince(since);\n\n let userToken = await asyncStorage.getItem('user-token');\n\n logger.info(\n 'Syncing since',\n since,\n messages.length,\n '(attempt: ' + count + ')'\n );\n\n let buffer = await encoder.encode(groupId, cloudFileId, since, messages);\n\n // TODO: There a limit on how many messages we can send because of\n // the payload size. Right now it's at 20MB on the server. We should\n // check the worst case here and make multiple requests if it's\n // really large.\n let resBuffer = await postBinary(getServer().SYNC_SERVER + '/sync', buffer, {\n 'X-ACTUAL-TOKEN': userToken\n });\n\n // Abort if the file is either no longer loaded, the group id has\n // changed because of a sync reset\n if (!prefs.getPrefs() || prefs.getPrefs().groupId !== groupId) {\n return [];\n }\n\n let res = await encoder.decode(resBuffer);\n\n logger.info('Got messages from server', res.messages.length);\n\n let localTimeChanged = getClock().timestamp.toString() !== currentTime;\n\n // Apply the new messages\n let receivedMessages = [];\n if (res.messages.length > 0) {\n receivedMessages = await receiveMessages(\n res.messages.map(msg => ({\n ...msg,\n value: deserializeValue(msg.value),\n timestamp: Timestamp.parse(msg.timestamp)\n }))\n );\n }\n\n let diffTime = merkle.diff(res.merkle, getClock().merkle);\n let result = res.messages;\n\n if (diffTime !== null) {\n // This is a bit wonky, but we loop until we are in sync with the\n // server. While syncing, either the client or server could change\n // out from under us, so it might take a couple passes to\n // completely sync up. This is a check that stops the loop in case\n // we are corrupted and can't sync up. We try 10 times if we keep\n // getting the same diff time, and add a upper limit of 300 no\n // matter what (just to stop this from ever being an infinite\n // loop).\n //\n // It's slightly possible for the user to add more messages while we\n // are in `receiveMessages`, but `localTimeChanged` would still be\n // false. In that case, we don't reset the counter but it should be\n // very unlikely that this happens enough to hit the loop limit.\n\n if ((count >= 10 && diffTime === prevDiffTime) || count >= 100) {\n logger.info('SENT -------');\n logger.info(JSON.stringify(messages));\n logger.info('RECEIVED -------');\n logger.info(JSON.stringify(res.messages));\n\n let rebuiltMerkle = rebuildMerkleHash();\n\n console.log(\n count,\n 'messages:',\n messages.length,\n messages.length > 0 ? messages[0] : null,\n 'res.messages:',\n res.messages.length,\n res.messages.length > 0 ? res.messages[0] : null,\n 'clientId',\n getClock().timestamp.node(),\n 'groupId',\n groupId,\n 'diffTime:',\n diffTime,\n diffTime === prevDiffTime,\n 'local clock:',\n getClock().timestamp.toString(),\n getClock().merkle.hash,\n 'rebuilt hash:',\n rebuiltMerkle.numMessages,\n rebuiltMerkle.trie.hash,\n 'server hash:',\n res.merkle.hash,\n 'localTimeChanged:',\n localTimeChanged\n );\n\n if (rebuiltMerkle.trie.hash === res.merkle.hash) {\n // Rebuilding the merkle worked... but why?\n let clocks = await db.all('SELECT * FROM messages_clock');\n if (clocks.length !== 1) {\n console.log('Bad number of clocks:', clocks.length);\n }\n let hash = deserializeClock(clocks[0]).merkle.hash;\n console.log('Merkle hash in db:', hash);\n }\n\n throw new SyncError('out-of-sync');\n }\n\n receivedMessages = receivedMessages.concat(\n await _fullSync(\n new Timestamp(diffTime, 0, '0').toString(),\n // If something local changed while we were syncing, always\n // reset, token the counter. We never want to think syncing failed\n // because we tried to syncing many times and couldn't sync,\n // but it was because the user kept changing stuff in the\n // middle of syncing.\n localTimeChanged ? 0 : count + 1,\n diffTime\n )\n );\n } else {\n // All synced up, store the current time as a simple optimization\n // for the next sync\n await prefs.savePrefs({\n lastSyncedTimestamp: getClock().timestamp.toString()\n });\n }\n\n return receivedMessages;\n}\n","import encryption from '../encryption';\nlet SyncPb = require('./proto/sync_pb');\n\nasync function randomString() {\n return (await encryption.randomBytes(12)).toString();\n}\n\nexport default async function makeTestMessage(keyId) {\n let messagePb = new SyncPb.Message();\n messagePb.setDataset(await randomString());\n messagePb.setRow(await randomString());\n messagePb.setColumn(await randomString());\n messagePb.setValue(await randomString());\n let binaryMsg = messagePb.serializeBinary();\n\n return await encryption.encrypt(binaryMsg, keyId);\n}\n","import { addSyncListener, applyMessages } from './index';\nimport Timestamp from '../timestamp';\n\nfunction migrateParentIds(oldValues, newValues) {\n newValues.forEach((items, table) => {\n if (table === 'transactions') {\n let old = oldValues.get(table);\n let toApply = [];\n\n items.forEach(newValue => {\n if (\n newValue.isChild === 1 &&\n newValue.parent_id == null &&\n newValue.id.includes('/')\n ) {\n let parentId = newValue.id.split('/')[0];\n\n toApply.push({\n dataset: 'transactions',\n row: newValue.id,\n column: 'parent_id',\n value: parentId,\n timestamp: Timestamp.send()\n });\n }\n });\n\n if (toApply.length > 0) {\n applyMessages(toApply);\n }\n }\n });\n}\n\nlet _unlisten = null;\nexport function listen() {\n unlisten();\n _unlisten = addSyncListener(migrateParentIds);\n}\n\nexport function unlisten() {\n if (_unlisten) {\n _unlisten();\n _unlisten = null;\n }\n}\n","// source: sync.proto\n/**\n * @fileoverview\n * @enhanceable\n * @suppress {messageConventions} JS Compiler reports an error if a variable or\n * field starts with 'MSG_' and isn't a translatable message.\n * @public\n */\n// GENERATED CODE -- DO NOT EDIT!\n\nvar jspb = require('google-protobuf');\nvar goog = jspb;\nvar global = globalThis;\n\ngoog.exportSymbol('proto.EncryptedData', null, global);\ngoog.exportSymbol('proto.Message', null, global);\ngoog.exportSymbol('proto.MessageEnvelope', null, global);\ngoog.exportSymbol('proto.SyncRequest', null, global);\ngoog.exportSymbol('proto.SyncResponse', null, global);\n/**\n * Generated by JsPbCodeGenerator.\n * @param {Array=} opt_data Optional initial data array, typically from a\n * server response, or constructed directly in Javascript. The array is used\n * in place and becomes part of the constructed object. It is not cloned.\n * If no data is provided, the constructed object will be empty, but still\n * valid.\n * @extends {jspb.Message}\n * @constructor\n */\nproto.EncryptedData = function(opt_data) {\n jspb.Message.initialize(this, opt_data, 0, -1, null, null);\n};\ngoog.inherits(proto.EncryptedData, jspb.Message);\nif (goog.DEBUG && !COMPILED) {\n /**\n * @public\n * @override\n */\n proto.EncryptedData.displayName = 'proto.EncryptedData';\n}\n/**\n * Generated by JsPbCodeGenerator.\n * @param {Array=} opt_data Optional initial data array, typically from a\n * server response, or constructed directly in Javascript. The array is used\n * in place and becomes part of the constructed object. It is not cloned.\n * If no data is provided, the constructed object will be empty, but still\n * valid.\n * @extends {jspb.Message}\n * @constructor\n */\nproto.Message = function(opt_data) {\n jspb.Message.initialize(this, opt_data, 0, -1, null, null);\n};\ngoog.inherits(proto.Message, jspb.Message);\nif (goog.DEBUG && !COMPILED) {\n /**\n * @public\n * @override\n */\n proto.Message.displayName = 'proto.Message';\n}\n/**\n * Generated by JsPbCodeGenerator.\n * @param {Array=} opt_data Optional initial data array, typically from a\n * server response, or constructed directly in Javascript. The array is used\n * in place and becomes part of the constructed object. It is not cloned.\n * If no data is provided, the constructed object will be empty, but still\n * valid.\n * @extends {jspb.Message}\n * @constructor\n */\nproto.MessageEnvelope = function(opt_data) {\n jspb.Message.initialize(this, opt_data, 0, -1, null, null);\n};\ngoog.inherits(proto.MessageEnvelope, jspb.Message);\nif (goog.DEBUG && !COMPILED) {\n /**\n * @public\n * @override\n */\n proto.MessageEnvelope.displayName = 'proto.MessageEnvelope';\n}\n/**\n * Generated by JsPbCodeGenerator.\n * @param {Array=} opt_data Optional initial data array, typically from a\n * server response, or constructed directly in Javascript. The array is used\n * in place and becomes part of the constructed object. It is not cloned.\n * If no data is provided, the constructed object will be empty, but still\n * valid.\n * @extends {jspb.Message}\n * @constructor\n */\nproto.SyncRequest = function(opt_data) {\n jspb.Message.initialize(this, opt_data, 0, -1, proto.SyncRequest.repeatedFields_, null);\n};\ngoog.inherits(proto.SyncRequest, jspb.Message);\nif (goog.DEBUG && !COMPILED) {\n /**\n * @public\n * @override\n */\n proto.SyncRequest.displayName = 'proto.SyncRequest';\n}\n/**\n * Generated by JsPbCodeGenerator.\n * @param {Array=} opt_data Optional initial data array, typically from a\n * server response, or constructed directly in Javascript. The array is used\n * in place and becomes part of the constructed object. It is not cloned.\n * If no data is provided, the constructed object will be empty, but still\n * valid.\n * @extends {jspb.Message}\n * @constructor\n */\nproto.SyncResponse = function(opt_data) {\n jspb.Message.initialize(this, opt_data, 0, -1, proto.SyncResponse.repeatedFields_, null);\n};\ngoog.inherits(proto.SyncResponse, jspb.Message);\nif (goog.DEBUG && !COMPILED) {\n /**\n * @public\n * @override\n */\n proto.SyncResponse.displayName = 'proto.SyncResponse';\n}\n\n\n\nif (jspb.Message.GENERATE_TO_OBJECT) {\n/**\n * Creates an object representation of this proto.\n * Field names that are reserved in JavaScript and will be renamed to pb_name.\n * Optional fields that are not set will be set to undefined.\n * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.\n * For the list of reserved names please see:\n * net/proto2/compiler/js/internal/generator.cc#kKeyword.\n * @param {boolean=} opt_includeInstance Deprecated. whether to include the\n * JSPB instance for transitional soy proto support:\n * http://goto/soy-param-migration\n * @return {!Object}\n */\nproto.EncryptedData.prototype.toObject = function(opt_includeInstance) {\n return proto.EncryptedData.toObject(opt_includeInstance, this);\n};\n\n\n/**\n * Static version of the {@see toObject} method.\n * @param {boolean|undefined} includeInstance Deprecated. Whether to include\n * the JSPB instance for transitional soy proto support:\n * http://goto/soy-param-migration\n * @param {!proto.EncryptedData} msg The msg instance to transform.\n * @return {!Object}\n * @suppress {unusedLocalVariables} f is only used for nested messages\n */\nproto.EncryptedData.toObject = function(includeInstance, msg) {\n var f, obj = {\n iv: msg.getIv_asB64(),\n authtag: msg.getAuthtag_asB64(),\n data: msg.getData_asB64()\n };\n\n if (includeInstance) {\n obj.$jspbMessageInstance = msg;\n }\n return obj;\n};\n}\n\n\n/**\n * Deserializes binary data (in protobuf wire format).\n * @param {jspb.ByteSource} bytes The bytes to deserialize.\n * @return {!proto.EncryptedData}\n */\nproto.EncryptedData.deserializeBinary = function(bytes) {\n var reader = new jspb.BinaryReader(bytes);\n var msg = new proto.EncryptedData;\n return proto.EncryptedData.deserializeBinaryFromReader(msg, reader);\n};\n\n\n/**\n * Deserializes binary data (in protobuf wire format) from the\n * given reader into the given message object.\n * @param {!proto.EncryptedData} msg The message object to deserialize into.\n * @param {!jspb.BinaryReader} reader The BinaryReader to use.\n * @return {!proto.EncryptedData}\n */\nproto.EncryptedData.deserializeBinaryFromReader = function(msg, reader) {\n while (reader.nextField()) {\n if (reader.isEndGroup()) {\n break;\n }\n var field = reader.getFieldNumber();\n switch (field) {\n case 1:\n var value = /** @type {!Uint8Array} */ (reader.readBytes());\n msg.setIv(value);\n break;\n case 2:\n var value = /** @type {!Uint8Array} */ (reader.readBytes());\n msg.setAuthtag(value);\n break;\n case 3:\n var value = /** @type {!Uint8Array} */ (reader.readBytes());\n msg.setData(value);\n break;\n default:\n reader.skipField();\n break;\n }\n }\n return msg;\n};\n\n\n/**\n * Serializes the message to binary data (in protobuf wire format).\n * @return {!Uint8Array}\n */\nproto.EncryptedData.prototype.serializeBinary = function() {\n var writer = new jspb.BinaryWriter();\n proto.EncryptedData.serializeBinaryToWriter(this, writer);\n return writer.getResultBuffer();\n};\n\n\n/**\n * Serializes the given message to binary data (in protobuf wire\n * format), writing to the given BinaryWriter.\n * @param {!proto.EncryptedData} message\n * @param {!jspb.BinaryWriter} writer\n * @suppress {unusedLocalVariables} f is only used for nested messages\n */\nproto.EncryptedData.serializeBinaryToWriter = function(message, writer) {\n var f = undefined;\n f = message.getIv_asU8();\n if (f.length > 0) {\n writer.writeBytes(\n 1,\n f\n );\n }\n f = message.getAuthtag_asU8();\n if (f.length > 0) {\n writer.writeBytes(\n 2,\n f\n );\n }\n f = message.getData_asU8();\n if (f.length > 0) {\n writer.writeBytes(\n 3,\n f\n );\n }\n};\n\n\n/**\n * optional bytes iv = 1;\n * @return {!(string|Uint8Array)}\n */\nproto.EncryptedData.prototype.getIv = function() {\n return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 1, \"\"));\n};\n\n\n/**\n * optional bytes iv = 1;\n * This is a type-conversion wrapper around `getIv()`\n * @return {string}\n */\nproto.EncryptedData.prototype.getIv_asB64 = function() {\n return /** @type {string} */ (jspb.Message.bytesAsB64(\n this.getIv()));\n};\n\n\n/**\n * optional bytes iv = 1;\n * Note that Uint8Array is not supported on all browsers.\n * @see http://caniuse.com/Uint8Array\n * This is a type-conversion wrapper around `getIv()`\n * @return {!Uint8Array}\n */\nproto.EncryptedData.prototype.getIv_asU8 = function() {\n return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8(\n this.getIv()));\n};\n\n\n/**\n * @param {!(string|Uint8Array)} value\n * @return {!proto.EncryptedData} returns this\n */\nproto.EncryptedData.prototype.setIv = function(value) {\n return jspb.Message.setProto3BytesField(this, 1, value);\n};\n\n\n/**\n * optional bytes authTag = 2;\n * @return {!(string|Uint8Array)}\n */\nproto.EncryptedData.prototype.getAuthtag = function() {\n return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 2, \"\"));\n};\n\n\n/**\n * optional bytes authTag = 2;\n * This is a type-conversion wrapper around `getAuthtag()`\n * @return {string}\n */\nproto.EncryptedData.prototype.getAuthtag_asB64 = function() {\n return /** @type {string} */ (jspb.Message.bytesAsB64(\n this.getAuthtag()));\n};\n\n\n/**\n * optional bytes authTag = 2;\n * Note that Uint8Array is not supported on all browsers.\n * @see http://caniuse.com/Uint8Array\n * This is a type-conversion wrapper around `getAuthtag()`\n * @return {!Uint8Array}\n */\nproto.EncryptedData.prototype.getAuthtag_asU8 = function() {\n return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8(\n this.getAuthtag()));\n};\n\n\n/**\n * @param {!(string|Uint8Array)} value\n * @return {!proto.EncryptedData} returns this\n */\nproto.EncryptedData.prototype.setAuthtag = function(value) {\n return jspb.Message.setProto3BytesField(this, 2, value);\n};\n\n\n/**\n * optional bytes data = 3;\n * @return {!(string|Uint8Array)}\n */\nproto.EncryptedData.prototype.getData = function() {\n return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 3, \"\"));\n};\n\n\n/**\n * optional bytes data = 3;\n * This is a type-conversion wrapper around `getData()`\n * @return {string}\n */\nproto.EncryptedData.prototype.getData_asB64 = function() {\n return /** @type {string} */ (jspb.Message.bytesAsB64(\n this.getData()));\n};\n\n\n/**\n * optional bytes data = 3;\n * Note that Uint8Array is not supported on all browsers.\n * @see http://caniuse.com/Uint8Array\n * This is a type-conversion wrapper around `getData()`\n * @return {!Uint8Array}\n */\nproto.EncryptedData.prototype.getData_asU8 = function() {\n return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8(\n this.getData()));\n};\n\n\n/**\n * @param {!(string|Uint8Array)} value\n * @return {!proto.EncryptedData} returns this\n */\nproto.EncryptedData.prototype.setData = function(value) {\n return jspb.Message.setProto3BytesField(this, 3, value);\n};\n\n\n\n\n\nif (jspb.Message.GENERATE_TO_OBJECT) {\n/**\n * Creates an object representation of this proto.\n * Field names that are reserved in JavaScript and will be renamed to pb_name.\n * Optional fields that are not set will be set to undefined.\n * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.\n * For the list of reserved names please see:\n * net/proto2/compiler/js/internal/generator.cc#kKeyword.\n * @param {boolean=} opt_includeInstance Deprecated. whether to include the\n * JSPB instance for transitional soy proto support:\n * http://goto/soy-param-migration\n * @return {!Object}\n */\nproto.Message.prototype.toObject = function(opt_includeInstance) {\n return proto.Message.toObject(opt_includeInstance, this);\n};\n\n\n/**\n * Static version of the {@see toObject} method.\n * @param {boolean|undefined} includeInstance Deprecated. Whether to include\n * the JSPB instance for transitional soy proto support:\n * http://goto/soy-param-migration\n * @param {!proto.Message} msg The msg instance to transform.\n * @return {!Object}\n * @suppress {unusedLocalVariables} f is only used for nested messages\n */\nproto.Message.toObject = function(includeInstance, msg) {\n var f, obj = {\n dataset: jspb.Message.getFieldWithDefault(msg, 1, \"\"),\n row: jspb.Message.getFieldWithDefault(msg, 2, \"\"),\n column: jspb.Message.getFieldWithDefault(msg, 3, \"\"),\n value: jspb.Message.getFieldWithDefault(msg, 4, \"\")\n };\n\n if (includeInstance) {\n obj.$jspbMessageInstance = msg;\n }\n return obj;\n};\n}\n\n\n/**\n * Deserializes binary data (in protobuf wire format).\n * @param {jspb.ByteSource} bytes The bytes to deserialize.\n * @return {!proto.Message}\n */\nproto.Message.deserializeBinary = function(bytes) {\n var reader = new jspb.BinaryReader(bytes);\n var msg = new proto.Message;\n return proto.Message.deserializeBinaryFromReader(msg, reader);\n};\n\n\n/**\n * Deserializes binary data (in protobuf wire format) from the\n * given reader into the given message object.\n * @param {!proto.Message} msg The message object to deserialize into.\n * @param {!jspb.BinaryReader} reader The BinaryReader to use.\n * @return {!proto.Message}\n */\nproto.Message.deserializeBinaryFromReader = function(msg, reader) {\n while (reader.nextField()) {\n if (reader.isEndGroup()) {\n break;\n }\n var field = reader.getFieldNumber();\n switch (field) {\n case 1:\n var value = /** @type {string} */ (reader.readString());\n msg.setDataset(value);\n break;\n case 2:\n var value = /** @type {string} */ (reader.readString());\n msg.setRow(value);\n break;\n case 3:\n var value = /** @type {string} */ (reader.readString());\n msg.setColumn(value);\n break;\n case 4:\n var value = /** @type {string} */ (reader.readString());\n msg.setValue(value);\n break;\n default:\n reader.skipField();\n break;\n }\n }\n return msg;\n};\n\n\n/**\n * Serializes the message to binary data (in protobuf wire format).\n * @return {!Uint8Array}\n */\nproto.Message.prototype.serializeBinary = function() {\n var writer = new jspb.BinaryWriter();\n proto.Message.serializeBinaryToWriter(this, writer);\n return writer.getResultBuffer();\n};\n\n\n/**\n * Serializes the given message to binary data (in protobuf wire\n * format), writing to the given BinaryWriter.\n * @param {!proto.Message} message\n * @param {!jspb.BinaryWriter} writer\n * @suppress {unusedLocalVariables} f is only used for nested messages\n */\nproto.Message.serializeBinaryToWriter = function(message, writer) {\n var f = undefined;\n f = message.getDataset();\n if (f.length > 0) {\n writer.writeString(\n 1,\n f\n );\n }\n f = message.getRow();\n if (f.length > 0) {\n writer.writeString(\n 2,\n f\n );\n }\n f = message.getColumn();\n if (f.length > 0) {\n writer.writeString(\n 3,\n f\n );\n }\n f = message.getValue();\n if (f.length > 0) {\n writer.writeString(\n 4,\n f\n );\n }\n};\n\n\n/**\n * optional string dataset = 1;\n * @return {string}\n */\nproto.Message.prototype.getDataset = function() {\n return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, \"\"));\n};\n\n\n/**\n * @param {string} value\n * @return {!proto.Message} returns this\n */\nproto.Message.prototype.setDataset = function(value) {\n return jspb.Message.setProto3StringField(this, 1, value);\n};\n\n\n/**\n * optional string row = 2;\n * @return {string}\n */\nproto.Message.prototype.getRow = function() {\n return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, \"\"));\n};\n\n\n/**\n * @param {string} value\n * @return {!proto.Message} returns this\n */\nproto.Message.prototype.setRow = function(value) {\n return jspb.Message.setProto3StringField(this, 2, value);\n};\n\n\n/**\n * optional string column = 3;\n * @return {string}\n */\nproto.Message.prototype.getColumn = function() {\n return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, \"\"));\n};\n\n\n/**\n * @param {string} value\n * @return {!proto.Message} returns this\n */\nproto.Message.prototype.setColumn = function(value) {\n return jspb.Message.setProto3StringField(this, 3, value);\n};\n\n\n/**\n * optional string value = 4;\n * @return {string}\n */\nproto.Message.prototype.getValue = function() {\n return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, \"\"));\n};\n\n\n/**\n * @param {string} value\n * @return {!proto.Message} returns this\n */\nproto.Message.prototype.setValue = function(value) {\n return jspb.Message.setProto3StringField(this, 4, value);\n};\n\n\n\n\n\nif (jspb.Message.GENERATE_TO_OBJECT) {\n/**\n * Creates an object representation of this proto.\n * Field names that are reserved in JavaScript and will be renamed to pb_name.\n * Optional fields that are not set will be set to undefined.\n * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.\n * For the list of reserved names please see:\n * net/proto2/compiler/js/internal/generator.cc#kKeyword.\n * @param {boolean=} opt_includeInstance Deprecated. whether to include the\n * JSPB instance for transitional soy proto support:\n * http://goto/soy-param-migration\n * @return {!Object}\n */\nproto.MessageEnvelope.prototype.toObject = function(opt_includeInstance) {\n return proto.MessageEnvelope.toObject(opt_includeInstance, this);\n};\n\n\n/**\n * Static version of the {@see toObject} method.\n * @param {boolean|undefined} includeInstance Deprecated. Whether to include\n * the JSPB instance for transitional soy proto support:\n * http://goto/soy-param-migration\n * @param {!proto.MessageEnvelope} msg The msg instance to transform.\n * @return {!Object}\n * @suppress {unusedLocalVariables} f is only used for nested messages\n */\nproto.MessageEnvelope.toObject = function(includeInstance, msg) {\n var f, obj = {\n timestamp: jspb.Message.getFieldWithDefault(msg, 1, \"\"),\n isencrypted: jspb.Message.getBooleanFieldWithDefault(msg, 2, false),\n content: msg.getContent_asB64()\n };\n\n if (includeInstance) {\n obj.$jspbMessageInstance = msg;\n }\n return obj;\n};\n}\n\n\n/**\n * Deserializes binary data (in protobuf wire format).\n * @param {jspb.ByteSource} bytes The bytes to deserialize.\n * @return {!proto.MessageEnvelope}\n */\nproto.MessageEnvelope.deserializeBinary = function(bytes) {\n var reader = new jspb.BinaryReader(bytes);\n var msg = new proto.MessageEnvelope;\n return proto.MessageEnvelope.deserializeBinaryFromReader(msg, reader);\n};\n\n\n/**\n * Deserializes binary data (in protobuf wire format) from the\n * given reader into the given message object.\n * @param {!proto.MessageEnvelope} msg The message object to deserialize into.\n * @param {!jspb.BinaryReader} reader The BinaryReader to use.\n * @return {!proto.MessageEnvelope}\n */\nproto.MessageEnvelope.deserializeBinaryFromReader = function(msg, reader) {\n while (reader.nextField()) {\n if (reader.isEndGroup()) {\n break;\n }\n var field = reader.getFieldNumber();\n switch (field) {\n case 1:\n var value = /** @type {string} */ (reader.readString());\n msg.setTimestamp(value);\n break;\n case 2:\n var value = /** @type {boolean} */ (reader.readBool());\n msg.setIsencrypted(value);\n break;\n case 3:\n var value = /** @type {!Uint8Array} */ (reader.readBytes());\n msg.setContent(value);\n break;\n default:\n reader.skipField();\n break;\n }\n }\n return msg;\n};\n\n\n/**\n * Serializes the message to binary data (in protobuf wire format).\n * @return {!Uint8Array}\n */\nproto.MessageEnvelope.prototype.serializeBinary = function() {\n var writer = new jspb.BinaryWriter();\n proto.MessageEnvelope.serializeBinaryToWriter(this, writer);\n return writer.getResultBuffer();\n};\n\n\n/**\n * Serializes the given message to binary data (in protobuf wire\n * format), writing to the given BinaryWriter.\n * @param {!proto.MessageEnvelope} message\n * @param {!jspb.BinaryWriter} writer\n * @suppress {unusedLocalVariables} f is only used for nested messages\n */\nproto.MessageEnvelope.serializeBinaryToWriter = function(message, writer) {\n var f = undefined;\n f = message.getTimestamp();\n if (f.length > 0) {\n writer.writeString(\n 1,\n f\n );\n }\n f = message.getIsencrypted();\n if (f) {\n writer.writeBool(\n 2,\n f\n );\n }\n f = message.getContent_asU8();\n if (f.length > 0) {\n writer.writeBytes(\n 3,\n f\n );\n }\n};\n\n\n/**\n * optional string timestamp = 1;\n * @return {string}\n */\nproto.MessageEnvelope.prototype.getTimestamp = function() {\n return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, \"\"));\n};\n\n\n/**\n * @param {string} value\n * @return {!proto.MessageEnvelope} returns this\n */\nproto.MessageEnvelope.prototype.setTimestamp = function(value) {\n return jspb.Message.setProto3StringField(this, 1, value);\n};\n\n\n/**\n * optional bool isEncrypted = 2;\n * @return {boolean}\n */\nproto.MessageEnvelope.prototype.getIsencrypted = function() {\n return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false));\n};\n\n\n/**\n * @param {boolean} value\n * @return {!proto.MessageEnvelope} returns this\n */\nproto.MessageEnvelope.prototype.setIsencrypted = function(value) {\n return jspb.Message.setProto3BooleanField(this, 2, value);\n};\n\n\n/**\n * optional bytes content = 3;\n * @return {!(string|Uint8Array)}\n */\nproto.MessageEnvelope.prototype.getContent = function() {\n return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 3, \"\"));\n};\n\n\n/**\n * optional bytes content = 3;\n * This is a type-conversion wrapper around `getContent()`\n * @return {string}\n */\nproto.MessageEnvelope.prototype.getContent_asB64 = function() {\n return /** @type {string} */ (jspb.Message.bytesAsB64(\n this.getContent()));\n};\n\n\n/**\n * optional bytes content = 3;\n * Note that Uint8Array is not supported on all browsers.\n * @see http://caniuse.com/Uint8Array\n * This is a type-conversion wrapper around `getContent()`\n * @return {!Uint8Array}\n */\nproto.MessageEnvelope.prototype.getContent_asU8 = function() {\n return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8(\n this.getContent()));\n};\n\n\n/**\n * @param {!(string|Uint8Array)} value\n * @return {!proto.MessageEnvelope} returns this\n */\nproto.MessageEnvelope.prototype.setContent = function(value) {\n return jspb.Message.setProto3BytesField(this, 3, value);\n};\n\n\n\n/**\n * List of repeated fields within this message type.\n * @private {!Array<number>}\n * @const\n */\nproto.SyncRequest.repeatedFields_ = [1];\n\n\n\nif (jspb.Message.GENERATE_TO_OBJECT) {\n/**\n * Creates an object representation of this proto.\n * Field names that are reserved in JavaScript and will be renamed to pb_name.\n * Optional fields that are not set will be set to undefined.\n * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.\n * For the list of reserved names please see:\n * net/proto2/compiler/js/internal/generator.cc#kKeyword.\n * @param {boolean=} opt_includeInstance Deprecated. whether to include the\n * JSPB instance for transitional soy proto support:\n * http://goto/soy-param-migration\n * @return {!Object}\n */\nproto.SyncRequest.prototype.toObject = function(opt_includeInstance) {\n return proto.SyncRequest.toObject(opt_includeInstance, this);\n};\n\n\n/**\n * Static version of the {@see toObject} method.\n * @param {boolean|undefined} includeInstance Deprecated. Whether to include\n * the JSPB instance for transitional soy proto support:\n * http://goto/soy-param-migration\n * @param {!proto.SyncRequest} msg The msg instance to transform.\n * @return {!Object}\n * @suppress {unusedLocalVariables} f is only used for nested messages\n */\nproto.SyncRequest.toObject = function(includeInstance, msg) {\n var f, obj = {\n messagesList: jspb.Message.toObjectList(msg.getMessagesList(),\n proto.MessageEnvelope.toObject, includeInstance),\n fileid: jspb.Message.getFieldWithDefault(msg, 2, \"\"),\n groupid: jspb.Message.getFieldWithDefault(msg, 3, \"\"),\n keyid: jspb.Message.getFieldWithDefault(msg, 5, \"\"),\n since: jspb.Message.getFieldWithDefault(msg, 6, \"\")\n };\n\n if (includeInstance) {\n obj.$jspbMessageInstance = msg;\n }\n return obj;\n};\n}\n\n\n/**\n * Deserializes binary data (in protobuf wire format).\n * @param {jspb.ByteSource} bytes The bytes to deserialize.\n * @return {!proto.SyncRequest}\n */\nproto.SyncRequest.deserializeBinary = function(bytes) {\n var reader = new jspb.BinaryReader(bytes);\n var msg = new proto.SyncRequest;\n return proto.SyncRequest.deserializeBinaryFromReader(msg, reader);\n};\n\n\n/**\n * Deserializes binary data (in protobuf wire format) from the\n * given reader into the given message object.\n * @param {!proto.SyncRequest} msg The message object to deserialize into.\n * @param {!jspb.BinaryReader} reader The BinaryReader to use.\n * @return {!proto.SyncRequest}\n */\nproto.SyncRequest.deserializeBinaryFromReader = function(msg, reader) {\n while (reader.nextField()) {\n if (reader.isEndGroup()) {\n break;\n }\n var field = reader.getFieldNumber();\n switch (field) {\n case 1:\n var value = new proto.MessageEnvelope;\n reader.readMessage(value,proto.MessageEnvelope.deserializeBinaryFromReader);\n msg.addMessages(value);\n break;\n case 2:\n var value = /** @type {string} */ (reader.readString());\n msg.setFileid(value);\n break;\n case 3:\n var value = /** @type {string} */ (reader.readString());\n msg.setGroupid(value);\n break;\n case 5:\n var value = /** @type {string} */ (reader.readString());\n msg.setKeyid(value);\n break;\n case 6:\n var value = /** @type {string} */ (reader.readString());\n msg.setSince(value);\n break;\n default:\n reader.skipField();\n break;\n }\n }\n return msg;\n};\n\n\n/**\n * Serializes the message to binary data (in protobuf wire format).\n * @return {!Uint8Array}\n */\nproto.SyncRequest.prototype.serializeBinary = function() {\n var writer = new jspb.BinaryWriter();\n proto.SyncRequest.serializeBinaryToWriter(this, writer);\n return writer.getResultBuffer();\n};\n\n\n/**\n * Serializes the given message to binary data (in protobuf wire\n * format), writing to the given BinaryWriter.\n * @param {!proto.SyncRequest} message\n * @param {!jspb.BinaryWriter} writer\n * @suppress {unusedLocalVariables} f is only used for nested messages\n */\nproto.SyncRequest.serializeBinaryToWriter = function(message, writer) {\n var f = undefined;\n f = message.getMessagesList();\n if (f.length > 0) {\n writer.writeRepeatedMessage(\n 1,\n f,\n proto.MessageEnvelope.serializeBinaryToWriter\n );\n }\n f = message.getFileid();\n if (f.length > 0) {\n writer.writeString(\n 2,\n f\n );\n }\n f = message.getGroupid();\n if (f.length > 0) {\n writer.writeString(\n 3,\n f\n );\n }\n f = message.getKeyid();\n if (f.length > 0) {\n writer.writeString(\n 5,\n f\n );\n }\n f = message.getSince();\n if (f.length > 0) {\n writer.writeString(\n 6,\n f\n );\n }\n};\n\n\n/**\n * repeated MessageEnvelope messages = 1;\n * @return {!Array<!proto.MessageEnvelope>}\n */\nproto.SyncRequest.prototype.getMessagesList = function() {\n return /** @type{!Array<!proto.MessageEnvelope>} */ (\n jspb.Message.getRepeatedWrapperField(this, proto.MessageEnvelope, 1));\n};\n\n\n/**\n * @param {!Array<!proto.MessageEnvelope>} value\n * @return {!proto.SyncRequest} returns this\n*/\nproto.SyncRequest.prototype.setMessagesList = function(value) {\n return jspb.Message.setRepeatedWrapperField(this, 1, value);\n};\n\n\n/**\n * @param {!proto.MessageEnvelope=} opt_value\n * @param {number=} opt_index\n * @return {!proto.MessageEnvelope}\n */\nproto.SyncRequest.prototype.addMessages = function(opt_value, opt_index) {\n return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.MessageEnvelope, opt_index);\n};\n\n\n/**\n * Clears the list making it empty but non-null.\n * @return {!proto.SyncRequest} returns this\n */\nproto.SyncRequest.prototype.clearMessagesList = function() {\n return this.setMessagesList([]);\n};\n\n\n/**\n * optional string fileId = 2;\n * @return {string}\n */\nproto.SyncRequest.prototype.getFileid = function() {\n return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, \"\"));\n};\n\n\n/**\n * @param {string} value\n * @return {!proto.SyncRequest} returns this\n */\nproto.SyncRequest.prototype.setFileid = function(value) {\n return jspb.Message.setProto3StringField(this, 2, value);\n};\n\n\n/**\n * optional string groupId = 3;\n * @return {string}\n */\nproto.SyncRequest.prototype.getGroupid = function() {\n return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, \"\"));\n};\n\n\n/**\n * @param {string} value\n * @return {!proto.SyncRequest} returns this\n */\nproto.SyncRequest.prototype.setGroupid = function(value) {\n return jspb.Message.setProto3StringField(this, 3, value);\n};\n\n\n/**\n * optional string keyId = 5;\n * @return {string}\n */\nproto.SyncRequest.prototype.getKeyid = function() {\n return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 5, \"\"));\n};\n\n\n/**\n * @param {string} value\n * @return {!proto.SyncRequest} returns this\n */\nproto.SyncRequest.prototype.setKeyid = function(value) {\n return jspb.Message.setProto3StringField(this, 5, value);\n};\n\n\n/**\n * optional string since = 6;\n * @return {string}\n */\nproto.SyncRequest.prototype.getSince = function() {\n return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 6, \"\"));\n};\n\n\n/**\n * @param {string} value\n * @return {!proto.SyncRequest} returns this\n */\nproto.SyncRequest.prototype.setSince = function(value) {\n return jspb.Message.setProto3StringField(this, 6, value);\n};\n\n\n\n/**\n * List of repeated fields within this message type.\n * @private {!Array<number>}\n * @const\n */\nproto.SyncResponse.repeatedFields_ = [1];\n\n\n\nif (jspb.Message.GENERATE_TO_OBJECT) {\n/**\n * Creates an object representation of this proto.\n * Field names that are reserved in JavaScript and will be renamed to pb_name.\n * Optional fields that are not set will be set to undefined.\n * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.\n * For the list of reserved names please see:\n * net/proto2/compiler/js/internal/generator.cc#kKeyword.\n * @param {boolean=} opt_includeInstance Deprecated. whether to include the\n * JSPB instance for transitional soy proto support:\n * http://goto/soy-param-migration\n * @return {!Object}\n */\nproto.SyncResponse.prototype.toObject = function(opt_includeInstance) {\n return proto.SyncResponse.toObject(opt_includeInstance, this);\n};\n\n\n/**\n * Static version of the {@see toObject} method.\n * @param {boolean|undefined} includeInstance Deprecated. Whether to include\n * the JSPB instance for transitional soy proto support:\n * http://goto/soy-param-migration\n * @param {!proto.SyncResponse} msg The msg instance to transform.\n * @return {!Object}\n * @suppress {unusedLocalVariables} f is only used for nested messages\n */\nproto.SyncResponse.toObject = function(includeInstance, msg) {\n var f, obj = {\n messagesList: jspb.Message.toObjectList(msg.getMessagesList(),\n proto.MessageEnvelope.toObject, includeInstance),\n merkle: jspb.Message.getFieldWithDefault(msg, 2, \"\")\n };\n\n if (includeInstance) {\n obj.$jspbMessageInstance = msg;\n }\n return obj;\n};\n}\n\n\n/**\n * Deserializes binary data (in protobuf wire format).\n * @param {jspb.ByteSource} bytes The bytes to deserialize.\n * @return {!proto.SyncResponse}\n */\nproto.SyncResponse.deserializeBinary = function(bytes) {\n var reader = new jspb.BinaryReader(bytes);\n var msg = new proto.SyncResponse;\n return proto.SyncResponse.deserializeBinaryFromReader(msg, reader);\n};\n\n\n/**\n * Deserializes binary data (in protobuf wire format) from the\n * given reader into the given message object.\n * @param {!proto.SyncResponse} msg The message object to deserialize into.\n * @param {!jspb.BinaryReader} reader The BinaryReader to use.\n * @return {!proto.SyncResponse}\n */\nproto.SyncResponse.deserializeBinaryFromReader = function(msg, reader) {\n while (reader.nextField()) {\n if (reader.isEndGroup()) {\n break;\n }\n var field = reader.getFieldNumber();\n switch (field) {\n case 1:\n var value = new proto.MessageEnvelope;\n reader.readMessage(value,proto.MessageEnvelope.deserializeBinaryFromReader);\n msg.addMessages(value);\n break;\n case 2:\n var value = /** @type {string} */ (reader.readString());\n msg.setMerkle(value);\n break;\n default:\n reader.skipField();\n break;\n }\n }\n return msg;\n};\n\n\n/**\n * Serializes the message to binary data (in protobuf wire format).\n * @return {!Uint8Array}\n */\nproto.SyncResponse.prototype.serializeBinary = function() {\n var writer = new jspb.BinaryWriter();\n proto.SyncResponse.serializeBinaryToWriter(this, writer);\n return writer.getResultBuffer();\n};\n\n\n/**\n * Serializes the given message to binary data (in protobuf wire\n * format), writing to the given BinaryWriter.\n * @param {!proto.SyncResponse} message\n * @param {!jspb.BinaryWriter} writer\n * @suppress {unusedLocalVariables} f is only used for nested messages\n */\nproto.SyncResponse.serializeBinaryToWriter = function(message, writer) {\n var f = undefined;\n f = message.getMessagesList();\n if (f.length > 0) {\n writer.writeRepeatedMessage(\n 1,\n f,\n proto.MessageEnvelope.serializeBinaryToWriter\n );\n }\n f = message.getMerkle();\n if (f.length > 0) {\n writer.writeString(\n 2,\n f\n );\n }\n};\n\n\n/**\n * repeated MessageEnvelope messages = 1;\n * @return {!Array<!proto.MessageEnvelope>}\n */\nproto.SyncResponse.prototype.getMessagesList = function() {\n return /** @type{!Array<!proto.MessageEnvelope>} */ (\n jspb.Message.getRepeatedWrapperField(this, proto.MessageEnvelope, 1));\n};\n\n\n/**\n * @param {!Array<!proto.MessageEnvelope>} value\n * @return {!proto.SyncResponse} returns this\n*/\nproto.SyncResponse.prototype.setMessagesList = function(value) {\n return jspb.Message.setRepeatedWrapperField(this, 1, value);\n};\n\n\n/**\n * @param {!proto.MessageEnvelope=} opt_value\n * @param {number=} opt_index\n * @return {!proto.MessageEnvelope}\n */\nproto.SyncResponse.prototype.addMessages = function(opt_value, opt_index) {\n return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.MessageEnvelope, opt_index);\n};\n\n\n/**\n * Clears the list making it empty but non-null.\n * @return {!proto.SyncResponse} returns this\n */\nproto.SyncResponse.prototype.clearMessagesList = function() {\n return this.setMessagesList([]);\n};\n\n\n/**\n * optional string merkle = 2;\n * @return {string}\n */\nproto.SyncResponse.prototype.getMerkle = function() {\n return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, \"\"));\n};\n\n\n/**\n * @param {string} value\n * @return {!proto.SyncResponse} returns this\n */\nproto.SyncResponse.prototype.setMerkle = function(value) {\n return jspb.Message.setProto3StringField(this, 2, value);\n};\n\n\ngoog.object.extend(exports, proto);\n","import * as db from '../db';\nimport Timestamp, { serializeClock, getClock } from '../timestamp';\nimport * as merkle from '../merkle';\n\nexport function rebuildMerkleHash() {\n let rows = db.runQuery('SELECT timestamp FROM messages_crdt', [], true);\n let trie = {};\n\n for (let i = 0; i < rows.length; i++) {\n trie = merkle.insert(trie, Timestamp.parse(rows[i].timestamp));\n }\n\n return {\n numMessages: rows.length,\n trie: trie\n };\n}\n\nexport default async function repairSync() {\n let rebuilt = rebuildMerkleHash();\n let clock = getClock();\n\n // Save it locally\n clock.merkle = rebuilt.trie;\n\n // Persist it in the db\n db.runQuery(\n db.cache('INSERT OR REPLACE INTO messages_clock (id, clock) VALUES (1, ?)'),\n [serializeClock(clock)]\n );\n}\n","import * as cloudStorage from '../cloud-storage';\nimport * as db from '../db';\nimport * as prefs from '../prefs';\nimport asyncStorage from '../../platform/server/asyncStorage';\nimport { captureException } from '../../platform/exceptions';\nimport { runMutator } from '../mutators';\nconst connection = require('../../platform/server/connection');\n\nexport default async function resetSync(keyState) {\n if (!keyState) {\n // If we aren't resetting the key, make sure our key is up-to-date\n // so we don't accidentally upload a file encrypted with the wrong\n // key (or not encrypted at all)\n let { valid, error } = await cloudStorage.checkKey();\n if (error) {\n return { error };\n } else if (!valid) {\n return { error: { reason: 'file-has-new-key' } };\n }\n }\n\n let { error } = await cloudStorage.resetSyncState(keyState);\n if (error) {\n return { error };\n }\n\n await runMutator(async () => {\n // TOOD: We could automatically generate the list of tables to\n // cleanup by looking at the schema\n //\n // Be VERY careful here since we are bulk deleting data. It should\n // never delete any data that doesn't have `tombstone = 1`\n await db.execQuery(`\n DELETE FROM messages_crdt;\n DELETE FROM messages_clock;\n DELETE FROM transactions WHERE tombstone = 1;\n DELETE FROM accounts WHERE tombstone = 1;\n DELETE FROM payees WHERE tombstone = 1;\n DELETE FROM categories WHERE tombstone = 1;\n DELETE FROM category_groups WHERE tombstone = 1;\n DELETE FROM schedules WHERE tombstone = 1;\n DELETE FROM rules WHERE tombstone = 1;\n ANALYZE;\n VACUUM;\n `);\n await db.loadClock();\n });\n\n await prefs.savePrefs({\n groupId: null,\n lastSyncedTimestamp: null,\n lastUploaded: null\n });\n\n if (keyState) {\n let { key } = keyState;\n let { cloudFileId } = prefs.getPrefs();\n\n // The key has changed, we need to update our local data to\n // store the new key\n\n // Persist key in async storage\n let keys = JSON.parse((await asyncStorage.getItem(`encrypt-keys`)) || '{}');\n keys[cloudFileId] = key.serialize();\n await asyncStorage.setItem('encrypt-keys', JSON.stringify(keys));\n\n // Save the key id in prefs\n await prefs.savePrefs({ encryptKeyId: key.getId() });\n }\n\n // Finally, upload the file to make it the \"true\" version that all\n // other clients need to pull down to get back in sync\n try {\n await cloudStorage.upload();\n } catch (e) {\n if (e.reason) {\n return { error: e };\n }\n captureException(e);\n return { error: { reason: 'upload-failure' } };\n } finally {\n connection.send('prefs-updated');\n }\n\n return {};\n}\n","import murmurhash from 'murmurhash';\nconst uuid = require('../platform/uuid');\n\n/**\n * Hybrid Unique Logical Clock (HULC) timestamp generator\n *\n * Globally-unique, monotonic timestamps are generated from the\n * combination of the unreliable system time, a counter, and an\n * identifier for the current node (instance, machine, process, etc.).\n * These timestamps can accommodate clock stuttering (duplicate values),\n * regression, and node differences within the configured maximum drift.\n *\n * In order to generate timestamps locally or for transmission to another\n * node, use the send() method. For global causality, timestamps must\n * be included in each message processed by the system. Whenever a\n * message is received, its timestamp must be passed to the recv()\n * method.\n *\n * Timestamps serialize into a 46-character collatable string\n * example: 2015-04-24T22:23:42.123Z-1000-0123456789ABCDEF\n * example: 2015-04-24T22:23:42.123Z-1000-A219E7A71CC18912\n *\n * The 64-bit hybrid clock is based on the HLC specification,\n * http://www.cse.buffalo.edu/tech-reports/2014-04.pdf\n */\n\n// A mutable global clock\nlet clock = null;\n\nexport function setClock(clock_) {\n clock = clock_;\n}\n\nexport function getClock() {\n return clock;\n}\n\nexport function makeClock(timestamp, merkle = {}) {\n return { timestamp: MutableTimestamp.from(timestamp), merkle };\n}\n\nexport function serializeClock(clock) {\n return JSON.stringify({\n timestamp: clock.timestamp.toString(),\n merkle: clock.merkle\n });\n}\n\nexport function deserializeClock(clock) {\n let data;\n try {\n data = JSON.parse(clock);\n } catch (e) {\n data = {\n timestamp: '1970-01-01T00:00:00.000Z-0000-' + makeClientId(),\n merkle: {}\n };\n }\n\n return {\n timestamp: MutableTimestamp.from(Timestamp.parse(data.timestamp)),\n merkle: data.merkle\n };\n}\n\nexport function makeClientId() {\n return uuid\n .v4Sync()\n .replace(/-/g, '')\n .slice(-16);\n}\n\nvar config = {\n // Allow 5 minutes of clock drift\n maxDrift: 5 * 60 * 1000\n};\n\n/**\n * timestamp instance class\n */\nexport default class Timestamp {\n constructor(millis, counter, node) {\n this._state = {\n millis: millis,\n counter: counter,\n node: node\n };\n }\n\n valueOf() {\n return this.toString();\n }\n\n toString() {\n return [\n new Date(this.millis()).toISOString(),\n (\n '0000' +\n this.counter()\n .toString(16)\n .toUpperCase()\n ).slice(-4),\n ('0000000000000000' + this.node()).slice(-16)\n ].join('-');\n }\n\n millis() {\n return this._state.millis;\n }\n\n counter() {\n return this._state.counter;\n }\n\n node() {\n return this._state.node;\n }\n\n hash() {\n return murmurhash.v3(this.toString());\n }\n}\n\nexport class MutableTimestamp extends Timestamp {\n setMillis(n) {\n this._state.millis = n;\n }\n\n setCounter(n) {\n this._state.counter = n;\n }\n\n setNode(n) {\n this._state.node = n;\n }\n}\n\nMutableTimestamp.from = timestamp => {\n return new MutableTimestamp(\n timestamp.millis(),\n timestamp.counter(),\n timestamp.node()\n );\n};\n\n// Timestamp generator initialization\n// * sets the node ID to an arbitrary value\n// * useful for mocking/unit testing\nTimestamp.init = function(options = {}) {\n if (options.maxDrift) {\n config.maxDrift = options.maxDrift;\n }\n\n setClock(\n makeClock(\n new Timestamp(\n 0,\n 0,\n options.node\n ? ('0000000000000000' + options.node).toString().slice(-16)\n : ''\n )\n ),\n null\n );\n};\n\n/**\n * Timestamp send. Generates a unique, monotonic timestamp suitable\n * for transmission to another system in string format\n */\nTimestamp.send = function() {\n if (!clock) {\n return null;\n }\n\n // retrieve the local wall time\n var phys = Date.now();\n\n // unpack the clock.timestamp logical time and counter\n var lOld = clock.timestamp.millis();\n var cOld = clock.timestamp.counter();\n\n // calculate the next logical time and counter\n // * ensure that the logical time never goes backward\n // * increment the counter if phys time does not advance\n var lNew = Math.max(lOld, phys);\n var cNew = lOld === lNew ? cOld + 1 : 0;\n\n // check the result for drift and counter overflow\n if (lNew - phys > config.maxDrift) {\n throw new Timestamp.ClockDriftError(lNew, phys, config.maxDrift);\n }\n if (cNew > 65535) {\n throw new Timestamp.OverflowError();\n }\n\n // repack the logical time/counter\n clock.timestamp.setMillis(lNew);\n clock.timestamp.setCounter(cNew);\n\n return new Timestamp(\n clock.timestamp.millis(),\n clock.timestamp.counter(),\n clock.timestamp.node()\n );\n};\n\n// Timestamp receive. Parses and merges a timestamp from a remote\n// system with the local timeglobal uniqueness and monotonicity are\n// preserved\nTimestamp.recv = function(msg) {\n if (!clock) {\n return null;\n }\n\n // retrieve the local wall time\n var phys = Date.now();\n\n // unpack the message wall time/counter\n var lMsg = msg.millis();\n var cMsg = msg.counter();\n\n // assert the node id and remote clock drift\n // if (msg.node() === clock.timestamp.node()) {\n // throw new Timestamp.DuplicateNodeError(clock.timestamp.node());\n // }\n if (lMsg - phys > config.maxDrift) {\n throw new Timestamp.ClockDriftError();\n }\n\n // unpack the clock.timestamp logical time and counter\n var lOld = clock.timestamp.millis();\n var cOld = clock.timestamp.counter();\n\n // calculate the next logical time and counter\n // . ensure that the logical time never goes backward\n // . if all logical clocks are equal, increment the max counter\n // . if max = old > message, increment local counter\n // . if max = messsage > old, increment message counter\n // . otherwise, clocks are monotonic, reset counter\n var lNew = Math.max(Math.max(lOld, phys), lMsg);\n var cNew =\n lNew === lOld && lNew === lMsg\n ? Math.max(cOld, cMsg) + 1\n : lNew === lOld\n ? cOld + 1\n : lNew === lMsg\n ? cMsg + 1\n : 0;\n\n // check the result for drift and counter overflow\n if (lNew - phys > config.maxDrift) {\n throw new Timestamp.ClockDriftError();\n }\n if (cNew > 65535) {\n throw new Timestamp.OverflowError();\n }\n\n // repack the logical time/counter\n clock.timestamp.setMillis(lNew);\n clock.timestamp.setCounter(cNew);\n\n return new Timestamp(\n clock.timestamp.millis(),\n clock.timestamp.counter(),\n clock.timestamp.node()\n );\n};\n\n/**\n * timestamp parsing\n * converts a fixed-length string timestamp to the structured value\n */\nTimestamp.parse = function(timestamp) {\n if (typeof timestamp === 'string') {\n var parts = timestamp.split('-');\n if (parts && parts.length === 5) {\n var millis = Date.parse(parts.slice(0, 3).join('-')).valueOf();\n var counter = parseInt(parts[3], 16);\n var node = parts[4];\n if (!isNaN(millis) && !isNaN(counter))\n return new Timestamp(millis, counter, node);\n }\n }\n return null;\n};\n\n/**\n * zero/minimum timestamp\n */\nvar zero = Timestamp.parse('1970-01-01T00:00:00.000Z-0000-0000000000000000');\nTimestamp.zero = function() {\n return zero;\n};\n\n/**\n * maximum timestamp\n */\nvar max = Timestamp.parse('9999-12-31T23:59:59.999Z-FFFF-FFFFFFFFFFFFFFFF');\nTimestamp.max = function() {\n return max;\n};\n\nTimestamp.since = isoString => {\n return isoString + '-0000-0000000000000000';\n};\n\n/**\n * error classes\n */\nTimestamp.DuplicateNodeError = class extends Error {\n constructor(node) {\n super();\n this.type = 'DuplicateNodeError';\n this.message = 'duplicate node identifier ' + node;\n }\n};\n\nTimestamp.ClockDriftError = class extends Error {\n constructor(...args) {\n super();\n this.type = 'ClockDriftError';\n this.message = ['maximum clock drift exceeded'].concat(args).join(' ');\n }\n};\n\nTimestamp.OverflowError = class extends Error {\n constructor() {\n super();\n this.type = 'OverflowError';\n this.message = 'timestamp counter overflow';\n }\n};\n","import { batchMessages } from '../sync';\nimport { runMutator } from '../mutators';\nimport { createApp } from '../app';\nimport * as db from '../db';\nimport { batchUpdateTransactions } from '../accounts/transactions';\n\nlet app = createApp();\n\napp.method('tools/fix-split-transactions', async () => {\n // 1. Check for child transactions that have a blank payee, and set\n // the payee to whatever the parent has\n let blankPayeeRows = await db.all(`\n SELECT t.*, p.payee AS parentPayee FROM v_transactions_internal t\n LEFT JOIN v_transactions_internal p ON t.parent_id = p.id\n WHERE t.is_child = 1 AND t.payee IS NULL AND p.payee IS NOT NULL\n `);\n\n await runMutator(async () => {\n let updated = blankPayeeRows.map(row => ({\n id: row.id,\n payee: row.parentPayee\n }));\n await batchUpdateTransactions({ updated });\n });\n\n // 2. Make sure the \"cleared\" flag is synced up with the parent\n // transactions\n let clearedRows = await db.all(`\n SELECT t.id, p.cleared FROM v_transactions_internal t\n LEFT JOIN v_transactions_internal p ON t.parent_id = p.id\n WHERE t.is_child = 1 AND t.cleared != p.cleared\n `);\n\n await runMutator(async () => {\n let updated = clearedRows.map(row => ({\n id: row.id,\n cleared: row.cleared === 1\n }));\n await batchUpdateTransactions({ updated });\n });\n\n // 3. Mark the `tombstone` field as true on any child transactions\n // that have a dead parent\n let deletedRows = await db.all(`\n SELECT t.* FROM v_transactions_internal t\n LEFT JOIN v_transactions_internal p ON t.parent_id = p.id\n WHERE t.is_child = 1 AND t.tombstone = 0 AND (p.tombstone = 1 OR p.id IS NULL)\n `);\n\n await runMutator(async () => {\n let updated = deletedRows.map(row => ({ id: row.id, tombstone: 1 }));\n await batchUpdateTransactions({ updated });\n });\n\n return {\n numBlankPayees: blankPayeeRows.length,\n numCleared: clearedRows.length,\n numDeleted: deletedRows.length\n };\n});\n\nexport default app;\n","import asyncStorage from '../../platform/server/asyncStorage';\nimport { sha256String } from '../encryption-internals';\nlet uuid = require('../../platform/uuid');\n\nlet currentUniqueId;\nlet mixpanel;\nlet isEnabled = true;\n\nexport function toggle(trackUsage) {\n isEnabled = trackUsage == null || trackUsage === 'true' ? true : false;\n}\n\n// TODO: Figure out location, send to EU data centers if in EU\n// {\n// host: \"api-eu.mixpanel.com\",\n// },\n\n// This must stay up-to-date with all apps that hit mixpanel! That includes the\n// website and server. If changing this, make sure to change it everywhere\nasync function hash(userId) {\n let hashed = await sha256String(userId);\n return `user-${hashed.replace(/[=/]/g, '')}`;\n}\n\nfunction isAnonymous(id) {\n return !id.startsWith('user-');\n}\n\nexport async function init() {\n}\n\nexport async function login(userId) {\n}\n\nlet BUFFERING = false;\nlet BUFFER = [];\n\nfunction startBuffering() {\n BUFFERING = true;\n BUFFER = [];\n}\n\nfunction stopBuffering() {\n for (let call of BUFFER) {\n call[0](...call[1]);\n }\n BUFFERING = false;\n BUFFER = [];\n}\n\nfunction buffered(func) {\n return (...args) => {\n if (process.env.NODE_ENV !== 'development') {\n if (BUFFERING) {\n BUFFER.push([func, [currentUniqueId, ...args]]);\n } else {\n func(currentUniqueId, ...args);\n }\n }\n };\n}\n\nexport const track = buffered((distinct_id, name, props) => {});\n\nexport const setProfile = buffered((distinct_id, props) => {});\n","import { sendMessages } from './sync';\nimport { getIn } from '../shared/util';\nimport Timestamp from './timestamp';\nimport { withMutatorContext, getMutatorContext } from './mutators';\nconst connection = require('../platform/server/connection');\n\n// A marker always sits as the first entry to simplify logic\nlet MESSAGE_HISTORY = [{ type: 'marker' }];\nlet CURSOR = 0;\nlet HISTORY_SIZE = 20;\n\nfunction trimHistory() {\n MESSAGE_HISTORY = MESSAGE_HISTORY.slice(0, CURSOR + 1);\n\n let markers = MESSAGE_HISTORY.filter(item => item.type === 'marker');\n if (markers.length > HISTORY_SIZE) {\n let slice = markers.slice(-HISTORY_SIZE);\n let cutoff = MESSAGE_HISTORY.indexOf(slice[0]);\n MESSAGE_HISTORY = MESSAGE_HISTORY.slice(cutoff);\n CURSOR = MESSAGE_HISTORY.length - 1;\n }\n}\n\nexport function appendMessages(messages, oldData) {\n let context = getMutatorContext();\n\n if (context.undoListening && messages.length > 0) {\n trimHistory();\n\n let { undoTag } = context;\n\n MESSAGE_HISTORY.push({\n type: 'messages',\n messages,\n oldData,\n undoTag\n });\n CURSOR++;\n }\n}\n\nexport function clearUndo() {\n MESSAGE_HISTORY = [{ type: 'marker' }];\n CURSOR = 0;\n}\n\nexport function withUndo(func, meta) {\n let context = getMutatorContext();\n if (context.undoDisabled || context.undoListening) {\n return func();\n }\n\n MESSAGE_HISTORY = MESSAGE_HISTORY.slice(0, CURSOR + 1);\n\n let marker = { type: 'marker', meta };\n\n if (MESSAGE_HISTORY[MESSAGE_HISTORY.length - 1].type === 'marker') {\n MESSAGE_HISTORY[MESSAGE_HISTORY.length - 1] = marker;\n } else {\n MESSAGE_HISTORY.push(marker);\n CURSOR++;\n }\n\n return withMutatorContext(\n { undoListening: true, undoTag: context.undoTag },\n func\n );\n}\n\nexport function undoable(func) {\n return (...args) => {\n return withUndo(() => {\n return func(...args);\n });\n };\n}\n\nasync function applyUndoAction(messages, meta, undoTag) {\n await withMutatorContext({ undoListening: false }, () => {\n return sendMessages(\n messages.map(msg => ({ ...msg, timestamp: Timestamp.send() }))\n );\n });\n\n const tables = messages.reduce((acc, message) => {\n if (!acc.includes(message.dataset)) {\n acc.push(message.dataset);\n }\n return acc;\n }, []);\n\n connection.send('undo-event', {\n messages,\n tables,\n meta,\n undoTag\n });\n}\n\nexport async function undo() {\n let end = CURSOR;\n CURSOR = Math.max(CURSOR - 1, 0);\n\n // Walk back to the nearest marker\n while (CURSOR > 0 && MESSAGE_HISTORY[CURSOR].type !== 'marker') {\n CURSOR--;\n }\n\n let meta = MESSAGE_HISTORY[CURSOR].meta;\n let start = Math.max(CURSOR, 0);\n let entries = MESSAGE_HISTORY.slice(start, end + 1).filter(\n entry => entry.type === 'messages'\n );\n\n if (entries.length > 0) {\n let toApply = entries\n .reduce((acc, entry) => {\n return acc.concat(\n entry.messages\n .map(message => undoMessage(message, entry.oldData))\n .filter(x => x)\n );\n }, [])\n .reverse();\n\n await applyUndoAction(toApply, meta, entries[0].undoTag);\n }\n}\n\nfunction undoMessage(message, oldData) {\n let oldItem = getIn(oldData, [message.dataset, message.row]);\n if (oldItem) {\n let column = message.column;\n if (message.dataset === 'spreadsheet_cells') {\n // The spreadsheet messages use the `expr` column, but only as a\n // placeholder. We actually want to read the `cachedValue` prop\n // from the old item.\n column = 'cachedValue';\n }\n\n return { ...message, value: oldItem[column] };\n } else {\n if (message.dataset === 'spreadsheet_cells') {\n if (message.column === 'expr') {\n return { ...message, value: null };\n }\n return message;\n } else if (\n // The mapping fields aren't ever deleted... this should be\n // harmless since all they are is meta information. Maybe we\n // should fix this though.\n message.dataset !== 'category_mapping' &&\n message.dataset !== 'payee_mapping'\n ) {\n if (\n message.dataset === 'zero_budget_months' ||\n message.dataset === 'zero_budgets' ||\n message.dataset === 'reflect_budgets'\n ) {\n // Only these fields are reversable\n if (['buffered', 'amount', 'carryover'].includes(message.column)) {\n return { ...message, value: 0 };\n }\n return null;\n } else if (message.dataset === 'notes') {\n return { ...message, value: null };\n }\n\n return { ...message, column: 'tombstone', value: 1 };\n }\n }\n return null;\n}\n\nexport async function redo() {\n let meta =\n MESSAGE_HISTORY[CURSOR].type === 'marker'\n ? MESSAGE_HISTORY[CURSOR].meta\n : null;\n\n let start = CURSOR;\n CURSOR = Math.min(CURSOR + 1, MESSAGE_HISTORY.length - 1);\n\n // Walk forward to the nearest marker\n while (\n CURSOR < MESSAGE_HISTORY.length - 1 &&\n MESSAGE_HISTORY[CURSOR].type !== 'marker'\n ) {\n CURSOR++;\n }\n\n let end = CURSOR;\n let entries = MESSAGE_HISTORY.slice(start + 1, end + 1).filter(\n entry => entry.type === 'messages'\n );\n\n if (entries.length > 0) {\n let toApply = entries.reduce((acc, entry) => {\n return acc\n .concat(entry.messages)\n .concat(redoResurrections(entry.messages, entry.oldData));\n }, []);\n\n await applyUndoAction(toApply, meta, entries[entries.length - 1].undoTag);\n }\n}\n\nfunction redoResurrections(messages, oldData) {\n let resurrect = new Set();\n\n messages.forEach(message => {\n // If any of the ids didn't exist before, we need to \"resurrect\"\n // them by resetting their tombstones to 0\n let oldItem = getIn(oldData, [message.dataset, message.row]);\n if (\n !oldItem &&\n ![\n 'zero_budget_months',\n 'zero_budgets',\n 'reflect_budgets',\n 'notes',\n 'category_mapping',\n 'payee_mapping'\n ].includes(message.dataset)\n ) {\n resurrect.add(message.dataset + '.' + message.row);\n }\n });\n\n return [...resurrect].map(desc => {\n let [table, row] = desc.split('.');\n return {\n dataset: table,\n row,\n column: 'tombstone',\n value: 0,\n timestamp: Timestamp.send()\n };\n });\n}\n","import md5 from 'md5';\nimport * as migrations from './migrate/migrations';\nimport * as db from './db';\nimport { schema, schemaConfig } from './aql/schema';\nimport { makeViews } from './aql/views';\n\n// Managing the init/update process\n\nasync function runMigrations() {\n await migrations.migrate(db.getDatabase());\n}\n\nexport async function updateViews() {\n let hashKey = 'view-hash';\n let row = await db.first('SELECT value FROM __meta__ WHERE key = ?', [\n hashKey\n ]);\n let { value: hash } = row || {};\n\n let views = makeViews(schema, schemaConfig);\n let currentHash = md5(views);\n\n if (hash !== currentHash) {\n await db.execQuery(views);\n await db.runQuery(\n 'INSERT OR REPLACE INTO __meta__ (key, value) VALUES (?, ?)',\n [hashKey, currentHash]\n );\n }\n}\n\nexport async function updateVersion() {\n await runMigrations();\n await updateViews();\n}\n","import fs from '../../platform/server/fs';\nconst uuid = require('../../platform/uuid');\n\nexport async function uniqueFileName(existingFiles) {\n let initialName = 'My Finances';\n let idx = 1;\n\n // If there is a conflict, keep appending an index until there is no\n // conflict and we have a unique name\n let newName = initialName;\n while (existingFiles.find(file => file.name === newName)) {\n newName = `${initialName} ${idx}`;\n idx++;\n }\n\n return newName;\n}\n\nexport async function idFromFileName(name) {\n let id =\n name.replace(/( |[^A-Za-z0-9])/g, '-') + '-' + uuid.v4Sync().slice(0, 7);\n\n // Make sure the id is unique. There's a chance one could already\n // exist (although very unlikely now that we append unique\n // characters onto the id)\n let index = 0;\n\n let budgetDir = fs.getBudgetDir(id);\n while (await fs.exists(budgetDir)) {\n index++;\n budgetDir = fs.getBudgetDir(id + index.toString());\n }\n\n // If a suffix was added, update the id\n if (index > 0) {\n id = id + index.toString();\n }\n\n return id;\n}\n","import '@rschedule/standard-date-adapter/setup';\nimport '@rschedule/json-tools/Schedule';\n\nexport * from '@rschedule/standard-date-adapter';\nexport * from '@rschedule/core';\nexport * from '@rschedule/core/generators';\n","export function fromPlaidAccountType(type, subtype) {\n switch (type) {\n case 'brokerage':\n case 'investment':\n return 'investment';\n case 'credit':\n return 'credit';\n case 'loan':\n return 'debt';\n case 'other':\n return 'other';\n case 'depository':\n default:\n switch (subtype) {\n case 'money market':\n case 'savings':\n return 'savings';\n case 'cd':\n return 'cd';\n default:\n return 'checking';\n }\n }\n}\n\nexport function prettyAccountType(type) {\n switch (type) {\n case 'checking':\n return 'Checking';\n case 'savings':\n return 'Savings';\n case 'cd':\n return 'CD';\n case 'investment':\n return 'Investment';\n case 'credit':\n return 'Credit Card';\n case 'mortgage':\n return 'Mortgage';\n case 'debt':\n return 'Debt';\n case 'other':\n default:\n return 'Other';\n }\n}\n\nexport function determineOffBudget(type) {\n switch (type) {\n case 'investment':\n case 'mortgage':\n case 'debt':\n case 'other':\n return true;\n default:\n }\n return false;\n}\n","export function sequential(fn) {\n let sequenceState = {\n running: null,\n queue: []\n };\n\n function pump() {\n if (sequenceState.queue.length > 0) {\n const next = sequenceState.queue.shift();\n run(next.args, next.resolve, next.reject);\n } else {\n sequenceState.running = null;\n }\n }\n\n function run(args, resolve, reject) {\n sequenceState.running = fn(...args);\n\n sequenceState.running.then(\n val => {\n pump();\n resolve(val);\n },\n err => {\n pump();\n reject(err);\n }\n );\n }\n\n return (...args) => {\n if (!sequenceState.running) {\n return new Promise((resolve, reject) => {\n return run(args, resolve, reject);\n });\n } else {\n return new Promise((resolve, reject) => {\n sequenceState.queue.push({ resolve, reject, args });\n });\n }\n };\n}\n\nexport function once(fn) {\n let promise = null;\n let onceFn = (...args) => {\n if (!promise) {\n promise = fn(...args).finally(() => {\n promise = null;\n });\n return promise;\n }\n\n return promise;\n };\n\n return onceFn;\n}\n","import * as d from 'date-fns';\nimport memoizeOne from 'memoize-one';\n\nfunction _parse(value) {\n if (typeof value === 'string') {\n // Dates are hard. We just want to deal with months in the format\n // 2020-01 and days in the format 2020-01-01, but life is never\n // simple. We want to rely on native dates for date logic because\n // days are complicated (leap years, etc). But relying on native\n // dates mean we're exposed to craziness.\n //\n // The biggest problem is that JS dates work with local time by\n // default. We could try to only work with UTC, but there's not an\n // easy way to make `format` avoid local time, and not sure if we\n // want that anyway (`currentMonth` should surely print the local\n // time). We need to embrace local time, and as long as inputs to\n // date logic and outputs from format are local time, it should\n // work.\n //\n // To make sure we're in local time, always give Date integer\n // values. If you pass in a string to parse, different string\n // formats produce different results.\n //\n // A big problem is daylight savings, however. Usually, when\n // giving the time to the Date constructor, you get back a date\n // specifically for that time in your local timezone. However, if\n // daylight savings occurs on that exact time, you will get back\n // something different:\n //\n // This is fine:\n // > new Date(2017, 2, 12, 1).toString()\n // > 'Sun Mar 12 2017 01:00:00 GMT-0500 (Eastern Standard Time)'\n //\n // But wait, we got back a different time (3AM instead of 2AM):\n // > new Date(2017, 2, 12, 2).toString()\n // > 'Sun Mar 12 2017 03:00:00 GMT-0400 (Eastern Daylight Time)'\n //\n // The time is \"correctly\" adjusted via DST, but we _really_\n // wanted 2AM. The problem is that time simply doesn't exist.\n //\n // Why is this a problem? Well, consider a case where the DST\n // shift happens *at midnight* and it goes back an hour. You think\n // you have a date object for the next day, but when formatted it\n // actually shows the previous day. A more likely scenario: buggy\n // timezone data makes JS dates do this shift when it shouldn't,\n // so using midnight at the time for date logic gives back the\n // last day. See the time range of Sep 30 15:00 - Oct 1 1:00 for\n // the AEST timezone when nodejs-mobile incorrectly gives you back\n // a time an hour *before* you specified. Since this happens on\n // Oct 1, doing `addMonths(September, 1)` still gives you back\n // September. Issue here:\n // https://github.com/JaneaSystems/nodejs-mobile/issues/251\n //\n // The fix is simple once you understand this. Always use the 12th\n // hour of the day. That's it. There is no DST that shifts more\n // than 12 hours (god let's hope not) so no matter how far DST has\n // shifted backwards or forwards, doing date logic will stay\n // within the day we want.\n\n let [year, month, day] = value.split('-');\n if (day != null) {\n return new Date(parseInt(year), parseInt(month) - 1, parseInt(day), 12);\n } else if (month != null) {\n return new Date(parseInt(year), parseInt(month) - 1, 1, 12);\n } else {\n return new Date(parseInt(year), 0, 1, 12);\n }\n }\n return value;\n}\n\nexport const parseDate = _parse;\n\nexport function yearFromDate(date) {\n return d.format(_parse(date), 'yyyy');\n}\n\nexport function monthFromDate(date) {\n return d.format(_parse(date), 'yyyy-MM');\n}\n\nexport function dayFromDate(date) {\n return d.format(_parse(date), 'yyyy-MM-dd');\n}\n\nexport function currentMonth() {\n if (global.IS_TESTING) {\n return '2017-01';\n } else {\n return d.format(new Date(), 'yyyy-MM');\n }\n}\n\nexport function currentDay() {\n if (global.IS_TESTING) {\n return '2017-01-01';\n } else {\n return d.format(new Date(), 'yyyy-MM-dd');\n }\n}\n\nexport function nextMonth(month) {\n return d.format(d.addMonths(_parse(month), 1), 'yyyy-MM');\n}\n\nexport function prevMonth(month) {\n return d.format(d.subMonths(_parse(month), 1), 'yyyy-MM');\n}\n\nexport function addMonths(month, n) {\n return d.format(d.addMonths(_parse(month), n), 'yyyy-MM');\n}\n\nexport function subMonths(month, n) {\n return d.format(d.subMonths(_parse(month), n), 'yyyy-MM');\n}\n\nexport function addDays(day, n) {\n return d.format(d.addDays(_parse(day), n), 'yyyy-MM-dd');\n}\n\nexport function subDays(day, n) {\n return d.format(d.subDays(_parse(day), n), 'yyyy-MM-dd');\n}\n\nexport function isBefore(month1, month2) {\n return d.isBefore(_parse(month1), _parse(month2));\n}\n\nexport function isAfter(month1, month2) {\n return d.isAfter(_parse(month1), _parse(month2));\n}\n\n// TODO: This doesn't really fit in this module anymore, should\n// probably live elsewhere\nexport function bounds(month) {\n return {\n start: parseInt(d.format(d.startOfMonth(_parse(month)), 'yyyyMMdd')),\n end: parseInt(d.format(d.endOfMonth(_parse(month)), 'yyyyMMdd'))\n };\n}\n\nexport function _range(start, end, inclusive) {\n const months = [];\n let month = monthFromDate(start);\n while (d.isBefore(_parse(month), _parse(end))) {\n months.push(month);\n month = addMonths(month, 1);\n }\n\n if (inclusive) {\n months.push(month);\n }\n\n return months;\n}\n\nexport function range(start, end) {\n return _range(start, end);\n}\n\nexport function rangeInclusive(start, end) {\n return _range(start, end, true);\n}\n\nexport function _dayRange(start, end, inclusive) {\n const days = [];\n let day = start;\n while (d.isBefore(_parse(day), _parse(end))) {\n days.push(day);\n day = addDays(day, 1);\n }\n\n if (inclusive) {\n days.push(day);\n }\n\n return days;\n}\n\nexport function dayRange(start, end) {\n return _dayRange(start, end);\n}\n\nexport function dayRangeInclusive(start, end) {\n return _dayRange(start, end, true);\n}\n\nexport function getMonthIndex(month) {\n return parseInt(month.slice(5, 7)) - 1;\n}\n\nexport function getYear(month) {\n return month.slice(0, 4);\n}\n\nexport function getMonth(day) {\n return day.slice(0, 7);\n}\n\nexport function getYearStart(month) {\n return getYear(month) + '-01';\n}\n\nexport function getYearEnd(month) {\n return getYear(month) + '-12';\n}\n\nexport function sheetForMonth(month) {\n return 'budget' + month.replace('-', '');\n}\n\nexport function nameForMonth(month) {\n return d.format(_parse(month), \"MMMM 'yy\");\n}\n\nexport function format(month, str) {\n return d.format(_parse(month), str);\n}\n\nexport const getDateFormatRegex = memoizeOne(format => {\n return new RegExp(\n format\n .replace(/d+/g, '\\\\d{1,2}')\n .replace(/M+/g, '\\\\d{1,2}')\n .replace(/y+/g, '\\\\d{4}')\n );\n});\n\nexport const getDayMonthFormat = memoizeOne(format => {\n return format\n .replace(/y+/g, '')\n .replace(/[^\\w]$/, '')\n .replace(/^[^\\w]/, '');\n});\n\nexport const getDayMonthRegex = memoizeOne(format => {\n let regex = format\n .replace(/y+/g, '')\n .replace(/[^\\w]$/, '')\n .replace(/^[^\\w]/, '')\n .replace(/d+/g, '\\\\d{1,2}')\n .replace(/M+/g, '\\\\d{1,2}');\n return new RegExp('^' + regex + '$');\n});\n\nexport const getMonthYearFormat = memoizeOne(format => {\n return format\n .replace(/d+/g, '')\n .replace(/[^\\w]$/, '')\n .replace(/^[^\\w]/, '')\n .replace(/\\/\\//, '/')\n .replace(/\\.\\./, '.')\n .replace(/--/, '-');\n});\n\nexport const getMonthYearRegex = memoizeOne(format => {\n let regex = format\n .replace(/d+/g, '')\n .replace(/[^\\w]$/, '')\n .replace(/^[^\\w]/, '')\n .replace(/\\/\\//, '/')\n .replace(/M+/g, '\\\\d{1,2}')\n .replace(/y+/g, '\\\\d{2,4}');\n return new RegExp('^' + regex + '$');\n});\n\nexport const getShortYearFormat = memoizeOne(format => {\n return format.replace(/y+/g, 'yy');\n});\n\nexport const getShortYearRegex = memoizeOne(format => {\n let regex = format\n .replace(/[^\\w]$/, '')\n .replace(/^[^\\w]/, '')\n .replace(/d+/g, '\\\\d{1,2}')\n .replace(/M+/g, '\\\\d{1,2}')\n .replace(/y+/g, '\\\\d{2}');\n return new RegExp('^' + regex + '$');\n});\n","export class Query {\n constructor(state) {\n this.state = {\n filterExpressions: state.filterExpressions || [],\n selectExpressions: state.selectExpressions || [],\n groupExpressions: state.groupExpressions || [],\n orderExpressions: state.orderExpressions || [],\n calculation: false,\n rawMode: false,\n withDead: false,\n validateRefs: true,\n limit: null,\n offset: null,\n ...state\n };\n }\n\n filter(expr) {\n return new Query({\n ...this.state,\n filterExpressions: [...this.state.filterExpressions, expr]\n });\n }\n\n unfilter(exprs) {\n let exprSet = new Set(exprs);\n return new Query({\n ...this.state,\n filterExpressions: this.state.filterExpressions.filter(\n expr => !exprSet.has(Object.keys(expr)[0])\n )\n });\n }\n\n select(exprs = []) {\n if (!Array.isArray(exprs)) {\n exprs = [exprs];\n }\n\n let query = new Query({ ...this.state, selectExpressions: exprs });\n query.state.calculation = false;\n return query;\n }\n\n calculate(expr) {\n let query = this.select({ result: expr });\n query.state.calculation = true;\n return query;\n }\n\n groupBy(exprs) {\n if (!Array.isArray(exprs)) {\n exprs = [exprs];\n }\n\n return new Query({\n ...this.state,\n groupExpressions: [...this.state.groupExpressions, ...exprs]\n });\n }\n\n orderBy(exprs) {\n if (!Array.isArray(exprs)) {\n exprs = [exprs];\n }\n\n return new Query({\n ...this.state,\n orderExpressions: [...this.state.orderExpressions, ...exprs]\n });\n }\n\n limit(num) {\n return new Query({ ...this.state, limit: num });\n }\n\n offset(num) {\n return new Query({ ...this.state, offset: num });\n }\n\n raw() {\n return new Query({ ...this.state, rawMode: true });\n }\n\n withDead() {\n return new Query({ ...this.state, withDead: true });\n }\n\n withoutValidatedRefs() {\n return new Query({ ...this.state, validateRefs: false });\n }\n\n options(opts) {\n return new Query({ ...this.state, tableOptions: opts });\n }\n\n serialize() {\n return this.state;\n }\n}\n\nexport function getPrimaryOrderBy(query, defaultOrderBy) {\n let orderExprs = query.serialize().orderExpressions;\n if (orderExprs.length === 0) {\n if (defaultOrderBy) {\n return { order: 'asc', ...defaultOrderBy };\n }\n return null;\n }\n\n let firstOrder = orderExprs[0];\n if (typeof firstOrder === 'string') {\n return { field: firstOrder, order: 'asc' };\n }\n // Handle this form: { field: 'desc' }\n let [field] = Object.keys(firstOrder);\n return { field, order: firstOrder[field] };\n}\n\nexport default function q(table) {\n return new Query({ table });\n}\n","import { integerToAmount, amountToInteger, currencyToAmount } from './util';\n\n// For now, this info is duplicated from the backend. Figure out how\n// to share it later.\nexport const TYPE_INFO = {\n date: {\n ops: ['is', 'isapprox', 'gt', 'gte', 'lt', 'lte'],\n nullable: false\n },\n id: {\n ops: ['is', 'contains', 'oneOf'],\n nullable: true\n },\n string: {\n ops: ['is', 'contains', 'oneOf'],\n nullable: false\n },\n number: {\n ops: ['is', 'isapprox', 'isbetween', 'gt', 'gte', 'lt', 'lte'],\n nullable: false\n },\n boolean: {\n ops: ['is'],\n nullable: false\n }\n};\n\nexport const FIELD_TYPES = new Map(\n Object.entries({\n imported_payee: 'string',\n payee: 'id',\n date: 'date',\n notes: 'string',\n amount: 'number',\n amountInflow: 'number',\n amountOutfow: 'number',\n category: 'id',\n account: 'id',\n cleared: 'boolean'\n })\n);\n\nexport function mapField(field, opts) {\n opts = opts || {};\n\n switch (field) {\n case 'imported_payee':\n return 'imported payee';\n case 'amount':\n if (opts.inflow) {\n return 'amount (inflow)';\n } else if (opts.outflow) {\n return 'amount (outflow)';\n }\n return 'amount';\n case 'amount-inflow':\n return 'amount (inflow)';\n case 'amount-outflow':\n return 'amount (outflow)';\n default:\n return field;\n }\n}\n\nexport function friendlyOp(op, type) {\n switch (op) {\n case 'oneOf':\n return 'one of';\n case 'is':\n return 'is';\n case 'isapprox':\n return 'is approx';\n case 'isbetween':\n return 'is between';\n case 'contains':\n return 'contains';\n case 'gt':\n if (type === 'date') {\n return 'is after';\n }\n return 'is greater than';\n case 'gte':\n if (type === 'date') {\n return 'is after or equals';\n }\n return 'is greater than or equals';\n case 'lt':\n if (type === 'date') {\n return 'is before';\n }\n return 'is less than';\n case 'lte':\n if (type === 'date') {\n return 'is before or equals';\n }\n return 'is less than or equals';\n case 'true':\n return 'is true';\n case 'false':\n return 'is false';\n case 'set':\n return 'set';\n case 'link-schedule':\n return 'link schedule';\n default:\n return '';\n }\n}\n\nexport function deserializeField(field) {\n if (field === 'amount-inflow') {\n return { field: 'amount', options: { inflow: true } };\n } else if (field === 'amount-outflow') {\n return { field: 'amount', options: { outflow: true } };\n } else {\n return { field };\n }\n}\n\nexport function getFieldError(type) {\n switch (type) {\n case 'date-format':\n return 'Invalid date format';\n case 'no-null':\n case 'no-empty-array':\n case 'no-empty-string':\n return 'Value cannot be empty';\n case 'not-number':\n return 'Value must be a number';\n case 'invalid-field':\n return 'Please choose a valid field for this type of rule';\n default:\n return 'Internal error, sorry! Contact help@actualbudget.com';\n }\n}\n\nexport function sortNumbers(num1, num2) {\n if (num1 < num2) {\n return [num1, num2];\n }\n return [num2, num1];\n}\n\nexport function parse(item) {\n switch (item.type) {\n case 'number': {\n let parsed = item.value;\n if (item.field === 'amount' && item.op !== 'isbetween') {\n parsed = integerToAmount(parsed);\n }\n return { ...item, value: parsed };\n }\n case 'string': {\n let parsed = item.value == null ? '' : item.value;\n return { ...item, value: parsed };\n }\n default:\n }\n\n return { ...item, error: null };\n}\n\nexport function unparse({ error, inputKey, ...item }) {\n switch (item.type) {\n case 'number': {\n let unparsed = item.value;\n if (item.field === 'amount' && item.op !== 'isbetween') {\n unparsed = amountToInteger(unparsed);\n }\n\n return { ...item, value: unparsed };\n }\n case 'string': {\n let unparsed = item.value == null ? '' : item.value;\n return { ...item, value: unparsed };\n }\n default:\n }\n\n return item;\n}\n\nexport function makeValue(value, cond) {\n switch (cond.type) {\n case 'number': {\n if (cond.op !== 'isbetween') {\n return {\n ...cond,\n error: null,\n value: value ? currencyToAmount(value) || 0 : 0\n };\n }\n break;\n }\n default:\n }\n\n return { ...cond, error: null, value };\n}\n\nexport function getApproxNumberThreshold(number) {\n return (Math.abs(number) * 0.075) | 0;\n}\n","import * as monthUtils from './months';\nimport q from './query';\n\nexport function getStatus(nextDate, completed, hasTrans) {\n let today = monthUtils.currentDay();\n\n if (completed) {\n return 'completed';\n } else if (hasTrans) {\n return 'paid';\n } else if (nextDate === today) {\n return 'due';\n } else if (nextDate > today && nextDate <= monthUtils.addDays(today, 7)) {\n return 'upcoming';\n } else if (nextDate < today) {\n return 'missed';\n } else {\n return 'scheduled';\n }\n}\n\nexport function getHasTransactionsQuery(schedules) {\n let filters = schedules.map(schedule => {\n let dateCond = schedule._conditions.find(c => c.field === 'date');\n return {\n $and: {\n schedule: schedule.id,\n date: {\n $gte:\n dateCond && dateCond.op === 'is'\n ? schedule.next_date\n : monthUtils.subDays(schedule.next_date, 2)\n }\n }\n };\n });\n\n return q('transactions')\n .filter({ $or: filters })\n .orderBy({ date: 'desc' })\n .groupBy('schedule')\n .select(['schedule', 'date']);\n}\n\nfunction makeNumberSuffix(num) {\n // Slight abuse of date-fns to turn a number like \"1\" into the full\n // form \"1st\" but formatting a date with that number\n return monthUtils.format(new Date(2020, 0, num, 12), 'do');\n}\n\nfunction prettyDayName(day) {\n let days = {\n SU: 'Sunday',\n MO: 'Monday',\n TU: 'Tuesday',\n WE: 'Wednesday',\n TH: 'Thursday',\n FR: 'Friday',\n SA: 'Saturday'\n };\n return days[day];\n}\n\nexport function getRecurringDescription(config) {\n let interval = config.interval || 1;\n\n switch (config.frequency) {\n case 'weekly': {\n let desc = 'Every ';\n desc += interval !== 1 ? `${interval} weeks` : 'week';\n desc += ' on ' + monthUtils.format(config.start, 'EEEE');\n return desc;\n }\n case 'monthly': {\n let desc = 'Every ';\n desc += interval !== 1 ? `${interval} months` : 'month';\n\n if (config.patterns && config.patterns.length > 0) {\n // Sort the days ascending. We filter out -1 because that\n // represents \"last days\" and should always be last, but this\n // sort would put them first\n let patterns = [...config.patterns]\n .sort((p1, p2) => {\n let typeOrder =\n (p1.type === 'day' ? 1 : 0) - (p2.type === 'day' ? 1 : 0);\n let valOrder = p1.value - p2.value;\n\n if (typeOrder === 0) {\n return valOrder;\n }\n return typeOrder;\n })\n .filter(p => p.value !== -1);\n\n // Add on all -1 values to the end\n patterns = patterns.concat(config.patterns.filter(p => p.value === -1));\n\n desc += ' on the ';\n\n let strs = [];\n\n let uniqueDays = new Set(patterns.map(p => p.type));\n let isSameDay = uniqueDays.length === 1 && !uniqueDays.has('day');\n\n for (let pattern of patterns) {\n if (pattern.type === 'day') {\n if (pattern.value === -1) {\n strs.push('last day');\n } else {\n // Example: 15th day\n strs.push(makeNumberSuffix(pattern.value));\n }\n } else {\n let dayName = isSameDay ? '' : ' ' + prettyDayName(pattern.type);\n\n if (pattern.value === -1) {\n // Example: last Monday\n strs.push('last' + dayName);\n } else {\n // Example: 3rd Monday\n strs.push(makeNumberSuffix(pattern.value) + dayName);\n }\n }\n }\n\n if (strs.length > 2) {\n desc += strs.slice(0, strs.length - 1).join(', ');\n desc += ', and ';\n desc += strs[strs.length - 1];\n } else {\n desc += strs.join(' and ');\n }\n\n if (isSameDay) {\n desc += ' ' + prettyDayName(patterns[0].type);\n }\n } else {\n desc += ' on the ' + monthUtils.format(config.start, 'do');\n }\n\n return desc;\n }\n case 'yearly': {\n let desc = 'Every ';\n desc += interval !== 1 ? `${interval} years` : 'year';\n desc += ' on ' + monthUtils.format(config.start, 'LLL do');\n return desc;\n }\n default:\n return 'Recurring error';\n }\n}\n\nexport function recurConfigToRSchedule(config) {\n let base = {\n start: monthUtils.parseDate(config.start),\n frequency: config.frequency.toUpperCase(),\n byHourOfDay: [12]\n };\n\n if (config.interval) {\n base.interval = config.interval;\n }\n\n let abbrevDay = name => name.slice(0, 2).toUpperCase();\n\n switch (config.frequency) {\n case 'weekly':\n // Nothing to do\n return [base];\n case 'monthly':\n if (config.patterns && config.patterns.length > 0) {\n let days = config.patterns.filter(p => p.type === 'day');\n let dayNames = config.patterns.filter(p => p.type !== 'day');\n\n return [\n days.length > 0 && { ...base, byDayOfMonth: days.map(p => p.value) },\n dayNames.length > 0 && {\n ...base,\n byDayOfWeek: dayNames.map(p => [abbrevDay(p.type), p.value])\n }\n ].filter(Boolean);\n } else {\n // Nothing to do\n return [base];\n }\n case 'yearly':\n return [base];\n default:\n throw new Error('Invalid recurring date config');\n }\n}\n\nexport function extractScheduleConds(conditions) {\n return {\n payee:\n conditions.find(cond => cond.op === 'is' && cond.field === 'payee') ||\n conditions.find(\n cond => cond.op === 'is' && cond.field === 'description'\n ) ||\n null,\n account:\n conditions.find(cond => cond.op === 'is' && cond.field === 'account') ||\n conditions.find(cond => cond.op === 'is' && cond.field === 'acct') ||\n null,\n amount:\n conditions.find(\n cond =>\n (cond.op === 'is' ||\n cond.op === 'isapprox' ||\n cond.op === 'isbetween') &&\n cond.field === 'amount'\n ) || null,\n date:\n conditions.find(\n cond =>\n (cond.op === 'is' || cond.op === 'isapprox') && cond.field === 'date'\n ) || null\n };\n}\n\nexport function getScheduledAmount(amount) {\n if (amount && typeof amount !== 'number') {\n return ((amount.num1 + amount.num2) / 2) | 0;\n }\n return amount;\n}\n","import { last, diffItems, getChangedValues, applyChanges } from './util';\nconst uuid = require('../platform/uuid');\n\n// The amount might be null when adding a new transaction\nfunction num(n) {\n return typeof n === 'number' ? n : 0;\n}\n\nfunction SplitTransactionError(total, parent) {\n let difference = num(parent.amount) - total;\n\n return {\n type: 'SplitTransactionError',\n version: 1,\n difference\n };\n}\n\nexport function makeChild(parent, data) {\n let prefix = parent.id === 'temp' ? 'temp' : '';\n\n return {\n amount: 0,\n ...data,\n payee: data.payee || parent.payee,\n id: data.id ? data.id : prefix + uuid.v4Sync(),\n account: parent.account,\n date: parent.date,\n cleared: parent.cleared != null ? parent.cleared : null,\n starting_balance_flag:\n parent.starting_balance_flag != null\n ? parent.starting_balance_flag\n : null,\n is_child: true,\n parent_id: parent.id,\n error: null\n };\n}\n\nexport function recalculateSplit(trans) {\n // Calculate the new total of split transactions and make sure\n // that it equals the parent amount\n const total = trans.subtransactions.reduce(\n (acc, t) => acc + num(t.amount),\n 0\n );\n return {\n ...trans,\n error:\n total === num(trans.amount) ? null : SplitTransactionError(total, trans)\n };\n}\n\nexport function findParentIndex(transactions, idx) {\n // This relies on transactions being sorted in a way where parents\n // are always before children, which is enforced in the db layer.\n // Walk backwards and find the last parent;\n while (idx >= 0) {\n let trans = transactions[idx];\n if (trans.is_parent) {\n return idx;\n }\n idx--;\n }\n return null;\n}\n\nexport function getSplit(transactions, parentIndex) {\n let split = [transactions[parentIndex]];\n let curr = parentIndex + 1;\n while (curr < transactions.length && transactions[curr].is_child) {\n split.push(transactions[curr]);\n curr++;\n }\n return split;\n}\n\nexport function ungroupTransactions(transactions) {\n let x = transactions.reduce((list, parent) => {\n let { subtransactions, ...trans } = parent;\n subtransactions = subtransactions || [];\n\n list.push(trans);\n\n for (let i = 0; i < subtransactions.length; i++) {\n list.push(subtransactions[i]);\n }\n return list;\n }, []);\n return x;\n}\n\nexport function groupTransaction(split) {\n return { ...split[0], subtransactions: split.slice(1) };\n}\n\nexport function ungroupTransaction(split) {\n if (split == null) {\n return null;\n }\n return ungroupTransactions([split]);\n}\n\nexport function applyTransactionDiff(groupedTrans, diff) {\n return groupTransaction(applyChanges(diff, ungroupTransaction(groupedTrans)));\n}\n\nexport function replaceTransactions(transactions, id, func) {\n let idx = transactions.findIndex(t => t.id === id);\n let trans = transactions[idx];\n let transactionsCopy = [...transactions];\n\n if (idx === -1) {\n throw new Error('Tried to edit unknown transaction id: ' + id);\n }\n\n if (trans.is_parent || trans.is_child) {\n let parentIndex = findParentIndex(transactions, idx);\n if (parentIndex == null) {\n console.log('Cannot find parent index');\n return { diff: { deleted: [], updated: [] } };\n }\n\n let split = getSplit(transactions, parentIndex);\n let grouped = func(groupTransaction(split));\n let newSplit = ungroupTransaction(grouped);\n\n let diff;\n if (newSplit == null) {\n // If everything was deleted, just delete the parent which will\n // delete everything\n diff = { deleted: [{ id: split[0].id }], updated: [] };\n grouped = { id: split[0].id, _deleted: true };\n transactionsCopy.splice(parentIndex, split.length);\n } else {\n diff = diffItems(split, newSplit);\n transactionsCopy.splice(parentIndex, split.length, ...newSplit);\n }\n\n return { data: transactionsCopy, newTransaction: grouped, diff };\n } else {\n let grouped = func(trans);\n let newTrans = ungroupTransaction(grouped) || [];\n if (grouped) {\n grouped.subtransactions = grouped.subtransactions || [];\n }\n transactionsCopy.splice(idx, 1, ...newTrans);\n\n return {\n data: transactionsCopy,\n newTransaction: grouped || { id: trans.id, _deleted: true },\n diff: diffItems([trans], newTrans)\n };\n }\n}\n\nexport function addSplitTransaction(transactions, id) {\n return replaceTransactions(transactions, id, trans => {\n if (!trans.is_parent) {\n return trans;\n }\n let prevSub = last(trans.subtransactions);\n trans.subtransactions.push(\n makeChild(trans, {\n amount: 0,\n sort_order: num(prevSub && prevSub.sort_order) - 1\n })\n );\n return trans;\n });\n}\n\nexport function updateTransaction(transactions, transaction) {\n return replaceTransactions(transactions, transaction.id, trans => {\n if (trans.is_parent) {\n let parent = trans.id === transaction.id ? transaction : trans;\n let sub = trans.subtransactions.map(t => {\n // Make sure to update the children to reflect the updated\n // properties (if the parent updated)\n\n let child = t;\n if (trans.id === transaction.id) {\n child = {\n ...t,\n payee: t.payee === trans.payee ? transaction.payee : t.payee\n };\n } else if (t.id === transaction.id) {\n child = transaction;\n }\n\n return makeChild(parent, child);\n });\n\n return recalculateSplit({ ...parent, subtransactions: sub });\n } else {\n return transaction;\n }\n });\n}\n\nexport function deleteTransaction(transactions, id) {\n return replaceTransactions(transactions, id, trans => {\n if (trans.is_parent) {\n if (trans.id === id) {\n return null;\n } else if (trans.subtransactions.length === 1) {\n return {\n ...trans,\n subtransactions: null,\n is_parent: false,\n error: null\n };\n } else {\n let sub = trans.subtransactions.filter(t => t.id !== id);\n return recalculateSplit({ ...trans, subtransactions: sub });\n }\n } else {\n return null;\n }\n });\n}\n\nexport function splitTransaction(transactions, id) {\n return replaceTransactions(transactions, id, trans => {\n if (trans.is_parent || trans.is_child) {\n return trans;\n }\n\n return {\n ...trans,\n is_parent: true,\n error: num(trans.amount) === 0 ? null : SplitTransactionError(0, trans),\n subtransactions: [makeChild(trans, { amount: 0, sort_order: -1 })]\n };\n });\n}\n\nexport function realizeTempTransactions(transactions) {\n let parent = transactions.find(t => !t.is_child);\n parent = { ...parent, id: uuid.v4Sync() };\n\n let children = transactions.filter(t => t.is_child);\n return [\n parent,\n ...children.map(child => ({\n ...child,\n id: uuid.v4Sync(),\n parent_id: parent.id\n }))\n ];\n}\n","let currencyFormatter = require('currency-formatter');\n\nexport function cleanUUID(uuid) {\n return uuid.replace(/-/g, '');\n}\n\nexport function last(arr) {\n return arr[arr.length - 1];\n}\n\nexport function mergeObjects(objects) {\n return Object.assign.apply(null, [{}, ...objects]);\n}\n\nexport function composeCellChanges(objects) {\n const merged = {};\n Object.keys(objects).forEach(key => {\n if (merged[key]) {\n merged[key] = { ...merged[key], ...objects[key] };\n } else {\n merged[key] = objects[key];\n }\n });\n}\n\nexport function flattenArray(arrays) {\n return Array.prototype.concat.apply([], arrays);\n}\n\nexport function shallowEqual(a, b) {\n if (a === b) {\n return true;\n }\n\n var numKeysA = 0,\n numKeysB = 0,\n key;\n for (key in b) {\n numKeysB++;\n if (!a.hasOwnProperty(key) || a[key] !== b[key]) {\n return false;\n }\n }\n for (key in a) {\n numKeysA++;\n }\n return numKeysA === numKeysB;\n}\n\nexport function getChangedValues(obj1, obj2) {\n // Keep the id field because this is mostly used to diff database\n // objects\n const diff = obj1.id ? { id: obj1.id } : {};\n const keys = Object.keys(obj2);\n let hasChanged = false;\n\n for (let i = 0; i < keys.length; i++) {\n let key = keys[i];\n\n if (obj1[key] !== obj2[key]) {\n diff[key] = obj2[key];\n hasChanged = true;\n }\n }\n\n return hasChanged ? diff : null;\n}\n\nexport function hasFieldsChanged(obj1, obj2, fields) {\n let changed = false;\n for (var i = 0; i < fields.length; i++) {\n let field = fields[i];\n if (obj1[field] !== obj2[field]) {\n changed = true;\n break;\n }\n }\n return changed;\n}\n\nexport function applyChanges(changes, items) {\n items = [...items];\n\n if (changes.added) {\n changes.added.forEach(add => {\n items.push(add);\n });\n }\n\n if (changes.updated) {\n changes.updated.forEach(({ id, ...fields }) => {\n const idx = items.findIndex(t => t.id === id);\n items[idx] = {\n ...items[idx],\n ...fields\n };\n });\n }\n\n if (changes.deleted) {\n changes.deleted.forEach(t => {\n const idx = items.findIndex(t2 => t.id === t2.id);\n if (idx !== -1) {\n items.splice(idx, 1);\n }\n });\n }\n\n return items;\n}\n\nexport function partitionByField(data, field) {\n let res = new Map();\n for (let i = 0; i < data.length; i++) {\n let item = data[i];\n let key = item[field];\n\n let items = res.get(key) || [];\n items.push(item);\n\n res.set(key, items);\n }\n return res;\n}\n\nexport function groupBy(data, field, mapper) {\n let res = new Map();\n for (let i = 0; i < data.length; i++) {\n let item = data[i];\n let key = item[field];\n let existing = res.get(key) || [];\n res.set(key, existing.concat([mapper ? mapper(item) : data[i]]));\n }\n return res;\n}\n\nexport function groupBySingle(data, field, mapper) {\n let res = new Map();\n for (let i = 0; i < data.length; i++) {\n let item = data[i];\n let key = item[field];\n if (res.has(key)) {\n throw new Error('groupBySingle found conflicting key: ' + key);\n }\n res.set(key, mapper ? mapper(item) : data[i]);\n }\n return res;\n}\n\n// This should replace the existing `groupById` function, since a\n// `Map` is better, but we can't swap it out because `Map` has a\n// different API and we need to go through and update everywhere that\n// uses it.\nfunction _groupById(data) {\n let res = new Map();\n for (let i = 0; i < data.length; i++) {\n let item = data[i];\n res.set(item.id, item);\n }\n return res;\n}\n\nexport function diffItems(items, newItems) {\n let grouped = _groupById(items);\n let newGrouped = _groupById(newItems);\n let added = [];\n let updated = [];\n\n let deleted = items\n .filter(item => !newGrouped.has(item.id))\n .map(item => ({ id: item.id }));\n\n newItems.forEach(newItem => {\n let item = grouped.get(newItem.id);\n if (!item) {\n added.push(newItem);\n } else {\n const changes = getChangedValues(item, newItem);\n if (changes) {\n updated.push(changes);\n }\n }\n });\n\n return { added, updated, deleted };\n}\n\nexport function groupById(data) {\n let res = {};\n for (let i = 0; i < data.length; i++) {\n let item = data[i];\n res[item.id] = item;\n }\n return res;\n}\n\nexport function debugMemoFailure(prevProps, nextProps) {\n let changed = getChangedValues(prevProps, nextProps);\n if (changed !== null) {\n console.log(changed);\n }\n return changed === null;\n}\n\nexport function setIn(map, keys, item) {\n for (let i = 0; i < keys.length; i++) {\n let key = keys[i];\n\n if (i === keys.length - 1) {\n map.set(key, item);\n } else {\n if (!map.has(key)) {\n map.set(key, new Map());\n }\n\n map = map.get(key);\n }\n }\n}\n\nexport function getIn(map, keys) {\n let item = map;\n for (let i = 0; i < keys.length; i++) {\n item = item.get(keys[i]);\n\n if (item == null) {\n return item;\n }\n }\n return item;\n}\n\n// Useful for throwing exception from expressions\nexport function throwError(err) {\n throw err;\n}\n\nexport function fastSetMerge(set1, set2) {\n let finalSet = new Set(set1);\n let iter = set2.values();\n let value = iter.next();\n while (!value.done) {\n finalSet.add(value.value);\n value = iter.next();\n }\n return finalSet;\n}\n\nexport function titleFirst(str) {\n return str[0].toUpperCase() + str.slice(1);\n}\n\nexport let numberFormats = [\n { value: 'comma-dot', label: '1,000.33' },\n { value: 'dot-comma', label: '1.000,33' },\n { value: 'space-comma', label: '1 000,33' }\n];\n\nlet numberFormat = {\n value: null,\n formatter: null,\n regex: null\n};\n\nexport function setNumberFormat(format) {\n let locale, regex, separator;\n\n switch (format) {\n case 'space-comma':\n locale = 'za-ZA';\n regex = /[^-0-9,]/g;\n separator = ',';\n break;\n case 'dot-comma':\n locale = 'de-DE';\n regex = /[^-0-9,]/g;\n separator = ',';\n break;\n case 'comma-dot':\n default:\n locale = 'en-US';\n regex = /[^-0-9.]/g;\n separator = '.';\n }\n\n numberFormat = {\n value: format,\n separator,\n // This is the keep in line with the Intl API which we might\n // switch to when it's available on all mobile platforms\n formatter: {\n format: number =>\n currencyFormatter.format(number, { locale, format: '%v' })\n },\n regex\n };\n}\n\nexport function getNumberFormat() {\n return numberFormat;\n}\n\nsetNumberFormat('1,000.33');\n\nexport function toRelaxedNumber(value) {\n return integerToAmount(currencyToInteger(value) || 0);\n}\n\nexport function toRelaxedInteger(value) {\n return stringToInteger(value) || 0;\n}\n\nexport function integerToCurrency(n) {\n // Awesome\n return numberFormat.formatter.format(n / 100);\n}\n\nexport function amountToCurrency(n) {\n return numberFormat.formatter.format(n);\n}\n\nexport function amountToPrettyCurrency(n, code) {\n return currencyFormatter.format(n, { code });\n}\n\nexport function currencyToAmount(str) {\n let amount = parseFloat(\n str.replace(numberFormat.regex, '').replace(numberFormat.separator, '.')\n );\n return isNaN(amount) ? null : amount;\n}\n\nexport function currencyToInteger(str) {\n let amount = currencyToAmount(str);\n return amount ? amountToInteger(amount) : null;\n}\n\nexport function stringToInteger(str) {\n let amount = parseInt(str.replace(/[^-0-9.,]/g, ''));\n if (!isNaN(amount)) {\n return amount;\n }\n return null;\n}\n\nexport function amountToInteger(n) {\n return Math.round(n * 100);\n}\n\nexport function integerToAmount(n) {\n return parseFloat((n / 100).toFixed(2));\n}\n\n// This is used when the input format could be anything (from\n// financial files and we don't want to parse based on the user's\n// number format, because the user could be importing from many\n// currencies. We extract out the numbers and just ignore separators.\nexport function looselyParseAmount(amount) {\n function safeNumber(v) {\n return isNaN(v) ? null : v;\n }\n\n let m = amount.match(/[.,][^.,]*$/);\n if (!m || m.index === 0) {\n return safeNumber(parseFloat(amount));\n }\n\n let left = amount.slice(0, m.index);\n let right = amount.slice(m.index + 1);\n\n return safeNumber(parseFloat(left.replace(/[^0-9-]/g, '') + '.' + right));\n}\n\nexport function semverToNumber(str) {\n return parseInt(\n '1' +\n str\n .split('.')\n .map(x => {\n return ('000' + x.replace(/[^0-9]/g, '')).slice(-3);\n })\n .join('')\n );\n}\n","module.exports = require(\"better-sqlite3\");","module.exports = require(\"crypto\");","module.exports = require(\"fs\");","module.exports = require(\"node-fetch\");","module.exports = require(\"node-libofx\");","module.exports = require(\"path\");","module.exports = require(\"stream\");","module.exports = require(\"string_decoder\");","module.exports = require(\"util\");","module.exports = require(\"zlib\");"],"sourceRoot":""} \ No newline at end of file diff --git a/packages/api/package.json b/packages/api/package.json index 20073089c37ecd15ed242dbd84b8e26047ccf3c0..b38ef5781e7272cadeff9c8e129cebd4630bc363 100644 --- a/packages/api/package.json +++ b/packages/api/package.json @@ -1,9 +1,18 @@ { "name": "@actual-app/api", - "version": "4.0.2", + "version": "4.1.5", "license": "MIT", "description": "An API for Actual", "main": "index.js", + "files": [ + "app", + "default-db.sqlite", + "index.js", + "injected.js", + "methods.js", + "migrations", + "utils.js" + ], "dependencies": { "better-sqlite3": "^7.5.0", "node-fetch": "^1.6.3", diff --git a/packages/desktop-client/package.json b/packages/desktop-client/package.json index bfee38538e42ce2377c2e5db8567412db4963d20..8a1e36ab32c12652adf0f0add72ca32ee8133f2f 100644 --- a/packages/desktop-client/package.json +++ b/packages/desktop-client/package.json @@ -1,6 +1,6 @@ { "name": "@actual-app/web", - "version": "22.10.25", + "version": "22.12.03", "license": "MIT", "files": [ "build" diff --git a/packages/desktop-client/src/components/accounts/Account.js b/packages/desktop-client/src/components/accounts/Account.js index e811229a30a3ae55240e070b7a174c8dbe593dc7..e180b5fa951daef9e79117401e9a4ff880497d9e 100644 --- a/packages/desktop-client/src/components/accounts/Account.js +++ b/packages/desktop-client/src/components/accounts/Account.js @@ -35,6 +35,7 @@ import { Stack } from 'loot-design/src/components/common'; import { KeyHandlers } from 'loot-design/src/components/KeyHandlers'; +import NotesButton from 'loot-design/src/components/NotesButton'; import CellValue from 'loot-design/src/components/spreadsheet/CellValue'; import format from 'loot-design/src/components/spreadsheet/format'; import useSheetValue from 'loot-design/src/components/spreadsheet/useSheetValue'; @@ -670,30 +671,46 @@ const AccountHeader = React.memo( /> </InitialFocus> ) : isNameEditable ? ( - <Button - bare + <View style={{ - fontSize: 25, - fontWeight: 500, - marginLeft: -5, - marginTop: -5, - backgroundColor: 'transparent', - '& svg': { display: 'none' }, - '&:hover svg': { display: 'unset' } + flexDirection: 'row', + alignItems: 'center', + gap: 3, + '& .hover-visible': { + opacity: 0, + transition: 'opacity .25s' + }, + '&:hover .hover-visible': { + opacity: 1 + } }} - onClick={() => onExposeName(true)} > - {accountName} - - <Pencil1 + <View style={{ - width: 11, - height: 11, - marginLeft: 5, - color: colors.n4 + fontSize: 25, + fontWeight: 500, + marginRight: 5, + marginBottom: 5 }} - /> - </Button> + > + {accountName} + </View> + + <NotesButton id={`account-${account.id}`} /> + <Button + bare + className="hover-visible" + onClick={() => onExposeName(true)} + > + <Pencil1 + style={{ + width: 11, + height: 11, + color: colors.n8 + }} + /> + </Button> + </View> ) : ( <View style={{ fontSize: 25, fontWeight: 500, marginBottom: 5 }} diff --git a/packages/desktop-electron/package.json b/packages/desktop-electron/package.json index e6fdf12f34e5fbb6c6a8b24acc7f8100899685ce..f6890d4dd54389f1850bf425e3a0e800f6d04858 100644 --- a/packages/desktop-electron/package.json +++ b/packages/desktop-electron/package.json @@ -3,7 +3,7 @@ "productName": "Actual", "author": "Shift Reset LLC", "description": "A simple and powerful personal finance system", - "version": "22.10.25", + "version": "22.12.03", "scripts": { "clean": "rm -rf dist", "build": "electron-builder", diff --git a/packages/loot-core/src/client/actions/queries.js b/packages/loot-core/src/client/actions/queries.js index 2fa3fc8ba14c93fe1d5fa4efc33f198b0e45c17c..7bd94c7d75758e9c4f9c5fb1aa3079283e25157d 100644 --- a/packages/loot-core/src/client/actions/queries.js +++ b/packages/loot-core/src/client/actions/queries.js @@ -24,21 +24,12 @@ export function applyBudgetAction(month, type, args) { case 'set-3-avg': await send('budget/set-3month-avg', { month }); break; - case 'set-all-future': - await send('budget/set-all-future', { startMonth: month }); - break; case 'hold': await send('budget/hold-for-next-month', { month, amount: args.amount }); break; - case 'hold-all-future': - await send('budget/hold-for-future-months', { - startMonth: month, - amount: args.amount - }); - break; case 'reset-hold': await send('budget/reset-hold', { month }); break; diff --git a/packages/loot-core/src/server/budget/actions.js b/packages/loot-core/src/server/budget/actions.js index 1e8266dc877a0c24b124d3cbf5d876d170d0620f..bbad221acefc4c690cfbad3cf9d71616fa290e25 100644 --- a/packages/loot-core/src/server/budget/actions.js +++ b/packages/loot-core/src/server/budget/actions.js @@ -190,26 +190,6 @@ export async function set3MonthAvg({ month }) { }); } -export async function setAllFuture({ startMonth }) { - if (!isReflectBudget()) { - throw new Error('setAllFuture only applies to report budget type'); - } - let table = getBudgetTable(); - let budgetData = await getBudgetData(table, dbMonth(startMonth)); - let months = getAllMonths(monthUtils.addMonths(startMonth, 1)); - - batchMessages(() => { - for (let month of months) { - budgetData.forEach(budget => { - if (budget.is_income === 1 && !isReflectBudget()) { - return; - } - setBudget({ category: budget.category, month, amount: budget.amount }); - }); - } - }); -} - export async function holdForNextMonth({ month, amount }) { let row = await db.first( 'SELECT buffered FROM zero_budget_months WHERE id = ?', @@ -232,18 +212,6 @@ export async function holdForNextMonth({ month, amount }) { return false; } -export async function holdForFutureMonths({ startMonth, amount }) { - let months = getAllMonths(startMonth); - - await batchMessages(async () => { - for (let month of months) { - if (!(await holdForNextMonth({ month, amount }))) { - break; - } - } - }); -} - export async function resetHold({ month }) { await setBuffer(month, 0); } diff --git a/packages/loot-core/src/server/budget/app.js b/packages/loot-core/src/server/budget/app.js index 2ef9ea936902ae1becbbe81208098d51ee6dc689..60eb58ff68c29866eb52a6f3fce6a67bcc7c1d50 100644 --- a/packages/loot-core/src/server/budget/app.js +++ b/packages/loot-core/src/server/budget/app.js @@ -12,15 +12,10 @@ app.method( ); app.method('budget/set-zero', mutator(undoable(actions.setZero))); app.method('budget/set-3month-avg', mutator(undoable(actions.set3MonthAvg))); -app.method('budget/set-all-future', mutator(undoable(actions.setAllFuture))); app.method( 'budget/hold-for-next-month', mutator(undoable(actions.holdForNextMonth)) ); -app.method( - 'budget/hold-for-future-months', - mutator(undoable(actions.holdForFutureMonths)) -); app.method('budget/reset-hold', mutator(undoable(actions.resetHold))); app.method( 'budget/cover-overspending', diff --git a/packages/loot-design/src/components/budget/report/BudgetSummary.js b/packages/loot-design/src/components/budget/report/BudgetSummary.js index 034c36878e29a658befc873ac29660d9c37bb23b..2ca372b205401b9660d33e65bcd2aaf7ac0d5d72 100644 --- a/packages/loot-design/src/components/budget/report/BudgetSummary.js +++ b/packages/loot-design/src/components/budget/report/BudgetSummary.js @@ -368,10 +368,6 @@ export default React.memo(function BudgetSummary({ month }) { { name: 'set-3-avg', text: 'Set budgets to 3 month avg' - }, - { - name: 'set-all-future', - text: 'Apply to all future budgets' } ]} /> diff --git a/packages/loot-design/src/components/budget/rollover/BudgetSummary.js b/packages/loot-design/src/components/budget/rollover/BudgetSummary.js index 715c8ed112149537487482bf2bd4a23c6d23e92f..b8eff1f3fa99667d35066763a91c92a9e621f3ff 100644 --- a/packages/loot-design/src/components/budget/rollover/BudgetSummary.js +++ b/packages/loot-design/src/components/budget/rollover/BudgetSummary.js @@ -204,10 +204,6 @@ function ToBudget({ month, prevMonthName, collapsed, onBudgetAction }) { name: 'buffer', text: 'Hold for next month' }, - { - name: 'buffer-future', - text: 'Hold for all future months' - }, { name: 'reset-buffer', text: "Reset next month's buffer" @@ -224,14 +220,6 @@ function ToBudget({ month, prevMonthName, collapsed, onBudgetAction }) { }} /> )} - {state.menuOpen === 'buffer-future' && ( - <HoldTooltip - onClose={() => setState({ menuOpen: null })} - onSubmit={amount => { - onBudgetAction(month, 'hold-all-future', { amount }); - }} - /> - )} {state.menuOpen === 'transfer' && ( <TransferTooltip initialAmountName="leftover" diff --git a/packages/mobile/src/components/budget/index.js b/packages/mobile/src/components/budget/index.js index 7ac6e461c68b059b010e49eec9cf1e9a526f005f..a726ec020cfaea7b16a1de13ba1830dc462ee57d 100644 --- a/packages/mobile/src/components/budget/index.js +++ b/packages/mobile/src/components/budget/index.js @@ -330,11 +330,6 @@ class Budget extends React.Component { case 3: this.onBudgetAction('set-3-avg'); break; - case 4: - if (budgetType === 'report') { - this.onBudgetAction('set-all-future'); - break; - } default: } }