4626 lines
158 KiB
JavaScript
4626 lines
158 KiB
JavaScript
// ==UserScript==
|
||
// @name 3CX TAPI
|
||
// @namespace http://cp-solutions.at
|
||
// @version 9.1.1
|
||
// @author Daniel Triendl <d.triendl@cp-solutions.at>
|
||
// @copyright Copyright 2021 CP Solutions GmbH
|
||
// @source https://source.cp-austria.at/git/CPATRD/3cx_tapi.git
|
||
// @downloadURL https://source.cp-austria.at/git/CPATRD/3cx_tapi/raw/branch/master/3CX_TAPI.user.js
|
||
// @match https://192.168.0.154:5001/webclient*
|
||
// @match https://cpsolution.my3cx.at:5001/webclient*
|
||
// @require https://cdn.jsdelivr.net/gh/CoeJoder/waitForKeyElements.js@v1.2/waitForKeyElements.js
|
||
// @require https://cdn.jsdelivr.net/npm/axios@^1.4.0/dist/axios.min.js
|
||
// @require https://cdn.jsdelivr.net/npm/axios-userscript-adapter@^0.2.0-alpha.2/dist/axiosGmxhrAdapter.min.js
|
||
// @grant GM.xmlHttpRequest
|
||
// @grant GM.notification
|
||
// @grant GM.getValue
|
||
// @grant GM.setValue
|
||
// @connect cpatapi.cpsrvweb2016.cp-austria.at
|
||
// @run-at document-end
|
||
// ==/UserScript==
|
||
|
||
/******/ (() => { // webpackBootstrap
|
||
/******/ var __webpack_modules__ = ({
|
||
|
||
/***/ "./node_modules/css-loader/dist/runtime/api.js":
|
||
/***/ ((module) => {
|
||
|
||
"use strict";
|
||
|
||
|
||
/*
|
||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||
Author Tobias Koppers @sokra
|
||
*/
|
||
module.exports = function (cssWithMappingToString) {
|
||
var list = [];
|
||
|
||
// return the list of modules as css string
|
||
list.toString = function toString() {
|
||
return this.map(function (item) {
|
||
var content = "";
|
||
var needLayer = typeof item[5] !== "undefined";
|
||
if (item[4]) {
|
||
content += "@supports (".concat(item[4], ") {");
|
||
}
|
||
if (item[2]) {
|
||
content += "@media ".concat(item[2], " {");
|
||
}
|
||
if (needLayer) {
|
||
content += "@layer".concat(item[5].length > 0 ? " ".concat(item[5]) : "", " {");
|
||
}
|
||
content += cssWithMappingToString(item);
|
||
if (needLayer) {
|
||
content += "}";
|
||
}
|
||
if (item[2]) {
|
||
content += "}";
|
||
}
|
||
if (item[4]) {
|
||
content += "}";
|
||
}
|
||
return content;
|
||
}).join("");
|
||
};
|
||
|
||
// import a list of modules into the list
|
||
list.i = function i(modules, media, dedupe, supports, layer) {
|
||
if (typeof modules === "string") {
|
||
modules = [[null, modules, undefined]];
|
||
}
|
||
var alreadyImportedModules = {};
|
||
if (dedupe) {
|
||
for (var k = 0; k < this.length; k++) {
|
||
var id = this[k][0];
|
||
if (id != null) {
|
||
alreadyImportedModules[id] = true;
|
||
}
|
||
}
|
||
}
|
||
for (var _k = 0; _k < modules.length; _k++) {
|
||
var item = [].concat(modules[_k]);
|
||
if (dedupe && alreadyImportedModules[item[0]]) {
|
||
continue;
|
||
}
|
||
if (typeof layer !== "undefined") {
|
||
if (typeof item[5] === "undefined") {
|
||
item[5] = layer;
|
||
} else {
|
||
item[1] = "@layer".concat(item[5].length > 0 ? " ".concat(item[5]) : "", " {").concat(item[1], "}");
|
||
item[5] = layer;
|
||
}
|
||
}
|
||
if (media) {
|
||
if (!item[2]) {
|
||
item[2] = media;
|
||
} else {
|
||
item[1] = "@media ".concat(item[2], " {").concat(item[1], "}");
|
||
item[2] = media;
|
||
}
|
||
}
|
||
if (supports) {
|
||
if (!item[4]) {
|
||
item[4] = "".concat(supports);
|
||
} else {
|
||
item[1] = "@supports (".concat(item[4], ") {").concat(item[1], "}");
|
||
item[4] = supports;
|
||
}
|
||
}
|
||
list.push(item);
|
||
}
|
||
};
|
||
return list;
|
||
};
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/css-loader/dist/runtime/noSourceMaps.js":
|
||
/***/ ((module) => {
|
||
|
||
"use strict";
|
||
|
||
|
||
module.exports = function (i) {
|
||
return i[1];
|
||
};
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/dayjs/dayjs.min.js":
|
||
/***/ (function(module) {
|
||
|
||
!function (t, e) {
|
||
true ? module.exports = e() : 0;
|
||
}(this, function () {
|
||
"use strict";
|
||
|
||
var t = 1e3,
|
||
e = 6e4,
|
||
n = 36e5,
|
||
r = "millisecond",
|
||
i = "second",
|
||
s = "minute",
|
||
u = "hour",
|
||
a = "day",
|
||
o = "week",
|
||
f = "month",
|
||
h = "quarter",
|
||
c = "year",
|
||
d = "date",
|
||
l = "Invalid Date",
|
||
$ = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,
|
||
y = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,
|
||
M = {
|
||
name: "en",
|
||
weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),
|
||
months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"),
|
||
ordinal: function (t) {
|
||
var e = ["th", "st", "nd", "rd"],
|
||
n = t % 100;
|
||
return "[" + t + (e[(n - 20) % 10] || e[n] || e[0]) + "]";
|
||
}
|
||
},
|
||
m = function (t, e, n) {
|
||
var r = String(t);
|
||
return !r || r.length >= e ? t : "" + Array(e + 1 - r.length).join(n) + t;
|
||
},
|
||
v = {
|
||
s: m,
|
||
z: function (t) {
|
||
var e = -t.utcOffset(),
|
||
n = Math.abs(e),
|
||
r = Math.floor(n / 60),
|
||
i = n % 60;
|
||
return (e <= 0 ? "+" : "-") + m(r, 2, "0") + ":" + m(i, 2, "0");
|
||
},
|
||
m: function t(e, n) {
|
||
if (e.date() < n.date()) return -t(n, e);
|
||
var r = 12 * (n.year() - e.year()) + (n.month() - e.month()),
|
||
i = e.clone().add(r, f),
|
||
s = n - i < 0,
|
||
u = e.clone().add(r + (s ? -1 : 1), f);
|
||
return +(-(r + (n - i) / (s ? i - u : u - i)) || 0);
|
||
},
|
||
a: function (t) {
|
||
return t < 0 ? Math.ceil(t) || 0 : Math.floor(t);
|
||
},
|
||
p: function (t) {
|
||
return {
|
||
M: f,
|
||
y: c,
|
||
w: o,
|
||
d: a,
|
||
D: d,
|
||
h: u,
|
||
m: s,
|
||
s: i,
|
||
ms: r,
|
||
Q: h
|
||
}[t] || String(t || "").toLowerCase().replace(/s$/, "");
|
||
},
|
||
u: function (t) {
|
||
return void 0 === t;
|
||
}
|
||
},
|
||
g = "en",
|
||
D = {};
|
||
D[g] = M;
|
||
var p = function (t) {
|
||
return t instanceof _;
|
||
},
|
||
S = function t(e, n, r) {
|
||
var i;
|
||
if (!e) return g;
|
||
if ("string" == typeof e) {
|
||
var s = e.toLowerCase();
|
||
D[s] && (i = s), n && (D[s] = n, i = s);
|
||
var u = e.split("-");
|
||
if (!i && u.length > 1) return t(u[0]);
|
||
} else {
|
||
var a = e.name;
|
||
D[a] = e, i = a;
|
||
}
|
||
return !r && i && (g = i), i || !r && g;
|
||
},
|
||
w = function (t, e) {
|
||
if (p(t)) return t.clone();
|
||
var n = "object" == typeof e ? e : {};
|
||
return n.date = t, n.args = arguments, new _(n);
|
||
},
|
||
O = v;
|
||
O.l = S, O.i = p, O.w = function (t, e) {
|
||
return w(t, {
|
||
locale: e.$L,
|
||
utc: e.$u,
|
||
x: e.$x,
|
||
$offset: e.$offset
|
||
});
|
||
};
|
||
var _ = function () {
|
||
function M(t) {
|
||
this.$L = S(t.locale, null, !0), this.parse(t);
|
||
}
|
||
var m = M.prototype;
|
||
return m.parse = function (t) {
|
||
this.$d = function (t) {
|
||
var e = t.date,
|
||
n = t.utc;
|
||
if (null === e) return new Date(NaN);
|
||
if (O.u(e)) return new Date();
|
||
if (e instanceof Date) return new Date(e);
|
||
if ("string" == typeof e && !/Z$/i.test(e)) {
|
||
var r = e.match($);
|
||
if (r) {
|
||
var i = r[2] - 1 || 0,
|
||
s = (r[7] || "0").substring(0, 3);
|
||
return n ? new Date(Date.UTC(r[1], i, r[3] || 1, r[4] || 0, r[5] || 0, r[6] || 0, s)) : new Date(r[1], i, r[3] || 1, r[4] || 0, r[5] || 0, r[6] || 0, s);
|
||
}
|
||
}
|
||
return new Date(e);
|
||
}(t), this.$x = t.x || {}, this.init();
|
||
}, m.init = function () {
|
||
var t = this.$d;
|
||
this.$y = t.getFullYear(), this.$M = t.getMonth(), this.$D = t.getDate(), this.$W = t.getDay(), this.$H = t.getHours(), this.$m = t.getMinutes(), this.$s = t.getSeconds(), this.$ms = t.getMilliseconds();
|
||
}, m.$utils = function () {
|
||
return O;
|
||
}, m.isValid = function () {
|
||
return !(this.$d.toString() === l);
|
||
}, m.isSame = function (t, e) {
|
||
var n = w(t);
|
||
return this.startOf(e) <= n && n <= this.endOf(e);
|
||
}, m.isAfter = function (t, e) {
|
||
return w(t) < this.startOf(e);
|
||
}, m.isBefore = function (t, e) {
|
||
return this.endOf(e) < w(t);
|
||
}, m.$g = function (t, e, n) {
|
||
return O.u(t) ? this[e] : this.set(n, t);
|
||
}, m.unix = function () {
|
||
return Math.floor(this.valueOf() / 1e3);
|
||
}, m.valueOf = function () {
|
||
return this.$d.getTime();
|
||
}, m.startOf = function (t, e) {
|
||
var n = this,
|
||
r = !!O.u(e) || e,
|
||
h = O.p(t),
|
||
l = function (t, e) {
|
||
var i = O.w(n.$u ? Date.UTC(n.$y, e, t) : new Date(n.$y, e, t), n);
|
||
return r ? i : i.endOf(a);
|
||
},
|
||
$ = function (t, e) {
|
||
return O.w(n.toDate()[t].apply(n.toDate("s"), (r ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(e)), n);
|
||
},
|
||
y = this.$W,
|
||
M = this.$M,
|
||
m = this.$D,
|
||
v = "set" + (this.$u ? "UTC" : "");
|
||
switch (h) {
|
||
case c:
|
||
return r ? l(1, 0) : l(31, 11);
|
||
case f:
|
||
return r ? l(1, M) : l(0, M + 1);
|
||
case o:
|
||
var g = this.$locale().weekStart || 0,
|
||
D = (y < g ? y + 7 : y) - g;
|
||
return l(r ? m - D : m + (6 - D), M);
|
||
case a:
|
||
case d:
|
||
return $(v + "Hours", 0);
|
||
case u:
|
||
return $(v + "Minutes", 1);
|
||
case s:
|
||
return $(v + "Seconds", 2);
|
||
case i:
|
||
return $(v + "Milliseconds", 3);
|
||
default:
|
||
return this.clone();
|
||
}
|
||
}, m.endOf = function (t) {
|
||
return this.startOf(t, !1);
|
||
}, m.$set = function (t, e) {
|
||
var n,
|
||
o = O.p(t),
|
||
h = "set" + (this.$u ? "UTC" : ""),
|
||
l = (n = {}, n[a] = h + "Date", n[d] = h + "Date", n[f] = h + "Month", n[c] = h + "FullYear", n[u] = h + "Hours", n[s] = h + "Minutes", n[i] = h + "Seconds", n[r] = h + "Milliseconds", n)[o],
|
||
$ = o === a ? this.$D + (e - this.$W) : e;
|
||
if (o === f || o === c) {
|
||
var y = this.clone().set(d, 1);
|
||
y.$d[l]($), y.init(), this.$d = y.set(d, Math.min(this.$D, y.daysInMonth())).$d;
|
||
} else l && this.$d[l]($);
|
||
return this.init(), this;
|
||
}, m.set = function (t, e) {
|
||
return this.clone().$set(t, e);
|
||
}, m.get = function (t) {
|
||
return this[O.p(t)]();
|
||
}, m.add = function (r, h) {
|
||
var d,
|
||
l = this;
|
||
r = Number(r);
|
||
var $ = O.p(h),
|
||
y = function (t) {
|
||
var e = w(l);
|
||
return O.w(e.date(e.date() + Math.round(t * r)), l);
|
||
};
|
||
if ($ === f) return this.set(f, this.$M + r);
|
||
if ($ === c) return this.set(c, this.$y + r);
|
||
if ($ === a) return y(1);
|
||
if ($ === o) return y(7);
|
||
var M = (d = {}, d[s] = e, d[u] = n, d[i] = t, d)[$] || 1,
|
||
m = this.$d.getTime() + r * M;
|
||
return O.w(m, this);
|
||
}, m.subtract = function (t, e) {
|
||
return this.add(-1 * t, e);
|
||
}, m.format = function (t) {
|
||
var e = this,
|
||
n = this.$locale();
|
||
if (!this.isValid()) return n.invalidDate || l;
|
||
var r = t || "YYYY-MM-DDTHH:mm:ssZ",
|
||
i = O.z(this),
|
||
s = this.$H,
|
||
u = this.$m,
|
||
a = this.$M,
|
||
o = n.weekdays,
|
||
f = n.months,
|
||
h = function (t, n, i, s) {
|
||
return t && (t[n] || t(e, r)) || i[n].slice(0, s);
|
||
},
|
||
c = function (t) {
|
||
return O.s(s % 12 || 12, t, "0");
|
||
},
|
||
d = n.meridiem || function (t, e, n) {
|
||
var r = t < 12 ? "AM" : "PM";
|
||
return n ? r.toLowerCase() : r;
|
||
},
|
||
$ = {
|
||
YY: String(this.$y).slice(-2),
|
||
YYYY: O.s(this.$y, 4, "0"),
|
||
M: a + 1,
|
||
MM: O.s(a + 1, 2, "0"),
|
||
MMM: h(n.monthsShort, a, f, 3),
|
||
MMMM: h(f, a),
|
||
D: this.$D,
|
||
DD: O.s(this.$D, 2, "0"),
|
||
d: String(this.$W),
|
||
dd: h(n.weekdaysMin, this.$W, o, 2),
|
||
ddd: h(n.weekdaysShort, this.$W, o, 3),
|
||
dddd: o[this.$W],
|
||
H: String(s),
|
||
HH: O.s(s, 2, "0"),
|
||
h: c(1),
|
||
hh: c(2),
|
||
a: d(s, u, !0),
|
||
A: d(s, u, !1),
|
||
m: String(u),
|
||
mm: O.s(u, 2, "0"),
|
||
s: String(this.$s),
|
||
ss: O.s(this.$s, 2, "0"),
|
||
SSS: O.s(this.$ms, 3, "0"),
|
||
Z: i
|
||
};
|
||
return r.replace(y, function (t, e) {
|
||
return e || $[t] || i.replace(":", "");
|
||
});
|
||
}, m.utcOffset = function () {
|
||
return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
|
||
}, m.diff = function (r, d, l) {
|
||
var $,
|
||
y = O.p(d),
|
||
M = w(r),
|
||
m = (M.utcOffset() - this.utcOffset()) * e,
|
||
v = this - M,
|
||
g = O.m(this, M);
|
||
return g = ($ = {}, $[c] = g / 12, $[f] = g, $[h] = g / 3, $[o] = (v - m) / 6048e5, $[a] = (v - m) / 864e5, $[u] = v / n, $[s] = v / e, $[i] = v / t, $)[y] || v, l ? g : O.a(g);
|
||
}, m.daysInMonth = function () {
|
||
return this.endOf(f).$D;
|
||
}, m.$locale = function () {
|
||
return D[this.$L];
|
||
}, m.locale = function (t, e) {
|
||
if (!t) return this.$L;
|
||
var n = this.clone(),
|
||
r = S(t, e, !0);
|
||
return r && (n.$L = r), n;
|
||
}, m.clone = function () {
|
||
return O.w(this.$d, this);
|
||
}, m.toDate = function () {
|
||
return new Date(this.valueOf());
|
||
}, m.toJSON = function () {
|
||
return this.isValid() ? this.toISOString() : null;
|
||
}, m.toISOString = function () {
|
||
return this.$d.toISOString();
|
||
}, m.toString = function () {
|
||
return this.$d.toUTCString();
|
||
}, M;
|
||
}(),
|
||
T = _.prototype;
|
||
return w.prototype = T, [["$ms", r], ["$s", i], ["$m", s], ["$H", u], ["$W", a], ["$M", f], ["$y", c], ["$D", d]].forEach(function (t) {
|
||
T[t[1]] = function (e) {
|
||
return this.$g(e, t[0], t[1]);
|
||
};
|
||
}), w.extend = function (t, e) {
|
||
return t.$i || (t(e, _, w), t.$i = !0), w;
|
||
}, w.locale = S, w.isDayjs = p, w.unix = function (t) {
|
||
return w(1e3 * t);
|
||
}, w.en = D[g], w.Ls = D, w.p = {}, w;
|
||
});
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/dayjs/plugin/quarterOfYear.js":
|
||
/***/ (function(module) {
|
||
|
||
!function (t, n) {
|
||
true ? module.exports = n() : 0;
|
||
}(this, function () {
|
||
"use strict";
|
||
|
||
var t = "month",
|
||
n = "quarter";
|
||
return function (e, i) {
|
||
var r = i.prototype;
|
||
r.quarter = function (t) {
|
||
return this.$utils().u(t) ? Math.ceil((this.month() + 1) / 3) : this.month(this.month() % 3 + 3 * (t - 1));
|
||
};
|
||
var s = r.add;
|
||
r.add = function (e, i) {
|
||
return e = Number(e), this.$utils().p(i) === n ? this.add(3 * e, t) : s.bind(this)(e, i);
|
||
};
|
||
var u = r.startOf;
|
||
r.startOf = function (e, i) {
|
||
var r = this.$utils(),
|
||
s = !!r.u(i) || i;
|
||
if (r.p(e) === n) {
|
||
var o = this.quarter() - 1;
|
||
return s ? this.month(3 * o).startOf(t).startOf("day") : this.month(3 * o + 2).endOf(t).endOf("day");
|
||
}
|
||
return u.bind(this)(e, i);
|
||
};
|
||
};
|
||
});
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/css-loader/dist/cjs.js!./src/search.css":
|
||
/***/ ((module, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
||
/* harmony export */ Z: () => (__WEBPACK_DEFAULT_EXPORT__)
|
||
/* harmony export */ });
|
||
/* harmony import */ var _node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("./node_modules/css-loader/dist/runtime/noSourceMaps.js");
|
||
/* harmony import */ var _node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__);
|
||
/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("./node_modules/css-loader/dist/runtime/api.js");
|
||
/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__);
|
||
// Imports
|
||
|
||
|
||
var ___CSS_LOADER_EXPORT___ = _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default()((_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default()));
|
||
// Module
|
||
___CSS_LOADER_EXPORT___.push([module.id, `.tapi-search-autocomplete {
|
||
/*the container must be positioned relative:*/
|
||
position: relative;
|
||
display: inline-block;
|
||
margin-right: 20px;
|
||
}
|
||
.tapi-search-autocomplete input {
|
||
border: 1px solid transparent;
|
||
background-color: #f1f1f1;
|
||
/*padding: 10px;*/
|
||
/*font-size: 16px;*/
|
||
}
|
||
.tapi-search-autocomplete input[type=text] {
|
||
background-color: #f1f1f1;
|
||
width: 100%;
|
||
}
|
||
|
||
.tapi-search-autocomplete-items {
|
||
position: absolute;
|
||
border: 1px solid #d4d4d4;
|
||
border-bottom: none;
|
||
border-top: none;
|
||
z-index: 99;
|
||
/*position the autocomplete items to be the same width as the container:*/
|
||
top: 100%;
|
||
left: 0;
|
||
right: 0;
|
||
}
|
||
.tapi-search-autocomplete-items div {
|
||
padding: 10px;
|
||
cursor: pointer;
|
||
background-color: #fff;
|
||
border-bottom: 1px solid #d4d4d4;
|
||
color: #000;
|
||
}
|
||
.tapi-search-autocomplete-items div p {
|
||
margin: 0;
|
||
}
|
||
.tapi-search-autocomplete-items div:hover, .tapi-search-autocomplete-active {
|
||
/*when hovering an item:*/
|
||
background-color: #E7E6E6 !important;
|
||
}
|
||
`, ""]);
|
||
// Exports
|
||
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (___CSS_LOADER_EXPORT___);
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/css-loader/dist/cjs.js!./src/status.css":
|
||
/***/ ((module, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
||
/* harmony export */ Z: () => (__WEBPACK_DEFAULT_EXPORT__)
|
||
/* harmony export */ });
|
||
/* harmony import */ var _node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("./node_modules/css-loader/dist/runtime/noSourceMaps.js");
|
||
/* harmony import */ var _node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__);
|
||
/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("./node_modules/css-loader/dist/runtime/api.js");
|
||
/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__);
|
||
// Imports
|
||
|
||
|
||
var ___CSS_LOADER_EXPORT___ = _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default()((_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default()));
|
||
// Module
|
||
___CSS_LOADER_EXPORT___.push([module.id, `.tapi-dropdown {
|
||
position: relative;
|
||
display: inline-block;
|
||
}
|
||
|
||
.tapi-dropdown-content {
|
||
display: none;
|
||
position: absolute;
|
||
min-width: 200px;
|
||
overflow: auto;
|
||
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
|
||
z-index: 1;
|
||
color: #000;
|
||
background-color: #fff;
|
||
}
|
||
|
||
.show {
|
||
display: block;
|
||
}
|
||
`, ""]);
|
||
// Exports
|
||
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (___CSS_LOADER_EXPORT___);
|
||
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":
|
||
/***/ ((module) => {
|
||
|
||
"use strict";
|
||
|
||
|
||
var stylesInDOM = [];
|
||
function getIndexByIdentifier(identifier) {
|
||
var result = -1;
|
||
for (var i = 0; i < stylesInDOM.length; i++) {
|
||
if (stylesInDOM[i].identifier === identifier) {
|
||
result = i;
|
||
break;
|
||
}
|
||
}
|
||
return result;
|
||
}
|
||
function modulesToDom(list, options) {
|
||
var idCountMap = {};
|
||
var identifiers = [];
|
||
for (var i = 0; i < list.length; i++) {
|
||
var item = list[i];
|
||
var id = options.base ? item[0] + options.base : item[0];
|
||
var count = idCountMap[id] || 0;
|
||
var identifier = "".concat(id, " ").concat(count);
|
||
idCountMap[id] = count + 1;
|
||
var indexByIdentifier = getIndexByIdentifier(identifier);
|
||
var obj = {
|
||
css: item[1],
|
||
media: item[2],
|
||
sourceMap: item[3],
|
||
supports: item[4],
|
||
layer: item[5]
|
||
};
|
||
if (indexByIdentifier !== -1) {
|
||
stylesInDOM[indexByIdentifier].references++;
|
||
stylesInDOM[indexByIdentifier].updater(obj);
|
||
} else {
|
||
var updater = addElementStyle(obj, options);
|
||
options.byIndex = i;
|
||
stylesInDOM.splice(i, 0, {
|
||
identifier: identifier,
|
||
updater: updater,
|
||
references: 1
|
||
});
|
||
}
|
||
identifiers.push(identifier);
|
||
}
|
||
return identifiers;
|
||
}
|
||
function addElementStyle(obj, options) {
|
||
var api = options.domAPI(options);
|
||
api.update(obj);
|
||
var updater = function updater(newObj) {
|
||
if (newObj) {
|
||
if (newObj.css === obj.css && newObj.media === obj.media && newObj.sourceMap === obj.sourceMap && newObj.supports === obj.supports && newObj.layer === obj.layer) {
|
||
return;
|
||
}
|
||
api.update(obj = newObj);
|
||
} else {
|
||
api.remove();
|
||
}
|
||
};
|
||
return updater;
|
||
}
|
||
module.exports = function (list, options) {
|
||
options = options || {};
|
||
list = list || [];
|
||
var lastIdentifiers = modulesToDom(list, options);
|
||
return function update(newList) {
|
||
newList = newList || [];
|
||
for (var i = 0; i < lastIdentifiers.length; i++) {
|
||
var identifier = lastIdentifiers[i];
|
||
var index = getIndexByIdentifier(identifier);
|
||
stylesInDOM[index].references--;
|
||
}
|
||
var newLastIdentifiers = modulesToDom(newList, options);
|
||
for (var _i = 0; _i < lastIdentifiers.length; _i++) {
|
||
var _identifier = lastIdentifiers[_i];
|
||
var _index = getIndexByIdentifier(_identifier);
|
||
if (stylesInDOM[_index].references === 0) {
|
||
stylesInDOM[_index].updater();
|
||
stylesInDOM.splice(_index, 1);
|
||
}
|
||
}
|
||
lastIdentifiers = newLastIdentifiers;
|
||
};
|
||
};
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/style-loader/dist/runtime/insertBySelector.js":
|
||
/***/ ((module) => {
|
||
|
||
"use strict";
|
||
|
||
|
||
var memo = {};
|
||
|
||
/* istanbul ignore next */
|
||
function getTarget(target) {
|
||
if (typeof memo[target] === "undefined") {
|
||
var styleTarget = document.querySelector(target);
|
||
|
||
// Special case to return head of iframe instead of iframe itself
|
||
if (window.HTMLIFrameElement && styleTarget instanceof window.HTMLIFrameElement) {
|
||
try {
|
||
// This will throw an exception if access to iframe is blocked
|
||
// due to cross-origin restrictions
|
||
styleTarget = styleTarget.contentDocument.head;
|
||
} catch (e) {
|
||
// istanbul ignore next
|
||
styleTarget = null;
|
||
}
|
||
}
|
||
memo[target] = styleTarget;
|
||
}
|
||
return memo[target];
|
||
}
|
||
|
||
/* istanbul ignore next */
|
||
function insertBySelector(insert, style) {
|
||
var target = getTarget(insert);
|
||
if (!target) {
|
||
throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");
|
||
}
|
||
target.appendChild(style);
|
||
}
|
||
module.exports = insertBySelector;
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/style-loader/dist/runtime/insertStyleElement.js":
|
||
/***/ ((module) => {
|
||
|
||
"use strict";
|
||
|
||
|
||
/* istanbul ignore next */
|
||
function insertStyleElement(options) {
|
||
var element = document.createElement("style");
|
||
options.setAttributes(element, options.attributes);
|
||
options.insert(element, options.options);
|
||
return element;
|
||
}
|
||
module.exports = insertStyleElement;
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":
|
||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
|
||
|
||
/* istanbul ignore next */
|
||
function setAttributesWithoutAttributes(styleElement) {
|
||
var nonce = true ? __webpack_require__.nc : 0;
|
||
if (nonce) {
|
||
styleElement.setAttribute("nonce", nonce);
|
||
}
|
||
}
|
||
module.exports = setAttributesWithoutAttributes;
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/style-loader/dist/runtime/styleDomAPI.js":
|
||
/***/ ((module) => {
|
||
|
||
"use strict";
|
||
|
||
|
||
/* istanbul ignore next */
|
||
function apply(styleElement, options, obj) {
|
||
var css = "";
|
||
if (obj.supports) {
|
||
css += "@supports (".concat(obj.supports, ") {");
|
||
}
|
||
if (obj.media) {
|
||
css += "@media ".concat(obj.media, " {");
|
||
}
|
||
var needLayer = typeof obj.layer !== "undefined";
|
||
if (needLayer) {
|
||
css += "@layer".concat(obj.layer.length > 0 ? " ".concat(obj.layer) : "", " {");
|
||
}
|
||
css += obj.css;
|
||
if (needLayer) {
|
||
css += "}";
|
||
}
|
||
if (obj.media) {
|
||
css += "}";
|
||
}
|
||
if (obj.supports) {
|
||
css += "}";
|
||
}
|
||
var sourceMap = obj.sourceMap;
|
||
if (sourceMap && typeof btoa !== "undefined") {
|
||
css += "\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))), " */");
|
||
}
|
||
|
||
// For old IE
|
||
/* istanbul ignore if */
|
||
options.styleTagTransform(css, styleElement, options.options);
|
||
}
|
||
function removeStyleElement(styleElement) {
|
||
// istanbul ignore if
|
||
if (styleElement.parentNode === null) {
|
||
return false;
|
||
}
|
||
styleElement.parentNode.removeChild(styleElement);
|
||
}
|
||
|
||
/* istanbul ignore next */
|
||
function domAPI(options) {
|
||
if (typeof document === "undefined") {
|
||
return {
|
||
update: function update() {},
|
||
remove: function remove() {}
|
||
};
|
||
}
|
||
var styleElement = options.insertStyleElement(options);
|
||
return {
|
||
update: function update(obj) {
|
||
apply(styleElement, options, obj);
|
||
},
|
||
remove: function remove() {
|
||
removeStyleElement(styleElement);
|
||
}
|
||
};
|
||
}
|
||
module.exports = domAPI;
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/style-loader/dist/runtime/styleTagTransform.js":
|
||
/***/ ((module) => {
|
||
|
||
"use strict";
|
||
|
||
|
||
/* istanbul ignore next */
|
||
function styleTagTransform(css, styleElement) {
|
||
if (styleElement.styleSheet) {
|
||
styleElement.styleSheet.cssText = css;
|
||
} else {
|
||
while (styleElement.firstChild) {
|
||
styleElement.removeChild(styleElement.firstChild);
|
||
}
|
||
styleElement.appendChild(document.createTextNode(css));
|
||
}
|
||
}
|
||
module.exports = styleTagTransform;
|
||
|
||
/***/ })
|
||
|
||
/******/ });
|
||
/************************************************************************/
|
||
/******/ // The module cache
|
||
/******/ var __webpack_module_cache__ = {};
|
||
/******/
|
||
/******/ // The require function
|
||
/******/ function __webpack_require__(moduleId) {
|
||
/******/ // Check if module is in cache
|
||
/******/ var cachedModule = __webpack_module_cache__[moduleId];
|
||
/******/ if (cachedModule !== undefined) {
|
||
/******/ return cachedModule.exports;
|
||
/******/ }
|
||
/******/ // Create a new module (and put it into the cache)
|
||
/******/ var module = __webpack_module_cache__[moduleId] = {
|
||
/******/ id: moduleId,
|
||
/******/ // no module.loaded needed
|
||
/******/ exports: {}
|
||
/******/ };
|
||
/******/
|
||
/******/ // Execute the module function
|
||
/******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
||
/******/
|
||
/******/ // Return the exports of the module
|
||
/******/ return module.exports;
|
||
/******/ }
|
||
/******/
|
||
/************************************************************************/
|
||
/******/ /* webpack/runtime/compat get default export */
|
||
/******/ (() => {
|
||
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
||
/******/ __webpack_require__.n = (module) => {
|
||
/******/ var getter = module && module.__esModule ?
|
||
/******/ () => (module['default']) :
|
||
/******/ () => (module);
|
||
/******/ __webpack_require__.d(getter, { a: getter });
|
||
/******/ return getter;
|
||
/******/ };
|
||
/******/ })();
|
||
/******/
|
||
/******/ /* webpack/runtime/define property getters */
|
||
/******/ (() => {
|
||
/******/ // define getter functions for harmony exports
|
||
/******/ __webpack_require__.d = (exports, definition) => {
|
||
/******/ for(var key in definition) {
|
||
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
|
||
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
|
||
/******/ }
|
||
/******/ }
|
||
/******/ };
|
||
/******/ })();
|
||
/******/
|
||
/******/ /* webpack/runtime/hasOwnProperty shorthand */
|
||
/******/ (() => {
|
||
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
|
||
/******/ })();
|
||
/******/
|
||
/******/ /* webpack/runtime/nonce */
|
||
/******/ (() => {
|
||
/******/ __webpack_require__.nc = undefined;
|
||
/******/ })();
|
||
/******/
|
||
/************************************************************************/
|
||
var __webpack_exports__ = {};
|
||
// This entry need to be wrapped in an IIFE because it need to be in strict mode.
|
||
(() => {
|
||
"use strict";
|
||
|
||
;// CONCATENATED MODULE: ./node_modules/chrono-node/dist/esm/utils/pattern.js
|
||
function repeatedTimeunitPattern(prefix, singleTimeunitPattern) {
|
||
const singleTimeunitPatternNoCapture = singleTimeunitPattern.replace(/\((?!\?)/g, "(?:");
|
||
return `${prefix}${singleTimeunitPatternNoCapture}\\s{0,5}(?:,?\\s{0,5}${singleTimeunitPatternNoCapture}){0,10}`;
|
||
}
|
||
function extractTerms(dictionary) {
|
||
let keys;
|
||
if (dictionary instanceof Array) {
|
||
keys = [...dictionary];
|
||
} else if (dictionary instanceof Map) {
|
||
keys = Array.from(dictionary.keys());
|
||
} else {
|
||
keys = Object.keys(dictionary);
|
||
}
|
||
return keys;
|
||
}
|
||
function matchAnyPattern(dictionary) {
|
||
const joinedTerms = extractTerms(dictionary).sort((a, b) => b.length - a.length).join("|").replace(/\./g, "\\.");
|
||
return `(?:${joinedTerms})`;
|
||
}
|
||
// EXTERNAL MODULE: ./node_modules/dayjs/dayjs.min.js
|
||
var dayjs_min = __webpack_require__("./node_modules/dayjs/dayjs.min.js");
|
||
;// CONCATENATED MODULE: ./node_modules/chrono-node/dist/esm/calculation/years.js
|
||
|
||
function findMostLikelyADYear(yearNumber) {
|
||
if (yearNumber < 100) {
|
||
if (yearNumber > 50) {
|
||
yearNumber = yearNumber + 1900;
|
||
} else {
|
||
yearNumber = yearNumber + 2000;
|
||
}
|
||
}
|
||
return yearNumber;
|
||
}
|
||
function findYearClosestToRef(refDate, day, month) {
|
||
const refMoment = dayjs_min(refDate);
|
||
let dateMoment = refMoment;
|
||
dateMoment = dateMoment.month(month - 1);
|
||
dateMoment = dateMoment.date(day);
|
||
dateMoment = dateMoment.year(refMoment.year());
|
||
const nextYear = dateMoment.add(1, "y");
|
||
const lastYear = dateMoment.add(-1, "y");
|
||
if (Math.abs(nextYear.diff(refMoment)) < Math.abs(dateMoment.diff(refMoment))) {
|
||
dateMoment = nextYear;
|
||
} else if (Math.abs(lastYear.diff(refMoment)) < Math.abs(dateMoment.diff(refMoment))) {
|
||
dateMoment = lastYear;
|
||
}
|
||
return dateMoment.year();
|
||
}
|
||
;// CONCATENATED MODULE: ./node_modules/chrono-node/dist/esm/locales/en/constants.js
|
||
|
||
|
||
const WEEKDAY_DICTIONARY = {
|
||
sunday: 0,
|
||
sun: 0,
|
||
"sun.": 0,
|
||
monday: 1,
|
||
mon: 1,
|
||
"mon.": 1,
|
||
tuesday: 2,
|
||
tue: 2,
|
||
"tue.": 2,
|
||
wednesday: 3,
|
||
wed: 3,
|
||
"wed.": 3,
|
||
thursday: 4,
|
||
thurs: 4,
|
||
"thurs.": 4,
|
||
thur: 4,
|
||
"thur.": 4,
|
||
thu: 4,
|
||
"thu.": 4,
|
||
friday: 5,
|
||
fri: 5,
|
||
"fri.": 5,
|
||
saturday: 6,
|
||
sat: 6,
|
||
"sat.": 6
|
||
};
|
||
const FULL_MONTH_NAME_DICTIONARY = {
|
||
january: 1,
|
||
february: 2,
|
||
march: 3,
|
||
april: 4,
|
||
may: 5,
|
||
june: 6,
|
||
july: 7,
|
||
august: 8,
|
||
september: 9,
|
||
october: 10,
|
||
november: 11,
|
||
december: 12
|
||
};
|
||
const MONTH_DICTIONARY = {
|
||
...FULL_MONTH_NAME_DICTIONARY,
|
||
jan: 1,
|
||
"jan.": 1,
|
||
feb: 2,
|
||
"feb.": 2,
|
||
mar: 3,
|
||
"mar.": 3,
|
||
apr: 4,
|
||
"apr.": 4,
|
||
jun: 6,
|
||
"jun.": 6,
|
||
jul: 7,
|
||
"jul.": 7,
|
||
aug: 8,
|
||
"aug.": 8,
|
||
sep: 9,
|
||
"sep.": 9,
|
||
sept: 9,
|
||
"sept.": 9,
|
||
oct: 10,
|
||
"oct.": 10,
|
||
nov: 11,
|
||
"nov.": 11,
|
||
dec: 12,
|
||
"dec.": 12
|
||
};
|
||
const INTEGER_WORD_DICTIONARY = {
|
||
one: 1,
|
||
two: 2,
|
||
three: 3,
|
||
four: 4,
|
||
five: 5,
|
||
six: 6,
|
||
seven: 7,
|
||
eight: 8,
|
||
nine: 9,
|
||
ten: 10,
|
||
eleven: 11,
|
||
twelve: 12
|
||
};
|
||
const ORDINAL_WORD_DICTIONARY = {
|
||
first: 1,
|
||
second: 2,
|
||
third: 3,
|
||
fourth: 4,
|
||
fifth: 5,
|
||
sixth: 6,
|
||
seventh: 7,
|
||
eighth: 8,
|
||
ninth: 9,
|
||
tenth: 10,
|
||
eleventh: 11,
|
||
twelfth: 12,
|
||
thirteenth: 13,
|
||
fourteenth: 14,
|
||
fifteenth: 15,
|
||
sixteenth: 16,
|
||
seventeenth: 17,
|
||
eighteenth: 18,
|
||
nineteenth: 19,
|
||
twentieth: 20,
|
||
"twenty first": 21,
|
||
"twenty-first": 21,
|
||
"twenty second": 22,
|
||
"twenty-second": 22,
|
||
"twenty third": 23,
|
||
"twenty-third": 23,
|
||
"twenty fourth": 24,
|
||
"twenty-fourth": 24,
|
||
"twenty fifth": 25,
|
||
"twenty-fifth": 25,
|
||
"twenty sixth": 26,
|
||
"twenty-sixth": 26,
|
||
"twenty seventh": 27,
|
||
"twenty-seventh": 27,
|
||
"twenty eighth": 28,
|
||
"twenty-eighth": 28,
|
||
"twenty ninth": 29,
|
||
"twenty-ninth": 29,
|
||
"thirtieth": 30,
|
||
"thirty first": 31,
|
||
"thirty-first": 31
|
||
};
|
||
const TIME_UNIT_DICTIONARY_NO_ABBR = {
|
||
second: "second",
|
||
seconds: "second",
|
||
minute: "minute",
|
||
minutes: "minute",
|
||
hour: "hour",
|
||
hours: "hour",
|
||
day: "d",
|
||
days: "d",
|
||
week: "week",
|
||
weeks: "week",
|
||
month: "month",
|
||
months: "month",
|
||
quarter: "quarter",
|
||
quarters: "quarter",
|
||
year: "year",
|
||
years: "year"
|
||
};
|
||
const TIME_UNIT_DICTIONARY = {
|
||
s: "second",
|
||
sec: "second",
|
||
second: "second",
|
||
seconds: "second",
|
||
m: "minute",
|
||
min: "minute",
|
||
mins: "minute",
|
||
minute: "minute",
|
||
minutes: "minute",
|
||
h: "hour",
|
||
hr: "hour",
|
||
hrs: "hour",
|
||
hour: "hour",
|
||
hours: "hour",
|
||
d: "d",
|
||
day: "d",
|
||
days: "d",
|
||
w: "w",
|
||
week: "week",
|
||
weeks: "week",
|
||
mo: "month",
|
||
mon: "month",
|
||
mos: "month",
|
||
month: "month",
|
||
months: "month",
|
||
qtr: "quarter",
|
||
quarter: "quarter",
|
||
quarters: "quarter",
|
||
y: "year",
|
||
yr: "year",
|
||
year: "year",
|
||
years: "year",
|
||
...TIME_UNIT_DICTIONARY_NO_ABBR
|
||
};
|
||
const NUMBER_PATTERN = `(?:${matchAnyPattern(INTEGER_WORD_DICTIONARY)}|[0-9]+|[0-9]+\\.[0-9]+|half(?:\\s{0,2}an?)?|an?\\b(?:\\s{0,2}few)?|few|several|the|a?\\s{0,2}couple\\s{0,2}(?:of)?)`;
|
||
function parseNumberPattern(match) {
|
||
const num = match.toLowerCase();
|
||
if (INTEGER_WORD_DICTIONARY[num] !== undefined) {
|
||
return INTEGER_WORD_DICTIONARY[num];
|
||
} else if (num === "a" || num === "an" || num == "the") {
|
||
return 1;
|
||
} else if (num.match(/few/)) {
|
||
return 3;
|
||
} else if (num.match(/half/)) {
|
||
return 0.5;
|
||
} else if (num.match(/couple/)) {
|
||
return 2;
|
||
} else if (num.match(/several/)) {
|
||
return 7;
|
||
}
|
||
return parseFloat(num);
|
||
}
|
||
const ORDINAL_NUMBER_PATTERN = `(?:${matchAnyPattern(ORDINAL_WORD_DICTIONARY)}|[0-9]{1,2}(?:st|nd|rd|th)?)`;
|
||
function parseOrdinalNumberPattern(match) {
|
||
let num = match.toLowerCase();
|
||
if (ORDINAL_WORD_DICTIONARY[num] !== undefined) {
|
||
return ORDINAL_WORD_DICTIONARY[num];
|
||
}
|
||
num = num.replace(/(?:st|nd|rd|th)$/i, "");
|
||
return parseInt(num);
|
||
}
|
||
const YEAR_PATTERN = `(?:[1-9][0-9]{0,3}\\s{0,2}(?:BE|AD|BC|BCE|CE)|[1-2][0-9]{3}|[5-9][0-9])`;
|
||
function parseYear(match) {
|
||
if (/BE/i.test(match)) {
|
||
match = match.replace(/BE/i, "");
|
||
return parseInt(match) - 543;
|
||
}
|
||
if (/BCE?/i.test(match)) {
|
||
match = match.replace(/BCE?/i, "");
|
||
return -parseInt(match);
|
||
}
|
||
if (/(AD|CE)/i.test(match)) {
|
||
match = match.replace(/(AD|CE)/i, "");
|
||
return parseInt(match);
|
||
}
|
||
const rawYearNumber = parseInt(match);
|
||
return findMostLikelyADYear(rawYearNumber);
|
||
}
|
||
const SINGLE_TIME_UNIT_PATTERN = `(${NUMBER_PATTERN})\\s{0,3}(${matchAnyPattern(TIME_UNIT_DICTIONARY)})`;
|
||
const SINGLE_TIME_UNIT_REGEX = new RegExp(SINGLE_TIME_UNIT_PATTERN, "i");
|
||
const SINGLE_TIME_UNIT_NO_ABBR_PATTERN = `(${NUMBER_PATTERN})\\s{0,3}(${matchAnyPattern(TIME_UNIT_DICTIONARY_NO_ABBR)})`;
|
||
const TIME_UNITS_PATTERN = repeatedTimeunitPattern(`(?:(?:about|around)\\s{0,3})?`, SINGLE_TIME_UNIT_PATTERN);
|
||
const TIME_UNITS_NO_ABBR_PATTERN = repeatedTimeunitPattern(`(?:(?:about|around)\\s{0,3})?`, SINGLE_TIME_UNIT_NO_ABBR_PATTERN);
|
||
function parseTimeUnits(timeunitText) {
|
||
const fragments = {};
|
||
let remainingText = timeunitText;
|
||
let match = SINGLE_TIME_UNIT_REGEX.exec(remainingText);
|
||
while (match) {
|
||
collectDateTimeFragment(fragments, match);
|
||
remainingText = remainingText.substring(match[0].length).trim();
|
||
match = SINGLE_TIME_UNIT_REGEX.exec(remainingText);
|
||
}
|
||
return fragments;
|
||
}
|
||
function collectDateTimeFragment(fragments, match) {
|
||
const num = parseNumberPattern(match[1]);
|
||
const unit = TIME_UNIT_DICTIONARY[match[2].toLowerCase()];
|
||
fragments[unit] = num;
|
||
}
|
||
// EXTERNAL MODULE: ./node_modules/dayjs/plugin/quarterOfYear.js
|
||
var quarterOfYear = __webpack_require__("./node_modules/dayjs/plugin/quarterOfYear.js");
|
||
;// CONCATENATED MODULE: ./node_modules/chrono-node/dist/esm/utils/dayjs.js
|
||
|
||
function assignTheNextDay(component, targetDayJs) {
|
||
targetDayJs = targetDayJs.add(1, "day");
|
||
dayjs_assignSimilarDate(component, targetDayJs);
|
||
implySimilarTime(component, targetDayJs);
|
||
}
|
||
function implyTheNextDay(component, targetDayJs) {
|
||
targetDayJs = targetDayJs.add(1, "day");
|
||
implySimilarDate(component, targetDayJs);
|
||
implySimilarTime(component, targetDayJs);
|
||
}
|
||
function dayjs_assignSimilarDate(component, targetDayJs) {
|
||
component.assign("day", targetDayJs.date());
|
||
component.assign("month", targetDayJs.month() + 1);
|
||
component.assign("year", targetDayJs.year());
|
||
}
|
||
function assignSimilarTime(component, targetDayJs) {
|
||
component.assign("hour", targetDayJs.hour());
|
||
component.assign("minute", targetDayJs.minute());
|
||
component.assign("second", targetDayJs.second());
|
||
component.assign("millisecond", targetDayJs.millisecond());
|
||
if (component.get("hour") < 12) {
|
||
component.assign("meridiem", esm_Meridiem.AM);
|
||
} else {
|
||
component.assign("meridiem", esm_Meridiem.PM);
|
||
}
|
||
}
|
||
function implySimilarDate(component, targetDayJs) {
|
||
component.imply("day", targetDayJs.date());
|
||
component.imply("month", targetDayJs.month() + 1);
|
||
component.imply("year", targetDayJs.year());
|
||
}
|
||
function implySimilarTime(component, targetDayJs) {
|
||
component.imply("hour", targetDayJs.hour());
|
||
component.imply("minute", targetDayJs.minute());
|
||
component.imply("second", targetDayJs.second());
|
||
component.imply("millisecond", targetDayJs.millisecond());
|
||
}
|
||
;// CONCATENATED MODULE: ./node_modules/chrono-node/dist/esm/timezone.js
|
||
|
||
|
||
const TIMEZONE_ABBR_MAP = {
|
||
ACDT: 630,
|
||
ACST: 570,
|
||
ADT: -180,
|
||
AEDT: 660,
|
||
AEST: 600,
|
||
AFT: 270,
|
||
AKDT: -480,
|
||
AKST: -540,
|
||
ALMT: 360,
|
||
AMST: -180,
|
||
AMT: -240,
|
||
ANAST: 720,
|
||
ANAT: 720,
|
||
AQTT: 300,
|
||
ART: -180,
|
||
AST: -240,
|
||
AWDT: 540,
|
||
AWST: 480,
|
||
AZOST: 0,
|
||
AZOT: -60,
|
||
AZST: 300,
|
||
AZT: 240,
|
||
BNT: 480,
|
||
BOT: -240,
|
||
BRST: -120,
|
||
BRT: -180,
|
||
BST: 60,
|
||
BTT: 360,
|
||
CAST: 480,
|
||
CAT: 120,
|
||
CCT: 390,
|
||
CDT: -300,
|
||
CEST: 120,
|
||
CET: {
|
||
timezoneOffsetDuringDst: 2 * 60,
|
||
timezoneOffsetNonDst: 60,
|
||
dstStart: year => getLastWeekdayOfMonth(year, Month.MARCH, Weekday.SUNDAY, 2),
|
||
dstEnd: year => getLastWeekdayOfMonth(year, Month.OCTOBER, Weekday.SUNDAY, 3)
|
||
},
|
||
CHADT: 825,
|
||
CHAST: 765,
|
||
CKT: -600,
|
||
CLST: -180,
|
||
CLT: -240,
|
||
COT: -300,
|
||
CST: -360,
|
||
CT: {
|
||
timezoneOffsetDuringDst: -5 * 60,
|
||
timezoneOffsetNonDst: -6 * 60,
|
||
dstStart: year => getNthWeekdayOfMonth(year, Month.MARCH, Weekday.SUNDAY, 2, 2),
|
||
dstEnd: year => getNthWeekdayOfMonth(year, Month.NOVEMBER, Weekday.SUNDAY, 1, 2)
|
||
},
|
||
CVT: -60,
|
||
CXT: 420,
|
||
ChST: 600,
|
||
DAVT: 420,
|
||
EASST: -300,
|
||
EAST: -360,
|
||
EAT: 180,
|
||
ECT: -300,
|
||
EDT: -240,
|
||
EEST: 180,
|
||
EET: 120,
|
||
EGST: 0,
|
||
EGT: -60,
|
||
EST: -300,
|
||
ET: {
|
||
timezoneOffsetDuringDst: -4 * 60,
|
||
timezoneOffsetNonDst: -5 * 60,
|
||
dstStart: year => getNthWeekdayOfMonth(year, Month.MARCH, Weekday.SUNDAY, 2, 2),
|
||
dstEnd: year => getNthWeekdayOfMonth(year, Month.NOVEMBER, Weekday.SUNDAY, 1, 2)
|
||
},
|
||
FJST: 780,
|
||
FJT: 720,
|
||
FKST: -180,
|
||
FKT: -240,
|
||
FNT: -120,
|
||
GALT: -360,
|
||
GAMT: -540,
|
||
GET: 240,
|
||
GFT: -180,
|
||
GILT: 720,
|
||
GMT: 0,
|
||
GST: 240,
|
||
GYT: -240,
|
||
HAA: -180,
|
||
HAC: -300,
|
||
HADT: -540,
|
||
HAE: -240,
|
||
HAP: -420,
|
||
HAR: -360,
|
||
HAST: -600,
|
||
HAT: -90,
|
||
HAY: -480,
|
||
HKT: 480,
|
||
HLV: -210,
|
||
HNA: -240,
|
||
HNC: -360,
|
||
HNE: -300,
|
||
HNP: -480,
|
||
HNR: -420,
|
||
HNT: -150,
|
||
HNY: -540,
|
||
HOVT: 420,
|
||
ICT: 420,
|
||
IDT: 180,
|
||
IOT: 360,
|
||
IRDT: 270,
|
||
IRKST: 540,
|
||
IRKT: 540,
|
||
IRST: 210,
|
||
IST: 330,
|
||
JST: 540,
|
||
KGT: 360,
|
||
KRAST: 480,
|
||
KRAT: 480,
|
||
KST: 540,
|
||
KUYT: 240,
|
||
LHDT: 660,
|
||
LHST: 630,
|
||
LINT: 840,
|
||
MAGST: 720,
|
||
MAGT: 720,
|
||
MART: -510,
|
||
MAWT: 300,
|
||
MDT: -360,
|
||
MESZ: 120,
|
||
MEZ: 60,
|
||
MHT: 720,
|
||
MMT: 390,
|
||
MSD: 240,
|
||
MSK: 180,
|
||
MST: -420,
|
||
MT: {
|
||
timezoneOffsetDuringDst: -6 * 60,
|
||
timezoneOffsetNonDst: -7 * 60,
|
||
dstStart: year => getNthWeekdayOfMonth(year, Month.MARCH, Weekday.SUNDAY, 2, 2),
|
||
dstEnd: year => getNthWeekdayOfMonth(year, Month.NOVEMBER, Weekday.SUNDAY, 1, 2)
|
||
},
|
||
MUT: 240,
|
||
MVT: 300,
|
||
MYT: 480,
|
||
NCT: 660,
|
||
NDT: -90,
|
||
NFT: 690,
|
||
NOVST: 420,
|
||
NOVT: 360,
|
||
NPT: 345,
|
||
NST: -150,
|
||
NUT: -660,
|
||
NZDT: 780,
|
||
NZST: 720,
|
||
OMSST: 420,
|
||
OMST: 420,
|
||
PDT: -420,
|
||
PET: -300,
|
||
PETST: 720,
|
||
PETT: 720,
|
||
PGT: 600,
|
||
PHOT: 780,
|
||
PHT: 480,
|
||
PKT: 300,
|
||
PMDT: -120,
|
||
PMST: -180,
|
||
PONT: 660,
|
||
PST: -480,
|
||
PT: {
|
||
timezoneOffsetDuringDst: -7 * 60,
|
||
timezoneOffsetNonDst: -8 * 60,
|
||
dstStart: year => getNthWeekdayOfMonth(year, Month.MARCH, Weekday.SUNDAY, 2, 2),
|
||
dstEnd: year => getNthWeekdayOfMonth(year, Month.NOVEMBER, Weekday.SUNDAY, 1, 2)
|
||
},
|
||
PWT: 540,
|
||
PYST: -180,
|
||
PYT: -240,
|
||
RET: 240,
|
||
SAMT: 240,
|
||
SAST: 120,
|
||
SBT: 660,
|
||
SCT: 240,
|
||
SGT: 480,
|
||
SRT: -180,
|
||
SST: -660,
|
||
TAHT: -600,
|
||
TFT: 300,
|
||
TJT: 300,
|
||
TKT: 780,
|
||
TLT: 540,
|
||
TMT: 300,
|
||
TVT: 720,
|
||
ULAT: 480,
|
||
UTC: 0,
|
||
UYST: -120,
|
||
UYT: -180,
|
||
UZT: 300,
|
||
VET: -210,
|
||
VLAST: 660,
|
||
VLAT: 660,
|
||
VUT: 660,
|
||
WAST: 120,
|
||
WAT: 60,
|
||
WEST: 60,
|
||
WESZ: 60,
|
||
WET: 0,
|
||
WEZ: 0,
|
||
WFT: 720,
|
||
WGST: -120,
|
||
WGT: -180,
|
||
WIB: 420,
|
||
WIT: 540,
|
||
WITA: 480,
|
||
WST: 780,
|
||
WT: 0,
|
||
YAKST: 600,
|
||
YAKT: 600,
|
||
YAPT: 600,
|
||
YEKST: 360,
|
||
YEKT: 360
|
||
};
|
||
function getNthWeekdayOfMonth(year, month, weekday, n, hour = 0) {
|
||
let dayOfMonth = 0;
|
||
let i = 0;
|
||
while (i < n) {
|
||
dayOfMonth++;
|
||
const date = new Date(year, month - 1, dayOfMonth);
|
||
if (date.getDay() === weekday) i++;
|
||
}
|
||
return new Date(year, month - 1, dayOfMonth, hour);
|
||
}
|
||
function getLastWeekdayOfMonth(year, month, weekday, hour = 0) {
|
||
const oneIndexedWeekday = weekday === 0 ? 7 : weekday;
|
||
const date = new Date(year, month - 1 + 1, 1, 12);
|
||
const firstWeekdayNextMonth = date.getDay() === 0 ? 7 : date.getDay();
|
||
let dayDiff;
|
||
if (firstWeekdayNextMonth === oneIndexedWeekday) dayDiff = 7;else if (firstWeekdayNextMonth < oneIndexedWeekday) dayDiff = 7 + firstWeekdayNextMonth - oneIndexedWeekday;else dayDiff = firstWeekdayNextMonth - oneIndexedWeekday;
|
||
date.setDate(date.getDate() - dayDiff);
|
||
return new Date(year, month - 1, date.getDate(), hour);
|
||
}
|
||
function toTimezoneOffset(timezoneInput, date, timezoneOverrides = {}) {
|
||
if (timezoneInput == null) {
|
||
return null;
|
||
}
|
||
if (typeof timezoneInput === "number") {
|
||
return timezoneInput;
|
||
}
|
||
const matchedTimezone = timezoneOverrides[timezoneInput] ?? TIMEZONE_ABBR_MAP[timezoneInput];
|
||
if (matchedTimezone == null) {
|
||
return null;
|
||
}
|
||
if (typeof matchedTimezone == "number") {
|
||
return matchedTimezone;
|
||
}
|
||
if (date == null) {
|
||
return null;
|
||
}
|
||
if (dayjs_min(date).isAfter(matchedTimezone.dstStart(date.getFullYear())) && !dayjs_min(date).isAfter(matchedTimezone.dstEnd(date.getFullYear()))) {
|
||
return matchedTimezone.timezoneOffsetDuringDst;
|
||
}
|
||
return matchedTimezone.timezoneOffsetNonDst;
|
||
}
|
||
;// CONCATENATED MODULE: ./node_modules/chrono-node/dist/esm/results.js
|
||
|
||
|
||
|
||
|
||
dayjs_min.extend(quarterOfYear);
|
||
class ReferenceWithTimezone {
|
||
constructor(input) {
|
||
input = input ?? new Date();
|
||
if (input instanceof Date) {
|
||
this.instant = input;
|
||
} else {
|
||
this.instant = input.instant ?? new Date();
|
||
this.timezoneOffset = toTimezoneOffset(input.timezone, this.instant);
|
||
}
|
||
}
|
||
getDateWithAdjustedTimezone() {
|
||
return new Date(this.instant.getTime() + this.getSystemTimezoneAdjustmentMinute(this.instant) * 60000);
|
||
}
|
||
getSystemTimezoneAdjustmentMinute(date, overrideTimezoneOffset) {
|
||
if (!date || date.getTime() < 0) {
|
||
date = new Date();
|
||
}
|
||
const currentTimezoneOffset = -date.getTimezoneOffset();
|
||
const targetTimezoneOffset = overrideTimezoneOffset ?? this.timezoneOffset ?? currentTimezoneOffset;
|
||
return currentTimezoneOffset - targetTimezoneOffset;
|
||
}
|
||
}
|
||
class results_ParsingComponents {
|
||
constructor(reference, knownComponents) {
|
||
this.reference = reference;
|
||
this.knownValues = {};
|
||
this.impliedValues = {};
|
||
if (knownComponents) {
|
||
for (const key in knownComponents) {
|
||
this.knownValues[key] = knownComponents[key];
|
||
}
|
||
}
|
||
const refDayJs = dayjs_min(reference.instant);
|
||
this.imply("day", refDayJs.date());
|
||
this.imply("month", refDayJs.month() + 1);
|
||
this.imply("year", refDayJs.year());
|
||
this.imply("hour", 12);
|
||
this.imply("minute", 0);
|
||
this.imply("second", 0);
|
||
this.imply("millisecond", 0);
|
||
}
|
||
get(component) {
|
||
if (component in this.knownValues) {
|
||
return this.knownValues[component];
|
||
}
|
||
if (component in this.impliedValues) {
|
||
return this.impliedValues[component];
|
||
}
|
||
return null;
|
||
}
|
||
isCertain(component) {
|
||
return component in this.knownValues;
|
||
}
|
||
getCertainComponents() {
|
||
return Object.keys(this.knownValues);
|
||
}
|
||
imply(component, value) {
|
||
if (component in this.knownValues) {
|
||
return this;
|
||
}
|
||
this.impliedValues[component] = value;
|
||
return this;
|
||
}
|
||
assign(component, value) {
|
||
this.knownValues[component] = value;
|
||
delete this.impliedValues[component];
|
||
return this;
|
||
}
|
||
delete(component) {
|
||
delete this.knownValues[component];
|
||
delete this.impliedValues[component];
|
||
}
|
||
clone() {
|
||
const component = new results_ParsingComponents(this.reference);
|
||
component.knownValues = {};
|
||
component.impliedValues = {};
|
||
for (const key in this.knownValues) {
|
||
component.knownValues[key] = this.knownValues[key];
|
||
}
|
||
for (const key in this.impliedValues) {
|
||
component.impliedValues[key] = this.impliedValues[key];
|
||
}
|
||
return component;
|
||
}
|
||
isOnlyDate() {
|
||
return !this.isCertain("hour") && !this.isCertain("minute") && !this.isCertain("second");
|
||
}
|
||
isOnlyTime() {
|
||
return !this.isCertain("weekday") && !this.isCertain("day") && !this.isCertain("month");
|
||
}
|
||
isOnlyWeekdayComponent() {
|
||
return this.isCertain("weekday") && !this.isCertain("day") && !this.isCertain("month");
|
||
}
|
||
isDateWithUnknownYear() {
|
||
return this.isCertain("month") && !this.isCertain("year");
|
||
}
|
||
isValidDate() {
|
||
const date = this.dateWithoutTimezoneAdjustment();
|
||
if (date.getFullYear() !== this.get("year")) return false;
|
||
if (date.getMonth() !== this.get("month") - 1) return false;
|
||
if (date.getDate() !== this.get("day")) return false;
|
||
if (this.get("hour") != null && date.getHours() != this.get("hour")) return false;
|
||
if (this.get("minute") != null && date.getMinutes() != this.get("minute")) return false;
|
||
return true;
|
||
}
|
||
toString() {
|
||
return `[ParsingComponents {knownValues: ${JSON.stringify(this.knownValues)}, impliedValues: ${JSON.stringify(this.impliedValues)}}, reference: ${JSON.stringify(this.reference)}]`;
|
||
}
|
||
dayjs() {
|
||
return dayjs_min(this.date());
|
||
}
|
||
date() {
|
||
const date = this.dateWithoutTimezoneAdjustment();
|
||
const timezoneAdjustment = this.reference.getSystemTimezoneAdjustmentMinute(date, this.get("timezoneOffset"));
|
||
return new Date(date.getTime() + timezoneAdjustment * 60000);
|
||
}
|
||
dateWithoutTimezoneAdjustment() {
|
||
const date = new Date(this.get("year"), this.get("month") - 1, this.get("day"), this.get("hour"), this.get("minute"), this.get("second"), this.get("millisecond"));
|
||
date.setFullYear(this.get("year"));
|
||
return date;
|
||
}
|
||
static createRelativeFromReference(reference, fragments) {
|
||
let date = dayjs_min(reference.instant);
|
||
for (const key in fragments) {
|
||
date = date.add(fragments[key], key);
|
||
}
|
||
const components = new results_ParsingComponents(reference);
|
||
if (fragments["hour"] || fragments["minute"] || fragments["second"]) {
|
||
assignSimilarTime(components, date);
|
||
dayjs_assignSimilarDate(components, date);
|
||
if (reference.timezoneOffset !== null) {
|
||
components.assign("timezoneOffset", -reference.instant.getTimezoneOffset());
|
||
}
|
||
} else {
|
||
implySimilarTime(components, date);
|
||
if (reference.timezoneOffset !== null) {
|
||
components.imply("timezoneOffset", -reference.instant.getTimezoneOffset());
|
||
}
|
||
if (fragments["d"]) {
|
||
components.assign("day", date.date());
|
||
components.assign("month", date.month() + 1);
|
||
components.assign("year", date.year());
|
||
} else {
|
||
if (fragments["week"]) {
|
||
components.imply("weekday", date.day());
|
||
}
|
||
components.imply("day", date.date());
|
||
if (fragments["month"]) {
|
||
components.assign("month", date.month() + 1);
|
||
components.assign("year", date.year());
|
||
} else {
|
||
components.imply("month", date.month() + 1);
|
||
if (fragments["year"]) {
|
||
components.assign("year", date.year());
|
||
} else {
|
||
components.imply("year", date.year());
|
||
}
|
||
}
|
||
}
|
||
}
|
||
return components;
|
||
}
|
||
}
|
||
class ParsingResult {
|
||
constructor(reference, index, text, start, end) {
|
||
this.reference = reference;
|
||
this.refDate = reference.instant;
|
||
this.index = index;
|
||
this.text = text;
|
||
this.start = start || new results_ParsingComponents(reference);
|
||
this.end = end;
|
||
}
|
||
clone() {
|
||
const result = new ParsingResult(this.reference, this.index, this.text);
|
||
result.start = this.start ? this.start.clone() : null;
|
||
result.end = this.end ? this.end.clone() : null;
|
||
return result;
|
||
}
|
||
date() {
|
||
return this.start.date();
|
||
}
|
||
toString() {
|
||
return `[ParsingResult {index: ${this.index}, text: '${this.text}', ...}]`;
|
||
}
|
||
}
|
||
;// CONCATENATED MODULE: ./node_modules/chrono-node/dist/esm/common/parsers/AbstractParserWithWordBoundary.js
|
||
class AbstractParserWithWordBoundaryChecking {
|
||
constructor() {
|
||
this.cachedInnerPattern = null;
|
||
this.cachedPattern = null;
|
||
}
|
||
patternLeftBoundary() {
|
||
return `(\\W|^)`;
|
||
}
|
||
pattern(context) {
|
||
const innerPattern = this.innerPattern(context);
|
||
if (innerPattern == this.cachedInnerPattern) {
|
||
return this.cachedPattern;
|
||
}
|
||
this.cachedPattern = new RegExp(`${this.patternLeftBoundary()}${innerPattern.source}`, innerPattern.flags);
|
||
this.cachedInnerPattern = innerPattern;
|
||
return this.cachedPattern;
|
||
}
|
||
extract(context, match) {
|
||
const header = match[1] ?? "";
|
||
match.index = match.index + header.length;
|
||
match[0] = match[0].substring(header.length);
|
||
for (let i = 2; i < match.length; i++) {
|
||
match[i - 1] = match[i];
|
||
}
|
||
return this.innerExtract(context, match);
|
||
}
|
||
}
|
||
;// CONCATENATED MODULE: ./node_modules/chrono-node/dist/esm/locales/en/parsers/ENTimeUnitWithinFormatParser.js
|
||
|
||
|
||
|
||
const PATTERN_WITHOUT_PREFIX = new RegExp(`(?:(?:about|around|roughly|approximately|just)\\s*(?:~\\s*)?)?(${TIME_UNITS_PATTERN})(?=\\W|$)`, "i");
|
||
const PATTERN_WITH_PREFIX = new RegExp(`(?:within|in|for)\\s*` + `(?:(?:about|around|roughly|approximately|just)\\s*(?:~\\s*)?)?(${TIME_UNITS_PATTERN})(?=\\W|$)`, "i");
|
||
const PATTERN_WITH_PREFIX_STRICT = new RegExp(`(?:within|in|for)\\s*` + `(?:(?:about|around|roughly|approximately|just)\\s*(?:~\\s*)?)?(${TIME_UNITS_NO_ABBR_PATTERN})(?=\\W|$)`, "i");
|
||
class ENTimeUnitWithinFormatParser extends AbstractParserWithWordBoundaryChecking {
|
||
constructor(strictMode) {
|
||
super();
|
||
this.strictMode = strictMode;
|
||
}
|
||
innerPattern(context) {
|
||
if (this.strictMode) {
|
||
return PATTERN_WITH_PREFIX_STRICT;
|
||
}
|
||
return context.option.forwardDate ? PATTERN_WITHOUT_PREFIX : PATTERN_WITH_PREFIX;
|
||
}
|
||
innerExtract(context, match) {
|
||
const timeUnits = parseTimeUnits(match[1]);
|
||
return results_ParsingComponents.createRelativeFromReference(context.reference, timeUnits);
|
||
}
|
||
}
|
||
;// CONCATENATED MODULE: ./node_modules/chrono-node/dist/esm/locales/en/parsers/ENMonthNameLittleEndianParser.js
|
||
|
||
|
||
|
||
|
||
|
||
|
||
const PATTERN = new RegExp(`(?:on\\s{0,3})?` + `(${ORDINAL_NUMBER_PATTERN})` + `(?:` + `\\s{0,3}(?:to|\\-|\\–|until|through|till)?\\s{0,3}` + `(${ORDINAL_NUMBER_PATTERN})` + ")?" + `(?:-|/|\\s{0,3}(?:of)?\\s{0,3})` + `(${matchAnyPattern(MONTH_DICTIONARY)})` + "(?:" + `(?:-|/|,?\\s{0,3})` + `(${YEAR_PATTERN}(?![^\\s]\\d))` + ")?" + "(?=\\W|$)", "i");
|
||
const DATE_GROUP = 1;
|
||
const DATE_TO_GROUP = 2;
|
||
const MONTH_NAME_GROUP = 3;
|
||
const YEAR_GROUP = 4;
|
||
class ENMonthNameLittleEndianParser extends AbstractParserWithWordBoundaryChecking {
|
||
innerPattern() {
|
||
return PATTERN;
|
||
}
|
||
innerExtract(context, match) {
|
||
const result = context.createParsingResult(match.index, match[0]);
|
||
const month = MONTH_DICTIONARY[match[MONTH_NAME_GROUP].toLowerCase()];
|
||
const day = parseOrdinalNumberPattern(match[DATE_GROUP]);
|
||
if (day > 31) {
|
||
match.index = match.index + match[DATE_GROUP].length;
|
||
return null;
|
||
}
|
||
result.start.assign("month", month);
|
||
result.start.assign("day", day);
|
||
if (match[YEAR_GROUP]) {
|
||
const yearNumber = parseYear(match[YEAR_GROUP]);
|
||
result.start.assign("year", yearNumber);
|
||
} else {
|
||
const year = findYearClosestToRef(context.refDate, day, month);
|
||
result.start.imply("year", year);
|
||
}
|
||
if (match[DATE_TO_GROUP]) {
|
||
const endDate = parseOrdinalNumberPattern(match[DATE_TO_GROUP]);
|
||
result.end = result.start.clone();
|
||
result.end.assign("day", endDate);
|
||
}
|
||
return result;
|
||
}
|
||
}
|
||
;// CONCATENATED MODULE: ./node_modules/chrono-node/dist/esm/locales/en/parsers/ENMonthNameMiddleEndianParser.js
|
||
|
||
|
||
|
||
|
||
|
||
|
||
const ENMonthNameMiddleEndianParser_PATTERN = new RegExp(`(${matchAnyPattern(MONTH_DICTIONARY)})` + "(?:-|/|\\s*,?\\s*)" + `(${ORDINAL_NUMBER_PATTERN})(?!\\s*(?:am|pm))\\s*` + "(?:" + "(?:to|\\-)\\s*" + `(${ORDINAL_NUMBER_PATTERN})\\s*` + ")?" + "(?:" + "(?:-|/|\\s*,?\\s*)" + `(${YEAR_PATTERN})` + ")?" + "(?=\\W|$)(?!\\:\\d)", "i");
|
||
const ENMonthNameMiddleEndianParser_MONTH_NAME_GROUP = 1;
|
||
const ENMonthNameMiddleEndianParser_DATE_GROUP = 2;
|
||
const ENMonthNameMiddleEndianParser_DATE_TO_GROUP = 3;
|
||
const ENMonthNameMiddleEndianParser_YEAR_GROUP = 4;
|
||
class ENMonthNameMiddleEndianParser extends AbstractParserWithWordBoundaryChecking {
|
||
innerPattern() {
|
||
return ENMonthNameMiddleEndianParser_PATTERN;
|
||
}
|
||
innerExtract(context, match) {
|
||
const month = MONTH_DICTIONARY[match[ENMonthNameMiddleEndianParser_MONTH_NAME_GROUP].toLowerCase()];
|
||
const day = parseOrdinalNumberPattern(match[ENMonthNameMiddleEndianParser_DATE_GROUP]);
|
||
if (day > 31) {
|
||
return null;
|
||
}
|
||
const components = context.createParsingComponents({
|
||
day: day,
|
||
month: month
|
||
});
|
||
if (match[ENMonthNameMiddleEndianParser_YEAR_GROUP]) {
|
||
const year = parseYear(match[ENMonthNameMiddleEndianParser_YEAR_GROUP]);
|
||
components.assign("year", year);
|
||
} else {
|
||
const year = findYearClosestToRef(context.refDate, day, month);
|
||
components.imply("year", year);
|
||
}
|
||
if (!match[ENMonthNameMiddleEndianParser_DATE_TO_GROUP]) {
|
||
return components;
|
||
}
|
||
const endDate = parseOrdinalNumberPattern(match[ENMonthNameMiddleEndianParser_DATE_TO_GROUP]);
|
||
const result = context.createParsingResult(match.index, match[0]);
|
||
result.start = components;
|
||
result.end = components.clone();
|
||
result.end.assign("day", endDate);
|
||
return result;
|
||
}
|
||
}
|
||
;// CONCATENATED MODULE: ./node_modules/chrono-node/dist/esm/locales/en/parsers/ENMonthNameParser.js
|
||
|
||
|
||
|
||
|
||
|
||
const ENMonthNameParser_PATTERN = new RegExp(`((?:in)\\s*)?` + `(${matchAnyPattern(MONTH_DICTIONARY)})` + `\\s*` + `(?:` + `[,-]?\\s*(${YEAR_PATTERN})?` + ")?" + "(?=[^\\s\\w]|\\s+[^0-9]|\\s+$|$)", "i");
|
||
const PREFIX_GROUP = 1;
|
||
const ENMonthNameParser_MONTH_NAME_GROUP = 2;
|
||
const ENMonthNameParser_YEAR_GROUP = 3;
|
||
class ENMonthNameParser extends AbstractParserWithWordBoundaryChecking {
|
||
innerPattern() {
|
||
return ENMonthNameParser_PATTERN;
|
||
}
|
||
innerExtract(context, match) {
|
||
const monthName = match[ENMonthNameParser_MONTH_NAME_GROUP].toLowerCase();
|
||
if (match[0].length <= 3 && !FULL_MONTH_NAME_DICTIONARY[monthName]) {
|
||
return null;
|
||
}
|
||
const result = context.createParsingResult(match.index + (match[PREFIX_GROUP] || "").length, match.index + match[0].length);
|
||
result.start.imply("day", 1);
|
||
const month = MONTH_DICTIONARY[monthName];
|
||
result.start.assign("month", month);
|
||
if (match[ENMonthNameParser_YEAR_GROUP]) {
|
||
const year = parseYear(match[ENMonthNameParser_YEAR_GROUP]);
|
||
result.start.assign("year", year);
|
||
} else {
|
||
const year = findYearClosestToRef(context.refDate, 1, month);
|
||
result.start.imply("year", year);
|
||
}
|
||
return result;
|
||
}
|
||
}
|
||
;// CONCATENATED MODULE: ./node_modules/chrono-node/dist/esm/locales/en/parsers/ENCasualYearMonthDayParser.js
|
||
|
||
|
||
|
||
const ENCasualYearMonthDayParser_PATTERN = new RegExp(`([0-9]{4})[\\.\\/\\s]` + `(?:(${matchAnyPattern(MONTH_DICTIONARY)})|([0-9]{1,2}))[\\.\\/\\s]` + `([0-9]{1,2})` + "(?=\\W|$)", "i");
|
||
const YEAR_NUMBER_GROUP = 1;
|
||
const ENCasualYearMonthDayParser_MONTH_NAME_GROUP = 2;
|
||
const MONTH_NUMBER_GROUP = 3;
|
||
const DATE_NUMBER_GROUP = 4;
|
||
class ENCasualYearMonthDayParser extends AbstractParserWithWordBoundaryChecking {
|
||
innerPattern() {
|
||
return ENCasualYearMonthDayParser_PATTERN;
|
||
}
|
||
innerExtract(context, match) {
|
||
const month = match[MONTH_NUMBER_GROUP] ? parseInt(match[MONTH_NUMBER_GROUP]) : MONTH_DICTIONARY[match[ENCasualYearMonthDayParser_MONTH_NAME_GROUP].toLowerCase()];
|
||
if (month < 1 || month > 12) {
|
||
return null;
|
||
}
|
||
const year = parseInt(match[YEAR_NUMBER_GROUP]);
|
||
const day = parseInt(match[DATE_NUMBER_GROUP]);
|
||
return {
|
||
day: day,
|
||
month: month,
|
||
year: year
|
||
};
|
||
}
|
||
}
|
||
;// CONCATENATED MODULE: ./node_modules/chrono-node/dist/esm/locales/en/parsers/ENSlashMonthFormatParser.js
|
||
|
||
const ENSlashMonthFormatParser_PATTERN = new RegExp("([0-9]|0[1-9]|1[012])/([0-9]{4})" + "", "i");
|
||
const MONTH_GROUP = 1;
|
||
const ENSlashMonthFormatParser_YEAR_GROUP = 2;
|
||
class ENSlashMonthFormatParser extends AbstractParserWithWordBoundaryChecking {
|
||
innerPattern() {
|
||
return ENSlashMonthFormatParser_PATTERN;
|
||
}
|
||
innerExtract(context, match) {
|
||
const year = parseInt(match[ENSlashMonthFormatParser_YEAR_GROUP]);
|
||
const month = parseInt(match[MONTH_GROUP]);
|
||
return context.createParsingComponents().imply("day", 1).assign("month", month).assign("year", year);
|
||
}
|
||
}
|
||
;// CONCATENATED MODULE: ./node_modules/chrono-node/dist/esm/common/parsers/AbstractTimeExpressionParser.js
|
||
|
||
function primaryTimePattern(leftBoundary, primaryPrefix, primarySuffix, flags) {
|
||
return new RegExp(`${leftBoundary}` + `${primaryPrefix}` + `(\\d{1,4})` + `(?:` + `(?:\\.|:|:)` + `(\\d{1,2})` + `(?:` + `(?::|:)` + `(\\d{2})` + `(?:\\.(\\d{1,6}))?` + `)?` + `)?` + `(?:\\s*(a\\.m\\.|p\\.m\\.|am?|pm?))?` + `${primarySuffix}`, flags);
|
||
}
|
||
function followingTimePatten(followingPhase, followingSuffix) {
|
||
return new RegExp(`^(${followingPhase})` + `(\\d{1,4})` + `(?:` + `(?:\\.|\\:|\\:)` + `(\\d{1,2})` + `(?:` + `(?:\\.|\\:|\\:)` + `(\\d{1,2})(?:\\.(\\d{1,6}))?` + `)?` + `)?` + `(?:\\s*(a\\.m\\.|p\\.m\\.|am?|pm?))?` + `${followingSuffix}`, "i");
|
||
}
|
||
const HOUR_GROUP = 2;
|
||
const MINUTE_GROUP = 3;
|
||
const SECOND_GROUP = 4;
|
||
const MILLI_SECOND_GROUP = 5;
|
||
const AM_PM_HOUR_GROUP = 6;
|
||
class AbstractTimeExpressionParser {
|
||
constructor(strictMode = false) {
|
||
this.cachedPrimaryPrefix = null;
|
||
this.cachedPrimarySuffix = null;
|
||
this.cachedPrimaryTimePattern = null;
|
||
this.cachedFollowingPhase = null;
|
||
this.cachedFollowingSuffix = null;
|
||
this.cachedFollowingTimePatten = null;
|
||
this.strictMode = strictMode;
|
||
}
|
||
patternFlags() {
|
||
return "i";
|
||
}
|
||
primaryPatternLeftBoundary() {
|
||
return `(^|\\s|T|\\b)`;
|
||
}
|
||
primarySuffix() {
|
||
return `(?=\\W|$)`;
|
||
}
|
||
followingSuffix() {
|
||
return `(?=\\W|$)`;
|
||
}
|
||
pattern(context) {
|
||
return this.getPrimaryTimePatternThroughCache();
|
||
}
|
||
extract(context, match) {
|
||
const startComponents = this.extractPrimaryTimeComponents(context, match);
|
||
if (!startComponents) {
|
||
match.index += match[0].length;
|
||
return null;
|
||
}
|
||
const index = match.index + match[1].length;
|
||
const text = match[0].substring(match[1].length);
|
||
const result = context.createParsingResult(index, text, startComponents);
|
||
match.index += match[0].length;
|
||
const remainingText = context.text.substring(match.index);
|
||
const followingPattern = this.getFollowingTimePatternThroughCache();
|
||
const followingMatch = followingPattern.exec(remainingText);
|
||
if (text.match(/^\d{3,4}/) && followingMatch && followingMatch[0].match(/^\s*([+-])\s*\d{2,4}$/)) {
|
||
return null;
|
||
}
|
||
if (!followingMatch || followingMatch[0].match(/^\s*([+-])\s*\d{3,4}$/)) {
|
||
return this.checkAndReturnWithoutFollowingPattern(result);
|
||
}
|
||
result.end = this.extractFollowingTimeComponents(context, followingMatch, result);
|
||
if (result.end) {
|
||
result.text += followingMatch[0];
|
||
}
|
||
return this.checkAndReturnWithFollowingPattern(result);
|
||
}
|
||
extractPrimaryTimeComponents(context, match, strict = false) {
|
||
const components = context.createParsingComponents();
|
||
let minute = 0;
|
||
let meridiem = null;
|
||
let hour = parseInt(match[HOUR_GROUP]);
|
||
if (hour > 100) {
|
||
if (this.strictMode || match[MINUTE_GROUP] != null) {
|
||
return null;
|
||
}
|
||
minute = hour % 100;
|
||
hour = Math.floor(hour / 100);
|
||
}
|
||
if (hour > 24) {
|
||
return null;
|
||
}
|
||
if (match[MINUTE_GROUP] != null) {
|
||
if (match[MINUTE_GROUP].length == 1 && !match[AM_PM_HOUR_GROUP]) {
|
||
return null;
|
||
}
|
||
minute = parseInt(match[MINUTE_GROUP]);
|
||
}
|
||
if (minute >= 60) {
|
||
return null;
|
||
}
|
||
if (hour > 12) {
|
||
meridiem = esm_Meridiem.PM;
|
||
}
|
||
if (match[AM_PM_HOUR_GROUP] != null) {
|
||
if (hour > 12) return null;
|
||
const ampm = match[AM_PM_HOUR_GROUP][0].toLowerCase();
|
||
if (ampm == "a") {
|
||
meridiem = esm_Meridiem.AM;
|
||
if (hour == 12) {
|
||
hour = 0;
|
||
}
|
||
}
|
||
if (ampm == "p") {
|
||
meridiem = esm_Meridiem.PM;
|
||
if (hour != 12) {
|
||
hour += 12;
|
||
}
|
||
}
|
||
}
|
||
components.assign("hour", hour);
|
||
components.assign("minute", minute);
|
||
if (meridiem !== null) {
|
||
components.assign("meridiem", meridiem);
|
||
} else {
|
||
if (hour < 12) {
|
||
components.imply("meridiem", esm_Meridiem.AM);
|
||
} else {
|
||
components.imply("meridiem", esm_Meridiem.PM);
|
||
}
|
||
}
|
||
if (match[MILLI_SECOND_GROUP] != null) {
|
||
const millisecond = parseInt(match[MILLI_SECOND_GROUP].substring(0, 3));
|
||
if (millisecond >= 1000) return null;
|
||
components.assign("millisecond", millisecond);
|
||
}
|
||
if (match[SECOND_GROUP] != null) {
|
||
const second = parseInt(match[SECOND_GROUP]);
|
||
if (second >= 60) return null;
|
||
components.assign("second", second);
|
||
}
|
||
return components;
|
||
}
|
||
extractFollowingTimeComponents(context, match, result) {
|
||
const components = context.createParsingComponents();
|
||
if (match[MILLI_SECOND_GROUP] != null) {
|
||
const millisecond = parseInt(match[MILLI_SECOND_GROUP].substring(0, 3));
|
||
if (millisecond >= 1000) return null;
|
||
components.assign("millisecond", millisecond);
|
||
}
|
||
if (match[SECOND_GROUP] != null) {
|
||
const second = parseInt(match[SECOND_GROUP]);
|
||
if (second >= 60) return null;
|
||
components.assign("second", second);
|
||
}
|
||
let hour = parseInt(match[HOUR_GROUP]);
|
||
let minute = 0;
|
||
let meridiem = -1;
|
||
if (match[MINUTE_GROUP] != null) {
|
||
minute = parseInt(match[MINUTE_GROUP]);
|
||
} else if (hour > 100) {
|
||
minute = hour % 100;
|
||
hour = Math.floor(hour / 100);
|
||
}
|
||
if (minute >= 60 || hour > 24) {
|
||
return null;
|
||
}
|
||
if (hour >= 12) {
|
||
meridiem = esm_Meridiem.PM;
|
||
}
|
||
if (match[AM_PM_HOUR_GROUP] != null) {
|
||
if (hour > 12) {
|
||
return null;
|
||
}
|
||
const ampm = match[AM_PM_HOUR_GROUP][0].toLowerCase();
|
||
if (ampm == "a") {
|
||
meridiem = esm_Meridiem.AM;
|
||
if (hour == 12) {
|
||
hour = 0;
|
||
if (!components.isCertain("day")) {
|
||
components.imply("day", components.get("day") + 1);
|
||
}
|
||
}
|
||
}
|
||
if (ampm == "p") {
|
||
meridiem = esm_Meridiem.PM;
|
||
if (hour != 12) hour += 12;
|
||
}
|
||
if (!result.start.isCertain("meridiem")) {
|
||
if (meridiem == esm_Meridiem.AM) {
|
||
result.start.imply("meridiem", esm_Meridiem.AM);
|
||
if (result.start.get("hour") == 12) {
|
||
result.start.assign("hour", 0);
|
||
}
|
||
} else {
|
||
result.start.imply("meridiem", esm_Meridiem.PM);
|
||
if (result.start.get("hour") != 12) {
|
||
result.start.assign("hour", result.start.get("hour") + 12);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
components.assign("hour", hour);
|
||
components.assign("minute", minute);
|
||
if (meridiem >= 0) {
|
||
components.assign("meridiem", meridiem);
|
||
} else {
|
||
const startAtPM = result.start.isCertain("meridiem") && result.start.get("hour") > 12;
|
||
if (startAtPM) {
|
||
if (result.start.get("hour") - 12 > hour) {
|
||
components.imply("meridiem", esm_Meridiem.AM);
|
||
} else if (hour <= 12) {
|
||
components.assign("hour", hour + 12);
|
||
components.assign("meridiem", esm_Meridiem.PM);
|
||
}
|
||
} else if (hour > 12) {
|
||
components.imply("meridiem", esm_Meridiem.PM);
|
||
} else if (hour <= 12) {
|
||
components.imply("meridiem", esm_Meridiem.AM);
|
||
}
|
||
}
|
||
if (components.date().getTime() < result.start.date().getTime()) {
|
||
components.imply("day", components.get("day") + 1);
|
||
}
|
||
return components;
|
||
}
|
||
checkAndReturnWithoutFollowingPattern(result) {
|
||
if (result.text.match(/^\d$/)) {
|
||
return null;
|
||
}
|
||
if (result.text.match(/^\d\d\d+$/)) {
|
||
return null;
|
||
}
|
||
if (result.text.match(/\d[apAP]$/)) {
|
||
return null;
|
||
}
|
||
const endingWithNumbers = result.text.match(/[^\d:.](\d[\d.]+)$/);
|
||
if (endingWithNumbers) {
|
||
const endingNumbers = endingWithNumbers[1];
|
||
if (this.strictMode) {
|
||
return null;
|
||
}
|
||
if (endingNumbers.includes(".") && !endingNumbers.match(/\d(\.\d{2})+$/)) {
|
||
return null;
|
||
}
|
||
const endingNumberVal = parseInt(endingNumbers);
|
||
if (endingNumberVal > 24) {
|
||
return null;
|
||
}
|
||
}
|
||
return result;
|
||
}
|
||
checkAndReturnWithFollowingPattern(result) {
|
||
if (result.text.match(/^\d+-\d+$/)) {
|
||
return null;
|
||
}
|
||
const endingWithNumbers = result.text.match(/[^\d:.](\d[\d.]+)\s*-\s*(\d[\d.]+)$/);
|
||
if (endingWithNumbers) {
|
||
if (this.strictMode) {
|
||
return null;
|
||
}
|
||
const startingNumbers = endingWithNumbers[1];
|
||
const endingNumbers = endingWithNumbers[2];
|
||
if (endingNumbers.includes(".") && !endingNumbers.match(/\d(\.\d{2})+$/)) {
|
||
return null;
|
||
}
|
||
const endingNumberVal = parseInt(endingNumbers);
|
||
const startingNumberVal = parseInt(startingNumbers);
|
||
if (endingNumberVal > 24 || startingNumberVal > 24) {
|
||
return null;
|
||
}
|
||
}
|
||
return result;
|
||
}
|
||
getPrimaryTimePatternThroughCache() {
|
||
const primaryPrefix = this.primaryPrefix();
|
||
const primarySuffix = this.primarySuffix();
|
||
if (this.cachedPrimaryPrefix === primaryPrefix && this.cachedPrimarySuffix === primarySuffix) {
|
||
return this.cachedPrimaryTimePattern;
|
||
}
|
||
this.cachedPrimaryTimePattern = primaryTimePattern(this.primaryPatternLeftBoundary(), primaryPrefix, primarySuffix, this.patternFlags());
|
||
this.cachedPrimaryPrefix = primaryPrefix;
|
||
this.cachedPrimarySuffix = primarySuffix;
|
||
return this.cachedPrimaryTimePattern;
|
||
}
|
||
getFollowingTimePatternThroughCache() {
|
||
const followingPhase = this.followingPhase();
|
||
const followingSuffix = this.followingSuffix();
|
||
if (this.cachedFollowingPhase === followingPhase && this.cachedFollowingSuffix === followingSuffix) {
|
||
return this.cachedFollowingTimePatten;
|
||
}
|
||
this.cachedFollowingTimePatten = followingTimePatten(followingPhase, followingSuffix);
|
||
this.cachedFollowingPhase = followingPhase;
|
||
this.cachedFollowingSuffix = followingSuffix;
|
||
return this.cachedFollowingTimePatten;
|
||
}
|
||
}
|
||
;// CONCATENATED MODULE: ./node_modules/chrono-node/dist/esm/locales/en/parsers/ENTimeExpressionParser.js
|
||
|
||
|
||
class ENTimeExpressionParser extends AbstractTimeExpressionParser {
|
||
constructor(strictMode) {
|
||
super(strictMode);
|
||
}
|
||
followingPhase() {
|
||
return "\\s*(?:\\-|\\–|\\~|\\〜|to|until|through|till|\\?)\\s*";
|
||
}
|
||
primaryPrefix() {
|
||
return "(?:(?:at|from)\\s*)??";
|
||
}
|
||
primarySuffix() {
|
||
return "(?:\\s*(?:o\\W*clock|at\\s*night|in\\s*the\\s*(?:morning|afternoon)))?(?!/)(?=\\W|$)";
|
||
}
|
||
extractPrimaryTimeComponents(context, match) {
|
||
const components = super.extractPrimaryTimeComponents(context, match);
|
||
if (components) {
|
||
if (match[0].endsWith("night")) {
|
||
const hour = components.get("hour");
|
||
if (hour >= 6 && hour < 12) {
|
||
components.assign("hour", components.get("hour") + 12);
|
||
components.assign("meridiem", esm_Meridiem.PM);
|
||
} else if (hour < 6) {
|
||
components.assign("meridiem", esm_Meridiem.AM);
|
||
}
|
||
}
|
||
if (match[0].endsWith("afternoon")) {
|
||
components.assign("meridiem", esm_Meridiem.PM);
|
||
const hour = components.get("hour");
|
||
if (hour >= 0 && hour <= 6) {
|
||
components.assign("hour", components.get("hour") + 12);
|
||
}
|
||
}
|
||
if (match[0].endsWith("morning")) {
|
||
components.assign("meridiem", esm_Meridiem.AM);
|
||
const hour = components.get("hour");
|
||
if (hour < 12) {
|
||
components.assign("hour", components.get("hour"));
|
||
}
|
||
}
|
||
}
|
||
return components;
|
||
}
|
||
}
|
||
;// CONCATENATED MODULE: ./node_modules/chrono-node/dist/esm/utils/timeunits.js
|
||
function reverseTimeUnits(timeUnits) {
|
||
const reversed = {};
|
||
for (const key in timeUnits) {
|
||
reversed[key] = -timeUnits[key];
|
||
}
|
||
return reversed;
|
||
}
|
||
function addImpliedTimeUnits(components, timeUnits) {
|
||
const output = components.clone();
|
||
let date = components.dayjs();
|
||
for (const key in timeUnits) {
|
||
date = date.add(timeUnits[key], key);
|
||
}
|
||
if ("day" in timeUnits || "d" in timeUnits || "week" in timeUnits || "month" in timeUnits || "year" in timeUnits) {
|
||
output.imply("day", date.date());
|
||
output.imply("month", date.month() + 1);
|
||
output.imply("year", date.year());
|
||
}
|
||
if ("second" in timeUnits || "minute" in timeUnits || "hour" in timeUnits) {
|
||
output.imply("second", date.second());
|
||
output.imply("minute", date.minute());
|
||
output.imply("hour", date.hour());
|
||
}
|
||
return output;
|
||
}
|
||
;// CONCATENATED MODULE: ./node_modules/chrono-node/dist/esm/locales/en/parsers/ENTimeUnitAgoFormatParser.js
|
||
|
||
|
||
|
||
|
||
const ENTimeUnitAgoFormatParser_PATTERN = new RegExp(`(${TIME_UNITS_PATTERN})\\s{0,5}(?:ago|before|earlier)(?=\\W|$)`, "i");
|
||
const STRICT_PATTERN = new RegExp(`(${TIME_UNITS_NO_ABBR_PATTERN})\\s{0,5}(?:ago|before|earlier)(?=\\W|$)`, "i");
|
||
class ENTimeUnitAgoFormatParser extends AbstractParserWithWordBoundaryChecking {
|
||
constructor(strictMode) {
|
||
super();
|
||
this.strictMode = strictMode;
|
||
}
|
||
innerPattern() {
|
||
return this.strictMode ? STRICT_PATTERN : ENTimeUnitAgoFormatParser_PATTERN;
|
||
}
|
||
innerExtract(context, match) {
|
||
const timeUnits = parseTimeUnits(match[1]);
|
||
const outputTimeUnits = reverseTimeUnits(timeUnits);
|
||
return results_ParsingComponents.createRelativeFromReference(context.reference, outputTimeUnits);
|
||
}
|
||
}
|
||
;// CONCATENATED MODULE: ./node_modules/chrono-node/dist/esm/locales/en/parsers/ENTimeUnitLaterFormatParser.js
|
||
|
||
|
||
|
||
const ENTimeUnitLaterFormatParser_PATTERN = new RegExp(`(${TIME_UNITS_PATTERN})\\s{0,5}(?:later|after|from now|henceforth|forward|out)` + "(?=(?:\\W|$))", "i");
|
||
const ENTimeUnitLaterFormatParser_STRICT_PATTERN = new RegExp("" + "(" + TIME_UNITS_NO_ABBR_PATTERN + ")" + "(later|from now)" + "(?=(?:\\W|$))", "i");
|
||
const GROUP_NUM_TIMEUNITS = 1;
|
||
class ENTimeUnitLaterFormatParser extends AbstractParserWithWordBoundaryChecking {
|
||
constructor(strictMode) {
|
||
super();
|
||
this.strictMode = strictMode;
|
||
}
|
||
innerPattern() {
|
||
return this.strictMode ? ENTimeUnitLaterFormatParser_STRICT_PATTERN : ENTimeUnitLaterFormatParser_PATTERN;
|
||
}
|
||
innerExtract(context, match) {
|
||
const fragments = parseTimeUnits(match[GROUP_NUM_TIMEUNITS]);
|
||
return results_ParsingComponents.createRelativeFromReference(context.reference, fragments);
|
||
}
|
||
}
|
||
;// CONCATENATED MODULE: ./node_modules/chrono-node/dist/esm/common/abstractRefiners.js
|
||
class Filter {
|
||
refine(context, results) {
|
||
return results.filter(r => this.isValid(context, r));
|
||
}
|
||
}
|
||
class MergingRefiner {
|
||
refine(context, results) {
|
||
if (results.length < 2) {
|
||
return results;
|
||
}
|
||
const mergedResults = [];
|
||
let curResult = results[0];
|
||
let nextResult = null;
|
||
for (let i = 1; i < results.length; i++) {
|
||
nextResult = results[i];
|
||
const textBetween = context.text.substring(curResult.index + curResult.text.length, nextResult.index);
|
||
if (!this.shouldMergeResults(textBetween, curResult, nextResult, context)) {
|
||
mergedResults.push(curResult);
|
||
curResult = nextResult;
|
||
} else {
|
||
const left = curResult;
|
||
const right = nextResult;
|
||
const mergedResult = this.mergeResults(textBetween, left, right, context);
|
||
context.debug(() => {
|
||
console.log(`${this.constructor.name} merged ${left} and ${right} into ${mergedResult}`);
|
||
});
|
||
curResult = mergedResult;
|
||
}
|
||
}
|
||
if (curResult != null) {
|
||
mergedResults.push(curResult);
|
||
}
|
||
return mergedResults;
|
||
}
|
||
}
|
||
;// CONCATENATED MODULE: ./node_modules/chrono-node/dist/esm/common/refiners/AbstractMergeDateRangeRefiner.js
|
||
|
||
class AbstractMergeDateRangeRefiner extends MergingRefiner {
|
||
shouldMergeResults(textBetween, currentResult, nextResult) {
|
||
return !currentResult.end && !nextResult.end && textBetween.match(this.patternBetween()) != null;
|
||
}
|
||
mergeResults(textBetween, fromResult, toResult) {
|
||
if (!fromResult.start.isOnlyWeekdayComponent() && !toResult.start.isOnlyWeekdayComponent()) {
|
||
toResult.start.getCertainComponents().forEach(key => {
|
||
if (!fromResult.start.isCertain(key)) {
|
||
fromResult.start.imply(key, toResult.start.get(key));
|
||
}
|
||
});
|
||
fromResult.start.getCertainComponents().forEach(key => {
|
||
if (!toResult.start.isCertain(key)) {
|
||
toResult.start.imply(key, fromResult.start.get(key));
|
||
}
|
||
});
|
||
}
|
||
if (fromResult.start.date().getTime() > toResult.start.date().getTime()) {
|
||
let fromMoment = fromResult.start.dayjs();
|
||
let toMoment = toResult.start.dayjs();
|
||
if (toResult.start.isOnlyWeekdayComponent() && toMoment.add(7, "days").isAfter(fromMoment)) {
|
||
toMoment = toMoment.add(7, "days");
|
||
toResult.start.imply("day", toMoment.date());
|
||
toResult.start.imply("month", toMoment.month() + 1);
|
||
toResult.start.imply("year", toMoment.year());
|
||
} else if (fromResult.start.isOnlyWeekdayComponent() && fromMoment.add(-7, "days").isBefore(toMoment)) {
|
||
fromMoment = fromMoment.add(-7, "days");
|
||
fromResult.start.imply("day", fromMoment.date());
|
||
fromResult.start.imply("month", fromMoment.month() + 1);
|
||
fromResult.start.imply("year", fromMoment.year());
|
||
} else if (toResult.start.isDateWithUnknownYear() && toMoment.add(1, "years").isAfter(fromMoment)) {
|
||
toMoment = toMoment.add(1, "years");
|
||
toResult.start.imply("year", toMoment.year());
|
||
} else if (fromResult.start.isDateWithUnknownYear() && fromMoment.add(-1, "years").isBefore(toMoment)) {
|
||
fromMoment = fromMoment.add(-1, "years");
|
||
fromResult.start.imply("year", fromMoment.year());
|
||
} else {
|
||
[toResult, fromResult] = [fromResult, toResult];
|
||
}
|
||
}
|
||
const result = fromResult.clone();
|
||
result.start = fromResult.start;
|
||
result.end = toResult.start;
|
||
result.index = Math.min(fromResult.index, toResult.index);
|
||
if (fromResult.index < toResult.index) {
|
||
result.text = fromResult.text + textBetween + toResult.text;
|
||
} else {
|
||
result.text = toResult.text + textBetween + fromResult.text;
|
||
}
|
||
return result;
|
||
}
|
||
}
|
||
;// CONCATENATED MODULE: ./node_modules/chrono-node/dist/esm/locales/en/refiners/ENMergeDateRangeRefiner.js
|
||
|
||
class ENMergeDateRangeRefiner extends AbstractMergeDateRangeRefiner {
|
||
patternBetween() {
|
||
return /^\s*(to|-|–|until|through|till)\s*$/i;
|
||
}
|
||
}
|
||
;// CONCATENATED MODULE: ./node_modules/chrono-node/dist/esm/calculation/mergingCalculation.js
|
||
|
||
|
||
function mergeDateTimeResult(dateResult, timeResult) {
|
||
const result = dateResult.clone();
|
||
const beginDate = dateResult.start;
|
||
const beginTime = timeResult.start;
|
||
result.start = mergeDateTimeComponent(beginDate, beginTime);
|
||
if (dateResult.end != null || timeResult.end != null) {
|
||
const endDate = dateResult.end == null ? dateResult.start : dateResult.end;
|
||
const endTime = timeResult.end == null ? timeResult.start : timeResult.end;
|
||
const endDateTime = mergeDateTimeComponent(endDate, endTime);
|
||
if (dateResult.end == null && endDateTime.date().getTime() < result.start.date().getTime()) {
|
||
const nextDayJs = endDateTime.dayjs().add(1, "day");
|
||
if (endDateTime.isCertain("day")) {
|
||
dayjs_assignSimilarDate(endDateTime, nextDayJs);
|
||
} else {
|
||
implySimilarDate(endDateTime, nextDayJs);
|
||
}
|
||
}
|
||
result.end = endDateTime;
|
||
}
|
||
return result;
|
||
}
|
||
function mergeDateTimeComponent(dateComponent, timeComponent) {
|
||
const dateTimeComponent = dateComponent.clone();
|
||
if (timeComponent.isCertain("hour")) {
|
||
dateTimeComponent.assign("hour", timeComponent.get("hour"));
|
||
dateTimeComponent.assign("minute", timeComponent.get("minute"));
|
||
if (timeComponent.isCertain("second")) {
|
||
dateTimeComponent.assign("second", timeComponent.get("second"));
|
||
if (timeComponent.isCertain("millisecond")) {
|
||
dateTimeComponent.assign("millisecond", timeComponent.get("millisecond"));
|
||
} else {
|
||
dateTimeComponent.imply("millisecond", timeComponent.get("millisecond"));
|
||
}
|
||
} else {
|
||
dateTimeComponent.imply("second", timeComponent.get("second"));
|
||
dateTimeComponent.imply("millisecond", timeComponent.get("millisecond"));
|
||
}
|
||
} else {
|
||
dateTimeComponent.imply("hour", timeComponent.get("hour"));
|
||
dateTimeComponent.imply("minute", timeComponent.get("minute"));
|
||
dateTimeComponent.imply("second", timeComponent.get("second"));
|
||
dateTimeComponent.imply("millisecond", timeComponent.get("millisecond"));
|
||
}
|
||
if (timeComponent.isCertain("timezoneOffset")) {
|
||
dateTimeComponent.assign("timezoneOffset", timeComponent.get("timezoneOffset"));
|
||
}
|
||
if (timeComponent.isCertain("meridiem")) {
|
||
dateTimeComponent.assign("meridiem", timeComponent.get("meridiem"));
|
||
} else if (timeComponent.get("meridiem") != null && dateTimeComponent.get("meridiem") == null) {
|
||
dateTimeComponent.imply("meridiem", timeComponent.get("meridiem"));
|
||
}
|
||
if (dateTimeComponent.get("meridiem") == esm_Meridiem.PM && dateTimeComponent.get("hour") < 12) {
|
||
if (timeComponent.isCertain("hour")) {
|
||
dateTimeComponent.assign("hour", dateTimeComponent.get("hour") + 12);
|
||
} else {
|
||
dateTimeComponent.imply("hour", dateTimeComponent.get("hour") + 12);
|
||
}
|
||
}
|
||
return dateTimeComponent;
|
||
}
|
||
;// CONCATENATED MODULE: ./node_modules/chrono-node/dist/esm/common/refiners/AbstractMergeDateTimeRefiner.js
|
||
|
||
|
||
class AbstractMergeDateTimeRefiner extends MergingRefiner {
|
||
shouldMergeResults(textBetween, currentResult, nextResult) {
|
||
return (currentResult.start.isOnlyDate() && nextResult.start.isOnlyTime() || nextResult.start.isOnlyDate() && currentResult.start.isOnlyTime()) && textBetween.match(this.patternBetween()) != null;
|
||
}
|
||
mergeResults(textBetween, currentResult, nextResult) {
|
||
const result = currentResult.start.isOnlyDate() ? mergeDateTimeResult(currentResult, nextResult) : mergeDateTimeResult(nextResult, currentResult);
|
||
result.index = currentResult.index;
|
||
result.text = currentResult.text + textBetween + nextResult.text;
|
||
return result;
|
||
}
|
||
}
|
||
;// CONCATENATED MODULE: ./node_modules/chrono-node/dist/esm/locales/en/refiners/ENMergeDateTimeRefiner.js
|
||
|
||
class ENMergeDateTimeRefiner extends AbstractMergeDateTimeRefiner {
|
||
patternBetween() {
|
||
return new RegExp("^\\s*(T|at|after|before|on|of|,|-)?\\s*$");
|
||
}
|
||
}
|
||
;// CONCATENATED MODULE: ./node_modules/chrono-node/dist/esm/common/refiners/ExtractTimezoneAbbrRefiner.js
|
||
|
||
const TIMEZONE_NAME_PATTERN = new RegExp("^\\s*,?\\s*\\(?([A-Z]{2,4})\\)?(?=\\W|$)", "i");
|
||
class ExtractTimezoneAbbrRefiner {
|
||
constructor(timezoneOverrides) {
|
||
this.timezoneOverrides = timezoneOverrides;
|
||
}
|
||
refine(context, results) {
|
||
const timezoneOverrides = context.option.timezones ?? {};
|
||
results.forEach(result => {
|
||
const suffix = context.text.substring(result.index + result.text.length);
|
||
const match = TIMEZONE_NAME_PATTERN.exec(suffix);
|
||
if (!match) {
|
||
return;
|
||
}
|
||
const timezoneAbbr = match[1].toUpperCase();
|
||
const refDate = result.start.date() ?? result.refDate ?? new Date();
|
||
const tzOverrides = {
|
||
...this.timezoneOverrides,
|
||
...timezoneOverrides
|
||
};
|
||
const extractedTimezoneOffset = toTimezoneOffset(timezoneAbbr, refDate, tzOverrides);
|
||
if (extractedTimezoneOffset == null) {
|
||
return;
|
||
}
|
||
context.debug(() => {
|
||
console.log(`Extracting timezone: '${timezoneAbbr}' into: ${extractedTimezoneOffset} for: ${result.start}`);
|
||
});
|
||
const currentTimezoneOffset = result.start.get("timezoneOffset");
|
||
if (currentTimezoneOffset !== null && extractedTimezoneOffset != currentTimezoneOffset) {
|
||
if (result.start.isCertain("timezoneOffset")) {
|
||
return;
|
||
}
|
||
if (timezoneAbbr != match[1]) {
|
||
return;
|
||
}
|
||
}
|
||
if (result.start.isOnlyDate()) {
|
||
if (timezoneAbbr != match[1]) {
|
||
return;
|
||
}
|
||
}
|
||
result.text += match[0];
|
||
if (!result.start.isCertain("timezoneOffset")) {
|
||
result.start.assign("timezoneOffset", extractedTimezoneOffset);
|
||
}
|
||
if (result.end != null && !result.end.isCertain("timezoneOffset")) {
|
||
result.end.assign("timezoneOffset", extractedTimezoneOffset);
|
||
}
|
||
});
|
||
return results;
|
||
}
|
||
}
|
||
;// CONCATENATED MODULE: ./node_modules/chrono-node/dist/esm/common/refiners/ExtractTimezoneOffsetRefiner.js
|
||
const TIMEZONE_OFFSET_PATTERN = new RegExp("^\\s*(?:\\(?(?:GMT|UTC)\\s?)?([+-])(\\d{1,2})(?::?(\\d{2}))?\\)?", "i");
|
||
const TIMEZONE_OFFSET_SIGN_GROUP = 1;
|
||
const TIMEZONE_OFFSET_HOUR_OFFSET_GROUP = 2;
|
||
const TIMEZONE_OFFSET_MINUTE_OFFSET_GROUP = 3;
|
||
class ExtractTimezoneOffsetRefiner {
|
||
refine(context, results) {
|
||
results.forEach(function (result) {
|
||
if (result.start.isCertain("timezoneOffset")) {
|
||
return;
|
||
}
|
||
const suffix = context.text.substring(result.index + result.text.length);
|
||
const match = TIMEZONE_OFFSET_PATTERN.exec(suffix);
|
||
if (!match) {
|
||
return;
|
||
}
|
||
context.debug(() => {
|
||
console.log(`Extracting timezone: '${match[0]}' into : ${result}`);
|
||
});
|
||
const hourOffset = parseInt(match[TIMEZONE_OFFSET_HOUR_OFFSET_GROUP]);
|
||
const minuteOffset = parseInt(match[TIMEZONE_OFFSET_MINUTE_OFFSET_GROUP] || "0");
|
||
let timezoneOffset = hourOffset * 60 + minuteOffset;
|
||
if (timezoneOffset > 14 * 60) {
|
||
return;
|
||
}
|
||
if (match[TIMEZONE_OFFSET_SIGN_GROUP] === "-") {
|
||
timezoneOffset = -timezoneOffset;
|
||
}
|
||
if (result.end != null) {
|
||
result.end.assign("timezoneOffset", timezoneOffset);
|
||
}
|
||
result.start.assign("timezoneOffset", timezoneOffset);
|
||
result.text += match[0];
|
||
});
|
||
return results;
|
||
}
|
||
}
|
||
;// CONCATENATED MODULE: ./node_modules/chrono-node/dist/esm/common/refiners/OverlapRemovalRefiner.js
|
||
class OverlapRemovalRefiner {
|
||
refine(context, results) {
|
||
if (results.length < 2) {
|
||
return results;
|
||
}
|
||
const filteredResults = [];
|
||
let prevResult = results[0];
|
||
for (let i = 1; i < results.length; i++) {
|
||
const result = results[i];
|
||
if (result.index < prevResult.index + prevResult.text.length) {
|
||
if (result.text.length > prevResult.text.length) {
|
||
prevResult = result;
|
||
}
|
||
} else {
|
||
filteredResults.push(prevResult);
|
||
prevResult = result;
|
||
}
|
||
}
|
||
if (prevResult != null) {
|
||
filteredResults.push(prevResult);
|
||
}
|
||
return filteredResults;
|
||
}
|
||
}
|
||
;// CONCATENATED MODULE: ./node_modules/chrono-node/dist/esm/common/refiners/ForwardDateRefiner.js
|
||
|
||
|
||
class ForwardDateRefiner {
|
||
refine(context, results) {
|
||
if (!context.option.forwardDate) {
|
||
return results;
|
||
}
|
||
results.forEach(function (result) {
|
||
let refMoment = dayjs_min(context.refDate);
|
||
if (result.start.isOnlyTime() && refMoment.isAfter(result.start.dayjs())) {
|
||
refMoment = refMoment.add(1, "day");
|
||
implySimilarDate(result.start, refMoment);
|
||
if (result.end && result.end.isOnlyTime()) {
|
||
implySimilarDate(result.end, refMoment);
|
||
if (result.start.dayjs().isAfter(result.end.dayjs())) {
|
||
refMoment = refMoment.add(1, "day");
|
||
implySimilarDate(result.end, refMoment);
|
||
}
|
||
}
|
||
}
|
||
if (result.start.isOnlyWeekdayComponent() && refMoment.isAfter(result.start.dayjs())) {
|
||
if (refMoment.day() >= result.start.get("weekday")) {
|
||
refMoment = refMoment.day(result.start.get("weekday") + 7);
|
||
} else {
|
||
refMoment = refMoment.day(result.start.get("weekday"));
|
||
}
|
||
result.start.imply("day", refMoment.date());
|
||
result.start.imply("month", refMoment.month() + 1);
|
||
result.start.imply("year", refMoment.year());
|
||
context.debug(() => {
|
||
console.log(`Forward weekly adjusted for ${result} (${result.start})`);
|
||
});
|
||
if (result.end && result.end.isOnlyWeekdayComponent()) {
|
||
if (refMoment.day() > result.end.get("weekday")) {
|
||
refMoment = refMoment.day(result.end.get("weekday") + 7);
|
||
} else {
|
||
refMoment = refMoment.day(result.end.get("weekday"));
|
||
}
|
||
result.end.imply("day", refMoment.date());
|
||
result.end.imply("month", refMoment.month() + 1);
|
||
result.end.imply("year", refMoment.year());
|
||
context.debug(() => {
|
||
console.log(`Forward weekly adjusted for ${result} (${result.end})`);
|
||
});
|
||
}
|
||
}
|
||
if (result.start.isDateWithUnknownYear() && refMoment.isAfter(result.start.dayjs())) {
|
||
for (let i = 0; i < 3 && refMoment.isAfter(result.start.dayjs()); i++) {
|
||
result.start.imply("year", result.start.get("year") + 1);
|
||
context.debug(() => {
|
||
console.log(`Forward yearly adjusted for ${result} (${result.start})`);
|
||
});
|
||
if (result.end && !result.end.isCertain("year")) {
|
||
result.end.imply("year", result.end.get("year") + 1);
|
||
context.debug(() => {
|
||
console.log(`Forward yearly adjusted for ${result} (${result.end})`);
|
||
});
|
||
}
|
||
}
|
||
}
|
||
});
|
||
return results;
|
||
}
|
||
}
|
||
;// CONCATENATED MODULE: ./node_modules/chrono-node/dist/esm/common/refiners/UnlikelyFormatFilter.js
|
||
|
||
class UnlikelyFormatFilter extends Filter {
|
||
constructor(strictMode) {
|
||
super();
|
||
this.strictMode = strictMode;
|
||
}
|
||
isValid(context, result) {
|
||
if (result.text.replace(" ", "").match(/^\d*(\.\d*)?$/)) {
|
||
context.debug(() => {
|
||
console.log(`Removing unlikely result '${result.text}'`);
|
||
});
|
||
return false;
|
||
}
|
||
if (!result.start.isValidDate()) {
|
||
context.debug(() => {
|
||
console.log(`Removing invalid result: ${result} (${result.start})`);
|
||
});
|
||
return false;
|
||
}
|
||
if (result.end && !result.end.isValidDate()) {
|
||
context.debug(() => {
|
||
console.log(`Removing invalid result: ${result} (${result.end})`);
|
||
});
|
||
return false;
|
||
}
|
||
if (this.strictMode) {
|
||
return this.isStrictModeValid(context, result);
|
||
}
|
||
return true;
|
||
}
|
||
isStrictModeValid(context, result) {
|
||
if (result.start.isOnlyWeekdayComponent()) {
|
||
context.debug(() => {
|
||
console.log(`(Strict) Removing weekday only component: ${result} (${result.end})`);
|
||
});
|
||
return false;
|
||
}
|
||
if (result.start.isOnlyTime() && (!result.start.isCertain("hour") || !result.start.isCertain("minute"))) {
|
||
context.debug(() => {
|
||
console.log(`(Strict) Removing uncertain time component: ${result} (${result.end})`);
|
||
});
|
||
return false;
|
||
}
|
||
return true;
|
||
}
|
||
}
|
||
;// CONCATENATED MODULE: ./node_modules/chrono-node/dist/esm/common/parsers/ISOFormatParser.js
|
||
|
||
const ISOFormatParser_PATTERN = new RegExp("([0-9]{4})\\-([0-9]{1,2})\\-([0-9]{1,2})" + "(?:T" + "([0-9]{1,2}):([0-9]{1,2})" + "(?:" + ":([0-9]{1,2})(?:\\.(\\d{1,4}))?" + ")?" + "(?:" + "Z|([+-]\\d{2}):?(\\d{2})?" + ")?" + ")?" + "(?=\\W|$)", "i");
|
||
const ISOFormatParser_YEAR_NUMBER_GROUP = 1;
|
||
const ISOFormatParser_MONTH_NUMBER_GROUP = 2;
|
||
const ISOFormatParser_DATE_NUMBER_GROUP = 3;
|
||
const HOUR_NUMBER_GROUP = 4;
|
||
const MINUTE_NUMBER_GROUP = 5;
|
||
const SECOND_NUMBER_GROUP = 6;
|
||
const MILLISECOND_NUMBER_GROUP = 7;
|
||
const TZD_HOUR_OFFSET_GROUP = 8;
|
||
const TZD_MINUTE_OFFSET_GROUP = 9;
|
||
class ISOFormatParser extends AbstractParserWithWordBoundaryChecking {
|
||
innerPattern() {
|
||
return ISOFormatParser_PATTERN;
|
||
}
|
||
innerExtract(context, match) {
|
||
const components = {};
|
||
components["year"] = parseInt(match[ISOFormatParser_YEAR_NUMBER_GROUP]);
|
||
components["month"] = parseInt(match[ISOFormatParser_MONTH_NUMBER_GROUP]);
|
||
components["day"] = parseInt(match[ISOFormatParser_DATE_NUMBER_GROUP]);
|
||
if (match[HOUR_NUMBER_GROUP] != null) {
|
||
components["hour"] = parseInt(match[HOUR_NUMBER_GROUP]);
|
||
components["minute"] = parseInt(match[MINUTE_NUMBER_GROUP]);
|
||
if (match[SECOND_NUMBER_GROUP] != null) {
|
||
components["second"] = parseInt(match[SECOND_NUMBER_GROUP]);
|
||
}
|
||
if (match[MILLISECOND_NUMBER_GROUP] != null) {
|
||
components["millisecond"] = parseInt(match[MILLISECOND_NUMBER_GROUP]);
|
||
}
|
||
if (match[TZD_HOUR_OFFSET_GROUP] == null) {
|
||
components["timezoneOffset"] = 0;
|
||
} else {
|
||
const hourOffset = parseInt(match[TZD_HOUR_OFFSET_GROUP]);
|
||
let minuteOffset = 0;
|
||
if (match[TZD_MINUTE_OFFSET_GROUP] != null) {
|
||
minuteOffset = parseInt(match[TZD_MINUTE_OFFSET_GROUP]);
|
||
}
|
||
let offset = hourOffset * 60;
|
||
if (offset < 0) {
|
||
offset -= minuteOffset;
|
||
} else {
|
||
offset += minuteOffset;
|
||
}
|
||
components["timezoneOffset"] = offset;
|
||
}
|
||
}
|
||
return components;
|
||
}
|
||
}
|
||
;// CONCATENATED MODULE: ./node_modules/chrono-node/dist/esm/common/refiners/MergeWeekdayComponentRefiner.js
|
||
|
||
class MergeWeekdayComponentRefiner extends MergingRefiner {
|
||
mergeResults(textBetween, currentResult, nextResult) {
|
||
const newResult = nextResult.clone();
|
||
newResult.index = currentResult.index;
|
||
newResult.text = currentResult.text + textBetween + newResult.text;
|
||
newResult.start.assign("weekday", currentResult.start.get("weekday"));
|
||
if (newResult.end) {
|
||
newResult.end.assign("weekday", currentResult.start.get("weekday"));
|
||
}
|
||
return newResult;
|
||
}
|
||
shouldMergeResults(textBetween, currentResult, nextResult) {
|
||
const weekdayThenNormalDate = currentResult.start.isOnlyWeekdayComponent() && !currentResult.start.isCertain("hour") && nextResult.start.isCertain("day");
|
||
return weekdayThenNormalDate && textBetween.match(/^,?\s*$/) != null;
|
||
}
|
||
}
|
||
;// CONCATENATED MODULE: ./node_modules/chrono-node/dist/esm/configurations.js
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
function includeCommonConfiguration(configuration, strictMode = false) {
|
||
configuration.parsers.unshift(new ISOFormatParser());
|
||
configuration.refiners.unshift(new MergeWeekdayComponentRefiner());
|
||
configuration.refiners.unshift(new ExtractTimezoneOffsetRefiner());
|
||
configuration.refiners.unshift(new OverlapRemovalRefiner());
|
||
configuration.refiners.push(new ExtractTimezoneAbbrRefiner());
|
||
configuration.refiners.push(new OverlapRemovalRefiner());
|
||
configuration.refiners.push(new ForwardDateRefiner());
|
||
configuration.refiners.push(new UnlikelyFormatFilter(strictMode));
|
||
return configuration;
|
||
}
|
||
;// CONCATENATED MODULE: ./node_modules/chrono-node/dist/esm/common/casualReferences.js
|
||
|
||
|
||
|
||
|
||
function now(reference) {
|
||
const targetDate = dayjs_min(reference.instant);
|
||
const component = new results_ParsingComponents(reference, {});
|
||
dayjs_assignSimilarDate(component, targetDate);
|
||
assignSimilarTime(component, targetDate);
|
||
if (reference.timezoneOffset !== null) {
|
||
component.assign("timezoneOffset", targetDate.utcOffset());
|
||
}
|
||
return component;
|
||
}
|
||
function today(reference) {
|
||
const targetDate = dayjs_min(reference.instant);
|
||
const component = new results_ParsingComponents(reference, {});
|
||
dayjs_assignSimilarDate(component, targetDate);
|
||
implySimilarTime(component, targetDate);
|
||
return component;
|
||
}
|
||
function yesterday(reference) {
|
||
return theDayBefore(reference, 1);
|
||
}
|
||
function theDayBefore(reference, numDay) {
|
||
return theDayAfter(reference, -numDay);
|
||
}
|
||
function tomorrow(reference) {
|
||
return theDayAfter(reference, 1);
|
||
}
|
||
function theDayAfter(reference, nDays) {
|
||
let targetDate = dayjs_min(reference.instant);
|
||
const component = new results_ParsingComponents(reference, {});
|
||
targetDate = targetDate.add(nDays, "day");
|
||
dayjs_assignSimilarDate(component, targetDate);
|
||
implySimilarTime(component, targetDate);
|
||
return component;
|
||
}
|
||
function tonight(reference, implyHour = 22) {
|
||
const targetDate = dayjs_min(reference.instant);
|
||
const component = new results_ParsingComponents(reference, {});
|
||
component.imply("hour", implyHour);
|
||
component.imply("meridiem", esm_Meridiem.PM);
|
||
dayjs_assignSimilarDate(component, targetDate);
|
||
return component;
|
||
}
|
||
function lastNight(reference, implyHour = 0) {
|
||
let targetDate = dayjs(reference.instant);
|
||
const component = new ParsingComponents(reference, {});
|
||
if (targetDate.hour() < 6) {
|
||
targetDate = targetDate.add(-1, "day");
|
||
}
|
||
assignSimilarDate(component, targetDate);
|
||
component.imply("hour", implyHour);
|
||
return component;
|
||
}
|
||
function evening(reference, implyHour = 20) {
|
||
const component = new results_ParsingComponents(reference, {});
|
||
component.imply("meridiem", esm_Meridiem.PM);
|
||
component.imply("hour", implyHour);
|
||
return component;
|
||
}
|
||
function yesterdayEvening(reference, implyHour = 20) {
|
||
let targetDate = dayjs(reference.instant);
|
||
const component = new ParsingComponents(reference, {});
|
||
targetDate = targetDate.add(-1, "day");
|
||
assignSimilarDate(component, targetDate);
|
||
component.imply("hour", implyHour);
|
||
component.imply("meridiem", Meridiem.PM);
|
||
return component;
|
||
}
|
||
function midnight(reference) {
|
||
const component = new results_ParsingComponents(reference, {});
|
||
const targetDate = dayjs_min(reference.instant);
|
||
if (targetDate.hour() > 2) {
|
||
implyTheNextDay(component, targetDate);
|
||
}
|
||
component.assign("hour", 0);
|
||
component.imply("minute", 0);
|
||
component.imply("second", 0);
|
||
component.imply("millisecond", 0);
|
||
return component;
|
||
}
|
||
function morning(reference, implyHour = 6) {
|
||
const component = new results_ParsingComponents(reference, {});
|
||
component.imply("meridiem", esm_Meridiem.AM);
|
||
component.imply("hour", implyHour);
|
||
component.imply("minute", 0);
|
||
component.imply("second", 0);
|
||
component.imply("millisecond", 0);
|
||
return component;
|
||
}
|
||
function afternoon(reference, implyHour = 15) {
|
||
const component = new results_ParsingComponents(reference, {});
|
||
component.imply("meridiem", esm_Meridiem.PM);
|
||
component.imply("hour", implyHour);
|
||
component.imply("minute", 0);
|
||
component.imply("second", 0);
|
||
component.imply("millisecond", 0);
|
||
return component;
|
||
}
|
||
function noon(reference) {
|
||
const component = new results_ParsingComponents(reference, {});
|
||
component.imply("meridiem", esm_Meridiem.AM);
|
||
component.imply("hour", 12);
|
||
component.imply("minute", 0);
|
||
component.imply("second", 0);
|
||
component.imply("millisecond", 0);
|
||
return component;
|
||
}
|
||
;// CONCATENATED MODULE: ./node_modules/chrono-node/dist/esm/locales/en/parsers/ENCasualDateParser.js
|
||
|
||
|
||
|
||
|
||
const ENCasualDateParser_PATTERN = /(now|today|tonight|tomorrow|tmr|tmrw|yesterday|last\s*night)(?=\W|$)/i;
|
||
class ENCasualDateParser extends AbstractParserWithWordBoundaryChecking {
|
||
innerPattern(context) {
|
||
return ENCasualDateParser_PATTERN;
|
||
}
|
||
innerExtract(context, match) {
|
||
let targetDate = dayjs_min(context.refDate);
|
||
const lowerText = match[0].toLowerCase();
|
||
const component = context.createParsingComponents();
|
||
switch (lowerText) {
|
||
case "now":
|
||
return now(context.reference);
|
||
case "today":
|
||
return today(context.reference);
|
||
case "yesterday":
|
||
return yesterday(context.reference);
|
||
case "tomorrow":
|
||
case "tmr":
|
||
case "tmrw":
|
||
return tomorrow(context.reference);
|
||
case "tonight":
|
||
return tonight(context.reference);
|
||
default:
|
||
if (lowerText.match(/last\s*night/)) {
|
||
if (targetDate.hour() > 6) {
|
||
targetDate = targetDate.add(-1, "day");
|
||
}
|
||
dayjs_assignSimilarDate(component, targetDate);
|
||
component.imply("hour", 0);
|
||
}
|
||
break;
|
||
}
|
||
return component;
|
||
}
|
||
}
|
||
;// CONCATENATED MODULE: ./node_modules/chrono-node/dist/esm/locales/en/parsers/ENCasualTimeParser.js
|
||
|
||
|
||
const ENCasualTimeParser_PATTERN = /(?:this)?\s{0,3}(morning|afternoon|evening|night|midnight|midday|noon)(?=\W|$)/i;
|
||
class ENCasualTimeParser extends AbstractParserWithWordBoundaryChecking {
|
||
innerPattern() {
|
||
return ENCasualTimeParser_PATTERN;
|
||
}
|
||
innerExtract(context, match) {
|
||
switch (match[1].toLowerCase()) {
|
||
case "afternoon":
|
||
return afternoon(context.reference);
|
||
case "evening":
|
||
case "night":
|
||
return evening(context.reference);
|
||
case "midnight":
|
||
return midnight(context.reference);
|
||
case "morning":
|
||
return morning(context.reference);
|
||
case "noon":
|
||
case "midday":
|
||
return noon(context.reference);
|
||
}
|
||
return null;
|
||
}
|
||
}
|
||
;// CONCATENATED MODULE: ./node_modules/chrono-node/dist/esm/common/calculation/weekdays.js
|
||
|
||
|
||
|
||
function createParsingComponentsAtWeekday(reference, weekday, modifier) {
|
||
const refDate = reference.getDateWithAdjustedTimezone();
|
||
const daysToWeekday = getDaysToWeekday(refDate, weekday, modifier);
|
||
let components = new results_ParsingComponents(reference);
|
||
components = addImpliedTimeUnits(components, {
|
||
"day": daysToWeekday
|
||
});
|
||
components.assign("weekday", weekday);
|
||
return components;
|
||
}
|
||
function getDaysToWeekday(refDate, weekday, modifier) {
|
||
const refWeekday = refDate.getDay();
|
||
switch (modifier) {
|
||
case "this":
|
||
return getDaysForwardToWeekday(refDate, weekday);
|
||
case "last":
|
||
return getBackwardDaysToWeekday(refDate, weekday);
|
||
case "next":
|
||
if (refWeekday == Weekday.SUNDAY) {
|
||
return weekday == Weekday.SUNDAY ? 7 : weekday;
|
||
}
|
||
if (refWeekday == Weekday.SATURDAY) {
|
||
if (weekday == Weekday.SATURDAY) return 7;
|
||
if (weekday == Weekday.SUNDAY) return 8;
|
||
return 1 + weekday;
|
||
}
|
||
if (weekday < refWeekday && weekday != Weekday.SUNDAY) {
|
||
return getDaysForwardToWeekday(refDate, weekday);
|
||
} else {
|
||
return getDaysForwardToWeekday(refDate, weekday) + 7;
|
||
}
|
||
}
|
||
return getDaysToWeekdayClosest(refDate, weekday);
|
||
}
|
||
function getDaysToWeekdayClosest(refDate, weekday) {
|
||
const backward = getBackwardDaysToWeekday(refDate, weekday);
|
||
const forward = getDaysForwardToWeekday(refDate, weekday);
|
||
return forward < -backward ? forward : backward;
|
||
}
|
||
function getDaysForwardToWeekday(refDate, weekday) {
|
||
const refWeekday = refDate.getDay();
|
||
let forwardCount = weekday - refWeekday;
|
||
if (forwardCount < 0) {
|
||
forwardCount += 7;
|
||
}
|
||
return forwardCount;
|
||
}
|
||
function getBackwardDaysToWeekday(refDate, weekday) {
|
||
const refWeekday = refDate.getDay();
|
||
let backwardCount = weekday - refWeekday;
|
||
if (backwardCount >= 0) {
|
||
backwardCount -= 7;
|
||
}
|
||
return backwardCount;
|
||
}
|
||
;// CONCATENATED MODULE: ./node_modules/chrono-node/dist/esm/locales/en/parsers/ENWeekdayParser.js
|
||
|
||
|
||
|
||
|
||
const ENWeekdayParser_PATTERN = new RegExp("(?:(?:\\,|\\(|\\()\\s*)?" + "(?:on\\s*?)?" + "(?:(this|last|past|next)\\s*)?" + `(${matchAnyPattern(WEEKDAY_DICTIONARY)})` + "(?:\\s*(?:\\,|\\)|\\)))?" + "(?:\\s*(this|last|past|next)\\s*week)?" + "(?=\\W|$)", "i");
|
||
const ENWeekdayParser_PREFIX_GROUP = 1;
|
||
const WEEKDAY_GROUP = 2;
|
||
const POSTFIX_GROUP = 3;
|
||
class ENWeekdayParser extends AbstractParserWithWordBoundaryChecking {
|
||
innerPattern() {
|
||
return ENWeekdayParser_PATTERN;
|
||
}
|
||
innerExtract(context, match) {
|
||
const dayOfWeek = match[WEEKDAY_GROUP].toLowerCase();
|
||
const weekday = WEEKDAY_DICTIONARY[dayOfWeek];
|
||
const prefix = match[ENWeekdayParser_PREFIX_GROUP];
|
||
const postfix = match[POSTFIX_GROUP];
|
||
let modifierWord = prefix || postfix;
|
||
modifierWord = modifierWord || "";
|
||
modifierWord = modifierWord.toLowerCase();
|
||
let modifier = null;
|
||
if (modifierWord == "last" || modifierWord == "past") {
|
||
modifier = "last";
|
||
} else if (modifierWord == "next") {
|
||
modifier = "next";
|
||
} else if (modifierWord == "this") {
|
||
modifier = "this";
|
||
}
|
||
return createParsingComponentsAtWeekday(context.reference, weekday, modifier);
|
||
}
|
||
}
|
||
;// CONCATENATED MODULE: ./node_modules/chrono-node/dist/esm/locales/en/parsers/ENRelativeDateFormatParser.js
|
||
|
||
|
||
|
||
|
||
|
||
const ENRelativeDateFormatParser_PATTERN = new RegExp(`(this|last|past|next|after\\s*this)\\s*(${matchAnyPattern(TIME_UNIT_DICTIONARY)})(?=\\s*)` + "(?=\\W|$)", "i");
|
||
const MODIFIER_WORD_GROUP = 1;
|
||
const RELATIVE_WORD_GROUP = 2;
|
||
class ENRelativeDateFormatParser extends AbstractParserWithWordBoundaryChecking {
|
||
innerPattern() {
|
||
return ENRelativeDateFormatParser_PATTERN;
|
||
}
|
||
innerExtract(context, match) {
|
||
const modifier = match[MODIFIER_WORD_GROUP].toLowerCase();
|
||
const unitWord = match[RELATIVE_WORD_GROUP].toLowerCase();
|
||
const timeunit = TIME_UNIT_DICTIONARY[unitWord];
|
||
if (modifier == "next" || modifier.startsWith("after")) {
|
||
const timeUnits = {};
|
||
timeUnits[timeunit] = 1;
|
||
return results_ParsingComponents.createRelativeFromReference(context.reference, timeUnits);
|
||
}
|
||
if (modifier == "last" || modifier == "past") {
|
||
const timeUnits = {};
|
||
timeUnits[timeunit] = -1;
|
||
return results_ParsingComponents.createRelativeFromReference(context.reference, timeUnits);
|
||
}
|
||
const components = context.createParsingComponents();
|
||
let date = dayjs_min(context.reference.instant);
|
||
if (unitWord.match(/week/i)) {
|
||
date = date.add(-date.get("d"), "d");
|
||
components.imply("day", date.date());
|
||
components.imply("month", date.month() + 1);
|
||
components.imply("year", date.year());
|
||
} else if (unitWord.match(/month/i)) {
|
||
date = date.add(-date.date() + 1, "d");
|
||
components.imply("day", date.date());
|
||
components.assign("year", date.year());
|
||
components.assign("month", date.month() + 1);
|
||
} else if (unitWord.match(/year/i)) {
|
||
date = date.add(-date.date() + 1, "d");
|
||
date = date.add(-date.month(), "month");
|
||
components.imply("day", date.date());
|
||
components.imply("month", date.month() + 1);
|
||
components.assign("year", date.year());
|
||
}
|
||
return components;
|
||
}
|
||
}
|
||
;// CONCATENATED MODULE: ./node_modules/chrono-node/dist/esm/chrono.js
|
||
|
||
|
||
class Chrono {
|
||
constructor(configuration) {
|
||
configuration = configuration || createCasualConfiguration();
|
||
this.parsers = [...configuration.parsers];
|
||
this.refiners = [...configuration.refiners];
|
||
}
|
||
clone() {
|
||
return new Chrono({
|
||
parsers: [...this.parsers],
|
||
refiners: [...this.refiners]
|
||
});
|
||
}
|
||
parseDate(text, referenceDate, option) {
|
||
const results = this.parse(text, referenceDate, option);
|
||
return results.length > 0 ? results[0].start.date() : null;
|
||
}
|
||
parse(text, referenceDate, option) {
|
||
const context = new ParsingContext(text, referenceDate, option);
|
||
let results = [];
|
||
this.parsers.forEach(parser => {
|
||
const parsedResults = Chrono.executeParser(context, parser);
|
||
results = results.concat(parsedResults);
|
||
});
|
||
results.sort((a, b) => {
|
||
return a.index - b.index;
|
||
});
|
||
this.refiners.forEach(function (refiner) {
|
||
results = refiner.refine(context, results);
|
||
});
|
||
return results;
|
||
}
|
||
static executeParser(context, parser) {
|
||
const results = [];
|
||
const pattern = parser.pattern(context);
|
||
const originalText = context.text;
|
||
let remainingText = context.text;
|
||
let match = pattern.exec(remainingText);
|
||
while (match) {
|
||
const index = match.index + originalText.length - remainingText.length;
|
||
match.index = index;
|
||
const result = parser.extract(context, match);
|
||
if (!result) {
|
||
remainingText = originalText.substring(match.index + 1);
|
||
match = pattern.exec(remainingText);
|
||
continue;
|
||
}
|
||
let parsedResult = null;
|
||
if (result instanceof ParsingResult) {
|
||
parsedResult = result;
|
||
} else if (result instanceof results_ParsingComponents) {
|
||
parsedResult = context.createParsingResult(match.index, match[0]);
|
||
parsedResult.start = result;
|
||
} else {
|
||
parsedResult = context.createParsingResult(match.index, match[0], result);
|
||
}
|
||
context.debug(() => console.log(`${parser.constructor.name} extracted result ${parsedResult}`));
|
||
results.push(parsedResult);
|
||
remainingText = originalText.substring(index + parsedResult.text.length);
|
||
match = pattern.exec(remainingText);
|
||
}
|
||
return results;
|
||
}
|
||
}
|
||
class ParsingContext {
|
||
constructor(text, refDate, option) {
|
||
this.text = text;
|
||
this.reference = new ReferenceWithTimezone(refDate);
|
||
this.option = option ?? {};
|
||
this.refDate = this.reference.instant;
|
||
}
|
||
createParsingComponents(components) {
|
||
if (components instanceof results_ParsingComponents) {
|
||
return components;
|
||
}
|
||
return new results_ParsingComponents(this.reference, components);
|
||
}
|
||
createParsingResult(index, textOrEndIndex, startComponents, endComponents) {
|
||
const text = typeof textOrEndIndex === "string" ? textOrEndIndex : this.text.substring(index, textOrEndIndex);
|
||
const start = startComponents ? this.createParsingComponents(startComponents) : null;
|
||
const end = endComponents ? this.createParsingComponents(endComponents) : null;
|
||
return new ParsingResult(this.reference, index, text, start, end);
|
||
}
|
||
debug(block) {
|
||
if (this.option.debug) {
|
||
if (this.option.debug instanceof Function) {
|
||
this.option.debug(block);
|
||
} else {
|
||
const handler = this.option.debug;
|
||
handler.debug(block);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
;// CONCATENATED MODULE: ./node_modules/chrono-node/dist/esm/common/parsers/SlashDateFormatParser.js
|
||
|
||
const SlashDateFormatParser_PATTERN = new RegExp("([^\\d]|^)" + "([0-3]{0,1}[0-9]{1})[\\/\\.\\-]([0-3]{0,1}[0-9]{1})" + "(?:[\\/\\.\\-]([0-9]{4}|[0-9]{2}))?" + "(\\W|$)", "i");
|
||
const OPENING_GROUP = 1;
|
||
const ENDING_GROUP = 5;
|
||
const FIRST_NUMBERS_GROUP = 2;
|
||
const SECOND_NUMBERS_GROUP = 3;
|
||
const SlashDateFormatParser_YEAR_GROUP = 4;
|
||
class SlashDateFormatParser {
|
||
constructor(littleEndian) {
|
||
this.groupNumberMonth = littleEndian ? SECOND_NUMBERS_GROUP : FIRST_NUMBERS_GROUP;
|
||
this.groupNumberDay = littleEndian ? FIRST_NUMBERS_GROUP : SECOND_NUMBERS_GROUP;
|
||
}
|
||
pattern() {
|
||
return SlashDateFormatParser_PATTERN;
|
||
}
|
||
extract(context, match) {
|
||
if (match[OPENING_GROUP].length == 0 && match.index > 0 && match.index < context.text.length) {
|
||
const previousChar = context.text[match.index - 1];
|
||
if (previousChar >= "0" && previousChar <= "9") {
|
||
return;
|
||
}
|
||
}
|
||
const index = match.index + match[OPENING_GROUP].length;
|
||
const text = match[0].substr(match[OPENING_GROUP].length, match[0].length - match[OPENING_GROUP].length - match[ENDING_GROUP].length);
|
||
if (text.match(/^\d\.\d$/) || text.match(/^\d\.\d{1,2}\.\d{1,2}\s*$/)) {
|
||
return;
|
||
}
|
||
if (!match[SlashDateFormatParser_YEAR_GROUP] && match[0].indexOf("/") < 0) {
|
||
return;
|
||
}
|
||
const result = context.createParsingResult(index, text);
|
||
let month = parseInt(match[this.groupNumberMonth]);
|
||
let day = parseInt(match[this.groupNumberDay]);
|
||
if (month < 1 || month > 12) {
|
||
if (month > 12) {
|
||
if (day >= 1 && day <= 12 && month <= 31) {
|
||
[day, month] = [month, day];
|
||
} else {
|
||
return null;
|
||
}
|
||
}
|
||
}
|
||
if (day < 1 || day > 31) {
|
||
return null;
|
||
}
|
||
result.start.assign("day", day);
|
||
result.start.assign("month", month);
|
||
if (match[SlashDateFormatParser_YEAR_GROUP]) {
|
||
const rawYearNumber = parseInt(match[SlashDateFormatParser_YEAR_GROUP]);
|
||
const year = findMostLikelyADYear(rawYearNumber);
|
||
result.start.assign("year", year);
|
||
} else {
|
||
const year = findYearClosestToRef(context.refDate, day, month);
|
||
result.start.imply("year", year);
|
||
}
|
||
return result;
|
||
}
|
||
}
|
||
;// CONCATENATED MODULE: ./node_modules/chrono-node/dist/esm/locales/en/parsers/ENTimeUnitCasualRelativeFormatParser.js
|
||
|
||
|
||
|
||
|
||
const ENTimeUnitCasualRelativeFormatParser_PATTERN = new RegExp(`(this|last|past|next|after|\\+|-)\\s*(${TIME_UNITS_PATTERN})(?=\\W|$)`, "i");
|
||
const PATTERN_NO_ABBR = new RegExp(`(this|last|past|next|after|\\+|-)\\s*(${TIME_UNITS_NO_ABBR_PATTERN})(?=\\W|$)`, "i");
|
||
class ENTimeUnitCasualRelativeFormatParser extends AbstractParserWithWordBoundaryChecking {
|
||
constructor(allowAbbreviations = true) {
|
||
super();
|
||
this.allowAbbreviations = allowAbbreviations;
|
||
}
|
||
innerPattern() {
|
||
return this.allowAbbreviations ? ENTimeUnitCasualRelativeFormatParser_PATTERN : PATTERN_NO_ABBR;
|
||
}
|
||
innerExtract(context, match) {
|
||
const prefix = match[1].toLowerCase();
|
||
let timeUnits = parseTimeUnits(match[2]);
|
||
switch (prefix) {
|
||
case "last":
|
||
case "past":
|
||
case "-":
|
||
timeUnits = reverseTimeUnits(timeUnits);
|
||
break;
|
||
}
|
||
return results_ParsingComponents.createRelativeFromReference(context.reference, timeUnits);
|
||
}
|
||
}
|
||
;// CONCATENATED MODULE: ./node_modules/chrono-node/dist/esm/locales/en/refiners/ENMergeRelativeDateRefiner.js
|
||
|
||
|
||
|
||
|
||
function hasImpliedEarlierReferenceDate(result) {
|
||
return result.text.match(/\s+(before|from)$/i) != null;
|
||
}
|
||
function hasImpliedLaterReferenceDate(result) {
|
||
return result.text.match(/\s+(after|since)$/i) != null;
|
||
}
|
||
class ENMergeRelativeDateRefiner extends MergingRefiner {
|
||
patternBetween() {
|
||
return /^\s*$/i;
|
||
}
|
||
shouldMergeResults(textBetween, currentResult, nextResult) {
|
||
if (!textBetween.match(this.patternBetween())) {
|
||
return false;
|
||
}
|
||
if (!hasImpliedEarlierReferenceDate(currentResult) && !hasImpliedLaterReferenceDate(currentResult)) {
|
||
return false;
|
||
}
|
||
return !!nextResult.start.get("day") && !!nextResult.start.get("month") && !!nextResult.start.get("year");
|
||
}
|
||
mergeResults(textBetween, currentResult, nextResult) {
|
||
let timeUnits = parseTimeUnits(currentResult.text);
|
||
if (hasImpliedEarlierReferenceDate(currentResult)) {
|
||
timeUnits = reverseTimeUnits(timeUnits);
|
||
}
|
||
const components = results_ParsingComponents.createRelativeFromReference(new ReferenceWithTimezone(nextResult.start.date()), timeUnits);
|
||
return new ParsingResult(nextResult.reference, currentResult.index, `${currentResult.text}${textBetween}${nextResult.text}`, components);
|
||
}
|
||
}
|
||
;// CONCATENATED MODULE: ./node_modules/chrono-node/dist/esm/locales/en/index.js
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
const casual = new Chrono(createCasualConfiguration(false));
|
||
const strict = new Chrono(createConfiguration(true, false));
|
||
const GB = new Chrono(createConfiguration(false, true));
|
||
function parse(text, ref, option) {
|
||
return casual.parse(text, ref, option);
|
||
}
|
||
function parseDate(text, ref, option) {
|
||
return casual.parseDate(text, ref, option);
|
||
}
|
||
function createCasualConfiguration(littleEndian = false) {
|
||
const option = createConfiguration(false, littleEndian);
|
||
option.parsers.unshift(new ENCasualDateParser());
|
||
option.parsers.unshift(new ENCasualTimeParser());
|
||
option.parsers.unshift(new ENMonthNameParser());
|
||
option.parsers.unshift(new ENRelativeDateFormatParser());
|
||
option.parsers.unshift(new ENTimeUnitCasualRelativeFormatParser());
|
||
return option;
|
||
}
|
||
function createConfiguration(strictMode = true, littleEndian = false) {
|
||
return includeCommonConfiguration({
|
||
parsers: [new SlashDateFormatParser(littleEndian), new ENTimeUnitWithinFormatParser(strictMode), new ENMonthNameLittleEndianParser(), new ENMonthNameMiddleEndianParser(), new ENWeekdayParser(), new ENCasualYearMonthDayParser(), new ENSlashMonthFormatParser(), new ENTimeExpressionParser(strictMode), new ENTimeUnitAgoFormatParser(strictMode), new ENTimeUnitLaterFormatParser(strictMode)],
|
||
refiners: [new ENMergeRelativeDateRefiner(), new ENMergeDateTimeRefiner(), new ENMergeDateRangeRefiner()]
|
||
}, strictMode);
|
||
}
|
||
;// CONCATENATED MODULE: ./node_modules/chrono-node/dist/esm/index.js
|
||
|
||
|
||
|
||
var esm_Meridiem;
|
||
(function (Meridiem) {
|
||
Meridiem[Meridiem["AM"] = 0] = "AM";
|
||
Meridiem[Meridiem["PM"] = 1] = "PM";
|
||
})(esm_Meridiem || (esm_Meridiem = {}));
|
||
var Weekday;
|
||
(function (Weekday) {
|
||
Weekday[Weekday["SUNDAY"] = 0] = "SUNDAY";
|
||
Weekday[Weekday["MONDAY"] = 1] = "MONDAY";
|
||
Weekday[Weekday["TUESDAY"] = 2] = "TUESDAY";
|
||
Weekday[Weekday["WEDNESDAY"] = 3] = "WEDNESDAY";
|
||
Weekday[Weekday["THURSDAY"] = 4] = "THURSDAY";
|
||
Weekday[Weekday["FRIDAY"] = 5] = "FRIDAY";
|
||
Weekday[Weekday["SATURDAY"] = 6] = "SATURDAY";
|
||
})(Weekday || (Weekday = {}));
|
||
var Month;
|
||
(function (Month) {
|
||
Month[Month["JANUARY"] = 1] = "JANUARY";
|
||
Month[Month["FEBRUARY"] = 2] = "FEBRUARY";
|
||
Month[Month["MARCH"] = 3] = "MARCH";
|
||
Month[Month["APRIL"] = 4] = "APRIL";
|
||
Month[Month["MAY"] = 5] = "MAY";
|
||
Month[Month["JUNE"] = 6] = "JUNE";
|
||
Month[Month["JULY"] = 7] = "JULY";
|
||
Month[Month["AUGUST"] = 8] = "AUGUST";
|
||
Month[Month["SEPTEMBER"] = 9] = "SEPTEMBER";
|
||
Month[Month["OCTOBER"] = 10] = "OCTOBER";
|
||
Month[Month["NOVEMBER"] = 11] = "NOVEMBER";
|
||
Month[Month["DECEMBER"] = 12] = "DECEMBER";
|
||
})(Month || (Month = {}));
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
const esm_strict = strict;
|
||
const esm_casual = casual;
|
||
function esm_parse(text, ref, option) {
|
||
return esm_casual.parse(text, ref, option);
|
||
}
|
||
function esm_parseDate(text, ref, option) {
|
||
return esm_casual.parseDate(text, ref, option);
|
||
}
|
||
;// CONCATENATED MODULE: ./node_modules/chrono-node/dist/esm/locales/de/parsers/DETimeExpressionParser.js
|
||
|
||
class DETimeExpressionParser extends AbstractTimeExpressionParser {
|
||
primaryPrefix() {
|
||
return "(?:(?:um|von)\\s*)?";
|
||
}
|
||
followingPhase() {
|
||
return "\\s*(?:\\-|\\–|\\~|\\〜|bis)\\s*";
|
||
}
|
||
extractPrimaryTimeComponents(context, match) {
|
||
if (match[0].match(/^\s*\d{4}\s*$/)) {
|
||
return null;
|
||
}
|
||
return super.extractPrimaryTimeComponents(context, match);
|
||
}
|
||
}
|
||
;// CONCATENATED MODULE: ./node_modules/chrono-node/dist/esm/locales/de/constants.js
|
||
|
||
|
||
const constants_WEEKDAY_DICTIONARY = {
|
||
"sonntag": 0,
|
||
"so": 0,
|
||
"montag": 1,
|
||
"mo": 1,
|
||
"dienstag": 2,
|
||
"di": 2,
|
||
"mittwoch": 3,
|
||
"mi": 3,
|
||
"donnerstag": 4,
|
||
"do": 4,
|
||
"freitag": 5,
|
||
"fr": 5,
|
||
"samstag": 6,
|
||
"sa": 6
|
||
};
|
||
const constants_MONTH_DICTIONARY = {
|
||
"januar": 1,
|
||
"jänner": 1,
|
||
"janner": 1,
|
||
"jan": 1,
|
||
"jan.": 1,
|
||
"februar": 2,
|
||
"feber": 2,
|
||
"feb": 2,
|
||
"feb.": 2,
|
||
"märz": 3,
|
||
"maerz": 3,
|
||
"mär": 3,
|
||
"mär.": 3,
|
||
"mrz": 3,
|
||
"mrz.": 3,
|
||
"april": 4,
|
||
"apr": 4,
|
||
"apr.": 4,
|
||
"mai": 5,
|
||
"juni": 6,
|
||
"jun": 6,
|
||
"jun.": 6,
|
||
"juli": 7,
|
||
"jul": 7,
|
||
"jul.": 7,
|
||
"august": 8,
|
||
"aug": 8,
|
||
"aug.": 8,
|
||
"september": 9,
|
||
"sep": 9,
|
||
"sep.": 9,
|
||
"sept": 9,
|
||
"sept.": 9,
|
||
"oktober": 10,
|
||
"okt": 10,
|
||
"okt.": 10,
|
||
"november": 11,
|
||
"nov": 11,
|
||
"nov.": 11,
|
||
"dezember": 12,
|
||
"dez": 12,
|
||
"dez.": 12
|
||
};
|
||
const constants_INTEGER_WORD_DICTIONARY = {
|
||
"eins": 1,
|
||
"eine": 1,
|
||
"einem": 1,
|
||
"einen": 1,
|
||
"einer": 1,
|
||
"zwei": 2,
|
||
"drei": 3,
|
||
"vier": 4,
|
||
"fünf": 5,
|
||
"fuenf": 5,
|
||
"sechs": 6,
|
||
"sieben": 7,
|
||
"acht": 8,
|
||
"neun": 9,
|
||
"zehn": 10,
|
||
"elf": 11,
|
||
"zwölf": 12,
|
||
"zwoelf": 12
|
||
};
|
||
const constants_TIME_UNIT_DICTIONARY = {
|
||
sek: "second",
|
||
sekunde: "second",
|
||
sekunden: "second",
|
||
min: "minute",
|
||
minute: "minute",
|
||
minuten: "minute",
|
||
h: "hour",
|
||
std: "hour",
|
||
stunde: "hour",
|
||
stunden: "hour",
|
||
tag: "d",
|
||
tage: "d",
|
||
tagen: "d",
|
||
woche: "week",
|
||
wochen: "week",
|
||
monat: "month",
|
||
monate: "month",
|
||
monaten: "month",
|
||
monats: "month",
|
||
quartal: "quarter",
|
||
quartals: "quarter",
|
||
quartale: "quarter",
|
||
quartalen: "quarter",
|
||
a: "year",
|
||
j: "year",
|
||
jr: "year",
|
||
jahr: "year",
|
||
jahre: "year",
|
||
jahren: "year",
|
||
jahres: "year"
|
||
};
|
||
const constants_NUMBER_PATTERN = `(?:${matchAnyPattern(constants_INTEGER_WORD_DICTIONARY)}|[0-9]+|[0-9]+\\.[0-9]+|halb?|halbe?|einigen?|wenigen?|mehreren?)`;
|
||
function constants_parseNumberPattern(match) {
|
||
const num = match.toLowerCase();
|
||
if (constants_INTEGER_WORD_DICTIONARY[num] !== undefined) {
|
||
return constants_INTEGER_WORD_DICTIONARY[num];
|
||
} else if (num === "ein" || num === "einer" || num === "einem" || num === "einen" || num === "eine") {
|
||
return 1;
|
||
} else if (num.match(/wenigen/)) {
|
||
return 2;
|
||
} else if (num.match(/halb/) || num.match(/halben/)) {
|
||
return 0.5;
|
||
} else if (num.match(/einigen/)) {
|
||
return 3;
|
||
} else if (num.match(/mehreren/)) {
|
||
return 7;
|
||
}
|
||
return parseFloat(num);
|
||
}
|
||
const constants_YEAR_PATTERN = `(?:[0-9]{1,4}(?:\\s*[vn]\\.?\\s*(?:C(?:hr)?|(?:u\\.?|d\\.?(?:\\s*g\\.?)?)?\\s*Z)\\.?|\\s*(?:u\\.?|d\\.?(?:\\s*g\\.)?)\\s*Z\\.?)?)`;
|
||
function constants_parseYear(match) {
|
||
if (/v/i.test(match)) {
|
||
return -parseInt(match.replace(/[^0-9]+/gi, ""));
|
||
}
|
||
if (/n/i.test(match)) {
|
||
return parseInt(match.replace(/[^0-9]+/gi, ""));
|
||
}
|
||
if (/z/i.test(match)) {
|
||
return parseInt(match.replace(/[^0-9]+/gi, ""));
|
||
}
|
||
const rawYearNumber = parseInt(match);
|
||
return findMostLikelyADYear(rawYearNumber);
|
||
}
|
||
const constants_SINGLE_TIME_UNIT_PATTERN = `(${constants_NUMBER_PATTERN})\\s{0,5}(${matchAnyPattern(constants_TIME_UNIT_DICTIONARY)})\\s{0,5}`;
|
||
const constants_SINGLE_TIME_UNIT_REGEX = new RegExp(constants_SINGLE_TIME_UNIT_PATTERN, "i");
|
||
const constants_TIME_UNITS_PATTERN = repeatedTimeunitPattern("", constants_SINGLE_TIME_UNIT_PATTERN);
|
||
function constants_parseTimeUnits(timeunitText) {
|
||
const fragments = {};
|
||
let remainingText = timeunitText;
|
||
let match = constants_SINGLE_TIME_UNIT_REGEX.exec(remainingText);
|
||
while (match) {
|
||
constants_collectDateTimeFragment(fragments, match);
|
||
remainingText = remainingText.substring(match[0].length);
|
||
match = constants_SINGLE_TIME_UNIT_REGEX.exec(remainingText);
|
||
}
|
||
return fragments;
|
||
}
|
||
function constants_collectDateTimeFragment(fragments, match) {
|
||
const num = constants_parseNumberPattern(match[1]);
|
||
const unit = constants_TIME_UNIT_DICTIONARY[match[2].toLowerCase()];
|
||
fragments[unit] = num;
|
||
}
|
||
;// CONCATENATED MODULE: ./node_modules/chrono-node/dist/esm/locales/de/parsers/DEWeekdayParser.js
|
||
|
||
|
||
|
||
|
||
const DEWeekdayParser_PATTERN = new RegExp("(?:(?:\\,|\\(|\\()\\s*)?" + "(?:a[mn]\\s*?)?" + "(?:(diese[mn]|letzte[mn]|n(?:ä|ae)chste[mn])\\s*)?" + `(${matchAnyPattern(constants_WEEKDAY_DICTIONARY)})` + "(?:\\s*(?:\\,|\\)|\\)))?" + "(?:\\s*(diese|letzte|n(?:ä|ae)chste)\\s*woche)?" + "(?=\\W|$)", "i");
|
||
const DEWeekdayParser_PREFIX_GROUP = 1;
|
||
const SUFFIX_GROUP = 3;
|
||
const DEWeekdayParser_WEEKDAY_GROUP = 2;
|
||
class DEWeekdayParser extends AbstractParserWithWordBoundaryChecking {
|
||
innerPattern() {
|
||
return DEWeekdayParser_PATTERN;
|
||
}
|
||
innerExtract(context, match) {
|
||
const dayOfWeek = match[DEWeekdayParser_WEEKDAY_GROUP].toLowerCase();
|
||
const offset = constants_WEEKDAY_DICTIONARY[dayOfWeek];
|
||
const prefix = match[DEWeekdayParser_PREFIX_GROUP];
|
||
const postfix = match[SUFFIX_GROUP];
|
||
let modifierWord = prefix || postfix;
|
||
modifierWord = modifierWord || "";
|
||
modifierWord = modifierWord.toLowerCase();
|
||
let modifier = null;
|
||
if (modifierWord.match(/letzte/)) {
|
||
modifier = "last";
|
||
} else if (modifierWord.match(/chste/)) {
|
||
modifier = "next";
|
||
} else if (modifierWord.match(/diese/)) {
|
||
modifier = "this";
|
||
}
|
||
return createParsingComponentsAtWeekday(context.reference, offset, modifier);
|
||
}
|
||
}
|
||
;// CONCATENATED MODULE: ./node_modules/chrono-node/dist/esm/locales/de/parsers/DESpecificTimeExpressionParser.js
|
||
|
||
const FIRST_REG_PATTERN = new RegExp("(^|\\s|T)" + "(?:(?:um|von)\\s*)?" + "(\\d{1,2})(?:h|:)?" + "(?:(\\d{1,2})(?:m|:)?)?" + "(?:(\\d{1,2})(?:s)?)?" + "(?:\\s*Uhr)?" + "(?:\\s*(morgens|vormittags|nachmittags|abends|nachts|am\\s+(?:Morgen|Vormittag|Nachmittag|Abend)|in\\s+der\\s+Nacht))?" + "(?=\\W|$)", "i");
|
||
const SECOND_REG_PATTERN = new RegExp("^\\s*(\\-|\\–|\\~|\\〜|bis(?:\\s+um)?|\\?)\\s*" + "(\\d{1,2})(?:h|:)?" + "(?:(\\d{1,2})(?:m|:)?)?" + "(?:(\\d{1,2})(?:s)?)?" + "(?:\\s*Uhr)?" + "(?:\\s*(morgens|vormittags|nachmittags|abends|nachts|am\\s+(?:Morgen|Vormittag|Nachmittag|Abend)|in\\s+der\\s+Nacht))?" + "(?=\\W|$)", "i");
|
||
const DESpecificTimeExpressionParser_HOUR_GROUP = 2;
|
||
const DESpecificTimeExpressionParser_MINUTE_GROUP = 3;
|
||
const DESpecificTimeExpressionParser_SECOND_GROUP = 4;
|
||
const DESpecificTimeExpressionParser_AM_PM_HOUR_GROUP = 5;
|
||
class DESpecificTimeExpressionParser {
|
||
pattern(context) {
|
||
return FIRST_REG_PATTERN;
|
||
}
|
||
extract(context, match) {
|
||
const result = context.createParsingResult(match.index + match[1].length, match[0].substring(match[1].length));
|
||
if (result.text.match(/^\d{4}$/)) {
|
||
match.index += match[0].length;
|
||
return null;
|
||
}
|
||
result.start = DESpecificTimeExpressionParser.extractTimeComponent(result.start.clone(), match);
|
||
if (!result.start) {
|
||
match.index += match[0].length;
|
||
return null;
|
||
}
|
||
const remainingText = context.text.substring(match.index + match[0].length);
|
||
const secondMatch = SECOND_REG_PATTERN.exec(remainingText);
|
||
if (secondMatch) {
|
||
result.end = DESpecificTimeExpressionParser.extractTimeComponent(result.start.clone(), secondMatch);
|
||
if (result.end) {
|
||
result.text += secondMatch[0];
|
||
}
|
||
}
|
||
return result;
|
||
}
|
||
static extractTimeComponent(extractingComponents, match) {
|
||
let hour = 0;
|
||
let minute = 0;
|
||
let meridiem = null;
|
||
hour = parseInt(match[DESpecificTimeExpressionParser_HOUR_GROUP]);
|
||
if (match[DESpecificTimeExpressionParser_MINUTE_GROUP] != null) {
|
||
minute = parseInt(match[DESpecificTimeExpressionParser_MINUTE_GROUP]);
|
||
}
|
||
if (minute >= 60 || hour > 24) {
|
||
return null;
|
||
}
|
||
if (hour >= 12) {
|
||
meridiem = esm_Meridiem.PM;
|
||
}
|
||
if (match[DESpecificTimeExpressionParser_AM_PM_HOUR_GROUP] != null) {
|
||
if (hour > 12) return null;
|
||
const ampm = match[DESpecificTimeExpressionParser_AM_PM_HOUR_GROUP].toLowerCase();
|
||
if (ampm.match(/morgen|vormittag/)) {
|
||
meridiem = esm_Meridiem.AM;
|
||
if (hour == 12) {
|
||
hour = 0;
|
||
}
|
||
}
|
||
if (ampm.match(/nachmittag|abend/)) {
|
||
meridiem = esm_Meridiem.PM;
|
||
if (hour != 12) {
|
||
hour += 12;
|
||
}
|
||
}
|
||
if (ampm.match(/nacht/)) {
|
||
if (hour == 12) {
|
||
meridiem = esm_Meridiem.AM;
|
||
hour = 0;
|
||
} else if (hour < 6) {
|
||
meridiem = esm_Meridiem.AM;
|
||
} else {
|
||
meridiem = esm_Meridiem.PM;
|
||
hour += 12;
|
||
}
|
||
}
|
||
}
|
||
extractingComponents.assign("hour", hour);
|
||
extractingComponents.assign("minute", minute);
|
||
if (meridiem !== null) {
|
||
extractingComponents.assign("meridiem", meridiem);
|
||
} else {
|
||
if (hour < 12) {
|
||
extractingComponents.imply("meridiem", esm_Meridiem.AM);
|
||
} else {
|
||
extractingComponents.imply("meridiem", esm_Meridiem.PM);
|
||
}
|
||
}
|
||
if (match[DESpecificTimeExpressionParser_SECOND_GROUP] != null) {
|
||
const second = parseInt(match[DESpecificTimeExpressionParser_SECOND_GROUP]);
|
||
if (second >= 60) return null;
|
||
extractingComponents.assign("second", second);
|
||
}
|
||
return extractingComponents;
|
||
}
|
||
}
|
||
;// CONCATENATED MODULE: ./node_modules/chrono-node/dist/esm/locales/de/refiners/DEMergeDateRangeRefiner.js
|
||
|
||
class DEMergeDateRangeRefiner extends AbstractMergeDateRangeRefiner {
|
||
patternBetween() {
|
||
return /^\s*(bis(?:\s*(?:am|zum))?|-)\s*$/i;
|
||
}
|
||
}
|
||
;// CONCATENATED MODULE: ./node_modules/chrono-node/dist/esm/locales/de/refiners/DEMergeDateTimeRefiner.js
|
||
|
||
class DEMergeDateTimeRefiner extends AbstractMergeDateTimeRefiner {
|
||
patternBetween() {
|
||
return new RegExp("^\\s*(T|um|am|,|-)?\\s*$");
|
||
}
|
||
}
|
||
;// CONCATENATED MODULE: ./node_modules/chrono-node/dist/esm/locales/de/parsers/DECasualTimeParser.js
|
||
|
||
|
||
|
||
|
||
|
||
class DECasualTimeParser extends AbstractParserWithWordBoundaryChecking {
|
||
innerPattern(context) {
|
||
return /(diesen)?\s*(morgen|vormittag|mittags?|nachmittag|abend|nacht|mitternacht)(?=\W|$)/i;
|
||
}
|
||
innerExtract(context, match) {
|
||
const targetDate = dayjs_min(context.refDate);
|
||
const timeKeywordPattern = match[2].toLowerCase();
|
||
const component = context.createParsingComponents();
|
||
implySimilarTime(component, targetDate);
|
||
return DECasualTimeParser.extractTimeComponents(component, timeKeywordPattern);
|
||
}
|
||
static extractTimeComponents(component, timeKeywordPattern) {
|
||
switch (timeKeywordPattern) {
|
||
case "morgen":
|
||
component.imply("hour", 6);
|
||
component.imply("minute", 0);
|
||
component.imply("second", 0);
|
||
component.imply("meridiem", esm_Meridiem.AM);
|
||
break;
|
||
case "vormittag":
|
||
component.imply("hour", 9);
|
||
component.imply("minute", 0);
|
||
component.imply("second", 0);
|
||
component.imply("meridiem", esm_Meridiem.AM);
|
||
break;
|
||
case "mittag":
|
||
case "mittags":
|
||
component.imply("hour", 12);
|
||
component.imply("minute", 0);
|
||
component.imply("second", 0);
|
||
component.imply("meridiem", esm_Meridiem.AM);
|
||
break;
|
||
case "nachmittag":
|
||
component.imply("hour", 15);
|
||
component.imply("minute", 0);
|
||
component.imply("second", 0);
|
||
component.imply("meridiem", esm_Meridiem.PM);
|
||
break;
|
||
case "abend":
|
||
component.imply("hour", 18);
|
||
component.imply("minute", 0);
|
||
component.imply("second", 0);
|
||
component.imply("meridiem", esm_Meridiem.PM);
|
||
break;
|
||
case "nacht":
|
||
component.imply("hour", 22);
|
||
component.imply("minute", 0);
|
||
component.imply("second", 0);
|
||
component.imply("meridiem", esm_Meridiem.PM);
|
||
break;
|
||
case "mitternacht":
|
||
if (component.get("hour") > 1) {
|
||
component = addImpliedTimeUnits(component, {
|
||
"day": 1
|
||
});
|
||
}
|
||
component.imply("hour", 0);
|
||
component.imply("minute", 0);
|
||
component.imply("second", 0);
|
||
component.imply("meridiem", esm_Meridiem.AM);
|
||
break;
|
||
}
|
||
return component;
|
||
}
|
||
}
|
||
;// CONCATENATED MODULE: ./node_modules/chrono-node/dist/esm/locales/de/parsers/DECasualDateParser.js
|
||
|
||
|
||
|
||
|
||
|
||
const DECasualDateParser_PATTERN = new RegExp(`(jetzt|heute|morgen|übermorgen|uebermorgen|gestern|vorgestern|letzte\\s*nacht)` + `(?:\\s*(morgen|vormittag|mittags?|nachmittag|abend|nacht|mitternacht))?` + `(?=\\W|$)`, "i");
|
||
const DECasualDateParser_DATE_GROUP = 1;
|
||
const TIME_GROUP = 2;
|
||
class DECasualDateParser extends AbstractParserWithWordBoundaryChecking {
|
||
innerPattern(context) {
|
||
return DECasualDateParser_PATTERN;
|
||
}
|
||
innerExtract(context, match) {
|
||
let targetDate = dayjs_min(context.refDate);
|
||
const dateKeyword = (match[DECasualDateParser_DATE_GROUP] || "").toLowerCase();
|
||
const timeKeyword = (match[TIME_GROUP] || "").toLowerCase();
|
||
let component = context.createParsingComponents();
|
||
switch (dateKeyword) {
|
||
case "jetzt":
|
||
component = now(context.reference);
|
||
break;
|
||
case "heute":
|
||
component = today(context.reference);
|
||
break;
|
||
case "morgen":
|
||
assignTheNextDay(component, targetDate);
|
||
break;
|
||
case "übermorgen":
|
||
case "uebermorgen":
|
||
targetDate = targetDate.add(1, "day");
|
||
assignTheNextDay(component, targetDate);
|
||
break;
|
||
case "gestern":
|
||
targetDate = targetDate.add(-1, "day");
|
||
dayjs_assignSimilarDate(component, targetDate);
|
||
implySimilarTime(component, targetDate);
|
||
break;
|
||
case "vorgestern":
|
||
targetDate = targetDate.add(-2, "day");
|
||
dayjs_assignSimilarDate(component, targetDate);
|
||
implySimilarTime(component, targetDate);
|
||
break;
|
||
default:
|
||
if (dateKeyword.match(/letzte\s*nacht/)) {
|
||
if (targetDate.hour() > 6) {
|
||
targetDate = targetDate.add(-1, "day");
|
||
}
|
||
dayjs_assignSimilarDate(component, targetDate);
|
||
component.imply("hour", 0);
|
||
}
|
||
break;
|
||
}
|
||
if (timeKeyword) {
|
||
component = DECasualTimeParser.extractTimeComponents(component, timeKeyword);
|
||
}
|
||
return component;
|
||
}
|
||
}
|
||
;// CONCATENATED MODULE: ./node_modules/chrono-node/dist/esm/locales/de/parsers/DEMonthNameLittleEndianParser.js
|
||
|
||
|
||
|
||
|
||
|
||
const DEMonthNameLittleEndianParser_PATTERN = new RegExp("(?:am\\s*?)?" + "(?:den\\s*?)?" + `([0-9]{1,2})\\.` + `(?:\\s*(?:bis(?:\\s*(?:am|zum))?|\\-|\\–|\\s)\\s*([0-9]{1,2})\\.?)?\\s*` + `(${matchAnyPattern(constants_MONTH_DICTIONARY)})` + `(?:(?:-|/|,?\\s*)(${constants_YEAR_PATTERN}(?![^\\s]\\d)))?` + `(?=\\W|$)`, "i");
|
||
const DEMonthNameLittleEndianParser_DATE_GROUP = 1;
|
||
const DEMonthNameLittleEndianParser_DATE_TO_GROUP = 2;
|
||
const DEMonthNameLittleEndianParser_MONTH_NAME_GROUP = 3;
|
||
const DEMonthNameLittleEndianParser_YEAR_GROUP = 4;
|
||
class DEMonthNameLittleEndianParser extends AbstractParserWithWordBoundaryChecking {
|
||
innerPattern() {
|
||
return DEMonthNameLittleEndianParser_PATTERN;
|
||
}
|
||
innerExtract(context, match) {
|
||
const result = context.createParsingResult(match.index, match[0]);
|
||
const month = constants_MONTH_DICTIONARY[match[DEMonthNameLittleEndianParser_MONTH_NAME_GROUP].toLowerCase()];
|
||
const day = parseInt(match[DEMonthNameLittleEndianParser_DATE_GROUP]);
|
||
if (day > 31) {
|
||
match.index = match.index + match[DEMonthNameLittleEndianParser_DATE_GROUP].length;
|
||
return null;
|
||
}
|
||
result.start.assign("month", month);
|
||
result.start.assign("day", day);
|
||
if (match[DEMonthNameLittleEndianParser_YEAR_GROUP]) {
|
||
const yearNumber = constants_parseYear(match[DEMonthNameLittleEndianParser_YEAR_GROUP]);
|
||
result.start.assign("year", yearNumber);
|
||
} else {
|
||
const year = findYearClosestToRef(context.refDate, day, month);
|
||
result.start.imply("year", year);
|
||
}
|
||
if (match[DEMonthNameLittleEndianParser_DATE_TO_GROUP]) {
|
||
const endDate = parseInt(match[DEMonthNameLittleEndianParser_DATE_TO_GROUP]);
|
||
result.end = result.start.clone();
|
||
result.end.assign("day", endDate);
|
||
}
|
||
return result;
|
||
}
|
||
}
|
||
;// CONCATENATED MODULE: ./node_modules/chrono-node/dist/esm/locales/de/parsers/DETimeUnitRelativeFormatParser.js
|
||
|
||
|
||
|
||
|
||
|
||
class DETimeUnitAgoFormatParser extends AbstractParserWithWordBoundaryChecking {
|
||
constructor() {
|
||
super();
|
||
}
|
||
innerPattern() {
|
||
return new RegExp(`(?:\\s*((?:nächste|kommende|folgende|letzte|vergangene|vorige|vor(?:her|an)gegangene)(?:s|n|m|r)?|vor|in)\\s*)?` + `(${constants_NUMBER_PATTERN})?` + `(?:\\s*(nächste|kommende|folgende|letzte|vergangene|vorige|vor(?:her|an)gegangene)(?:s|n|m|r)?)?` + `\\s*(${matchAnyPattern(constants_TIME_UNIT_DICTIONARY)})`, "i");
|
||
}
|
||
innerExtract(context, match) {
|
||
const num = match[2] ? constants_parseNumberPattern(match[2]) : 1;
|
||
const unit = constants_TIME_UNIT_DICTIONARY[match[4].toLowerCase()];
|
||
let timeUnits = {};
|
||
timeUnits[unit] = num;
|
||
let modifier = match[1] || match[3] || "";
|
||
modifier = modifier.toLowerCase();
|
||
if (!modifier) {
|
||
return;
|
||
}
|
||
if (/vor/.test(modifier) || /letzte/.test(modifier) || /vergangen/.test(modifier)) {
|
||
timeUnits = reverseTimeUnits(timeUnits);
|
||
}
|
||
return results_ParsingComponents.createRelativeFromReference(context.reference, timeUnits);
|
||
}
|
||
}
|
||
;// CONCATENATED MODULE: ./node_modules/chrono-node/dist/esm/locales/de/parsers/DETimeUnitWithinFormatParser.js
|
||
|
||
|
||
|
||
class DETimeUnitWithinFormatParser extends AbstractParserWithWordBoundaryChecking {
|
||
innerPattern() {
|
||
return new RegExp(`(?:in|für|während)\\s*(${constants_TIME_UNITS_PATTERN})(?=\\W|$)`, "i");
|
||
}
|
||
innerExtract(context, match) {
|
||
const timeUnits = constants_parseTimeUnits(match[1]);
|
||
return results_ParsingComponents.createRelativeFromReference(context.reference, timeUnits);
|
||
}
|
||
}
|
||
;// CONCATENATED MODULE: ./node_modules/chrono-node/dist/esm/locales/de/index.js
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
const de_casual = new Chrono(de_createCasualConfiguration());
|
||
const de_strict = new Chrono(de_createConfiguration(true));
|
||
function de_parse(text, ref, option) {
|
||
return de_casual.parse(text, ref, option);
|
||
}
|
||
function de_parseDate(text, ref, option) {
|
||
return de_casual.parseDate(text, ref, option);
|
||
}
|
||
function de_createCasualConfiguration(littleEndian = true) {
|
||
const option = de_createConfiguration(false, littleEndian);
|
||
option.parsers.unshift(new DECasualTimeParser());
|
||
option.parsers.unshift(new DECasualDateParser());
|
||
option.parsers.unshift(new DETimeUnitAgoFormatParser());
|
||
return option;
|
||
}
|
||
function de_createConfiguration(strictMode = true, littleEndian = true) {
|
||
return includeCommonConfiguration({
|
||
parsers: [new ISOFormatParser(), new SlashDateFormatParser(littleEndian), new DETimeExpressionParser(), new DESpecificTimeExpressionParser(), new DEMonthNameLittleEndianParser(), new DEWeekdayParser(), new DETimeUnitWithinFormatParser()],
|
||
refiners: [new DEMergeDateRangeRefiner(), new DEMergeDateTimeRefiner()]
|
||
}, strictMode);
|
||
}
|
||
;// CONCATENATED MODULE: external "axios"
|
||
const external_axios_namespaceObject = axios;
|
||
var external_axios_default = /*#__PURE__*/__webpack_require__.n(external_axios_namespaceObject);
|
||
;// CONCATENATED MODULE: external "axiosGmxhrAdapter"
|
||
const external_axiosGmxhrAdapter_namespaceObject = axiosGmxhrAdapter;
|
||
var external_axiosGmxhrAdapter_default = /*#__PURE__*/__webpack_require__.n(external_axiosGmxhrAdapter_namespaceObject);
|
||
;// CONCATENATED MODULE: ./src/utils.ts
|
||
/**
|
||
* @typedef {Object} AxiosResponse
|
||
* @property {Object} data
|
||
* @property {Object} headers
|
||
* @property {Object} config
|
||
* @property {Object} request
|
||
* @property {number} code
|
||
* @property {string} statusText
|
||
*/
|
||
/**
|
||
* @typedef {Object} AxiosError
|
||
* @property {AxiosResponse} response
|
||
*/
|
||
|
||
|
||
(external_axios_default()).defaults.adapter = (external_axiosGmxhrAdapter_default());
|
||
|
||
function extractNumber(s) {
|
||
var match = /(\+?[0-9]{4,})/.exec(s);
|
||
if (!match) {
|
||
return undefined;
|
||
}
|
||
var number = match[1];
|
||
if (number.startsWith('+')) {
|
||
number = number.replace('+', '00');
|
||
}
|
||
return number;
|
||
}
|
||
function fireChangeEvents(element) {
|
||
var changeEvent = null;
|
||
changeEvent = document.createEvent('HTMLEvents');
|
||
changeEvent.initEvent('input', true, true);
|
||
element.dispatchEvent(changeEvent);
|
||
console.debug('input event dispatched for element: ' + element.id);
|
||
changeEvent = document.createEvent('HTMLEvents');
|
||
changeEvent.initEvent('keyup', true, true);
|
||
element.dispatchEvent(changeEvent);
|
||
console.debug('keyup event dispatched for element: ' + element.id);
|
||
changeEvent = document.createEvent('HTMLEvents');
|
||
changeEvent.initEvent('change', true, true);
|
||
element.dispatchEvent(changeEvent);
|
||
console.debug('change event dispatched for element: ' + element.id);
|
||
}
|
||
|
||
;// CONCATENATED MODULE: ./src/call-history.ts
|
||
var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||
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) : adopt(result.value).then(fulfilled, rejected); }
|
||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||
});
|
||
};
|
||
|
||
|
||
class CallHistory {
|
||
constructor() {
|
||
this.callerIds = {};
|
||
}
|
||
updateCallHistoryEntry(call, callerId) {
|
||
var span = call.querySelector(':scope > span');
|
||
this.showTimeManager(call, call.querySelector('.date').textContent, callerId);
|
||
if (callerId && callerId.tD_NAME !== '') {
|
||
var text = span.textContent;
|
||
span.textContent = callerId.tD_NAME + ' ' + callerId.tD_NUMBER;
|
||
}
|
||
}
|
||
showTimeManager(call, date, callerId) {
|
||
var dateParts = date.match(/^(?<date>.*), (?<duration>[0-9]{2}:[0-9]{2}:[0-9]{2})$/);
|
||
var duration = '00:00:00';
|
||
if (dateParts) {
|
||
date = dateParts.groups.date;
|
||
duration = dateParts.groups.duration;
|
||
}
|
||
var parsedDate = esm_parseDate(date);
|
||
var parsedDateDe = de_parseDate(date);
|
||
if (parsedDateDe) {
|
||
parsedDate = parsedDateDe;
|
||
}
|
||
if (!parsedDate) {
|
||
return;
|
||
}
|
||
// Date parsing is awful, just assume the first number is the day of month
|
||
var day = date.match(/[0-9]+/)[0];
|
||
var parsedDuration = esm_parseDate(duration);
|
||
console.log('TAPI call history time:', date, 'parsedDate:', parsedDate, 'duration:', duration, 'parsedDuration:', parsedDuration);
|
||
var connect = parsedDate.getFullYear().toString() +
|
||
(parsedDate.getMonth() + 1).toString().padStart(2, '0') + // (January gives 0)
|
||
day.toString().padStart(2, '0') +
|
||
parsedDate.getHours().toString().padStart(2, '0') +
|
||
parsedDate.getMinutes().toString().padStart(2, '0');
|
||
var length = (parsedDuration.getHours() * 60 + parsedDuration.getMinutes()).toString();
|
||
var toolbar = call.querySelector('call-history-options');
|
||
var href = 'domizil://PM/Zeitbuchung?';
|
||
if (callerId && callerId.tD_ID) {
|
||
href += 'KontaktId=' + callerId.tD_ID + '&';
|
||
}
|
||
href += 'connect=' + connect + '&length=' + length;
|
||
var a = document.createElement('a');
|
||
a.title = 'PM Zeitbuchung';
|
||
a.dataset.domizilLink = href;
|
||
a.onclick = () => {
|
||
window.open(href);
|
||
};
|
||
a.innerHTML = '<svg version="1.1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 559.98 559.98">' +
|
||
'<g>' +
|
||
' <g>' +
|
||
' <path d="M279.99,0C125.601,0,0,125.601,0,279.99c0,154.39,125.601,279.99,279.99,279.99c154.39,0,279.99-125.601,279.99-279.99' +
|
||
' C559.98,125.601,434.38,0,279.99,0z M279.99,498.78c-120.644,0-218.79-98.146-218.79-218.79' +
|
||
' c0-120.638,98.146-218.79,218.79-218.79s218.79,98.152,218.79,218.79C498.78,400.634,400.634,498.78,279.99,498.78z"/>' +
|
||
' <path d="M304.226,280.326V162.976c0-13.103-10.618-23.721-23.716-23.721c-13.102,0-23.721,10.618-23.721,23.721v124.928' +
|
||
' c0,0.373,0.092,0.723,0.11,1.096c-0.312,6.45,1.91,12.999,6.836,17.926l88.343,88.336c9.266,9.266,24.284,9.266,33.543,0' +
|
||
' c9.26-9.266,9.266-24.284,0-33.544L304.226,280.326z"/>' +
|
||
' </g>' +
|
||
'</g>' +
|
||
'</svg>';
|
||
a.classList.add('btn');
|
||
a.classList.add('btn-plain');
|
||
toolbar.insertBefore(a, toolbar.firstChild);
|
||
}
|
||
showCallHistory(element) {
|
||
return __awaiter(this, void 0, void 0, function* () {
|
||
var span = element.querySelector(':scope > span');
|
||
var number = extractNumber(span.textContent);
|
||
if (!number) {
|
||
this.updateCallHistoryEntry(element, undefined);
|
||
return;
|
||
}
|
||
if (this.callerIds[number] !== undefined) {
|
||
this.updateCallHistoryEntry(element, this.callerIds[number]);
|
||
}
|
||
else {
|
||
var response = yield external_axios_default().get('http://cpatapi.cpsrvweb2016.cp-austria.at/callerid/' + encodeURIComponent(number));
|
||
var callerId = { tD_NAME: '' };
|
||
if (response.status === 200) {
|
||
callerId = response.data;
|
||
}
|
||
console.log('TAPI call histroy callerid response', number, response, callerId);
|
||
this.callerIds[number] = callerId;
|
||
this.updateCallHistoryEntry(element, callerId);
|
||
}
|
||
});
|
||
}
|
||
}
|
||
|
||
;// CONCATENATED MODULE: ./src/call-notification.ts
|
||
var call_notification_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||
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) : adopt(result.value).then(fulfilled, rejected); }
|
||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||
});
|
||
};
|
||
|
||
class CallNotification {
|
||
showCallNotification(element) {
|
||
return call_notification_awaiter(this, void 0, void 0, function* () {
|
||
var number = element.querySelector('.callNumber').textContent;
|
||
console.log('TAPI call notification', number);
|
||
number = extractNumber(number);
|
||
if (!number) {
|
||
console.log('TAPI callerid no number found');
|
||
return;
|
||
}
|
||
console.log('TAPI searching callerid for', number);
|
||
var response = yield external_axios_default().get('http://cpatapi.cpsrvweb2016.cp-austria.at/callerid/' + encodeURIComponent(number));
|
||
console.log('TAPI callerid response', response);
|
||
var notification = {
|
||
text: number
|
||
};
|
||
if (response.status === 200) {
|
||
var callerId = response.data;
|
||
if (callerId) {
|
||
notification.text = callerId.tD_NAME + '\r\n' + number + ' (' + callerId.tD_MEDIUM + ')';
|
||
}
|
||
}
|
||
// eslint-disable-next-line no-undef
|
||
GM.notification(notification);
|
||
});
|
||
}
|
||
}
|
||
|
||
// EXTERNAL MODULE: ./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js
|
||
var injectStylesIntoStyleTag = __webpack_require__("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js");
|
||
var injectStylesIntoStyleTag_default = /*#__PURE__*/__webpack_require__.n(injectStylesIntoStyleTag);
|
||
// EXTERNAL MODULE: ./node_modules/style-loader/dist/runtime/styleDomAPI.js
|
||
var styleDomAPI = __webpack_require__("./node_modules/style-loader/dist/runtime/styleDomAPI.js");
|
||
var styleDomAPI_default = /*#__PURE__*/__webpack_require__.n(styleDomAPI);
|
||
// EXTERNAL MODULE: ./node_modules/style-loader/dist/runtime/insertBySelector.js
|
||
var insertBySelector = __webpack_require__("./node_modules/style-loader/dist/runtime/insertBySelector.js");
|
||
var insertBySelector_default = /*#__PURE__*/__webpack_require__.n(insertBySelector);
|
||
// EXTERNAL MODULE: ./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js
|
||
var setAttributesWithoutAttributes = __webpack_require__("./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js");
|
||
var setAttributesWithoutAttributes_default = /*#__PURE__*/__webpack_require__.n(setAttributesWithoutAttributes);
|
||
// EXTERNAL MODULE: ./node_modules/style-loader/dist/runtime/insertStyleElement.js
|
||
var insertStyleElement = __webpack_require__("./node_modules/style-loader/dist/runtime/insertStyleElement.js");
|
||
var insertStyleElement_default = /*#__PURE__*/__webpack_require__.n(insertStyleElement);
|
||
// EXTERNAL MODULE: ./node_modules/style-loader/dist/runtime/styleTagTransform.js
|
||
var styleTagTransform = __webpack_require__("./node_modules/style-loader/dist/runtime/styleTagTransform.js");
|
||
var styleTagTransform_default = /*#__PURE__*/__webpack_require__.n(styleTagTransform);
|
||
// EXTERNAL MODULE: ./node_modules/css-loader/dist/cjs.js!./src/search.css
|
||
var search = __webpack_require__("./node_modules/css-loader/dist/cjs.js!./src/search.css");
|
||
;// CONCATENATED MODULE: ./src/search.css
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
var options = {};
|
||
|
||
options.styleTagTransform = (styleTagTransform_default());
|
||
options.setAttributes = (setAttributesWithoutAttributes_default());
|
||
|
||
options.insert = insertBySelector_default().bind(null, "head");
|
||
|
||
options.domAPI = (styleDomAPI_default());
|
||
options.insertStyleElement = (insertStyleElement_default());
|
||
|
||
var update = injectStylesIntoStyleTag_default()(search/* default */.Z, options);
|
||
|
||
|
||
|
||
|
||
/* harmony default export */ const src_search = (search/* default */.Z && search/* default */.Z.locals ? search/* default */.Z.locals : undefined);
|
||
|
||
;// CONCATENATED MODULE: ./src/debounce.js
|
||
function debounce(func, wait) {
|
||
let timeout;
|
||
return function executedFunction() {
|
||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
||
args[_key] = arguments[_key];
|
||
}
|
||
const later = () => {
|
||
clearTimeout(timeout);
|
||
func(...args);
|
||
};
|
||
clearTimeout(timeout);
|
||
timeout = setTimeout(later, wait);
|
||
};
|
||
}
|
||
;// CONCATENATED MODULE: ./src/search.ts
|
||
var search_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||
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) : adopt(result.value).then(fulfilled, rejected); }
|
||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||
});
|
||
};
|
||
|
||
|
||
|
||
class Search {
|
||
constructor() {
|
||
this.currentSearchText = '';
|
||
this.doSearch = debounce(() => search_awaiter(this, void 0, void 0, function* () {
|
||
var search = document.getElementById('tapiSearchInput');
|
||
var searchText = search.value.trim();
|
||
if (searchText === '') {
|
||
this.removeSearchResults();
|
||
return;
|
||
}
|
||
else if (searchText === this.currentSearchText) {
|
||
return;
|
||
}
|
||
console.log('Searching TAPI');
|
||
var response = yield external_axios_default().get('http://cpatapi.cpsrvweb2016.cp-austria.at/search?query=' + encodeURIComponent(searchText));
|
||
console.log('TAPI Search response', response);
|
||
var contacts = response.data;
|
||
console.log('TAPI Contacts', contacts);
|
||
this.removeSearchResults();
|
||
this.currentSearchText = searchText;
|
||
var results = document.createElement('div');
|
||
results.setAttribute('id', 'tapi-search-autocomplete-list');
|
||
results.setAttribute('class', 'tapi-search-autocomplete-items');
|
||
document.getElementById('tapiSearchBox').appendChild(results);
|
||
contacts.forEach(contact => {
|
||
var item = document.createElement('div');
|
||
item.setAttribute('class', 'tapi-search-autocomplete-item');
|
||
var p = document.createElement('p');
|
||
p.innerHTML = contact.tD_NAME + '<br>' + contact.tD_MEDIUM + ': ' + contact.tD_NUMBER_TAPI;
|
||
item.appendChild(p);
|
||
item.onclick = () => { this.dial(contact.tD_NUMBER_TAPI); };
|
||
item.onmouseover = () => { this.selectResult(item); };
|
||
item.dataset.tapiNumber = contact.tD_NUMBER_TAPI;
|
||
results.appendChild(item);
|
||
});
|
||
}), 200);
|
||
}
|
||
createSearchWindow(element) {
|
||
console.log('Create TAPI Search');
|
||
var form = document.createElement('form');
|
||
form.onsubmit = () => {
|
||
var items = document.getElementsByClassName('tapi-search-autocomplete-active');
|
||
if (items.length === 0) {
|
||
items = document.getElementsByClassName('tapi-search-autocomplete-item');
|
||
}
|
||
if (items.length > 0) {
|
||
this.dial(items[0].dataset.tapiNumber);
|
||
}
|
||
else {
|
||
this.dial(document.getElementById('tapiSearchInput').value);
|
||
}
|
||
return false;
|
||
};
|
||
var searchBox = document.createElement('div');
|
||
searchBox.classList.add('tapi-search-autocomplete');
|
||
searchBox.style.width = '200px';
|
||
searchBox.id = 'tapiSearchBox';
|
||
form.appendChild(searchBox);
|
||
var search = document.createElement('input');
|
||
search.id = 'tapiSearchInput';
|
||
search.autocomplete = 'off';
|
||
search.placeholder = 'TAPI Suche';
|
||
search.onfocus = () => { this.doSearch(); };
|
||
search.onkeydown = (ev) => { this.doSearchKeyDown(ev); };
|
||
search.onblur = () => {
|
||
console.log('TAPI Search exit', this);
|
||
setTimeout(() => {
|
||
console.log('TAPI clear search results');
|
||
this.removeSearchResults();
|
||
}, 250);
|
||
};
|
||
searchBox.appendChild(search);
|
||
element.parentElement.insertBefore(form, element);
|
||
}
|
||
removeSearchResults() {
|
||
var resultList = document.getElementById('tapi-search-autocomplete-list');
|
||
if (resultList) {
|
||
resultList.parentNode.removeChild(resultList);
|
||
}
|
||
this.currentSearchText = '';
|
||
}
|
||
doSearchKeyDown(ev) {
|
||
if (ev.key === 'ArrowUp') {
|
||
let items = document.getElementsByClassName('tapi-search-autocomplete-active');
|
||
if (items.length > 0) {
|
||
var prev = items[0].previousSibling;
|
||
}
|
||
if (!prev) {
|
||
items = document.getElementsByClassName('tapi-search-autocomplete-item');
|
||
if (items.length > 0) {
|
||
prev = items[items.length - 1];
|
||
}
|
||
}
|
||
if (prev) {
|
||
this.selectResult(prev);
|
||
prev.scrollIntoView(true);
|
||
}
|
||
}
|
||
else if (ev.key === 'ArrowDown') {
|
||
let items = document.getElementsByClassName('tapi-search-autocomplete-active');
|
||
if (items.length > 0) {
|
||
var next = items[0].nextSibling;
|
||
}
|
||
if (!next) {
|
||
items = document.getElementsByClassName('tapi-search-autocomplete-item');
|
||
if (items.length > 0) {
|
||
next = items[0];
|
||
}
|
||
}
|
||
if (next) {
|
||
this.selectResult(next);
|
||
next.scrollIntoView(false);
|
||
}
|
||
}
|
||
else {
|
||
this.doSearch();
|
||
}
|
||
}
|
||
selectResult(item) {
|
||
console.log('Select item', item);
|
||
var items = document.getElementsByClassName('tapi-search-autocomplete-active');
|
||
for (var i of items) {
|
||
i.classList.remove('tapi-search-autocomplete-active');
|
||
}
|
||
item.classList.add('tapi-search-autocomplete-active');
|
||
}
|
||
dial(number) {
|
||
console.log('TAPI Search dialing', number);
|
||
var searchInput = document.getElementById('dialpad-input');
|
||
searchInput.value = number;
|
||
searchInput.focus;
|
||
fireChangeEvents(searchInput);
|
||
var toaster = document.querySelector('toaster-container');
|
||
if (window.getComputedStyle(toaster, null).display == 'none') {
|
||
document.getElementById('menuDialer').click();
|
||
}
|
||
}
|
||
}
|
||
|
||
// EXTERNAL MODULE: ./node_modules/css-loader/dist/cjs.js!./src/status.css
|
||
var cjs_js_src_status = __webpack_require__("./node_modules/css-loader/dist/cjs.js!./src/status.css");
|
||
;// CONCATENATED MODULE: ./src/status.css
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
var status_options = {};
|
||
|
||
status_options.styleTagTransform = (styleTagTransform_default());
|
||
status_options.setAttributes = (setAttributesWithoutAttributes_default());
|
||
|
||
status_options.insert = insertBySelector_default().bind(null, "head");
|
||
|
||
status_options.domAPI = (styleDomAPI_default());
|
||
status_options.insertStyleElement = (insertStyleElement_default());
|
||
|
||
var status_update = injectStylesIntoStyleTag_default()(cjs_js_src_status/* default */.Z, status_options);
|
||
|
||
|
||
|
||
|
||
/* harmony default export */ const src_status = (cjs_js_src_status/* default */.Z && cjs_js_src_status/* default */.Z.locals ? cjs_js_src_status/* default */.Z.locals : undefined);
|
||
|
||
;// CONCATENATED MODULE: ./src/status.ts
|
||
var status_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||
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) : adopt(result.value).then(fulfilled, rejected); }
|
||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||
});
|
||
};
|
||
|
||
|
||
class Status {
|
||
constructor() {
|
||
this._enabled = false;
|
||
this._statusOn = 'menuAvailable';
|
||
this._statusOff = 'menuAway';
|
||
this._currentStatus = undefined;
|
||
}
|
||
showStatus(element) {
|
||
return status_awaiter(this, void 0, void 0, function* () {
|
||
this._user = yield GM.getValue('tapi-zc-user', '');
|
||
this._enabled = yield GM.getValue('tapi-zc-enabled', false);
|
||
this._statusOn = yield GM.getValue('tapi-zc-on', 'menuAvailable');
|
||
this._statusOff = yield GM.getValue('tapi-zc-off', 'menuAvailable');
|
||
console.log('tapi-zc-user', this._user, 'tapi-zc-enabled', this._enabled, 'tapi-zc-on', this._statusOn, 'tapi-zc-off', this._statusOff);
|
||
this.checkStatus();
|
||
waitForKeyElements("wc-account-menu > div > ul", (element) => { this.addZcStatusPopup(element); }, true);
|
||
});
|
||
}
|
||
checkStatus() {
|
||
return status_awaiter(this, void 0, void 0, function* () {
|
||
if (this._enabled) {
|
||
try {
|
||
var response = yield external_axios_default().get('http://cpatapi.cpsrvweb2016.cp-austria.at/availability/' + encodeURIComponent(this._user));
|
||
if (response.status == 200) {
|
||
var status = response.data;
|
||
if (this._currentStatus !== status.loggedIn) {
|
||
this._currentStatus = status.loggedIn;
|
||
console.log('New status, loggedIn', this._currentStatus);
|
||
document.getElementsByTagName("wcavatar")[0].click();
|
||
setTimeout(() => {
|
||
var statusId = this._currentStatus ? this._statusOn : this._statusOff;
|
||
document.getElementById(statusId).click();
|
||
}, 1000);
|
||
}
|
||
}
|
||
}
|
||
catch (error) {
|
||
console.log(error);
|
||
}
|
||
setTimeout(() => this.checkStatus(), 30000);
|
||
}
|
||
});
|
||
}
|
||
addZcStatusPopup(element) {
|
||
var divider = document.createElement('li');
|
||
divider.classList.add('divider');
|
||
divider.classList.add('dropdown-divider');
|
||
element.appendChild(divider);
|
||
var menu = document.createElement('li');
|
||
element.appendChild(menu);
|
||
var link = document.createElement('a');
|
||
link.id = 'tapi-zc-button';
|
||
link.innerText = 'ZeitConsens';
|
||
link.classList.add('dropdown-item');
|
||
link.classList.add('d-flex');
|
||
link.onclick = () => {
|
||
document.getElementById('zc-modal').classList.toggle('show');
|
||
};
|
||
menu.appendChild(link);
|
||
var html = '<div role="document" class="modal-dialog">' +
|
||
' <div class="modal-content">' +
|
||
' <div class="modal-header">' +
|
||
' <h4 class="modal-title float-left">ZeitConsens Status</h4><button id="zc-btnClose" type="button" aria-label="Close" class="close float-right"><span aria-hidden="true">×</span></button>' +
|
||
' </div>' +
|
||
' <div class="modal-body">' +
|
||
' <div class="form-group">' +
|
||
' <label for="tapi-zc-user">Username</label>' +
|
||
' <input type="text" class="form-control" name="tapi-zc-user" id="tapi-zc-user">' +
|
||
' </div>' +
|
||
' <div class="form-group">' +
|
||
' <label for="tapi-zc-on">Signed in</label>' +
|
||
' <select id="tapi-zc-on" class="form-control">' +
|
||
' <option value="menuAvailable">Available</option>' +
|
||
' <option value="menuOutofoffice">Do Not Disturb</option>' +
|
||
' <option value="menuCustom1">Verfügbar DW</option>' +
|
||
' </select>' +
|
||
' </div>' +
|
||
' <div class="form-group">' +
|
||
' <label for="tapi-zc-off">Signed out</label>' +
|
||
' <select id="tapi-zc-off" class="form-control">' +
|
||
' <option value="menuAway">Away</option>' +
|
||
' <option value="menuOutofoffice">Do Not Disturb</option>' +
|
||
' </select>' +
|
||
' </div>' +
|
||
' <div class="checkbox">' +
|
||
' <label class="i-checks" for="tapi-zc-enabled">' +
|
||
' <input type="checkbox" id="tapi-zc-enabled">' +
|
||
' <i></i><span>Enabled</span>' +
|
||
' </label>';
|
||
' </div>';
|
||
' </div>' +
|
||
' <div class="modal-footer">' +
|
||
' <button id="zc-btnOk" type="button" class="btn btn-primary">OK </button>' +
|
||
' <button id="zc-btnCancel" type="button" class="btn btn-light">Cancel </button>' +
|
||
' </div>' +
|
||
' </div>' +
|
||
'</div>';
|
||
var modal = document.createElement('modal-container');
|
||
modal.id = 'zc-modal';
|
||
modal.classList.add('modal');
|
||
modal.classList.add('fade');
|
||
modal.innerHTML = html;
|
||
var body = document.getElementsByTagName('body')[0].appendChild(modal);
|
||
var btnClose = document.getElementById('zc-btnClose');
|
||
btnClose.onclick = () => {
|
||
document.getElementById('zc-modal').classList.toggle('show');
|
||
};
|
||
var zcUser = document.getElementById('tapi-zc-user');
|
||
zcUser.value = this._user;
|
||
zcUser.onchange = () => {
|
||
this._user = zcUser.value;
|
||
GM.setValue('tapi-zc-user', this._user);
|
||
console.log('tapi-zc-user', this._user);
|
||
this._currentStatus = undefined;
|
||
};
|
||
var zcEnabled = document.getElementById('tapi-zc-enabled');
|
||
zcEnabled.checked = this._enabled;
|
||
zcEnabled.onchange = () => {
|
||
this._enabled = zcEnabled.checked;
|
||
GM.setValue('tapi-zc-enabled', this._enabled);
|
||
console.log('tapi-zc-enabled', this._enabled);
|
||
this._currentStatus = undefined;
|
||
this.checkStatus();
|
||
};
|
||
var zcOn = document.getElementById('tapi-zc-on');
|
||
zcOn.value = this._statusOn;
|
||
zcOn.onchange = () => {
|
||
this._statusOn = zcOn.value;
|
||
GM.setValue('tapi-zc-on', this._statusOn);
|
||
console.log('tapi-zc-on', this._statusOn);
|
||
this._currentStatus = undefined;
|
||
};
|
||
var zcOff = document.getElementById('tapi-zc-off');
|
||
zcOff.value = this._statusOff;
|
||
zcOff.onchange = () => {
|
||
this._statusOff = zcOff.value;
|
||
GM.setValue('tapi-zc-off', this._statusOff);
|
||
console.log('tapi-zc-off', this._statusOff);
|
||
this._currentStatus = undefined;
|
||
};
|
||
}
|
||
}
|
||
|
||
;// CONCATENATED MODULE: ./src/index.js
|
||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||
|
||
|
||
|
||
|
||
|
||
console.log('script start');
|
||
const src_search_0 = new Search();
|
||
// eslint-disable-next-line no-undef
|
||
waitForKeyElements('ongoing-call-button', element => {
|
||
src_search_0.createSearchWindow(element);
|
||
}, false);
|
||
const callNotification = new CallNotification();
|
||
// eslint-disable-next-line no-undef
|
||
waitForKeyElements('call-view', element => {
|
||
callNotification.showCallNotification(element);
|
||
}, false);
|
||
const callHistory = new CallHistory();
|
||
// eslint-disable-next-line no-undef
|
||
waitForKeyElements('.call-history-list call', element => {
|
||
callHistory.showCallHistory(element);
|
||
}, false);
|
||
const src_status_0 = new Status();
|
||
// eslint-disable-next-line no-undef
|
||
waitForKeyElements('wc-account-menu', element => {
|
||
src_status_0.showStatus(element);
|
||
}, false);
|
||
})();
|
||
|
||
/******/ })()
|
||
; |