@charbytex/vue-cron-editor-vuetify
Version:
[](https://github.com/caehprogrammer/vue-cron-editor/actions)
1,192 lines (1,140 loc) • 969 kB
JavaScript
module.exports =
/******/ (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 = "fb15");
/******/ })
/************************************************************************/
/******/ ({
/***/ "01a8":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(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);
};
Object.defineProperty(exports, "__esModule", { value: true });
// This comes from the fact that parseInt trims characters coming
// after digits and consider it a valid int, so `1*` becomes `1`.
var safeParseInt = function (value) {
if (/^\d+$/.test(value)) {
return Number(value);
}
else {
return NaN;
}
};
var isWildcard = function (value) {
return value === '*';
};
var isQuestionMark = function (value) {
return value === '?';
};
var isInRange = function (value, start, stop) {
return value >= start && value <= stop;
};
var isValidRange = function (value, start, stop) {
var sides = value.split('-');
switch (sides.length) {
case 1:
return isWildcard(value) || isInRange(safeParseInt(value), start, stop);
case 2:
var _a = sides.map(function (side) { return safeParseInt(side); }), small = _a[0], big = _a[1];
return small <= big && isInRange(small, start, stop) && isInRange(big, start, stop);
default:
return false;
}
};
var isValidStep = function (value) {
return value === undefined || value.search(/[^\d]/) === -1;
};
var validateForRange = function (value, start, stop) {
if (value.search(/[^\d-,\/*]/) !== -1) {
return false;
}
var list = value.split(',');
return list.every(function (condition) {
var splits = condition.split('/');
// Prevents `*/ * * * *` from being accepted.
if (condition.trim().endsWith('/')) {
return false;
}
// Prevents `*/*/* * * * *` from being accepted
if (splits.length > 2) {
return false;
}
// If we don't have a `/`, right will be undefined which is considered a valid step if we don't a `/`.
var left = splits[0], right = splits[1];
return isValidRange(left, start, stop) && isValidStep(right);
});
};
var hasValidSeconds = function (seconds) {
return validateForRange(seconds, 0, 59);
};
var hasValidMinutes = function (minutes) {
return validateForRange(minutes, 0, 59);
};
var hasValidHours = function (hours) {
return validateForRange(hours, 0, 23);
};
var hasValidDays = function (days, allowBlankDay) {
return (allowBlankDay && isQuestionMark(days)) || validateForRange(days, 1, 31);
};
var monthAlias = {
jan: '1',
feb: '2',
mar: '3',
apr: '4',
may: '5',
jun: '6',
jul: '7',
aug: '8',
sep: '9',
oct: '10',
nov: '11',
dec: '12'
};
var hasValidMonths = function (months, alias) {
// Prevents alias to be used as steps
if (months.search(/\/[a-zA-Z]/) !== -1) {
return false;
}
if (alias) {
var remappedMonths = months.toLowerCase().replace(/[a-z]{3}/g, function (match) {
return monthAlias[match] === undefined ? match : monthAlias[match];
});
// If any invalid alias was used, it won't pass the other checks as there will be non-numeric values in the months
return validateForRange(remappedMonths, 1, 12);
}
return validateForRange(months, 1, 12);
};
var weekdaysAlias = {
sun: '0',
mon: '1',
tue: '2',
wed: '3',
thu: '4',
fri: '5',
sat: '6'
};
var hasValidWeekdays = function (weekdays, alias, allowBlankDay) {
// If there is a question mark, checks if the allowBlankDay flag is set
if (allowBlankDay && isQuestionMark(weekdays)) {
return true;
}
else if (!allowBlankDay && isQuestionMark(weekdays)) {
return false;
}
// Prevents alias to be used as steps
if (weekdays.search(/\/[a-zA-Z]/) !== -1) {
return false;
}
if (alias) {
var remappedWeekdays = weekdays.toLowerCase().replace(/[a-z]{3}/g, function (match) {
return weekdaysAlias[match] === undefined ? match : weekdaysAlias[match];
});
// If any invalid alias was used, it won't pass the other checks as there will be non-numeric values in the weekdays
return validateForRange(remappedWeekdays, 0, 6);
}
return validateForRange(weekdays, 0, 6);
};
var hasCompatibleDayFormat = function (days, weekdays, allowBlankDay) {
return !(allowBlankDay && isQuestionMark(days) && isQuestionMark(weekdays));
};
var split = function (cron) {
return cron.trim().split(/\s+/);
};
var defaultOptions = {
alias: false,
seconds: false,
allowBlankDay: false
};
exports.isValidCron = function (cron, options) {
options = __assign(__assign({}, defaultOptions), options);
var splits = split(cron);
if (splits.length > (options.seconds ? 6 : 5) || splits.length < 5) {
return false;
}
var checks = [];
if (splits.length === 6) {
var seconds = splits.shift();
if (seconds) {
checks.push(hasValidSeconds(seconds));
}
}
// We could only check the steps gradually and return false on the first invalid block,
// However, this won't have any performance impact so why bother for now.
var minutes = splits[0], hours = splits[1], days = splits[2], months = splits[3], weekdays = splits[4];
checks.push(hasValidMinutes(minutes));
checks.push(hasValidHours(hours));
checks.push(hasValidDays(days, options.allowBlankDay));
checks.push(hasValidMonths(months, options.alias));
checks.push(hasValidWeekdays(weekdays, options.alias, options.allowBlankDay));
checks.push(hasCompatibleDayFormat(days, weekdays, options.allowBlankDay));
return checks.every(Boolean);
};
//# sourceMappingURL=index.js.map
/***/ }),
/***/ "0366":
/***/ (function(module, exports, __webpack_require__) {
var aFunction = __webpack_require__("1c0b");
// optional / simple context binding
module.exports = function (fn, that, length) {
aFunction(fn);
if (that === undefined) return fn;
switch (length) {
case 0: return function () {
return fn.call(that);
};
case 1: return function (a) {
return fn.call(that, a);
};
case 2: return function (a, b) {
return fn.call(that, a, b);
};
case 3: return function (a, b, c) {
return fn.call(that, a, b, c);
};
}
return function (/* ...args */) {
return fn.apply(that, arguments);
};
};
/***/ }),
/***/ "057f":
/***/ (function(module, exports, __webpack_require__) {
var toIndexedObject = __webpack_require__("fc6a");
var nativeGetOwnPropertyNames = __webpack_require__("241c").f;
var toString = {}.toString;
var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames
? Object.getOwnPropertyNames(window) : [];
var getWindowNames = function (it) {
try {
return nativeGetOwnPropertyNames(it);
} catch (error) {
return windowNames.slice();
}
};
// fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window
module.exports.f = function getOwnPropertyNames(it) {
return windowNames && toString.call(it) == '[object Window]'
? getWindowNames(it)
: nativeGetOwnPropertyNames(toIndexedObject(it));
};
/***/ }),
/***/ "06cf":
/***/ (function(module, exports, __webpack_require__) {
var DESCRIPTORS = __webpack_require__("83ab");
var propertyIsEnumerableModule = __webpack_require__("d1e7");
var createPropertyDescriptor = __webpack_require__("5c6c");
var toIndexedObject = __webpack_require__("fc6a");
var toPrimitive = __webpack_require__("c04e");
var has = __webpack_require__("5135");
var IE8_DOM_DEFINE = __webpack_require__("0cfb");
var nativeGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
// `Object.getOwnPropertyDescriptor` method
// https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptor
exports.f = DESCRIPTORS ? nativeGetOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {
O = toIndexedObject(O);
P = toPrimitive(P, true);
if (IE8_DOM_DEFINE) try {
return nativeGetOwnPropertyDescriptor(O, P);
} catch (error) { /* empty */ }
if (has(O, P)) return createPropertyDescriptor(!propertyIsEnumerableModule.f.call(O, P), O[P]);
};
/***/ }),
/***/ "0b4c":
/***/ (function(module, exports, __webpack_require__) {
// Imports
var ___CSS_LOADER_API_IMPORT___ = __webpack_require__("24fb");
exports = ___CSS_LOADER_API_IMPORT___(false);
// Module
exports.push([module.i, ".v-progress-circular{position:relative;display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;vertical-align:middle;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.v-progress-circular>svg{width:100%;height:100%;margin:auto;position:absolute;top:0;bottom:0;left:0;right:0;z-index:0}.v-progress-circular--indeterminate>svg{-webkit-animation:progress-circular-rotate 1.4s linear infinite;animation:progress-circular-rotate 1.4s linear infinite;-webkit-transform-origin:center center;transform-origin:center center;-webkit-transition:all .2s ease-in-out;transition:all .2s ease-in-out}.v-progress-circular--indeterminate .v-progress-circular__overlay{-webkit-animation:progress-circular-dash 1.4s ease-in-out infinite;animation:progress-circular-dash 1.4s ease-in-out infinite;stroke-linecap:round;stroke-dasharray:80,200;stroke-dashoffset:0px}.v-progress-circular__info{-webkit-box-align:center;-ms-flex-align:center;align-items:center;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center}.v-progress-circular__underlay{stroke:hsla(0,0%,62%,.4);z-index:1}.v-progress-circular__overlay{stroke:currentColor;z-index:2;-webkit-transition:all .6s ease-in-out;transition:all .6s ease-in-out}@-webkit-keyframes progress-circular-dash{0%{stroke-dasharray:1,200;stroke-dashoffset:0px}50%{stroke-dasharray:100,200;stroke-dashoffset:-15px}to{stroke-dasharray:100,200;stroke-dashoffset:-125px}}@keyframes progress-circular-dash{0%{stroke-dasharray:1,200;stroke-dashoffset:0px}50%{stroke-dasharray:100,200;stroke-dashoffset:-15px}to{stroke-dasharray:100,200;stroke-dashoffset:-125px}}@-webkit-keyframes progress-circular-rotate{to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}@keyframes progress-circular-rotate{to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}", ""]);
// Exports
module.exports = exports;
/***/ }),
/***/ "0cfb":
/***/ (function(module, exports, __webpack_require__) {
var DESCRIPTORS = __webpack_require__("83ab");
var fails = __webpack_require__("d039");
var createElement = __webpack_require__("cc12");
// Thank's IE8 for his funny defineProperty
module.exports = !DESCRIPTORS && !fails(function () {
return Object.defineProperty(createElement('div'), 'a', {
get: function () { return 7; }
}).a != 7;
});
/***/ }),
/***/ "0e90":
/***/ (function(module, exports, __webpack_require__) {
// Imports
var ___CSS_LOADER_API_IMPORT___ = __webpack_require__("24fb");
exports = ___CSS_LOADER_API_IMPORT___(false);
// Module
exports.push([module.i, ".theme--light.v-label{color:rgba(0,0,0,.6)}.theme--light.v-label--is-disabled{color:rgba(0,0,0,.38)}.theme--dark.v-label{color:hsla(0,0%,100%,.7)}.theme--dark.v-label--is-disabled{color:hsla(0,0%,100%,.5)}.v-label{font-size:16px;line-height:1;min-height:8px;-webkit-transition:.3s cubic-bezier(.25,.8,.5,1);transition:.3s cubic-bezier(.25,.8,.5,1)}", ""]);
// Exports
module.exports = exports;
/***/ }),
/***/ "122c":
/***/ (function(module, exports, __webpack_require__) {
(function webpackUniversalModuleDefinition(root, factory) {
if(true)
module.exports = factory();
else {}
})(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 = 6);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var stringUtilities_1 = __webpack_require__(1);
var cronParser_1 = __webpack_require__(2);
var ExpressionDescriptor = (function () {
function ExpressionDescriptor(expression, options) {
this.expression = expression;
this.options = options;
this.expressionParts = new Array(5);
if (ExpressionDescriptor.locales[options.locale]) {
this.i18n = ExpressionDescriptor.locales[options.locale];
}
else {
console.warn("Locale '" + options.locale + "' could not be found; falling back to 'en'.");
this.i18n = ExpressionDescriptor.locales["en"];
}
if (options.use24HourTimeFormat === undefined) {
options.use24HourTimeFormat = this.i18n.use24HourTimeFormatByDefault();
}
}
ExpressionDescriptor.toString = function (expression, _a) {
var _b = _a === void 0 ? {} : _a, _c = _b.throwExceptionOnParseError, throwExceptionOnParseError = _c === void 0 ? true : _c, _d = _b.verbose, verbose = _d === void 0 ? false : _d, _e = _b.dayOfWeekStartIndexZero, dayOfWeekStartIndexZero = _e === void 0 ? true : _e, use24HourTimeFormat = _b.use24HourTimeFormat, _f = _b.locale, locale = _f === void 0 ? "en" : _f;
var options = {
throwExceptionOnParseError: throwExceptionOnParseError,
verbose: verbose,
dayOfWeekStartIndexZero: dayOfWeekStartIndexZero,
use24HourTimeFormat: use24HourTimeFormat,
locale: locale
};
var descripter = new ExpressionDescriptor(expression, options);
return descripter.getFullDescription();
};
ExpressionDescriptor.initialize = function (localesLoader) {
ExpressionDescriptor.specialCharacters = ["/", "-", ",", "*"];
localesLoader.load(ExpressionDescriptor.locales);
};
ExpressionDescriptor.prototype.getFullDescription = function () {
var description = "";
try {
var parser = new cronParser_1.CronParser(this.expression, this.options.dayOfWeekStartIndexZero);
this.expressionParts = parser.parse();
var timeSegment = this.getTimeOfDayDescription();
var dayOfMonthDesc = this.getDayOfMonthDescription();
var monthDesc = this.getMonthDescription();
var dayOfWeekDesc = this.getDayOfWeekDescription();
var yearDesc = this.getYearDescription();
description += timeSegment + dayOfMonthDesc + dayOfWeekDesc + monthDesc + yearDesc;
description = this.transformVerbosity(description, this.options.verbose);
description = description.charAt(0).toLocaleUpperCase() + description.substr(1);
}
catch (ex) {
if (!this.options.throwExceptionOnParseError) {
description = this.i18n.anErrorOccuredWhenGeneratingTheExpressionD();
}
else {
throw "" + ex;
}
}
return description;
};
ExpressionDescriptor.prototype.getTimeOfDayDescription = function () {
var secondsExpression = this.expressionParts[0];
var minuteExpression = this.expressionParts[1];
var hourExpression = this.expressionParts[2];
var description = "";
if (!stringUtilities_1.StringUtilities.containsAny(minuteExpression, ExpressionDescriptor.specialCharacters) &&
!stringUtilities_1.StringUtilities.containsAny(hourExpression, ExpressionDescriptor.specialCharacters) &&
!stringUtilities_1.StringUtilities.containsAny(secondsExpression, ExpressionDescriptor.specialCharacters)) {
description += this.i18n.atSpace() + this.formatTime(hourExpression, minuteExpression, secondsExpression);
}
else if (!secondsExpression &&
minuteExpression.indexOf("-") > -1 &&
!(minuteExpression.indexOf(",") > -1) &&
!(minuteExpression.indexOf("/") > -1) &&
!stringUtilities_1.StringUtilities.containsAny(hourExpression, ExpressionDescriptor.specialCharacters)) {
var minuteParts = minuteExpression.split("-");
description += stringUtilities_1.StringUtilities.format(this.i18n.everyMinuteBetweenX0AndX1(), this.formatTime(hourExpression, minuteParts[0], ""), this.formatTime(hourExpression, minuteParts[1], ""));
}
else if (!secondsExpression &&
hourExpression.indexOf(",") > -1 &&
hourExpression.indexOf("-") == -1 &&
hourExpression.indexOf("/") == -1 &&
!stringUtilities_1.StringUtilities.containsAny(minuteExpression, ExpressionDescriptor.specialCharacters)) {
var hourParts = hourExpression.split(",");
description += this.i18n.at();
for (var i = 0; i < hourParts.length; i++) {
description += " ";
description += this.formatTime(hourParts[i], minuteExpression, "");
if (i < hourParts.length - 2) {
description += ",";
}
if (i == hourParts.length - 2) {
description += this.i18n.spaceAnd();
}
}
}
else {
var secondsDescription = this.getSecondsDescription();
var minutesDescription = this.getMinutesDescription();
var hoursDescription = this.getHoursDescription();
description += secondsDescription;
if (description.length > 0 && minutesDescription.length > 0) {
description += ", ";
}
description += minutesDescription;
if (description.length > 0 && hoursDescription.length > 0) {
description += ", ";
}
description += hoursDescription;
}
return description;
};
ExpressionDescriptor.prototype.getSecondsDescription = function () {
var _this = this;
var description = this.getSegmentDescription(this.expressionParts[0], this.i18n.everySecond(), function (s) {
return s;
}, function (s) {
return stringUtilities_1.StringUtilities.format(_this.i18n.everyX0Seconds(), s);
}, function (s) {
return _this.i18n.secondsX0ThroughX1PastTheMinute();
}, function (s) {
return s == "0"
? ""
: parseInt(s) < 20
? _this.i18n.atX0SecondsPastTheMinute()
: _this.i18n.atX0SecondsPastTheMinuteGt20() || _this.i18n.atX0SecondsPastTheMinute();
});
return description;
};
ExpressionDescriptor.prototype.getMinutesDescription = function () {
var _this = this;
var secondsExpression = this.expressionParts[0];
var hourExpression = this.expressionParts[2];
var description = this.getSegmentDescription(this.expressionParts[1], this.i18n.everyMinute(), function (s) {
return s;
}, function (s) {
return stringUtilities_1.StringUtilities.format(_this.i18n.everyX0Minutes(), s);
}, function (s) {
return _this.i18n.minutesX0ThroughX1PastTheHour();
}, function (s) {
try {
return s == "0" && hourExpression.indexOf("/") == -1 && secondsExpression == ""
? _this.i18n.everyHour()
: parseInt(s) < 20
? _this.i18n.atX0MinutesPastTheHour()
: _this.i18n.atX0MinutesPastTheHourGt20() || _this.i18n.atX0MinutesPastTheHour();
}
catch (e) {
return _this.i18n.atX0MinutesPastTheHour();
}
});
return description;
};
ExpressionDescriptor.prototype.getHoursDescription = function () {
var _this = this;
var expression = this.expressionParts[2];
var description = this.getSegmentDescription(expression, this.i18n.everyHour(), function (s) {
return _this.formatTime(s, "0", "");
}, function (s) {
return stringUtilities_1.StringUtilities.format(_this.i18n.everyX0Hours(), s);
}, function (s) {
return _this.i18n.betweenX0AndX1();
}, function (s) {
return _this.i18n.atX0();
});
return description;
};
ExpressionDescriptor.prototype.getDayOfWeekDescription = function () {
var _this = this;
var daysOfWeekNames = this.i18n.daysOfTheWeek();
var description = null;
if (this.expressionParts[5] == "*") {
description = "";
}
else {
description = this.getSegmentDescription(this.expressionParts[5], this.i18n.commaEveryDay(), function (s) {
var exp = s;
if (s.indexOf("#") > -1) {
exp = s.substr(0, s.indexOf("#"));
}
else if (s.indexOf("L") > -1) {
exp = exp.replace("L", "");
}
return daysOfWeekNames[parseInt(exp)];
}, function (s) {
if (parseInt(s) == 1) {
return "";
}
else {
return stringUtilities_1.StringUtilities.format(_this.i18n.commaEveryX0DaysOfTheWeek(), s);
}
}, function (s) {
return _this.i18n.commaX0ThroughX1();
}, function (s) {
var format = null;
if (s.indexOf("#") > -1) {
var dayOfWeekOfMonthNumber = s.substring(s.indexOf("#") + 1);
var dayOfWeekOfMonthDescription = null;
switch (dayOfWeekOfMonthNumber) {
case "1":
dayOfWeekOfMonthDescription = _this.i18n.first();
break;
case "2":
dayOfWeekOfMonthDescription = _this.i18n.second();
break;
case "3":
dayOfWeekOfMonthDescription = _this.i18n.third();
break;
case "4":
dayOfWeekOfMonthDescription = _this.i18n.fourth();
break;
case "5":
dayOfWeekOfMonthDescription = _this.i18n.fifth();
break;
}
format = _this.i18n.commaOnThe() + dayOfWeekOfMonthDescription + _this.i18n.spaceX0OfTheMonth();
}
else if (s.indexOf("L") > -1) {
format = _this.i18n.commaOnTheLastX0OfTheMonth();
}
else {
var domSpecified = _this.expressionParts[3] != "*";
format = domSpecified ? _this.i18n.commaAndOnX0() : _this.i18n.commaOnlyOnX0();
}
return format;
});
}
return description;
};
ExpressionDescriptor.prototype.getMonthDescription = function () {
var _this = this;
var monthNames = this.i18n.monthsOfTheYear();
var description = this.getSegmentDescription(this.expressionParts[4], "", function (s) {
return monthNames[parseInt(s) - 1];
}, function (s) {
if (parseInt(s) == 1) {
return "";
}
else {
return stringUtilities_1.StringUtilities.format(_this.i18n.commaEveryX0Months(), s);
}
}, function (s) {
return _this.i18n.commaMonthX0ThroughMonthX1() || _this.i18n.commaX0ThroughX1();
}, function (s) {
return _this.i18n.commaOnlyInMonthX0 ? _this.i18n.commaOnlyInMonthX0() : _this.i18n.commaOnlyInX0();
});
return description;
};
ExpressionDescriptor.prototype.getDayOfMonthDescription = function () {
var _this = this;
var description = null;
var expression = this.expressionParts[3];
switch (expression) {
case "L":
description = this.i18n.commaOnTheLastDayOfTheMonth();
break;
case "WL":
case "LW":
description = this.i18n.commaOnTheLastWeekdayOfTheMonth();
break;
default:
var weekDayNumberMatches = expression.match(/(\d{1,2}W)|(W\d{1,2})/);
if (weekDayNumberMatches) {
var dayNumber = parseInt(weekDayNumberMatches[0].replace("W", ""));
var dayString = dayNumber == 1
? this.i18n.firstWeekday()
: stringUtilities_1.StringUtilities.format(this.i18n.weekdayNearestDayX0(), dayNumber.toString());
description = stringUtilities_1.StringUtilities.format(this.i18n.commaOnTheX0OfTheMonth(), dayString);
break;
}
else {
var lastDayOffSetMatches = expression.match(/L-(\d{1,2})/);
if (lastDayOffSetMatches) {
var offSetDays = lastDayOffSetMatches[1];
description = stringUtilities_1.StringUtilities.format(this.i18n.commaDaysBeforeTheLastDayOfTheMonth(), offSetDays);
break;
}
else if (expression == "*" && this.expressionParts[5] != "*") {
return "";
}
else {
description = this.getSegmentDescription(expression, this.i18n.commaEveryDay(), function (s) {
return s == "L" ? _this.i18n.lastDay() : ((_this.i18n.dayX0) ? stringUtilities_1.StringUtilities.format(_this.i18n.dayX0(), s) : s);
}, function (s) {
return s == "1" ? _this.i18n.commaEveryDay() : _this.i18n.commaEveryX0Days();
}, function (s) {
return _this.i18n.commaBetweenDayX0AndX1OfTheMonth();
}, function (s) {
return _this.i18n.commaOnDayX0OfTheMonth();
});
}
break;
}
}
return description;
};
ExpressionDescriptor.prototype.getYearDescription = function () {
var _this = this;
var description = this.getSegmentDescription(this.expressionParts[6], "", function (s) {
return /^\d+$/.test(s) ? new Date(parseInt(s), 1).getFullYear().toString() : s;
}, function (s) {
return stringUtilities_1.StringUtilities.format(_this.i18n.commaEveryX0Years(), s);
}, function (s) {
return _this.i18n.commaYearX0ThroughYearX1() || _this.i18n.commaX0ThroughX1();
}, function (s) {
return _this.i18n.commaOnlyInYearX0 ? _this.i18n.commaOnlyInYearX0() : _this.i18n.commaOnlyInX0();
});
return description;
};
ExpressionDescriptor.prototype.getSegmentDescription = function (expression, allDescription, getSingleItemDescription, getIntervalDescriptionFormat, getBetweenDescriptionFormat, getDescriptionFormat) {
var _this = this;
var description = null;
if (!expression) {
description = "";
}
else if (expression === "*") {
description = allDescription;
}
else if (!stringUtilities_1.StringUtilities.containsAny(expression, ["/", "-", ","])) {
description = stringUtilities_1.StringUtilities.format(getDescriptionFormat(expression), getSingleItemDescription(expression));
}
else if (expression.indexOf("/") > -1) {
var segments = expression.split("/");
description = stringUtilities_1.StringUtilities.format(getIntervalDescriptionFormat(segments[1]), segments[1]);
if (segments[0].indexOf("-") > -1) {
var betweenSegmentDescription = this.generateBetweenSegmentDescription(segments[0], getBetweenDescriptionFormat, getSingleItemDescription);
if (betweenSegmentDescription.indexOf(", ") != 0) {
description += ", ";
}
description += betweenSegmentDescription;
}
else if (!stringUtilities_1.StringUtilities.containsAny(segments[0], ["*", ","])) {
var rangeItemDescription = stringUtilities_1.StringUtilities.format(getDescriptionFormat(segments[0]), getSingleItemDescription(segments[0]));
rangeItemDescription = rangeItemDescription.replace(", ", "");
description += stringUtilities_1.StringUtilities.format(this.i18n.commaStartingX0(), rangeItemDescription);
}
}
else if (expression.indexOf(",") > -1) {
var segments = expression.split(",");
var descriptionContent = "";
for (var i = 0; i < segments.length; i++) {
if (i > 0 && segments.length > 2) {
descriptionContent += ",";
if (i < segments.length - 1) {
descriptionContent += " ";
}
}
if (i > 0 && segments.length > 1 && (i == segments.length - 1 || segments.length == 2)) {
descriptionContent += this.i18n.spaceAnd() + " ";
}
if (segments[i].indexOf("-") > -1) {
var betweenSegmentDescription = this.generateBetweenSegmentDescription(segments[i], function (s) {
return _this.i18n.commaX0ThroughX1();
}, getSingleItemDescription);
betweenSegmentDescription = betweenSegmentDescription.replace(", ", "");
descriptionContent += betweenSegmentDescription;
}
else {
descriptionContent += getSingleItemDescription(segments[i]);
}
}
description = stringUtilities_1.StringUtilities.format(getDescriptionFormat(expression), descriptionContent);
}
else if (expression.indexOf("-") > -1) {
description = this.generateBetweenSegmentDescription(expression, getBetweenDescriptionFormat, getSingleItemDescription);
}
return description;
};
ExpressionDescriptor.prototype.generateBetweenSegmentDescription = function (betweenExpression, getBetweenDescriptionFormat, getSingleItemDescription) {
var description = "";
var betweenSegments = betweenExpression.split("-");
var betweenSegment1Description = getSingleItemDescription(betweenSegments[0]);
var betweenSegment2Description = getSingleItemDescription(betweenSegments[1]);
betweenSegment2Description = betweenSegment2Description.replace(":00", ":59");
var betweenDescriptionFormat = getBetweenDescriptionFormat(betweenExpression);
description += stringUtilities_1.StringUtilities.format(betweenDescriptionFormat, betweenSegment1Description, betweenSegment2Description);
return description;
};
ExpressionDescriptor.prototype.formatTime = function (hourExpression, minuteExpression, secondExpression) {
var hour = parseInt(hourExpression);
var period = "";
var setPeriodBeforeTime = false;
if (!this.options.use24HourTimeFormat) {
setPeriodBeforeTime = this.i18n.setPeriodBeforeTime && this.i18n.setPeriodBeforeTime();
period = setPeriodBeforeTime ? this.getPeriod(hour) + " " : " " + this.getPeriod(hour);
if (hour > 12) {
hour -= 12;
}
if (hour === 0) {
hour = 12;
}
}
var minute = minuteExpression;
var second = "";
if (secondExpression) {
second = ":" + ("00" + secondExpression).substring(secondExpression.length);
}
return "" + (setPeriodBeforeTime ? period : "") + ("00" + hour.toString()).substring(hour.toString().length) + ":" + ("00" + minute.toString()).substring(minute.toString().length) + second + (!setPeriodBeforeTime ? period : "");
};
ExpressionDescriptor.prototype.transformVerbosity = function (description, useVerboseFormat) {
if (!useVerboseFormat) {
description = description.replace(new RegExp(", " + this.i18n.everyMinute(), "g"), "");
description = description.replace(new RegExp(", " + this.i18n.everyHour(), "g"), "");
description = description.replace(new RegExp(this.i18n.commaEveryDay(), "g"), "");
description = description.replace(/\, ?$/, "");
}
return description;
};
ExpressionDescriptor.prototype.getPeriod = function (hour) {
return hour >= 12 ? this.i18n.pm && this.i18n.pm() || "PM" : this.i18n.am && this.i18n.am() || "AM";
};
ExpressionDescriptor.locales = {};
return ExpressionDescriptor;
}());
exports.ExpressionDescriptor = ExpressionDescriptor;
/***/ }),
/* 1 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var StringUtilities = (function () {
function StringUtilities() {
}
StringUtilities.format = function (template) {
var values = [];
for (var _i = 1; _i < arguments.length; _i++) {
values[_i - 1] = arguments[_i];
}
return template.replace(/%s/g, function () {
return values.shift();
});
};
StringUtilities.containsAny = function (text, searchStrings) {
return searchStrings.some(function (c) {
return text.indexOf(c) > -1;
});
};
return StringUtilities;
}());
exports.StringUtilities = StringUtilities;
/***/ }),
/* 2 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var CronParser = (function () {
function CronParser(expression, dayOfWeekStartIndexZero) {
if (dayOfWeekStartIndexZero === void 0) { dayOfWeekStartIndexZero = true; }
this.expression = expression;
this.dayOfWeekStartIndexZero = dayOfWeekStartIndexZero;
}
CronParser.prototype.parse = function () {
var parsed = this.extractParts(this.expression);
this.normalize(parsed);
this.validate(parsed);
return parsed;
};
CronParser.prototype.extractParts = function (expression) {
if (!this.expression) {
throw new Error("Expression is empty");
}
var parsed = expression.trim().split(/[ ]+/);
if (parsed.length < 5) {
throw new Error("Expression has only " + parsed.length + " part" + (parsed.length == 1 ? "" : "s") + ". At least 5 parts are required.");
}
else if (parsed.length == 5) {
parsed.unshift("");
parsed.push("");
}
else if (parsed.length == 6) {
if (/\d{4}$/.test(parsed[5])) {
parsed.unshift("");
}
else {
parsed.push("");
}
}
else if (parsed.length > 7) {
throw new Error("Expression has " + parsed.length + " parts; too many!");
}
return parsed;
};
CronParser.prototype.normalize = function (expressionParts) {
var _this = this;
expressionParts[3] = expressionParts[3].replace("?", "*");
expressionParts[5] = expressionParts[5].replace("?", "*");
expressionParts[2] = expressionParts[2].replace("?", "*");
if (expressionParts[0].indexOf("0/") == 0) {
expressionParts[0] = expressionParts[0].replace("0/", "*/");
}
if (expressionParts[1].indexOf("0/") == 0) {
expressionParts[1] = expressionParts[1].replace("0/", "*/");
}
if (expressionParts[2].indexOf("0/") == 0) {
expressionParts[2] = expressionParts[2].replace("0/", "*/");
}
if (expressionParts[3].indexOf("1/") == 0) {
expressionParts[3] = expressionParts[3].replace("1/", "*/");
}
if (expressionParts[4].indexOf("1/") == 0) {
expressionParts[4] = expressionParts[4].replace("1/", "*/");
}
if (expressionParts[5].indexOf("1/") == 0) {
expressionParts[5] = expressionParts[5].replace("1/", "*/");
}
if (expressionParts[6].indexOf("1/") == 0) {
expressionParts[6] = expressionParts[6].replace("1/", "*/");
}
expressionParts[5] = expressionParts[5].replace(/(^\d)|([^#/\s]\d)/g, function (t) {
var dowDigits = t.replace(/\D/, "");
var dowDigitsAdjusted = dowDigits;
if (_this.dayOfWeekStartIndexZero) {
if (dowDigits == "7") {
dowDigitsAdjusted = "0";
}
}
else {
dowDigitsAdjusted = (parseInt(dowDigits) - 1).toString();
}
return t.replace(dowDigits, dowDigitsAdjusted);
});
if (expressionParts[5] == "L") {
expressionParts[5] = "6";
}
if (expressionParts[3] == "?") {
expressionParts[3] = "*";
}
if (expressionParts[3].indexOf("W") > -1 &&
(expressionParts[3].indexOf(",") > -1 || expressionParts[3].indexOf("-") > -1)) {
throw new Error("The 'W' character can be specified only when the day-of-month is a single day, not a range or list of days.");
}
var days = {
SUN: 0,
MON: 1,
TUE: 2,
WED: 3,
THU: 4,
FRI: 5,
SAT: 6
};
for (var day in days) {
expressionParts[5] = expressionParts[5].replace(new RegExp(day, "gi"), days[day].toString());
}
var months = {
JAN: 1,
FEB: 2,
MAR: 3,
APR: 4,
MAY: 5,
JUN: 6,
JUL: 7,
AUG: 8,
SEP: 9,
OCT: 10,
NOV: 11,
DEC: 12
};
for (var month in months) {
expressionParts[4] = expressionParts[4].replace(new RegExp(month, "gi"), months[month].toString());
}
if (expressionParts[0] == "0") {
expressionParts[0] = "";
}
if (!/\*|\-|\,|\//.test(expressionParts[2]) &&
(/\*|\//.test(expressionParts[1]) || /\*|\//.test(expressionParts[0]))) {
expressionParts[2] += "-" + expressionParts[2];
}
for (var i = 0; i < expressionParts.length; i++) {
if (expressionParts[i] == "*/1") {
expressionParts[i] = "*";
}
if (expressionParts[i].indexOf("/") > -1 && !/^\*|\-|\,/.test(expressionParts[i])) {
var stepRangeThrough = null;
switch (i) {
case 4:
stepRangeThrough = "12";
break;
case 5:
stepRangeThrough = "6";
break;
case 6:
stepRangeThrough = "9999";
break;
default:
stepRangeThrough = null;
break;
}
if (stepRangeThrough != null) {
var parts = expressionParts[i].split("/");
expressionParts[i] = parts[0] + "-" + stepRangeThrough + "/" + parts[1];
}
}
}
};
CronParser.prototype.validate = function (parsed) {
this.assertNoInvalidCharacters("DOW", parsed[5]);
this.assertNoInvalidCharacters("DOM", parsed[3]);
};
CronParser.prototype.assertNoInvalidCharacters = function (partDescription, expression) {
var invalidChars = expression.match(/[A-KM-VX-Z]+/gi);
if (invalidChars && invalidChars.length) {
throw new Error(partDescription + " part contains invalid values: '" + invalidChars.toString() + "'");
}
};
return CronParser;
}());
exports.CronParser = CronParser;
/***/ }),
/* 3 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var en = (function () {
function en() {
}
en.prototype.atX0SecondsPastTheMinuteGt20 = function () {
return null;
};
en.prototype.atX0MinutesPastTheHourGt20 = function () {
return null;
};
en.prototype.commaMonthX0ThroughMonthX1 = function () {
return null;
};
en.prototype.commaYearX0ThroughYearX1 = function () {
return null;
};
en.prototype.use24HourTimeFormatByDefault = function () {
return false;
};
en.prototype.anErrorOccuredWhenGeneratingTheExpressionD = function () {
return "An error occured when generating the expression description. Check the cron expression syntax.";
};
en.prototype.everyMinute = function () {
return "every minute";
};
en.prototype.everyHour = function () {
return "every hour";
};
en.prototype.atSpace = function () {
return "At ";
};
en.prototype.everyMinuteBetweenX0AndX1 = function () {
return "Every minute between %s and %s";
};
en.prototype.at = function () {
return "At";
};
en.prototype.spaceAnd = function () {
return " and";
};
en.prototype.everySecond = function () {
return "every second";
};
en.prototype.everyX0Seconds = function () {
return "every %s seconds";
};
en.prototype.secondsX0ThroughX1PastTheMinute = function () {
return "seconds %s through %s past the minute";
};
en.prototype.atX0SecondsPastTheMinute = function () {
return "at %s seconds past the minute";
};
en.prototype.everyX0Minutes = function () {
return "every %s minutes";
};
en.prototype.minutesX0ThroughX1PastTheHour = function () {
return "minutes %s through %s past the hour";
};
en.prototype.atX0MinutesPastTheHour = function () {
return "at %s minutes past the hour";
};
en.prototype.everyX0Hours = function () {
return "every %s hours";
};
en.prototype.betweenX0AndX1 = function () {
return "between %s and %s";
};
en.prototype.atX0 = function () {
return