text: (function webpackUniversalModuleDefinition(root, factory) {
  	if(typeof exports === 'object' && typeof module === 'object')
  		module.exports = factory();
  	else if(typeof define === 'function' && define.amd)
  		define([], factory);
  	else if(typeof exports === 'object')
  		exports["rrule"] = factory();
  	else
  		root["rrule"] = factory();
  })(typeof self !== 'undefined' ? self : this, function() {
  return /******/ (function(modules) { // webpackBootstrap
  /******/ 	// The module cache
  /******/ 	var installedModules = {};
  /******/
  /******/ 	// The require function
  /******/ 	function __webpack_require__(moduleId) {
  /******/
  /******/ 		// Check if module is in cache
  /******/ 		if(installedModules[moduleId]) {
  /******/ 			return installedModules[moduleId].exports;
  /******/ 		}
  /******/ 		// Create a new module (and put it into the cache)
  /******/ 		var module = installedModules[moduleId] = {
  /******/ 			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 = "";
  /******/
  /******/
  /******/ 	// Load entry module and return exports
  /******/ 	return __webpack_require__(__webpack_require__.s = 1);
  /******/ })
  /************************************************************************/
  /******/ ([
  /* 0 */
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
  
  "use strict";
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return isPresent; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return isNumber; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return isArray; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "j", function() { return range; });
  /* unused harmony export clone */
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "k", function() { return repeat; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "m", function() { return toArray; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return padStart; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "l", function() { return split; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return pymod; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return divmod; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return empty; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return notEmpty; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return includes; });
  // =============================================================================
  // Helper functions
  // =============================================================================
  var isPresent = function (value) {
      return value !== null && value !== undefined;
  };
  var isNumber = function (value) {
      return typeof value === 'number';
  };
  var isArray = Array.isArray;
  /**
   * Simplified version of python's range()
   */
  var range = function (start, end) {
      if (end === void 0) { end = start; }
      if (arguments.length === 1) {
          end = start;
          start = 0;
      }
      var rang = [];
      for (var i = start; i < end; i++)
          rang.push(i);
      return rang;
  };
  var clone = function (array) {
      return [].concat(array);
  };
  var repeat = function (value, times) {
      var i = 0;
      var array = [];
      if (isArray(value)) {
          for (; i < times; i++)
              array[i] = [].concat(value);
      }
      else {
          for (; i < times; i++)
              array[i] = value;
      }
      return array;
  };
  var toArray = function (item) {
      if (isArray(item)) {
          return item;
      }
      return [item];
  };
  function padStart(item, targetLength, padString) {
      if (padString === void 0) { padString = ' '; }
      var str = String(item);
      targetLength = targetLength >> 0;
      if (str.length > targetLength) {
          return String(str);
      }
      targetLength = targetLength - str.length;
      if (targetLength > padString.length) {
          padString += repeat(padString, targetLength / padString.length);
      }
      return padString.slice(0, targetLength) + String(str);
  }
  /**
   * Python like split
   */
  var split = function (str, sep, num) {
      var splits = str.split(sep);
      return num
          ? splits.slice(0, num).concat([splits.slice(num).join(sep)])
          : splits;
  };
  /**
   * closure/goog/math/math.js:modulo
   * Copyright 2006 The Closure Library Authors.
   * The % operator in JavaScript returns the remainder of a / b, but differs from
   * some other languages in that the result will have the same sign as the
   * dividend. For example, -1 % 8 == -1, whereas in some other languages
   * (such as Python) the result would be 7. This function emulates the more
   * correct modulo behavior, which is useful for certain applications such as
   * calculating an offset index in a circular list.
   *
   * @param {number} a The dividend.
   * @param {number} b The divisor.
   * @return {number} a % b where the result is between 0 and b (either 0 <= x < b
   *     or b < x <= 0, depending on the sign of b).
   */
  var pymod = function (a, b) {
      var r = a % b;
      // If r and b differ in sign, add b to wrap the result to the correct sign.
      return r * b < 0 ? r + b : r;
  };
  /**
   * @see: <http://docs.python.org/library/functions.html#divmod>
   */
  var divmod = function (a, b) {
      return { div: Math.floor(a / b), mod: pymod(a, b) };
  };
  var empty = function (obj) {
      return !isPresent(obj) || obj.length === 0;
  };
  /**
   * Python-like boolean
   * @return {Boolean} value of an object/primitive, taking into account
   * the fact that in Python an empty list's/tuple's
   * boolean value is False, whereas in JS it's true
   */
  var notEmpty = function (obj) {
      return !empty(obj);
  };
  /**
   * Return true if a value is in an array
   */
  var includes = function (arr, val) {
      return notEmpty(arr) && arr.indexOf(val) !== -1;
  };
  
  
  /***/ }),
  /* 1 */
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
  
  "use strict";
  __webpack_require__.r(__webpack_exports__);
  
  // EXTERNAL MODULE: ./src/helpers.ts
  var helpers = __webpack_require__(0);
  
  // CONCATENATED MODULE: ./src/dateutil.ts
  
  /**
   * General date-related utilities.
   * Also handles several incompatibilities between JavaScript and Python
   *
   */
  var dateutil_dateutil;
  (function (dateutil) {
      dateutil.MONTH_DAYS = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
      /**
       * Number of milliseconds of one day
       */
      dateutil.ONE_DAY = 1000 * 60 * 60 * 24;
      /**
       * @see: <http://docs.python.org/library/datetime.html#datetime.MAXYEAR>
       */
      dateutil.MAXYEAR = 9999;
      /**
       * Python uses 1-Jan-1 as the base for calculating ordinals but we don't
       * want to confuse the JS engine with milliseconds > Number.MAX_NUMBER,
       * therefore we use 1-Jan-1970 instead
       */
      dateutil.ORDINAL_BASE = new Date(Date.UTC(1970, 0, 1));
      /**
       * Python: MO-SU: 0 - 6
       * JS: SU-SAT 0 - 6
       */
      dateutil.PY_WEEKDAYS = [6, 0, 1, 2, 3, 4, 5];
      /**
       * py_date.timetuple()[7]
       */
      dateutil.getYearDay = function (date) {
          var dateNoTime = new Date(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate());
          return (Math.ceil((dateNoTime.valueOf() -
              new Date(date.getUTCFullYear(), 0, 1).valueOf()) /
              dateutil.ONE_DAY) + 1);
      };
      dateutil.isLeapYear = function (year) {
          return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;
      };
      dateutil.isDate = function (value) {
          return value instanceof Date;
      };
      dateutil.isValidDate = function (value) {
          return dateutil.isDate(value) && !isNaN(value.getTime());
      };
      /**
       * @return {Number} the date's timezone offset in ms
       */
      dateutil.tzOffset = function (date) {
          return date.getTimezoneOffset() * 60 * 1000;
      };
      /**
       * @see: <http://www.mcfedries.com/JavaScript/DaysBetween.asp>
       */
      dateutil.daysBetween = function (date1, date2) {
          // The number of milliseconds in one day
          // Convert both dates to milliseconds
          var date1ms = date1.getTime() - dateutil.tzOffset(date1);
          var date2ms = date2.getTime() - dateutil.tzOffset(date2);
          // Calculate the difference in milliseconds
          var differencems = date1ms - date2ms;
          // Convert back to days and return
          return Math.round(differencems / dateutil.ONE_DAY);
      };
      /**
       * @see: <http://docs.python.org/library/datetime.html#datetime.date.toordinal>
       */
      dateutil.toOrdinal = function (date) {
          return dateutil.daysBetween(date, dateutil.ORDINAL_BASE);
      };
      /**
       * @see - <http://docs.python.org/library/datetime.html#datetime.date.fromordinal>
       */
      dateutil.fromOrdinal = function (ordinal) {
          return new Date(dateutil.ORDINAL_BASE.getTime() + ordinal * dateutil.ONE_DAY);
      };
      dateutil.getMonthDays = function (date) {
          var month = date.getUTCMonth();
          return month === 1 && dateutil.isLeapYear(date.getUTCFullYear())
              ? 29
              : dateutil.MONTH_DAYS[month];
      };
      /**
       * @return {Number} python-like weekday
       */
      dateutil.getWeekday = function (date) {
          return dateutil.PY_WEEKDAYS[date.getUTCDay()];
      };
      /**
       * @see: <http://docs.python.org/library/calendar.html#calendar.monthrange>
       */
      dateutil.monthRange = function (year, month) {
          var date = new Date(Date.UTC(year, month, 1));
          return [dateutil.getWeekday(date), dateutil.getMonthDays(date)];
      };
      /**
       * @see: <http://docs.python.org/library/datetime.html#datetime.datetime.combine>
       */
      dateutil.combine = function (date, time) {
          time = time || date;
          return new Date(Date.UTC(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate(), time.getHours(), time.getMinutes(), time.getSeconds(), time.getMilliseconds()));
      };
      dateutil.clone = function (date) {
          var dolly = new Date(date.getTime());
          return dolly;
      };
      dateutil.cloneDates = function (dates) {
          var clones = [];
          for (var i = 0; i < dates.length; i++) {
              clones.push(dateutil.clone(dates[i]));
          }
          return clones;
      };
      /**
       * Sorts an array of Date or dateutil.Time objects
       */
      dateutil.sort = function (dates) {
          dates.sort(function (a, b) {
              return a.getTime() - b.getTime();
          });
      };
      dateutil.timeToUntilString = function (time, utc) {
          if (utc === void 0) { utc = true; }
          var date = new Date(time);
          return [
              Object(helpers["h" /* padStart */])(date.getUTCFullYear().toString(), 4, '0'),
              Object(helpers["h" /* padStart */])(date.getUTCMonth() + 1, 2, '0'),
              Object(helpers["h" /* padStart */])(date.getUTCDate(), 2, '0'),
              'T',
              Object(helpers["h" /* padStart */])(date.getUTCHours(), 2, '0'),
              Object(helpers["h" /* padStart */])(date.getUTCMinutes(), 2, '0'),
              Object(helpers["h" /* padStart */])(date.getUTCSeconds(), 2, '0'),
              utc ? 'Z' : ''
          ].join('');
      };
      dateutil.untilStringToDate = function (until) {
          var re = /^(\d{4})(\d{2})(\d{2})(T(\d{2})(\d{2})(\d{2})Z?)?$/;
          var bits = re.exec(until);
          if (!bits)
              throw new Error("Invalid UNTIL value: " + until);
          return new Date(Date.UTC(parseInt(bits[1], 10), parseInt(bits[2], 10) - 1, parseInt(bits[3], 10), parseInt(bits[5], 10) || 0, parseInt(bits[6], 10) || 0, parseInt(bits[7], 10) || 0));
      };
  })(dateutil_dateutil || (dateutil_dateutil = {}));
  /* harmony default export */ var src_dateutil = (dateutil_dateutil);
  
  // CONCATENATED MODULE: ./src/iterresult.ts
  /**
   * This class helps us to emulate python's generators, sorta.
   */
  var IterResult = /** @class */ (function () {
      function IterResult(method, args) {
          this.minDate = null;
          this.maxDate = null;
          this._result = [];
          this.total = 0;
          this.method = method;
          this.args = args;
          if (method === 'between') {
              this.maxDate = args.inc
                  ? args.before
                  : new Date(args.before.getTime() - 1);
              this.minDate = args.inc ? args.after : new Date(args.after.getTime() + 1);
          }
          else if (method === 'before') {
              this.maxDate = args.inc ? args.dt : new Date(args.dt.getTime() - 1);
          }
          else if (method === 'after') {
              this.minDate = args.inc ? args.dt : new Date(args.dt.getTime() + 1);
          }
      }
      /**
       * Possibly adds a date into the result.
       *
       * @param {Date} date - the date isn't necessarly added to the result
       *                      list (if it is too late/too early)
       * @return {Boolean} true if it makes sense to continue the iteration
       *                   false if we're done.
       */
      IterResult.prototype.accept = function (date) {
          ++this.total;
          var tooEarly = this.minDate && date < this.minDate;
          var tooLate = this.maxDate && date > this.maxDate;
          if (this.method === 'between') {
              if (tooEarly)
                  return true;
              if (tooLate)
                  return false;
          }
          else if (this.method === 'before') {
              if (tooLate)
                  return false;
          }
          else if (this.method === 'after') {
              if (tooEarly)
                  return true;
              this.add(date);
              return false;
          }
          return this.add(date);
      };
      /**
       *
       * @param {Date} date that is part of the result.
       * @return {Boolean} whether we are interested in more values.
       */
      IterResult.prototype.add = function (date) {
          this._result.push(date);
          return true;
      };
      /**
       * 'before' and 'after' return only one date, whereas 'all'
       * and 'between' an array.
       * @return {Date,Array?}
       */
      IterResult.prototype.getValue = function () {
          var res = this._result;
          switch (this.method) {
              case 'all':
              case 'between':
                  return res;
              case 'before':
              case 'after':
              default:
                  return (res.length ? res[res.length - 1] : null);
          }
      };
      IterResult.prototype.clone = function () {
          return new IterResult(this.method, this.args);
      };
      return IterResult;
  }());
  /* harmony default export */ var iterresult = (IterResult);
  
  // CONCATENATED MODULE: ./node_modules/tslib/tslib.es6.js
  /*! *****************************************************************************
  Copyright (c) Microsoft Corporation. All rights reserved.
  Licensed under the Apache License, Version 2.0 (the "License"); you may not use
  this file except in compliance with the License. You may obtain a copy of the
  License at http://www.apache.org/licenses/LICENSE-2.0
  
  THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
  WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
  MERCHANTABLITY OR NON-INFRINGEMENT.
  
  See the Apache Version 2.0 License for specific language governing permissions
  and limitations under the License.
  ***************************************************************************** */
  /* global Reflect, Promise */
  
  var extendStatics = function(d, b) {
      extendStatics = Object.setPrototypeOf ||
          ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
          function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
      return extendStatics(d, b);
  };
  
  function __extends(d, b) {
      extendStatics(d, b);
      function __() { this.constructor = d; }
      d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  }
  
  var __assign = function() {
      __assign = Object.assign || function __assign(t) {
          for (var s, i = 1, n = arguments.length; i < n; i++) {
              s = arguments[i];
              for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
          }
          return t;
      }
      return __assign.apply(this, arguments);
  }
  
  function __rest(s, e) {
      var t = {};
      for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
          t[p] = s[p];
      if (s != null && typeof Object.getOwnPropertySymbols === "function")
          for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)
              t[p[i]] = s[p[i]];
      return t;
  }
  
  function __decorate(decorators, target, key, desc) {
      var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
      if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
      else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
      return c > 3 && r && Object.defineProperty(target, key, r), r;
  }
  
  function __param(paramIndex, decorator) {
      return function (target, key) { decorator(target, key, paramIndex); }
  }
  
  function __metadata(metadataKey, metadataValue) {
      if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
  }
  
  function __awaiter(thisArg, _arguments, P, generator) {
      return new (P || (P = Promise))(function (resolve, reject) {
          function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
          function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
          function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
          step((generator = generator.apply(thisArg, _arguments || [])).next());
      });
  }
  
  function __generator(thisArg, body) {
      var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
      return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
      function verb(n) { return function (v) { return step([n, v]); }; }
      function step(op) {
          if (f) throw new TypeError("Generator is already executing.");
          while (_) try {
              if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
              if (y = 0, t) op = [op[0] & 2, t.value];
              switch (op[0]) {
                  case 0: case 1: t = op; break;
                  case 4: _.label++; return { value: op[1], done: false };
                  case 5: _.label++; y = op[1]; op = [0]; continue;
                  case 7: op = _.ops.pop(); _.trys.pop(); continue;
                  default:
                      if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
                      if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
                      if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
                      if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
                      if (t[2]) _.ops.pop();
                      _.trys.pop(); continue;
              }
              op = body.call(thisArg, _);
          } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
          if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
      }
  }
  
  function __exportStar(m, exports) {
      for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  }
  
  function __values(o) {
      var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0;
      if (m) return m.call(o);
      return {
          next: function () {
              if (o && i >= o.length) o = void 0;
              return { value: o && o[i++], done: !o };
          }
      };
  }
  
  function __read(o, n) {
      var m = typeof Symbol === "function" && o[Symbol.iterator];
      if (!m) return o;
      var i = m.call(o), r, ar = [], e;
      try {
          while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
      }
      catch (error) { e = { error: error }; }
      finally {
          try {
              if (r && !r.done && (m = i["return"])) m.call(i);
          }
          finally { if (e) throw e.error; }
      }
      return ar;
  }
  
  function __spread() {
      for (var ar = [], i = 0; i < arguments.length; i++)
          ar = ar.concat(__read(arguments[i]));
      return ar;
  }
  
  function __await(v) {
      return this instanceof __await ? (this.v = v, this) : new __await(v);
  }
  
  function __asyncGenerator(thisArg, _arguments, generator) {
      if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
      var g = generator.apply(thisArg, _arguments || []), i, q = [];
      return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
      function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
      function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
      function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
      function fulfill(value) { resume("next", value); }
      function reject(value) { resume("throw", value); }
      function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
  }
  
  function __asyncDelegator(o) {
      var i, p;
      return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
      function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
  }
  
  function __asyncValues(o) {
      if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
      var m = o[Symbol.asyncIterator], i;
      return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
      function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
      function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
  }
  
  function __makeTemplateObject(cooked, raw) {
      if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
      return cooked;
  };
  
  function __importStar(mod) {
      if (mod && mod.__esModule) return mod;
      var result = {};
      if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
      result.default = mod;
      return result;
  }
  
  function __importDefault(mod) {
      return (mod && mod.__esModule) ? mod : { default: mod };
  }
  
  // CONCATENATED MODULE: ./src/callbackiterresult.ts
  
  
  /**
   * IterResult subclass that calls a callback function on each add,
   * and stops iterating when the callback returns false.
   */
  var callbackiterresult_CallbackIterResult = /** @class */ (function (_super) {
      __extends(CallbackIterResult, _super);
      function CallbackIterResult(method, args, iterator) {
          var _this = _super.call(this, method, args) || this;
          _this.iterator = iterator;
          return _this;
      }
      CallbackIterResult.prototype.add = function (date) {
          if (this.iterator(date, this._result.length)) {
              this._result.push(date);
              return true;
          }
          return false;
      };
      return CallbackIterResult;
  }(iterresult));
  /* harmony default export */ var callbackiterresult = (callbackiterresult_CallbackIterResult);
  
  // CONCATENATED MODULE: ./src/types.ts
  var Frequency;
  (function (Frequency) {
      Frequency[Frequency["YEARLY"] = 0] = "YEARLY";
      Frequency[Frequency["MONTHLY"] = 1] = "MONTHLY";
      Frequency[Frequency["WEEKLY"] = 2] = "WEEKLY";
      Frequency[Frequency["DAILY"] = 3] = "DAILY";
      Frequency[Frequency["HOURLY"] = 4] = "HOURLY";
      Frequency[Frequency["MINUTELY"] = 5] = "MINUTELY";
      Frequency[Frequency["SECONDLY"] = 6] = "SECONDLY";
  })(Frequency || (Frequency = {}));
  function freqIsDailyOrGreater(freq) {
      return freq < Frequency.HOURLY;
  }
  
  // CONCATENATED MODULE: ./src/weekday.ts
  // =============================================================================
  // Weekday
  // =============================================================================
  var WDAYS = ['MO', 'TU', 'WE', 'TH', 'FR', 'SA', 'SU'];
  var Weekday = /** @class */ (function () {
      function Weekday(weekday, n) {
          if (n === 0)
              throw new Error("Can't create weekday with n == 0");
          this.weekday = weekday;
          this.n = n;
      }
      // __call__ - Cannot call the object directly, do it through
      // e.g. RRule.TH.nth(-1) instead,
      Weekday.prototype.nth = function (n) {
          return this.n === n ? this : new Weekday(this.weekday, n);
      };
      // __eq__
      Weekday.prototype.equals = function (other) {
          return this.weekday === other.weekday && this.n === other.n;
      };
      // __repr__
      Weekday.prototype.toString = function () {
          var s = WDAYS[this.weekday];
          if (this.n)
              s = (this.n > 0 ? '+' : '') + String(this.n) + s;
          return s;
      };
      Weekday.prototype.getJsWeekday = function () {
          return this.weekday === 6 ? 0 : this.weekday + 1;
      };
      return Weekday;
  }());
  
  
  // CONCATENATED MODULE: ./src/datetime.ts
  
  
  
  
  var Time = /** @class */ (function () {
      function Time(hour, minute, second, millisecond) {
          this.hour = hour;
          this.minute = minute;
          this.second = second;
          this.millisecond = millisecond || 0;
      }
      Time.prototype.getHours = function () {
          return this.hour;
      };
      Time.prototype.getMinutes = function () {
          return this.minute;
      };
      Time.prototype.getSeconds = function () {
          return this.second;
      };
      Time.prototype.getMilliseconds = function () {
          return this.millisecond;
      };
      Time.prototype.getTime = function () {
          return ((this.hour * 60 * 60 + this.minute * 60 + this.second) * 1000 +
              this.millisecond);
      };
      return Time;
  }());
  
  var datetime_DateTime = /** @class */ (function (_super) {
      __extends(DateTime, _super);
      function DateTime(year, month, day, hour, minute, second, millisecond) {
          var _this = _super.call(this, hour, minute, second, millisecond) || this;
          _this.year = year;
          _this.month = month;
          _this.day = day;
          return _this;
      }
      DateTime.fromDate = function (date) {
          return new this(date.getUTCFullYear(), date.getUTCMonth() + 1, date.getUTCDate(), date.getUTCHours(), date.getUTCMinutes(), date.getUTCSeconds(), date.valueOf() % 1000);
      };
      DateTime.prototype.getWeekday = function () {
          return dateutil_dateutil.getWeekday(new Date(this.getTime()));
      };
      DateTime.prototype.getTime = function () {
          return new Date(Date.UTC(this.year, this.month - 1, this.day, this.hour, this.minute, this.second, this.millisecond)).getTime();
      };
      DateTime.prototype.getDay = function () {
          return this.day;
      };
      DateTime.prototype.getMonth = function () {
          return this.month;
      };
      DateTime.prototype.getYear = function () {
          return this.year;
      };
      DateTime.prototype.addYears = function (years) {
          this.year += years;
      };
      DateTime.prototype.addMonths = function (months) {
          this.month += months;
          if (this.month > 12) {
              var yearDiv = Math.floor(this.month / 12);
              var monthMod = Object(helpers["i" /* pymod */])(this.month, 12);
              this.month = monthMod;
              this.year += yearDiv;
              if (this.month === 0) {
                  this.month = 12;
                  --this.year;
              }
          }
      };
      DateTime.prototype.addWeekly = function (days, wkst) {
          if (wkst > this.getWeekday()) {
              this.day += -(this.getWeekday() + 1 + (6 - wkst)) + days * 7;
          }
          else {
              this.day += -(this.getWeekday() - wkst) + days * 7;
          }
          this.fixDay();
      };
      DateTime.prototype.addDaily = function (days) {
          this.day += days;
          this.fixDay();
      };
      DateTime.prototype.addHours = function (hours, filtered, byhour) {
          if (filtered) {
              // Jump to one iteration before next day
              this.hour += Math.floor((23 - this.hour) / hours) * hours;
          }
          while (true) {
              this.hour += hours;
              var _a = Object(helpers["a" /* divmod */])(this.hour, 24), dayDiv = _a.div, hourMod = _a.mod;
              if (dayDiv) {
                  this.hour = hourMod;
                  this.addDaily(dayDiv);
              }
              if (Object(helpers["b" /* empty */])(byhour) || Object(helpers["c" /* includes */])(byhour, this.hour))
                  break;
          }
      };
      DateTime.prototype.addMinutes = function (minutes, filtered, byhour, byminute) {
          if (filtered) {
              // Jump to one iteration before next day
              this.minute +=
                  Math.floor((1439 - (this.hour * 60 + this.minute)) / minutes) * minutes;
          }
          while (true) {
              this.minute += minutes;
              var _a = Object(helpers["a" /* divmod */])(this.minute, 60), hourDiv = _a.div, minuteMod = _a.mod;
              if (hourDiv) {
                  this.minute = minuteMod;
                  this.addHours(hourDiv, false, byhour);
              }
              if ((Object(helpers["b" /* empty */])(byhour) || Object(helpers["c" /* includes */])(byhour, this.hour)) &&
                  (Object(helpers["b" /* empty */])(byminute) || Object(helpers["c" /* includes */])(byminute, this.minute))) {
                  break;
              }
          }
      };
      DateTime.prototype.addSeconds = function (seconds, filtered, byhour, byminute, bysecond) {
          if (filtered) {
              // Jump to one iteration before next day
              this.second +=
                  Math.floor((86399 - (this.hour * 3600 + this.minute * 60 + this.second)) / seconds) * seconds;
          }
          while (true) {
              this.second += seconds;
              var _a = Object(helpers["a" /* divmod */])(this.second, 60), minuteDiv = _a.div, secondMod = _a.mod;
              if (minuteDiv) {
                  this.second = secondMod;
                  this.addMinutes(minuteDiv, false, byhour, byminute);
              }
              if ((Object(helpers["b" /* empty */])(byhour) || Object(helpers["c" /* includes */])(byhour, this.hour)) &&
                  (Object(helpers["b" /* empty */])(byminute) || Object(helpers["c" /* includes */])(byminute, this.minute)) &&
                  (Object(helpers["b" /* empty */])(bysecond) || Object(helpers["c" /* includes */])(bysecond, this.second))) {
                  break;
              }
          }
      };
      DateTime.prototype.fixDay = function () {
          if (this.day <= 28) {
              return;
          }
          var daysinmonth = dateutil_dateutil.monthRange(this.year, this.month - 1)[1];
          if (this.day <= daysinmonth) {
              return;
          }
          while (this.day > daysinmonth) {
              this.day -= daysinmonth;
              ++this.month;
              if (this.month === 13) {
                  this.month = 1;
                  ++this.year;
                  if (this.year > dateutil_dateutil.MAXYEAR) {
                      return;
                  }
              }
              daysinmonth = dateutil_dateutil.monthRange(this.year, this.month - 1)[1];
          }
      };
      DateTime.prototype.add = function (options, filtered) {
          var freq = options.freq, interval = options.interval, wkst = options.wkst, byhour = options.byhour, byminute = options.byminute, bysecond = options.bysecond;
          switch (freq) {
              case Frequency.YEARLY: return this.addYears(interval);
              case Frequency.MONTHLY: return this.addMonths(interval);
              case Frequency.WEEKLY: return this.addWeekly(interval, wkst);
              case Frequency.DAILY: return this.addDaily(interval);
              case Frequency.HOURLY: return this.addHours(interval, filtered, byhour);
              case Frequency.MINUTELY: return this.addMinutes(interval, filtered, byhour, byminute);
              case Frequency.SECONDLY: return this.addSeconds(interval, filtered, byhour, byminute, bysecond);
          }
      };
      return DateTime;
  }(Time));
  
  
  // CONCATENATED MODULE: ./src/parseoptions.ts
  
  
  
  
  
  
  function initializeOptions(options) {
      var invalid = [];
      var keys = Object.keys(options);
      var initializedOptions = {};
      // Shallow copy for options and origOptions and check for invalid
      keys.forEach(function (key) {
          var value = options[key];
          initializedOptions[key] = value;
          if (!Object(helpers["c" /* includes */])(rrule_defaultKeys, key))
              invalid.push(key);
          if (src_dateutil.isDate(value) && !src_dateutil.isValidDate(value))
              invalid.push(key);
      });
      if (invalid.length) {
          throw new Error('Invalid options: ' + invalid.join(', '));
      }
      return initializedOptions;
  }
  function parseOptions(options) {
      var opts = initializeOptions(options);
      var keys = Object.keys(options);
      // Merge in default options
      rrule_defaultKeys.forEach(function (key) {
          if (!Object(helpers["c" /* includes */])(keys, key) || !Object(helpers["f" /* isPresent */])(opts[key]))
              opts[key] = DEFAULT_OPTIONS[key];
      });
      if (Object(helpers["f" /* isPresent */])(opts.byeaster))
          opts.freq = src_rrule.YEARLY;
      if (!(Object(helpers["f" /* isPresent */])(opts.freq) && src_rrule.FREQUENCIES[opts.freq])) {
          throw new Error("Invalid frequency: " + opts.freq + " " + options.freq);
      }
      if (!opts.dtstart)
          opts.dtstart = new Date(new Date().setMilliseconds(0));
      if (!Object(helpers["f" /* isPresent */])(opts.wkst)) {
          opts.wkst = src_rrule.MO.weekday;
      }
      else if (Object(helpers["e" /* isNumber */])(opts.wkst)) {
          // cool, just keep it like that
      }
      else {
          opts.wkst = opts.wkst.weekday;
      }
      if (Object(helpers["f" /* isPresent */])(opts.bysetpos)) {
          if (Object(helpers["e" /* isNumber */])(opts.bysetpos))
              opts.bysetpos = [opts.bysetpos];
          for (var i = 0; i < opts.bysetpos.length; i++) {
              var v = opts.bysetpos[i];
              if (v === 0 || !(v >= -366 && v <= 366)) {
                  throw new Error('bysetpos must be between 1 and 366,' + ' or between -366 and -1');
              }
          }
      }
      if (!(Boolean(opts.byweekno) ||
          Object(helpers["g" /* notEmpty */])(opts.byweekno) ||
          Object(helpers["g" /* notEmpty */])(opts.byyearday) ||
          Boolean(opts.bymonthday) ||
          Object(helpers["g" /* notEmpty */])(opts.bymonthday) ||
          Object(helpers["f" /* isPresent */])(opts.byweekday) ||
          Object(helpers["f" /* isPresent */])(opts.byeaster))) {
          switch (opts.freq) {
              case src_rrule.YEARLY:
                  if (!opts.bymonth)
                      opts.bymonth = opts.dtstart.getUTCMonth() + 1;
                  opts.bymonthday = opts.dtstart.getUTCDate();
                  break;
              case src_rrule.MONTHLY:
                  opts.bymonthday = opts.dtstart.getUTCDate();
                  break;
              case src_rrule.WEEKLY:
                  opts.byweekday = [src_dateutil.getWeekday(opts.dtstart)];
                  break;
          }
      }
      // bymonth
      if (Object(helpers["f" /* isPresent */])(opts.bymonth) && !Object(helpers["d" /* isArray */])(opts.bymonth)) {
          opts.bymonth = [opts.bymonth];
      }
      // byyearday
      if (Object(helpers["f" /* isPresent */])(opts.byyearday) &&
          !Object(helpers["d" /* isArray */])(opts.byyearday) &&
          Object(helpers["e" /* isNumber */])(opts.byyearday)) {
          opts.byyearday = [opts.byyearday];
      }
      // bymonthday
      if (!Object(helpers["f" /* isPresent */])(opts.bymonthday)) {
          opts.bymonthday = [];
          opts.bynmonthday = [];
      }
      else if (Object(helpers["d" /* isArray */])(opts.bymonthday)) {
          var bymonthday = [];
          var bynmonthday = [];
          for (var i = 0; i < opts.bymonthday.length; i++) {
              var v = opts.bymonthday[i];
              if (v > 0) {
                  bymonthday.push(v);
              }
              else if (v < 0) {
                  bynmonthday.push(v);
              }
          }
          opts.bymonthday = bymonthday;
          opts.bynmonthday = bynmonthday;
      }
      else if (opts.bymonthday < 0) {
          opts.bynmonthday = [opts.bymonthday];
          opts.bymonthday = [];
      }
      else {
          opts.bynmonthday = [];
          opts.bymonthday = [opts.bymonthday];
      }
      // byweekno
      if (Object(helpers["f" /* isPresent */])(opts.byweekno) && !Object(helpers["d" /* isArray */])(opts.byweekno)) {
          opts.byweekno = [opts.byweekno];
      }
      // byweekday / bynweekday
      if (!Object(helpers["f" /* isPresent */])(opts.byweekday)) {
          opts.bynweekday = null;
      }
      else if (Object(helpers["e" /* isNumber */])(opts.byweekday)) {
          opts.byweekday = [opts.byweekday];
          opts.bynweekday = null;
      }
      else if (opts.byweekday instanceof Weekday) {
          if (!opts.byweekday.n || opts.freq > src_rrule.MONTHLY) {
              opts.byweekday = [opts.byweekday.weekday];
              opts.bynweekday = null;
          }
          else {
              opts.bynweekday = [[opts.byweekday.weekday, opts.byweekday.n]];
              opts.byweekday = null;
          }
      }
      else {
          var byweekday = [];
          var bynweekday = [];
          for (var i = 0; i < opts.byweekday.length; i++) {
              var wday = opts.byweekday[i];
              if (Object(helpers["e" /* isNumber */])(wday)) {
                  byweekday.push(wday);
                  continue;
              }
              var wd = wday;
              if (!wd.n || opts.freq > src_rrule.MONTHLY) {
                  byweekday.push(wd.weekday);
              }
              else {
                  bynweekday.push([wd.weekday, wd.n]);
              }
          }
          opts.byweekday = Object(helpers["g" /* notEmpty */])(byweekday) ? byweekday : null;
          opts.bynweekday = Object(helpers["g" /* notEmpty */])(bynweekday) ? bynweekday : null;
      }
      // byhour
      if (!Object(helpers["f" /* isPresent */])(opts.byhour)) {
          opts.byhour =
              opts.freq < src_rrule.HOURLY ? [opts.dtstart.getUTCHours()] : null;
      }
      else if (Object(helpers["e" /* isNumber */])(opts.byhour)) {
          opts.byhour = [opts.byhour];
      }
      // byminute
      if (!Object(helpers["f" /* isPresent */])(opts.byminute)) {
          opts.byminute =
              opts.freq < src_rrule.MINUTELY ? [opts.dtstart.getUTCMinutes()] : null;
      }
      else if (Object(helpers["e" /* isNumber */])(opts.byminute)) {
          opts.byminute = [opts.byminute];
      }
      // bysecond
      if (!Object(helpers["f" /* isPresent */])(opts.bysecond)) {
          opts.bysecond =
              opts.freq < src_rrule.SECONDLY ? [opts.dtstart.getUTCSeconds()] : null;
      }
      else if (Object(helpers["e" /* isNumber */])(opts.bysecond)) {
          opts.bysecond = [opts.bysecond];
      }
      return { parsedOptions: opts };
  }
  function buildTimeset(opts) {
      var millisecondModulo = opts.dtstart.getTime() % 1000;
      if (!freqIsDailyOrGreater(opts.freq)) {
          return [];
      }
      var timeset = [];
      opts.byhour.forEach(function (hour) {
          opts.byminute.forEach(function (minute) {
              opts.bysecond.forEach(function (second) {
                  timeset.push(new Time(hour, minute, second, millisecondModulo));
              });
          });
      });
      return timeset;
  }
  
  // CONCATENATED MODULE: ./src/parsestring.ts
  
  
  
  
  
  function parseString(rfcString) {
      var options = rfcString.split('\n').map(parseLine).filter(function (x) { return x !== null; });
      return __assign({}, options[0], options[1]);
  }
  function parseDtstart(line) {
      var options = {};
      var dtstartWithZone = /DTSTART(?:;TZID=([^:=]+?))?(?::|=)([^;\s]+)/i.exec(line);
      if (!dtstartWithZone) {
          return options;
      }
      var _ = dtstartWithZone[0], tzid = dtstartWithZone[1], dtstart = dtstartWithZone[2];
      if (tzid) {
          options.tzid = tzid;
      }
      options.dtstart = src_dateutil.untilStringToDate(dtstart);
      return options;
  }
  function parseLine(rfcString) {
      rfcString = rfcString.replace(/^\s+|\s+$/, '');
      if (!rfcString.length)
          return null;
      var header = /^([A-Z]+?)[:;]/.exec(rfcString.toUpperCase());
      if (!header) {
          return parseRrule(rfcString);
      }
      var _ = header[0], key = header[1];
      switch (key.toUpperCase()) {
          case 'RRULE':
          case 'EXRULE':
              return parseRrule(rfcString);
          case 'DTSTART':
              return parseDtstart(rfcString);
          default:
              throw new Error("Unsupported RFC prop " + key + " in " + rfcString);
      }
  }
  function parseRrule(line) {
      var strippedLine = line.replace(/^RRULE:/i, '');
      var options = parseDtstart(strippedLine);
      var attrs = line.replace(/^(?:RRULE|EXRULE):/i, '').split(';');
      attrs.forEach(function (attr) {
          var _a = attr.split('='), key = _a[0], value = _a[1];
          switch (key.toUpperCase()) {
              case 'FREQ':
                  options.freq = Frequency[value.toUpperCase()];
                  break;
              case 'WKST':
                  options.wkst = Days[value.toUpperCase()];
                  break;
              case 'COUNT':
              case 'INTERVAL':
              case 'BYSETPOS':
              case 'BYMONTH':
              case 'BYMONTHDAY':
              case 'BYYEARDAY':
              case 'BYWEEKNO':
              case 'BYHOUR':
              case 'BYMINUTE':
              case 'BYSECOND':
                  var num = parseNumber(value);
                  var optionKey = key.toLowerCase();
                  // @ts-ignore
                  options[optionKey] = num;
                  break;
              case 'BYWEEKDAY':
              case 'BYDAY':
                  options.byweekday = parseWeekday(value);
                  break;
              case 'DTSTART':
              case 'TZID':
                  // for backwards compatibility
                  var dtstart = parseDtstart(line);
                  options.tzid = dtstart.tzid;
                  options.dtstart = dtstart.dtstart;
                  break;
              case 'UNTIL':
                  options.until = src_dateutil.untilStringToDate(value);
                  break;
              case 'BYEASTER':
                  options.byeaster = Number(value);
                  break;
              default:
                  throw new Error("Unknown RRULE property '" + key + "'");
          }
      });
      return options;
  }
  function parseNumber(value) {
      if (value.indexOf(',') !== -1) {
          var values = value.split(',');
          return values.map(parseIndividualNumber);
      }
      return parseIndividualNumber(value);
  }
  function parseIndividualNumber(value) {
      if (/^[+-]?\d+$/.test(value)) {
          return Number(value);
      }
      return value;
  }
  function parseWeekday(value) {
      var days = value.split(',');
      return days.map(function (day) {
          if (day.length === 2) {
              // MO, TU, ...
              return Days[day]; // wday instanceof Weekday
          }
          // -1MO, +3FR, 1SO, 13TU ...
          var parts = day.match(/^([+-]?\d{1,2})([A-Z]{2})$/);
          var n = Number(parts[1]);
          var wdaypart = parts[2];
          var wday = Days[wdaypart].weekday;
          return new Weekday(wday, n);
      });
  }
  
  // EXTERNAL MODULE: ./node_modules/luxon/build/cjs-browser/luxon.js
  var luxon = __webpack_require__(2);
  
  // CONCATENATED MODULE: ./src/datewithzone.ts
  
  
  var datewithzone_DateWithZone = /** @class */ (function () {
      function DateWithZone(date, tzid) {
          this.date = date;
          this.tzid = tzid;
      }
      Object.defineProperty(DateWithZone.prototype, "isUTC", {
          get: function () {
              return !this.tzid || this.tzid.toUpperCase() === 'UTC';
          },
          enumerable: true,
          configurable: true
      });
      DateWithZone.prototype.toString = function () {
          var datestr = src_dateutil.timeToUntilString(this.date.getTime(), this.isUTC);
          if (!this.isUTC) {
              return ";TZID=" + this.tzid + ":" + datestr;
          }
          return ":" + datestr;
      };
      DateWithZone.prototype.getTime = function () {
          return this.date.getTime();
      };
      DateWithZone.prototype.rezonedDate = function () {
          if (this.isUTC) {
              return this.date;
          }
          try {
              var datetime = luxon["DateTime"]
                  .fromJSDate(this.date);
              var rezoned = datetime.setZone(this.tzid, { keepLocalTime: true });
              return rezoned.toJSDate();
          }
          catch (e) {
              if (e instanceof TypeError) {
                  console.error('Using TZID without Luxon available is unsupported. Returned times are in UTC, not the requested time zone');
              }
              return this.date;
          }
      };
      return DateWithZone;
  }());
  
  
  // CONCATENATED MODULE: ./src/optionstostring.ts
  
  
  
  
  
  function optionsToString(options) {
      var rrule = [];
      var dtstart = '';
      var keys = Object.keys(options);
      var defaultKeys = Object.keys(DEFAULT_OPTIONS);
      for (var i = 0; i < keys.length; i++) {
          if (keys[i] === 'tzid')
              continue;
          if (!Object(helpers["c" /* includes */])(defaultKeys, keys[i]))
              continue;
          var key = keys[i].toUpperCase();
          var value = options[keys[i]];
          var outValue = '';
          if (!Object(helpers["f" /* isPresent */])(value) || (Object(helpers["d" /* isArray */])(value) && !value.length))
              continue;
          switch (key) {
              case 'FREQ':
                  outValue = src_rrule.FREQUENCIES[options.freq];
                  break;
              case 'WKST':
                  if (Object(helpers["e" /* isNumber */])(value)) {
                      outValue = new Weekday(value).toString();
                  }
                  else {
                      outValue = value.toString();
                  }
                  break;
              case 'BYWEEKDAY':
                  /*
                  NOTE: BYWEEKDAY is a special case.
                  RRule() deconstructs the rule.options.byweekday array
                  into an array of Weekday arguments.
                  On the other hand, rule.origOptions is an array of Weekdays.
                  We need to handle both cases here.
                  It might be worth change RRule to keep the Weekdays.
        
                  Also, BYWEEKDAY (used by RRule) vs. BYDAY (RFC)
        
                  */
                  key = 'BYDAY';
                  outValue = Object(helpers["m" /* toArray */])(value).map(function (wday) {
                      if (wday instanceof Weekday) {
                          return wday;
                      }
                      if (Object(helpers["d" /* isArray */])(wday)) {
                          return new Weekday(wday[0], wday[1]);
                      }
                      return new Weekday(wday);
                  }).toString();
                  break;
              case 'DTSTART':
                  dtstart = buildDtstart(value, options.tzid);
                  break;
              case 'UNTIL':
                  outValue = src_dateutil.timeToUntilString(value, !options.tzid);
                  break;
              default:
                  if (Object(helpers["d" /* isArray */])(value)) {
                      var strValues = [];
                      for (var j = 0; j < value.length; j++) {
                          strValues[j] = String(value[j]);
                      }
                      outValue = strValues.toString();
                  }
                  else {
                      outValue = String(value);
                  }
          }
          if (outValue) {
              rrule.push([key, outValue]);
          }
      }
      var rules = rrule.map(function (_a) {
          var key = _a[0], value = _a[1];
          return key + "=" + value.toString();
      }).join(';');
      var ruleString = '';
      if (rules !== '') {
          ruleString = "RRULE:" + rules;
      }
      return [dtstart, ruleString].filter(function (x) { return !!x; }).join('\n');
  }
  function buildDtstart(dtstart, tzid) {
      if (!dtstart) {
          return '';
      }
      return 'DTSTART' + new datewithzone_DateWithZone(new Date(dtstart), tzid).toString();
  }
  
  // CONCATENATED MODULE: ./src/cache.ts
  
  
  
  var cache_Cache = /** @class */ (function () {
      function Cache() {
          this.all = false;
          this.before = [];
          this.after = [];
          this.between = [];
      }
      /**
       * @param {String} what - all/before/after/between
       * @param {Array,Date} value - an array of dates, one date, or null
       * @param {Object?} args - _iter arguments
       */
      Cache.prototype._cacheAdd = function (what, value, args) {
          if (value) {
              value =
                  value instanceof Date
                      ? src_dateutil.clone(value)
                      : src_dateutil.cloneDates(value);
          }
          if (what === 'all') {
              this.all = value;
          }
          else {
              args._value = value;
              this[what].push(args);
          }
      };
      /**
       * @return false - not in the cache
       *         null  - cached, but zero occurrences (before/after)
       *         Date  - cached (before/after)
       *         []    - cached, but zero occurrences (all/between)
       *         [Date1, DateN] - cached (all/between)
       */
      Cache.prototype._cacheGet = function (what, args) {
          var cached = false;
          var argsKeys = args ? Object.keys(args) : [];
          var findCacheDiff = function (item) {
              for (var i = 0; i < argsKeys.length; i++) {
                  var key = argsKeys[i];
                  if (String(args[key]) !== String(item[key])) {
                      return true;
                  }
              }
              return false;
          };
          var cachedObject = this[what];
          if (what === 'all') {
              cached = this.all;
          }
          else if (Object(helpers["d" /* isArray */])(cachedObject)) {
              // Let's see whether we've already called the
              // 'what' method with the same 'args'
              for (var i = 0; i < cachedObject.length; i++) {
                  var item = cachedObject[i];
                  if (argsKeys.length && findCacheDiff(item))
                      continue;
                  cached = item._value;
                  break;
              }
          }
          if (!cached && this.all) {
              // Not in the cache, but we already know all the occurrences,
              // so we can find the correct dates from the cached ones.
              var iterResult = new iterresult(what, args);
              for (var i = 0; i < this.all.length; i++) {
                  if (!iterResult.accept(this.all[i]))
                      break;
              }
              cached = iterResult.getValue();
              this._cacheAdd(what, cached, args);
          }
          return Object(helpers["d" /* isArray */])(cached)
              ? src_dateutil.cloneDates(cached)
              : cached instanceof Date
                  ? src_dateutil.clone(cached)
                  : cached;
      };
      return Cache;
  }());
  
  
  // CONCATENATED MODULE: ./src/masks.ts
  
  // =============================================================================
  // Date masks
  // =============================================================================
  // Every mask is 7 days longer to handle cross-year weekly periods.
  var M365MASK = Object(helpers["k" /* repeat */])(1, 31).concat(Object(helpers["k" /* repeat */])(2, 28), Object(helpers["k" /* repeat */])(3, 31), Object(helpers["k" /* repeat */])(4, 30), Object(helpers["k" /* repeat */])(5, 31), Object(helpers["k" /* repeat */])(6, 30), Object(helpers["k" /* repeat */])(7, 31), Object(helpers["k" /* repeat */])(8, 31), Object(helpers["k" /* repeat */])(9, 30), Object(helpers["k" /* repeat */])(10, 31), Object(helpers["k" /* repeat */])(11, 30), Object(helpers["k" /* repeat */])(12, 31), Object(helpers["k" /* repeat */])(1, 7));
  var M366MASK = Object(helpers["k" /* repeat */])(1, 31).concat(Object(helpers["k" /* repeat */])(2, 29), Object(helpers["k" /* repeat */])(3, 31), Object(helpers["k" /* repeat */])(4, 30), Object(helpers["k" /* repeat */])(5, 31), Object(helpers["k" /* repeat */])(6, 30), Object(helpers["k" /* repeat */])(7, 31), Object(helpers["k" /* repeat */])(8, 31), Object(helpers["k" /* repeat */])(9, 30), Object(helpers["k" /* repeat */])(10, 31), Object(helpers["k" /* repeat */])(11, 30), Object(helpers["k" /* repeat */])(12, 31), Object(helpers["k" /* repeat */])(1, 7));
  var M28 = Object(helpers["j" /* range */])(1, 29);
  var M29 = Object(helpers["j" /* range */])(1, 30);
  var M30 = Object(helpers["j" /* range */])(1, 31);
  var M31 = Object(helpers["j" /* range */])(1, 32);
  var MDAY366MASK = M31.concat(M29, M31, M30, M31, M30, M31, M31, M30, M31, M30, M31, M31.slice(0, 7));
  var MDAY365MASK = M31.concat(M28, M31, M30, M31, M30, M31, M31, M30, M31, M30, M31, M31.slice(0, 7));
  var NM28 = Object(helpers["j" /* range */])(-28, 0);
  var NM29 = Object(helpers["j" /* range */])(-29, 0);
  var NM30 = Object(helpers["j" /* range */])(-30, 0);
  var NM31 = Object(helpers["j" /* range */])(-31, 0);
  var NMDAY366MASK = NM31.concat(NM29, NM31, NM30, NM31, NM30, NM31, NM31, NM30, NM31, NM30, NM31, NM31.slice(0, 7));
  var NMDAY365MASK = NM31.concat(NM28, NM31, NM30, NM31, NM30, NM31, NM31, NM30, NM31, NM30, NM31, NM31.slice(0, 7));
  var M366RANGE = [0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366];
  var M365RANGE = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365];
  var WDAYMASK = (function () {
      var wdaymask = [];
      for (var i = 0; i < 55; i++)
          wdaymask = wdaymask.concat(Object(helpers["j" /* range */])(7));
      return wdaymask;
  })();
  
  
  // CONCATENATED MODULE: ./src/iterinfo/yearinfo.ts
  
  
  
  
  function rebuildYear(year, options) {
      var firstyday = new Date(Date.UTC(year, 0, 1));
      var yearlen = src_dateutil.isLeapYear(year) ? 366 : 365;
      var nextyearlen = src_dateutil.isLeapYear(year + 1) ? 366 : 365;
      var yearordinal = src_dateutil.toOrdinal(firstyday);
      var yearweekday = src_dateutil.getWeekday(firstyday);
      var result = __assign({ yearlen: yearlen,
          nextyearlen: nextyearlen,
          yearordinal: yearordinal,
          yearweekday: yearweekday }, baseYearMasks(year), { wnomask: null });
      if (Object(helpers["b" /* empty */])(options.byweekno)) {
          return result;
      }
      result.wnomask = Object(helpers["k" /* repeat */])(0, yearlen + 7);
      var firstwkst;
      var wyearlen;
      var no1wkst = firstwkst = Object(helpers["i" /* pymod */])(7 - yearweekday + options.wkst, 7);
      if (no1wkst >= 4) {
          no1wkst = 0;
          // Number of days in the year, plus the days we got
          // from last year.
          wyearlen =
              result.yearlen + Object(helpers["i" /* pymod */])(yearweekday - options.wkst, 7);
      }
      else {
          // Number of days in the year, minus the days we
          // left in last year.
          wyearlen = yearlen - no1wkst;
      }
      var div = Math.floor(wyearlen / 7);
      var mod = Object(helpers["i" /* pymod */])(wyearlen, 7);
      var numweeks = Math.floor(div + mod / 4);
      for (var j = 0; j < options.byweekno.length; j++) {
          var n = options.byweekno[j];
          if (n < 0) {
              n += numweeks + 1;
          }
          if (!(n > 0 && n <= numweeks)) {
              continue;
          }
          var i = void 0;
          if (n > 1) {
              i = no1wkst + (n - 1) * 7;
              if (no1wkst !== firstwkst) {
                  i -= 7 - firstwkst;
              }
          }
          else {
              i = no1wkst;
          }
          for (var k = 0; k < 7; k++) {
              result.wnomask[i] = 1;
              i++;
              if (result.wdaymask[i] === options.wkst)
                  break;
          }
      }
      if (Object(helpers["c" /* includes */])(options.byweekno, 1)) {
          // Check week number 1 of next year as well
          // orig-TODO : Check -numweeks for next year.
          var i = no1wkst + numweeks * 7;
          if (no1wkst !== firstwkst)
              i -= 7 - firstwkst;
          if (i < yearlen) {
              // If week starts in next year, we
              // don't care about it.
              for (var j = 0; j < 7; j++) {
                  result.wnomask[i] = 1;
                  i += 1;
                  if (result.wdaymask[i] === options.wkst)
                      break;
              }
          }
      }
      if (no1wkst) {
          // Check last week number of last year as
          // well. If no1wkst is 0, either the year
          // started on week start, or week number 1
          // got days from last year, so there are no
          // days from last year's last week number in
          // this year.
          var lnumweeks = void 0;
          if (!Object(helpers["c" /* includes */])(options.byweekno, -1)) {
              var lyearweekday = src_dateutil.getWeekday(new Date(Date.UTC(year - 1, 0, 1)));
              var lno1wkst = Object(helpers["i" /* pymod */])(7 - lyearweekday.valueOf() + options.wkst, 7);
              var lyearlen = src_dateutil.isLeapYear(year - 1) ? 366 : 365;
              var weekst = void 0;
              if (lno1wkst >= 4) {
                  lno1wkst = 0;
                  weekst = lyearlen + Object(helpers["i" /* pymod */])(lyearweekday - options.wkst, 7);
              }
              else {
                  weekst = yearlen - no1wkst;
              }
              lnumweeks = Math.floor(52 + Object(helpers["i" /* pymod */])(weekst, 7) / 4);
          }
          else {
              lnumweeks = -1;
          }
          if (Object(helpers["c" /* includes */])(options.byweekno, lnumweeks)) {
              for (var i = 0; i < no1wkst; i++)
                  result.wnomask[i] = 1;
          }
      }
      return result;
  }
  function baseYearMasks(year) {
      var yearlen = src_dateutil.isLeapYear(year) ? 366 : 365;
      var firstyday = new Date(Date.UTC(year, 0, 1));
      var wday = src_dateutil.getWeekday(firstyday);
      if (yearlen === 365) {
          return {
              mmask: M365MASK,
              mdaymask: MDAY365MASK,
              nmdaymask: NMDAY365MASK,
              wdaymask: WDAYMASK.slice(wday),
              mrange: M365RANGE
          };
      }
      return {
          mmask: M366MASK,
          mdaymask: MDAY366MASK,
          nmdaymask: NMDAY366MASK,
          wdaymask: WDAYMASK.slice(wday),
          mrange: M366RANGE
      };
  }
  
  // CONCATENATED MODULE: ./src/iterinfo/monthinfo.ts
  
  
  function rebuildMonth(year, month, yearlen, mrange, wdaymask, options) {
      var result = {
          lastyear: year,
          lastmonth: month,
          nwdaymask: []
      };
      var ranges = [];
      if (options.freq === src_rrule.YEARLY) {
          if (Object(helpers["b" /* empty */])(options.bymonth)) {
              ranges = [[0, yearlen]];
          }
          else {
              for (var j = 0; j < options.bymonth.length; j++) {
                  month = options.bymonth[j];
                  ranges.push(mrange.slice(month - 1, month + 1));
              }
          }
      }
      else if (options.freq === src_rrule.MONTHLY) {
          ranges = [mrange.slice(month - 1, month + 1)];
      }
      if (Object(helpers["b" /* empty */])(ranges)) {
          return result;
      }
      // Weekly frequency won't get here, so we may not
      // care about cross-year weekly periods.
      result.nwdaymask = Object(helpers["k" /* repeat */])(0, yearlen);
      for (var j = 0; j < ranges.length; j++) {
          var rang = ranges[j];
          var first = rang[0];
          var last = rang[1] - 1;
          for (var k = 0; k < options.bynweekday.length; k++) {
              var i = void 0;
              var _a = options.bynweekday[k], wday = _a[0], n = _a[1];
              if (n < 0) {
                  i = last + (n + 1) * 7;
                  i -= Object(helpers["i" /* pymod */])(wdaymask[i] - wday, 7);
              }
              else {
                  i = first + (n - 1) * 7;
                  i += Object(helpers["i" /* pymod */])(7 - wdaymask[i] + wday, 7);
              }
              if (first <= i && i <= last)
                  result.nwdaymask[i] = 1;
          }
      }
      return result;
  }
  
  // CONCATENATED MODULE: ./src/iterinfo/easter.ts
  function easter(y, offset) {
      if (offset === void 0) { offset = 0; }
      var a = y % 19;
      var b = Math.floor(y / 100);
      var c = y % 100;
      var d = Math.floor(b / 4);
      var e = b % 4;
      var f = Math.floor((b + 8) / 25);
      var g = Math.floor((b - f + 1) / 3);
      var h = Math.floor(19 * a + b - d - g + 15) % 30;
      var i = Math.floor(c / 4);
      var k = c % 4;
      var l = Math.floor(32 + 2 * e + 2 * i - h - k) % 7;
      var m = Math.floor((a + 11 * h + 22 * l) / 451);
      var month = Math.floor((h + l - 7 * m + 114) / 31);
      var day = ((h + l - 7 * m + 114) % 31) + 1;
      var date = Date.UTC(y, month - 1, day + offset);
      var yearStart = Date.UTC(y, 0, 1);
      return [Math.ceil((date - yearStart) / (1000 * 60 * 60 * 24))];
  }
  
  // CONCATENATED MODULE: ./src/iterinfo/index.ts
  
  
  
  
  
  
  
  // =============================================================================
  // Iterinfo
  // =============================================================================
  var iterinfo_Iterinfo = /** @class */ (function () {
      function Iterinfo(options) {
          this.options = options;
      }
      Iterinfo.prototype.rebuild = function (year, month) {
          var options = this.options;
          if (year !== this.lastyear) {
              this.yearinfo = rebuildYear(year, options);
          }
          if (Object(helpers["g" /* notEmpty */])(options.bynweekday) &&
              (month !== this.lastmonth || year !== this.lastyear)) {
              var _a = this.yearinfo, yearlen = _a.yearlen, mrange = _a.mrange, wdaymask = _a.wdaymask;
              this.monthinfo = rebuildMonth(year, month, yearlen, mrange, wdaymask, options);
          }
          if (Object(helpers["f" /* isPresent */])(options.byeaster)) {
              this.eastermask = easter(year, options.byeaster);
          }
      };
      Object.defineProperty(Iterinfo.prototype, "lastyear", {
          get: function () {
              return this.monthinfo ? this.monthinfo.lastyear : null;
          },
          enumerable: true,
          configurable: true
      });
      Object.defineProperty(Iterinfo.prototype, "lastmonth", {
          get: function () {
              return this.monthinfo ? this.monthinfo.lastmonth : null;
          },
          enumerable: true,
          configurable: true
      });
      Object.defineProperty(Iterinfo.prototype, "yearlen", {
          get: function () {
              return this.yearinfo.yearlen;
          },
          enumerable: true,
          configurable: true
      });
      Object.defineProperty(Iterinfo.prototype, "yearordinal", {
          get: function () {
              return this.yearinfo.yearordinal;
          },
          enumerable: true,
          configurable: true
      });
      Object.defineProperty(Iterinfo.prototype, "mrange", {
          get: function () {
              return this.yearinfo.mrange;
          },
          enumerable: true,
          configurable: true
      });
      Object.defineProperty(Iterinfo.prototype, "wdaymask", {
          get: function () {
              return this.yearinfo.wdaymask;
          },
          enumerable: true,
          configurable: true
      });
      Object.defineProperty(Iterinfo.prototype, "mmask", {
          get: function () {
              return this.yearinfo.mmask;
          },
          enumerable: true,
          configurable: true
      });
      Object.defineProperty(Iterinfo.prototype, "wnomask", {
          get: function () {
              return this.yearinfo.wnomask;
          },
          enumerable: true,
          configurable: true
      });
      Object.defineProperty(Iterinfo.prototype, "nwdaymask", {
          get: function () {
              return this.monthinfo ? this.monthinfo.nwdaymask : [];
          },
          enumerable: true,
          configurable: true
      });
      Object.defineProperty(Iterinfo.prototype, "nextyearlen", {
          get: function () {
              return this.yearinfo.nextyearlen;
          },
          enumerable: true,
          configurable: true
      });
      Object.defineProperty(Iterinfo.prototype, "mdaymask", {
          get: function () {
              return this.yearinfo.mdaymask;
          },
          enumerable: true,
          configurable: true
      });
      Object.defineProperty(Iterinfo.prototype, "nmdaymask", {
          get: function () {
              return this.yearinfo.nmdaymask;
          },
          enumerable: true,
          configurable: true
      });
      Iterinfo.prototype.ydayset = function () {
          return [Object(helpers["j" /* range */])(this.yearlen), 0, this.yearlen];
      };
      Iterinfo.prototype.mdayset = function (_, month, __) {
          var start = this.mrange[month - 1];
          var end = this.mrange[month];
          var set = Object(helpers["k" /* repeat */])(null, this.yearlen);
          for (var i = start; i < end; i++)
              set[i] = i;
          return [set, start, end];
      };
      Iterinfo.prototype.wdayset = function (year, month, day) {
          // We need to handle cross-year weeks here.
          var set = Object(helpers["k" /* repeat */])(null, this.yearlen + 7);
          var i = src_dateutil.toOrdinal(new Date(Date.UTC(year, month - 1, day))) -
              this.yearordinal;
          var start = i;
          for (var j = 0; j < 7; j++) {
              set[i] = i;
              ++i;
              if (this.wdaymask[i] === this.options.wkst)
                  break;
          }
          return [set, start, i];
      };
      Iterinfo.prototype.ddayset = function (year, month, day) {
          var set = Object(helpers["k" /* repeat */])(null, this.yearlen);
          var i = src_dateutil.toOrdinal(new Date(Date.UTC(year, month - 1, day))) -
              this.yearordinal;
          set[i] = i;
          return [set, i, i + 1];
      };
      Iterinfo.prototype.htimeset = function (hour, _, second, millisecond) {
          var _this = this;
          var set = [];
          this.options.byminute.forEach(function (minute) {
              set = set.concat(_this.mtimeset(hour, minute, second, millisecond));
          });
          src_dateutil.sort(set);
          return set;
      };
      Iterinfo.prototype.mtimeset = function (hour, minute, _, millisecond) {
          var set = this.options.bysecond.map(function (second) {
              return new Time(hour, minute, second, millisecond);
          });
          src_dateutil.sort(set);
          return set;
      };
      Iterinfo.prototype.stimeset = function (hour, minute, second, millisecond) {
          return [new Time(hour, minute, second, millisecond)];
      };
      Iterinfo.prototype.getdayset = function (freq) {
          switch (freq) {
              case Frequency.YEARLY: return this.ydayset.bind(this);
              case Frequency.MONTHLY: return this.mdayset.bind(this);
              case Frequency.WEEKLY: return this.wdayset.bind(this);
              case Frequency.DAILY: return this.ddayset.bind(this);
              default: return this.ddayset.bind(this);
          }
      };
      Iterinfo.prototype.gettimeset = function (freq) {
          switch (freq) {
              case Frequency.HOURLY: return this.htimeset.bind(this);
              case Frequency.MINUTELY: return this.mtimeset.bind(this);
              case Frequency.SECONDLY: return this.stimeset.bind(this);
          }
      };
      return Iterinfo;
  }());
  /* harmony default export */ var iterinfo = (iterinfo_Iterinfo);
  
  // CONCATENATED MODULE: ./src/iter/poslist.ts
  
  
  function buildPoslist(bysetpos, timeset, start, end, ii, dayset) {
      var poslist = [];
      for (var j = 0; j < bysetpos.length; j++) {
          var daypos = void 0;
          var timepos = void 0;
          var pos = bysetpos[j];
          if (pos < 0) {
              daypos = Math.floor(pos / timeset.length);
              timepos = Object(helpers["i" /* pymod */])(pos, timeset.length);
          }
          else {
              daypos = Math.floor((pos - 1) / timeset.length);
              timepos = Object(helpers["i" /* pymod */])(pos - 1, timeset.length);
          }
          var tmp = [];
          for (var k = start; k < end; k++) {
              var val = dayset[k];
              if (!Object(helpers["f" /* isPresent */])(val))
                  continue;
              tmp.push(val);
          }
          var i = void 0;
          if (daypos < 0) {
              i = tmp.slice(daypos)[0];
          }
          else {
              i = tmp[daypos];
          }
          var time = timeset[timepos];
          var date = src_dateutil.fromOrdinal(ii.yearordinal + i);
          var res = src_dateutil.combine(date, time);
          // XXX: can this ever be in the array?
          // - compare the actual date instead?
          if (!Object(helpers["c" /* includes */])(poslist, res))
              poslist.push(res);
      }
      src_dateutil.sort(poslist);
      return poslist;
  }
  
  // CONCATENATED MODULE: ./src/iter/index.ts
  
  
  
  
  
  
  
  
  
  function iter(iterResult, options) {
      var dtstart = options.dtstart, freq = options.freq, interval = options.interval, until = options.until, bysetpos = options.bysetpos;
      var count = options.count;
      if (count === 0 || interval === 0) {
          return emitResult(iterResult);
      }
      var counterDate = datetime_DateTime.fromDate(dtstart);
      var ii = new iterinfo(options);
      ii.rebuild(counterDate.year, counterDate.month);
      var timeset = makeTimeset(ii, counterDate, options);
      while (true) {
          var _a = ii.getdayset(freq)(counterDate.year, counterDate.month, counterDate.day), dayset = _a[0], start = _a[1], end = _a[2];
          var filtered = removeFilteredDays(dayset, start, end, ii, options);
          if (Object(helpers["g" /* notEmpty */])(bysetpos)) {
              var poslist = buildPoslist(bysetpos, timeset, start, end, ii, dayset);
              for (var j = 0; j < poslist.length; j++) {
                  var res = poslist[j];
                  if (until && res > until) {
                      return emitResult(iterResult);
                  }
                  if (res >= dtstart) {
                      var rezonedDate = rezoneIfNeeded(res, options);
                      if (!iterResult.accept(rezonedDate)) {
                          return emitResult(iterResult);
                      }
                      if (count) {
                          --count;
                          if (!count) {
                              return emitResult(iterResult);
                          }
                      }
                  }
              }
          }
          else {
              for (var j = start; j < end; j++) {
                  var currentDay = dayset[j];
                  if (!Object(helpers["f" /* isPresent */])(currentDay)) {
                      continue;
                  }
                  var date = src_dateutil.fromOrdinal(ii.yearordinal + currentDay);
                  for (var k = 0; k < timeset.length; k++) {
                      var time = timeset[k];
                      var res = src_dateutil.combine(date, time);
                      if (until && res > until) {
                          return emitResult(iterResult);
                      }
                      if (res >= dtstart) {
                          var rezonedDate = rezoneIfNeeded(res, options);
                          if (!iterResult.accept(rezonedDate)) {
                              return emitResult(iterResult);
                          }
                          if (count) {
                              --count;
                              if (!count) {
                                  return emitResult(iterResult);
                              }
                          }
                      }
                  }
              }
          }
          if (options.interval === 0) {
              return emitResult(iterResult);
          }
          // Handle frequency and interval
          counterDate.add(options, filtered);
          if (counterDate.year > src_dateutil.MAXYEAR) {
              return emitResult(iterResult);
          }
          if (!freqIsDailyOrGreater(freq)) {
              timeset = ii.gettimeset(freq)(counterDate.hour, counterDate.minute, counterDate.second, 0);
          }
          ii.rebuild(counterDate.year, counterDate.month);
      }
  }
  function isFiltered(ii, currentDay, options) {
      var bymonth = options.bymonth, byweekno = options.byweekno, byweekday = options.byweekday, byeaster = options.byeaster, bymonthday = options.bymonthday, bynmonthday = options.bynmonthday, byyearday = options.byyearday;
      return ((Object(helpers["g" /* notEmpty */])(bymonth) && !Object(helpers["c" /* includes */])(bymonth, ii.mmask[currentDay])) ||
          (Object(helpers["g" /* notEmpty */])(byweekno) && !ii.wnomask[currentDay]) ||
          (Object(helpers["g" /* notEmpty */])(byweekday) && !Object(helpers["c" /* includes */])(byweekday, ii.wdaymask[currentDay])) ||
          (Object(helpers["g" /* notEmpty */])(ii.nwdaymask) && !ii.nwdaymask[currentDay]) ||
          (byeaster !== null && !Object(helpers["c" /* includes */])(ii.eastermask, currentDay)) ||
          ((Object(helpers["g" /* notEmpty */])(bymonthday) || Object(helpers["g" /* notEmpty */])(bynmonthday)) &&
              !Object(helpers["c" /* includes */])(bymonthday, ii.mdaymask[currentDay]) &&
              !Object(helpers["c" /* includes */])(bynmonthday, ii.nmdaymask[currentDay])) ||
          (Object(helpers["g" /* notEmpty */])(byyearday) &&
              ((currentDay < ii.yearlen &&
                  !Object(helpers["c" /* includes */])(byyearday, currentDay + 1) &&
                  !Object(helpers["c" /* includes */])(byyearday, -ii.yearlen + currentDay)) ||
                  (currentDay >= ii.yearlen &&
                      !Object(helpers["c" /* includes */])(byyearday, currentDay + 1 - ii.yearlen) &&
                      !Object(helpers["c" /* includes */])(byyearday, -ii.nextyearlen + currentDay - ii.yearlen)))));
  }
  function rezoneIfNeeded(date, options) {
      return new datewithzone_DateWithZone(date, options.tzid).rezonedDate();
  }
  function emitResult(iterResult) {
      return iterResult.getValue();
  }
  function removeFilteredDays(dayset, start, end, ii, options) {
      var filtered = false;
      for (var dayCounter = start; dayCounter < end; dayCounter++) {
          var currentDay = dayset[dayCounter];
          filtered = isFiltered(ii, currentDay, options);
          if (filtered)
              dayset[currentDay] = null;
      }
      return filtered;
  }
  function makeTimeset(ii, counterDate, options) {
      var freq = options.freq, byhour = options.byhour, byminute = options.byminute, bysecond = options.bysecond;
      if (freqIsDailyOrGreater(freq)) {
          return buildTimeset(options);
      }
      if ((freq >= src_rrule.HOURLY &&
          Object(helpers["g" /* notEmpty */])(byhour) &&
          !Object(helpers["c" /* includes */])(byhour, counterDate.hour)) ||
          (freq >= src_rrule.MINUTELY &&
              Object(helpers["g" /* notEmpty */])(byminute) &&
              !Object(helpers["c" /* includes */])(byminute, counterDate.minute)) ||
          (freq >= src_rrule.SECONDLY &&
              Object(helpers["g" /* notEmpty */])(bysecond) &&
              !Object(helpers["c" /* includes */])(bysecond, counterDate.second))) {
          return [];
      }
      return ii.gettimeset(freq)(counterDate.hour, counterDate.minute, counterDate.second, counterDate.millisecond);
  }
  
  // CONCATENATED MODULE: ./src/rrule.ts
  
  
  
  
  
  
  
  
  
  
  var getnlp = function () {
      // Lazy, runtime import to avoid circular refs.
      if (!getnlp._nlp) {
          getnlp._nlp = __webpack_require__(8);
      }
      return getnlp._nlp;
  };
  // =============================================================================
  // RRule
  // =============================================================================
  var Days = {
      MO: new Weekday(0),
      TU: new Weekday(1),
      WE: new Weekday(2),
      TH: new Weekday(3),
      FR: new Weekday(4),
      SA: new Weekday(5),
      SU: new Weekday(6)
  };
  var DEFAULT_OPTIONS = {
      freq: Frequency.YEARLY,
      dtstart: null,
      interval: 1,
      wkst: Days.MO,
      count: null,
      until: null,
      tzid: null,
      bysetpos: null,
      bymonth: null,
      bymonthday: null,
      bynmonthday: null,
      byyearday: null,
      byweekno: null,
      byweekday: null,
      bynweekday: null,
      byhour: null,
      byminute: null,
      bysecond: null,
      byeaster: null
  };
  var rrule_defaultKeys = Object.keys(DEFAULT_OPTIONS);
  /**
   *
   * @param {Options?} options - see <http://labix.org/python-dateutil/#head-cf004ee9a75592797e076752b2a889c10f445418>
   *        The only required option is `freq`, one of RRule.YEARLY, RRule.MONTHLY, ...
   * @constructor
   */
  var rrule_RRule = /** @class */ (function () {
      function RRule(options, noCache) {
          if (options === void 0) { options = {}; }
          if (noCache === void 0) { noCache = false; }
          // RFC string
          this._cache = noCache ? null : new cache_Cache();
          // used by toString()
          this.origOptions = initializeOptions(options);
          var parsedOptions = parseOptions(options).parsedOptions;
          this.options = parsedOptions;
      }
      RRule.parseText = function (text, language) {
          return getnlp().parseText(text, language);
      };
      RRule.fromText = function (text, language) {
          return getnlp().fromText(text, language);
      };
      RRule.fromString = function (str) {
          return new RRule(RRule.parseString(str) || undefined);
      };
      RRule.prototype._iter = function (iterResult) {
          return iter(iterResult, this.options);
      };
      RRule.prototype._cacheGet = function (what, args) {
          if (!this._cache)
              return false;
          return this._cache._cacheGet(what, args);
      };
      RRule.prototype._cacheAdd = function (what, value, args) {
          if (!this._cache)
              return;
          return this._cache._cacheAdd(what, value, args);
      };
      /**
       * @param {Function} iterator - optional function that will be called
       *                   on each date that is added. It can return false
       *                   to stop the iteration.
       * @return Array containing all recurrences.
       */
      RRule.prototype.all = function (iterator) {
          if (iterator) {
              return this._iter(new callbackiterresult('all', {}, iterator));
          }
          var result = this._cacheGet('all');
          if (result === false) {
              result = this._iter(new iterresult('all', {}));
              this._cacheAdd('all', result);
          }
          return result;
      };
      /**
       * Returns all the occurrences of the rrule between after and before.
       * The inc keyword defines what happens if after and/or before are
       * themselves occurrences. With inc == True, they will be included in the
       * list, if they are found in the recurrence set.
       * @return Array
       */
      RRule.prototype.between = function (after, before, inc, iterator) {
          if (inc === void 0) { inc = false; }
          if (!src_dateutil.isValidDate(after) || !src_dateutil.isValidDate(before))
              throw new Error('Invalid date passed in to RRule.between');
          var args = {
              before: before,
              after: after,
              inc: inc
          };
          if (iterator) {
              return this._iter(new callbackiterresult('between', args, iterator));
          }
          var result = this._cacheGet('between', args);
          if (result === false) {
              result = this._iter(new iterresult('between', args));
              this._cacheAdd('between', result, args);
          }
          return result;
      };
      /**
       * Returns the last recurrence before the given datetime instance.
       * The inc keyword defines what happens if dt is an occurrence.
       * With inc == True, if dt itself is an occurrence, it will be returned.
       * @return Date or null
       */
      RRule.prototype.before = function (dt, inc) {
          if (inc === void 0) { inc = false; }
          if (!src_dateutil.isValidDate(dt))
              throw new Error('Invalid date passed in to RRule.before');
          var args = { dt: dt, inc: inc };
          var result = this._cacheGet('before', args);
          if (result === false) {
              result = this._iter(new iterresult('before', args));
              this._cacheAdd('before', result, args);
          }
          return result;
      };
      /**
       * Returns the first recurrence after the given datetime instance.
       * The inc keyword defines what happens if dt is an occurrence.
       * With inc == True, if dt itself is an occurrence, it will be returned.
       * @return Date or null
       */
      RRule.prototype.after = function (dt, inc) {
          if (inc === void 0) { inc = false; }
          if (!src_dateutil.isValidDate(dt))
              throw new Error('Invalid date passed in to RRule.after');
          var args = { dt: dt, inc: inc };
          var result = this._cacheGet('after', args);
          if (result === false) {
              result = this._iter(new iterresult('after', args));
              this._cacheAdd('after', result, args);
          }
          return result;
      };
      /**
       * Returns the number of recurrences in this set. It will have go trough
       * the whole recurrence, if this hasn't been done before.
       */
      RRule.prototype.count = function () {
          return this.all().length;
      };
      /**
       * Converts the rrule into its string representation
       * @see <http://www.ietf.org/rfc/rfc2445.txt>
       * @return String
       */
      RRule.prototype.toString = function () {
          return optionsToString(this.origOptions);
      };
      /**
       * Will convert all rules described in nlp:ToText
       * to text.
       */
      RRule.prototype.toText = function (gettext, language, dateFormatter) {
          return getnlp().toText(this, gettext, language, dateFormatter);
      };
      RRule.prototype.isFullyConvertibleToText = function () {
          return getnlp().isFullyConvertible(this);
      };
      /**
       * @return a RRule instance with the same freq and options
       *          as this one (cache is not cloned)
       */
      RRule.prototype.clone = function () {
          return new RRule(this.origOptions);
      };
      // RRule class 'constants'
      RRule.FREQUENCIES = [
          'YEARLY',
          'MONTHLY',
          'WEEKLY',
          'DAILY',
          'HOURLY',
          'MINUTELY',
          'SECONDLY'
      ];
      RRule.YEARLY = Frequency.YEARLY;
      RRule.MONTHLY = Frequency.MONTHLY;
      RRule.WEEKLY = Frequency.WEEKLY;
      RRule.DAILY = Frequency.DAILY;
      RRule.HOURLY = Frequency.HOURLY;
      RRule.MINUTELY = Frequency.MINUTELY;
      RRule.SECONDLY = Frequency.SECONDLY;
      RRule.MO = Days.MO;
      RRule.TU = Days.TU;
      RRule.WE = Days.WE;
      RRule.TH = Days.TH;
      RRule.FR = Days.FR;
      RRule.SA = Days.SA;
      RRule.SU = Days.SU;
      RRule.parseString = parseString;
      RRule.optionsToString = optionsToString;
      return RRule;
  }());
  /* harmony default export */ var src_rrule = (rrule_RRule);
  
  // CONCATENATED MODULE: ./src/iterset.ts
  
  
  
  function iterSet(iterResult, _rrule, _exrule, _rdate, _exdate, tzid) {
      var _exdateHash = {};
      var _accept = iterResult.accept;
      function evalExdate(after, before) {
          _exrule.forEach(function (rrule) {
              rrule.between(after, before, true).forEach(function (date) {
                  _exdateHash[Number(date)] = true;
              });
          });
      }
      _exdate.forEach(function (date) {
          var zonedDate = new datewithzone_DateWithZone(date, tzid).rezonedDate();
          _exdateHash[Number(zonedDate)] = true;
      });
      iterResult.accept = function (date) {
          var dt = Number(date);
          if (!_exdateHash[dt]) {
              evalExdate(new Date(dt - 1), new Date(dt + 1));
              if (!_exdateHash[dt]) {
                  _exdateHash[dt] = true;
                  return _accept.call(this, date);
              }
          }
          return true;
      };
      if (iterResult.method === 'between') {
          evalExdate(iterResult.args.after, iterResult.args.before);
          iterResult.accept = function (date) {
              var dt = Number(date);
              if (!_exdateHash[dt]) {
                  _exdateHash[dt] = true;
                  return _accept.call(this, date);
              }
              return true;
          };
      }
      for (var i = 0; i < _rdate.length; i++) {
          var zonedDate = new datewithzone_DateWithZone(_rdate[i], tzid).rezonedDate();
          if (!iterResult.accept(new Date(zonedDate.getTime())))
              break;
      }
      _rrule.forEach(function (rrule) {
          iter(iterResult, rrule.options);
      });
      var res = iterResult._result;
      src_dateutil.sort(res);
      switch (iterResult.method) {
          case 'all':
          case 'between':
              return res;
          case 'before':
              return ((res.length && res[res.length - 1]) || null);
          case 'after':
          default:
              return ((res.length && res[0]) || null);
      }
  }
  
  // CONCATENATED MODULE: ./src/rrulestr.ts
  
  
  
  
  
  
  /**
   * RRuleStr
   *  To parse a set of rrule strings
   */
  var rrulestr_DEFAULT_OPTIONS = {
      dtstart: null,
      cache: false,
      unfold: false,
      forceset: false,
      compatible: false,
      tzid: null
  };
  function parseInput(s, options) {
      var rrulevals = [];
      var rdatevals = [];
      var exrulevals = [];
      var exdatevals = [];
      var _a = parseDtstart(s), dtstart = _a.dtstart, tzid = _a.tzid;
      var lines = splitIntoLines(s, options.unfold);
      lines.forEach(function (line) {
          if (!line)
              return;
          var _a = breakDownLine(line), name = _a.name, parms = _a.parms, value = _a.value;
          switch (name.toUpperCase()) {
              case 'RRULE':
                  if (parms.length) {
                      throw new Error("unsupported RRULE parm: " + parms.join(','));
                  }
                  rrulevals.push(parseString(line));
                  break;
              case 'RDATE':
                  var _b = /RDATE(?:;TZID=([^:=]+))?/i.exec(line), _ = _b[0], rdateTzid = _b[1];
                  if (rdateTzid && !tzid) {
                      tzid = rdateTzid;
                  }
                  rdatevals = rdatevals.concat(parseRDate(value, parms));
                  break;
              case 'EXRULE':
                  if (parms.length) {
                      throw new Error("unsupported EXRULE parm: " + parms.join(','));
                  }
                  exrulevals.push(parseString(value));
                  break;
              case 'EXDATE':
                  exdatevals = exdatevals.concat(parseRDate(value, parms));
                  break;
              case 'DTSTART':
                  break;
              default:
                  throw new Error('unsupported property: ' + name);
          }
      });
      return {
          dtstart: dtstart,
          tzid: tzid,
          rrulevals: rrulevals,
          rdatevals: rdatevals,
          exrulevals: exrulevals,
          exdatevals: exdatevals
      };
  }
  function buildRule(s, options) {
      var _a = parseInput(s, options), rrulevals = _a.rrulevals, rdatevals = _a.rdatevals, exrulevals = _a.exrulevals, exdatevals = _a.exdatevals, dtstart = _a.dtstart, tzid = _a.tzid;
      var noCache = options.cache === false;
      if (options.compatible) {
          options.forceset = true;
          options.unfold = true;
      }
      if (options.forceset ||
          rrulevals.length > 1 ||
          rdatevals.length ||
          exrulevals.length ||
          exdatevals.length) {
          var rset_1 = new rruleset(noCache);
          rset_1.dtstart(dtstart);
          rset_1.tzid(tzid || undefined);
          rrulevals.forEach(function (val) {
              rset_1.rrule(new src_rrule(groomRruleOptions(val, dtstart, tzid), noCache));
          });
          rdatevals.forEach(function (date) {
              rset_1.rdate(date);
          });
          exrulevals.forEach(function (val) {
              rset_1.exrule(new src_rrule(groomRruleOptions(val, dtstart, tzid), noCache));
          });
          exdatevals.forEach(function (date) {
              rset_1.exdate(date);
          });
          if (options.compatible && options.dtstart)
              rset_1.rdate(dtstart);
          return rset_1;
      }
      var val = rrulevals[0] || {};
      return new src_rrule(groomRruleOptions(val, val.dtstart || options.dtstart || dtstart, val.tzid || options.tzid || tzid), noCache);
  }
  function rrulestr(s, options) {
      if (options === void 0) { options = {}; }
      return buildRule(s, rrulestr_initializeOptions(options));
  }
  function groomRruleOptions(val, dtstart, tzid) {
      return __assign({}, val, { dtstart: dtstart,
          tzid: tzid });
  }
  function rrulestr_initializeOptions(options) {
      var invalid = [];
      var keys = Object.keys(options);
      var defaultKeys = Object.keys(rrulestr_DEFAULT_OPTIONS);
      keys.forEach(function (key) {
          if (!Object(helpers["c" /* includes */])(defaultKeys, key))
              invalid.push(key);
      });
      if (invalid.length) {
          throw new Error('Invalid options: ' + invalid.join(', '));
      }
      var initializedOptions = __assign({}, options);
      // Merge in default options
      defaultKeys.forEach(function (key) {
          if (!Object(helpers["c" /* includes */])(keys, key))
              initializedOptions[key] = rrulestr_DEFAULT_OPTIONS[key];
      });
      return initializedOptions;
  }
  function extractName(line) {
      if (line.indexOf(':') === -1) {
          return {
              name: 'RRULE',
              value: line
          };
      }
      var _a = Object(helpers["l" /* split */])(line, ':', 1), name = _a[0], value = _a[1];
      return {
          name: name,
          value: value
      };
  }
  function breakDownLine(line) {
      var _a = extractName(line), name = _a.name, value = _a.value;
      var parms = name.split(';');
      if (!parms)
          throw new Error('empty property name');
      return {
          name: parms[0].toUpperCase(),
          parms: parms.slice(1),
          value: value
      };
  }
  function splitIntoLines(s, unfold) {
      if (unfold === void 0) { unfold = false; }
      s = s && s.trim();
      if (!s)
          throw new Error('Invalid empty string');
      // More info about 'unfold' option
      // Go head to http://www.ietf.org/rfc/rfc2445.txt
      if (!unfold) {
          return s.split(/\s/);
      }
      var lines = s.split('\n');
      var i = 0;
      while (i < lines.length) {
          // TODO
          var line = (lines[i] = lines[i].replace(/\s+$/g, ''));
          if (!line) {
              lines.splice(i, 1);
          }
          else if (i > 0 && line[0] === ' ') {
              lines[i - 1] += line.slice(1);
              lines.splice(i, 1);
          }
          else {
              i += 1;
          }
      }
      return lines;
  }
  function validateDateParm(parms) {
      parms.forEach(function (parm) {
          if (!/(VALUE=DATE(-TIME)?)|(TZID=)/.test(parm)) {
              throw new Error('unsupported RDATE/EXDATE parm: ' + parm);
          }
      });
  }
  function parseRDate(rdateval, parms) {
      validateDateParm(parms);
      return rdateval
          .split(',')
          .map(function (datestr) { return src_dateutil.untilStringToDate(datestr); });
  }
  
  // CONCATENATED MODULE: ./src/rruleset.ts
  
  
  
  
  
  
  
  function createGetterSetter(fieldName) {
      var _this = this;
      return function (field) {
          if (field !== undefined) {
              _this["_" + fieldName] = field;
          }
          if (_this["_" + fieldName] !== undefined) {
              return _this["_" + fieldName];
          }
          for (var i = 0; i < _this._rrule.length; i++) {
              var field_1 = _this._rrule[i].origOptions[fieldName];
              if (field_1) {
                  return field_1;
              }
          }
      };
  }
  var rruleset_RRuleSet = /** @class */ (function (_super) {
      __extends(RRuleSet, _super);
      /**
       *
       * @param {Boolean?} noCache
       *  The same stratagy as RRule on cache, default to false
       * @constructor
       */
      function RRuleSet(noCache) {
          if (noCache === void 0) { noCache = false; }
          var _this = _super.call(this, {}, noCache) || this;
          _this.dtstart = createGetterSetter.apply(_this, ['dtstart']);
          _this.tzid = createGetterSetter.apply(_this, ['tzid']);
          _this._rrule = [];
          _this._rdate = [];
          _this._exrule = [];
          _this._exdate = [];
          return _this;
      }
      RRuleSet.prototype._iter = function (iterResult) {
          return iterSet(iterResult, this._rrule, this._exrule, this._rdate, this._exdate, this.tzid());
      };
      /**
       * Adds an RRule to the set
       *
       * @param {RRule}
       */
      RRuleSet.prototype.rrule = function (rrule) {
          _addRule(rrule, this._rrule);
      };
      /**
       * Adds an EXRULE to the set
       *
       * @param {RRule}
       */
      RRuleSet.prototype.exrule = function (rrule) {
          _addRule(rrule, this._exrule);
      };
      /**
       * Adds an RDate to the set
       *
       * @param {Date}
       */
      RRuleSet.prototype.rdate = function (date) {
          _addDate(date, this._rdate);
      };
      /**
       * Adds an EXDATE to the set
       *
       * @param {Date}
       */
      RRuleSet.prototype.exdate = function (date) {
          _addDate(date, this._exdate);
      };
      /**
       * Get list of included rrules in this recurrence set.
       *
       * @return List of rrules
       */
      RRuleSet.prototype.rrules = function () {
          return this._rrule.map(function (e) { return rrulestr(e.toString()); });
      };
      /**
       * Get list of excluded rrules in this recurrence set.
       *
       * @return List of exrules
       */
      RRuleSet.prototype.exrules = function () {
          return this._exrule.map(function (e) { return rrulestr(e.toString()); });
      };
      /**
       * Get list of included datetimes in this recurrence set.
       *
       * @return List of rdates
       */
      RRuleSet.prototype.rdates = function () {
          return this._rdate.map(function (e) { return new Date(e.getTime()); });
      };
      /**
       * Get list of included datetimes in this recurrence set.
       *
       * @return List of exdates
       */
      RRuleSet.prototype.exdates = function () {
          return this._exdate.map(function (e) { return new Date(e.getTime()); });
      };
      RRuleSet.prototype.valueOf = function () {
          var result = [];
          if (!this._rrule.length && this._dtstart) {
              result = result.concat(optionsToString({ dtstart: this._dtstart }));
          }
          this._rrule.forEach(function (rrule) {
              result = result.concat(rrule.toString().split('\n'));
          });
          this._exrule.forEach(function (exrule) {
              result = result.concat(exrule.toString().split('\n')
                  .map(function (line) { return line.replace(/^RRULE:/, 'EXRULE:'); })
                  .filter(function (line) { return !/^DTSTART/.test(line); }));
          });
          if (this._rdate.length) {
              result.push(rdatesToString('RDATE', this._rdate, this.tzid()));
          }
          if (this._exdate.length) {
              result.push(rdatesToString('EXDATE', this._exdate, this.tzid()));
          }
          return result;
      };
      /**
       * to generate recurrence field such as:
       *   DTSTART:19970902T010000Z
       *   RRULE:FREQ=YEARLY;COUNT=2;BYDAY=TU
       *   RRULE:FREQ=YEARLY;COUNT=1;BYDAY=TH
       */
      RRuleSet.prototype.toString = function () {
          return this.valueOf().join('\n');
      };
      /**
       * Create a new RRuleSet Object completely base on current instance
       */
      RRuleSet.prototype.clone = function () {
          var rrs = new RRuleSet(!!this._cache);
          this._rrule.forEach(function (rule) { return rrs.rrule(rule.clone()); });
          this._exrule.forEach(function (rule) { return rrs.exrule(rule.clone()); });
          this._rdate.forEach(function (date) { return rrs.rdate(new Date(date.getTime())); });
          this._exdate.forEach(function (date) { return rrs.exdate(new Date(date.getTime())); });
          return rrs;
      };
      return RRuleSet;
  }(src_rrule));
  /* harmony default export */ var rruleset = (rruleset_RRuleSet);
  function _addRule(rrule, collection) {
      if (!(rrule instanceof src_rrule)) {
          throw new TypeError(String(rrule) + ' is not RRule instance');
      }
      if (!Object(helpers["c" /* includes */])(collection.map(String), String(rrule))) {
          collection.push(rrule);
      }
  }
  function _addDate(date, collection) {
      if (!(date instanceof Date)) {
          throw new TypeError(String(date) + ' is not Date instance');
      }
      if (!Object(helpers["c" /* includes */])(collection.map(Number), Number(date))) {
          collection.push(date);
          src_dateutil.sort(collection);
      }
  }
  function rdatesToString(param, rdates, tzid) {
      var isUTC = !tzid || tzid.toUpperCase() === 'UTC';
      var header = isUTC ? param + ":" : param + ";TZID=" + tzid + ":";
      var dateString = rdates
          .map(function (rdate) { return src_dateutil.timeToUntilString(rdate.valueOf(), isUTC); })
          .join(',');
      return "" + header + dateString;
  }
  
  // CONCATENATED MODULE: ./src/index.ts
  /* concated harmony reexport */__webpack_require__.d(__webpack_exports__, "Frequency", function() { return Frequency; });
  /* concated harmony reexport */__webpack_require__.d(__webpack_exports__, "Weekday", function() { return Weekday; });
  /* concated harmony reexport */__webpack_require__.d(__webpack_exports__, "RRule", function() { return src_rrule; });
  /* concated harmony reexport */__webpack_require__.d(__webpack_exports__, "RRuleSet", function() { return rruleset; });
  /* concated harmony reexport */__webpack_require__.d(__webpack_exports__, "rrulestr", function() { return rrulestr; });
  /*!
   * rrule.js - Library for working with recurrence rules for calendar dates.
   * https://github.com/jakubroztocil/rrule
   *
   * Copyright 2010, Jakub Roztocil and Lars Schoning
   * Licenced under the BSD licence.
   * https://github.com/jakubroztocil/rrule/blob/master/LICENCE
   *
   * Based on:
   * python-dateutil - Extensions to the standard Python datetime module.
   * Copyright (c) 2003-2011 - Gustavo Niemeyer <gustavo@niemeyer.net>
   * Copyright (c) 2012 - Tomi Pieviläinen <tomi.pievilainen@iki.fi>
   * https://github.com/jakubroztocil/rrule/blob/master/LICENCE
   *
   */
  
  
  
  
  
  // =============================================================================
  // Export
  // =============================================================================
  
  /* harmony default export */ var src = __webpack_exports__["default"] = (src_rrule);
  
  
  /***/ }),
  /* 2 */
  /***/ (function(module, exports, __webpack_require__) {
  
  "use strict";
  
  
  Object.defineProperty(exports, '__esModule', { value: true });
  
  /*
    This is just a junk drawer, containing anything used across multiple classes.
    Because Luxon is small(ish), this should stay small and we won't worry about splitting
    it up into, say, parsingUtil.js and basicUtil.js and so on. But they are divided up by feature area.
  */
  
  /**
   * @private
   */
  
  // TYPES
  
  function isUndefined(o) {
    return typeof o === 'undefined';
  }
  
  function isNumber(o) {
    return typeof o === 'number';
  }
  
  function isString(o) {
    return typeof o === 'string';
  }
  
  function isDate(o) {
    return Object.prototype.toString.call(o) === '[object Date]';
  }
  
  // CAPABILITIES
  
  function hasIntl() {
    return typeof Intl !== 'undefined' && Intl.DateTimeFormat;
  }
  
  function hasFormatToParts() {
    return !isUndefined(Intl.DateTimeFormat.prototype.formatToParts);
  }
  
  // OBJECTS AND ARRAYS
  
  function maybeArray(thing) {
    return Array.isArray(thing) ? thing : [thing];
  }
  
  function bestBy(arr, by, compare) {
    if (arr.length === 0) {
      return undefined;
    }
    return arr.reduce(function (best, next) {
      var pair = [by(next), next];
      if (!best) {
        return pair;
      } else if (compare.apply(null, [best[0], pair[0]]) === best[0]) {
        return best;
      } else {
        return pair;
      }
    }, null)[1];
  }
  
  function pick(obj, keys) {
    return keys.reduce(function (a, k) {
      a[k] = obj[k];
      return a;
    }, {});
  }
  
  // NUMBERS AND STRINGS
  
  function numberBetween(thing, bottom, top) {
    return isNumber(thing) && thing >= bottom && thing <= top;
  }
  
  // x % n but takes the sign of n instead of x
  function floorMod(x, n) {
    return x - n * Math.floor(x / n);
  }
  
  function padStart(input) {
    var n = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
  
    if (input.toString().length < n) {
      return ('0'.repeat(n) + input).slice(-n);
    } else {
      return input.toString();
    }
  }
  
  function parseMillis(fraction) {
    if (isUndefined(fraction)) {
      return NaN;
    } else {
      var f = parseFloat('0.' + fraction) * 1000;
      return Math.floor(f);
    }
  }
  
  function roundTo(number, digits) {
    var factor = Math.pow(10, digits);
    return Math.round(number * factor) / factor;
  }
  
  // DATE BASICS
  
  function isLeapYear(year) {
    return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
  }
  
  function daysInYear(year) {
    return isLeapYear(year) ? 366 : 365;
  }
  
  function daysInMonth(year, month) {
    var modMonth = floorMod(month - 1, 12) + 1,
        modYear = year + (month - modMonth) / 12;
  
    if (modMonth === 2) {
      return isLeapYear(modYear) ? 29 : 28;
    } else {
      return [31, null, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][modMonth - 1];
    }
  }
  
  function weeksInWeekYear(weekYear) {
    var p1 = (weekYear + Math.floor(weekYear / 4) - Math.floor(weekYear / 100) + Math.floor(weekYear / 400)) % 7,
        last = weekYear - 1,
        p2 = (last + Math.floor(last / 4) - Math.floor(last / 100) + Math.floor(last / 400)) % 7;
    return p1 === 4 || p2 === 3 ? 53 : 52;
  }
  
  function untruncateYear(year) {
    if (year > 99) {
      return year;
    } else return year > 60 ? 1900 + year : 2000 + year;
  }
  
  // PARSING
  
  function parseZoneInfo(ts, offsetFormat, locale) {
    var timeZone = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
  
    var date = new Date(ts),
        intlOpts = {
      hour12: false,
      year: 'numeric',
      month: '2-digit',
      day: '2-digit',
      hour: '2-digit',
      minute: '2-digit'
    };
  
    if (timeZone) {
      intlOpts.timeZone = timeZone;
    }
  
    var modified = Object.assign({ timeZoneName: offsetFormat }, intlOpts),
        intl = hasIntl();
  
    if (intl && hasFormatToParts()) {
      var parsed = new Intl.DateTimeFormat(locale, modified).formatToParts(date).find(function (m) {
        return m.type.toLowerCase() === 'timezonename';
      });
      return parsed ? parsed.value : null;
    } else if (intl) {
      // this probably doesn't work for all locales
      var without = new Intl.DateTimeFormat(locale, intlOpts).format(date),
          included = new Intl.DateTimeFormat(locale, modified).format(date),
          diffed = included.substring(without.length),
          trimmed = diffed.replace(/^[, ]+/, '');
      return trimmed;
    } else {
      return null;
    }
  }
  
  // signedOffset('-5', '30') -> -330
  function signedOffset(offHourStr, offMinuteStr) {
    var offHour = parseInt(offHourStr, 10) || 0,
        offMin = parseInt(offMinuteStr, 10) || 0,
        offMinSigned = offHour < 0 ? -offMin : offMin;
    return offHour * 60 + offMinSigned;
  }
  
  // COERCION
  
  function normalizeObject(obj, normalizer) {
    var ignoreUnknown = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  
    var normalized = {};
    for (var u in obj) {
      if (obj.hasOwnProperty(u)) {
        var v = obj[u];
        if (v !== null && !isUndefined(v) && !Number.isNaN(v)) {
          var mapped = normalizer(u, ignoreUnknown);
          if (mapped) {
            normalized[mapped] = v;
          }
        }
      }
    }
    return normalized;
  }
  
  function timeObject(obj) {
    return pick(obj, ['hour', 'minute', 'second', 'millisecond']);
  }
  
  var customInspectSymbol = function () {
    try {
      return __webpack_require__(3).inspect.custom; // eslint-disable-line global-require
    } catch (_err) {
      return Symbol('util.inspect.custom');
    }
  }();
  
  /**
   * @private
   */
  
  var n = 'numeric';
  var s = 'short';
  var l = 'long';
  var d2 = '2-digit';
  
  var DATE_SHORT = {
    year: n,
    month: n,
    day: n
  };
  
  var DATE_MED = {
    year: n,
    month: s,
    day: n
  };
  
  var DATE_FULL = {
    year: n,
    month: l,
    day: n
  };
  
  var DATE_HUGE = {
    year: n,
    month: l,
    day: n,
    weekday: l
  };
  
  var TIME_SIMPLE = {
    hour: n,
    minute: d2
  };
  
  var TIME_WITH_SECONDS = {
    hour: n,
    minute: d2,
    second: d2
  };
  
  var TIME_WITH_SHORT_OFFSET = {
    hour: n,
    minute: d2,
    second: d2,
    timeZoneName: s
  };
  
  var TIME_WITH_LONG_OFFSET = {
    hour: n,
    minute: d2,
    second: d2,
    timeZoneName: l
  };
  
  var TIME_24_SIMPLE = {
    hour: n,
    minute: d2,
    hour12: false
  };
  
  /**
   * {@link toLocaleString}; format like '09:30:23', always 24-hour.
   */
  var TIME_24_WITH_SECONDS = {
    hour: n,
    minute: d2,
    second: d2,
    hour12: false
  };
  
  /**
   * {@link toLocaleString}; format like '09:30:23 EDT', always 24-hour.
   */
  var TIME_24_WITH_SHORT_OFFSET = {
    hour: n,
    minute: d2,
    second: d2,
    hour12: false,
    timeZoneName: s
  };
  
  /**
   * {@link toLocaleString}; format like '09:30:23 Eastern Daylight Time', always 24-hour.
   */
  var TIME_24_WITH_LONG_OFFSET = {
    hour: n,
    minute: d2,
    second: d2,
    hour12: false,
    timeZoneName: l
  };
  
  /**
   * {@link toLocaleString}; format like '10/14/1983, 9:30 AM'. Only 12-hour if the locale is.
   */
  var DATETIME_SHORT = {
    year: n,
    month: n,
    day: n,
    hour: n,
    minute: d2
  };
  
  /**
   * {@link toLocaleString}; format like '10/14/1983, 9:30:33 AM'. Only 12-hour if the locale is.
   */
  var DATETIME_SHORT_WITH_SECONDS = {
    year: n,
    month: n,
    day: n,
    hour: n,
    minute: d2,
    second: d2
  };
  
  var DATETIME_MED = {
    year: n,
    month: s,
    day: n,
    hour: n,
    minute: d2
  };
  
  var DATETIME_MED_WITH_SECONDS = {
    year: n,
    month: s,
    day: n,
    hour: n,
    minute: d2,
    second: d2
  };
  
  var DATETIME_FULL = {
    year: n,
    month: l,
    day: n,
    hour: n,
    minute: d2,
    timeZoneName: s
  };
  
  var DATETIME_FULL_WITH_SECONDS = {
    year: n,
    month: l,
    day: n,
    hour: n,
    minute: d2,
    second: d2,
    timeZoneName: s
  };
  
  var DATETIME_HUGE = {
    year: n,
    month: l,
    day: n,
    weekday: l,
    hour: n,
    minute: d2,
    timeZoneName: l
  };
  
  var DATETIME_HUGE_WITH_SECONDS = {
    year: n,
    month: l,
    day: n,
    weekday: l,
    hour: n,
    minute: d2,
    second: d2,
    timeZoneName: l
  };
  
  function stringify(obj) {
    return JSON.stringify(obj, Object.keys(obj).sort());
  }
  
  /**
   * @private
   */
  
  var monthsLong = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
  
  var monthsShort = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
  
  var monthsNarrow = ['J', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', 'O', 'N', 'D'];
  
  function months(length) {
    switch (length) {
      case 'narrow':
        return monthsNarrow;
      case 'short':
        return monthsShort;
      case 'long':
        return monthsLong;
      case 'numeric':
        return ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'];
      case '2-digit':
        return ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12'];
      default:
        return null;
    }
  }
  
  var weekdaysLong = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'];
  
  var weekdaysShort = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'];
  
  var weekdaysNarrow = ['M', 'T', 'W', 'T', 'F', 'S', 'S'];
  
  function weekdays(length) {
    switch (length) {
      case 'narrow':
        return weekdaysNarrow;
      case 'short':
        return weekdaysShort;
      case 'long':
        return weekdaysLong;
      case 'numeric':
        return ['1', '2', '3', '4', '5', '6', '7'];
      default:
        return null;
    }
  }
  
  var meridiems = ['AM', 'PM'];
  
  var erasLong = ['Before Christ', 'Anno Domini'];
  
  var erasShort = ['BC', 'AD'];
  
  var erasNarrow = ['B', 'A'];
  
  function eras(length) {
    switch (length) {
      case 'narrow':
        return erasNarrow;
      case 'short':
        return erasShort;
      case 'long':
        return erasLong;
      default:
        return null;
    }
  }
  
  function meridiemForDateTime(dt) {
    return meridiems[dt.hour < 12 ? 0 : 1];
  }
  
  function weekdayForDateTime(dt, length) {
    return weekdays(length)[dt.weekday - 1];
  }
  
  function monthForDateTime(dt, length) {
    return months(length)[dt.month - 1];
  }
  
  function eraForDateTime(dt, length) {
    return eras(length)[dt.year < 0 ? 0 : 1];
  }
  
  function formatString(knownFormat) {
    // these all have the offsets removed because we don't have access to them
    // without all the intl stuff this is backfilling
    var filtered = pick(knownFormat, ['weekday', 'era', 'year', 'month', 'day', 'hour', 'minute', 'second', 'timeZoneName', 'hour12']),
        key = stringify(filtered),
        dateTimeHuge = 'EEEE, LLLL d, yyyy, h:mm a';
    switch (key) {
      case stringify(DATE_SHORT):
        return 'M/d/yyyy';
      case stringify(DATE_MED):
        return 'LLL d, yyyy';
      case stringify(DATE_FULL):
        return 'LLLL d, yyyy';
      case stringify(DATE_HUGE):
        return 'EEEE, LLLL d, yyyy';
      case stringify(TIME_SIMPLE):
        return 'h:mm a';
      case stringify(TIME_WITH_SECONDS):
        return 'h:mm:ss a';
      case stringify(TIME_WITH_SHORT_OFFSET):
        return 'h:mm a';
      case stringify(TIME_WITH_LONG_OFFSET):
        return 'h:mm a';
      case stringify(TIME_24_SIMPLE):
        return 'HH:mm';
      case stringify(TIME_24_WITH_SECONDS):
        return 'HH:mm:ss';
      case stringify(TIME_24_WITH_SHORT_OFFSET):
        return 'HH:mm';
      case stringify(TIME_24_WITH_LONG_OFFSET):
        return 'HH:mm';
      case stringify(DATETIME_SHORT):
        return 'M/d/yyyy, h:mm a';
      case stringify(DATETIME_MED):
        return 'LLL d, yyyy, h:mm a';
      case stringify(DATETIME_FULL):
        return 'LLLL d, yyyy, h:mm a';
      case stringify(DATETIME_HUGE):
        return dateTimeHuge;
      case stringify(DATETIME_SHORT_WITH_SECONDS):
        return 'M/d/yyyy, h:mm:ss a';
      case stringify(DATETIME_MED_WITH_SECONDS):
        return 'LLL d, yyyy, h:mm:ss a';
      case stringify(DATETIME_FULL_WITH_SECONDS):
        return 'LLLL d, yyyy, h:mm:ss a';
      case stringify(DATETIME_HUGE_WITH_SECONDS):
        return 'EEEE, LLLL d, yyyy, h:mm:ss a';
      default:
        return dateTimeHuge;
    }
  }
  
  var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
    return typeof obj;
  } : function (obj) {
    return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
  };
  
  
  
  
  
  
  
  
  
  
  
  var classCallCheck = function (instance, Constructor) {
    if (!(instance instanceof Constructor)) {
      throw new TypeError("Cannot call a class as a function");
    }
  };
  
  var createClass = function () {
    function defineProperties(target, props) {
      for (var i = 0; i < props.length; i++) {
        var descriptor = props[i];
        descriptor.enumerable = descriptor.enumerable || false;
        descriptor.configurable = true;
        if ("value" in descriptor) descriptor.writable = true;
        Object.defineProperty(target, descriptor.key, descriptor);
      }
    }
  
    return function (Constructor, protoProps, staticProps) {
      if (protoProps) defineProperties(Constructor.prototype, protoProps);
      if (staticProps) defineProperties(Constructor, staticProps);
      return Constructor;
    };
  }();
  
  
  
  
  
  
  
  
  
  var inherits = function (subClass, superClass) {
    if (typeof superClass !== "function" && superClass !== null) {
      throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
    }
  
    subClass.prototype = Object.create(superClass && superClass.prototype, {
      constructor: {
        value: subClass,
        enumerable: false,
        writable: true,
        configurable: true
      }
    });
    if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
  };
  
  
  
  
  
  
  
  
  
  
  
  var possibleConstructorReturn = function (self, call) {
    if (!self) {
      throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
    }
  
    return call && (typeof call === "object" || typeof call === "function") ? call : self;
  };
  
  // these aren't really private, but nor are they really useful to document
  
  /**
   * @private
   */
  var LuxonError = function (_Error) {
    inherits(LuxonError, _Error);
  
    function LuxonError() {
      classCallCheck(this, LuxonError);
      return possibleConstructorReturn(this, _Error.apply(this, arguments));
    }
  
    return LuxonError;
  }(Error);
  
  /**
   * @private
   */
  
  
  var InvalidDateTimeError = function (_LuxonError) {
    inherits(InvalidDateTimeError, _LuxonError);
  
    function InvalidDateTimeError(reason) {
      classCallCheck(this, InvalidDateTimeError);
      return possibleConstructorReturn(this, _LuxonError.call(this, 'Invalid DateTime: ' + reason));
    }
  
    return InvalidDateTimeError;
  }(LuxonError);
  
  /**
   * @private
   */
  var InvalidIntervalError = function (_LuxonError2) {
    inherits(InvalidIntervalError, _LuxonError2);
  
    function InvalidIntervalError(reason) {
      classCallCheck(this, InvalidIntervalError);
      return possibleConstructorReturn(this, _LuxonError2.call(this, 'Invalid Interval: ' + reason));
    }
  
    return InvalidIntervalError;
  }(LuxonError);
  
  /**
   * @private
   */
  var InvalidDurationError = function (_LuxonError3) {
    inherits(InvalidDurationError, _LuxonError3);
  
    function InvalidDurationError(reason) {
      classCallCheck(this, InvalidDurationError);
      return possibleConstructorReturn(this, _LuxonError3.call(this, 'Invalid Duration: ' + reason));
    }
  
    return InvalidDurationError;
  }(LuxonError);
  
  /**
   * @private
   */
  var ConflictingSpecificationError = function (_LuxonError4) {
    inherits(ConflictingSpecificationError, _LuxonError4);
  
    function ConflictingSpecificationError() {
      classCallCheck(this, ConflictingSpecificationError);
      return possibleConstructorReturn(this, _LuxonError4.apply(this, arguments));
    }
  
    return ConflictingSpecificationError;
  }(LuxonError);
  
  /**
   * @private
   */
  var InvalidUnitError = function (_LuxonError5) {
    inherits(InvalidUnitError, _LuxonError5);
  
    function InvalidUnitError(unit) {
      classCallCheck(this, InvalidUnitError);
      return possibleConstructorReturn(this, _LuxonError5.call(this, 'Invalid unit ' + unit));
    }
  
    return InvalidUnitError;
  }(LuxonError);
  
  /**
   * @private
   */
  var InvalidArgumentError = function (_LuxonError6) {
    inherits(InvalidArgumentError, _LuxonError6);
  
    function InvalidArgumentError() {
      classCallCheck(this, InvalidArgumentError);
      return possibleConstructorReturn(this, _LuxonError6.apply(this, arguments));
    }
  
    return InvalidArgumentError;
  }(LuxonError);
  
  /**
   * @private
   */
  var ZoneIsAbstractError = function (_LuxonError7) {
    inherits(ZoneIsAbstractError, _LuxonError7);
  
    function ZoneIsAbstractError() {
      classCallCheck(this, ZoneIsAbstractError);
      return possibleConstructorReturn(this, _LuxonError7.call(this, 'Zone is an abstract class'));
    }
  
    return ZoneIsAbstractError;
  }(LuxonError);
  
  /* eslint no-unused-vars: "off" */
  /**
   * @interface
  */
  
  var Zone = function () {
    function Zone() {
      classCallCheck(this, Zone);
    }
  
    /**
     * Returns the offset's common name (such as EST) at the specified timestamp
     * @abstract
     * @param {number} ts - Epoch milliseconds for which to get the name
     * @param {Object} opts - Options to affect the format
     * @param {string} opts.format - What style of offset to return. Accepts 'long' or 'short'.
     * @param {string} opts.locale - What locale to return the offset name in.
     * @return {string}
     */
    Zone.prototype.offsetName = function offsetName(ts, opts) {
      throw new ZoneIsAbstractError();
    };
  
    /**
     * Return the offset in minutes for this zone at the specified timestamp.
     * @abstract
     * @param {number} ts - Epoch milliseconds for which to compute the offset
     * @return {number}
     */
  
  
    Zone.prototype.offset = function offset(ts) {
      throw new ZoneIsAbstractError();
    };
  
    /**
     * Return whether this Zone is equal to another zoner
     * @abstract
     * @param {Zone} otherZone - the zone to compare
     * @return {boolean}
     */
  
  
    Zone.prototype.equals = function equals(otherZone) {
      throw new ZoneIsAbstractError();
    };
  
    /**
     * Return whether this Zone is valid.
     * @abstract
     * @type {boolean}
     */
  
  
    createClass(Zone, [{
      key: 'type',
  
      /**
       * The type of zone
       * @abstract
       * @type {string}
       */
      get: function get$$1() {
        throw new ZoneIsAbstractError();
      }
  
      /**
       * The name of this zone.
       * @abstract
       * @type {string}
       */
  
    }, {
      key: 'name',
      get: function get$$1() {
        throw new ZoneIsAbstractError();
      }
  
      /**
       * Returns whether the offset is known to be fixed for the whole year.
       * @abstract
       * @type {boolean}
       */
  
    }, {
      key: 'universal',
      get: function get$$1() {
        throw new ZoneIsAbstractError();
      }
    }, {
      key: 'isValid',
      get: function get$$1() {
        throw new ZoneIsAbstractError();
      }
    }]);
    return Zone;
  }();
  
  var singleton = null;
  
  var LocalZone = function (_Zone) {
    inherits(LocalZone, _Zone);
  
    function LocalZone() {
      classCallCheck(this, LocalZone);
      return possibleConstructorReturn(this, _Zone.apply(this, arguments));
    }
  
    LocalZone.prototype.offsetName = function offsetName(ts, _ref) {
      var format = _ref.format,
          locale = _ref.locale;
  
      return parseZoneInfo(ts, format, locale);
    };
  
    LocalZone.prototype.offset = function offset(ts) {
      return -new Date(ts).getTimezoneOffset();
    };
  
    LocalZone.prototype.equals = function equals(otherZone) {
      return otherZone.type === 'local';
    };
  
    createClass(LocalZone, [{
      key: 'type',
      get: function get$$1() {
        return 'local';
      }
    }, {
      key: 'name',
      get: function get$$1() {
        if (hasIntl()) {
          return new Intl.DateTimeFormat().resolvedOptions().timeZone;
        } else return 'local';
      }
    }, {
      key: 'universal',
      get: function get$$1() {
        return false;
      }
    }, {
      key: 'isValid',
      get: function get$$1() {
        return true;
      }
    }], [{
      key: 'instance',
      get: function get$$1() {
        if (singleton === null) {
          singleton = new LocalZone();
        }
        return singleton;
      }
    }]);
    return LocalZone;
  }(Zone);
  
  var dtfCache = {};
  function makeDTF(zone) {
    if (!dtfCache[zone]) {
      dtfCache[zone] = new Intl.DateTimeFormat('en-US', {
        hour12: false,
        timeZone: zone,
        year: 'numeric',
        month: '2-digit',
        day: '2-digit',
        hour: '2-digit',
        minute: '2-digit',
        second: '2-digit'
      });
    }
    return dtfCache[zone];
  }
  
  var typeToPos = {
    year: 0,
    month: 1,
    day: 2,
    hour: 3,
    minute: 4,
    second: 5
  };
  
  function hackyOffset(dtf, date) {
    var formatted = dtf.format(date).replace(/\u200E/g, ''),
        parsed = /(\d+)\/(\d+)\/(\d+),? (\d+):(\d+):(\d+)/.exec(formatted),
        fMonth = parsed[1],
        fDay = parsed[2],
        fYear = parsed[3],
        fHour = parsed[4],
        fMinute = parsed[5],
        fSecond = parsed[6];
  
    return [fYear, fMonth, fDay, fHour, fMinute, fSecond];
  }
  
  function partsOffset(dtf, date) {
    var formatted = dtf.formatToParts(date),
        filled = [];
    for (var i = 0; i < formatted.length; i++) {
      var _formatted$i = formatted[i],
          type = _formatted$i.type,
          value = _formatted$i.value,
          pos = typeToPos[type];
  
  
      if (!isUndefined(pos)) {
        filled[pos] = parseInt(value, 10);
      }
    }
    return filled;
  }
  
  var IANAZone = function (_Zone) {
    inherits(IANAZone, _Zone);
  
    IANAZone.isValidSpecifier = function isValidSpecifier(s) {
      return s && s.match(/^[a-z_+-]{1,256}\/[a-z_+-]{1,256}(\/[a-z_+-]{1,256})?$/i);
    };
  
    IANAZone.isValidZone = function isValidZone(zone) {
      try {
        new Intl.DateTimeFormat('en-US', { timeZone: zone }).format();
        return true;
      } catch (e) {
        return false;
      }
    };
  
    // Etc/GMT+8 -> 480
  
  
    IANAZone.parseGMTOffset = function parseGMTOffset(specifier) {
      if (specifier) {
        var match = specifier.match(/^Etc\/GMT([+-]\d{1,2})$/i);
        if (match) {
          return 60 * parseInt(match[1]);
        }
      }
      return null;
    };
  
    function IANAZone(name) {
      classCallCheck(this, IANAZone);
  
      var _this = possibleConstructorReturn(this, _Zone.call(this));
  
      _this.zoneName = name;
      _this.valid = IANAZone.isValidZone(name);
      return _this;
    }
  
    IANAZone.prototype.offsetName = function offsetName(ts, _ref) {
      var format = _ref.format,
          locale = _ref.locale;
  
      return parseZoneInfo(ts, format, locale, this.zoneName);
    };
  
    IANAZone.prototype.offset = function offset(ts) {
      var date = new Date(ts),
          dtf = makeDTF(this.zoneName),
          _ref2 = dtf.formatToParts ? partsOffset(dtf, date) : hackyOffset(dtf, date),
          fYear = _ref2[0],
          fMonth = _ref2[1],
          fDay = _ref2[2],
          fHour = _ref2[3],
          fMinute = _ref2[4],
          fSecond = _ref2[5],
          asUTC = Date.UTC(fYear, fMonth - 1, fDay, fHour, fMinute, fSecond);
  
      var asTS = date.valueOf();
      asTS -= asTS % 1000;
      return (asUTC - asTS) / (60 * 1000);
    };
  
    IANAZone.prototype.equals = function equals(otherZone) {
      return otherZone.type === 'iana' && otherZone.zoneName === this.zoneName;
    };
  
    createClass(IANAZone, [{
      key: 'type',
      get: function get$$1() {
        return 'iana';
      }
    }, {
      key: 'name',
      get: function get$$1() {
        return this.zoneName;
      }
    }, {
      key: 'universal',
      get: function get$$1() {
        return false;
      }
    }, {
      key: 'isValid',
      get: function get$$1() {
        return this.valid;
      }
    }]);
    return IANAZone;
  }(Zone);
  
  var singleton$1 = null;
  
  function hoursMinutesOffset(z) {
    var hours = Math.trunc(z.fixed / 60),
        minutes = Math.abs(z.fixed % 60),
        sign = hours > 0 ? '+' : '-',
        base = sign + Math.abs(hours);
    return minutes > 0 ? base + ':' + padStart(minutes, 2) : base;
  }
  
  var FixedOffsetZone = function (_Zone) {
    inherits(FixedOffsetZone, _Zone);
  
    FixedOffsetZone.instance = function instance(offset) {
      return offset === 0 ? FixedOffsetZone.utcInstance : new FixedOffsetZone(offset);
    };
  
    FixedOffsetZone.parseSpecifier = function parseSpecifier(s) {
      if (s) {
        var r = s.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);
        if (r) {
          return new FixedOffsetZone(signedOffset(r[1], r[2]));
        }
      }
      return null;
    };
  
    createClass(FixedOffsetZone, null, [{
      key: 'utcInstance',
      get: function get$$1() {
        if (singleton$1 === null) {
          singleton$1 = new FixedOffsetZone(0);
        }
        return singleton$1;
      }
    }]);
  
    function FixedOffsetZone(offset) {
      classCallCheck(this, FixedOffsetZone);
  
      var _this = possibleConstructorReturn(this, _Zone.call(this));
  
      _this.fixed = offset;
      return _this;
    }
  
    FixedOffsetZone.prototype.offsetName = function offsetName() {
      return this.name;
    };
  
    FixedOffsetZone.prototype.offset = function offset() {
      return this.fixed;
    };
  
    FixedOffsetZone.prototype.equals = function equals(otherZone) {
      return otherZone.type === 'fixed' && otherZone.fixed === this.fixed;
    };
  
    createClass(FixedOffsetZone, [{
      key: 'type',
      get: function get$$1() {
        return 'fixed';
      }
    }, {
      key: 'name',
      get: function get$$1() {
        return this.fixed === 0 ? 'UTC' : 'UTC' + hoursMinutesOffset(this);
      }
    }, {
      key: 'universal',
      get: function get$$1() {
        return true;
      }
    }, {
      key: 'isValid',
      get: function get$$1() {
        return true;
      }
    }]);
    return FixedOffsetZone;
  }(Zone);
  
  var singleton$2 = null;
  
  var InvalidZone = function (_Zone) {
    inherits(InvalidZone, _Zone);
  
    function InvalidZone() {
      classCallCheck(this, InvalidZone);
      return possibleConstructorReturn(this, _Zone.apply(this, arguments));
    }
  
    InvalidZone.prototype.offsetName = function offsetName() {
      return null;
    };
  
    InvalidZone.prototype.offset = function offset() {
      return NaN;
    };
  
    InvalidZone.prototype.equals = function equals() {
      return false;
    };
  
    createClass(InvalidZone, [{
      key: 'type',
      get: function get$$1() {
        return 'invalid';
      }
    }, {
      key: 'name',
      get: function get$$1() {
        return null;
      }
    }, {
      key: 'universal',
      get: function get$$1() {
        return false;
      }
    }, {
      key: 'isValid',
      get: function get$$1() {
        return false;
      }
    }], [{
      key: 'instance',
      get: function get$$1() {
        if (singleton$2 === null) {
          singleton$2 = new InvalidZone();
        }
        return singleton$2;
      }
    }]);
    return InvalidZone;
  }(Zone);
  
  /**
   * @private
   */
  
  function normalizeZone(input, defaultZone) {
    var offset = void 0;
    if (isUndefined(input) || input === null) {
      return defaultZone;
    } else if (input instanceof Zone) {
      return input;
    } else if (isString(input)) {
      var lowered = input.toLowerCase();
      if (lowered === 'local') return LocalZone.instance;else if (lowered === 'utc' || lowered === 'gmt') return FixedOffsetZone.utcInstance;else if ((offset = IANAZone.parseGMTOffset(input)) != null) {
        // handle Etc/GMT-4, which V8 chokes on
        return FixedOffsetZone.instance(offset);
      } else if (IANAZone.isValidSpecifier(lowered)) return new IANAZone(input);else return FixedOffsetZone.parseSpecifier(lowered) || InvalidZone.instance;
    } else if (isNumber(input)) {
      return FixedOffsetZone.instance(input);
    } else if ((typeof input === 'undefined' ? 'undefined' : _typeof(input)) === 'object' && input.offset) {
      // This is dumb, but the instanceof check above doesn't seem to really work
      // so we're duck checking it
      return input;
    } else {
      return InvalidZone.instance;
    }
  }
  
  var now = function now() {
    return Date.now();
  };
  var defaultZone = null;
  var defaultLocale = null;
  var defaultNumberingSystem = null;
  var defaultOutputCalendar = null;
  var throwOnInvalid = false;
  
  /**
   * Settings contains static getters and setters that control Luxon's overall behavior. Luxon is a simple library with few options, but the ones it does have live here.
   */
  
  var Settings = function () {
    function Settings() {
      classCallCheck(this, Settings);
    }
  
    /**
     * Reset Luxon's global caches. Should only be necessary in testing scenarios.
     * @return {void}
     */
    Settings.resetCaches = function resetCaches() {
      Locale.resetCache();
    };
  
    createClass(Settings, null, [{
      key: 'now',
  
      /**
       * Get the callback for returning the current timestamp.
       * @type {function}
       */
      get: function get$$1() {
        return now;
      }
  
      /**
       * Set the callback for returning the current timestamp.
       * @type {function}
       */
      ,
      set: function set$$1(n) {
        now = n;
      }
  
      /**
       * Get the default time zone to create DateTimes in.
       * @type {string}
       */
  
    }, {
      key: 'defaultZoneName',
      get: function get$$1() {
        return (defaultZone || LocalZone.instance).name;
      }
  
      /**
       * Set the default time zone to create DateTimes in. Does not affect existing instances.
       * @type {string}
       */
      ,
      set: function set$$1(z) {
        if (!z) {
          defaultZone = null;
        } else {
          defaultZone = normalizeZone(z);
        }
      }
  
      /**
       * Get the default time zone object to create DateTimes in. Does not affect existing instances.
       * @type {Zone}
       */
  
    }, {
      key: 'defaultZone',
      get: function get$$1() {
        return defaultZone || LocalZone.instance;
      }
  
      /**
       * Get the default locale to create DateTimes with. Does not affect existing instances.
       * @type {string}
       */
  
    }, {
      key: 'defaultLocale',
      get: function get$$1() {
        return defaultLocale;
      }
  
      /**
       * Set the default locale to create DateTimes with. Does not affect existing instances.
       * @type {string}
       */
      ,
      set: function set$$1(locale) {
        defaultLocale = locale;
      }
  
      /**
       * Get the default numbering system to create DateTimes with. Does not affect existing instances.
       * @type {string}
       */
  
    }, {
      key: 'defaultNumberingSystem',
      get: function get$$1() {
        return defaultNumberingSystem;
      }
  
      /**
       * Set the default numbering system to create DateTimes with. Does not affect existing instances.
       * @type {string}
       */
      ,
      set: function set$$1(numberingSystem) {
        defaultNumberingSystem = numberingSystem;
      }
  
      /**
       * Get the default output calendar to create DateTimes with. Does not affect existing instances.
       * @type {string}
       */
  
    }, {
      key: 'defaultOutputCalendar',
      get: function get$$1() {
        return defaultOutputCalendar;
      }
  
      /**
       * Set the default output calendar to create DateTimes with. Does not affect existing instances.
       * @type {string}
       */
      ,
      set: function set$$1(outputCalendar) {
        defaultOutputCalendar = outputCalendar;
      }
  
      /**
       * Get whether Luxon will throw when it encounters invalid DateTimes, Durations, or Intervals
       * @type {boolean}
       */
  
    }, {
      key: 'throwOnInvalid',
      get: function get$$1() {
        return throwOnInvalid;
      }
  
      /**
       * Set whether Luxon will throw when it encounters invalid DateTimes, Durations, or Intervals
       * @type {boolean}
       */
      ,
      set: function set$$1(t) {
        throwOnInvalid = t;
      }
    }]);
    return Settings;
  }();
  
  function stringifyTokens(splits, tokenToString) {
    var s = '';
    for (var _iterator = splits, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
      var _ref;
  
      if (_isArray) {
        if (_i >= _iterator.length) break;
        _ref = _iterator[_i++];
      } else {
        _i = _iterator.next();
        if (_i.done) break;
        _ref = _i.value;
      }
  
      var token = _ref;
  
      if (token.literal) {
        s += token.val;
      } else {
        s += tokenToString(token.val);
      }
    }
    return s;
  }
  
  var tokenToObject = {
    D: DATE_SHORT,
    DD: DATE_MED,
    DDD: DATE_FULL,
    DDDD: DATE_HUGE,
    t: TIME_SIMPLE,
    tt: TIME_WITH_SECONDS,
    ttt: TIME_WITH_SHORT_OFFSET,
    tttt: TIME_WITH_LONG_OFFSET,
    T: TIME_24_SIMPLE,
    TT: TIME_24_WITH_SECONDS,
    TTT: TIME_24_WITH_SHORT_OFFSET,
    TTTT: TIME_24_WITH_LONG_OFFSET,
    f: DATETIME_SHORT,
    ff: DATETIME_MED,
    fff: DATETIME_FULL,
    ffff: DATETIME_HUGE,
    F: DATETIME_SHORT_WITH_SECONDS,
    FF: DATETIME_MED_WITH_SECONDS,
    FFF: DATETIME_FULL_WITH_SECONDS,
    FFFF: DATETIME_HUGE_WITH_SECONDS
  };
  
  /**
   * @private
   */
  
  var Formatter = function () {
    Formatter.create = function create(locale) {
      var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  
      var formatOpts = Object.assign({}, { round: true }, opts);
      return new Formatter(locale, formatOpts);
    };
  
    Formatter.parseFormat = function parseFormat(fmt) {
      var current = null,
          currentFull = '',
          bracketed = false;
      var splits = [];
      for (var i = 0; i < fmt.length; i++) {
        var c = fmt.charAt(i);
        if (c === "'") {
          if (currentFull.length > 0) {
            splits.push({ literal: bracketed, val: currentFull });
          }
          current = null;
          currentFull = '';
          bracketed = !bracketed;
        } else if (bracketed) {
          currentFull += c;
        } else if (c === current) {
          currentFull += c;
        } else {
          if (currentFull.length > 0) {
            splits.push({ literal: false, val: currentFull });
          }
          currentFull = c;
          current = c;
        }
      }
  
      if (currentFull.length > 0) {
        splits.push({ literal: bracketed, val: currentFull });
      }
  
      return splits;
    };
  
    function Formatter(locale, formatOpts) {
      classCallCheck(this, Formatter);
  
      this.opts = formatOpts;
      this.loc = locale;
      this.systemLoc = null;
    }
  
    Formatter.prototype.formatWithSystemDefault = function formatWithSystemDefault(dt, opts) {
      if (this.systemLoc === null) {
        this.systemLoc = this.loc.redefaultToSystem();
      }
      var df = this.systemLoc.dtFormatter(dt, Object.assign({}, this.opts, opts));
      return df.format();
    };
  
    Formatter.prototype.formatDateTime = function formatDateTime(dt) {
      var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  
      var df = this.loc.dtFormatter(dt, Object.assign({}, this.opts, opts));
      return df.format();
    };
  
    Formatter.prototype.formatDateTimeParts = function formatDateTimeParts(dt) {
      var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  
      var df = this.loc.dtFormatter(dt, Object.assign({}, this.opts, opts));
      return df.formatToParts();
    };
  
    Formatter.prototype.resolvedOptions = function resolvedOptions(dt) {
      var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  
      var df = this.loc.dtFormatter(dt, Object.assign({}, this.opts, opts));
      return df.resolvedOptions();
    };
  
    Formatter.prototype.num = function num(n) {
      var p = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
  
      // we get some perf out of doing this here, annoyingly
      if (this.opts.forceSimple) {
        return padStart(n, p);
      }
  
      var opts = Object.assign({}, this.opts);
  
      if (p > 0) {
        opts.padTo = p;
      }
  
      return this.loc.numberFormatter(opts).format(n);
    };
  
    Formatter.prototype.formatDateTimeFromString = function formatDateTimeFromString(dt, fmt) {
      var _this = this;
  
      var knownEnglish = this.loc.listingMode() === 'en';
      var string = function string(opts, extract) {
        return _this.loc.extract(dt, opts, extract);
      },
          formatOffset = function formatOffset(opts) {
        if (dt.isOffsetFixed && dt.offset === 0 && opts.allowZ) {
          return 'Z';
        }
  
        var hours = Math.trunc(dt.offset / 60),
            minutes = Math.abs(dt.offset % 60),
            sign = hours >= 0 ? '+' : '-',
            base = '' + sign + Math.abs(hours);
  
        switch (opts.format) {
          case 'short':
            return '' + sign + _this.num(Math.abs(hours), 2) + ':' + _this.num(minutes, 2);
          case 'narrow':
            return minutes > 0 ? base + ':' + minutes : base;
          case 'techie':
            return '' + sign + _this.num(Math.abs(hours), 2) + _this.num(minutes, 2);
          default:
            throw new RangeError('Value format ' + opts.format + ' is out of range for property format');
        }
      },
          meridiem = function meridiem() {
        return knownEnglish ? meridiemForDateTime(dt) : string({ hour: 'numeric', hour12: true }, 'dayperiod');
      },
          month = function month(length, standalone) {
        return knownEnglish ? monthForDateTime(dt, length) : string(standalone ? { month: length } : { month: length, day: 'numeric' }, 'month');
      },
          weekday = function weekday(length, standalone) {
        return knownEnglish ? weekdayForDateTime(dt, length) : string(standalone ? { weekday: length } : { weekday: length, month: 'long', day: 'numeric' }, 'weekday');
      },
          maybeMacro = function maybeMacro(token) {
        var macro = tokenToObject[token];
        if (macro) {
          return _this.formatWithSystemDefault(dt, macro);
        } else {
          return token;
        }
      },
          era = function era(length) {
        return knownEnglish ? eraForDateTime(dt, length) : string({ era: length }, 'era');
      },
          tokenToString = function tokenToString(token) {
        var outputCal = _this.loc.outputCalendar;
  
        // Where possible: http://cldr.unicode.org/translation/date-time#TOC-Stand-Alone-vs.-Format-Styles
        switch (token) {
          // ms
          case 'S':
            return _this.num(dt.millisecond);
          case 'u':
          // falls through
          case 'SSS':
            return _this.num(dt.millisecond, 3);
          // seconds
          case 's':
            return _this.num(dt.second);
          case 'ss':
            return _this.num(dt.second, 2);
          // minutes
          case 'm':
            return _this.num(dt.minute);
          case 'mm':
            return _this.num(dt.minute, 2);
          // hours
          case 'h':
            return _this.num(dt.hour % 12 === 0 ? 12 : dt.hour % 12);
          case 'hh':
            return _this.num(dt.hour % 12 === 0 ? 12 : dt.hour % 12, 2);
          case 'H':
            return _this.num(dt.hour);
          case 'HH':
            return _this.num(dt.hour, 2);
          // offset
          case 'Z':
            // like +6
            return formatOffset({ format: 'narrow', allowZ: _this.opts.allowZ });
          case 'ZZ':
            // like +06:00
            return formatOffset({ format: 'short', allowZ: _this.opts.allowZ });
          case 'ZZZ':
            // like +0600
            return formatOffset({ format: 'techie', allowZ: false });
          case 'ZZZZ':
            // like EST
            return dt.offsetNameShort;
          case 'ZZZZZ':
            // like Eastern Standard Time
            return dt.offsetNameLong;
          // zone
          case 'z':
            // like America/New_York
            return dt.zoneName;
          // meridiems
          case 'a':
            return meridiem();
          // dates
          case 'd':
            return outputCal ? string({ day: 'numeric' }, 'day') : _this.num(dt.day);
          case 'dd':
            return outputCal ? string({ day: '2-digit' }, 'day') : _this.num(dt.day, 2);
          // weekdays - standalone
          case 'c':
            // like 1
            return _this.num(dt.weekday);
          case 'ccc':
            // like 'Tues'
            return weekday('short', true);
          case 'cccc':
            // like 'Tuesday'
            return weekday('long', true);
          case 'ccccc':
            // like 'T'
            return weekday('narrow', true);
          // weekdays - format
          case 'E':
            // like 1
            return _this.num(dt.weekday);
          case 'EEE':
            // like 'Tues'
            return weekday('short', false);
          case 'EEEE':
            // like 'Tuesday'
            return weekday('long', false);
          case 'EEEEE':
            // like 'T'
            return weekday('narrow', false);
          // months - standalone
          case 'L':
            // like 1
            return outputCal ? string({ month: 'numeric', day: 'numeric' }, 'month') : _this.num(dt.month);
          case 'LL':
            // like 01, doesn't seem to work
            return outputCal ? string({ month: '2-digit', day: 'numeric' }, 'month') : _this.num(dt.month, 2);
          case 'LLL':
            // like Jan
            return month('short', true);
          case 'LLLL':
            // like January
            return month('long', true);
          case 'LLLLL':
            // like J
            return month('narrow', true);
          // months - format
          case 'M':
            // like 1
            return outputCal ? string({ month: 'numeric' }, 'month') : _this.num(dt.month);
          case 'MM':
            // like 01
            return outputCal ? string({ month: '2-digit' }, 'month') : _this.num(dt.month, 2);
          case 'MMM':
            // like Jan
            return month('short', false);
          case 'MMMM':
            // like January
            return month('long', false);
          case 'MMMMM':
            // like J
            return month('narrow', false);
          // years
          case 'y':
            // like 2014
            return outputCal ? string({ year: 'numeric' }, 'year') : _this.num(dt.year);
          case 'yy':
            // like 14
            return outputCal ? string({ year: '2-digit' }, 'year') : _this.num(dt.year.toString().slice(-2), 2);
          case 'yyyy':
            // like 0012
            return outputCal ? string({ year: 'numeric' }, 'year') : _this.num(dt.year, 4);
          case 'yyyyyy':
            // like 000012
            return outputCal ? string({ year: 'numeric' }, 'year') : _this.num(dt.year, 6);
          // eras
          case 'G':
            // like AD
            return era('short');
          case 'GG':
            // like Anno Domini
            return era('long');
          case 'GGGGG':
            return era('narrow');
          case 'kk':
            return _this.num(dt.weekYear.toString().slice(-2), 2);
          case 'kkkk':
            return _this.num(dt.weekYear, 4);
          case 'W':
            return _this.num(dt.weekNumber);
          case 'WW':
            return _this.num(dt.weekNumber, 2);
          case 'o':
            return _this.num(dt.ordinal);
          case 'ooo':
            return _this.num(dt.ordinal, 3);
          case 'q':
            // like 1
            return _this.num(dt.quarter);
          case 'qq':
            // like 01
            return _this.num(dt.quarter, 2);
          default:
            return maybeMacro(token);
        }
      };
  
      return stringifyTokens(Formatter.parseFormat(fmt), tokenToString);
    };
  
    Formatter.prototype.formatDurationFromString = function formatDurationFromString(dur, fmt) {
      var _this2 = this;
  
      var tokenToField = function tokenToField(token) {
        switch (token[0]) {
          case 'S':
            return 'millisecond';
          case 's':
            return 'second';
          case 'm':
            return 'minute';
          case 'h':
            return 'hour';
          case 'd':
            return 'day';
          case 'M':
            return 'month';
          case 'y':
            return 'year';
          default:
            return null;
        }
      },
          tokenToString = function tokenToString(lildur) {
        return function (token) {
          var mapped = tokenToField(token);
          if (mapped) {
            return _this2.num(lildur.get(mapped), token.length);
          } else {
            return token;
          }
        };
      },
          tokens = Formatter.parseFormat(fmt),
          realTokens = tokens.reduce(function (found, _ref2) {
        var literal = _ref2.literal,
            val = _ref2.val;
        return literal ? found : found.concat(val);
      }, []),
          collapsed = dur.shiftTo.apply(dur, realTokens.map(tokenToField).filter(function (t) {
        return t;
      }));
      return stringifyTokens(tokens, tokenToString(collapsed));
    };
  
    return Formatter;
  }();
  
  var sysLocaleCache = null;
  function systemLocale() {
    if (sysLocaleCache) {
      return sysLocaleCache;
    } else if (hasIntl()) {
      var computedSys = new Intl.DateTimeFormat().resolvedOptions().locale;
      // node sometimes defaults to "und". Override that because that is dumb
      sysLocaleCache = computedSys === 'und' ? 'en-US' : computedSys;
      return sysLocaleCache;
    } else {
      sysLocaleCache = 'en-US';
      return sysLocaleCache;
    }
  }
  
  function intlConfigString(locale, numberingSystem, outputCalendar) {
    if (hasIntl()) {
      locale = Array.isArray(locale) ? locale : [locale];
  
      if (outputCalendar || numberingSystem) {
        locale = locale.map(function (l) {
          l += '-u';
  
          if (outputCalendar) {
            l += '-ca-' + outputCalendar;
          }
  
          if (numberingSystem) {
            l += '-nu-' + numberingSystem;
          }
          return l;
        });
      }
      return locale;
    } else {
      return [];
    }
  }
  
  function mapMonths(f) {
    var ms = [];
    for (var i = 1; i <= 12; i++) {
      var dt = DateTime.utc(2016, i, 1);
      ms.push(f(dt));
    }
    return ms;
  }
  
  function mapWeekdays(f) {
    var ms = [];
    for (var i = 1; i <= 7; i++) {
      var dt = DateTime.utc(2016, 11, 13 + i);
      ms.push(f(dt));
    }
    return ms;
  }
  
  function listStuff(loc, length, defaultOK, englishFn, intlFn) {
    var mode = loc.listingMode(defaultOK);
  
    if (mode === 'error') {
      return null;
    } else if (mode === 'en') {
      return englishFn(length);
    } else {
      return intlFn(length);
    }
  }
  
  function supportsFastNumbers(loc) {
    if (loc.numberingSystem && loc.numberingSystem !== 'latn') {
      return false;
    } else {
      return loc.numberingSystem === 'latn' || !loc.locale || loc.locale.startsWith('en') || hasIntl() && Intl.DateTimeFormat(loc.intl).resolvedOptions().numberingSystem === 'latn';
    }
  }
  
  /**
   * @private
   */
  
  var SimpleNumberFormatter = function () {
    function SimpleNumberFormatter(opts) {
      classCallCheck(this, SimpleNumberFormatter);
  
      this.padTo = opts.padTo || 0;
      this.round = opts.round || false;
      this.floor = opts.floor || false;
    }
  
    SimpleNumberFormatter.prototype.format = function format(i) {
      // to match the browser's numberformatter defaults
      var fixed = this.floor ? Math.floor(i) : roundTo(i, this.round ? 0 : 3);
      return padStart(fixed, this.padTo);
    };
  
    return SimpleNumberFormatter;
  }();
  
  var IntlNumberFormatter = function () {
    function IntlNumberFormatter(intl, opts) {
      classCallCheck(this, IntlNumberFormatter);
  
      var intlOpts = { useGrouping: false };
  
      if (opts.padTo > 0) {
        intlOpts.minimumIntegerDigits = opts.padTo;
      }
  
      if (opts.round) {
        intlOpts.maximumFractionDigits = 0;
      }
  
      this.floor = opts.floor;
      this.intl = new Intl.NumberFormat(intl, intlOpts);
    }
  
    IntlNumberFormatter.prototype.format = function format(i) {
      var fixed = this.floor ? Math.floor(i) : i;
      return this.intl.format(fixed);
    };
  
    return IntlNumberFormatter;
  }();
  
  /**
   * @private
   */
  
  var PolyDateFormatter = function () {
    function PolyDateFormatter(dt, intl, opts) {
      classCallCheck(this, PolyDateFormatter);
  
      this.opts = opts;
      this.hasIntl = hasIntl();
  
      var z = void 0;
      if (dt.zone.universal && this.hasIntl) {
        // Chromium doesn't support fixed-offset zones like Etc/GMT+8 in its formatter,
        // See https://bugs.chromium.org/p/chromium/issues/detail?id=364374.
        // So we have to make do. Two cases:
        // 1. The format options tell us to show the zone. We can't do that, so the best
        // we can do is format the date in UTC.
        // 2. The format options don't tell us to show the zone. Then we can adjust them
        // the time and tell the formatter to show it to us in UTC, so that the time is right
        // and the bad zone doesn't show up.
        // We can clean all this up when Chrome fixes this.
        z = 'UTC';
        if (opts.timeZoneName) {
          this.dt = dt;
        } else {
          this.dt = dt.offset === 0 ? dt : DateTime.fromMillis(dt.ts + dt.offset * 60 * 1000);
        }
      } else if (dt.zone.type === 'local') {
        this.dt = dt;
      } else {
        this.dt = dt;
        z = dt.zone.name;
      }
  
      if (this.hasIntl) {
        var realIntlOpts = Object.assign({}, this.opts);
        if (z) {
          realIntlOpts.timeZone = z;
        }
        this.dtf = new Intl.DateTimeFormat(intl, realIntlOpts);
      }
    }
  
    PolyDateFormatter.prototype.format = function format() {
      if (this.hasIntl) {
        return this.dtf.format(this.dt.toJSDate());
      } else {
        var tokenFormat = formatString(this.opts),
            loc = Locale.create('en-US');
        return Formatter.create(loc).formatDateTimeFromString(this.dt, tokenFormat);
      }
    };
  
    PolyDateFormatter.prototype.formatToParts = function formatToParts() {
      if (this.hasIntl && hasFormatToParts()) {
        return this.dtf.formatToParts(this.dt.toJSDate());
      } else {
        // This is kind of a cop out. We actually could do this for English. However, we couldn't do it for intl strings
        // and IMO it's too weird to have an uncanny valley like that
        return [];
      }
    };
  
    PolyDateFormatter.prototype.resolvedOptions = function resolvedOptions() {
      if (this.hasIntl) {
        return this.dtf.resolvedOptions();
      } else {
        return {
          locale: 'en-US',
          numberingSystem: 'latn',
          outputCalendar: 'gregory'
        };
      }
    };
  
    return PolyDateFormatter;
  }();
  
  /**
   * @private
   */
  
  var Locale = function () {
    Locale.fromOpts = function fromOpts(opts) {
      return Locale.create(opts.locale, opts.numberingSystem, opts.outputCalendar, opts.defaultToEN);
    };
  
    Locale.create = function create(locale, numberingSystem, outputCalendar) {
      var defaultToEN = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
  
      var specifiedLocale = locale || Settings.defaultLocale,
  
      // the system locale is useful for human readable strings but annoying for parsing/formatting known formats
      localeR = specifiedLocale || (defaultToEN ? 'en-US' : systemLocale()),
          numberingSystemR = numberingSystem || Settings.defaultNumberingSystem,
          outputCalendarR = outputCalendar || Settings.defaultOutputCalendar;
      return new Locale(localeR, numberingSystemR, outputCalendarR, specifiedLocale);
    };
  
    Locale.resetCache = function resetCache() {
      sysLocaleCache = null;
    };
  
    Locale.fromObject = function fromObject() {
      var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
          locale = _ref.locale,
          numberingSystem = _ref.numberingSystem,
          outputCalendar = _ref.outputCalendar;
  
      return Locale.create(locale, numberingSystem, outputCalendar);
    };
  
    function Locale(locale, numbering, outputCalendar, specifiedLocale) {
      classCallCheck(this, Locale);
  
      this.locale = locale;
      this.numberingSystem = numbering;
      this.outputCalendar = outputCalendar;
      this.intl = intlConfigString(this.locale, this.numberingSystem, this.outputCalendar);
  
      this.weekdaysCache = { format: {}, standalone: {} };
      this.monthsCache = { format: {}, standalone: {} };
      this.meridiemCache = null;
      this.eraCache = {};
  
      this.specifiedLocale = specifiedLocale;
      this.fastNumbersCached = null;
    }
  
    // todo: cache me
    Locale.prototype.listingMode = function listingMode() {
      var defaultOK = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
  
      var intl = hasIntl(),
          hasFTP = intl && hasFormatToParts(),
          isActuallyEn = this.locale === 'en' || this.locale.toLowerCase() === 'en-us' || intl && Intl.DateTimeFormat(this.intl).resolvedOptions().locale.startsWith('en-us'),
          hasNoWeirdness = (this.numberingSystem === null || this.numberingSystem === 'latn') && (this.outputCalendar === null || this.outputCalendar === 'gregory');
  
      if (!hasFTP && !(isActuallyEn && hasNoWeirdness) && !defaultOK) {
        return 'error';
      } else if (!hasFTP || isActuallyEn && hasNoWeirdness) {
        return 'en';
      } else {
        return 'intl';
      }
    };
  
    Locale.prototype.clone = function clone(alts) {
      if (!alts || Object.getOwnPropertyNames(alts).length === 0) {
        return this;
      } else {
        return Locale.create(alts.locale || this.specifiedLocale, alts.numberingSystem || this.numberingSystem, alts.outputCalendar || this.outputCalendar, alts.defaultToEN || false);
      }
    };
  
    Locale.prototype.redefaultToEN = function redefaultToEN() {
      var alts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  
      return this.clone(Object.assign({}, alts, { defaultToEN: true }));
    };
  
    Locale.prototype.redefaultToSystem = function redefaultToSystem() {
      var alts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  
      return this.clone(Object.assign({}, alts, { defaultToEN: false }));
    };
  
    Locale.prototype.months = function months$$1(length) {
      var _this = this;
  
      var format = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
      var defaultOK = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
  
      return listStuff(this, length, defaultOK, months, function () {
        var intl = format ? { month: length, day: 'numeric' } : { month: length },
            formatStr = format ? 'format' : 'standalone';
        if (!_this.monthsCache[formatStr][length]) {
          _this.monthsCache[formatStr][length] = mapMonths(function (dt) {
            return _this.extract(dt, intl, 'month');
          });
        }
        return _this.monthsCache[formatStr][length];
      });
    };
  
    Locale.prototype.weekdays = function weekdays$$1(length) {
      var _this2 = this;
  
      var format = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
      var defaultOK = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
  
      return listStuff(this, length, defaultOK, weekdays, function () {
        var intl = format ? { weekday: length, year: 'numeric', month: 'long', day: 'numeric' } : { weekday: length },
            formatStr = format ? 'format' : 'standalone';
        if (!_this2.weekdaysCache[formatStr][length]) {
          _this2.weekdaysCache[formatStr][length] = mapWeekdays(function (dt) {
            return _this2.extract(dt, intl, 'weekday');
          });
        }
        return _this2.weekdaysCache[formatStr][length];
      });
    };
  
    Locale.prototype.meridiems = function meridiems$$1() {
      var _this3 = this;
  
      var defaultOK = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
  
      return listStuff(this, undefined, defaultOK, function () {
        return meridiems;
      }, function () {
        // In theory there could be aribitrary day periods. We're gonna assume there are exactly two
        // for AM and PM. This is probably wrong, but it's makes parsing way easier.
        if (!_this3.meridiemCache) {
          var intl = { hour: 'numeric', hour12: true };
          _this3.meridiemCache = [DateTime.utc(2016, 11, 13, 9), DateTime.utc(2016, 11, 13, 19)].map(function (dt) {
            return _this3.extract(dt, intl, 'dayperiod');
          });
        }
  
        return _this3.meridiemCache;
      });
    };
  
    Locale.prototype.eras = function eras$$1(length) {
      var _this4 = this;
  
      var defaultOK = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
  
      return listStuff(this, length, defaultOK, eras, function () {
        var intl = { era: length };
  
        // This is utter bullshit. Different calendars are going to define eras totally differently. What I need is the minimum set of dates
        // to definitely enumerate them.
        if (!_this4.eraCache[length]) {
          _this4.eraCache[length] = [DateTime.utc(-40, 1, 1), DateTime.utc(2017, 1, 1)].map(function (dt) {
            return _this4.extract(dt, intl, 'era');
          });
        }
  
        return _this4.eraCache[length];
      });
    };
  
    Locale.prototype.extract = function extract(dt, intlOpts, field) {
      var df = this.dtFormatter(dt, intlOpts),
          results = df.formatToParts(),
          matching = results.find(function (m) {
        return m.type.toLowerCase() === field;
      });
  
      return matching ? matching.value : null;
    };
  
    Locale.prototype.numberFormatter = function numberFormatter() {
      var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  
      // this forcesimple option is never used (the only caller short-circuits on it, but it seems safer to leave)
      // (in contrast, the rest of the condition is used heavily)
      if (opts.forceSimple || this.fastNumbers || !hasIntl()) {
        return new SimpleNumberFormatter(opts);
      } else {
        return new IntlNumberFormatter(this.intl, opts);
      }
    };
  
    Locale.prototype.dtFormatter = function dtFormatter(dt) {
      var intlOpts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  
      return new PolyDateFormatter(dt, this.intl, intlOpts);
    };
  
    Locale.prototype.equals = function equals(other) {
      return this.locale === other.locale && this.numberingSystem === other.numberingSystem && this.outputCalendar === other.outputCalendar;
    };
  
    createClass(Locale, [{
      key: 'fastNumbers',
      get: function get$$1() {
        if (this.fastNumbersCached == null) {
          this.fastNumbersCached = supportsFastNumbers(this);
        }
  
        return this.fastNumbersCached;
      }
    }]);
    return Locale;
  }();
  
  /*
   * This file handles parsing for well-specified formats. Here's how it works:
   * Two things go into parsing: a regex to match with and an extractor to take apart the groups in the match.
   * An extractor is just a function that takes a regex match array and returns a { year: ..., month: ... } object
   * parse() does the work of executing the regex and applying the extractor. It takes multiple regex/extractor pairs to try in sequence.
   * Extractors can take a "cursor" representing the offset in the match to look at. This makes it easy to combine extractors.
   * combineExtractors() does the work of combining them, keeping track of the cursor through multiple extractions.
   * Some extractions are super dumb and simpleParse and fromStrings help DRY them.
   */
  
  function combineRegexes() {
    for (var _len = arguments.length, regexes = Array(_len), _key = 0; _key < _len; _key++) {
      regexes[_key] = arguments[_key];
    }
  
    var full = regexes.reduce(function (f, r) {
      return f + r.source;
    }, '');
    return RegExp('^' + full + '$');
  }
  
  function combineExtractors() {
    for (var _len2 = arguments.length, extractors = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
      extractors[_key2] = arguments[_key2];
    }
  
    return function (m) {
      return extractors.reduce(function (_ref, ex) {
        var mergedVals = _ref[0],
            mergedZone = _ref[1],
            cursor = _ref[2];
  
        var _ex = ex(m, cursor),
            val = _ex[0],
            zone = _ex[1],
            next = _ex[2];
  
        return [Object.assign(mergedVals, val), mergedZone || zone, next];
      }, [{}, null, 1]).slice(0, 2);
    };
  }
  
  function parse(s) {
    if (s == null) {
      return [null, null];
    }
  
    for (var _len3 = arguments.length, patterns = Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
      patterns[_key3 - 1] = arguments[_key3];
    }
  
    for (var _iterator = patterns, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
      var _ref3;
  
      if (_isArray) {
        if (_i >= _iterator.length) break;
        _ref3 = _iterator[_i++];
      } else {
        _i = _iterator.next();
        if (_i.done) break;
        _ref3 = _i.value;
      }
  
      var _ref2 = _ref3;
      var regex = _ref2[0];
      var extractor = _ref2[1];
  
      var m = regex.exec(s);
      if (m) {
        return extractor(m);
      }
    }
    return [null, null];
  }
  
  function simpleParse() {
    for (var _len4 = arguments.length, keys = Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
      keys[_key4] = arguments[_key4];
    }
  
    return function (match, cursor) {
      var ret = {};
      var i = void 0;
  
      for (i = 0; i < keys.length; i++) {
        ret[keys[i]] = parseInt(match[cursor + i]);
      }
      return [ret, null, cursor + i];
    };
  }
  
  // ISO and SQL parsing
  var offsetRegex = /(?:(Z)|([+-]\d\d)(?::?(\d\d))?)/;
  var isoTimeBaseRegex = /(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,9}))?)?)?/;
  var isoTimeRegex = RegExp('' + isoTimeBaseRegex.source + offsetRegex.source + '?');
  var isoTimeExtensionRegex = RegExp('(?:T' + isoTimeRegex.source + ')?');
  var isoYmdRegex = /([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/;
  var isoWeekRegex = /(\d{4})-?W(\d\d)-?(\d)/;
  var isoOrdinalRegex = /(\d{4})-?(\d{3})/;
  var extractISOWeekData = simpleParse('weekYear', 'weekNumber', 'weekDay');
  var extractISOOrdinalData = simpleParse('year', 'ordinal');
  var sqlYmdRegex = /(\d{4})-(\d\d)-(\d\d)/;
  var sqlTimeRegex = RegExp(isoTimeBaseRegex.source + ' ?(?:' + offsetRegex.source + '|([a-zA-Z_]{1,256}/[a-zA-Z_]{1,256}))?');
  var sqlTimeExtensionRegex = RegExp('(?: ' + sqlTimeRegex.source + ')?');
  
  function extractISOYmd(match, cursor) {
    var item = {
      year: parseInt(match[cursor]),
      month: parseInt(match[cursor + 1]) || 1,
      day: parseInt(match[cursor + 2]) || 1
    };
  
    return [item, null, cursor + 3];
  }
  
  function extractISOTime(match, cursor) {
    var item = {
      hour: parseInt(match[cursor]) || 0,
      minute: parseInt(match[cursor + 1]) || 0,
      second: parseInt(match[cursor + 2]) || 0,
      millisecond: parseMillis(match[cursor + 3])
    };
  
    return [item, null, cursor + 4];
  }
  
  function extractISOOffset(match, cursor) {
    var local = !match[cursor] && !match[cursor + 1],
        fullOffset = signedOffset(match[cursor + 1], match[cursor + 2]),
        zone = local ? null : FixedOffsetZone.instance(fullOffset);
    return [{}, zone, cursor + 3];
  }
  
  function extractIANAZone(match, cursor) {
    var zone = match[cursor] ? new IANAZone(match[cursor]) : null;
    return [{}, zone, cursor + 1];
  }
  
  // ISO duration parsing
  
  var isoDuration = /^P(?:(?:(\d{1,9})Y)?(?:(\d{1,9})M)?(?:(\d{1,9})D)?(?:T(?:(\d{1,9})H)?(?:(\d{1,9})M)?(?:(\d{1,9})(?:[.,](\d{1,9}))?S)?)?|(\d{1,9})W)$/;
  
  function extractISODuration(match) {
    var yearStr = match[1],
        monthStr = match[2],
        dayStr = match[3],
        hourStr = match[4],
        minuteStr = match[5],
        secondStr = match[6],
        millisecondsStr = match[7],
        weekStr = match[8];
  
  
    return [{
      years: parseInt(yearStr),
      months: parseInt(monthStr),
      weeks: parseInt(weekStr),
      days: parseInt(dayStr),
      hours: parseInt(hourStr),
      minutes: parseInt(minuteStr),
      seconds: parseInt(secondStr),
      milliseconds: parseMillis(millisecondsStr)
    }];
  }
  
  // These are a little braindead. EDT *should* tell us that we're in, say, America/New_York
  // and not just that we're in -240 *right now*. But since I don't think these are used that often
  // I'm just going to ignore that
  var obsOffsets = {
    GMT: 0,
    EDT: -4 * 60,
    EST: -5 * 60,
    CDT: -5 * 60,
    CST: -6 * 60,
    MDT: -6 * 60,
    MST: -7 * 60,
    PDT: -7 * 60,
    PST: -8 * 60
  };
  
  function fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr) {
    var result = {
      year: yearStr.length === 2 ? untruncateYear(parseInt(yearStr)) : parseInt(yearStr),
      month: monthStr.length === 2 ? parseInt(monthStr, 10) : monthsShort.indexOf(monthStr) + 1,
      day: parseInt(dayStr),
      hour: parseInt(hourStr),
      minute: parseInt(minuteStr)
    };
  
    if (secondStr) result.second = parseInt(secondStr);
    if (weekdayStr) {
      result.weekday = weekdayStr.length > 3 ? weekdaysLong.indexOf(weekdayStr) + 1 : weekdaysShort.indexOf(weekdayStr) + 1;
    }
  
    return result;
  }
  
  // RFC 2822/5322
  var rfc2822 = /^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|(?:([+-]\d\d)(\d\d)))$/;
  
  function extractRFC2822(match) {
    var weekdayStr = match[1],
        dayStr = match[2],
        monthStr = match[3],
        yearStr = match[4],
        hourStr = match[5],
        minuteStr = match[6],
        secondStr = match[7],
        obsOffset = match[8],
        milOffset = match[9],
        offHourStr = match[10],
        offMinuteStr = match[11],
        result = fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr);
  
  
    var offset = void 0;
    if (obsOffset) {
      offset = obsOffsets[obsOffset];
    } else if (milOffset) {
      offset = 0;
    } else {
      offset = signedOffset(offHourStr, offMinuteStr);
    }
  
    return [result, new FixedOffsetZone(offset)];
  }
  
  function preprocessRFC2822(s) {
    // Remove comments and folding whitespace and replace multiple-spaces with a single space
    return s.replace(/\([^)]*\)|[\n\t]/g, ' ').replace(/(\s\s+)/g, ' ').trim();
  }
  
  // http date
  
  var rfc1123 = /^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d\d) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d\d):(\d\d):(\d\d) GMT$/;
  var rfc850 = /^(Monday|Tuesday|Wedsday|Thursday|Friday|Saturday|Sunday), (\d\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d\d) (\d\d):(\d\d):(\d\d) GMT$/;
  var ascii = /^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( \d|\d\d) (\d\d):(\d\d):(\d\d) (\d{4})$/;
  
  function extractRFC1123Or850(match) {
    var weekdayStr = match[1],
        dayStr = match[2],
        monthStr = match[3],
        yearStr = match[4],
        hourStr = match[5],
        minuteStr = match[6],
        secondStr = match[7],
        result = fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr);
  
    return [result, FixedOffsetZone.utcInstance];
  }
  
  function extractASCII(match) {
    var weekdayStr = match[1],
        monthStr = match[2],
        dayStr = match[3],
        hourStr = match[4],
        minuteStr = match[5],
        secondStr = match[6],
        yearStr = match[7],
        result = fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr);
  
    return [result, FixedOffsetZone.utcInstance];
  }
  
  /**
   * @private
   */
  
  function parseISODate(s) {
    return parse(s, [combineRegexes(isoYmdRegex, isoTimeExtensionRegex), combineExtractors(extractISOYmd, extractISOTime, extractISOOffset)], [combineRegexes(isoWeekRegex, isoTimeExtensionRegex), combineExtractors(extractISOWeekData, extractISOTime, extractISOOffset)], [combineRegexes(isoOrdinalRegex, isoTimeExtensionRegex), combineExtractors(extractISOOrdinalData, extractISOTime)], [combineRegexes(isoTimeRegex), combineExtractors(extractISOTime, extractISOOffset)]);
  }
  
  function parseRFC2822Date(s) {
    return parse(preprocessRFC2822(s), [rfc2822, extractRFC2822]);
  }
  
  function parseHTTPDate(s) {
    return parse(s, [rfc1123, extractRFC1123Or850], [rfc850, extractRFC1123Or850], [ascii, extractASCII]);
  }
  
  function parseISODuration(s) {
    return parse(s, [isoDuration, extractISODuration]);
  }
  
  function parseSQL(s) {
    return parse(s, [combineRegexes(sqlYmdRegex, sqlTimeExtensionRegex), combineExtractors(extractISOYmd, extractISOTime, extractISOOffset, extractIANAZone)], [combineRegexes(sqlTimeRegex), combineExtractors(extractISOTime, extractISOOffset, extractIANAZone)]);
  }
  
  var INVALID$1 = 'Invalid Duration';
  var UNPARSABLE$1 = 'unparsable';
  
  // unit conversion constants
  var lowOrderMatrix = {
    weeks: {
      days: 7,
      hours: 7 * 24,
      minutes: 7 * 24 * 60,
      seconds: 7 * 24 * 60 * 60,
      milliseconds: 7 * 24 * 60 * 60 * 1000
    },
    days: {
      hours: 24,
      minutes: 24 * 60,
      seconds: 24 * 60 * 60,
      milliseconds: 24 * 60 * 60 * 1000
    },
    hours: { minutes: 60, seconds: 60 * 60, milliseconds: 60 * 60 * 1000 },
    minutes: { seconds: 60, milliseconds: 60 * 1000 },
    seconds: { milliseconds: 1000 }
  };
  var casualMatrix = Object.assign({
    years: {
      months: 12,
      weeks: 52,
      days: 365,
      hours: 365 * 24,
      minutes: 365 * 24 * 60,
      seconds: 365 * 24 * 60 * 60,
      milliseconds: 365 * 24 * 60 * 60 * 1000
    },
    quarters: {
      months: 3,
      weeks: 13,
      days: 91,
      hours: 91 * 24,
      minutes: 91 * 24 * 60,
      milliseconds: 91 * 24 * 60 * 60 * 1000
    },
    months: {
      weeks: 4,
      days: 30,
      hours: 30 * 24,
      minutes: 30 * 24 * 60,
      seconds: 30 * 24 * 60 * 60,
      milliseconds: 30 * 24 * 60 * 60 * 1000
    }
  }, lowOrderMatrix);
  var daysInYearAccurate = 146097.0 / 400;
  var daysInMonthAccurate = 146097.0 / 4800;
  var accurateMatrix = Object.assign({
    years: {
      months: 12,
      weeks: daysInYearAccurate / 7,
      days: daysInYearAccurate,
      hours: daysInYearAccurate * 24,
      minutes: daysInYearAccurate * 24 * 60,
      seconds: daysInYearAccurate * 24 * 60 * 60,
      milliseconds: daysInYearAccurate * 24 * 60 * 60 * 1000
    },
    quarters: {
      months: 3,
      weeks: daysInYearAccurate / 28,
      days: daysInYearAccurate / 4,
      hours: daysInYearAccurate * 24 / 4,
      minutes: daysInYearAccurate * 24 * 60 / 4,
      seconds: daysInYearAccurate * 24 * 60 * 60 / 4,
      milliseconds: daysInYearAccurate * 24 * 60 * 60 * 1000 / 4
    },
    months: {
      weeks: daysInMonthAccurate / 7,
      days: daysInMonthAccurate,
      hours: daysInMonthAccurate * 24,
      minutes: daysInMonthAccurate * 24 * 60,
      seconds: daysInMonthAccurate * 24 * 60 * 60,
      milliseconds: daysInMonthAccurate * 24 * 60 * 60 * 1000
    }
  }, lowOrderMatrix);
  
  // units ordered by size
  var orderedUnits$1 = ['years', 'quarters', 'months', 'weeks', 'days', 'hours', 'minutes', 'seconds', 'milliseconds'];
  
  var reverseUnits = orderedUnits$1.slice(0).reverse();
  
  // clone really means "create another instance just like this one, but with these changes"
  function clone$1(dur, alts) {
    var clear = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  
    // deep merge for vals
    var conf = {
      values: clear ? alts.values : Object.assign({}, dur.values, alts.values || {}),
      loc: dur.loc.clone(alts.loc),
      conversionAccuracy: alts.conversionAccuracy || dur.conversionAccuracy
    };
    return new Duration(conf);
  }
  
  // some functions really care about the absolute value of a duration, so combined with
  // normalize() this tells us whether this duration is positive or negative
  function isHighOrderNegative(obj) {
    // only rule is that the highest-order part must be non-negative
    for (var _iterator = orderedUnits$1, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
      var _ref;
  
      if (_isArray) {
        if (_i >= _iterator.length) break;
        _ref = _iterator[_i++];
      } else {
        _i = _iterator.next();
        if (_i.done) break;
        _ref = _i.value;
      }
  
      var k = _ref;
  
      if (obj[k]) return obj[k] < 0;
    }
    return false;
  }
  
  // NB: mutates parameters
  function convert(matrix, fromMap, fromUnit, toMap, toUnit) {
    var conv = matrix[toUnit][fromUnit],
        added = Math.floor(fromMap[fromUnit] / conv);
    toMap[toUnit] += added;
    fromMap[fromUnit] -= added * conv;
  }
  
  // NB: mutates parameters
  function normalizeValues(matrix, vals) {
    reverseUnits.reduce(function (previous, current) {
      if (!isUndefined(vals[current])) {
        if (previous) {
          convert(matrix, vals, previous, vals, current);
        }
        return current;
      } else {
        return previous;
      }
    }, null);
  }
  
  /**
   * @private
   */
  function friendlyDuration(duration) {
    if (isNumber(duration)) {
      return Duration.fromMillis(duration);
    } else if (duration instanceof Duration) {
      return duration;
    } else if ((typeof duration === 'undefined' ? 'undefined' : _typeof(duration)) === 'object') {
      return Duration.fromObject(duration);
    } else {
      throw new InvalidArgumentError('Unknown duration argument');
    }
  }
  
  /**
   * A Duration object represents a period of time, like "2 months" or "1 day, 1 hour". Conceptually, it's just a map of units to their quantities, accompanied by some additional configuration and methods for creating, parsing, interrogating, transforming, and formatting them. They can be used on their own or in conjunction with other Luxon types; for example, you can use {@link DateTime.plus} to add a Duration object to a DateTime, producing another DateTime.
   *
   * Here is a brief overview of commonly used methods and getters in Duration:
   *
   * * **Creation** To create a Duration, use {@link Duration.fromMillis}, {@link Duration.fromObject}, or {@link Duration.fromISO}.
   * * **Unit values** See the {@link Duration.years}, {@link Duration.months}, {@link Duration.weeks}, {@link Duration.days}, {@link Duration.hours}, {@link Duration.minutes}, {@link Duration.seconds}, {@link Duration.milliseconds} accessors.
   * * **Configuration** See  {@link Duration.locale} and {@link Duration.numberingSystem} accessors.
   * * **Transformation** To create new Durations out of old ones use {@link Duration.plus}, {@link Duration.minus}, {@link Duration.normalize}, {@link Duration.set}, {@link Duration.reconfigure}, {@link Duration.shiftTo}, and {@link Duration.negate}.
   * * **Output** To convert the Duration into other representations, see {@link Duration.as}, {@link Duration.toISO}, {@link Duration.toFormat}, and {@link Duration.toJSON}
   *
   * There's are more methods documented below. In addition, for more information on subtler topics like internationalization and validity, see the external documentation.
   */
  
  var Duration = function () {
    /**
     * @private
     */
    function Duration(config) {
      classCallCheck(this, Duration);
  
      var accurate = config.conversionAccuracy === 'longterm' || false;
      /**
       * @access private
       */
      this.values = config.values;
      /**
       * @access private
       */
      this.loc = config.loc || Locale.create();
      /**
       * @access private
       */
      this.conversionAccuracy = accurate ? 'longterm' : 'casual';
      /**
       * @access private
       */
      this.invalid = config.invalidReason || null;
      /**
       * @access private
       */
      this.matrix = accurate ? accurateMatrix : casualMatrix;
    }
  
    /**
     * Create Duration from a number of milliseconds.
     * @param {number} count of milliseconds
     * @param {Object} opts - options for parsing
     * @param {string} [opts.locale='en-US'] - the locale to use
     * @param {string} opts.numberingSystem - the numbering system to use
     * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use
     * @return {Duration}
     */
  
  
    Duration.fromMillis = function fromMillis(count, opts) {
      return Duration.fromObject(Object.assign({ milliseconds: count }, opts));
    };
  
    /**
     * Create a Duration from a Javascript object with keys like 'years' and 'hours.
     * If this object is empty then zero  milliseconds duration is returned.
     * @param {Object} obj - the object to create the DateTime from
     * @param {number} obj.years
     * @param {number} obj.quarters
     * @param {number} obj.months
     * @param {number} obj.weeks
     * @param {number} obj.days
     * @param {number} obj.hours
     * @param {number} obj.minutes
     * @param {number} obj.seconds
     * @param {number} obj.milliseconds
     * @param {string} [obj.locale='en-US'] - the locale to use
     * @param {string} obj.numberingSystem - the numbering system to use
     * @param {string} [obj.conversionAccuracy='casual'] - the conversion system to use
     * @return {Duration}
     */
  
  
    Duration.fromObject = function fromObject(obj) {
      if (obj == null || (typeof obj === 'undefined' ? 'undefined' : _typeof(obj)) !== 'object') {
        throw new InvalidArgumentError('Duration.fromObject: argument expected to be an object.');
      }
      return new Duration({
        values: normalizeObject(obj, Duration.normalizeUnit, true),
        loc: Locale.fromObject(obj),
        conversionAccuracy: obj.conversionAccuracy
      });
    };
  
    /**
     * Create a Duration from an ISO 8601 duration string.
     * @param {string} text - text to parse
     * @param {Object} opts - options for parsing
     * @param {string} [opts.locale='en-US'] - the locale to use
     * @param {string} opts.numberingSystem - the numbering system to use
     * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use
     * @see https://en.wikipedia.org/wiki/ISO_8601#Durations
     * @example Duration.fromISO('P3Y6M4DT12H30M5S').toObject() //=> { years: 3, months: 6, day: 4, hours: 12, minutes: 30, seconds: 5 }
     * @example Duration.fromISO('PT23H').toObject() //=> { hours: 23 }
     * @example Duration.fromISO('P5Y3M').toObject() //=> { years: 5, months: 3 }
     * @return {Duration}
     */
  
  
    Duration.fromISO = function fromISO(text, opts) {
      var _parseISODuration = parseISODuration(text),
          parsed = _parseISODuration[0];
  
      if (parsed) {
        var obj = Object.assign(parsed, opts);
        return Duration.fromObject(obj);
      } else {
        return Duration.invalid(UNPARSABLE$1);
      }
    };
  
    /**
     * Create an invalid Duration.
     * @param {string} reason - reason this is invalid
     * @return {Duration}
     */
  
  
    Duration.invalid = function invalid(reason) {
      if (!reason) {
        throw new InvalidArgumentError('need to specify a reason the Duration is invalid');
      }
      if (Settings.throwOnInvalid) {
        throw new InvalidDurationError(reason);
      } else {
        return new Duration({ invalidReason: reason });
      }
    };
  
    /**
     * @private
     */
  
  
    Duration.normalizeUnit = function normalizeUnit(unit) {
      var ignoreUnknown = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  
      var normalized = {
        year: 'years',
        years: 'years',
        quarter: 'quarters',
        quarters: 'quarters',
        month: 'months',
        months: 'months',
        week: 'weeks',
        weeks: 'weeks',
        day: 'days',
        days: 'days',
        hour: 'hours',
        hours: 'hours',
        minute: 'minutes',
        minutes: 'minutes',
        second: 'seconds',
        seconds: 'seconds',
        millisecond: 'milliseconds',
        milliseconds: 'milliseconds'
      }[unit ? unit.toLowerCase() : unit];
  
      if (!ignoreUnknown && !normalized) throw new InvalidUnitError(unit);
  
      return normalized;
    };
  
    /**
     * Get  the locale of a Duration, such 'en-GB'
     * @type {string}
     */
  
  
    /**
     * Returns a string representation of this Duration formatted according to the specified format string. The duration will be converted to the set of units in the format string using {@link Duration.shiftTo} and the Durations's conversion accuracy setting. You may use these tokens:
     * * `S` for milliseconds
     * * `s` for seconds
     * * `m` for minutes
     * * `h` for hours
     * * `d` for days
     * * `M` for months
     * * `y` for years
     * @param {string} fmt - the format string
     * @param {Object} opts - options
     * @param {boolean} [opts.floor=true] - floor numerical values
     * @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toFormat("y d s") //=> "1 6 2"
     * @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toFormat("M S") //=> "12 518402000"
     * @return {string}
     */
    Duration.prototype.toFormat = function toFormat(fmt) {
      var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  
      // reverse-compat since 1.2; we always round down now, never up, and we do it by default. So:
      // 1. always turn off rounding in the underlying formatter
      // 2. turn off flooring if either rounding is turned off or flooring is turned off, otherwise leave it on
      var fmtOpts = Object.assign({}, opts, { floor: true, round: false });
      if (opts.round === false || opts.floor === false) {
        fmtOpts.floor = false;
      }
  
      return this.isValid ? Formatter.create(this.loc, fmtOpts).formatDurationFromString(this, fmt) : INVALID$1;
    };
  
    /**
     * Returns a Javascript object with this Duration's values.
     * @param opts - options for generating the object
     * @param {boolean} [opts.includeConfig=false] - include configuration attributes in the output
     * @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toObject() //=> { years: 1, days: 6, seconds: 2 }
     * @return {Object}
     */
  
  
    Duration.prototype.toObject = function toObject() {
      var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  
      if (!this.isValid) return {};
  
      var base = Object.assign({}, this.values);
  
      if (opts.includeConfig) {
        base.conversionAccuracy = this.conversionAccuracy;
        base.numberingSystem = this.loc.numberingSystem;
        base.locale = this.loc.locale;
      }
      return base;
    };
  
    /**
     * Returns an ISO 8601-compliant string representation of this Duration.
     * @see https://en.wikipedia.org/wiki/ISO_8601#Durations
     * @example Duration.fromObject({ years: 3, seconds: 45 }).toISO() //=> 'P3YT45S'
     * @example Duration.fromObject({ months: 4, seconds: 45 }).toISO() //=> 'P4MT45S'
     * @example Duration.fromObject({ months: 5 }).toISO() //=> 'P5M'
     * @example Duration.fromObject({ minutes: 5 }).toISO() //=> 'PT5M'
     * @example Duration.fromObject({ milliseconds: 6 }).toISO() //=> 'PT0.006S'
     * @return {string}
     */
  
  
    Duration.prototype.toISO = function toISO() {
      // we could use the formatter, but this is an easier way to get the minimum string
      if (!this.isValid) return null;
  
      var s = 'P',
          norm = this.normalize();
  
      // ISO durations are always positive, so take the absolute value
      norm = isHighOrderNegative(norm.values) ? norm.negate() : norm;
  
      if (norm.years > 0) s += norm.years + 'Y';
      if (norm.months > 0 || norm.quarters > 0) s += norm.months + norm.quarters * 3 + 'M';
      if (norm.days > 0 || norm.weeks > 0) s += norm.days + norm.weeks * 7 + 'D';
      if (norm.hours > 0 || norm.minutes > 0 || norm.seconds > 0 || norm.milliseconds > 0) s += 'T';
      if (norm.hours > 0) s += norm.hours + 'H';
      if (norm.minutes > 0) s += norm.minutes + 'M';
      if (norm.seconds > 0 || norm.milliseconds > 0) s += norm.seconds + norm.milliseconds / 1000 + 'S';
      return s;
    };
  
    /**
     * Returns an ISO 8601 representation of this Duration appropriate for use in JSON.
     * @return {string}
     */
  
  
    Duration.prototype.toJSON = function toJSON() {
      return this.toISO();
    };
  
    /**
     * Returns an ISO 8601 representation of this Duration appropriate for use in debugging.
     * @return {string}
     */
  
  
    Duration.prototype.toString = function toString() {
      return this.toISO();
    };
  
    /**
     * Returns an milliseconds value of this Duration.
     * @return {number}
     */
  
  
    Duration.prototype.valueOf = function valueOf() {
      return this.as('milliseconds');
    };
  
    /**
     * Returns a string representation of this Duration appropriate for the REPL.
     * @return {string}
     */
  
  
    Duration.prototype[customInspectSymbol] = function () {
      if (this.isValid) {
        var valsInspect = JSON.stringify(this.toObject());
        return 'Duration {\n  values: ' + valsInspect + ',\n  locale: ' + this.locale + ',\n  conversionAccuracy: ' + this.conversionAccuracy + ' }';
      } else {
        return 'Duration { Invalid, reason: ' + this.invalidReason + ' }';
      }
    };
  
    /**
     * Make this Duration longer by the specified amount. Return a newly-constructed Duration.
     * @param {Duration|Object|number} duration - The amount to add. Either a Luxon Duration, a number of milliseconds, the object argument to Duration.fromObject()
     * @return {Duration}
     */
  
  
    Duration.prototype.plus = function plus(duration) {
      if (!this.isValid) return this;
  
      var dur = friendlyDuration(duration),
          result = {};
  
      for (var _iterator2 = orderedUnits$1, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) {
        var _ref2;
  
        if (_isArray2) {
          if (_i2 >= _iterator2.length) break;
          _ref2 = _iterator2[_i2++];
        } else {
          _i2 = _iterator2.next();
          if (_i2.done) break;
          _ref2 = _i2.value;
        }
  
        var k = _ref2;
  
        var val = dur.get(k) + this.get(k);
        if (val !== 0) {
          result[k] = val;
        }
      }
  
      return clone$1(this, { values: result }, true);
    };
  
    /**
     * Make this Duration shorter by the specified amount. Return a newly-constructed Duration.
     * @param {Duration|Object|number} duration - The amount to subtract. Either a Luxon Duration, a number of milliseconds, the object argument to Duration.fromObject()
     * @return {Duration}
     */
  
  
    Duration.prototype.minus = function minus(duration) {
      if (!this.isValid) return this;
  
      var dur = friendlyDuration(duration);
      return this.plus(dur.negate());
    };
  
    /**
     * Get the value of unit.
     * @param {string} unit - a unit such as 'minute' or 'day'
     * @example Duration.fromObject({years: 2, days: 3}).years //=> 2
     * @example Duration.fromObject({years: 2, days: 3}).months //=> 0
     * @example Duration.fromObject({years: 2, days: 3}).days //=> 3
     * @return {number}
     */
  
  
    Duration.prototype.get = function get$$1(unit) {
      return this[Duration.normalizeUnit(unit)];
    };
  
    /**
     * "Set" the values of specified units. Return a newly-constructed Duration.
     * @param {Object} values - a mapping of units to numbers
     * @example dur.set({ years: 2017 })
     * @example dur.set({ hours: 8, minutes: 30 })
     * @return {Duration}
     */
  
  
    Duration.prototype.set = function set$$1(values) {
      var mixed = Object.assign(this.values, normalizeObject(values, Duration.normalizeUnit));
      return clone$1(this, { values: mixed });
    };
  
    /**
     * "Set" the locale and/or numberingSystem.  Returns a newly-constructed Duration.
     * @example dur.reconfigure({ locale: 'en-GB' })
     * @return {Duration}
     */
  
  
    Duration.prototype.reconfigure = function reconfigure() {
      var _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
          locale = _ref3.locale,
          numberingSystem = _ref3.numberingSystem,
          conversionAccuracy = _ref3.conversionAccuracy;
  
      var loc = this.loc.clone({ locale: locale, numberingSystem: numberingSystem }),
          opts = { loc: loc };
  
      if (conversionAccuracy) {
        opts.conversionAccuracy = conversionAccuracy;
      }
  
      return clone$1(this, opts);
    };
  
    /**
     * Return the length of the duration in the specified unit.
     * @param {string} unit - a unit such as 'minutes' or 'days'
     * @example Duration.fromObject({years: 1}).as('days') //=> 365
     * @example Duration.fromObject({years: 1}).as('months') //=> 12
     * @example Duration.fromObject({hours: 60}).as('days') //=> 2.5
     * @return {number}
     */
  
  
    Duration.prototype.as = function as(unit) {
      return this.isValid ? this.shiftTo(unit).get(unit) : NaN;
    };
  
    /**
     * Reduce this Duration to its canonical representation in its current units.
     * @example Duration.fromObject({ years: 2, days: 5000 }).normalize().toObject() //=> { years: 15, days: 255 }
     * @example Duration.fromObject({ hours: 12, minutes: -45 }).normalize().toObject() //=> { hours: 11, minutes: 15 }
     * @return {Duration}
     */
  
  
    Duration.prototype.normalize = function normalize() {
      if (!this.isValid) return this;
  
      var neg = isHighOrderNegative(this.values),
          vals = (neg ? this.negate() : this).toObject();
      normalizeValues(this.matrix, vals);
      var dur = Duration.fromObject(vals);
      return neg ? dur.negate() : dur;
    };
  
    /**
     * Convert this Duration into its representation in a different set of units.
     * @example Duration.fromObject({ hours: 1, seconds: 30 }).shiftTo('minutes', 'milliseconds').toObject() //=> { minutes: 60, milliseconds: 30000 }
     * @return {Duration}
     */
  
  
    Duration.prototype.shiftTo = function shiftTo() {
      for (var _len = arguments.length, units = Array(_len), _key = 0; _key < _len; _key++) {
        units[_key] = arguments[_key];
      }
  
      if (!this.isValid) return this;
  
      if (units.length === 0) {
        return this;
      }
  
      units = units.map(function (u) {
        return Duration.normalizeUnit(u);
      });
  
      var built = {},
          accumulated = {},
          vals = this.toObject();
      var lastUnit = void 0;
  
      normalizeValues(this.matrix, vals);
  
      for (var _iterator3 = orderedUnits$1, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : _iterator3[Symbol.iterator]();;) {
        var _ref4;
  
        if (_isArray3) {
          if (_i3 >= _iterator3.length) break;
          _ref4 = _iterator3[_i3++];
        } else {
          _i3 = _iterator3.next();
          if (_i3.done) break;
          _ref4 = _i3.value;
        }
  
        var k = _ref4;
  
        if (units.indexOf(k) >= 0) {
          lastUnit = k;
  
          var own = 0;
  
          // anything we haven't boiled down yet should get boiled to this unit
          for (var ak in accumulated) {
            if (accumulated.hasOwnProperty(ak)) {
              own += this.matrix[ak][k] * accumulated[ak];
              accumulated[ak] = 0;
            }
          }
  
          // plus anything that's already in this unit
          if (isNumber(vals[k])) {
            own += vals[k];
          }
  
          var i = Math.trunc(own);
          built[k] = i;
          accumulated[k] = own - i;
  
          // plus anything further down the chain that should be rolled up in to this
          for (var down in vals) {
            if (orderedUnits$1.indexOf(down) > orderedUnits$1.indexOf(k)) {
              convert(this.matrix, vals, down, built, k);
            }
          }
          // otherwise, keep it in the wings to boil it later
        } else if (isNumber(vals[k])) {
          accumulated[k] = vals[k];
        }
      }
  
      // anything leftover becomes the decimal for the last unit
      if (lastUnit) {
        for (var key in accumulated) {
          if (accumulated.hasOwnProperty(key)) {
            if (accumulated[key] > 0) {
              built[lastUnit] += key === lastUnit ? accumulated[key] : accumulated[key] / this.matrix[lastUnit][key];
            }
          }
        }
      }
      return clone$1(this, { values: built }, true);
    };
  
    /**
     * Return the negative of this Duration.
     * @example Duration.fromObject({ hours: 1, seconds: 30 }).negate().toObject() //=> { hours: -1, seconds: -30 }
     * @return {Duration}
     */
  
  
    Duration.prototype.negate = function negate() {
      if (!this.isValid) return this;
      var negated = {};
      for (var _iterator4 = Object.keys(this.values), _isArray4 = Array.isArray(_iterator4), _i4 = 0, _iterator4 = _isArray4 ? _iterator4 : _iterator4[Symbol.iterator]();;) {
        var _ref5;
  
        if (_isArray4) {
          if (_i4 >= _iterator4.length) break;
          _ref5 = _iterator4[_i4++];
        } else {
          _i4 = _iterator4.next();
          if (_i4.done) break;
          _ref5 = _i4.value;
        }
  
        var k = _ref5;
  
        negated[k] = -this.values[k];
      }
      return clone$1(this, { values: negated }, true);
    };
  
    /**
     * Get the years.
     * @type {number}
     */
  
  
    /**
     * Equality check
     * Two Durations are equal iff they have the same units and the same values for each unit.
     * @param {Duration} other
     * @return {boolean}
     */
    Duration.prototype.equals = function equals(other) {
      if (!this.isValid || !other.isValid) {
        return false;
      }
  
      if (!this.loc.equals(other.loc)) {
        return false;
      }
  
      for (var _iterator5 = orderedUnits$1, _isArray5 = Array.isArray(_iterator5), _i5 = 0, _iterator5 = _isArray5 ? _iterator5 : _iterator5[Symbol.iterator]();;) {
        var _ref6;
  
        if (_isArray5) {
          if (_i5 >= _iterator5.length) break;
          _ref6 = _iterator5[_i5++];
        } else {
          _i5 = _iterator5.next();
          if (_i5.done) break;
          _ref6 = _i5.value;
        }
  
        var u = _ref6;
  
        if (this.values[u] !== other.values[u]) {
          return false;
        }
      }
      return true;
    };
  
    createClass(Duration, [{
      key: 'locale',
      get: function get$$1() {
        return this.isValid ? this.loc.locale : null;
      }
  
      /**
       * Get the numbering system of a Duration, such 'beng'. The numbering system is used when formatting the Duration
       *
       * @type {string}
       */
  
    }, {
      key: 'numberingSystem',
      get: function get$$1() {
        return this.isValid ? this.loc.numberingSystem : null;
      }
    }, {
      key: 'years',
      get: function get$$1() {
        return this.isValid ? this.values.years || 0 : NaN;
      }
  
      /**
       * Get the quarters.
       * @type {number}
       */
  
    }, {
      key: 'quarters',
      get: function get$$1() {
        return this.isValid ? this.values.quarters || 0 : NaN;
      }
  
      /**
       * Get the months.
       * @type {number}
       */
  
    }, {
      key: 'months',
      get: function get$$1() {
        return this.isValid ? this.values.months || 0 : NaN;
      }
  
      /**
       * Get the weeks
       * @type {number}
       */
  
    }, {
      key: 'weeks',
      get: function get$$1() {
        return this.isValid ? this.values.weeks || 0 : NaN;
      }
  
      /**
       * Get the days.
       * @type {number}
       */
  
    }, {
      key: 'days',
      get: function get$$1() {
        return this.isValid ? this.values.days || 0 : NaN;
      }
  
      /**
       * Get the hours.
       * @type {number}
       */
  
    }, {
      key: 'hours',
      get: function get$$1() {
        return this.isValid ? this.values.hours || 0 : NaN;
      }
  
      /**
       * Get the minutes.
       * @type {number}
       */
  
    }, {
      key: 'minutes',
      get: function get$$1() {
        return this.isValid ? this.values.minutes || 0 : NaN;
      }
  
      /**
       * Get the seconds.
       * @return {number}
       */
  
    }, {
      key: 'seconds',
      get: function get$$1() {
        return this.isValid ? this.values.seconds || 0 : NaN;
      }
  
      /**
       * Get the milliseconds.
       * @return {number}
       */
  
    }, {
      key: 'milliseconds',
      get: function get$$1() {
        return this.isValid ? this.values.milliseconds || 0 : NaN;
      }
  
      /**
       * Returns whether the Duration is invalid. Invalid durations are returned by diff operations
       * on invalid DateTimes or Intervals.
       * @return {boolean}
       */
  
    }, {
      key: 'isValid',
      get: function get$$1() {
        return this.invalidReason === null;
      }
  
      /**
       * Returns an explanation of why this Duration became invalid, or null if the Duration is valid
       * @return {string}
       */
  
    }, {
      key: 'invalidReason',
      get: function get$$1() {
        return this.invalid;
      }
    }]);
    return Duration;
  }();
  
  var INVALID$2 = 'Invalid Interval';
  
  // checks if the start is equal to or before the end
  function validateStartEnd(start, end) {
    return !!start && !!end && start.isValid && end.isValid && start <= end;
  }
  
  /**
   * An Interval object represents a half-open interval of time, where each endpoint is a {@link DateTime}. Conceptually, it's a container for those two endpoints, accompanied by methods for creating, parsing, interrogating, comparing, transforming, and formatting them.
   *
   * Here is a brief overview of the most commonly used methods and getters in Interval:
   *
   * * **Creation** To create an Interval, use {@link fromDateTimes}, {@link after}, {@link before}, or {@link fromISO}.
   * * **Accessors** Use {@link start} and {@link end} to get the start and end.
   * * **Interrogation** To analyze the Interval, use {@link count}, {@link length}, {@link hasSame}, {@link contains}, {@link isAfter}, or {@link isBefore}.
   * * **Transformation** To create other Intervals out of this one, use {@link set}, {@link splitAt}, {@link splitBy}, {@link divideEqually}, {@link merge}, {@link xor}, {@link union}, {@link intersection}, or {@link difference}.
   * * **Comparison** To compare this Interval to another one, use {@link equals}, {@link overlaps}, {@link abutsStart}, {@link abutsEnd}, {@link engulfs}
   * * **Output*** To convert the Interval into other representations, see {@link toString}, {@link toISO}, {@link toFormat}, and {@link toDuration}.
   */
  
  var Interval = function () {
    /**
     * @private
     */
    function Interval(config) {
      classCallCheck(this, Interval);
  
      /**
       * @access private
       */
      this.s = config.start;
      /**
       * @access private
       */
      this.e = config.end;
      /**
       * @access private
       */
      this.invalid = config.invalidReason || null;
    }
  
    /**
     * Create an invalid Interval.
     * @return {Interval}
     */
  
  
    Interval.invalid = function invalid(reason) {
      if (!reason) {
        throw new InvalidArgumentError('need to specify a reason the DateTime is invalid');
      }
      if (Settings.throwOnInvalid) {
        throw new InvalidIntervalError(reason);
      } else {
        return new Interval({ invalidReason: reason });
      }
    };
  
    /**
     * Create an Interval from a start DateTime and an end DateTime. Inclusive of the start but not the end.
     * @param {DateTime|Date|Object} start
     * @param {DateTime|Date|Object} end
     * @return {Interval}
     */
  
  
    Interval.fromDateTimes = function fromDateTimes(start, end) {
      var builtStart = friendlyDateTime(start),
          builtEnd = friendlyDateTime(end);
  
      return new Interval({
        start: builtStart,
        end: builtEnd,
        invalidReason: validateStartEnd(builtStart, builtEnd) ? null : 'invalid endpoints'
      });
    };
  
    /**
     * Create an Interval from a start DateTime and a Duration to extend to.
     * @param {DateTime|Date|Object} start
     * @param {Duration|Object|number} duration - the length of the Interval.
     * @return {Interval}
     */
  
  
    Interval.after = function after(start, duration) {
      var dur = friendlyDuration(duration),
          dt = friendlyDateTime(start);
      return Interval.fromDateTimes(dt, dt.plus(dur));
    };
  
    /**
     * Create an Interval from an end DateTime and a Duration to extend backwards to.
     * @param {DateTime|Date|Object} end
     * @param {Duration|Object|number} duration - the length of the Interval.
     * @return {Interval}
     */
  
  
    Interval.before = function before(end, duration) {
      var dur = friendlyDuration(duration),
          dt = friendlyDateTime(end);
      return Interval.fromDateTimes(dt.minus(dur), dt);
    };
  
    /**
     * Create an Interval from an ISO 8601 string
     * @param {string} string - the ISO string to parse
     * @param {Object} opts - options to pass {@see DateTime.fromISO}
     * @return {Interval}
     */
  
  
    Interval.fromISO = function fromISO(string, opts) {
      if (string) {
        var _string$split = string.split(/\//),
            s = _string$split[0],
            e = _string$split[1];
  
        if (s && e) {
          return Interval.fromDateTimes(DateTime.fromISO(s, opts), DateTime.fromISO(e, opts));
        }
      }
      return Interval.invalid('invalid ISO format');
    };
  
    /**
     * Returns the start of the Interval
     * @type {DateTime}
     */
  
  
    /**
     * Returns the length of the Interval in the specified unit.
     * @param {string} unit - the unit (such as 'hours' or 'days') to return the length in.
     * @return {number}
     */
    Interval.prototype.length = function length() {
      var unit = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'milliseconds';
  
      return this.isValid ? this.toDuration.apply(this, [unit]).get(unit) : NaN;
    };
  
    /**
     * Returns the count of minutes, hours, days, months, or years included in the Interval, even in part.
     * Unlike {@link length} this counts sections of the calendar, not periods of time, e.g. specifying 'day'
     * asks 'what dates are included in this interval?', not 'how many days long is this interval?'
     * @param {string} [unit='milliseconds'] - the unit of time to count.
     * @return {number}
     */
  
  
    Interval.prototype.count = function count() {
      var unit = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'milliseconds';
  
      if (!this.isValid) return NaN;
      var start = this.start.startOf(unit),
          end = this.end.startOf(unit);
      return Math.floor(end.diff(start, unit).get(unit)) + 1;
    };
  
    /**
     * Returns whether this Interval's start and end are both in the same unit of time
     * @param {string} unit - the unit of time to check sameness on
     * @return {boolean}
     */
  
  
    Interval.prototype.hasSame = function hasSame(unit) {
      return this.isValid ? this.e.minus(1).hasSame(this.s, unit) : false;
    };
  
    /**
     * Return whether this Interval has the same start and end DateTimes.
     * @return {boolean}
     */
  
  
    Interval.prototype.isEmpty = function isEmpty() {
      return this.s.valueOf() === this.e.valueOf();
    };
  
    /**
     * Return whether this Interval's start is after the specified DateTime.
     * @param {DateTime} dateTime
     * @return {boolean}
     */
  
  
    Interval.prototype.isAfter = function isAfter(dateTime) {
      if (!this.isValid) return false;
      return this.s > dateTime;
    };
  
    /**
     * Return whether this Interval's end is before the specified DateTime.
     * @param {DateTime} dateTime
     * @return {boolean}
     */
  
  
    Interval.prototype.isBefore = function isBefore(dateTime) {
      if (!this.isValid) return false;
      return this.e <= dateTime;
    };
  
    /**
     * Return whether this Interval contains the specified DateTime.
     * @param {DateTime} dateTime
     * @return {boolean}
     */
  
  
    Interval.prototype.contains = function contains(dateTime) {
      if (!this.isValid) return false;
      return this.s <= dateTime && this.e > dateTime;
    };
  
    /**
     * "Sets" the start and/or end dates. Returns a newly-constructed Interval.
     * @param {Object} values - the values to set
     * @param {DateTime} values.start - the starting DateTime
     * @param {DateTime} values.end - the ending DateTime
     * @return {Interval}
     */
  
  
    Interval.prototype.set = function set$$1() {
      var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
          start = _ref.start,
          end = _ref.end;
  
      if (!this.isValid) return this;
      return Interval.fromDateTimes(start || this.s, end || this.e);
    };
  
    /**
     * Split this Interval at each of the specified DateTimes
     * @param {...[DateTime]} dateTimes - the unit of time to count.
     * @return {[Interval]}
     */
  
  
    Interval.prototype.splitAt = function splitAt() {
      if (!this.isValid) return [];
  
      for (var _len = arguments.length, dateTimes = Array(_len), _key = 0; _key < _len; _key++) {
        dateTimes[_key] = arguments[_key];
      }
  
      var sorted = dateTimes.map(friendlyDateTime).sort(),
          results = [];
      var s = this.s,
          i = 0;
  
  
      while (s < this.e) {
        var added = sorted[i] || this.e,
            next = +added > +this.e ? this.e : added;
        results.push(Interval.fromDateTimes(s, next));
        s = next;
        i += 1;
      }
  
      return results;
    };
  
    /**
     * Split this Interval into smaller Intervals, each of the specified length.
     * Left over time is grouped into a smaller interval
     * @param {Duration|Object|number} duration - The length of each resulting interval.
     * @return {[Interval]}
     */
  
  
    Interval.prototype.splitBy = function splitBy(duration) {
      var dur = friendlyDuration(duration);
  
      if (!this.isValid || !dur.isValid || dur.as('milliseconds') === 0) {
        return [];
      }
  
      var s = this.s,
          added = void 0,
          next = void 0;
  
  
      var results = [];
      while (s < this.e) {
        added = s.plus(dur);
        next = +added > +this.e ? this.e : added;
        results.push(Interval.fromDateTimes(s, next));
        s = next;
      }
  
      return results;
    };
  
    /**
     * Split this Interval into the specified number of smaller intervals.
     * @param {number} numberOfParts - The number of Intervals to divide the Interval into.
     * @return {[Interval]}
     */
  
  
    Interval.prototype.divideEqually = function divideEqually(numberOfParts) {
      if (!this.isValid) return [];
      return this.splitBy(this.length() / numberOfParts).slice(0, numberOfParts);
    };
  
    /**
     * Return whether this Interval overlaps with the specified Interval
     * @param {Interval} other
     * @return {boolean}
     */
  
  
    Interval.prototype.overlaps = function overlaps(other) {
      return this.e > other.s && this.s < other.e;
    };
  
    /**
     * Return whether this Interval's end is adjacent to the specified Interval's start.
     * @param {Interval} other
     * @return {boolean}
     */
  
  
    Interval.prototype.abutsStart = function abutsStart(other) {
      if (!this.isValid) return false;
      return +this.e === +other.s;
    };
  
    /**
     * Return whether this Interval's start is adjacent to the specified Interval's end.
     * @param {Interval} other
     * @return {boolean}
     */
  
  
    Interval.prototype.abutsEnd = function abutsEnd(other) {
      if (!this.isValid) return false;
      return +other.e === +this.s;
    };
  
    /**
     * Return whether this Interval engulfs the start and end of the specified Interval.
     * @param {Interval} other
     * @return {boolean}
     */
  
  
    Interval.prototype.engulfs = function engulfs(other) {
      if (!this.isValid) return false;
      return this.s <= other.s && this.e >= other.e;
    };
  
    /**
     * Return whether this Interval has the same start and end as the specified Interval.
     * @param {Interval} other
     * @return {boolean}
     */
  
  
    Interval.prototype.equals = function equals(other) {
      if (!this.isValid || !other.isValid) {
        return false;
      }
  
      return this.s.equals(other.s) && this.e.equals(other.e);
    };
  
    /**
     * Return an Interval representing the intersection of this Interval and the specified Interval.
     * Specifically, the resulting Interval has the maximum start time and the minimum end time of the two Intervals.
     * Returns null if the intersection is empty, i.e., the intervals don't intersect.
     * @param {Interval} other
     * @return {Interval}
     */
  
  
    Interval.prototype.intersection = function intersection(other) {
      if (!this.isValid) return this;
      var s = this.s > other.s ? this.s : other.s,
          e = this.e < other.e ? this.e : other.e;
  
      if (s > e) {
        return null;
      } else {
        return Interval.fromDateTimes(s, e);
      }
    };
  
    /**
     * Return an Interval representing the union of this Interval and the specified Interval.
     * Specifically, the resulting Interval has the minimum start time and the maximum end time of the two Intervals.
     * @param {Interval} other
     * @return {Interval}
     */
  
  
    Interval.prototype.union = function union(other) {
      if (!this.isValid) return this;
      var s = this.s < other.s ? this.s : other.s,
          e = this.e > other.e ? this.e : other.e;
      return Interval.fromDateTimes(s, e);
    };
  
    /**
     * Merge an array of Intervals into a equivalent minimal set of Intervals.
     * Combines overlapping and adjacent Intervals.
     * @param {[Interval]} intervals
     * @return {[Interval]}
     */
  
  
    Interval.merge = function merge(intervals) {
      var _intervals$sort$reduc = intervals.sort(function (a, b) {
        return a.s - b.s;
      }).reduce(function (_ref2, item) {
        var sofar = _ref2[0],
            current = _ref2[1];
  
        if (!current) {
          return [sofar, item];
        } else if (current.overlaps(item) || current.abutsStart(item)) {
          return [sofar, current.union(item)];
        } else {
          return [sofar.concat([current]), item];
        }
      }, [[], null]),
          found = _intervals$sort$reduc[0],
          final = _intervals$sort$reduc[1];
  
      if (final) {
        found.push(final);
      }
      return found;
    };
  
    /**
     * Return an array of Intervals representing the spans of time that only appear in one of the specified Intervals.
     * @param {[Interval]} intervals
     * @return {[Interval]}
     */
  
  
    Interval.xor = function xor(intervals) {
      var _Array$prototype;
  
      var start = null,
          currentCount = 0;
      var results = [],
          ends = intervals.map(function (i) {
        return [{ time: i.s, type: 's' }, { time: i.e, type: 'e' }];
      }),
          flattened = (_Array$prototype = Array.prototype).concat.apply(_Array$prototype, ends),
          arr = flattened.sort(function (a, b) {
        return a.time - b.time;
      });
  
      for (var _iterator = arr, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
        var _ref3;
  
        if (_isArray) {
          if (_i >= _iterator.length) break;
          _ref3 = _iterator[_i++];
        } else {
          _i = _iterator.next();
          if (_i.done) break;
          _ref3 = _i.value;
        }
  
        var i = _ref3;
  
        currentCount += i.type === 's' ? 1 : -1;
  
        if (currentCount === 1) {
          start = i.time;
        } else {
          if (start && +start !== +i.time) {
            results.push(Interval.fromDateTimes(start, i.time));
          }
  
          start = null;
        }
      }
  
      return Interval.merge(results);
    };
  
    /**
     * Return an Interval representing the span of time in this Interval that doesn't overlap with any of the specified Intervals.
     * @param {...Interval} intervals
     * @return {[Interval]}
     */
  
  
    Interval.prototype.difference = function difference() {
      var _this = this;
  
      for (var _len2 = arguments.length, intervals = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
        intervals[_key2] = arguments[_key2];
      }
  
      return Interval.xor([this].concat(intervals)).map(function (i) {
        return _this.intersection(i);
      }).filter(function (i) {
        return i && !i.isEmpty();
      });
    };
  
    /**
     * Returns a string representation of this Interval appropriate for debugging.
     * @return {string}
     */
  
  
    Interval.prototype.toString = function toString() {
      if (!this.isValid) return INVALID$2;
      return '[' + this.s.toISO() + ' \u2013 ' + this.e.toISO() + ')';
    };
  
    /**
     * Returns a string representation of this Interval appropriate for the REPL.
     * @return {string}
     */
  
  
    Interval.prototype[customInspectSymbol] = function () {
      if (this.isValid) {
        return 'Interval {\n  start: ' + this.start.toISO() + ',\n  end: ' + this.end.toISO() + ',\n  zone:   ' + this.start.zone.name + ',\n  locale:   ' + this.start.locale + ' }';
      } else {
        return 'Interval { Invalid, reason: ' + this.invalidReason + ' }';
      }
    };
  
    /**
     * Returns an ISO 8601-compliant string representation of this Interval.
     * @see https://en.wikipedia.org/wiki/ISO_8601#Time_intervals
     * @param {Object} opts - The same options as {@link DateTime.toISO}
     * @return {string}
     */
  
  
    Interval.prototype.toISO = function toISO(opts) {
      if (!this.isValid) return INVALID$2;
      return this.s.toISO(opts) + '/' + this.e.toISO(opts);
    };
  
    /**
     * Returns a string representation of this Interval formatted according to the specified format string.
     * @param {string} dateFormat - the format string. This string formats the start and end time. See {@link DateTime.toFormat} for details.
     * @param {Object} opts - options
     * @param {string} [opts.separator =  ' – '] - a separator to place between the start and end representations
     * @return {string}
     */
  
  
    Interval.prototype.toFormat = function toFormat(dateFormat) {
      var _ref4 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
          _ref4$separator = _ref4.separator,
          separator = _ref4$separator === undefined ? ' – ' : _ref4$separator;
  
      if (!this.isValid) return INVALID$2;
      return '' + this.s.toFormat(dateFormat) + separator + this.e.toFormat(dateFormat);
    };
  
    /**
     * Return a Duration representing the time spanned by this interval.
     * @param {string|string[]} [unit=['milliseconds']] - the unit or units (such as 'hours' or 'days') to include in the duration.
     * @param {Object} opts - options that affect the creation of the Duration
     * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use
     * @example Interval.fromDateTimes(dt1, dt2).toDuration().toObject() //=> { milliseconds: 88489257 }
     * @example Interval.fromDateTimes(dt1, dt2).toDuration('days').toObject() //=> { days: 1.0241812152777778 }
     * @example Interval.fromDateTimes(dt1, dt2).toDuration(['hours', 'minutes']).toObject() //=> { hours: 24, minutes: 34.82095 }
     * @example Interval.fromDateTimes(dt1, dt2).toDuration(['hours', 'minutes', 'seconds']).toObject() //=> { hours: 24, minutes: 34, seconds: 49.257 }
     * @example Interval.fromDateTimes(dt1, dt2).toDuration('seconds').toObject() //=> { seconds: 88489.257 }
     * @return {Duration}
     */
  
  
    Interval.prototype.toDuration = function toDuration(unit, opts) {
      if (!this.isValid) {
        return Duration.invalid(this.invalidReason);
      }
      return this.e.diff(this.s, unit, opts);
    };
  
    createClass(Interval, [{
      key: 'start',
      get: function get$$1() {
        return this.isValid ? this.s : null;
      }
  
      /**
       * Returns the end of the Interval
       * @type {DateTime}
       */
  
    }, {
      key: 'end',
      get: function get$$1() {
        return this.isValid ? this.e : null;
      }
  
      /**
       * Returns whether this Interval's end is at least its start, i.e. that the Interval isn't 'backwards'.
       * @type {boolean}
       */
  
    }, {
      key: 'isValid',
      get: function get$$1() {
        return this.invalidReason === null;
      }
  
      /**
       * Returns an explanation of why this Interval became invalid, or null if the Interval is valid
       * @type {string}
       */
  
    }, {
      key: 'invalidReason',
      get: function get$$1() {
        return this.invalid;
      }
    }]);
    return Interval;
  }();
  
  /**
   * The Info class contains static methods for retrieving general time and date related data. For example, it has methods for finding out if a time zone has a DST, for listing the months in any supported locale, and for discovering which of Luxon features are available in the current environment.
   */
  
  var Info = function () {
    function Info() {
      classCallCheck(this, Info);
    }
  
    /**
     * Return whether the specified zone contains a DST.
     * @param {string|Zone} [zone='local'] - Zone to check. Defaults to the environment's local zone.
     * @return {boolean}
     */
    Info.hasDST = function hasDST() {
      var zone = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : Settings.defaultZone;
  
      var proto = DateTime.local().setZone(zone).set({ month: 12 });
  
      return !zone.universal && proto.offset !== proto.set({ month: 6 }).offset;
    };
  
    /**
     * Return whether the specified zone is a valid IANA specifier.
     * @param {string} zone - Zone to check
     * @return {boolean}
     */
  
  
    Info.isValidIANAZone = function isValidIANAZone(zone) {
      return !!IANAZone.isValidSpecifier(zone) && IANAZone.isValidZone(zone);
    };
  
    /**
     * Return an array of standalone month names.
     * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat
     * @param {string} [length='long'] - the length of the month representation, such as "numeric", "2-digit", "narrow", "short", "long"
     * @param {Object} opts - options
     * @param {string} [opts.locale] - the locale code
     * @param {string} [opts.numberingSystem=null] - the numbering system
     * @param {string} [opts.outputCalendar='gregory'] - the calendar
     * @example Info.months()[0] //=> 'January'
     * @example Info.months('short')[0] //=> 'Jan'
     * @example Info.months('numeric')[0] //=> '1'
     * @example Info.months('short', { locale: 'fr-CA' } )[0] //=> 'janv.'
     * @example Info.months('numeric', { locale: 'ar' })[0] //=> '١'
     * @example Info.months('long', { outputCalendar: 'islamic' })[0] //=> 'Rabiʻ I'
     * @return {[string]}
     */
  
  
    Info.months = function months() {
      var length = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'long';
  
      var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
          _ref$locale = _ref.locale,
          locale = _ref$locale === undefined ? null : _ref$locale,
          _ref$numberingSystem = _ref.numberingSystem,
          numberingSystem = _ref$numberingSystem === undefined ? null : _ref$numberingSystem,
          _ref$outputCalendar = _ref.outputCalendar,
          outputCalendar = _ref$outputCalendar === undefined ? 'gregory' : _ref$outputCalendar;
  
      return Locale.create(locale, numberingSystem, outputCalendar).months(length);
    };
  
    /**
     * Return an array of format month names.
     * Format months differ from standalone months in that they're meant to appear next to the day of the month. In some languages, that
     * changes the string.
     * See {@link months}
     * @param {string} [length='long'] - the length of the month representation, such as "numeric", "2-digit", "narrow", "short", "long"
     * @param {Object} opts - options
     * @param {string} [opts.locale] - the locale code
     * @param {string} [opts.numberingSystem=null] - the numbering system
     * @param {string} [opts.outputCalendar='gregory'] - the calendar
     * @return {[string]}
     */
  
  
    Info.monthsFormat = function monthsFormat() {
      var length = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'long';
  
      var _ref2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
          _ref2$locale = _ref2.locale,
          locale = _ref2$locale === undefined ? null : _ref2$locale,
          _ref2$numberingSystem = _ref2.numberingSystem,
          numberingSystem = _ref2$numberingSystem === undefined ? null : _ref2$numberingSystem,
          _ref2$outputCalendar = _ref2.outputCalendar,
          outputCalendar = _ref2$outputCalendar === undefined ? 'gregory' : _ref2$outputCalendar;
  
      return Locale.create(locale, numberingSystem, outputCalendar).months(length, true);
    };
  
    /**
     * Return an array of standalone week names.
     * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat
     * @param {string} [length='long'] - the length of the month representation, such as "narrow", "short", "long".
     * @param {Object} opts - options
     * @param {string} [opts.locale] - the locale code
     * @param {string} [opts.numberingSystem=null] - the numbering system
     * @example Info.weekdays()[0] //=> 'Monday'
     * @example Info.weekdays('short')[0] //=> 'Mon'
     * @example Info.weekdays('short', { locale: 'fr-CA' })[0] //=> 'lun.'
     * @example Info.weekdays('short', { locale: 'ar' })[0] //=> 'الاثنين'
     * @return {[string]}
     */
  
  
    Info.weekdays = function weekdays() {
      var length = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'long';
  
      var _ref3 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
          _ref3$locale = _ref3.locale,
          locale = _ref3$locale === undefined ? null : _ref3$locale,
          _ref3$numberingSystem = _ref3.numberingSystem,
          numberingSystem = _ref3$numberingSystem === undefined ? null : _ref3$numberingSystem;
  
      return Locale.create(locale, numberingSystem, null).weekdays(length);
    };
  
    /**
     * Return an array of format week names.
     * Format weekdays differ from standalone weekdays in that they're meant to appear next to more date information. In some languages, that
     * changes the string.
     * See {@link weekdays}
     * @param {string} [length='long'] - the length of the month representation, such as "narrow", "short", "long".
     * @param {Object} opts - options
     * @param {string} [opts.locale=null] - the locale code
     * @param {string} [opts.numberingSystem=null] - the numbering system
     * @return {[string]}
     */
  
  
    Info.weekdaysFormat = function weekdaysFormat() {
      var length = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'long';
  
      var _ref4 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
          _ref4$locale = _ref4.locale,
          locale = _ref4$locale === undefined ? null : _ref4$locale,
          _ref4$numberingSystem = _ref4.numberingSystem,
          numberingSystem = _ref4$numberingSystem === undefined ? null : _ref4$numberingSystem;
  
      return Locale.create(locale, numberingSystem, null).weekdays(length, true);
    };
  
    /**
     * Return an array of meridiems.
     * @param {Object} opts - options
     * @param {string} [opts.locale] - the locale code
     * @example Info.meridiems() //=> [ 'AM', 'PM' ]
     * @example Info.meridiems({ locale: 'de' }) //=> [ 'vorm.', 'nachm.' ]
     * @return {[string]}
     */
  
  
    Info.meridiems = function meridiems() {
      var _ref5 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
          _ref5$locale = _ref5.locale,
          locale = _ref5$locale === undefined ? null : _ref5$locale;
  
      return Locale.create(locale).meridiems();
    };
  
    /**
     * Return an array of eras, such as ['BC', 'AD']. The locale can be specified, but the calendar system is always Gregorian.
     * @param {string} [length='short'] - the length of the era representation, such as "short" or "long".
     * @param {Object} opts - options
     * @param {string} [opts.locale] - the locale code
     * @example Info.eras() //=> [ 'BC', 'AD' ]
     * @example Info.eras('long') //=> [ 'Before Christ', 'Anno Domini' ]
     * @example Info.eras('long', { locale: 'fr' }) //=> [ 'avant Jésus-Christ', 'après Jésus-Christ' ]
     * @return {[string]}
     */
  
  
    Info.eras = function eras() {
      var length = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'short';
  
      var _ref6 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
          _ref6$locale = _ref6.locale,
          locale = _ref6$locale === undefined ? null : _ref6$locale;
  
      return Locale.create(locale, null, 'gregory').eras(length);
    };
  
    /**
     * Return the set of available features in this environment.
     * Some features of Luxon are not available in all environments. For example, on older browsers, timezone support is not available. Use this function to figure out if that's the case.
     * Keys:
     * * `zones`: whether this environment supports IANA timezones
     * * `intlTokens`: whether this environment supports internationalized token-based formatting/parsing
     * * `intl`: whether this environment supports general internationalization
     * @example Info.features() //=> { intl: true, intlTokens: false, zones: true }
     * @return {Object}
     */
  
  
    Info.features = function features() {
      var intl = false,
          intlTokens = false,
          zones = false;
  
      if (hasIntl()) {
        intl = true;
        intlTokens = hasFormatToParts();
  
        try {
          zones = new Intl.DateTimeFormat('en', { timeZone: 'America/New_York' }).resolvedOptions().timeZone === 'America/New_York';
        } catch (e) {
          zones = false;
        }
      }
  
      return { intl: intl, intlTokens: intlTokens, zones: zones };
    };
  
    return Info;
  }();
  
  function dayDiff(earlier, later) {
    var utcDayStart = function utcDayStart(dt) {
      return dt.toUTC(0, { keepLocalTime: true }).startOf('day').valueOf();
    },
        ms = utcDayStart(later) - utcDayStart(earlier);
    return Math.floor(Duration.fromMillis(ms).as('days'));
  }
  
  function highOrderDiffs(cursor, later, units) {
    var differs = [['years', function (a, b) {
      return b.year - a.year;
    }], ['months', function (a, b) {
      return b.month - a.month + (b.year - a.year) * 12;
    }], ['weeks', function (a, b) {
      var days = dayDiff(a, b);
      return (days - days % 7) / 7;
    }], ['days', dayDiff]];
  
    var results = {};
    var lowestOrder = void 0,
        highWater = void 0;
  
    for (var _iterator = differs, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
      var _ref2;
  
      if (_isArray) {
        if (_i >= _iterator.length) break;
        _ref2 = _iterator[_i++];
      } else {
        _i = _iterator.next();
        if (_i.done) break;
        _ref2 = _i.value;
      }
  
      var _ref = _ref2;
      var unit = _ref[0];
      var differ = _ref[1];
  
      if (units.indexOf(unit) >= 0) {
        var _cursor$plus;
  
        lowestOrder = unit;
  
        var delta = differ(cursor, later);
  
        highWater = cursor.plus((_cursor$plus = {}, _cursor$plus[unit] = delta, _cursor$plus));
  
        if (highWater > later) {
          var _highWater$minus;
  
          cursor = highWater.minus((_highWater$minus = {}, _highWater$minus[unit] = 1, _highWater$minus));
          delta -= 1;
        } else {
          cursor = highWater;
        }
  
        if (delta > 0) {
          results[unit] = delta;
        }
      }
    }
  
    return [cursor, results, highWater, lowestOrder];
  }
  
  function _diff (earlier, later, units, opts) {
    var _highOrderDiffs = highOrderDiffs(earlier, later, units),
        cursor = _highOrderDiffs[0],
        results = _highOrderDiffs[1],
        highWater = _highOrderDiffs[2],
        lowestOrder = _highOrderDiffs[3];
  
    var remainingMillis = later - cursor;
  
    var lowerOrderUnits = units.filter(function (u) {
      return ['hours', 'minutes', 'seconds', 'milliseconds'].indexOf(u) >= 0;
    });
  
    if (lowerOrderUnits.length === 0) {
      if (highWater < later) {
        var _cursor$plus2;
  
        highWater = cursor.plus((_cursor$plus2 = {}, _cursor$plus2[lowestOrder] = 1, _cursor$plus2));
      }
  
      if (highWater !== cursor) {
        results[lowestOrder] = (results[lowestOrder] || 0) + remainingMillis / (highWater - cursor);
      }
    }
  
    var duration = Duration.fromObject(Object.assign(results, opts));
  
    if (lowerOrderUnits.length > 0) {
      var _Duration$fromMillis;
  
      return (_Duration$fromMillis = Duration.fromMillis(remainingMillis, opts)).shiftTo.apply(_Duration$fromMillis, lowerOrderUnits).plus(duration);
    } else {
      return duration;
    }
  }
  
  var MISSING_FTP = 'missing Intl.DateTimeFormat.formatToParts support';
  
  function intUnit(regex) {
    var post = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function (i) {
      return i;
    };
  
    return { regex: regex, deser: function deser(_ref) {
        var s = _ref[0];
        return post(parseInt(s));
      } };
  }
  
  function fixListRegex(s) {
    // make dots optional and also make them literal
    return s.replace(/\./, '\\.?');
  }
  
  function stripInsensitivities(s) {
    return s.replace(/\./, '').toLowerCase();
  }
  
  function oneOf(strings, startIndex) {
    if (strings === null) {
      return null;
    } else {
      return {
        regex: RegExp(strings.map(fixListRegex).join('|')),
        deser: function deser(_ref2) {
          var s = _ref2[0];
          return strings.findIndex(function (i) {
            return stripInsensitivities(s) === stripInsensitivities(i);
          }) + startIndex;
        }
      };
    }
  }
  
  function offset(regex, groups) {
    return { regex: regex, deser: function deser(_ref3) {
        var h = _ref3[1],
            m = _ref3[2];
        return signedOffset(h, m);
      }, groups: groups };
  }
  
  function simple(regex) {
    return { regex: regex, deser: function deser(_ref4) {
        var s = _ref4[0];
        return s;
      } };
  }
  
  function unitForToken(token, loc) {
    var one = /\d/,
        two = /\d{2}/,
        three = /\d{3}/,
        four = /\d{4}/,
        oneOrTwo = /\d{1,2}/,
        oneToThree = /\d{1,3}/,
        twoToFour = /\d{2,4}/,
        literal = function literal(t) {
      return { regex: RegExp(t.val), deser: function deser(_ref5) {
          var s = _ref5[0];
          return s;
        }, literal: true };
    },
        unitate = function unitate(t) {
      if (token.literal) {
        return literal(t);
      }
      switch (t.val) {
        // era
        case 'G':
          return oneOf(loc.eras('short', false), 0);
        case 'GG':
          return oneOf(loc.eras('long', false), 0);
        // years
        case 'y':
          return intUnit(/\d{1,6}/);
        case 'yy':
          return intUnit(twoToFour, untruncateYear);
        case 'yyyy':
          return intUnit(four);
        case 'yyyyy':
          return intUnit(/\d{4,6}/);
        case 'yyyyyy':
          return intUnit(/\d{6}/);
        // months
        case 'M':
          return intUnit(oneOrTwo);
        case 'MM':
          return intUnit(two);
        case 'MMM':
          return oneOf(loc.months('short', false, false), 1);
        case 'MMMM':
          return oneOf(loc.months('long', false, false), 1);
        case 'L':
          return intUnit(oneOrTwo);
        case 'LL':
          return intUnit(two);
        case 'LLL':
          return oneOf(loc.months('short', true, false), 1);
        case 'LLLL':
          return oneOf(loc.months('long', true, false), 1);
        // dates
        case 'd':
          return intUnit(oneOrTwo);
        case 'dd':
          return intUnit(two);
        // ordinals
        case 'o':
          return intUnit(oneToThree);
        case 'ooo':
          return intUnit(three);
        // time
        case 'HH':
          return intUnit(two);
        case 'H':
          return intUnit(oneOrTwo);
        case 'hh':
          return intUnit(two);
        case 'h':
          return intUnit(oneOrTwo);
        case 'mm':
          return intUnit(two);
        case 'm':
          return intUnit(oneOrTwo);
        case 's':
          return intUnit(oneOrTwo);
        case 'ss':
          return intUnit(two);
        case 'S':
          return intUnit(oneToThree);
        case 'SSS':
          return intUnit(three);
        case 'u':
          return simple(/\d{1,9}/);
        // meridiem
        case 'a':
          return oneOf(loc.meridiems(), 0);
        // weekYear (k)
        case 'kkkk':
          return intUnit(four);
        case 'kk':
          return intUnit(twoToFour, untruncateYear);
        // weekNumber (W)
        case 'W':
          return intUnit(oneOrTwo);
        case 'WW':
          return intUnit(two);
        // weekdays
        case 'E':
        case 'c':
          return intUnit(one);
        case 'EEE':
          return oneOf(loc.weekdays('short', false, false), 1);
        case 'EEEE':
          return oneOf(loc.weekdays('long', false, false), 1);
        case 'ccc':
          return oneOf(loc.weekdays('short', true, false), 1);
        case 'cccc':
          return oneOf(loc.weekdays('long', true, false), 1);
        // offset/zone
        case 'Z':
        case 'ZZ':
          return offset(/([+-]\d{1,2})(?::(\d{2}))?/, 2);
        case 'ZZZ':
          return offset(/([+-]\d{1,2})(\d{2})?/, 2);
        // we don't support ZZZZ (PST) or ZZZZZ (Pacific Standard Time) in parsing
        // because we don't have any way to figure out what they are
        case 'z':
          return simple(/[A-Za-z_]{1,256}\/[A-Za-z_]{1,256}/);
        default:
          return literal(t);
      }
    };
  
    var unit = unitate(token) || {
      invalidReason: MISSING_FTP
    };
  
    unit.token = token;
  
    return unit;
  }
  
  function buildRegex(units) {
    var re = units.map(function (u) {
      return u.regex;
    }).reduce(function (f, r) {
      return f + '(' + r.source + ')';
    }, '');
    return ['^' + re + '$', units];
  }
  
  function match(input, regex, handlers) {
    var matches = input.match(regex);
  
    if (matches) {
      var all = {};
      var matchIndex = 1;
      for (var i in handlers) {
        if (handlers.hasOwnProperty(i)) {
          var h = handlers[i],
              groups = h.groups ? h.groups + 1 : 1;
          if (!h.literal && h.token) {
            all[h.token.val[0]] = h.deser(matches.slice(matchIndex, matchIndex + groups));
          }
          matchIndex += groups;
        }
      }
      return [matches, all];
    } else {
      return [matches, {}];
    }
  }
  
  function dateTimeFromMatches(matches) {
    var toField = function toField(token) {
      switch (token) {
        case 'S':
          return 'millisecond';
        case 's':
          return 'second';
        case 'm':
          return 'minute';
        case 'h':
        case 'H':
          return 'hour';
        case 'd':
          return 'day';
        case 'o':
          return 'ordinal';
        case 'L':
        case 'M':
          return 'month';
        case 'y':
          return 'year';
        case 'E':
        case 'c':
          return 'weekday';
        case 'W':
          return 'weekNumber';
        case 'k':
          return 'weekYear';
        default:
          return null;
      }
    };
  
    var zone = void 0;
    if (!isUndefined(matches.Z)) {
      zone = new FixedOffsetZone(matches.Z);
    } else if (!isUndefined(matches.z)) {
      zone = new IANAZone(matches.z);
    } else {
      zone = null;
    }
  
    if (!isUndefined(matches.h)) {
      if (matches.h < 12 && matches.a === 1) {
        matches.h += 12;
      } else if (matches.h === 12 && matches.a === 0) {
        matches.h = 0;
      }
    }
  
    if (matches.G === 0 && matches.y) {
      matches.y = -matches.y;
    }
  
    if (!isUndefined(matches.u)) {
      matches.S = parseMillis(matches.u);
    }
  
    var vals = Object.keys(matches).reduce(function (r, k) {
      var f = toField(k);
      if (f) {
        r[f] = matches[k];
      }
  
      return r;
    }, {});
  
    return [vals, zone];
  }
  
  /**
   * @private
   */
  
  function explainFromTokens(locale, input, format) {
    var tokens = Formatter.parseFormat(format),
        units = tokens.map(function (t) {
      return unitForToken(t, locale);
    }),
        disqualifyingUnit = units.find(function (t) {
      return t.invalidReason;
    });
  
    if (disqualifyingUnit) {
      return { input: input, tokens: tokens, invalidReason: disqualifyingUnit.invalidReason };
    } else {
      var _buildRegex = buildRegex(units),
          regexString = _buildRegex[0],
          handlers = _buildRegex[1],
          regex = RegExp(regexString, 'i'),
          _match = match(input, regex, handlers),
          rawMatches = _match[0],
          matches = _match[1],
          _ref6 = matches ? dateTimeFromMatches(matches) : [null, null],
          result = _ref6[0],
          zone = _ref6[1];
  
      return { input: input, tokens: tokens, regex: regex, rawMatches: rawMatches, matches: matches, result: result, zone: zone };
    }
  }
  
  function parseFromTokens(locale, input, format) {
    var _explainFromTokens = explainFromTokens(locale, input, format),
        result = _explainFromTokens.result,
        zone = _explainFromTokens.zone,
        invalidReason = _explainFromTokens.invalidReason;
  
    return [result, zone, invalidReason];
  }
  
  var nonLeapLadder = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334];
  var leapLadder = [0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335];
  
  function dayOfWeek(year, month, day) {
    var js = new Date(Date.UTC(year, month - 1, day)).getUTCDay();
    return js === 0 ? 7 : js;
  }
  
  function computeOrdinal(year, month, day) {
    return day + (isLeapYear(year) ? leapLadder : nonLeapLadder)[month - 1];
  }
  
  function uncomputeOrdinal(year, ordinal) {
    var table = isLeapYear(year) ? leapLadder : nonLeapLadder,
        month0 = table.findIndex(function (i) {
      return i < ordinal;
    }),
        day = ordinal - table[month0];
    return { month: month0 + 1, day: day };
  }
  
  /**
   * @private
   */
  
  function gregorianToWeek(gregObj) {
    var year = gregObj.year,
        month = gregObj.month,
        day = gregObj.day,
        ordinal = computeOrdinal(year, month, day),
        weekday = dayOfWeek(year, month, day);
  
  
    var weekNumber = Math.floor((ordinal - weekday + 10) / 7),
        weekYear = void 0;
  
    if (weekNumber < 1) {
      weekYear = year - 1;
      weekNumber = weeksInWeekYear(weekYear);
    } else if (weekNumber > weeksInWeekYear(year)) {
      weekYear = year + 1;
      weekNumber = 1;
    } else {
      weekYear = year;
    }
  
    return Object.assign({ weekYear: weekYear, weekNumber: weekNumber, weekday: weekday }, timeObject(gregObj));
  }
  
  function weekToGregorian(weekData) {
    var weekYear = weekData.weekYear,
        weekNumber = weekData.weekNumber,
        weekday = weekData.weekday,
        weekdayOfJan4 = dayOfWeek(weekYear, 1, 4),
        yearInDays = daysInYear(weekYear);
  
    var ordinal = weekNumber * 7 + weekday - weekdayOfJan4 - 3,
        year = void 0;
  
    if (ordinal < 1) {
      year = weekYear - 1;
      ordinal += daysInYear(year);
    } else if (ordinal > yearInDays) {
      year = weekYear + 1;
      ordinal -= daysInYear(year);
    } else {
      year = weekYear;
    }
  
    var _uncomputeOrdinal = uncomputeOrdinal(year, ordinal),
        month = _uncomputeOrdinal.month,
        day = _uncomputeOrdinal.day;
  
    return Object.assign({ year: year, month: month, day: day }, timeObject(weekData));
  }
  
  function gregorianToOrdinal(gregData) {
    var year = gregData.year,
        month = gregData.month,
        day = gregData.day,
        ordinal = computeOrdinal(year, month, day);
  
  
    return Object.assign({ year: year, ordinal: ordinal }, timeObject(gregData));
  }
  
  function ordinalToGregorian(ordinalData) {
    var year = ordinalData.year,
        ordinal = ordinalData.ordinal,
        _uncomputeOrdinal2 = uncomputeOrdinal(year, ordinal),
        month = _uncomputeOrdinal2.month,
        day = _uncomputeOrdinal2.day;
  
    return Object.assign({ year: year, month: month, day: day }, timeObject(ordinalData));
  }
  
  function hasInvalidWeekData(obj) {
    var validYear = isNumber(obj.weekYear),
        validWeek = numberBetween(obj.weekNumber, 1, weeksInWeekYear(obj.weekYear)),
        validWeekday = numberBetween(obj.weekday, 1, 7);
  
    if (!validYear) {
      return 'weekYear out of range';
    } else if (!validWeek) {
      return 'week out of range';
    } else if (!validWeekday) {
      return 'weekday out of range';
    } else return false;
  }
  
  function hasInvalidOrdinalData(obj) {
    var validYear = isNumber(obj.year),
        validOrdinal = numberBetween(obj.ordinal, 1, daysInYear(obj.year));
  
    if (!validYear) {
      return 'year out of range';
    } else if (!validOrdinal) {
      return 'ordinal out of range';
    } else return false;
  }
  
  function hasInvalidGregorianData(obj) {
    var validYear = isNumber(obj.year),
        validMonth = numberBetween(obj.month, 1, 12),
        validDay = numberBetween(obj.day, 1, daysInMonth(obj.year, obj.month));
  
    if (!validYear) {
      return 'year out of range';
    } else if (!validMonth) {
      return 'month out of range';
    } else if (!validDay) {
      return 'day out of range';
    } else return false;
  }
  
  function hasInvalidTimeData(obj) {
    var validHour = numberBetween(obj.hour, 0, 23),
        validMinute = numberBetween(obj.minute, 0, 59),
        validSecond = numberBetween(obj.second, 0, 59),
        validMillisecond = numberBetween(obj.millisecond, 0, 999);
  
    if (!validHour) {
      return 'hour out of range';
    } else if (!validMinute) {
      return 'minute out of range';
    } else if (!validSecond) {
      return 'second out of range';
    } else if (!validMillisecond) {
      return 'millisecond out of range';
    } else return false;
  }
  
  var INVALID = 'Invalid DateTime';
  var INVALID_INPUT = 'invalid input';
  var UNSUPPORTED_ZONE = 'unsupported zone';
  var UNPARSABLE = 'unparsable';
  
  // we cache week data on the DT object and this intermediates the cache
  function possiblyCachedWeekData(dt) {
    if (dt.weekData === null) {
      dt.weekData = gregorianToWeek(dt.c);
    }
    return dt.weekData;
  }
  
  // clone really means, "make a new object with these modifications". all "setters" really use this
  // to create a new object while only changing some of the properties
  function clone(inst, alts) {
    var current = {
      ts: inst.ts,
      zone: inst.zone,
      c: inst.c,
      o: inst.o,
      loc: inst.loc,
      invalidReason: inst.invalidReason
    };
    return new DateTime(Object.assign({}, current, alts, { old: current }));
  }
  
  // find the right offset a given local time. The o input is our guess, which determines which
  // offset we'll pick in ambiguous cases (e.g. there are two 3 AMs b/c Fallback DST)
  function fixOffset(localTS, o, tz) {
    // Our UTC time is just a guess because our offset is just a guess
    var utcGuess = localTS - o * 60 * 1000;
  
    // Test whether the zone matches the offset for this ts
    var o2 = tz.offset(utcGuess);
  
    // If so, offset didn't change and we're done
    if (o === o2) {
      return [utcGuess, o];
    }
  
    // If not, change the ts by the difference in the offset
    utcGuess -= (o2 - o) * 60 * 1000;
  
    // If that gives us the local time we want, we're done
    var o3 = tz.offset(utcGuess);
    if (o2 === o3) {
      return [utcGuess, o2];
    }
  
    // If it's different, we're in a hole time. The offset has changed, but the we don't adjust the time
    return [localTS - Math.min(o2, o3) * 60 * 1000, Math.max(o2, o3)];
  }
  
  // convert an epoch timestamp into a calendar object with the given offset
  function tsToObj(ts, offset) {
    ts += offset * 60 * 1000;
  
    var d = new Date(ts);
  
    return {
      year: d.getUTCFullYear(),
      month: d.getUTCMonth() + 1,
      day: d.getUTCDate(),
      hour: d.getUTCHours(),
      minute: d.getUTCMinutes(),
      second: d.getUTCSeconds(),
      millisecond: d.getUTCMilliseconds()
    };
  }
  
  // covert a calendar object to a local timestamp (epoch, but with the offset baked in)
  function objToLocalTS(obj) {
    var d = Date.UTC(obj.year, obj.month - 1, obj.day, obj.hour, obj.minute, obj.second, obj.millisecond);
  
    // for legacy reasons, years between 0 and 99 are interpreted as 19XX; revert that
    if (obj.year < 100 && obj.year >= 0) {
      d = new Date(d);
      d.setUTCFullYear(obj.year);
    }
    return +d;
  }
  
  // convert a calendar object to a epoch timestamp
  function objToTS(obj, offset, zone) {
    return fixOffset(objToLocalTS(obj), offset, zone);
  }
  
  // create a new DT instance by adding a duration, adjusting for DSTs
  function adjustTime(inst, dur) {
    var oPre = inst.o,
        year = inst.c.year + dur.years,
        month = inst.c.month + dur.months + dur.quarters * 3,
        c = Object.assign({}, inst.c, {
      year: year,
      month: month,
      day: Math.min(inst.c.day, daysInMonth(year, month)) + dur.days + dur.weeks * 7
    }),
        millisToAdd = Duration.fromObject({
      hours: dur.hours,
      minutes: dur.minutes,
      seconds: dur.seconds,
      milliseconds: dur.milliseconds
    }).as('milliseconds'),
        localTS = objToLocalTS(c);
  
    var _fixOffset = fixOffset(localTS, oPre, inst.zone),
        ts = _fixOffset[0],
        o = _fixOffset[1];
  
    if (millisToAdd !== 0) {
      ts += millisToAdd;
      // that could have changed the offset by going over a DST, but we want to keep the ts the same
      o = inst.zone.offset(ts);
    }
  
    return { ts: ts, o: o };
  }
  
  // helper useful in turning the results of parsing into real dates
  // by handling the zone options
  function parseDataToDateTime(parsed, parsedZone, opts) {
    var setZone = opts.setZone,
        zone = opts.zone;
  
    if (parsed && Object.keys(parsed).length !== 0) {
      var interpretationZone = parsedZone || zone,
          inst = DateTime.fromObject(Object.assign(parsed, opts, {
        zone: interpretationZone
      }));
      return setZone ? inst : inst.setZone(zone);
    } else {
      return DateTime.invalid(UNPARSABLE);
    }
  }
  
  // if you want to output a technical format (e.g. RFC 2822), this helper
  // helps handle the details
  function toTechFormat(dt, format) {
    return dt.isValid ? Formatter.create(Locale.create('en-US'), {
      allowZ: true,
      forceSimple: true
    }).formatDateTimeFromString(dt, format) : null;
  }
  
  // technical time formats (e.g. the time part of ISO 8601), take some options
  // and this commonizes their handling
  function toTechTimeFormat(dt, _ref) {
    var _ref$suppressSeconds = _ref.suppressSeconds,
        suppressSeconds = _ref$suppressSeconds === undefined ? false : _ref$suppressSeconds,
        _ref$suppressMillisec = _ref.suppressMilliseconds,
        suppressMilliseconds = _ref$suppressMillisec === undefined ? false : _ref$suppressMillisec,
        _ref$includeOffset = _ref.includeOffset,
        includeOffset = _ref$includeOffset === undefined ? true : _ref$includeOffset,
        _ref$includeZone = _ref.includeZone,
        includeZone = _ref$includeZone === undefined ? false : _ref$includeZone,
        _ref$spaceZone = _ref.spaceZone,
        spaceZone = _ref$spaceZone === undefined ? false : _ref$spaceZone;
  
    var fmt = 'HH:mm';
  
    if (!suppressSeconds || dt.second !== 0 || dt.millisecond !== 0) {
      fmt += ':ss';
      if (!suppressMilliseconds || dt.millisecond !== 0) {
        fmt += '.SSS';
      }
    }
  
    if ((includeZone || includeOffset) && spaceZone) {
      fmt += ' ';
    }
  
    if (includeZone) {
      fmt += 'z';
    } else if (includeOffset) {
      fmt += 'ZZ';
    }
  
    return toTechFormat(dt, fmt);
  }
  
  // defaults for unspecified units in the supported calendars
  var defaultUnitValues = {
    month: 1,
    day: 1,
    hour: 0,
    minute: 0,
    second: 0,
    millisecond: 0
  };
  var defaultWeekUnitValues = {
    weekNumber: 1,
    weekday: 1,
    hour: 0,
    minute: 0,
    second: 0,
    millisecond: 0
  };
  var defaultOrdinalUnitValues = {
    ordinal: 1,
    hour: 0,
    minute: 0,
    second: 0,
    millisecond: 0
  };
  
  // Units in the supported calendars, sorted by bigness
  var orderedUnits = ['year', 'month', 'day', 'hour', 'minute', 'second', 'millisecond'];
  var orderedWeekUnits = ['weekYear', 'weekNumber', 'weekday', 'hour', 'minute', 'second', 'millisecond'];
  var orderedOrdinalUnits = ['year', 'ordinal', 'hour', 'minute', 'second', 'millisecond'];
  
  // standardize case and plurality in units
  function normalizeUnit(unit) {
    var ignoreUnknown = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  
    var normalized = {
      year: 'year',
      years: 'year',
      month: 'month',
      months: 'month',
      day: 'day',
      days: 'day',
      hour: 'hour',
      hours: 'hour',
      minute: 'minute',
      minutes: 'minute',
      second: 'second',
      seconds: 'second',
      millisecond: 'millisecond',
      milliseconds: 'millisecond',
      weekday: 'weekday',
      weekdays: 'weekday',
      weeknumber: 'weekNumber',
      weeksnumber: 'weekNumber',
      weeknumbers: 'weekNumber',
      weekyear: 'weekYear',
      weekyears: 'weekYear',
      ordinal: 'ordinal'
    }[unit ? unit.toLowerCase() : unit];
  
    if (!ignoreUnknown && !normalized) throw new InvalidUnitError(unit);
  
    return normalized;
  }
  
  // this is a dumbed down version of fromObject() that runs about 60% faster
  // but doesn't do any validation, makes a bunch of assumptions about what units
  // are present, and so on.
  function quickDT(obj, zone) {
    // assume we have the higher-order units
    for (var _iterator = orderedUnits, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
      var _ref2;
  
      if (_isArray) {
        if (_i >= _iterator.length) break;
        _ref2 = _iterator[_i++];
      } else {
        _i = _iterator.next();
        if (_i.done) break;
        _ref2 = _i.value;
      }
  
      var u = _ref2;
  
      if (isUndefined(obj[u])) {
        obj[u] = defaultUnitValues[u];
      }
    }
  
    var invalidReason = hasInvalidGregorianData(obj) || hasInvalidTimeData(obj);
    if (invalidReason) {
      return DateTime.invalid(invalidReason);
    }
  
    var tsNow = Settings.now(),
        offsetProvis = zone.offset(tsNow),
        _objToTS = objToTS(obj, offsetProvis, zone),
        ts = _objToTS[0],
        o = _objToTS[1];
  
  
    return new DateTime({
      ts: ts,
      zone: zone,
      o: o
    });
  }
  
  /**
   * A DateTime is an immutable data structure representing a specific date and time and accompanying methods. It contains class and instance methods for creating, parsing, interrogating, transforming, and formatting them.
   *
   * A DateTime comprises of:
   * * A timestamp. Each DateTime instance refers to a specific millisecond of the Unix epoch.
   * * A time zone. Each instance is considered in the context of a specific zone (by default the local system's zone).
   * * Configuration properties that effect how output strings are formatted, such as `locale`, `numberingSystem`, and `outputCalendar`.
   *
   * Here is a brief overview of the most commonly used functionality it provides:
   *
   * * **Creation**: To create a DateTime from its components, use one of its factory class methods: {@link local}, {@link utc}, and (most flexibly) {@link fromObject}. To create one from a standard string format, use {@link fromISO}, {@link fromHTTP}, and {@link fromRFC2822}. To create one from a custom string format, use {@link fromFormat}. To create one from a native JS date, use {@link fromJSDate}.
   * * **Gregorian calendar and time**: To examine the Gregorian properties of a DateTime individually (i.e as opposed to collectively through {@link toObject}), use the {@link year}, {@link month},
   * {@link day}, {@link hour}, {@link minute}, {@link second}, {@link millisecond} accessors.
   * * **Week calendar**: For ISO week calendar attributes, see the {@link weekYear}, {@link weekNumber}, and {@link weekday} accessors.
   * * **Configuration** See the {@link locale} and {@link numberingSystem} accessors.
   * * **Transformation**: To transform the DateTime into other DateTimes, use {@link set}, {@link reconfigure}, {@link setZone}, {@link setLocale}, {@link plus}, {@link minus}, {@link endOf}, {@link startOf}, {@link toUTC}, and {@link toLocal}.
   * * **Output**: To convert the DateTime to other representations, use the {@link toJSON}, {@link toISO}, {@link toHTTP}, {@link toObject}, {@link toRFC2822}, {@link toString}, {@link toLocaleString}, {@link toFormat}, {@link toMillis} and {@link toJSDate}.
   *
   * There's plenty others documented below. In addition, for more information on subtler topics like internationalization, time zones, alternative calendars, validity, and so on, see the external documentation.
   */
  
  var DateTime = function () {
    /**
     * @access private
     */
    function DateTime(config) {
      classCallCheck(this, DateTime);
  
      var zone = config.zone || Settings.defaultZone,
          invalidReason = config.invalidReason || (Number.isNaN(config.ts) ? INVALID_INPUT : null) || (!zone.isValid ? UNSUPPORTED_ZONE : null);
      /**
       * @access private
       */
      this.ts = isUndefined(config.ts) ? Settings.now() : config.ts;
  
      var c = null,
          o = null;
      if (!invalidReason) {
        var unchanged = config.old && config.old.ts === this.ts && config.old.zone.equals(zone);
        c = unchanged ? config.old.c : tsToObj(this.ts, zone.offset(this.ts));
        o = unchanged ? config.old.o : zone.offset(this.ts);
      }
  
      /**
       * @access private
       */
      this.zone = zone;
      /**
       * @access private
       */
      this.loc = config.loc || Locale.create();
      /**
       * @access private
       */
      this.invalid = invalidReason;
      /**
       * @access private
       */
      this.weekData = null;
      /**
       * @access private
       */
      this.c = c;
      /**
       * @access private
       */
      this.o = o;
    }
  
    // CONSTRUCT
  
    /**
     * Create a local DateTime
     * @param {number} year - The calendar year. If omitted (as in, call `local()` with no arguments), the current time will be used
     * @param {number} [month=1] - The month, 1-indexed
     * @param {number} [day=1] - The day of the month
     * @param {number} [hour=0] - The hour of the day, in 24-hour time
     * @param {number} [minute=0] - The minute of the hour, i.e. a number between 0 and 59
     * @param {number} [second=0] - The second of the minute, i.e. a number between 0 and 59
     * @param {number} [millisecond=0] - The millisecond of the second, i.e. a number between 0 and 999
     * @example DateTime.local()                            //~> now
     * @example DateTime.local(2017)                        //~> 2017-01-01T00:00:00
     * @example DateTime.local(2017, 3)                     //~> 2017-03-01T00:00:00
     * @example DateTime.local(2017, 3, 12)                 //~> 2017-03-12T00:00:00
     * @example DateTime.local(2017, 3, 12, 5)              //~> 2017-03-12T05:00:00
     * @example DateTime.local(2017, 3, 12, 5, 45)          //~> 2017-03-12T05:45:00
     * @example DateTime.local(2017, 3, 12, 5, 45, 10)      //~> 2017-03-12T05:45:10
     * @example DateTime.local(2017, 3, 12, 5, 45, 10, 765) //~> 2017-03-12T05:45:10.765
     * @return {DateTime}
     */
  
  
    DateTime.local = function local(year, month, day, hour, minute, second, millisecond) {
      if (isUndefined(year)) {
        return new DateTime({ ts: Settings.now() });
      } else {
        return quickDT({
          year: year,
          month: month,
          day: day,
          hour: hour,
          minute: minute,
          second: second,
          millisecond: millisecond
        }, Settings.defaultZone);
      }
    };
  
    /**
     * Create a DateTime in UTC
     * @param {number} year - The calendar year. If omitted (as in, call `utc()` with no arguments), the current time will be used
     * @param {number} [month=1] - The month, 1-indexed
     * @param {number} [day=1] - The day of the month
     * @param {number} [hour=0] - The hour of the day, in 24-hour time
     * @param {number} [minute=0] - The minute of the hour, i.e. a number between 0 and 59
     * @param {number} [second=0] - The second of the minute, i.e. a number between 0 and 59
     * @param {number} [millisecond=0] - The millisecond of the second, i.e. a number between 0 and 999
     * @example DateTime.utc()                            //~> now
     * @example DateTime.utc(2017)                        //~> 2017-01-01T00:00:00Z
     * @example DateTime.utc(2017, 3)                     //~> 2017-03-01T00:00:00Z
     * @example DateTime.utc(2017, 3, 12)                 //~> 2017-03-12T00:00:00Z
     * @example DateTime.utc(2017, 3, 12, 5)              //~> 2017-03-12T05:00:00Z
     * @example DateTime.utc(2017, 3, 12, 5, 45)          //~> 2017-03-12T05:45:00Z
     * @example DateTime.utc(2017, 3, 12, 5, 45, 10)      //~> 2017-03-12T05:45:10Z
     * @example DateTime.utc(2017, 3, 12, 5, 45, 10, 765) //~> 2017-03-12T05:45:10.765Z
     * @return {DateTime}
     */
  
  
    DateTime.utc = function utc(year, month, day, hour, minute, second, millisecond) {
      if (isUndefined(year)) {
        return new DateTime({
          ts: Settings.now(),
          zone: FixedOffsetZone.utcInstance
        });
      } else {
        return quickDT({
          year: year,
          month: month,
          day: day,
          hour: hour,
          minute: minute,
          second: second,
          millisecond: millisecond
        }, FixedOffsetZone.utcInstance);
      }
    };
  
    /**
     * Create a DateTime from a Javascript Date object. Uses the default zone.
     * @param {Date} date - a Javascript Date object
     * @param {Object} options - configuration options for the DateTime
     * @param {string|Zone} [options.zone='local'] - the zone to place the DateTime into
     * @return {DateTime}
     */
  
  
    DateTime.fromJSDate = function fromJSDate(date) {
      var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  
      return new DateTime({
        ts: isDate(date) ? date.valueOf() : NaN,
        zone: normalizeZone(options.zone, Settings.defaultZone),
        loc: Locale.fromObject(options)
      });
    };
  
    /**
     * Create a DateTime from a number of milliseconds since the epoch (i.e. since 1 January 1970 00:00:00 UTC). Uses the default zone.
     * @param {number} milliseconds - a number of milliseconds since 1970 UTC
     * @param {Object} options - configuration options for the DateTime
     * @param {string|Zone} [options.zone='local'] - the zone to place the DateTime into
     * @param {string} [options.locale] - a locale to set on the resulting DateTime instance
     * @param {string} options.outputCalendar - the output calendar to set on the resulting DateTime instance
     * @param {string} options.numberingSystem - the numbering system to set on the resulting DateTime instance
     * @return {DateTime}
     */
  
  
    DateTime.fromMillis = function fromMillis(milliseconds) {
      var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  
      if (!isNumber(milliseconds)) {
        throw new InvalidArgumentError('fromMillis requires a numerical input');
      } else {
        return new DateTime({
          ts: milliseconds,
          zone: normalizeZone(options.zone, Settings.defaultZone),
          loc: Locale.fromObject(options)
        });
      }
    };
  
    /**
     * Create a DateTime from a Javascript object with keys like 'year' and 'hour' with reasonable defaults.
     * @param {Object} obj - the object to create the DateTime from
     * @param {number} obj.year - a year, such as 1987
     * @param {number} obj.month - a month, 1-12
     * @param {number} obj.day - a day of the month, 1-31, depending on the month
     * @param {number} obj.ordinal - day of the year, 1-365 or 366
     * @param {number} obj.weekYear - an ISO week year
     * @param {number} obj.weekNumber - an ISO week number, between 1 and 52 or 53, depending on the year
     * @param {number} obj.weekday - an ISO weekday, 1-7, where 1 is Monday and 7 is Sunday
     * @param {number} obj.hour - hour of the day, 0-23
     * @param {number} obj.minute - minute of the hour, 0-59
     * @param {number} obj.second - second of the minute, 0-59
     * @param {number} obj.millisecond - millisecond of the second, 0-999
     * @param {string|Zone} [obj.zone='local'] - interpret the numbers in the context of a particular zone. Can take any value taken as the first argument to setZone()
     * @param {string} [obj.locale='en-US'] - a locale to set on the resulting DateTime instance
     * @param {string} obj.outputCalendar - the output calendar to set on the resulting DateTime instance
     * @param {string} obj.numberingSystem - the numbering system to set on the resulting DateTime instance
     * @example DateTime.fromObject({ year: 1982, month: 5, day: 25}).toISODate() //=> '1982-05-25'
     * @example DateTime.fromObject({ year: 1982 }).toISODate() //=> '1982-01-01T00'
     * @example DateTime.fromObject({ hour: 10, minute: 26, second: 6 }) //~> today at 10:26:06
     * @example DateTime.fromObject({ hour: 10, minute: 26, second: 6, zone: 'utc' }),
     * @example DateTime.fromObject({ hour: 10, minute: 26, second: 6, zone: 'local' })
     * @example DateTime.fromObject({ hour: 10, minute: 26, second: 6, zone: 'America/New_York' })
     * @example DateTime.fromObject({ weekYear: 2016, weekNumber: 2, weekday: 3 }).toISODate() //=> '2016-01-13'
     * @return {DateTime}
     */
  
  
    DateTime.fromObject = function fromObject(obj) {
      var zoneToUse = normalizeZone(obj.zone, Settings.defaultZone);
      if (!zoneToUse.isValid) {
        return DateTime.invalid(UNSUPPORTED_ZONE);
      }
  
      var tsNow = Settings.now(),
          offsetProvis = zoneToUse.offset(tsNow),
          normalized = normalizeObject(obj, normalizeUnit, true),
          containsOrdinal = !isUndefined(normalized.ordinal),
          containsGregorYear = !isUndefined(normalized.year),
          containsGregorMD = !isUndefined(normalized.month) || !isUndefined(normalized.day),
          containsGregor = containsGregorYear || containsGregorMD,
          definiteWeekDef = normalized.weekYear || normalized.weekNumber,
          loc = Locale.fromObject(obj);
  
      // cases:
      // just a weekday -> this week's instance of that weekday, no worries
      // (gregorian data or ordinal) + (weekYear or weekNumber) -> error
      // (gregorian month or day) + ordinal -> error
      // otherwise just use weeks or ordinals or gregorian, depending on what's specified
  
      if ((containsGregor || containsOrdinal) && definiteWeekDef) {
        throw new ConflictingSpecificationError("Can't mix weekYear/weekNumber units with year/month/day or ordinals");
      }
  
      if (containsGregorMD && containsOrdinal) {
        throw new ConflictingSpecificationError("Can't mix ordinal dates with month/day");
      }
  
      var useWeekData = definiteWeekDef || normalized.weekday && !containsGregor;
  
      // configure ourselves to deal with gregorian dates or week stuff
      var units = void 0,
          defaultValues = void 0,
          objNow = tsToObj(tsNow, offsetProvis);
      if (useWeekData) {
        units = orderedWeekUnits;
        defaultValues = defaultWeekUnitValues;
        objNow = gregorianToWeek(objNow);
      } else if (containsOrdinal) {
        units = orderedOrdinalUnits;
        defaultValues = defaultOrdinalUnitValues;
        objNow = gregorianToOrdinal(objNow);
      } else {
        units = orderedUnits;
        defaultValues = defaultUnitValues;
      }
  
      // set default values for missing stuff
      var foundFirst = false;
      for (var _iterator2 = units, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) {
        var _ref3;
  
        if (_isArray2) {
          if (_i2 >= _iterator2.length) break;
          _ref3 = _iterator2[_i2++];
        } else {
          _i2 = _iterator2.next();
          if (_i2.done) break;
          _ref3 = _i2.value;
        }
  
        var u = _ref3;
  
        var v = normalized[u];
        if (!isUndefined(v)) {
          foundFirst = true;
        } else if (foundFirst) {
          normalized[u] = defaultValues[u];
        } else {
          normalized[u] = objNow[u];
        }
      }
  
      // make sure the values we have are in range
      var higherOrderInvalid = useWeekData ? hasInvalidWeekData(normalized) : containsOrdinal ? hasInvalidOrdinalData(normalized) : hasInvalidGregorianData(normalized),
          invalidReason = higherOrderInvalid || hasInvalidTimeData(normalized);
  
      if (invalidReason) {
        return DateTime.invalid(invalidReason);
      }
  
      // compute the actual time
      var gregorian = useWeekData ? weekToGregorian(normalized) : containsOrdinal ? ordinalToGregorian(normalized) : normalized,
          _objToTS2 = objToTS(gregorian, offsetProvis, zoneToUse),
          tsFinal = _objToTS2[0],
          offsetFinal = _objToTS2[1],
          inst = new DateTime({
        ts: tsFinal,
        zone: zoneToUse,
        o: offsetFinal,
        loc: loc
      });
  
      // gregorian data + weekday serves only to validate
      if (normalized.weekday && containsGregor && obj.weekday !== inst.weekday) {
        return DateTime.invalid('mismatched weekday');
      }
  
      return inst;
    };
  
    /**
     * Create a DateTime from an ISO 8601 string
     * @param {string} text - the ISO string
     * @param {Object} opts - options to affect the creation
     * @param {string|Zone} [opts.zone='local'] - use this zone if no offset is specified in the input string itself. Will also convert the time to this zone
     * @param {boolean} [opts.setZone=false] - override the zone with a fixed-offset zone specified in the string itself, if it specifies one
     * @param {string} [opts.locale='en-US'] - a locale to set on the resulting DateTime instance
     * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance
     * @param {string} opts.numberingSystem - the numbering system to set on the resulting DateTime instance
     * @example DateTime.fromISO('2016-05-25T09:08:34.123')
     * @example DateTime.fromISO('2016-05-25T09:08:34.123+06:00')
     * @example DateTime.fromISO('2016-05-25T09:08:34.123+06:00', {setZone: true})
     * @example DateTime.fromISO('2016-05-25T09:08:34.123', {zone: 'utc'})
     * @example DateTime.fromISO('2016-W05-4')
     * @return {DateTime}
     */
  
  
    DateTime.fromISO = function fromISO(text) {
      var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  
      var _parseISODate = parseISODate(text),
          vals = _parseISODate[0],
          parsedZone = _parseISODate[1];
  
      return parseDataToDateTime(vals, parsedZone, opts);
    };
  
    /**
     * Create a DateTime from an RFC 2822 string
     * @param {string} text - the RFC 2822 string
     * @param {Object} opts - options to affect the creation
     * @param {string|Zone} [opts.zone='local'] - convert the time to this zone. Since the offset is always specified in the string itself, this has no effect on the interpretation of string, merely the zone the resulting DateTime is expressed in.
     * @param {boolean} [opts.setZone=false] - override the zone with a fixed-offset zone specified in the string itself, if it specifies one
     * @param {string} [opts.locale='en-US'] - a locale to set on the resulting DateTime instance
     * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance
     * @param {string} opts.numberingSystem - the numbering system to set on the resulting DateTime instance
     * @example DateTime.fromRFC2822('25 Nov 2016 13:23:12 GMT')
     * @example DateTime.fromRFC2822('Tue, 25 Nov 2016 13:23:12 +0600')
     * @example DateTime.fromRFC2822('25 Nov 2016 13:23 Z')
     * @return {DateTime}
     */
  
  
    DateTime.fromRFC2822 = function fromRFC2822(text) {
      var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  
      var _parseRFC2822Date = parseRFC2822Date(text),
          vals = _parseRFC2822Date[0],
          parsedZone = _parseRFC2822Date[1];
  
      return parseDataToDateTime(vals, parsedZone, opts);
    };
  
    /**
     * Create a DateTime from an HTTP header date
     * @see https://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3.1
     * @param {string} text - the HTTP header date
     * @param {Object} options - options to affect the creation
     * @param {string|Zone} [options.zone='local'] - convert the time to this zone. Since HTTP dates are always in UTC, this has no effect on the interpretation of string, merely the zone the resulting DateTime is expressed in.
     * @param {boolean} [options.setZone=false] - override the zone with the fixed-offset zone specified in the string. For HTTP dates, this is always UTC, so this option is equivalent to setting the `zone` option to 'utc', but this option is included for consistency with similar methods.
     * @param {string} [options.locale='en-US'] - a locale to set on the resulting DateTime instance
     * @param {string} options.outputCalendar - the output calendar to set on the resulting DateTime instance
     * @param {string} options.numberingSystem - the numbering system to set on the resulting DateTime instance
     * @example DateTime.fromHTTP('Sun, 06 Nov 1994 08:49:37 GMT')
     * @example DateTime.fromHTTP('Sunday, 06-Nov-94 08:49:37 GMT')
     * @example DateTime.fromHTTP('Sun Nov  6 08:49:37 1994')
     * @return {DateTime}
     */
  
  
    DateTime.fromHTTP = function fromHTTP(text) {
      var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  
      var _parseHTTPDate = parseHTTPDate(text),
          vals = _parseHTTPDate[0],
          parsedZone = _parseHTTPDate[1];
  
      return parseDataToDateTime(vals, parsedZone, options);
    };
  
    /**
     * Create a DateTime from an input string and format string
     * Defaults to en-US if no locale has been specified, regardless of the system's locale
     * @param {string} text - the string to parse
     * @param {string} fmt - the format the string is expected to be in (see description)
     * @param {Object} options - options to affect the creation
     * @param {string|Zone} [options.zone='local'] - use this zone if no offset is specified in the input string itself. Will also convert the DateTime to this zone
     * @param {boolean} [options.setZone=false] - override the zone with a zone specified in the string itself, if it specifies one
     * @param {string} [options.locale='en-US'] - a locale string to use when parsing. Will also set the DateTime to this locale
     * @param {string} options.numberingSystem - the numbering system to use when parsing. Will also set the resulting DateTime to this numbering system
     * @param {string} options.outputCalendar - the output calendar to set on the resulting DateTime instance
     * @return {DateTime}
     */
  
  
    DateTime.fromFormat = function fromFormat(text, fmt) {
      var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  
      if (isUndefined(text) || isUndefined(fmt)) {
        throw new InvalidArgumentError('fromFormat requires an input string and a format');
      }
  
      var _options$locale = options.locale,
          locale = _options$locale === undefined ? null : _options$locale,
          _options$numberingSys = options.numberingSystem,
          numberingSystem = _options$numberingSys === undefined ? null : _options$numberingSys,
          localeToUse = Locale.fromOpts({ locale: locale, numberingSystem: numberingSystem, defaultToEN: true }),
          _parseFromTokens = parseFromTokens(localeToUse, text, fmt),
          vals = _parseFromTokens[0],
          parsedZone = _parseFromTokens[1],
          invalidReason = _parseFromTokens[2];
  
      if (invalidReason) {
        return DateTime.invalid(invalidReason);
      } else {
        return parseDataToDateTime(vals, parsedZone, options);
      }
    };
  
    /**
     * @deprecated use fromFormat instead
     */
  
  
    DateTime.fromString = function fromString(text, fmt) {
      var opts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  
      return DateTime.fromFormat(text, fmt, opts);
    };
  
    /**
     * Create a DateTime from a SQL date, time, or datetime
     * Defaults to en-US if no locale has been specified, regardless of the system's locale
     * @param {string} text - the string to parse
     * @param {Object} options - options to affect the creation
     * @param {string|Zone} [options.zone='local'] - use this zone if no offset is specified in the input string itself. Will also convert the DateTime to this zone
     * @param {boolean} [options.setZone=false] - override the zone with a zone specified in the string itself, if it specifies one
     * @param {string} [options.locale='en-US'] - a locale string to use when parsing. Will also set the DateTime to this locale
     * @param {string} options.numberingSystem - the numbering system to use when parsing. Will also set the resulting DateTime to this numbering system
     * @param {string} options.outputCalendar - the output calendar to set on the resulting DateTime instance
     * @example DateTime.fromSQL('2017-05-15')
     * @example DateTime.fromSQL('2017-05-15 09:12:34')
     * @example DateTime.fromSQL('2017-05-15 09:12:34.342')
     * @example DateTime.fromSQL('2017-05-15 09:12:34.342+06:00')
     * @example DateTime.fromSQL('2017-05-15 09:12:34.342 America/Los_Angeles')
     * @example DateTime.fromSQL('2017-05-15 09:12:34.342 America/Los_Angeles', { setZone: true })
     * @example DateTime.fromSQL('2017-05-15 09:12:34.342', { zone: 'America/Los_Angeles' })
     * @example DateTime.fromSQL('09:12:34.342')
     * @return {DateTime}
     */
  
  
    DateTime.fromSQL = function fromSQL(text) {
      var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  
      var _parseSQL = parseSQL(text),
          vals = _parseSQL[0],
          parsedZone = _parseSQL[1];
  
      return parseDataToDateTime(vals, parsedZone, options);
    };
  
    /**
     * Create an invalid DateTime.
     * @return {DateTime}
     */
  
  
    DateTime.invalid = function invalid(reason) {
      if (!reason) {
        throw new InvalidArgumentError('need to specify a reason the DateTime is invalid');
      }
      if (Settings.throwOnInvalid) {
        throw new InvalidDateTimeError(reason);
      } else {
        return new DateTime({ invalidReason: reason });
      }
    };
  
    // INFO
  
    /**
     * Get the value of unit.
     * @param {string} unit - a unit such as 'minute' or 'day'
     * @example DateTime.local(2017, 7, 4).get('month'); //=> 7
     * @example DateTime.local(2017, 7, 4).get('day'); //=> 4
     * @return {number}
     */
  
  
    DateTime.prototype.get = function get$$1(unit) {
      return this[unit];
    };
  
    /**
     * Returns whether the DateTime is valid. Invalid DateTimes occur when:
     * * The DateTime was created from invalid calendar information, such as the 13th month or February 30
     * * The DateTime was created by an operation on another invalid date
     * @type {boolean}
     */
  
  
    /**
     * Returns the resolved Intl options for this DateTime.
     * This is useful in understanding the behavior of formatting methods
     * @param {Object} opts - the same options as toLocaleString
     * @return {Object}
     */
    DateTime.prototype.resolvedLocaleOpts = function resolvedLocaleOpts() {
      var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  
      var _Formatter$create$res = Formatter.create(this.loc.clone(opts), opts).resolvedOptions(this),
          locale = _Formatter$create$res.locale,
          numberingSystem = _Formatter$create$res.numberingSystem,
          calendar = _Formatter$create$res.calendar;
  
      return { locale: locale, numberingSystem: numberingSystem, outputCalendar: calendar };
    };
  
    // TRANSFORM
  
    /**
     * "Set" the DateTime's zone to UTC. Returns a newly-constructed DateTime.
     *
     * Equivalent to {@link setZone}('utc')
     * @param {number} [offset=0] - optionally, an offset from UTC in minutes
     * @param {Object} [opts={}] - options to pass to `setZone()`
     * @return {DateTime}
     */
  
  
    DateTime.prototype.toUTC = function toUTC() {
      var offset = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
      var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  
      return this.setZone(FixedOffsetZone.instance(offset), opts);
    };
  
    /**
     * "Set" the DateTime's zone to the host's local zone. Returns a newly-constructed DateTime.
     *
     * Equivalent to `setZone('local')`
     * @return {DateTime}
     */
  
  
    DateTime.prototype.toLocal = function toLocal() {
      return this.setZone(new LocalZone());
    };
  
    /**
     * "Set" the DateTime's zone to specified zone. Returns a newly-constructed DateTime.
     *
     * By default, the setter keeps the underlying time the same (as in, the same UTC timestamp), but the new instance will report different local times and consider DSTs when making computations, as with {@link plus}. You may wish to use {@link toLocal} and {@link toUTC} which provide simple convenience wrappers for commonly used zones.
     * @param {string|Zone} [zone='local'] - a zone identifier. As a string, that can be any IANA zone supported by the host environment, or a fixed-offset name of the form 'utc+3', or the strings 'local' or 'utc'. You may also supply an instance of a {@link Zone} class.
     * @param {Object} opts - options
     * @param {boolean} [opts.keepLocalTime=false] - If true, adjust the underlying time so that the local time stays the same, but in the target zone. You should rarely need this.
     * @return {DateTime}
     */
  
  
    DateTime.prototype.setZone = function setZone(zone) {
      var _ref4 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
          _ref4$keepLocalTime = _ref4.keepLocalTime,
          keepLocalTime = _ref4$keepLocalTime === undefined ? false : _ref4$keepLocalTime,
          _ref4$keepCalendarTim = _ref4.keepCalendarTime,
          keepCalendarTime = _ref4$keepCalendarTim === undefined ? false : _ref4$keepCalendarTim;
  
      zone = normalizeZone(zone, Settings.defaultZone);
      if (zone.equals(this.zone)) {
        return this;
      } else if (!zone.isValid) {
        return DateTime.invalid(UNSUPPORTED_ZONE);
      } else {
        var newTS = keepLocalTime || keepCalendarTime // keepCalendarTime is the deprecated name for keepLocalTime
        ? this.ts + (this.o - zone.offset(this.ts)) * 60 * 1000 : this.ts;
        return clone(this, { ts: newTS, zone: zone });
      }
    };
  
    /**
     * "Set" the locale, numberingSystem, or outputCalendar. Returns a newly-constructed DateTime.
     * @param {Object} properties - the properties to set
     * @example DateTime.local(2017, 5, 25).reconfigure({ locale: 'en-GB' })
     * @return {DateTime}
     */
  
  
    DateTime.prototype.reconfigure = function reconfigure() {
      var _ref5 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
          locale = _ref5.locale,
          numberingSystem = _ref5.numberingSystem,
          outputCalendar = _ref5.outputCalendar;
  
      var loc = this.loc.clone({ locale: locale, numberingSystem: numberingSystem, outputCalendar: outputCalendar });
      return clone(this, { loc: loc });
    };
  
    /**
     * "Set" the locale. Returns a newly-constructed DateTime.
     * Just a convenient alias for reconfigure({ locale })
     * @example DateTime.local(2017, 5, 25).setLocale('en-GB')
     * @return {DateTime}
     */
  
  
    DateTime.prototype.setLocale = function setLocale(locale) {
      return this.reconfigure({ locale: locale });
    };
  
    /**
     * "Set" the values of specified units. Returns a newly-constructed DateTime.
     * You can only set units with this method; for "setting" metadata, see {@link reconfigure} and {@link setZone}.
     * @param {Object} values - a mapping of units to numbers
     * @example dt.set({ year: 2017 })
     * @example dt.set({ hour: 8, minute: 30 })
     * @example dt.set({ weekday: 5 })
     * @example dt.set({ year: 2005, ordinal: 234 })
     * @return {DateTime}
     */
  
  
    DateTime.prototype.set = function set$$1(values) {
      if (!this.isValid) return this;
  
      var normalized = normalizeObject(values, normalizeUnit),
          settingWeekStuff = !isUndefined(normalized.weekYear) || !isUndefined(normalized.weekNumber) || !isUndefined(normalized.weekday);
  
      var mixed = void 0;
      if (settingWeekStuff) {
        mixed = weekToGregorian(Object.assign(gregorianToWeek(this.c), normalized));
      } else if (!isUndefined(normalized.ordinal)) {
        mixed = ordinalToGregorian(Object.assign(gregorianToOrdinal(this.c), normalized));
      } else {
        mixed = Object.assign(this.toObject(), normalized);
  
        // if we didn't set the day but we ended up on an overflow date,
        // use the last day of the right month
        if (isUndefined(normalized.day)) {
          mixed.day = Math.min(daysInMonth(mixed.year, mixed.month), mixed.day);
        }
      }
  
      var _objToTS3 = objToTS(mixed, this.o, this.zone),
          ts = _objToTS3[0],
          o = _objToTS3[1];
  
      return clone(this, { ts: ts, o: o });
    };
  
    /**
     * Add a period of time to this DateTime and return the resulting DateTime
     *
     * Adding hours, minutes, seconds, or milliseconds increases the timestamp by the right number of milliseconds. Adding days, months, or years shifts the calendar, accounting for DSTs and leap years along the way. Thus, `dt.plus({ hours: 24 })` may result in a different time than `dt.plus({ days: 1 })` if there's a DST shift in between.
     * @param {Duration|Object|number} duration - The amount to add. Either a Luxon Duration, a number of milliseconds, the object argument to Duration.fromObject()
     * @example DateTime.local().plus(123) //~> in 123 milliseconds
     * @example DateTime.local().plus({ minutes: 15 }) //~> in 15 minutes
     * @example DateTime.local().plus({ days: 1 }) //~> this time tomorrow
     * @example DateTime.local().plus({ days: -1 }) //~> this time yesterday
     * @example DateTime.local().plus({ hours: 3, minutes: 13 }) //~> in 1 hr, 13 min
     * @example DateTime.local().plus(Duration.fromObject({ hours: 3, minutes: 13 })) //~> in 1 hr, 13 min
     * @return {DateTime}
     */
  
  
    DateTime.prototype.plus = function plus(duration) {
      if (!this.isValid) return this;
      var dur = friendlyDuration(duration);
      return clone(this, adjustTime(this, dur));
    };
  
    /**
     * Subtract a period of time to this DateTime and return the resulting DateTime
     * See {@link plus}
     * @param {Duration|Object|number} duration - The amount to subtract. Either a Luxon Duration, a number of milliseconds, the object argument to Duration.fromObject()
     @return {DateTime}
    */
  
  
    DateTime.prototype.minus = function minus(duration) {
      if (!this.isValid) return this;
      var dur = friendlyDuration(duration).negate();
      return clone(this, adjustTime(this, dur));
    };
  
    /**
     * "Set" this DateTime to the beginning of a unit of time.
     * @param {string} unit - The unit to go to the beginning of. Can be 'year', 'month', 'day', 'hour', 'minute', 'second', or 'millisecond'.
     * @example DateTime.local(2014, 3, 3).startOf('month').toISODate(); //=> '2014-03-01'
     * @example DateTime.local(2014, 3, 3).startOf('year').toISODate(); //=> '2014-01-01'
     * @example DateTime.local(2014, 3, 3, 5, 30).startOf('day').toISOTime(); //=> '00:00.000-05:00'
     * @example DateTime.local(2014, 3, 3, 5, 30).startOf('hour').toISOTime(); //=> '05:00:00.000-05:00'
     * @return {DateTime}
     */
  
  
    DateTime.prototype.startOf = function startOf(unit) {
      if (!this.isValid) return this;
      var o = {},
          normalizedUnit = Duration.normalizeUnit(unit);
      switch (normalizedUnit) {
        case 'years':
          o.month = 1;
        // falls through
        case 'quarters':
        case 'months':
          o.day = 1;
        // falls through
        case 'weeks':
        case 'days':
          o.hour = 0;
        // falls through
        case 'hours':
          o.minute = 0;
        // falls through
        case 'minutes':
          o.second = 0;
        // falls through
        case 'seconds':
          o.millisecond = 0;
          break;
        case 'milliseconds':
          break;
        default:
          throw new InvalidUnitError(unit);
      }
  
      if (normalizedUnit === 'weeks') {
        o.weekday = 1;
      }
  
      if (normalizedUnit === 'quarters') {
        var q = Math.ceil(this.month / 3);
        o.month = (q - 1) * 3 + 1;
      }
  
      return this.set(o);
    };
  
    /**
     * "Set" this DateTime to the end (i.e. the last millisecond) of a unit of time
     * @param {string} unit - The unit to go to the end of. Can be 'year', 'month', 'day', 'hour', 'minute', 'second', or 'millisecond'.
     * @example DateTime.local(2014, 3, 3).endOf('month').toISO(); //=> '2014-03-31T23:59:59.999-05:00'
     * @example DateTime.local(2014, 3, 3).endOf('year').toISO(); //=> '2014-12-31T23:59:59.999-05:00'
     * @example DateTime.local(2014, 3, 3, 5, 30).endOf('day').toISO(); //=> '2014-03-03T23:59:59.999-05:00'
     * @example DateTime.local(2014, 3, 3, 5, 30).endOf('hour').toISO(); //=> '2014-03-03T05:59:59.999-05:00'
     * @return {DateTime}
     */
  
  
    DateTime.prototype.endOf = function endOf(unit) {
      var _startOf$plus;
  
      return this.isValid ? this.startOf(unit).plus((_startOf$plus = {}, _startOf$plus[unit] = 1, _startOf$plus)).minus(1) : this;
    };
  
    // OUTPUT
  
    /**
     * Returns a string representation of this DateTime formatted according to the specified format string.
     * **You may not want this.** See {@link toLocaleString} for a more flexible formatting tool. For a table of tokens and their interpretations, see [here](https://moment.github.io/luxon/docs/manual/formatting.html#table-of-tokens).
     * Defaults to en-US if no locale has been specified, regardless of the system's locale.
     * @see https://moment.github.io/luxon/docs/manual/formatting.html#table-of-tokens
     * @param {string} fmt - the format string
     * @param {Object} opts - options
     * @param {boolean} opts.round - round numerical values
     * @example DateTime.local().toFormat('yyyy LLL dd') //=> '2017 Apr 22'
     * @example DateTime.local().setLocale('fr').toFormat('yyyy LLL dd') //=> '2017 avr. 22'
     * @example DateTime.local().toFormat("HH 'hours and' mm 'minutes'") //=> '20 hours and 55 minutes'
     * @return {string}
     */
  
  
    DateTime.prototype.toFormat = function toFormat(fmt) {
      var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  
      return this.isValid ? Formatter.create(this.loc.redefaultToEN(), opts).formatDateTimeFromString(this, fmt) : INVALID;
    };
  
    /**
     * Returns a localized string representing this date. Accepts the same options as the Intl.DateTimeFormat constructor and any presets defined by Luxon, such as `DateTime.DATE_FULL` or `DateTime.TIME_SIMPLE`.
     * The exact behavior of this method is browser-specific, but in general it will return an appropriate representation.
     * of the DateTime in the assigned locale.
     * Defaults to the system's locale if no locale has been specified
     * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat
     * @param opts {Object} - Intl.DateTimeFormat constructor options
     * @example DateTime.local().toLocaleString(); //=> 4/20/2017
     * @example DateTime.local().setLocale('en-gb').toLocaleString(); //=> '20/04/2017'
     * @example DateTime.local().toLocaleString(DateTime.DATE_FULL); //=> 'April 20, 2017'
     * @example DateTime.local().toLocaleString(DateTime.TIME_SIMPLE); //=> '11:32 AM'
     * @example DateTime.local().toLocaleString(DateTime.DATETIME_SHORT); //=> '4/20/2017, 11:32 AM'
     * @example DateTime.local().toLocaleString({weekday: 'long', month: 'long', day: '2-digit'}); //=> 'Thu, Apr 20'
     * @example DateTime.local().toLocaleString({weekday: 'long', month: 'long', day: '2-digit', hour: '2-digit', minute: '2-digit'}); //=> 'Thu, Apr 20, 11:27'
     * @example DateTime.local().toLocaleString({hour: '2-digit', minute: '2-digit'}); //=> '11:32'
     * @return {string}
     */
  
  
    DateTime.prototype.toLocaleString = function toLocaleString() {
      var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DATE_SHORT;
  
      return this.isValid ? Formatter.create(this.loc.clone(opts), opts).formatDateTime(this) : INVALID;
    };
  
    /**
     * Returns an array of format "parts", i.e. individual tokens along with metadata. This is allows callers to post-process individual sections of the formatted output.
     * Defaults to the system's locale if no locale has been specified
     * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat/formatToParts
     * @param opts {Object} - Intl.DateTimeFormat constructor options, same as `toLocaleString`.
     * @example DateTime.local().toLocaleString(); //=> [
     *                                    //=>   { type: 'day', value: '25' },
     *                                    //=>   { type: 'literal', value: '/' },
     *                                    //=>   { type: 'month', value: '05' },
     *                                    //=>   { type: 'literal', value: '/' },
     *                                    //=>   { type: 'year', value: '1982' }
     *                                    //=> ]
     */
  
  
    DateTime.prototype.toLocaleParts = function toLocaleParts() {
      var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  
      return this.isValid ? Formatter.create(this.loc.clone(opts), opts).formatDateTimeParts(this) : [];
    };
  
    /**
     * Returns an ISO 8601-compliant string representation of this DateTime
     * @param {Object} opts - options
     * @param {boolean} [opts.suppressMilliseconds=false] - exclude milliseconds from the format if they're 0
     * @param {boolean} [opts.suppressSeconds=false] - exclude seconds from the format if they're 0
     * @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00'
     * @example DateTime.utc(1982, 5, 25).toISO() //=> '1982-05-25T00:00:00.000Z'
     * @example DateTime.local().toISO() //=> '2017-04-22T20:47:05.335-04:00'
     * @example DateTime.local().toISO({ includeOffset: false }) //=> '2017-04-22T20:47:05.335'
     * @return {string}
     */
  
  
    DateTime.prototype.toISO = function toISO() {
      var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  
      if (!this.isValid) {
        return null;
      }
  
      return this.toISODate() + 'T' + this.toISOTime(opts);
    };
  
    /**
     * Returns an ISO 8601-compliant string representation of this DateTime's date component
     * @example DateTime.utc(1982, 5, 25).toISODate() //=> '1982-05-25'
     * @return {string}
     */
  
  
    DateTime.prototype.toISODate = function toISODate() {
      return toTechFormat(this, 'yyyy-MM-dd');
    };
  
    /**
     * Returns an ISO 8601-compliant string representation of this DateTime's week date
     * @example DateTime.utc(1982, 5, 25).toISOWeekDate() //=> '1982-W21-2'
     * @return {string}
     */
  
  
    DateTime.prototype.toISOWeekDate = function toISOWeekDate() {
      return toTechFormat(this, "kkkk-'W'WW-c");
    };
  
    /**
     * Returns an ISO 8601-compliant string representation of this DateTime's time component
     * @param {Object} opts - options
     * @param {boolean} [opts.suppressMilliseconds=false] - exclude milliseconds from the format if they're 0
     * @param {boolean} [opts.suppressSeconds=false] - exclude seconds from the format if they're 0
     * @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00'
     * @example DateTime.utc().hour(7).minute(34).toISOTime() //=> '07:34:19.361Z'
     * @example DateTime.utc().hour(7).minute(34).toISOTime({ suppressSeconds: true }) //=> '07:34Z'
     * @return {string}
     */
  
  
    DateTime.prototype.toISOTime = function toISOTime() {
      var _ref6 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
          _ref6$suppressMillise = _ref6.suppressMilliseconds,
          suppressMilliseconds = _ref6$suppressMillise === undefined ? false : _ref6$suppressMillise,
          _ref6$suppressSeconds = _ref6.suppressSeconds,
          suppressSeconds = _ref6$suppressSeconds === undefined ? false : _ref6$suppressSeconds,
          _ref6$includeOffset = _ref6.includeOffset,
          includeOffset = _ref6$includeOffset === undefined ? true : _ref6$includeOffset;
  
      return toTechTimeFormat(this, { suppressSeconds: suppressSeconds, suppressMilliseconds: suppressMilliseconds, includeOffset: includeOffset });
    };
  
    /**
     * Returns an RFC 2822-compatible string representation of this DateTime, always in UTC
     * @example DateTime.utc(2014, 7, 13).toRFC2822() //=> 'Sun, 13 Jul 2014 00:00:00 +0000'
     * @example DateTime.local(2014, 7, 13).toRFC2822() //=> 'Sun, 13 Jul 2014 00:00:00 -0400'
     * @return {string}
     */
  
  
    DateTime.prototype.toRFC2822 = function toRFC2822() {
      return toTechFormat(this, 'EEE, dd LLL yyyy hh:mm:ss ZZZ');
    };
  
    /**
     * Returns a string representation of this DateTime appropriate for use in HTTP headers.
     * Specifically, the string conforms to RFC 1123.
     * @see https://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3.1
     * @example DateTime.utc(2014, 7, 13).toHTTP() //=> 'Sun, 13 Jul 2014 00:00:00 GMT'
     * @example DateTime.utc(2014, 7, 13, 19).toHTTP() //=> 'Sun, 13 Jul 2014 19:00:00 GMT'
     * @return {string}
     */
  
  
    DateTime.prototype.toHTTP = function toHTTP() {
      return toTechFormat(this.toUTC(), "EEE, dd LLL yyyy HH:mm:ss 'GMT'");
    };
  
    /**
     * Returns a string representation of this DateTime appropriate for use in SQL Date
     * @example DateTime.utc(2014, 7, 13).toSQLDate() //=> '2014-07-13'
     * @return {string}
     */
  
  
    DateTime.prototype.toSQLDate = function toSQLDate() {
      return toTechFormat(this, 'yyyy-MM-dd');
    };
  
    /**
     * Returns a string representation of this DateTime appropriate for use in SQL Time
     * @param {Object} opts - options
     * @param {boolean} [opts.includeZone=false] - include the zone, such as 'America/New_York'. Overides includeOffset.
     * @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00'
     * @example DateTime.utc().toSQL() //=> '05:15:16.345'
     * @example DateTime.local().toSQL() //=> '05:15:16.345 -04:00'
     * @example DateTime.local().toSQL({ includeOffset: false }) //=> '05:15:16.345'
     * @example DateTime.local().toSQL({ includeZone: false }) //=> '05:15:16.345 America/New_York'
     * @return {string}
     */
  
  
    DateTime.prototype.toSQLTime = function toSQLTime() {
      var _ref7 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
          _ref7$includeOffset = _ref7.includeOffset,
          includeOffset = _ref7$includeOffset === undefined ? true : _ref7$includeOffset,
          _ref7$includeZone = _ref7.includeZone,
          includeZone = _ref7$includeZone === undefined ? false : _ref7$includeZone;
  
      return toTechTimeFormat(this, { includeOffset: includeOffset, includeZone: includeZone, spaceZone: true });
    };
  
    /**
     * Returns a string representation of this DateTime appropriate for use in SQL DateTime
     * @param {Object} opts - options
     * @param {boolean} [opts.includeZone=false] - include the zone, such as 'America/New_York'. Overrides includeOffset.
     * @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00'
     * @example DateTime.utc(2014, 7, 13).toSQL() //=> '2014-07-13 00:00:00.000 Z'
     * @example DateTime.local(2014, 7, 13).toSQL() //=> '2014-07-13 00:00:00.000 -04:00'
     * @example DateTime.local(2014, 7, 13).toSQL({ includeOffset: false }) //=> '2014-07-13 00:00:00.000'
     * @example DateTime.local(2014, 7, 13).toSQL({ includeZone: false }) //=> '2014-07-13 00:00:00.000 America/New_York'
     * @return {string}
     */
  
  
    DateTime.prototype.toSQL = function toSQL() {
      var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  
      if (!this.isValid) {
        return null;
      }
  
      return this.toSQLDate() + ' ' + this.toSQLTime(opts);
    };
  
    /**
     * Returns a string representation of this DateTime appropriate for debugging
     * @return {string}
     */
  
  
    DateTime.prototype.toString = function toString() {
      return this.isValid ? this.toISO() : INVALID;
    };
  
    /**
     * Returns a string representation of this DateTime appropriate for the REPL.
     * @return {string}
     */
  
  
    DateTime.prototype[customInspectSymbol] = function () {
      if (this.isValid) {
        return 'DateTime {\n  ts: ' + this.toISO() + ',\n  zone: ' + this.zone.name + ',\n  locale: ' + this.locale + ' }';
      } else {
        return 'DateTime { Invalid, reason: ' + this.invalidReason + ' }';
      }
    };
  
    /**
     * Returns the epoch milliseconds of this DateTime. Alias of {@link toMillis}
     * @return {number}
     */
  
  
    DateTime.prototype.valueOf = function valueOf() {
      return this.toMillis();
    };
  
    /**
     * Returns the epoch milliseconds of this DateTime.
     * @return {number}
     */
  
  
    DateTime.prototype.toMillis = function toMillis() {
      return this.isValid ? this.ts : NaN;
    };
  
    /**
     * Returns an ISO 8601 representation of this DateTime appropriate for use in JSON.
     * @return {string}
     */
  
  
    DateTime.prototype.toJSON = function toJSON() {
      return this.toISO();
    };
  
    /**
     * Returns a BSON serializable equivalent to this DateTime.
     * @return {Date}
     */
  
  
    DateTime.prototype.toBSON = function toBSON() {
      return this.toJSDate();
    };
  
    /**
     * Returns a Javascript object with this DateTime's year, month, day, and so on.
     * @param opts - options for generating the object
     * @param {boolean} [opts.includeConfig=false] - include configuration attributes in the output
     * @example DateTime.local().toObject() //=> { year: 2017, month: 4, day: 22, hour: 20, minute: 49, second: 42, millisecond: 268 }
     * @return {Object}
     */
  
  
    DateTime.prototype.toObject = function toObject() {
      var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  
      if (!this.isValid) return {};
  
      var base = Object.assign({}, this.c);
  
      if (opts.includeConfig) {
        base.outputCalendar = this.outputCalendar;
        base.numberingSystem = this.loc.numberingSystem;
        base.locale = this.loc.locale;
      }
      return base;
    };
  
    /**
     * Returns a Javascript Date equivalent to this DateTime.
     * @return {Date}
     */
  
  
    DateTime.prototype.toJSDate = function toJSDate() {
      return new Date(this.isValid ? this.ts : NaN);
    };
  
    // COMPARE
  
    /**
     * Return the difference between two DateTimes as a Duration.
     * @param {DateTime} otherDateTime - the DateTime to compare this one to
     * @param {string|string[]} [unit=['milliseconds']] - the unit or array of units (such as 'hours' or 'days') to include in the duration.
     * @param {Object} opts - options that affect the creation of the Duration
     * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use
     * @example
     * var i1 = DateTime.fromISO('1982-05-25T09:45'),
     *     i2 = DateTime.fromISO('1983-10-14T10:30');
     * i2.diff(i1).toObject() //=> { milliseconds: 43807500000 }
     * i2.diff(i1, 'hours').toObject() //=> { hours: 12168.75 }
     * i2.diff(i1, ['months', 'days']).toObject() //=> { months: 16, days: 19.03125 }
     * i2.diff(i1, ['months', 'days', 'hours']).toObject() //=> { months: 16, days: 19, hours: 0.75 }
     * @return {Duration}
     */
  
  
    DateTime.prototype.diff = function diff(otherDateTime) {
      var unit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'milliseconds';
      var opts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  
      if (!this.isValid || !otherDateTime.isValid) return Duration.invalid(this.invalidReason || otherDateTime.invalidReason);
  
      var units = maybeArray(unit).map(Duration.normalizeUnit),
          otherIsLater = otherDateTime.valueOf() > this.valueOf(),
          earlier = otherIsLater ? this : otherDateTime,
          later = otherIsLater ? otherDateTime : this,
          diffed = _diff(earlier, later, units, opts);
  
      return otherIsLater ? diffed.negate() : diffed;
    };
  
    /**
     * Return the difference between this DateTime and right now.
     * See {@link diff}
     * @param {string|string[]} [unit=['milliseconds']] - the unit or units units (such as 'hours' or 'days') to include in the duration
     * @param {Object} opts - options that affect the creation of the Duration
     * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use
     * @return {Duration}
     */
  
  
    DateTime.prototype.diffNow = function diffNow() {
      var unit = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'milliseconds';
      var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  
      return this.diff(DateTime.local(), unit, opts);
    };
  
    /**
     * Return an Interval spanning between this DateTime and another DateTime
     * @param {DateTime} otherDateTime - the other end point of the Interval
     * @return {Interval}
     */
  
  
    DateTime.prototype.until = function until(otherDateTime) {
      return this.isValid ? Interval.fromDateTimes(this, otherDateTime) : this;
    };
  
    /**
     * Return whether this DateTime is in the same unit of time as another DateTime
     * @param {DateTime} otherDateTime - the other DateTime
     * @param {string} unit - the unit of time to check sameness on
     * @example DateTime.local().hasSame(otherDT, 'day'); //~> true if both the same calendar day
     * @return {boolean}
     */
  
  
    DateTime.prototype.hasSame = function hasSame(otherDateTime, unit) {
      if (!this.isValid) return false;
      if (unit === 'millisecond') {
        return this.valueOf() === otherDateTime.valueOf();
      } else {
        var inputMs = otherDateTime.valueOf();
        return this.startOf(unit) <= inputMs && inputMs <= this.endOf(unit);
      }
    };
  
    /**
     * Equality check
     * Two DateTimes are equal iff they represent the same millisecond, have the same zone and location, and are both valid.
     * To compare just the millisecond values, use `+dt1 === ~dt2`.
     * @param {DateTime} other - the other DateTime
     * @return {boolean}
     */
  
  
    DateTime.prototype.equals = function equals(other) {
      return this.isValid && other.isValid && this.valueOf() === other.valueOf() && this.zone.equals(other.zone) && this.loc.equals(other.loc);
    };
  
    /**
     * Return the min of several date times
     * @param {...DateTime} dateTimes - the DateTimes from which to choose the minimum
     * @return {DateTime} the min DateTime, or undefined if called with no argument
     */
  
  
    DateTime.min = function min() {
      for (var _len = arguments.length, dateTimes = Array(_len), _key = 0; _key < _len; _key++) {
        dateTimes[_key] = arguments[_key];
      }
  
      return bestBy(dateTimes, function (i) {
        return i.valueOf();
      }, Math.min);
    };
  
    /**
     * Return the max of several date times
     * @param {...DateTime} dateTimes - the DateTimes from which to choose the maximum
     * @return {DateTime} the max DateTime, or undefined if called with no argument
     */
  
  
    DateTime.max = function max() {
      for (var _len2 = arguments.length, dateTimes = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
        dateTimes[_key2] = arguments[_key2];
      }
  
      return bestBy(dateTimes, function (i) {
        return i.valueOf();
      }, Math.max);
    };
  
    // MISC
  
    /**
     * Explain how a string would be parsed by fromFormat()
     * @param {string} text - the string to parse
     * @param {string} fmt - the format the string is expected to be in (see description)
     * @param {Object} options - options taken by fromFormat()
     * @return {Object}
     */
  
  
    DateTime.fromFormatExplain = function fromFormatExplain(text, fmt) {
      var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
      var _options$locale2 = options.locale,
          locale = _options$locale2 === undefined ? null : _options$locale2,
          _options$numberingSys2 = options.numberingSystem,
          numberingSystem = _options$numberingSys2 === undefined ? null : _options$numberingSys2,
          localeToUse = Locale.fromOpts({ locale: locale, numberingSystem: numberingSystem, defaultToEN: true });
  
      return explainFromTokens(localeToUse, text, fmt);
    };
  
    /**
     * @deprecated use fromFormatExplain instead
     */
  
  
    DateTime.fromStringExplain = function fromStringExplain(text, fmt) {
      var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  
      return DateTime.fromFormatExplain(text, fmt, options);
    };
  
    // FORMAT PRESETS
  
    /**
     * {@link toLocaleString} format like 10/14/1983
     * @type {Object}
     */
  
  
    createClass(DateTime, [{
      key: 'isValid',
      get: function get$$1() {
        return this.invalidReason === null;
      }
  
      /**
       * Returns an explanation of why this DateTime became invalid, or null if the DateTime is valid
       * @type {string}
       */
  
    }, {
      key: 'invalidReason',
      get: function get$$1() {
        return this.invalid;
      }
  
      /**
       * Get the locale of a DateTime, such 'en-GB'. The locale is used when formatting the DateTime
       *
       * @type {string}
       */
  
    }, {
      key: 'locale',
      get: function get$$1() {
        return this.isValid ? this.loc.locale : null;
      }
  
      /**
       * Get the numbering system of a DateTime, such 'beng'. The numbering system is used when formatting the DateTime
       *
       * @type {string}
       */
  
    }, {
      key: 'numberingSystem',
      get: function get$$1() {
        return this.isValid ? this.loc.numberingSystem : null;
      }
  
      /**
       * Get the output calendar of a DateTime, such 'islamic'. The output calendar is used when formatting the DateTime
       *
       * @type {string}
       */
  
    }, {
      key: 'outputCalendar',
      get: function get$$1() {
        return this.isValid ? this.loc.outputCalendar : null;
      }
  
      /**
       * Get the name of the time zone.
       * @type {string}
       */
  
    }, {
      key: 'zoneName',
      get: function get$$1() {
        return this.isValid ? this.zone.name : null;
      }
  
      /**
       * Get the year
       * @example DateTime.local(2017, 5, 25).year //=> 2017
       * @type {number}
       */
  
    }, {
      key: 'year',
      get: function get$$1() {
        return this.isValid ? this.c.year : NaN;
      }
  
      /**
       * Get the quarter
       * @example DateTime.local(2017, 5, 25).quarter //=> 2
       * @type {number}
       */
  
    }, {
      key: 'quarter',
      get: function get$$1() {
        return this.isValid ? Math.ceil(this.c.month / 3) : NaN;
      }
      /**
       * Get the month (1-12).
       * @example DateTime.local(2017, 5, 25).month //=> 5
       * @type {number}
       */
  
    }, {
      key: 'month',
      get: function get$$1() {
        return this.isValid ? this.c.month : NaN;
      }
  
      /**
       * Get the day of the month (1-30ish).
       * @example DateTime.local(2017, 5, 25).day //=> 25
       * @type {number}
       */
  
    }, {
      key: 'day',
      get: function get$$1() {
        return this.isValid ? this.c.day : NaN;
      }
  
      /**
       * Get the hour of the day (0-23).
       * @example DateTime.local(2017, 5, 25, 9).hour //=> 9
       * @type {number}
       */
  
    }, {
      key: 'hour',
      get: function get$$1() {
        return this.isValid ? this.c.hour : NaN;
      }
  
      /**
       * Get the minute of the hour (0-59).
       * @example DateTime.local(2017, 5, 25, 9, 30).minute //=> 30
       * @type {number}
       */
  
    }, {
      key: 'minute',
      get: function get$$1() {
        return this.isValid ? this.c.minute : NaN;
      }
  
      /**
       * Get the second of the minute (0-59).
       * @example DateTime.local(2017, 5, 25, 9, 30, 52).second //=> 52
       * @type {number}
       */
  
    }, {
      key: 'second',
      get: function get$$1() {
        return this.isValid ? this.c.second : NaN;
      }
  
      /**
       * Get the millisecond of the second (0-999).
       * @example DateTime.local(2017, 5, 25, 9, 30, 52, 654).millisecond //=> 654
       * @type {number}
       */
  
    }, {
      key: 'millisecond',
      get: function get$$1() {
        return this.isValid ? this.c.millisecond : NaN;
      }
  
      /**
       * Get the week year
       * @see https://en.wikipedia.org/wiki/ISO_week_date
       * @example DateTime.local(2014, 11, 31).weekYear //=> 2015
       * @type {number}
       */
  
    }, {
      key: 'weekYear',
      get: function get$$1() {
        return this.isValid ? possiblyCachedWeekData(this).weekYear : NaN;
      }
  
      /**
       * Get the week number of the week year (1-52ish).
       * @see https://en.wikipedia.org/wiki/ISO_week_date
       * @example DateTime.local(2017, 5, 25).weekNumber //=> 21
       * @type {number}
       */
  
    }, {
      key: 'weekNumber',
      get: function get$$1() {
        return this.isValid ? possiblyCachedWeekData(this).weekNumber : NaN;
      }
  
      /**
       * Get the day of the week.
       * 1 is Monday and 7 is Sunday
       * @see https://en.wikipedia.org/wiki/ISO_week_date
       * @example DateTime.local(2014, 11, 31).weekday //=> 4
       * @type {number}
       */
  
    }, {
      key: 'weekday',
      get: function get$$1() {
        return this.isValid ? possiblyCachedWeekData(this).weekday : NaN;
      }
  
      /**
       * Get the ordinal (i.e. the day of the year)
       * @example DateTime.local(2017, 5, 25).ordinal //=> 145
       * @type {number|DateTime}
       */
  
    }, {
      key: 'ordinal',
      get: function get$$1() {
        return this.isValid ? gregorianToOrdinal(this.c).ordinal : NaN;
      }
  
      /**
       * Get the human readable short month name, such as 'Oct'.
       * Defaults to the system's locale if no locale has been specified
       * @example DateTime.local(2017, 10, 30).monthShort //=> Oct
       * @type {string}
       */
  
    }, {
      key: 'monthShort',
      get: function get$$1() {
        return this.isValid ? Info.months('short', { locale: this.locale })[this.month - 1] : null;
      }
  
      /**
       * Get the human readable long month name, such as 'October'.
       * Defaults to the system's locale if no locale has been specified
       * @example DateTime.local(2017, 10, 30).monthLong //=> October
       * @type {string}
       */
  
    }, {
      key: 'monthLong',
      get: function get$$1() {
        return this.isValid ? Info.months('long', { locale: this.locale })[this.month - 1] : null;
      }
  
      /**
       * Get the human readable short weekday, such as 'Mon'.
       * Defaults to the system's locale if no locale has been specified
       * @example DateTime.local(2017, 10, 30).weekdayShort //=> Mon
       * @type {string}
       */
  
    }, {
      key: 'weekdayShort',
      get: function get$$1() {
        return this.isValid ? Info.weekdays('short', { locale: this.locale })[this.weekday - 1] : null;
      }
  
      /**
       * Get the human readable long weekday, such as 'Monday'.
       * Defaults to the system's locale if no locale has been specified
       * @example DateTime.local(2017, 10, 30).weekdayLong //=> Monday
       * @type {string}
       */
  
    }, {
      key: 'weekdayLong',
      get: function get$$1() {
        return this.isValid ? Info.weekdays('long', { locale: this.locale })[this.weekday - 1] : null;
      }
  
      /**
       * Get the UTC offset of this DateTime in minutes
       * @example DateTime.local().offset //=> -240
       * @example DateTime.utc().offset //=> 0
       * @type {number}
       */
  
    }, {
      key: 'offset',
      get: function get$$1() {
        return this.isValid ? this.zone.offset(this.ts) : NaN;
      }
  
      /**
       * Get the short human name for the zone's current offset, for example "EST" or "EDT".
       * Defaults to the system's locale if no locale has been specified
       * @type {string}
       */
  
    }, {
      key: 'offsetNameShort',
      get: function get$$1() {
        if (this.isValid) {
          return this.zone.offsetName(this.ts, {
            format: 'short',
            locale: this.locale
          });
        } else {
          return null;
        }
      }
  
      /**
       * Get the long human name for the zone's current offset, for example "Eastern Standard Time" or "Eastern Daylight Time".
       * Defaults to the system's locale if no locale has been specified
       * @type {string}
       */
  
    }, {
      key: 'offsetNameLong',
      get: function get$$1() {
        if (this.isValid) {
          return this.zone.offsetName(this.ts, {
            format: 'long',
            locale: this.locale
          });
        } else {
          return null;
        }
      }
  
      /**
       * Get whether this zone's offset ever changes, as in a DST.
       * @type {boolean}
       */
  
    }, {
      key: 'isOffsetFixed',
      get: function get$$1() {
        return this.isValid ? this.zone.universal : null;
      }
  
      /**
       * Get whether the DateTime is in a DST.
       * @type {boolean}
       */
  
    }, {
      key: 'isInDST',
      get: function get$$1() {
        if (this.isOffsetFixed) {
          return false;
        } else {
          return this.offset > this.set({ month: 1 }).offset || this.offset > this.set({ month: 5 }).offset;
        }
      }
  
      /**
       * Returns true if this DateTime is in a leap year, false otherwise
       * @example DateTime.local(2016).isInLeapYear //=> true
       * @example DateTime.local(2013).isInLeapYear //=> false
       * @type {boolean}
       */
  
    }, {
      key: 'isInLeapYear',
      get: function get$$1() {
        return isLeapYear(this.year);
      }
  
      /**
       * Returns the number of days in this DateTime's month
       * @example DateTime.local(2016, 2).daysInMonth //=> 29
       * @example DateTime.local(2016, 3).daysInMonth //=> 31
       * @type {number}
       */
  
    }, {
      key: 'daysInMonth',
      get: function get$$1() {
        return daysInMonth(this.year, this.month);
      }
  
      /**
       * Returns the number of days in this DateTime's year
       * @example DateTime.local(2016).daysInYear //=> 366
       * @example DateTime.local(2013).daysInYear //=> 365
       * @type {number}
       */
  
    }, {
      key: 'daysInYear',
      get: function get$$1() {
        return this.isValid ? daysInYear(this.year) : NaN;
      }
  
      /**
       * Returns the number of weeks in this DateTime's year
       * @see https://en.wikipedia.org/wiki/ISO_week_date
       * @example DateTime.local(2004).weeksInWeekYear //=> 53
       * @example DateTime.local(2013).weeksInWeekYear //=> 52
       * @type {number}
       */
  
    }, {
      key: 'weeksInWeekYear',
      get: function get$$1() {
        return this.isValid ? weeksInWeekYear(this.weekYear) : NaN;
      }
    }], [{
      key: 'DATE_SHORT',
      get: function get$$1() {
        return DATE_SHORT;
      }
  
      /**
       * {@link toLocaleString} format like 'Oct 14, 1983'
       * @type {Object}
       */
  
    }, {
      key: 'DATE_MED',
      get: function get$$1() {
        return DATE_MED;
      }
  
      /**
       * {@link toLocaleString} format like 'October 14, 1983'
       * @type {Object}
       */
  
    }, {
      key: 'DATE_FULL',
      get: function get$$1() {
        return DATE_FULL;
      }
  
      /**
       * {@link toLocaleString} format like 'Tuesday, October 14, 1983'
       * @type {Object}
       */
  
    }, {
      key: 'DATE_HUGE',
      get: function get$$1() {
        return DATE_HUGE;
      }
  
      /**
       * {@link toLocaleString} format like '09:30 AM'. Only 12-hour if the locale is.
       * @type {Object}
       */
  
    }, {
      key: 'TIME_SIMPLE',
      get: function get$$1() {
        return TIME_SIMPLE;
      }
  
      /**
       * {@link toLocaleString} format like '09:30:23 AM'. Only 12-hour if the locale is.
       * @type {Object}
       */
  
    }, {
      key: 'TIME_WITH_SECONDS',
      get: function get$$1() {
        return TIME_WITH_SECONDS;
      }
  
      /**
       * {@link toLocaleString} format like '09:30:23 AM EDT'. Only 12-hour if the locale is.
       * @type {Object}
       */
  
    }, {
      key: 'TIME_WITH_SHORT_OFFSET',
      get: function get$$1() {
        return TIME_WITH_SHORT_OFFSET;
      }
  
      /**
       * {@link toLocaleString} format like '09:30:23 AM Eastern Daylight Time'. Only 12-hour if the locale is.
       * @type {Object}
       */
  
    }, {
      key: 'TIME_WITH_LONG_OFFSET',
      get: function get$$1() {
        return TIME_WITH_LONG_OFFSET;
      }
  
      /**
       * {@link toLocaleString} format like '09:30', always 24-hour.
       * @type {Object}
       */
  
    }, {
      key: 'TIME_24_SIMPLE',
      get: function get$$1() {
        return TIME_24_SIMPLE;
      }
  
      /**
       * {@link toLocaleString} format like '09:30:23', always 24-hour.
       * @type {Object}
       */
  
    }, {
      key: 'TIME_24_WITH_SECONDS',
      get: function get$$1() {
        return TIME_24_WITH_SECONDS;
      }
  
      /**
       * {@link toLocaleString} format like '09:30:23 EDT', always 24-hour.
       * @type {Object}
       */
  
    }, {
      key: 'TIME_24_WITH_SHORT_OFFSET',
      get: function get$$1() {
        return TIME_24_WITH_SHORT_OFFSET;
      }
  
      /**
       * {@link toLocaleString} format like '09:30:23 Eastern Daylight Time', always 24-hour.
       * @type {Object}
       */
  
    }, {
      key: 'TIME_24_WITH_LONG_OFFSET',
      get: function get$$1() {
        return TIME_24_WITH_LONG_OFFSET;
      }
  
      /**
       * {@link toLocaleString} format like '10/14/1983, 9:30 AM'. Only 12-hour if the locale is.
       * @type {Object}
       */
  
    }, {
      key: 'DATETIME_SHORT',
      get: function get$$1() {
        return DATETIME_SHORT;
      }
  
      /**
       * {@link toLocaleString} format like '10/14/1983, 9:30:33 AM'. Only 12-hour if the locale is.
       * @type {Object}
       */
  
    }, {
      key: 'DATETIME_SHORT_WITH_SECONDS',
      get: function get$$1() {
        return DATETIME_SHORT_WITH_SECONDS;
      }
  
      /**
       * {@link toLocaleString} format like 'Oct 14, 1983, 9:30 AM'. Only 12-hour if the locale is.
       * @type {Object}
       */
  
    }, {
      key: 'DATETIME_MED',
      get: function get$$1() {
        return DATETIME_MED;
      }
  
      /**
       * {@link toLocaleString} format like 'Oct 14, 1983, 9:30:33 AM'. Only 12-hour if the locale is.
       * @type {Object}
       */
  
    }, {
      key: 'DATETIME_MED_WITH_SECONDS',
      get: function get$$1() {
        return DATETIME_MED_WITH_SECONDS;
      }
  
      /**
       * {@link toLocaleString} format like 'October 14, 1983, 9:30 AM EDT'. Only 12-hour if the locale is.
       * @type {Object}
       */
  
    }, {
      key: 'DATETIME_FULL',
      get: function get$$1() {
        return DATETIME_FULL;
      }
  
      /**
       * {@link toLocaleString} format like 'October 14, 1983, 9:30:33 AM EDT'. Only 12-hour if the locale is.
       * @type {Object}
       */
  
    }, {
      key: 'DATETIME_FULL_WITH_SECONDS',
      get: function get$$1() {
        return DATETIME_FULL_WITH_SECONDS;
      }
  
      /**
       * {@link toLocaleString} format like 'Friday, October 14, 1983, 9:30 AM Eastern Daylight Time'. Only 12-hour if the locale is.
       * @type {Object}
       */
  
    }, {
      key: 'DATETIME_HUGE',
      get: function get$$1() {
        return DATETIME_HUGE;
      }
  
      /**
       * {@link toLocaleString} format like 'Friday, October 14, 1983, 9:30:33 AM Eastern Daylight Time'. Only 12-hour if the locale is.
       * @type {Object}
       */
  
    }, {
      key: 'DATETIME_HUGE_WITH_SECONDS',
      get: function get$$1() {
        return DATETIME_HUGE_WITH_SECONDS;
      }
    }]);
    return DateTime;
  }();
  
  function friendlyDateTime(dateTimeish) {
    if (dateTimeish instanceof DateTime) {
      return dateTimeish;
    } else if (dateTimeish.valueOf && isNumber(dateTimeish.valueOf())) {
      return DateTime.fromJSDate(dateTimeish);
    } else if ((typeof dateTimeish === 'undefined' ? 'undefined' : _typeof(dateTimeish)) === 'object') {
      return DateTime.fromObject(dateTimeish);
    } else {
      throw new InvalidArgumentError('Unknown datetime argument');
    }
  }
  
  exports.DateTime = DateTime;
  exports.Duration = Duration;
  exports.Interval = Interval;
  exports.Info = Info;
  exports.Zone = Zone;
  exports.FixedOffsetZone = FixedOffsetZone;
  exports.IANAZone = IANAZone;
  exports.LocalZone = LocalZone;
  exports.Settings = Settings;
  //# sourceMappingURL=luxon.js.map
  
  
  /***/ }),
  /* 3 */
  /***/ (function(module, exports, __webpack_require__) {
  
  /* WEBPACK VAR INJECTION */(function(global, process) {// Copyright Joyent, Inc. and other Node contributors.
  //
  // Permission is hereby granted, free of charge, to any person obtaining a
  // copy of this software and associated documentation files (the
  // "Software"), to deal in the Software without restriction, including
  // without limitation the rights to use, copy, modify, merge, publish,
  // distribute, sublicense, and/or sell copies of the Software, and to permit
  // persons to whom the Software is furnished to do so, subject to the
  // following conditions:
  //
  // The above copyright notice and this permission notice shall be included
  // in all copies or substantial portions of the Software.
  //
  // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  // USE OR OTHER DEALINGS IN THE SOFTWARE.
  
  var formatRegExp = /%[sdj%]/g;
  exports.format = function(f) {
    if (!isString(f)) {
      var objects = [];
      for (var i = 0; i < arguments.length; i++) {
        objects.push(inspect(arguments[i]));
      }
      return objects.join(' ');
    }
  
    var i = 1;
    var args = arguments;
    var len = args.length;
    var str = String(f).replace(formatRegExp, function(x) {
      if (x === '%%') return '%';
      if (i >= len) return x;
      switch (x) {
        case '%s': return String(args[i++]);
        case '%d': return Number(args[i++]);
        case '%j':
          try {
            return JSON.stringify(args[i++]);
          } catch (_) {
            return '[Circular]';
          }
        default:
          return x;
      }
    });
    for (var x = args[i]; i < len; x = args[++i]) {
      if (isNull(x) || !isObject(x)) {
        str += ' ' + x;
      } else {
        str += ' ' + inspect(x);
      }
    }
    return str;
  };
  
  
  // Mark that a method should not be used.
  // Returns a modified function which warns once by default.
  // If --no-deprecation is set, then it is a no-op.
  exports.deprecate = function(fn, msg) {
    // Allow for deprecating things in the process of starting up.
    if (isUndefined(global.process)) {
      return function() {
        return exports.deprecate(fn, msg).apply(this, arguments);
      };
    }
  
    if (process.noDeprecation === true) {
      return fn;
    }
  
    var warned = false;
    function deprecated() {
      if (!warned) {
        if (process.throwDeprecation) {
          throw new Error(msg);
        } else if (process.traceDeprecation) {
          console.trace(msg);
        } else {
          console.error(msg);
        }
        warned = true;
      }
      return fn.apply(this, arguments);
    }
  
    return deprecated;
  };
  
  
  var debugs = {};
  var debugEnviron;
  exports.debuglog = function(set) {
    if (isUndefined(debugEnviron))
      debugEnviron = process.env.NODE_DEBUG || '';
    set = set.toUpperCase();
    if (!debugs[set]) {
      if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) {
        var pid = process.pid;
        debugs[set] = function() {
          var msg = exports.format.apply(exports, arguments);
          console.error('%s %d: %s', set, pid, msg);
        };
      } else {
        debugs[set] = function() {};
      }
    }
    return debugs[set];
  };
  
  
  /**
   * Echos the value of a value. Trys to print the value out
   * in the best way possible given the different types.
   *
   * @param {Object} obj The object to print out.
   * @param {Object} opts Optional options object that alters the output.
   */
  /* legacy: obj, showHidden, depth, colors*/
  function inspect(obj, opts) {
    // default options
    var ctx = {
      seen: [],
      stylize: stylizeNoColor
    };
    // legacy...
    if (arguments.length >= 3) ctx.depth = arguments[2];
    if (arguments.length >= 4) ctx.colors = arguments[3];
    if (isBoolean(opts)) {
      // legacy...
      ctx.showHidden = opts;
    } else if (opts) {
      // got an "options" object
      exports._extend(ctx, opts);
    }
    // set default options
    if (isUndefined(ctx.showHidden)) ctx.showHidden = false;
    if (isUndefined(ctx.depth)) ctx.depth = 2;
    if (isUndefined(ctx.colors)) ctx.colors = false;
    if (isUndefined(ctx.customInspect)) ctx.customInspect = true;
    if (ctx.colors) ctx.stylize = stylizeWithColor;
    return formatValue(ctx, obj, ctx.depth);
  }
  exports.inspect = inspect;
  
  
  // http://en.wikipedia.org/wiki/ANSI_escape_code#graphics
  inspect.colors = {
    'bold' : [1, 22],
    'italic' : [3, 23],
    'underline' : [4, 24],
    'inverse' : [7, 27],
    'white' : [37, 39],
    'grey' : [90, 39],
    'black' : [30, 39],
    'blue' : [34, 39],
    'cyan' : [36, 39],
    'green' : [32, 39],
    'magenta' : [35, 39],
    'red' : [31, 39],
    'yellow' : [33, 39]
  };
  
  // Don't use 'blue' not visible on cmd.exe
  inspect.styles = {
    'special': 'cyan',
    'number': 'yellow',
    'boolean': 'yellow',
    'undefined': 'grey',
    'null': 'bold',
    'string': 'green',
    'date': 'magenta',
    // "name": intentionally not styling
    'regexp': 'red'
  };
  
  
  function stylizeWithColor(str, styleType) {
    var style = inspect.styles[styleType];
  
    if (style) {
      return '\u001b[' + inspect.colors[style][0] + 'm' + str +
             '\u001b[' + inspect.colors[style][1] + 'm';
    } else {
      return str;
    }
  }
  
  
  function stylizeNoColor(str, styleType) {
    return str;
  }
  
  
  function arrayToHash(array) {
    var hash = {};
  
    array.forEach(function(val, idx) {
      hash[val] = true;
    });
  
    return hash;
  }
  
  
  function formatValue(ctx, value, recurseTimes) {
    // Provide a hook for user-specified inspect functions.
    // Check that value is an object with an inspect function on it
    if (ctx.customInspect &&
        value &&
        isFunction(value.inspect) &&
        // Filter out the util module, it's inspect function is special
        value.inspect !== exports.inspect &&
        // Also filter out any prototype objects using the circular check.
        !(value.constructor && value.constructor.prototype === value)) {
      var ret = value.inspect(recurseTimes, ctx);
      if (!isString(ret)) {
        ret = formatValue(ctx, ret, recurseTimes);
      }
      return ret;
    }
  
    // Primitive types cannot have properties
    var primitive = formatPrimitive(ctx, value);
    if (primitive) {
      return primitive;
    }
  
    // Look up the keys of the object.
    var keys = Object.keys(value);
    var visibleKeys = arrayToHash(keys);
  
    if (ctx.showHidden) {
      keys = Object.getOwnPropertyNames(value);
    }
  
    // IE doesn't make error fields non-enumerable
    // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx
    if (isError(value)
        && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {
      return formatError(value);
    }
  
    // Some type of object without properties can be shortcutted.
    if (keys.length === 0) {
      if (isFunction(value)) {
        var name = value.name ? ': ' + value.name : '';
        return ctx.stylize('[Function' + name + ']', 'special');
      }
      if (isRegExp(value)) {
        return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
      }
      if (isDate(value)) {
        return ctx.stylize(Date.prototype.toString.call(value), 'date');
      }
      if (isError(value)) {
        return formatError(value);
      }
    }
  
    var base = '', array = false, braces = ['{', '}'];
  
    // Make Array say that they are Array
    if (isArray(value)) {
      array = true;
      braces = ['[', ']'];
    }
  
    // Make functions say that they are functions
    if (isFunction(value)) {
      var n = value.name ? ': ' + value.name : '';
      base = ' [Function' + n + ']';
    }
  
    // Make RegExps say that they are RegExps
    if (isRegExp(value)) {
      base = ' ' + RegExp.prototype.toString.call(value);
    }
  
    // Make dates with properties first say the date
    if (isDate(value)) {
      base = ' ' + Date.prototype.toUTCString.call(value);
    }
  
    // Make error with message first say the error
    if (isError(value)) {
      base = ' ' + formatError(value);
    }
  
    if (keys.length === 0 && (!array || value.length == 0)) {
      return braces[0] + base + braces[1];
    }
  
    if (recurseTimes < 0) {
      if (isRegExp(value)) {
        return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
      } else {
        return ctx.stylize('[Object]', 'special');
      }
    }
  
    ctx.seen.push(value);
  
    var output;
    if (array) {
      output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);
    } else {
      output = keys.map(function(key) {
        return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);
      });
    }
  
    ctx.seen.pop();
  
    return reduceToSingleString(output, base, braces);
  }
  
  
  function formatPrimitive(ctx, value) {
    if (isUndefined(value))
      return ctx.stylize('undefined', 'undefined');
    if (isString(value)) {
      var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '')
                                               .replace(/'/g, "\\'")
                                               .replace(/\\"/g, '"') + '\'';
      return ctx.stylize(simple, 'string');
    }
    if (isNumber(value))
      return ctx.stylize('' + value, 'number');
    if (isBoolean(value))
      return ctx.stylize('' + value, 'boolean');
    // For some reason typeof null is "object", so special case here.
    if (isNull(value))
      return ctx.stylize('null', 'null');
  }
  
  
  function formatError(value) {
    return '[' + Error.prototype.toString.call(value) + ']';
  }
  
  
  function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
    var output = [];
    for (var i = 0, l = value.length; i < l; ++i) {
      if (hasOwnProperty(value, String(i))) {
        output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
            String(i), true));
      } else {
        output.push('');
      }
    }
    keys.forEach(function(key) {
      if (!key.match(/^\d+$/)) {
        output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
            key, true));
      }
    });
    return output;
  }
  
  
  function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
    var name, str, desc;
    desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };
    if (desc.get) {
      if (desc.set) {
        str = ctx.stylize('[Getter/Setter]', 'special');
      } else {
        str = ctx.stylize('[Getter]', 'special');
      }
    } else {
      if (desc.set) {
        str = ctx.stylize('[Setter]', 'special');
      }
    }
    if (!hasOwnProperty(visibleKeys, key)) {
      name = '[' + key + ']';
    }
    if (!str) {
      if (ctx.seen.indexOf(desc.value) < 0) {
        if (isNull(recurseTimes)) {
          str = formatValue(ctx, desc.value, null);
        } else {
          str = formatValue(ctx, desc.value, recurseTimes - 1);
        }
        if (str.indexOf('\n') > -1) {
          if (array) {
            str = str.split('\n').map(function(line) {
              return '  ' + line;
            }).join('\n').substr(2);
          } else {
            str = '\n' + str.split('\n').map(function(line) {
              return '   ' + line;
            }).join('\n');
          }
        }
      } else {
        str = ctx.stylize('[Circular]', 'special');
      }
    }
    if (isUndefined(name)) {
      if (array && key.match(/^\d+$/)) {
        return str;
      }
      name = JSON.stringify('' + key);
      if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) {
        name = name.substr(1, name.length - 2);
        name = ctx.stylize(name, 'name');
      } else {
        name = name.replace(/'/g, "\\'")
                   .replace(/\\"/g, '"')
                   .replace(/(^"|"$)/g, "'");
        name = ctx.stylize(name, 'string');
      }
    }
  
    return name + ': ' + str;
  }
  
  
  function reduceToSingleString(output, base, braces) {
    var numLinesEst = 0;
    var length = output.reduce(function(prev, cur) {
      numLinesEst++;
      if (cur.indexOf('\n') >= 0) numLinesEst++;
      return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1;
    }, 0);
  
    if (length > 60) {
      return braces[0] +
             (base === '' ? '' : base + '\n ') +
             ' ' +
             output.join(',\n  ') +
             ' ' +
             braces[1];
    }
  
    return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];
  }
  
  
  // NOTE: These type checking functions intentionally don't use `instanceof`
  // because it is fragile and can be easily faked with `Object.create()`.
  function isArray(ar) {
    return Array.isArray(ar);
  }
  exports.isArray = isArray;
  
  function isBoolean(arg) {
    return typeof arg === 'boolean';
  }
  exports.isBoolean = isBoolean;
  
  function isNull(arg) {
    return arg === null;
  }
  exports.isNull = isNull;
  
  function isNullOrUndefined(arg) {
    return arg == null;
  }
  exports.isNullOrUndefined = isNullOrUndefined;
  
  function isNumber(arg) {
    return typeof arg === 'number';
  }
  exports.isNumber = isNumber;
  
  function isString(arg) {
    return typeof arg === 'string';
  }
  exports.isString = isString;
  
  function isSymbol(arg) {
    return typeof arg === 'symbol';
  }
  exports.isSymbol = isSymbol;
  
  function isUndefined(arg) {
    return arg === void 0;
  }
  exports.isUndefined = isUndefined;
  
  function isRegExp(re) {
    return isObject(re) && objectToString(re) === '[object RegExp]';
  }
  exports.isRegExp = isRegExp;
  
  function isObject(arg) {
    return typeof arg === 'object' && arg !== null;
  }
  exports.isObject = isObject;
  
  function isDate(d) {
    return isObject(d) && objectToString(d) === '[object Date]';
  }
  exports.isDate = isDate;
  
  function isError(e) {
    return isObject(e) &&
        (objectToString(e) === '[object Error]' || e instanceof Error);
  }
  exports.isError = isError;
  
  function isFunction(arg) {
    return typeof arg === 'function';
  }
  exports.isFunction = isFunction;
  
  function isPrimitive(arg) {
    return arg === null ||
           typeof arg === 'boolean' ||
           typeof arg === 'number' ||
           typeof arg === 'string' ||
           typeof arg === 'symbol' ||  // ES6 symbol
           typeof arg === 'undefined';
  }
  exports.isPrimitive = isPrimitive;
  
  exports.isBuffer = __webpack_require__(6);
  
  function objectToString(o) {
    return Object.prototype.toString.call(o);
  }
  
  
  function pad(n) {
    return n < 10 ? '0' + n.toString(10) : n.toString(10);
  }
  
  
  var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',
                'Oct', 'Nov', 'Dec'];
  
  // 26 Feb 16:19:34
  function timestamp() {
    var d = new Date();
    var time = [pad(d.getHours()),
                pad(d.getMinutes()),
                pad(d.getSeconds())].join(':');
    return [d.getDate(), months[d.getMonth()], time].join(' ');
  }
  
  
  // log is just a thin wrapper to console.log that prepends a timestamp
  exports.log = function() {
    console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));
  };
  
  
  /**
   * Inherit the prototype methods from one constructor into another.
   *
   * The Function.prototype.inherits from lang.js rewritten as a standalone
   * function (not on Function.prototype). NOTE: If this file is to be loaded
   * during bootstrapping this function needs to be rewritten using some native
   * functions as prototype setup using normal JavaScript does not work as
   * expected during bootstrapping (see mirror.js in r114903).
   *
   * @param {function} ctor Constructor function which needs to inherit the
   *     prototype.
   * @param {function} superCtor Constructor function to inherit prototype from.
   */
  exports.inherits = __webpack_require__(7);
  
  exports._extend = function(origin, add) {
    // Don't do anything if add isn't an object
    if (!add || !isObject(add)) return origin;
  
    var keys = Object.keys(add);
    var i = keys.length;
    while (i--) {
      origin[keys[i]] = add[keys[i]];
    }
    return origin;
  };
  
  function hasOwnProperty(obj, prop) {
    return Object.prototype.hasOwnProperty.call(obj, prop);
  }
  
  /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(4), __webpack_require__(5)))
  
  /***/ }),
  /* 4 */
  /***/ (function(module, exports) {
  
  var g;
  
  // This works in non-strict mode
  g = (function() {
  	return this;
  })();
  
  try {
  	// This works if eval is allowed (see CSP)
  	g = g || Function("return this")() || (1, eval)("this");
  } catch (e) {
  	// This works if the window reference is available
  	if (typeof window === "object") g = window;
  }
  
  // g can still be undefined, but nothing to do about it...
  // We return undefined, instead of nothing here, so it's
  // easier to handle this case. if(!global) { ...}
  
  module.exports = g;
  
  
  /***/ }),
  /* 5 */
  /***/ (function(module, exports) {
  
  // shim for using process in browser
  var process = module.exports = {};
  
  // cached from whatever global is present so that test runners that stub it
  // don't break things.  But we need to wrap it in a try catch in case it is
  // wrapped in strict mode code which doesn't define any globals.  It's inside a
  // function because try/catches deoptimize in certain engines.
  
  var cachedSetTimeout;
  var cachedClearTimeout;
  
  function defaultSetTimout() {
      throw new Error('setTimeout has not been defined');
  }
  function defaultClearTimeout () {
      throw new Error('clearTimeout has not been defined');
  }
  (function () {
      try {
          if (typeof setTimeout === 'function') {
              cachedSetTimeout = setTimeout;
          } else {
              cachedSetTimeout = defaultSetTimout;
          }
      } catch (e) {
          cachedSetTimeout = defaultSetTimout;
      }
      try {
          if (typeof clearTimeout === 'function') {
              cachedClearTimeout = clearTimeout;
          } else {
              cachedClearTimeout = defaultClearTimeout;
          }
      } catch (e) {
          cachedClearTimeout = defaultClearTimeout;
      }
  } ())
  function runTimeout(fun) {
      if (cachedSetTimeout === setTimeout) {
          //normal enviroments in sane situations
          return setTimeout(fun, 0);
      }
      // if setTimeout wasn't available but was latter defined
      if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
          cachedSetTimeout = setTimeout;
          return setTimeout(fun, 0);
      }
      try {
          // when when somebody has screwed with setTimeout but no I.E. maddness
          return cachedSetTimeout(fun, 0);
      } catch(e){
          try {
              // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
              return cachedSetTimeout.call(null, fun, 0);
          } catch(e){
              // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
              return cachedSetTimeout.call(this, fun, 0);
          }
      }
  
  
  }
  function runClearTimeout(marker) {
      if (cachedClearTimeout === clearTimeout) {
          //normal enviroments in sane situations
          return clearTimeout(marker);
      }
      // if clearTimeout wasn't available but was latter defined
      if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
          cachedClearTimeout = clearTimeout;
          return clearTimeout(marker);
      }
      try {
          // when when somebody has screwed with setTimeout but no I.E. maddness
          return cachedClearTimeout(marker);
      } catch (e){
          try {
              // When we are in I.E. but the script has been evaled so I.E. doesn't  trust the global object when called normally
              return cachedClearTimeout.call(null, marker);
          } catch (e){
              // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
              // Some versions of I.E. have different rules for clearTimeout vs setTimeout
              return cachedClearTimeout.call(this, marker);
          }
      }
  
  
  
  }
  var queue = [];
  var draining = false;
  var currentQueue;
  var queueIndex = -1;
  
  function cleanUpNextTick() {
      if (!draining || !currentQueue) {
          return;
      }
      draining = false;
      if (currentQueue.length) {
          queue = currentQueue.concat(queue);
      } else {
          queueIndex = -1;
      }
      if (queue.length) {
          drainQueue();
      }
  }
  
  function drainQueue() {
      if (draining) {
          return;
      }
      var timeout = runTimeout(cleanUpNextTick);
      draining = true;
  
      var len = queue.length;
      while(len) {
          currentQueue = queue;
          queue = [];
          while (++queueIndex < len) {
              if (currentQueue) {
                  currentQueue[queueIndex].run();
              }
          }
          queueIndex = -1;
          len = queue.length;
      }
      currentQueue = null;
      draining = false;
      runClearTimeout(timeout);
  }
  
  process.nextTick = function (fun) {
      var args = new Array(arguments.length - 1);
      if (arguments.length > 1) {
          for (var i = 1; i < arguments.length; i++) {
              args[i - 1] = arguments[i];
          }
      }
      queue.push(new Item(fun, args));
      if (queue.length === 1 && !draining) {
          runTimeout(drainQueue);
      }
  };
  
  // v8 likes predictible objects
  function Item(fun, array) {
      this.fun = fun;
      this.array = array;
  }
  Item.prototype.run = function () {
      this.fun.apply(null, this.array);
  };
  process.title = 'browser';
  process.browser = true;
  process.env = {};
  process.argv = [];
  process.version = ''; // empty string to avoid regexp issues
  process.versions = {};
  
  function noop() {}
  
  process.on = noop;
  process.addListener = noop;
  process.once = noop;
  process.off = noop;
  process.removeListener = noop;
  process.removeAllListeners = noop;
  process.emit = noop;
  process.prependListener = noop;
  process.prependOnceListener = noop;
  
  process.listeners = function (name) { return [] }
  
  process.binding = function (name) {
      throw new Error('process.binding is not supported');
  };
  
  process.cwd = function () { return '/' };
  process.chdir = function (dir) {
      throw new Error('process.chdir is not supported');
  };
  process.umask = function() { return 0; };
  
  
  /***/ }),
  /* 6 */
  /***/ (function(module, exports) {
  
  module.exports = function isBuffer(arg) {
    return arg && typeof arg === 'object'
      && typeof arg.copy === 'function'
      && typeof arg.fill === 'function'
      && typeof arg.readUInt8 === 'function';
  }
  
  /***/ }),
  /* 7 */
  /***/ (function(module, exports) {
  
  if (typeof Object.create === 'function') {
    // implementation from standard node.js 'util' module
    module.exports = function inherits(ctor, superCtor) {
      ctor.super_ = superCtor
      ctor.prototype = Object.create(superCtor.prototype, {
        constructor: {
          value: ctor,
          enumerable: false,
          writable: true,
          configurable: true
        }
      });
    };
  } else {
    // old school shim for old browsers
    module.exports = function inherits(ctor, superCtor) {
      ctor.super_ = superCtor
      var TempCtor = function () {}
      TempCtor.prototype = superCtor.prototype
      ctor.prototype = new TempCtor()
      ctor.prototype.constructor = ctor
    }
  }
  
  
  /***/ }),
  /* 8 */
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
  
  "use strict";
  __webpack_require__.r(__webpack_exports__);
  
  // CONCATENATED MODULE: ./src/nlp/i18n.ts
  // =============================================================================
  // i18n
  // =============================================================================
  var ENGLISH = {
      dayNames: [
          'Sunday', 'Monday', 'Tuesday', 'Wednesday',
          'Thursday', 'Friday', 'Saturday'
      ],
      monthNames: [
          'January', 'February', 'March', 'April', 'May',
          'June', 'July', 'August', 'September', 'October',
          'November', 'December'
      ],
      tokens: {
          'SKIP': /^[ \r\n\t]+|^\.$/,
          'number': /^[1-9][0-9]*/,
          'numberAsText': /^(one|two|three)/i,
          'every': /^every/i,
          'day(s)': /^days?/i,
          'weekday(s)': /^weekdays?/i,
          'week(s)': /^weeks?/i,
          'hour(s)': /^hours?/i,
          'minute(s)': /^minutes?/i,
          'month(s)': /^months?/i,
          'year(s)': /^years?/i,
          'on': /^(on|in)/i,
          'at': /^(at)/i,
          'the': /^the/i,
          'first': /^first/i,
          'second': /^second/i,
          'third': /^third/i,
          'nth': /^([1-9][0-9]*)(\.|th|nd|rd|st)/i,
          'last': /^last/i,
          'for': /^for/i,
          'time(s)': /^times?/i,
          'until': /^(un)?til/i,
          'monday': /^mo(n(day)?)?/i,
          'tuesday': /^tu(e(s(day)?)?)?/i,
          'wednesday': /^we(d(n(esday)?)?)?/i,
          'thursday': /^th(u(r(sday)?)?)?/i,
          'friday': /^fr(i(day)?)?/i,
          'saturday': /^sa(t(urday)?)?/i,
          'sunday': /^su(n(day)?)?/i,
          'january': /^jan(uary)?/i,
          'february': /^feb(ruary)?/i,
          'march': /^mar(ch)?/i,
          'april': /^apr(il)?/i,
          'may': /^may/i,
          'june': /^june?/i,
          'july': /^july?/i,
          'august': /^aug(ust)?/i,
          'september': /^sep(t(ember)?)?/i,
          'october': /^oct(ober)?/i,
          'november': /^nov(ember)?/i,
          'december': /^dec(ember)?/i,
          'comma': /^(,\s*|(and|or)\s*)+/i
      }
  };
  /* harmony default export */ var i18n = (ENGLISH);
  
  // EXTERNAL MODULE: ./src/index.ts + 23 modules
  var src = __webpack_require__(1);
  
  // EXTERNAL MODULE: ./src/helpers.ts
  var helpers = __webpack_require__(0);
  
  // CONCATENATED MODULE: ./src/nlp/totext.ts
  
  
  
  // =============================================================================
  // Helper functions
  // =============================================================================
  /**
   * Return true if a value is in an array
   */
  var contains = function (arr, val) {
      return arr.indexOf(val) !== -1;
  };
  var defaultGetText = function (id) { return id.toString(); };
  var defaultDateFormatter = function (year, month, day) { return month + " " + day + ", " + year; };
  /**
   *
   * @param {RRule} rrule
   * Optional:
   * @param {Function} gettext function
   * @param {Object} language definition
   * @constructor
   */
  var totext_ToText = /** @class */ (function () {
      function ToText(rrule, gettext, language, dateFormatter) {
          if (gettext === void 0) { gettext = defaultGetText; }
          if (language === void 0) { language = i18n; }
          if (dateFormatter === void 0) { dateFormatter = defaultDateFormatter; }
          this.text = [];
          this.language = language || i18n;
          this.gettext = gettext;
          this.dateFormatter = dateFormatter;
          this.rrule = rrule;
          this.options = rrule.options;
          this.origOptions = rrule.origOptions;
          if (this.origOptions.bymonthday) {
              var bymonthday = [].concat(this.options.bymonthday);
              var bynmonthday = [].concat(this.options.bynmonthday);
              bymonthday.sort(function (a, b) { return a - b; });
              bynmonthday.sort(function (a, b) { return b - a; });
              // 1, 2, 3, .., -5, -4, -3, ..
              this.bymonthday = bymonthday.concat(bynmonthday);
              if (!this.bymonthday.length)
                  this.bymonthday = null;
          }
          if (Object(helpers["f" /* isPresent */])(this.origOptions.byweekday)) {
              var byweekday = !Object(helpers["d" /* isArray */])(this.origOptions.byweekday)
                  ? [this.origOptions.byweekday]
                  : this.origOptions.byweekday;
              var days = String(byweekday);
              this.byweekday = {
                  allWeeks: byweekday.filter(function (weekday) {
                      return !weekday.n;
                  }),
                  someWeeks: byweekday.filter(function (weekday) {
                      return Boolean(weekday.n);
                  }),
                  isWeekdays: days.indexOf('MO') !== -1 &&
                      days.indexOf('TU') !== -1 &&
                      days.indexOf('WE') !== -1 &&
                      days.indexOf('TH') !== -1 &&
                      days.indexOf('FR') !== -1 &&
                      days.indexOf('SA') === -1 &&
                      days.indexOf('SU') === -1,
                  isEveryDay: days.indexOf('MO') !== -1 &&
                      days.indexOf('TU') !== -1 &&
                      days.indexOf('WE') !== -1 &&
                      days.indexOf('TH') !== -1 &&
                      days.indexOf('FR') !== -1 &&
                      days.indexOf('SA') !== -1 &&
                      days.indexOf('SU') !== -1
              };
              var sortWeekDays = function (a, b) {
                  return a.weekday - b.weekday;
              };
              this.byweekday.allWeeks.sort(sortWeekDays);
              this.byweekday.someWeeks.sort(sortWeekDays);
              if (!this.byweekday.allWeeks.length)
                  this.byweekday.allWeeks = null;
              if (!this.byweekday.someWeeks.length)
                  this.byweekday.someWeeks = null;
          }
          else {
              this.byweekday = null;
          }
      }
      /**
       * Test whether the rrule can be fully converted to text.
       * @param {RRule} rrule
       * @return {Boolean}
       */
      ToText.isFullyConvertible = function (rrule) {
          var canConvert = true;
          if (!(rrule.options.freq in ToText.IMPLEMENTED))
              return false;
          if (rrule.origOptions.until && rrule.origOptions.count)
              return false;
          for (var key in rrule.origOptions) {
              if (contains(['dtstart', 'wkst', 'freq'], key))
                  return true;
              if (!contains(ToText.IMPLEMENTED[rrule.options.freq], key))
                  return false;
          }
          return canConvert;
      };
      ToText.prototype.isFullyConvertible = function () {
          return ToText.isFullyConvertible(this.rrule);
      };
      /**
       * Perform the conversion. Only some of the frequencies are supported.
       * If some of the rrule's options aren't supported, they'll
       * be omitted from the output an "(~ approximate)" will be appended.
       * @return {*}
       */
      ToText.prototype.toString = function () {
          var gettext = this.gettext;
          if (!(this.options.freq in ToText.IMPLEMENTED)) {
              return gettext('RRule error: Unable to fully convert this rrule to text');
          }
          this.text = [gettext('every')];
          // @ts-ignore
          this[src["default"].FREQUENCIES[this.options.freq]]();
          if (this.options.until) {
              this.add(gettext('until'));
              var until = this.options.until;
              this.add(this.dateFormatter(until.getUTCFullYear(), this.language.monthNames[until.getUTCMonth()], until.getUTCDate()));
          }
          else if (this.options.count) {
              this.add(gettext('for'))
                  .add(this.options.count.toString())
                  .add(this.plural(this.options.count) ? gettext('times') : gettext('time'));
          }
          if (!this.isFullyConvertible())
              this.add(gettext('(~ approximate)'));
          return this.text.join('');
      };
      ToText.prototype.HOURLY = function () {
          var gettext = this.gettext;
          if (this.options.interval !== 1)
              this.add(this.options.interval.toString());
          this.add(this.plural(this.options.interval) ? gettext('hours') : gettext('hour'));
      };
      ToText.prototype.MINUTELY = function () {
          var gettext = this.gettext;
          if (this.options.interval !== 1)
              this.add(this.options.interval.toString());
          this.add(this.plural(this.options.interval)
              ? gettext('minutes')
              : gettext('minutes'));
      };
      ToText.prototype.DAILY = function () {
          var gettext = this.gettext;
          if (this.options.interval !== 1)
              this.add(this.options.interval.toString());
          if (this.byweekday && this.byweekday.isWeekdays) {
              this.add(this.plural(this.options.interval)
                  ? gettext('weekdays')
                  : gettext('weekday'));
          }
          else {
              this.add(this.plural(this.options.interval) ? gettext('days') : gettext('day'));
          }
          if (this.origOptions.bymonth) {
              this.add(gettext('in'));
              this._bymonth();
          }
          if (this.bymonthday) {
              this._bymonthday();
          }
          else if (this.byweekday) {
              this._byweekday();
          }
          else if (this.origOptions.byhour) {
              this._byhour();
          }
      };
      ToText.prototype.WEEKLY = function () {
          var gettext = this.gettext;
          if (this.options.interval !== 1) {
              this.add(this.options.interval.toString()).add(this.plural(this.options.interval) ? gettext('weeks') : gettext('week'));
          }
          if (this.byweekday && this.byweekday.isWeekdays) {
              if (this.options.interval === 1) {
                  this.add(this.plural(this.options.interval)
                      ? gettext('weekdays')
                      : gettext('weekday'));
              }
              else {
                  this.add(gettext('on')).add(gettext('weekdays'));
              }
          }
          else if (this.byweekday && this.byweekday.isEveryDay) {
              this.add(this.plural(this.options.interval) ? gettext('days') : gettext('day'));
          }
          else {
              if (this.options.interval === 1)
                  this.add(gettext('week'));
              if (this.origOptions.bymonth) {
                  this.add(gettext('in'));
                  this._bymonth();
              }
              if (this.bymonthday) {
                  this._bymonthday();
              }
              else if (this.byweekday) {
                  this._byweekday();
              }
          }
      };
      ToText.prototype.MONTHLY = function () {
          var gettext = this.gettext;
          if (this.origOptions.bymonth) {
              if (this.options.interval !== 1) {
                  this.add(this.options.interval.toString()).add(gettext('months'));
                  if (this.plural(this.options.interval))
                      this.add(gettext('in'));
              }
              else {
                  // this.add(gettext('MONTH'))
              }
              this._bymonth();
          }
          else {
              if (this.options.interval !== 1)
                  this.add(this.options.interval.toString());
              this.add(this.plural(this.options.interval)
                  ? gettext('months')
                  : gettext('month'));
          }
          if (this.bymonthday) {
              this._bymonthday();
          }
          else if (this.byweekday && this.byweekday.isWeekdays) {
              this.add(gettext('on')).add(gettext('weekdays'));
          }
          else if (this.byweekday) {
              this._byweekday();
          }
      };
      ToText.prototype.YEARLY = function () {
          var gettext = this.gettext;
          if (this.origOptions.bymonth) {
              if (this.options.interval !== 1) {
                  this.add(this.options.interval.toString());
                  this.add(gettext('years'));
              }
              else {
                  // this.add(gettext('YEAR'))
              }
              this._bymonth();
          }
          else {
              if (this.options.interval !== 1)
                  this.add(this.options.interval.toString());
              this.add(this.plural(this.options.interval) ? gettext('years') : gettext('year'));
          }
          if (this.bymonthday) {
              this._bymonthday();
          }
          else if (this.byweekday) {
              this._byweekday();
          }
          if (this.options.byyearday) {
              this.add(gettext('on the'))
                  .add(this.list(this.options.byyearday, this.nth, gettext('and')))
                  .add(gettext('day'));
          }
          if (this.options.byweekno) {
              this.add(gettext('in'))
                  .add(this.plural(this.options.byweekno.length)
                  ? gettext('weeks')
                  : gettext('week'))
                  .add(this.list(this.options.byweekno, undefined, gettext('and')));
          }
      };
      ToText.prototype._bymonthday = function () {
          var gettext = this.gettext;
          if (this.byweekday && this.byweekday.allWeeks) {
              this.add(gettext('on'))
                  .add(this.list(this.byweekday.allWeeks, this.weekdaytext, gettext('or')))
                  .add(gettext('the'))
                  .add(this.list(this.bymonthday, this.nth, gettext('or')));
          }
          else {
              this.add(gettext('on the')).add(this.list(this.bymonthday, this.nth, gettext('and')));
          }
          // this.add(gettext('DAY'))
      };
      ToText.prototype._byweekday = function () {
          var gettext = this.gettext;
          if (this.byweekday.allWeeks && !this.byweekday.isWeekdays) {
              this.add(gettext('on')).add(this.list(this.byweekday.allWeeks, this.weekdaytext));
          }
          if (this.byweekday.someWeeks) {
              if (this.byweekday.allWeeks)
                  this.add(gettext('and'));
              this.add(gettext('on the')).add(this.list(this.byweekday.someWeeks, this.weekdaytext, gettext('and')));
          }
      };
      ToText.prototype._byhour = function () {
          var gettext = this.gettext;
          this.add(gettext('at')).add(this.list(this.origOptions.byhour, undefined, gettext('and')));
      };
      ToText.prototype._bymonth = function () {
          this.add(this.list(this.options.bymonth, this.monthtext, this.gettext('and')));
      };
      ToText.prototype.nth = function (n) {
          n = parseInt(n.toString(), 10);
          var nth;
          var npos;
          var gettext = this.gettext;
          if (n === -1)
              return gettext('last');
          npos = Math.abs(n);
          switch (npos) {
              case 1:
              case 21:
              case 31:
                  nth = npos + gettext('st');
                  break;
              case 2:
              case 22:
                  nth = npos + gettext('nd');
                  break;
              case 3:
              case 23:
                  nth = npos + gettext('rd');
                  break;
              default:
                  nth = npos + gettext('th');
          }
          return n < 0 ? nth + ' ' + gettext('last') : nth;
      };
      ToText.prototype.monthtext = function (m) {
          return this.language.monthNames[m - 1];
      };
      ToText.prototype.weekdaytext = function (wday) {
          var weekday = Object(helpers["e" /* isNumber */])(wday) ? (wday + 1) % 7 : wday.getJsWeekday();
          return ((wday.n ? this.nth(wday.n) + ' ' : '') + this.language.dayNames[weekday]);
      };
      ToText.prototype.plural = function (n) {
          return n % 100 !== 1;
      };
      ToText.prototype.add = function (s) {
          this.text.push(' ');
          this.text.push(s);
          return this;
      };
      ToText.prototype.list = function (arr, callback, finalDelim, delim) {
          if (delim === void 0) { delim = ','; }
          if (!Object(helpers["d" /* isArray */])(arr)) {
              arr = [arr];
          }
          var delimJoin = function (array, delimiter, finalDelimiter) {
              var list = '';
              for (var i = 0; i < array.length; i++) {
                  if (i !== 0) {
                      if (i === array.length - 1) {
                          list += ' ' + finalDelimiter + ' ';
                      }
                      else {
                          list += delimiter + ' ';
                      }
                  }
                  list += array[i];
              }
              return list;
          };
          callback =
              callback ||
                  function (o) {
                      return o.toString();
                  };
          var self = this;
          var realCallback = function (arg) {
              return callback && callback.call(self, arg);
          };
          if (finalDelim) {
              return delimJoin(arr.map(realCallback), delim, finalDelim);
          }
          else {
              return arr.map(realCallback).join(delim + ' ');
          }
      };
      return ToText;
  }());
  /* harmony default export */ var totext = (totext_ToText);
  
  // CONCATENATED MODULE: ./src/nlp/parsetext.ts
  
  
  // =============================================================================
  // Parser
  // =============================================================================
  var Parser = /** @class */ (function () {
      function Parser(rules) {
          this.done = true;
          this.rules = rules;
      }
      Parser.prototype.start = function (text) {
          this.text = text;
          this.done = false;
          return this.nextSymbol();
      };
      Parser.prototype.isDone = function () {
          return this.done && this.symbol === null;
      };
      Parser.prototype.nextSymbol = function () {
          var best;
          var bestSymbol;
          var p = this;
          this.symbol = null;
          this.value = null;
          do {
              if (this.done)
                  return false;
              var rule = void 0;
              best = null;
              for (var name_1 in this.rules) {
                  rule = this.rules[name_1];
                  var match = rule.exec(p.text);
                  if (match) {
                      if (best === null || match[0].length > best[0].length) {
                          best = match;
                          bestSymbol = name_1;
                      }
                  }
              }
              if (best != null) {
                  this.text = this.text.substr(best[0].length);
                  if (this.text === '')
                      this.done = true;
              }
              if (best == null) {
                  this.done = true;
                  this.symbol = null;
                  this.value = null;
                  return;
              }
              // @ts-ignore
          } while (bestSymbol === 'SKIP');
          // @ts-ignore
          this.symbol = bestSymbol;
          this.value = best;
          return true;
      };
      Parser.prototype.accept = function (name) {
          if (this.symbol === name) {
              if (this.value) {
                  var v = this.value;
                  this.nextSymbol();
                  return v;
              }
              this.nextSymbol();
              return true;
          }
          return false;
      };
      Parser.prototype.acceptNumber = function () {
          return this.accept('number');
      };
      Parser.prototype.expect = function (name) {
          if (this.accept(name))
              return true;
          throw new Error('expected ' + name + ' but found ' + this.symbol);
      };
      return Parser;
  }());
  function parseText(text, language) {
      if (language === void 0) { language = i18n; }
      var options = {};
      var ttr = new Parser(language.tokens);
      if (!ttr.start(text))
          return null;
      S();
      return options;
      function S() {
          // every [n]
          ttr.expect('every');
          var n = ttr.acceptNumber();
          if (n)
              options.interval = parseInt(n[0], 10);
          if (ttr.isDone())
              throw new Error('Unexpected end');
          switch (ttr.symbol) {
              case 'day(s)':
                  options.freq = src["default"].DAILY;
                  if (ttr.nextSymbol()) {
                      AT();
                      F();
                  }
                  break;
              // FIXME Note: every 2 weekdays != every two weeks on weekdays.
              // DAILY on weekdays is not a valid rule
              case 'weekday(s)':
                  options.freq = src["default"].WEEKLY;
                  options.byweekday = [
                      src["default"].MO,
                      src["default"].TU,
                      src["default"].WE,
                      src["default"].TH,
                      src["default"].FR
                  ];
                  ttr.nextSymbol();
                  F();
                  break;
              case 'week(s)':
                  options.freq = src["default"].WEEKLY;
                  if (ttr.nextSymbol()) {
                      ON();
                      F();
                  }
                  break;
              case 'hour(s)':
                  options.freq = src["default"].HOURLY;
                  if (ttr.nextSymbol()) {
                      ON();
                      F();
                  }
                  break;
              case 'minute(s)':
                  options.freq = src["default"].MINUTELY;
                  if (ttr.nextSymbol()) {
                      ON();
                      F();
                  }
                  break;
              case 'month(s)':
                  options.freq = src["default"].MONTHLY;
                  if (ttr.nextSymbol()) {
                      ON();
                      F();
                  }
                  break;
              case 'year(s)':
                  options.freq = src["default"].YEARLY;
                  if (ttr.nextSymbol()) {
                      ON();
                      F();
                  }
                  break;
              case 'monday':
              case 'tuesday':
              case 'wednesday':
              case 'thursday':
              case 'friday':
              case 'saturday':
              case 'sunday':
                  options.freq = src["default"].WEEKLY;
                  var key = ttr.symbol.substr(0, 2).toUpperCase();
                  options.byweekday = [src["default"][key]];
                  if (!ttr.nextSymbol())
                      return;
                  // TODO check for duplicates
                  while (ttr.accept('comma')) {
                      if (ttr.isDone())
                          throw new Error('Unexpected end');
                      var wkd = decodeWKD();
                      if (!wkd) {
                          throw new Error('Unexpected symbol ' + ttr.symbol + ', expected weekday');
                      }
                      // @ts-ignore
                      options.byweekday.push(src["default"][wkd]);
                      ttr.nextSymbol();
                  }
                  MDAYs();
                  F();
                  break;
              case 'january':
              case 'february':
              case 'march':
              case 'april':
              case 'may':
              case 'june':
              case 'july':
              case 'august':
              case 'september':
              case 'october':
              case 'november':
              case 'december':
                  options.freq = src["default"].YEARLY;
                  options.bymonth = [decodeM()];
                  if (!ttr.nextSymbol())
                      return;
                  // TODO check for duplicates
                  while (ttr.accept('comma')) {
                      if (ttr.isDone())
                          throw new Error('Unexpected end');
                      var m = decodeM();
                      if (!m) {
                          throw new Error('Unexpected symbol ' + ttr.symbol + ', expected month');
                      }
                      options.bymonth.push(m);
                      ttr.nextSymbol();
                  }
                  ON();
                  F();
                  break;
              default:
                  throw new Error('Unknown symbol');
          }
      }
      function ON() {
          var on = ttr.accept('on');
          var the = ttr.accept('the');
          if (!(on || the))
              return;
          do {
              var nth = decodeNTH();
              var wkd = decodeWKD();
              var m = decodeM();
              // nth <weekday> | <weekday>
              if (nth) {
                  // ttr.nextSymbol()
                  if (wkd) {
                      ttr.nextSymbol();
                      if (!options.byweekday)
                          options.byweekday = [];
                      // @ts-ignore
                      options.byweekday.push(src["default"][wkd].nth(nth));
                  }
                  else {
                      if (!options.bymonthday)
                          options.bymonthday = [];
                      // @ts-ignore
                      options.bymonthday.push(nth);
                      ttr.accept('day(s)');
                  }
                  // <weekday>
              }
              else if (wkd) {
                  ttr.nextSymbol();
                  if (!options.byweekday)
                      options.byweekday = [];
                  // @ts-ignore
                  options.byweekday.push(src["default"][wkd]);
              }
              else if (ttr.symbol === 'weekday(s)') {
                  ttr.nextSymbol();
                  if (!options.byweekday) {
                      options.byweekday = [
                          src["default"].MO,
                          src["default"].TU,
                          src["default"].WE,
                          src["default"].TH,
                          src["default"].FR
                      ];
                  }
              }
              else if (ttr.symbol === 'week(s)') {
                  ttr.nextSymbol();
                  var n = ttr.acceptNumber();
                  if (!n) {
                      throw new Error('Unexpected symbol ' + ttr.symbol + ', expected week number');
                  }
                  options.byweekno = [parseInt(n[0], 10)];
                  while (ttr.accept('comma')) {
                      n = ttr.acceptNumber();
                      if (!n) {
                          throw new Error('Unexpected symbol ' + ttr.symbol + '; expected monthday');
                      }
                      options.byweekno.push(parseInt(n[0], 10));
                  }
              }
              else if (m) {
                  ttr.nextSymbol();
                  if (!options.bymonth)
                      options.bymonth = [];
                  // @ts-ignore
                  options.bymonth.push(m);
              }
              else {
                  return;
              }
          } while (ttr.accept('comma') || ttr.accept('the') || ttr.accept('on'));
      }
      function AT() {
          var at = ttr.accept('at');
          if (!at)
              return;
          do {
              var n = ttr.acceptNumber();
              if (!n) {
                  throw new Error('Unexpected symbol ' + ttr.symbol + ', expected hour');
              }
              options.byhour = [parseInt(n[0], 10)];
              while (ttr.accept('comma')) {
                  n = ttr.acceptNumber();
                  if (!n) {
                      throw new Error('Unexpected symbol ' + ttr.symbol + '; expected hour');
                  }
                  options.byhour.push(parseInt(n[0], 10));
              }
          } while (ttr.accept('comma') || ttr.accept('at'));
      }
      function decodeM() {
          switch (ttr.symbol) {
              case 'january':
                  return 1;
              case 'february':
                  return 2;
              case 'march':
                  return 3;
              case 'april':
                  return 4;
              case 'may':
                  return 5;
              case 'june':
                  return 6;
              case 'july':
                  return 7;
              case 'august':
                  return 8;
              case 'september':
                  return 9;
              case 'october':
                  return 10;
              case 'november':
                  return 11;
              case 'december':
                  return 12;
              default:
                  return false;
          }
      }
      function decodeWKD() {
          switch (ttr.symbol) {
              case 'monday':
              case 'tuesday':
              case 'wednesday':
              case 'thursday':
              case 'friday':
              case 'saturday':
              case 'sunday':
                  return ttr.symbol.substr(0, 2).toUpperCase();
              default:
                  return false;
          }
      }
      function decodeNTH() {
          switch (ttr.symbol) {
              case 'last':
                  ttr.nextSymbol();
                  return -1;
              case 'first':
                  ttr.nextSymbol();
                  return 1;
              case 'second':
                  ttr.nextSymbol();
                  return ttr.accept('last') ? -2 : 2;
              case 'third':
                  ttr.nextSymbol();
                  return ttr.accept('last') ? -3 : 3;
              case 'nth':
                  var v = parseInt(ttr.value[1], 10);
                  if (v < -366 || v > 366)
                      throw new Error('Nth out of range: ' + v);
                  ttr.nextSymbol();
                  return ttr.accept('last') ? -v : v;
              default:
                  return false;
          }
      }
      function MDAYs() {
          ttr.accept('on');
          ttr.accept('the');
          var nth = decodeNTH();
          if (!nth)
              return;
          options.bymonthday = [nth];
          ttr.nextSymbol();
          while (ttr.accept('comma')) {
              nth = decodeNTH();
              if (!nth) {
                  throw new Error('Unexpected symbol ' + ttr.symbol + '; expected monthday');
              }
              options.bymonthday.push(nth);
              ttr.nextSymbol();
          }
      }
      function F() {
          if (ttr.symbol === 'until') {
              var date = Date.parse(ttr.text);
              if (!date)
                  throw new Error('Cannot parse until date:' + ttr.text);
              options.until = new Date(date);
          }
          else if (ttr.accept('for')) {
              options.count = parseInt(ttr.value[0], 10);
              ttr.expect('number');
              // ttr.expect('times')
          }
      }
  }
  
  // CONCATENATED MODULE: ./src/nlp/index.ts
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fromText", function() { return fromText; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isFullyConvertible", function() { return isFullyConvertible; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "toText", function() { return toText; });
  /* concated harmony reexport */__webpack_require__.d(__webpack_exports__, "parseText", function() { return parseText; });
  
  
  
  
  /*!
  * rrule.js - Library for working with recurrence rules for calendar dates.
  * https://github.com/jakubroztocil/rrule
  *
  * Copyright 2010, Jakub Roztocil and Lars Schoning
  * Licenced under the BSD licence.
  * https://github.com/jakubroztocil/rrule/blob/master/LICENCE
  *
  */
  /**
   *
   * Implementation of RRule.fromText() and RRule::toText().
   *
   *
   * On the client side, this file needs to be included
   * when those functions are used.
   *
   */
  // =============================================================================
  // fromText
  // =============================================================================
  /**
   * Will be able to convert some of the below described rules from
   * text format to a rule object.
   *
   *
   * RULES
   *
   * Every ([n])
   *       day(s)
   *     | [weekday], ..., (and) [weekday]
   *     | weekday(s)
   *     | week(s)
   *     | month(s)
   *     | [month], ..., (and) [month]
   *     | year(s)
   *
   *
   * Plus 0, 1, or multiple of these:
   *
   * on [weekday], ..., (or) [weekday] the [monthday], [monthday], ... (or) [monthday]
   *
   * on [weekday], ..., (and) [weekday]
   *
   * on the [monthday], [monthday], ... (and) [monthday] (day of the month)
   *
   * on the [nth-weekday], ..., (and) [nth-weekday] (of the month/year)
   *
   *
   * Plus 0 or 1 of these:
   *
   * for [n] time(s)
   *
   * until [date]
   *
   * Plus (.)
   *
   *
   * Definitely no supported for parsing:
   *
   * (for year):
   *     in week(s) [n], ..., (and) [n]
   *
   *     on the [yearday], ..., (and) [n] day of the year
   *     on day [yearday], ..., (and) [n]
   *
   *
   * NON-TERMINALS
   *
   * [n]: 1, 2 ..., one, two, three ..
   * [month]: January, February, March, April, May, ... December
   * [weekday]: Monday, ... Sunday
   * [nth-weekday]: first [weekday], 2nd [weekday], ... last [weekday], ...
   * [monthday]: first, 1., 2., 1st, 2nd, second, ... 31st, last day, 2nd last day, ..
   * [date]:
   *     [month] (0-31(,) ([year])),
   *     (the) 0-31.(1-12.([year])),
   *     (the) 0-31/(1-12/([year])),
   *     [weekday]
   *
   * [year]: 0000, 0001, ... 01, 02, ..
   *
   * Definitely not supported for parsing:
   *
   * [yearday]: first, 1., 2., 1st, 2nd, second, ... 366th, last day, 2nd last day, ..
   *
   * @param {String} text
   * @return {Object, Boolean} the rule, or null.
   */
  var fromText = function (text, language) {
      if (language === void 0) { language = i18n; }
      return new src["default"](parseText(text, language) || undefined);
  };
  var common = [
      'count',
      'until',
      'interval',
      'byweekday',
      'bymonthday',
      'bymonth'
  ];
  totext.IMPLEMENTED = [];
  totext.IMPLEMENTED[src["default"].HOURLY] = common;
  totext.IMPLEMENTED[src["default"].MINUTELY] = common;
  totext.IMPLEMENTED[src["default"].DAILY] = ['byhour'].concat(common);
  totext.IMPLEMENTED[src["default"].WEEKLY] = common;
  totext.IMPLEMENTED[src["default"].MONTHLY] = common;
  totext.IMPLEMENTED[src["default"].YEARLY] = ['byweekno', 'byyearday'].concat(common);
  // =============================================================================
  // Export
  // =============================================================================
  var toText = function (rrule, gettext, language, dateFormatter) {
      return new totext(rrule, gettext, language, dateFormatter).toString();
  };
  var isFullyConvertible = totext.isFullyConvertible;
  
  
  
  /***/ })
  /******/ ]);
  });
  //# sourceMappingURL=rrule-tz.js.map