2020-10-19 18:04:01 +02:00
|
|
|
|
// ==UserScript==
|
2020-11-04 22:59:32 +01:00
|
|
|
|
// @name 3CX TAPI
|
|
|
|
|
// @namespace http://cp-solutions.at
|
2024-10-14 11:50:06 +02:00
|
|
|
|
// @version 9.2.1
|
2020-11-04 22:59:32 +01:00
|
|
|
|
// @author Daniel Triendl <d.triendl@cp-solutions.at>
|
2021-08-27 18:14:41 +02:00
|
|
|
|
// @copyright Copyright 2021 CP Solutions GmbH
|
2021-08-30 08:03:49 +02:00
|
|
|
|
// @source https://source.cp-austria.at/git/CPATRD/3cx_tapi.git
|
2021-08-27 18:14:41 +02:00
|
|
|
|
// @downloadURL https://source.cp-austria.at/git/CPATRD/3cx_tapi/raw/branch/master/3CX_TAPI.user.js
|
2024-10-14 11:01:38 +02:00
|
|
|
|
// @match https://192.168.0.154:5001/*
|
|
|
|
|
// @match https://cpsolution.my3cx.at:5001/*
|
2020-11-04 22:59:32 +01:00
|
|
|
|
// @require https://cdn.jsdelivr.net/gh/CoeJoder/waitForKeyElements.js@v1.2/waitForKeyElements.js
|
2021-08-27 18:14:41 +02:00
|
|
|
|
// @grant GM.xmlHttpRequest
|
2020-11-04 22:59:32 +01:00
|
|
|
|
// @grant GM.notification
|
2021-08-27 18:14:41 +02:00
|
|
|
|
// @grant GM.getValue
|
|
|
|
|
// @grant GM.setValue
|
2020-11-04 22:59:32 +01:00
|
|
|
|
// @connect cpatapi.cpsrvweb2016.cp-austria.at
|
|
|
|
|
// @run-at document-end
|
2020-10-19 18:04:01 +02:00
|
|
|
|
// ==/UserScript==
|
|
|
|
|
|
2023-06-27 17:25:14 +02:00
|
|
|
|
/******/ (() => { // webpackBootstrap
|
2021-08-27 18:14:41 +02:00
|
|
|
|
/******/ var __webpack_modules__ = ({
|
|
|
|
|
|
2023-06-27 17:25:14 +02:00
|
|
|
|
/***/ "./node_modules/css-loader/dist/runtime/api.js":
|
|
|
|
|
/***/ ((module) => {
|
2020-10-20 17:47:54 +02:00
|
|
|
|
|
2020-11-04 22:59:32 +01:00
|
|
|
|
"use strict";
|
|
|
|
|
|
2021-08-27 18:14:41 +02:00
|
|
|
|
|
2023-06-27 17:25:14 +02:00
|
|
|
|
/*
|
|
|
|
|
MIT License http://www.opensource.org/licenses/mit-license.php
|
|
|
|
|
Author Tobias Koppers @sokra
|
|
|
|
|
*/
|
|
|
|
|
module.exports = function (cssWithMappingToString) {
|
|
|
|
|
var list = [];
|
2021-08-27 18:14:41 +02:00
|
|
|
|
|
2023-06-27 17:25:14 +02:00
|
|
|
|
// 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("");
|
|
|
|
|
};
|
2021-08-27 18:14:41 +02:00
|
|
|
|
|
2023-06-27 17:25:14 +02:00
|
|
|
|
// 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;
|
2021-08-27 18:14:41 +02:00
|
|
|
|
}
|
2023-06-27 17:25:14 +02:00
|
|
|
|
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);
|
2020-11-04 22:59:32 +01:00
|
|
|
|
}
|
2023-06-27 17:25:14 +02:00
|
|
|
|
};
|
|
|
|
|
return list;
|
|
|
|
|
};
|
2021-08-27 18:14:41 +02:00
|
|
|
|
|
2023-06-27 17:25:14 +02:00
|
|
|
|
/***/ }),
|
2021-08-27 18:14:41 +02:00
|
|
|
|
|
2023-06-27 17:25:14 +02:00
|
|
|
|
/***/ "./node_modules/css-loader/dist/runtime/noSourceMaps.js":
|
|
|
|
|
/***/ ((module) => {
|
2020-11-04 22:59:32 +01:00
|
|
|
|
|
2023-06-27 17:25:14 +02:00
|
|
|
|
"use strict";
|
2020-11-04 22:59:32 +01:00
|
|
|
|
|
|
|
|
|
|
2023-06-27 17:25:14 +02:00
|
|
|
|
module.exports = function (i) {
|
|
|
|
|
return i[1];
|
|
|
|
|
};
|
2020-11-04 22:59:32 +01:00
|
|
|
|
|
2023-06-27 17:25:14 +02:00
|
|
|
|
/***/ }),
|
2020-11-04 22:59:32 +01:00
|
|
|
|
|
2023-06-27 17:25:14 +02:00
|
|
|
|
/***/ "./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]);
|
2021-08-27 18:14:41 +02:00
|
|
|
|
} else {
|
2023-06-27 17:25:14 +02:00
|
|
|
|
var a = e.name;
|
|
|
|
|
D[a] = e, i = a;
|
2021-08-27 18:14:41 +02:00
|
|
|
|
}
|
2023-06-27 17:25:14 +02:00
|
|
|
|
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;
|
|
|
|
|
});
|
2021-08-27 18:14:41 +02:00
|
|
|
|
|
2023-06-27 17:25:14 +02:00
|
|
|
|
/***/ }),
|
2021-08-27 18:14:41 +02:00
|
|
|
|
|
2023-06-27 17:25:14 +02:00
|
|
|
|
/***/ "./node_modules/dayjs/plugin/quarterOfYear.js":
|
|
|
|
|
/***/ (function(module) {
|
2021-08-27 18:14:41 +02:00
|
|
|
|
|
2023-06-27 17:25:14 +02:00
|
|
|
|
!function (t, n) {
|
|
|
|
|
true ? module.exports = n() : 0;
|
|
|
|
|
}(this, function () {
|
|
|
|
|
"use strict";
|
2020-11-04 22:59:32 +01:00
|
|
|
|
|
2023-06-27 17:25:14 +02:00
|
|
|
|
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);
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
});
|
2020-11-04 22:59:32 +01:00
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
2023-06-27 17:25:14 +02:00
|
|
|
|
/***/ "./node_modules/css-loader/dist/cjs.js!./src/search.css":
|
|
|
|
|
/***/ ((module, __webpack_exports__, __webpack_require__) => {
|
2020-11-04 22:59:32 +01:00
|
|
|
|
|
|
|
|
|
"use strict";
|
2023-06-27 17:25:14 +02:00
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
2024-10-14 11:01:38 +02:00
|
|
|
|
/* harmony export */ A: () => (__WEBPACK_DEFAULT_EXPORT__)
|
2023-06-27 17:25:14 +02:00
|
|
|
|
/* 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
|
2020-11-04 22:59:32 +01:00
|
|
|
|
|
2021-08-27 18:14:41 +02:00
|
|
|
|
|
2023-06-27 17:25:14 +02:00
|
|
|
|
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;
|
|
|
|
|
}
|
2023-06-27 17:34:29 +02:00
|
|
|
|
.tapi-search-autocomplete-items div p {
|
|
|
|
|
margin: 0;
|
|
|
|
|
}
|
2023-06-27 17:25:14 +02:00
|
|
|
|
.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___);
|
2021-08-27 18:14:41 +02:00
|
|
|
|
|
|
|
|
|
|
2023-06-27 17:25:14 +02:00
|
|
|
|
/***/ }),
|
2021-08-27 18:14:41 +02:00
|
|
|
|
|
2023-06-27 17:25:14 +02:00
|
|
|
|
/***/ "./node_modules/css-loader/dist/cjs.js!./src/status.css":
|
|
|
|
|
/***/ ((module, __webpack_exports__, __webpack_require__) => {
|
2021-08-27 18:14:41 +02:00
|
|
|
|
|
2023-06-27 17:25:14 +02:00
|
|
|
|
"use strict";
|
|
|
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
2024-10-14 11:01:38 +02:00
|
|
|
|
/* harmony export */ A: () => (__WEBPACK_DEFAULT_EXPORT__)
|
2023-06-27 17:25:14 +02:00
|
|
|
|
/* 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
|
2020-11-04 22:59:32 +01:00
|
|
|
|
|
2021-08-27 18:14:41 +02:00
|
|
|
|
|
2023-06-27 17:25:14 +02:00
|
|
|
|
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;
|
|
|
|
|
}
|
2021-08-27 18:14:41 +02:00
|
|
|
|
|
2023-06-27 17:25:14 +02:00
|
|
|
|
.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;
|
|
|
|
|
}
|
2021-08-27 18:14:41 +02:00
|
|
|
|
|
2023-06-27 17:25:14 +02:00
|
|
|
|
.show {
|
|
|
|
|
display: block;
|
2021-08-27 18:14:41 +02:00
|
|
|
|
}
|
2023-06-27 17:25:14 +02:00
|
|
|
|
`, ""]);
|
|
|
|
|
// Exports
|
|
|
|
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (___CSS_LOADER_EXPORT___);
|
2021-08-27 18:14:41 +02:00
|
|
|
|
|
2020-11-04 22:59:32 +01:00
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
2023-06-27 17:25:14 +02:00
|
|
|
|
/***/ "./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":
|
|
|
|
|
/***/ ((module) => {
|
2020-11-04 22:59:32 +01:00
|
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
|
|
|
2023-06-27 17:25:14 +02:00
|
|
|
|
var stylesInDOM = [];
|
|
|
|
|
function getIndexByIdentifier(identifier) {
|
|
|
|
|
var result = -1;
|
|
|
|
|
for (var i = 0; i < stylesInDOM.length; i++) {
|
|
|
|
|
if (stylesInDOM[i].identifier === identifier) {
|
|
|
|
|
result = i;
|
|
|
|
|
break;
|
|
|
|
|
}
|
2021-08-27 18:14:41 +02:00
|
|
|
|
}
|
2023-06-27 17:25:14 +02:00
|
|
|
|
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);
|
2021-08-27 18:14:41 +02:00
|
|
|
|
}
|
2023-06-27 17:25:14 +02:00
|
|
|
|
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;
|
|
|
|
|
};
|
|
|
|
|
};
|
2020-11-04 22:59:32 +01:00
|
|
|
|
|
2023-06-27 17:25:14 +02:00
|
|
|
|
/***/ }),
|
2020-11-04 22:59:32 +01:00
|
|
|
|
|
2023-06-27 17:25:14 +02:00
|
|
|
|
/***/ "./node_modules/style-loader/dist/runtime/insertBySelector.js":
|
|
|
|
|
/***/ ((module) => {
|
2020-11-04 22:59:32 +01:00
|
|
|
|
|
2023-06-27 17:25:14 +02:00
|
|
|
|
"use strict";
|
2020-11-04 22:59:32 +01:00
|
|
|
|
|
2021-08-27 18:14:41 +02:00
|
|
|
|
|
2023-06-27 17:25:14 +02:00
|
|
|
|
var memo = {};
|
2021-08-27 18:14:41 +02:00
|
|
|
|
|
2023-06-27 17:25:14 +02:00
|
|
|
|
/* istanbul ignore next */
|
|
|
|
|
function getTarget(target) {
|
|
|
|
|
if (typeof memo[target] === "undefined") {
|
|
|
|
|
var styleTarget = document.querySelector(target);
|
2021-08-27 18:14:41 +02:00
|
|
|
|
|
2023-06-27 17:25:14 +02:00
|
|
|
|
// 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;
|
2021-08-27 18:14:41 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
2023-06-27 17:25:14 +02:00
|
|
|
|
memo[target] = styleTarget;
|
2021-08-27 18:14:41 +02:00
|
|
|
|
}
|
2023-06-27 17:25:14 +02:00
|
|
|
|
return memo[target];
|
2020-11-04 22:59:32 +01:00
|
|
|
|
}
|
|
|
|
|
|
2023-06-27 17:25:14 +02:00
|
|
|
|
/* 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.");
|
2021-08-27 18:14:41 +02:00
|
|
|
|
}
|
2023-06-27 17:25:14 +02:00
|
|
|
|
target.appendChild(style);
|
|
|
|
|
}
|
|
|
|
|
module.exports = insertBySelector;
|
2020-11-04 22:59:32 +01:00
|
|
|
|
|
2023-06-27 17:25:14 +02:00
|
|
|
|
/***/ }),
|
2020-11-04 22:59:32 +01:00
|
|
|
|
|
2023-06-27 17:25:14 +02:00
|
|
|
|
/***/ "./node_modules/style-loader/dist/runtime/insertStyleElement.js":
|
|
|
|
|
/***/ ((module) => {
|
2020-11-04 22:59:32 +01:00
|
|
|
|
|
2023-06-27 17:25:14 +02:00
|
|
|
|
"use strict";
|
2021-08-27 18:14:41 +02:00
|
|
|
|
|
|
|
|
|
|
2023-06-27 17:25:14 +02:00
|
|
|
|
/* istanbul ignore next */
|
|
|
|
|
function insertStyleElement(options) {
|
|
|
|
|
var element = document.createElement("style");
|
|
|
|
|
options.setAttributes(element, options.attributes);
|
|
|
|
|
options.insert(element, options.options);
|
|
|
|
|
return element;
|
2020-11-04 22:59:32 +01:00
|
|
|
|
}
|
2023-06-27 17:25:14 +02:00
|
|
|
|
module.exports = insertStyleElement;
|
2020-11-04 22:59:32 +01:00
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
2023-06-27 17:25:14 +02:00
|
|
|
|
/***/ "./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js":
|
|
|
|
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
2020-11-04 22:59:32 +01:00
|
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
|
|
|
2023-06-27 17:25:14 +02:00
|
|
|
|
/* istanbul ignore next */
|
|
|
|
|
function setAttributesWithoutAttributes(styleElement) {
|
|
|
|
|
var nonce = true ? __webpack_require__.nc : 0;
|
|
|
|
|
if (nonce) {
|
|
|
|
|
styleElement.setAttribute("nonce", nonce);
|
2021-08-27 18:14:41 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
2023-06-27 17:25:14 +02:00
|
|
|
|
module.exports = setAttributesWithoutAttributes;
|
2020-11-04 22:59:32 +01:00
|
|
|
|
|
2023-06-27 17:25:14 +02:00
|
|
|
|
/***/ }),
|
2020-11-04 22:59:32 +01:00
|
|
|
|
|
2023-06-27 17:25:14 +02:00
|
|
|
|
/***/ "./node_modules/style-loader/dist/runtime/styleDomAPI.js":
|
|
|
|
|
/***/ ((module) => {
|
2021-08-27 18:14:41 +02:00
|
|
|
|
|
2023-06-27 17:25:14 +02:00
|
|
|
|
"use strict";
|
2021-08-27 18:14:41 +02:00
|
|
|
|
|
|
|
|
|
|
2023-06-27 17:25:14 +02:00
|
|
|
|
/* istanbul ignore next */
|
|
|
|
|
function apply(styleElement, options, obj) {
|
|
|
|
|
var css = "";
|
|
|
|
|
if (obj.supports) {
|
|
|
|
|
css += "@supports (".concat(obj.supports, ") {");
|
2021-08-27 18:14:41 +02:00
|
|
|
|
}
|
2023-06-27 17:25:14 +02:00
|
|
|
|
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)))), " */");
|
2022-10-03 09:52:08 +02:00
|
|
|
|
}
|
|
|
|
|
|
2023-06-27 17:25:14 +02:00
|
|
|
|
// For old IE
|
|
|
|
|
/* istanbul ignore if */
|
|
|
|
|
options.styleTagTransform(css, styleElement, options.options);
|
2022-10-03 09:52:08 +02:00
|
|
|
|
}
|
2023-06-27 17:25:14 +02:00
|
|
|
|
function removeStyleElement(styleElement) {
|
|
|
|
|
// istanbul ignore if
|
|
|
|
|
if (styleElement.parentNode === null) {
|
|
|
|
|
return false;
|
2022-10-03 09:52:08 +02:00
|
|
|
|
}
|
2023-06-27 17:25:14 +02:00
|
|
|
|
styleElement.parentNode.removeChild(styleElement);
|
2022-10-03 09:52:08 +02:00
|
|
|
|
}
|
|
|
|
|
|
2023-06-27 17:25:14 +02:00
|
|
|
|
/* istanbul ignore next */
|
|
|
|
|
function domAPI(options) {
|
|
|
|
|
if (typeof document === "undefined") {
|
|
|
|
|
return {
|
|
|
|
|
update: function update() {},
|
|
|
|
|
remove: function remove() {}
|
|
|
|
|
};
|
2022-10-03 09:52:08 +02:00
|
|
|
|
}
|
2023-06-27 17:25:14 +02:00
|
|
|
|
var styleElement = options.insertStyleElement(options);
|
|
|
|
|
return {
|
|
|
|
|
update: function update(obj) {
|
|
|
|
|
apply(styleElement, options, obj);
|
|
|
|
|
},
|
|
|
|
|
remove: function remove() {
|
|
|
|
|
removeStyleElement(styleElement);
|
|
|
|
|
}
|
|
|
|
|
};
|
2022-10-03 09:52:08 +02:00
|
|
|
|
}
|
2023-06-27 17:25:14 +02:00
|
|
|
|
module.exports = domAPI;
|
2022-10-03 09:52:08 +02:00
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
2023-06-27 17:25:14 +02:00
|
|
|
|
/***/ "./node_modules/style-loader/dist/runtime/styleTagTransform.js":
|
|
|
|
|
/***/ ((module) => {
|
2020-11-04 22:59:32 +01:00
|
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
|
|
2021-08-27 18:14:41 +02:00
|
|
|
|
|
2023-06-27 17:25:14 +02:00
|
|
|
|
/* 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));
|
2022-10-03 09:52:08 +02:00
|
|
|
|
}
|
2021-08-27 18:14:41 +02:00
|
|
|
|
}
|
2023-06-27 17:25:14 +02:00
|
|
|
|
module.exports = styleTagTransform;
|
2021-08-27 18:14:41 +02:00
|
|
|
|
|
2023-06-27 17:25:14 +02:00
|
|
|
|
/***/ })
|
2022-10-03 09:52:08 +02:00
|
|
|
|
|
2023-06-27 17:25:14 +02:00
|
|
|
|
/******/ });
|
|
|
|
|
/************************************************************************/
|
|
|
|
|
/******/ // 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";
|
2022-10-03 09:52:08 +02:00
|
|
|
|
|
2024-10-14 11:01:38 +02:00
|
|
|
|
// EXTERNAL MODULE: ./node_modules/dayjs/plugin/quarterOfYear.js
|
|
|
|
|
var quarterOfYear = __webpack_require__("./node_modules/dayjs/plugin/quarterOfYear.js");
|
2023-06-27 17:25:14 +02:00
|
|
|
|
// EXTERNAL MODULE: ./node_modules/dayjs/dayjs.min.js
|
|
|
|
|
var dayjs_min = __webpack_require__("./node_modules/dayjs/dayjs.min.js");
|
2024-10-14 11:01:38 +02:00
|
|
|
|
;// ./node_modules/chrono-node/dist/esm/types.js
|
|
|
|
|
var types_Meridiem;
|
|
|
|
|
(function (Meridiem) {
|
|
|
|
|
Meridiem[Meridiem["AM"] = 0] = "AM";
|
|
|
|
|
Meridiem[Meridiem["PM"] = 1] = "PM";
|
|
|
|
|
})(types_Meridiem || (types_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 = {}));
|
|
|
|
|
;// ./node_modules/chrono-node/dist/esm/utils/dayjs.js
|
2021-08-27 18:14:41 +02:00
|
|
|
|
|
2024-10-14 11:01:38 +02:00
|
|
|
|
function assignTheNextDay(component, targetDayJs) {
|
|
|
|
|
targetDayJs = targetDayJs.add(1, "day");
|
|
|
|
|
dayjs_assignSimilarDate(component, targetDayJs);
|
|
|
|
|
implySimilarTime(component, targetDayJs);
|
2021-08-27 18:14:41 +02:00
|
|
|
|
}
|
2024-10-14 11:01:38 +02:00
|
|
|
|
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", types_Meridiem.AM);
|
|
|
|
|
} else {
|
|
|
|
|
component.assign("meridiem", types_Meridiem.PM);
|
2022-10-03 09:52:08 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
2024-10-14 11:01:38 +02:00
|
|
|
|
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());
|
|
|
|
|
}
|
|
|
|
|
;// ./node_modules/chrono-node/dist/esm/timezone.js
|
2020-11-04 22:59:32 +01:00
|
|
|
|
|
|
|
|
|
|
2023-06-27 17:25:14 +02:00
|
|
|
|
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++;
|
|
|
|
|
}
|
2024-10-14 11:01:38 +02:00
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
;// ./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._tags = new Set();
|
|
|
|
|
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") && !this.isCertain("year");
|
|
|
|
|
}
|
|
|
|
|
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 {
|
|
|
|
|
tags: ${JSON.stringify(Array.from(this._tags).sort())},
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
addTag(tag) {
|
|
|
|
|
this._tags.add(tag);
|
|
|
|
|
return this;
|
|
|
|
|
}
|
|
|
|
|
addTags(tags) {
|
|
|
|
|
for (const tag of tags) {
|
|
|
|
|
this._tags.add(tag);
|
|
|
|
|
}
|
|
|
|
|
return this;
|
|
|
|
|
}
|
|
|
|
|
tags() {
|
|
|
|
|
return new Set(this._tags);
|
|
|
|
|
}
|
|
|
|
|
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.assign("day", date.date());
|
|
|
|
|
components.assign("month", date.month() + 1);
|
|
|
|
|
components.assign("year", date.year());
|
|
|
|
|
components.imply("weekday", date.day());
|
|
|
|
|
} else {
|
|
|
|
|
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();
|
|
|
|
|
}
|
|
|
|
|
tags() {
|
|
|
|
|
const combinedTags = new Set(this.start.tags());
|
|
|
|
|
if (this.end) {
|
|
|
|
|
for (const tag of this.end.tags()) {
|
|
|
|
|
combinedTags.add(tag);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return combinedTags;
|
|
|
|
|
}
|
|
|
|
|
toString() {
|
|
|
|
|
const tags = Array.from(this.tags()).sort();
|
|
|
|
|
return `[ParsingResult {index: ${this.index}, text: '${this.text}', tags: ${JSON.stringify(tags)} ...}]`;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
;// ./node_modules/chrono-node/dist/esm/utils/pattern.js
|
|
|
|
|
function repeatedTimeunitPattern(prefix, singleTimeunitPattern, connectorPattern = "\\s{0,5},?\\s{0,5}") {
|
|
|
|
|
const singleTimeunitPatternNoCapture = singleTimeunitPattern.replace(/\((?!\?)/g, "(?:");
|
|
|
|
|
return `${prefix}${singleTimeunitPatternNoCapture}(?:${connectorPattern}${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})`;
|
|
|
|
|
}
|
|
|
|
|
;// ./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();
|
|
|
|
|
}
|
|
|
|
|
;// ./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);
|
2023-06-27 17:25:14 +02:00
|
|
|
|
}
|
2024-10-14 11:01:38 +02:00
|
|
|
|
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];
|
2023-06-27 17:25:14 +02:00
|
|
|
|
}
|
2024-10-14 11:01:38 +02:00
|
|
|
|
num = num.replace(/(?:st|nd|rd|th)$/i, "");
|
|
|
|
|
return parseInt(num);
|
2023-06-27 17:25:14 +02:00
|
|
|
|
}
|
2024-10-14 11:01:38 +02:00
|
|
|
|
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]|2[0-5])`;
|
|
|
|
|
function parseYear(match) {
|
|
|
|
|
if (/BE/i.test(match)) {
|
|
|
|
|
match = match.replace(/BE/i, "");
|
|
|
|
|
return parseInt(match) - 543;
|
2021-08-27 18:14:41 +02:00
|
|
|
|
}
|
2024-10-14 11:01:38 +02:00
|
|
|
|
if (/BCE?/i.test(match)) {
|
|
|
|
|
match = match.replace(/BCE?/i, "");
|
|
|
|
|
return -parseInt(match);
|
2023-06-27 17:25:14 +02:00
|
|
|
|
}
|
2024-10-14 11:01:38 +02:00
|
|
|
|
if (/(AD|CE)/i.test(match)) {
|
|
|
|
|
match = match.replace(/(AD|CE)/i, "");
|
|
|
|
|
return parseInt(match);
|
2023-06-27 17:25:14 +02:00
|
|
|
|
}
|
2024-10-14 11:01:38 +02:00
|
|
|
|
const rawYearNumber = parseInt(match);
|
|
|
|
|
return findMostLikelyADYear(rawYearNumber);
|
2023-06-27 17:25:14 +02:00
|
|
|
|
}
|
2024-10-14 11:01:38 +02:00
|
|
|
|
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_UNIT_CONNECTOR_PATTERN = `\\s{0,5},?(?:\\s*and)?\\s{0,5}`;
|
|
|
|
|
const TIME_UNITS_PATTERN = repeatedTimeunitPattern(`(?:(?:about|around)\\s{0,3})?`, SINGLE_TIME_UNIT_PATTERN, TIME_UNIT_CONNECTOR_PATTERN);
|
|
|
|
|
const TIME_UNITS_NO_ABBR_PATTERN = repeatedTimeunitPattern(`(?:(?:about|around)\\s{0,3})?`, SINGLE_TIME_UNIT_NO_ABBR_PATTERN, TIME_UNIT_CONNECTOR_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);
|
2023-06-27 17:25:14 +02:00
|
|
|
|
}
|
2024-10-14 11:01:38 +02:00
|
|
|
|
if (Object.keys(fragments).length == 0) {
|
2023-06-27 17:25:14 +02:00
|
|
|
|
return null;
|
|
|
|
|
}
|
2024-10-14 11:01:38 +02:00
|
|
|
|
return fragments;
|
2023-06-27 17:25:14 +02:00
|
|
|
|
}
|
2024-10-14 11:01:38 +02:00
|
|
|
|
function collectDateTimeFragment(fragments, match) {
|
|
|
|
|
if (match[0].match(/^[a-zA-Z]+$/)) {
|
|
|
|
|
return;
|
2023-06-27 17:25:14 +02:00
|
|
|
|
}
|
2024-10-14 11:01:38 +02:00
|
|
|
|
const num = parseNumberPattern(match[1]);
|
|
|
|
|
const unit = TIME_UNIT_DICTIONARY[match[2].toLowerCase()];
|
|
|
|
|
fragments[unit] = num;
|
2023-06-27 17:25:14 +02:00
|
|
|
|
}
|
2024-10-14 11:01:38 +02:00
|
|
|
|
;// ./node_modules/chrono-node/dist/esm/common/parsers/AbstractParserWithWordBoundary.js
|
2023-06-27 17:25:14 +02:00
|
|
|
|
class AbstractParserWithWordBoundaryChecking {
|
|
|
|
|
constructor() {
|
|
|
|
|
this.cachedInnerPattern = null;
|
|
|
|
|
this.cachedPattern = null;
|
|
|
|
|
}
|
2024-10-14 11:01:38 +02:00
|
|
|
|
innerPatternHasChange(context, currentInnerPattern) {
|
|
|
|
|
return this.innerPattern(context) !== currentInnerPattern;
|
|
|
|
|
}
|
2023-06-27 17:25:14 +02:00
|
|
|
|
patternLeftBoundary() {
|
|
|
|
|
return `(\\W|^)`;
|
2022-10-03 09:52:08 +02:00
|
|
|
|
}
|
2021-08-27 18:14:41 +02:00
|
|
|
|
pattern(context) {
|
2024-10-14 11:01:38 +02:00
|
|
|
|
if (this.cachedInnerPattern) {
|
|
|
|
|
if (!this.innerPatternHasChange(context, this.cachedInnerPattern)) {
|
|
|
|
|
return this.cachedPattern;
|
|
|
|
|
}
|
2020-11-04 22:59:32 +01:00
|
|
|
|
}
|
2024-10-14 11:01:38 +02:00
|
|
|
|
this.cachedInnerPattern = this.innerPattern(context);
|
|
|
|
|
this.cachedPattern = new RegExp(`${this.patternLeftBoundary()}${this.cachedInnerPattern.source}`, this.cachedInnerPattern.flags);
|
2021-08-27 18:14:41 +02:00
|
|
|
|
return this.cachedPattern;
|
|
|
|
|
}
|
|
|
|
|
extract(context, match) {
|
2023-06-27 17:25:14 +02:00
|
|
|
|
const header = match[1] ?? "";
|
2021-08-27 18:14:41 +02:00
|
|
|
|
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);
|
|
|
|
|
}
|
2020-11-04 22:59:32 +01:00
|
|
|
|
}
|
2024-10-14 11:01:38 +02:00
|
|
|
|
;// ./node_modules/chrono-node/dist/esm/locales/en/parsers/ENTimeUnitWithinFormatParser.js
|
2020-11-04 22:59:32 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-10-14 11:01:38 +02:00
|
|
|
|
const PATTERN_WITH_OPTIONAL_PREFIX = new RegExp(`(?:(?:within|in|for)\\s*)?` + `(?:(?:about|around|roughly|approximately|just)\\s*(?:~\\s*)?)?(${TIME_UNITS_PATTERN})(?=\\W|$)`, "i");
|
2023-06-27 17:25:14 +02:00
|
|
|
|
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;
|
|
|
|
|
}
|
2024-10-14 11:01:38 +02:00
|
|
|
|
return context.option.forwardDate ? PATTERN_WITH_OPTIONAL_PREFIX : PATTERN_WITH_PREFIX;
|
2023-06-27 17:25:14 +02:00
|
|
|
|
}
|
|
|
|
|
innerExtract(context, match) {
|
2024-10-14 11:01:38 +02:00
|
|
|
|
if (match[0].match(/^for\s*the\s*\w+/)) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
2023-06-27 17:25:14 +02:00
|
|
|
|
const timeUnits = parseTimeUnits(match[1]);
|
2024-10-14 11:01:38 +02:00
|
|
|
|
if (!timeUnits) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
2023-06-27 17:25:14 +02:00
|
|
|
|
return results_ParsingComponents.createRelativeFromReference(context.reference, timeUnits);
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-10-14 11:01:38 +02:00
|
|
|
|
;// ./node_modules/chrono-node/dist/esm/locales/en/parsers/ENMonthNameLittleEndianParser.js
|
2020-11-04 22:59:32 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-08-27 18:14:41 +02:00
|
|
|
|
|
2020-11-04 22:59:32 +01:00
|
|
|
|
|
2021-08-27 18:14:41 +02:00
|
|
|
|
|
2024-10-14 11:01:38 +02:00
|
|
|
|
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}(?!\\w))` + ")?" + "(?=\\W|$)", "i");
|
2023-06-27 17:25:14 +02:00
|
|
|
|
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;
|
2021-08-27 18:14:41 +02:00
|
|
|
|
}
|
2023-06-27 17:25:14 +02:00
|
|
|
|
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;
|
2022-10-03 09:52:08 +02:00
|
|
|
|
}
|
2023-06-27 17:25:14 +02:00
|
|
|
|
}
|
2024-10-14 11:01:38 +02:00
|
|
|
|
;// ./node_modules/chrono-node/dist/esm/locales/en/parsers/ENMonthNameMiddleEndianParser.js
|
2022-10-03 09:52:08 +02:00
|
|
|
|
|
|
|
|
|
|
2020-11-04 22:59:32 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-08-27 18:14:41 +02:00
|
|
|
|
|
2024-10-14 11:01:38 +02:00
|
|
|
|
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*|\\s+)` + `(${YEAR_PATTERN})` + ")?" + "(?=\\W|$)(?!\\:\\d)", "i");
|
2023-06-27 17:25:14 +02:00
|
|
|
|
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 {
|
2024-10-14 11:01:38 +02:00
|
|
|
|
constructor(shouldSkipYearLikeDate) {
|
|
|
|
|
super();
|
|
|
|
|
this.shouldSkipYearLikeDate = shouldSkipYearLikeDate;
|
|
|
|
|
}
|
2023-06-27 17:25:14 +02:00
|
|
|
|
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;
|
|
|
|
|
}
|
2024-10-14 11:01:38 +02:00
|
|
|
|
if (this.shouldSkipYearLikeDate) {
|
|
|
|
|
if (!match[ENMonthNameMiddleEndianParser_DATE_TO_GROUP] && !match[ENMonthNameMiddleEndianParser_YEAR_GROUP] && match[ENMonthNameMiddleEndianParser_DATE_GROUP].match(/^2[0-5]$/)) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-06-27 17:25:14 +02:00
|
|
|
|
const components = context.createParsingComponents({
|
|
|
|
|
day: day,
|
|
|
|
|
month: month
|
2024-10-14 11:01:38 +02:00
|
|
|
|
}).addTag("parser/ENMonthNameMiddleEndianParser");
|
2023-06-27 17:25:14 +02:00
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-10-14 11:01:38 +02:00
|
|
|
|
;// ./node_modules/chrono-node/dist/esm/locales/en/parsers/ENMonthNameParser.js
|
2023-06-27 17:25:14 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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);
|
2024-10-14 11:01:38 +02:00
|
|
|
|
result.start.addTag("parser/ENMonthNameParser");
|
2023-06-27 17:25:14 +02:00
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-10-14 11:01:38 +02:00
|
|
|
|
;// ./node_modules/chrono-node/dist/esm/locales/en/parsers/ENYearMonthDayParser.js
|
2023-06-27 17:25:14 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-10-14 11:01:38 +02:00
|
|
|
|
const ENYearMonthDayParser_PATTERN = new RegExp(`([0-9]{4})[-\\.\\/\\s]` + `(?:(${matchAnyPattern(MONTH_DICTIONARY)})|([0-9]{1,2}))[-\\.\\/\\s]` + `([0-9]{1,2})` + "(?=\\W|$)", "i");
|
2023-06-27 17:25:14 +02:00
|
|
|
|
const YEAR_NUMBER_GROUP = 1;
|
2024-10-14 11:01:38 +02:00
|
|
|
|
const ENYearMonthDayParser_MONTH_NAME_GROUP = 2;
|
2023-06-27 17:25:14 +02:00
|
|
|
|
const MONTH_NUMBER_GROUP = 3;
|
|
|
|
|
const DATE_NUMBER_GROUP = 4;
|
2024-10-14 11:01:38 +02:00
|
|
|
|
class ENYearMonthDayParser extends AbstractParserWithWordBoundaryChecking {
|
|
|
|
|
constructor(strictMonthDateOrder) {
|
|
|
|
|
super();
|
|
|
|
|
this.strictMonthDateOrder = strictMonthDateOrder;
|
|
|
|
|
}
|
2023-06-27 17:25:14 +02:00
|
|
|
|
innerPattern() {
|
2024-10-14 11:01:38 +02:00
|
|
|
|
return ENYearMonthDayParser_PATTERN;
|
2023-06-27 17:25:14 +02:00
|
|
|
|
}
|
|
|
|
|
innerExtract(context, match) {
|
2024-10-14 11:01:38 +02:00
|
|
|
|
const year = parseInt(match[YEAR_NUMBER_GROUP]);
|
|
|
|
|
let day = parseInt(match[DATE_NUMBER_GROUP]);
|
|
|
|
|
let month = match[MONTH_NUMBER_GROUP] ? parseInt(match[MONTH_NUMBER_GROUP]) : MONTH_DICTIONARY[match[ENYearMonthDayParser_MONTH_NAME_GROUP].toLowerCase()];
|
2023-06-27 17:25:14 +02:00
|
|
|
|
if (month < 1 || month > 12) {
|
2024-10-14 11:01:38 +02:00
|
|
|
|
if (this.strictMonthDateOrder) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
if (day >= 1 && day <= 12) {
|
|
|
|
|
[month, day] = [day, month];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (day < 1 || day > 31) {
|
2023-06-27 17:25:14 +02:00
|
|
|
|
return null;
|
2020-11-04 22:59:32 +01:00
|
|
|
|
}
|
2023-06-27 17:25:14 +02:00
|
|
|
|
return {
|
|
|
|
|
day: day,
|
|
|
|
|
month: month,
|
|
|
|
|
year: year
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-10-14 11:01:38 +02:00
|
|
|
|
;// ./node_modules/chrono-node/dist/esm/locales/en/parsers/ENSlashMonthFormatParser.js
|
2021-08-27 18:14:41 +02:00
|
|
|
|
|
2023-06-27 17:25:14 +02:00
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-10-14 11:01:38 +02:00
|
|
|
|
;// ./node_modules/chrono-node/dist/esm/common/parsers/AbstractTimeExpressionParser.js
|
2023-06-27 17:25:14 +02:00
|
|
|
|
|
|
|
|
|
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() {
|
2024-10-14 11:01:38 +02:00
|
|
|
|
return `(?!/)(?=\\W|$)`;
|
2023-06-27 17:25:14 +02:00
|
|
|
|
}
|
|
|
|
|
followingSuffix() {
|
2024-10-14 11:01:38 +02:00
|
|
|
|
return `(?!/)(?=\\W|$)`;
|
2023-06-27 17:25:14 +02:00
|
|
|
|
}
|
|
|
|
|
pattern(context) {
|
|
|
|
|
return this.getPrimaryTimePatternThroughCache();
|
|
|
|
|
}
|
|
|
|
|
extract(context, match) {
|
|
|
|
|
const startComponents = this.extractPrimaryTimeComponents(context, match);
|
|
|
|
|
if (!startComponents) {
|
2024-10-14 11:01:38 +02:00
|
|
|
|
if (match[0].match(/^\d{4}/)) {
|
|
|
|
|
match.index += 4;
|
|
|
|
|
return null;
|
|
|
|
|
}
|
2023-06-27 17:25:14 +02:00
|
|
|
|
match.index += match[0].length;
|
|
|
|
|
return null;
|
|
|
|
|
}
|
2021-08-27 18:14:41 +02:00
|
|
|
|
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);
|
2024-10-14 11:01:38 +02:00
|
|
|
|
if (text.match(/^\d{3,4}/) && followingMatch) {
|
|
|
|
|
if (followingMatch[0].match(/^\s*([+-])\s*\d{2,4}$/)) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
if (followingMatch[0].match(/^\s*([+-])\s*\d{2}\W\d{2}/)) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
2022-10-03 09:52:08 +02:00
|
|
|
|
}
|
2021-08-27 18:14:41 +02:00
|
|
|
|
if (!followingMatch || followingMatch[0].match(/^\s*([+-])\s*\d{3,4}$/)) {
|
|
|
|
|
return this.checkAndReturnWithoutFollowingPattern(result);
|
2020-11-04 22:59:32 +01:00
|
|
|
|
}
|
2021-08-27 18:14:41 +02:00
|
|
|
|
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);
|
2020-11-04 22:59:32 +01:00
|
|
|
|
}
|
2021-08-27 18:14:41 +02:00
|
|
|
|
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) {
|
2024-10-14 11:01:38 +02:00
|
|
|
|
meridiem = types_Meridiem.PM;
|
2020-11-04 22:59:32 +01:00
|
|
|
|
}
|
2021-08-27 18:14:41 +02:00
|
|
|
|
if (match[AM_PM_HOUR_GROUP] != null) {
|
|
|
|
|
if (hour > 12) return null;
|
|
|
|
|
const ampm = match[AM_PM_HOUR_GROUP][0].toLowerCase();
|
|
|
|
|
if (ampm == "a") {
|
2024-10-14 11:01:38 +02:00
|
|
|
|
meridiem = types_Meridiem.AM;
|
2021-08-27 18:14:41 +02:00
|
|
|
|
if (hour == 12) {
|
|
|
|
|
hour = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (ampm == "p") {
|
2024-10-14 11:01:38 +02:00
|
|
|
|
meridiem = types_Meridiem.PM;
|
2021-08-27 18:14:41 +02:00
|
|
|
|
if (hour != 12) {
|
|
|
|
|
hour += 12;
|
2020-11-04 22:59:32 +01:00
|
|
|
|
}
|
2021-08-27 18:14:41 +02:00
|
|
|
|
}
|
2020-11-04 22:59:32 +01:00
|
|
|
|
}
|
2021-08-27 18:14:41 +02:00
|
|
|
|
components.assign("hour", hour);
|
|
|
|
|
components.assign("minute", minute);
|
|
|
|
|
if (meridiem !== null) {
|
|
|
|
|
components.assign("meridiem", meridiem);
|
|
|
|
|
} else {
|
|
|
|
|
if (hour < 12) {
|
2024-10-14 11:01:38 +02:00
|
|
|
|
components.imply("meridiem", types_Meridiem.AM);
|
2021-08-27 18:14:41 +02:00
|
|
|
|
} else {
|
2024-10-14 11:01:38 +02:00
|
|
|
|
components.imply("meridiem", types_Meridiem.PM);
|
2021-08-27 18:14:41 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
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);
|
2020-11-04 22:59:32 +01:00
|
|
|
|
}
|
2021-08-27 18:14:41 +02:00
|
|
|
|
if (minute >= 60 || hour > 24) {
|
|
|
|
|
return null;
|
2020-11-04 22:59:32 +01:00
|
|
|
|
}
|
2021-08-27 18:14:41 +02:00
|
|
|
|
if (hour >= 12) {
|
2024-10-14 11:01:38 +02:00
|
|
|
|
meridiem = types_Meridiem.PM;
|
2020-11-04 22:59:32 +01:00
|
|
|
|
}
|
2021-08-27 18:14:41 +02:00
|
|
|
|
if (match[AM_PM_HOUR_GROUP] != null) {
|
|
|
|
|
if (hour > 12) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
const ampm = match[AM_PM_HOUR_GROUP][0].toLowerCase();
|
|
|
|
|
if (ampm == "a") {
|
2024-10-14 11:01:38 +02:00
|
|
|
|
meridiem = types_Meridiem.AM;
|
2021-08-27 18:14:41 +02:00
|
|
|
|
if (hour == 12) {
|
|
|
|
|
hour = 0;
|
|
|
|
|
if (!components.isCertain("day")) {
|
|
|
|
|
components.imply("day", components.get("day") + 1);
|
|
|
|
|
}
|
2020-11-04 22:59:32 +01:00
|
|
|
|
}
|
2021-08-27 18:14:41 +02:00
|
|
|
|
}
|
|
|
|
|
if (ampm == "p") {
|
2024-10-14 11:01:38 +02:00
|
|
|
|
meridiem = types_Meridiem.PM;
|
2021-08-27 18:14:41 +02:00
|
|
|
|
if (hour != 12) hour += 12;
|
|
|
|
|
}
|
|
|
|
|
if (!result.start.isCertain("meridiem")) {
|
2024-10-14 11:01:38 +02:00
|
|
|
|
if (meridiem == types_Meridiem.AM) {
|
|
|
|
|
result.start.imply("meridiem", types_Meridiem.AM);
|
2021-08-27 18:14:41 +02:00
|
|
|
|
if (result.start.get("hour") == 12) {
|
|
|
|
|
result.start.assign("hour", 0);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
2024-10-14 11:01:38 +02:00
|
|
|
|
result.start.imply("meridiem", types_Meridiem.PM);
|
2021-08-27 18:14:41 +02:00
|
|
|
|
if (result.start.get("hour") != 12) {
|
|
|
|
|
result.start.assign("hour", result.start.get("hour") + 12);
|
|
|
|
|
}
|
2020-11-04 22:59:32 +01:00
|
|
|
|
}
|
2021-08-27 18:14:41 +02:00
|
|
|
|
}
|
2020-11-04 22:59:32 +01:00
|
|
|
|
}
|
2021-08-27 18:14:41 +02:00
|
|
|
|
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) {
|
2024-10-14 11:01:38 +02:00
|
|
|
|
components.imply("meridiem", types_Meridiem.AM);
|
2021-08-27 18:14:41 +02:00
|
|
|
|
} else if (hour <= 12) {
|
|
|
|
|
components.assign("hour", hour + 12);
|
2024-10-14 11:01:38 +02:00
|
|
|
|
components.assign("meridiem", types_Meridiem.PM);
|
2021-08-27 18:14:41 +02:00
|
|
|
|
}
|
|
|
|
|
} else if (hour > 12) {
|
2024-10-14 11:01:38 +02:00
|
|
|
|
components.imply("meridiem", types_Meridiem.PM);
|
2021-08-27 18:14:41 +02:00
|
|
|
|
} else if (hour <= 12) {
|
2024-10-14 11:01:38 +02:00
|
|
|
|
components.imply("meridiem", types_Meridiem.AM);
|
2021-08-27 18:14:41 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
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;
|
2020-11-04 22:59:32 +01:00
|
|
|
|
}
|
2022-10-03 09:52:08 +02:00
|
|
|
|
if (result.text.match(/^\d\d\d+$/)) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
2021-08-27 18:14:41 +02:00
|
|
|
|
if (result.text.match(/\d[apAP]$/)) {
|
|
|
|
|
return null;
|
2020-11-04 22:59:32 +01:00
|
|
|
|
}
|
2021-08-27 18:14:41 +02:00
|
|
|
|
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;
|
|
|
|
|
}
|
2020-11-04 22:59:32 +01:00
|
|
|
|
}
|
2021-08-27 18:14:41 +02:00
|
|
|
|
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;
|
|
|
|
|
}
|
2022-10-03 09:52:08 +02:00
|
|
|
|
this.cachedPrimaryTimePattern = primaryTimePattern(this.primaryPatternLeftBoundary(), primaryPrefix, primarySuffix, this.patternFlags());
|
2021-08-27 18:14:41 +02:00
|
|
|
|
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;
|
2020-11-04 22:59:32 +01:00
|
|
|
|
}
|
2021-08-27 18:14:41 +02:00
|
|
|
|
this.cachedFollowingTimePatten = followingTimePatten(followingPhase, followingSuffix);
|
|
|
|
|
this.cachedFollowingPhase = followingPhase;
|
|
|
|
|
this.cachedFollowingSuffix = followingSuffix;
|
|
|
|
|
return this.cachedFollowingTimePatten;
|
|
|
|
|
}
|
2020-11-04 22:59:32 +01:00
|
|
|
|
}
|
2024-10-14 11:01:38 +02:00
|
|
|
|
;// ./node_modules/chrono-node/dist/esm/locales/en/parsers/ENTimeExpressionParser.js
|
2020-11-04 22:59:32 +01:00
|
|
|
|
|
2021-08-27 18:14:41 +02:00
|
|
|
|
|
2023-06-27 17:25:14 +02:00
|
|
|
|
class ENTimeExpressionParser extends AbstractTimeExpressionParser {
|
|
|
|
|
constructor(strictMode) {
|
|
|
|
|
super(strictMode);
|
2021-08-27 18:14:41 +02:00
|
|
|
|
}
|
2023-06-27 17:25:14 +02:00
|
|
|
|
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);
|
2024-10-14 11:01:38 +02:00
|
|
|
|
if (!components) {
|
|
|
|
|
return 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", types_Meridiem.PM);
|
|
|
|
|
} else if (hour < 6) {
|
|
|
|
|
components.assign("meridiem", types_Meridiem.AM);
|
2021-08-27 18:14:41 +02:00
|
|
|
|
}
|
2024-10-14 11:01:38 +02:00
|
|
|
|
}
|
|
|
|
|
if (match[0].endsWith("afternoon")) {
|
|
|
|
|
components.assign("meridiem", types_Meridiem.PM);
|
|
|
|
|
const hour = components.get("hour");
|
|
|
|
|
if (hour >= 0 && hour <= 6) {
|
|
|
|
|
components.assign("hour", components.get("hour") + 12);
|
2021-08-27 18:14:41 +02:00
|
|
|
|
}
|
2024-10-14 11:01:38 +02:00
|
|
|
|
}
|
|
|
|
|
if (match[0].endsWith("morning")) {
|
|
|
|
|
components.assign("meridiem", types_Meridiem.AM);
|
|
|
|
|
const hour = components.get("hour");
|
|
|
|
|
if (hour < 12) {
|
|
|
|
|
components.assign("hour", components.get("hour"));
|
2021-08-27 18:14:41 +02:00
|
|
|
|
}
|
2020-11-04 22:59:32 +01:00
|
|
|
|
}
|
2024-10-14 11:01:38 +02:00
|
|
|
|
return components.addTag("parser/ENTimeExpressionParser");
|
2021-08-27 18:14:41 +02:00
|
|
|
|
}
|
2020-11-04 22:59:32 +01:00
|
|
|
|
}
|
2024-10-14 11:01:38 +02:00
|
|
|
|
;// ./node_modules/chrono-node/dist/esm/utils/timeunits.js
|
2023-06-27 17:25:14 +02:00
|
|
|
|
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;
|
|
|
|
|
}
|
2024-10-14 11:01:38 +02:00
|
|
|
|
;// ./node_modules/chrono-node/dist/esm/locales/en/parsers/ENTimeUnitAgoFormatParser.js
|
2020-11-04 22:59:32 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-06-27 17:25:14 +02:00
|
|
|
|
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;
|
2021-08-27 18:14:41 +02:00
|
|
|
|
}
|
2023-06-27 17:25:14 +02:00
|
|
|
|
innerPattern() {
|
|
|
|
|
return this.strictMode ? STRICT_PATTERN : ENTimeUnitAgoFormatParser_PATTERN;
|
2021-08-27 18:14:41 +02:00
|
|
|
|
}
|
2023-06-27 17:25:14 +02:00
|
|
|
|
innerExtract(context, match) {
|
|
|
|
|
const timeUnits = parseTimeUnits(match[1]);
|
2024-10-14 11:01:38 +02:00
|
|
|
|
if (!timeUnits) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
2023-06-27 17:25:14 +02:00
|
|
|
|
const outputTimeUnits = reverseTimeUnits(timeUnits);
|
|
|
|
|
return results_ParsingComponents.createRelativeFromReference(context.reference, outputTimeUnits);
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-10-14 11:01:38 +02:00
|
|
|
|
;// ./node_modules/chrono-node/dist/esm/locales/en/parsers/ENTimeUnitLaterFormatParser.js
|
2020-11-04 22:59:32 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-06-27 17:25:14 +02:00
|
|
|
|
const ENTimeUnitLaterFormatParser_PATTERN = new RegExp(`(${TIME_UNITS_PATTERN})\\s{0,5}(?:later|after|from now|henceforth|forward|out)` + "(?=(?:\\W|$))", "i");
|
2024-10-14 11:01:38 +02:00
|
|
|
|
const ENTimeUnitLaterFormatParser_STRICT_PATTERN = new RegExp(`(${TIME_UNITS_NO_ABBR_PATTERN})\\s{0,5}(later|after|from now)(?=\\W|$)`, "i");
|
2023-06-27 17:25:14 +02:00
|
|
|
|
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) {
|
2024-10-14 11:01:38 +02:00
|
|
|
|
const timeUnits = parseTimeUnits(match[GROUP_NUM_TIMEUNITS]);
|
|
|
|
|
if (!timeUnits) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
return results_ParsingComponents.createRelativeFromReference(context.reference, timeUnits);
|
2023-06-27 17:25:14 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
2024-10-14 11:01:38 +02:00
|
|
|
|
;// ./node_modules/chrono-node/dist/esm/common/abstractRefiners.js
|
2023-06-27 17:25:14 +02:00
|
|
|
|
class Filter {
|
|
|
|
|
refine(context, results) {
|
|
|
|
|
return results.filter(r => this.isValid(context, r));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
class MergingRefiner {
|
|
|
|
|
refine(context, results) {
|
|
|
|
|
if (results.length < 2) {
|
|
|
|
|
return results;
|
2021-08-27 18:14:41 +02:00
|
|
|
|
}
|
2023-06-27 17:25:14 +02:00
|
|
|
|
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;
|
2021-08-27 18:14:41 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
2023-06-27 17:25:14 +02:00
|
|
|
|
if (curResult != null) {
|
|
|
|
|
mergedResults.push(curResult);
|
2020-11-04 22:59:32 +01:00
|
|
|
|
}
|
2023-06-27 17:25:14 +02:00
|
|
|
|
return mergedResults;
|
2021-08-27 18:14:41 +02:00
|
|
|
|
}
|
2020-11-04 22:59:32 +01:00
|
|
|
|
}
|
2024-10-14 11:01:38 +02:00
|
|
|
|
;// ./node_modules/chrono-node/dist/esm/common/refiners/AbstractMergeDateRangeRefiner.js
|
2020-11-04 22:59:32 +01:00
|
|
|
|
|
2023-06-27 17:25:14 +02:00
|
|
|
|
class AbstractMergeDateRangeRefiner extends MergingRefiner {
|
2021-08-27 18:14:41 +02:00
|
|
|
|
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)) {
|
2023-06-27 17:25:14 +02:00
|
|
|
|
fromResult.start.imply(key, toResult.start.get(key));
|
2020-11-04 22:59:32 +01:00
|
|
|
|
}
|
2021-08-27 18:14:41 +02:00
|
|
|
|
});
|
|
|
|
|
fromResult.start.getCertainComponents().forEach(key => {
|
|
|
|
|
if (!toResult.start.isCertain(key)) {
|
2023-06-27 17:25:14 +02:00
|
|
|
|
toResult.start.imply(key, fromResult.start.get(key));
|
2020-11-04 22:59:32 +01:00
|
|
|
|
}
|
2021-08-27 18:14:41 +02:00
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
if (fromResult.start.date().getTime() > toResult.start.date().getTime()) {
|
|
|
|
|
let fromMoment = fromResult.start.dayjs();
|
|
|
|
|
let toMoment = toResult.start.dayjs();
|
2023-06-27 17:25:14 +02:00
|
|
|
|
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)) {
|
2021-08-27 18:14:41 +02:00
|
|
|
|
fromMoment = fromMoment.add(-7, "days");
|
|
|
|
|
fromResult.start.imply("day", fromMoment.date());
|
|
|
|
|
fromResult.start.imply("month", fromMoment.month() + 1);
|
|
|
|
|
fromResult.start.imply("year", fromMoment.year());
|
2023-06-27 17:25:14 +02:00
|
|
|
|
} else if (toResult.start.isDateWithUnknownYear() && toMoment.add(1, "years").isAfter(fromMoment)) {
|
|
|
|
|
toMoment = toMoment.add(1, "years");
|
2021-08-27 18:14:41 +02:00
|
|
|
|
toResult.start.imply("year", toMoment.year());
|
2023-06-27 17:25:14 +02:00
|
|
|
|
} else if (fromResult.start.isDateWithUnknownYear() && fromMoment.add(-1, "years").isBefore(toMoment)) {
|
|
|
|
|
fromMoment = fromMoment.add(-1, "years");
|
|
|
|
|
fromResult.start.imply("year", fromMoment.year());
|
2021-08-27 18:14:41 +02:00
|
|
|
|
} else {
|
|
|
|
|
[toResult, fromResult] = [fromResult, toResult];
|
|
|
|
|
}
|
2020-11-04 22:59:32 +01:00
|
|
|
|
}
|
2021-08-27 18:14:41 +02:00
|
|
|
|
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;
|
|
|
|
|
}
|
2020-11-04 22:59:32 +01:00
|
|
|
|
}
|
2024-10-14 11:01:38 +02:00
|
|
|
|
;// ./node_modules/chrono-node/dist/esm/locales/en/refiners/ENMergeDateRangeRefiner.js
|
2020-11-04 22:59:32 +01:00
|
|
|
|
|
2023-06-27 17:25:14 +02:00
|
|
|
|
class ENMergeDateRangeRefiner extends AbstractMergeDateRangeRefiner {
|
|
|
|
|
patternBetween() {
|
|
|
|
|
return /^\s*(to|-|–|until|through|till)\s*$/i;
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-10-14 11:01:38 +02:00
|
|
|
|
;// ./node_modules/chrono-node/dist/esm/calculation/mergingCalculation.js
|
2021-08-27 18:14:41 +02:00
|
|
|
|
|
|
|
|
|
|
2023-06-27 17:25:14 +02:00
|
|
|
|
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"));
|
|
|
|
|
}
|
2024-10-14 11:01:38 +02:00
|
|
|
|
if (dateTimeComponent.get("meridiem") == types_Meridiem.PM && dateTimeComponent.get("hour") < 12) {
|
2023-06-27 17:25:14 +02:00
|
|
|
|
if (timeComponent.isCertain("hour")) {
|
|
|
|
|
dateTimeComponent.assign("hour", dateTimeComponent.get("hour") + 12);
|
|
|
|
|
} else {
|
|
|
|
|
dateTimeComponent.imply("hour", dateTimeComponent.get("hour") + 12);
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-10-14 11:01:38 +02:00
|
|
|
|
dateTimeComponent.addTags(dateComponent.tags());
|
|
|
|
|
dateTimeComponent.addTags(timeComponent.tags());
|
2023-06-27 17:25:14 +02:00
|
|
|
|
return dateTimeComponent;
|
|
|
|
|
}
|
2024-10-14 11:01:38 +02:00
|
|
|
|
;// ./node_modules/chrono-node/dist/esm/common/refiners/AbstractMergeDateTimeRefiner.js
|
2021-08-27 18:14:41 +02:00
|
|
|
|
|
|
|
|
|
|
2023-06-27 17:25:14 +02:00
|
|
|
|
class AbstractMergeDateTimeRefiner extends MergingRefiner {
|
2021-08-27 18:14:41 +02:00
|
|
|
|
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) {
|
2023-06-27 17:25:14 +02:00
|
|
|
|
const result = currentResult.start.isOnlyDate() ? mergeDateTimeResult(currentResult, nextResult) : mergeDateTimeResult(nextResult, currentResult);
|
2021-08-27 18:14:41 +02:00
|
|
|
|
result.index = currentResult.index;
|
|
|
|
|
result.text = currentResult.text + textBetween + nextResult.text;
|
2020-11-04 22:59:32 +01:00
|
|
|
|
return result;
|
2021-08-27 18:14:41 +02:00
|
|
|
|
}
|
2020-11-04 22:59:32 +01:00
|
|
|
|
}
|
2024-10-14 11:01:38 +02:00
|
|
|
|
;// ./node_modules/chrono-node/dist/esm/locales/en/refiners/ENMergeDateTimeRefiner.js
|
2020-11-04 22:59:32 +01:00
|
|
|
|
|
2023-06-27 17:25:14 +02:00
|
|
|
|
class ENMergeDateTimeRefiner extends AbstractMergeDateTimeRefiner {
|
|
|
|
|
patternBetween() {
|
2024-10-14 11:01:38 +02:00
|
|
|
|
return new RegExp("^\\s*(T|at|after|before|on|of|,|-|\\.|∙|:)?\\s*$");
|
2023-06-27 17:25:14 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
2024-10-14 11:01:38 +02:00
|
|
|
|
;// ./node_modules/chrono-node/dist/esm/common/refiners/ExtractTimezoneAbbrRefiner.js
|
2021-08-27 18:14:41 +02:00
|
|
|
|
|
|
|
|
|
const TIMEZONE_NAME_PATTERN = new RegExp("^\\s*,?\\s*\\(?([A-Z]{2,4})\\)?(?=\\W|$)", "i");
|
|
|
|
|
class ExtractTimezoneAbbrRefiner {
|
|
|
|
|
constructor(timezoneOverrides) {
|
2023-06-27 17:25:14 +02:00
|
|
|
|
this.timezoneOverrides = timezoneOverrides;
|
2021-08-27 18:14:41 +02:00
|
|
|
|
}
|
|
|
|
|
refine(context, results) {
|
2023-06-27 17:25:14 +02:00
|
|
|
|
const timezoneOverrides = context.option.timezones ?? {};
|
2021-08-27 18:14:41 +02:00
|
|
|
|
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();
|
2023-06-27 17:25:14 +02:00
|
|
|
|
const refDate = result.start.date() ?? result.refDate ?? new Date();
|
|
|
|
|
const tzOverrides = {
|
|
|
|
|
...this.timezoneOverrides,
|
|
|
|
|
...timezoneOverrides
|
|
|
|
|
};
|
|
|
|
|
const extractedTimezoneOffset = toTimezoneOffset(timezoneAbbr, refDate, tzOverrides);
|
|
|
|
|
if (extractedTimezoneOffset == null) {
|
2021-08-27 18:14:41 +02:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
context.debug(() => {
|
2022-10-03 09:52:08 +02:00
|
|
|
|
console.log(`Extracting timezone: '${timezoneAbbr}' into: ${extractedTimezoneOffset} for: ${result.start}`);
|
2021-08-27 18:14:41 +02:00
|
|
|
|
});
|
|
|
|
|
const currentTimezoneOffset = result.start.get("timezoneOffset");
|
|
|
|
|
if (currentTimezoneOffset !== null && extractedTimezoneOffset != currentTimezoneOffset) {
|
|
|
|
|
if (result.start.isCertain("timezoneOffset")) {
|
|
|
|
|
return;
|
2020-11-04 22:59:32 +01:00
|
|
|
|
}
|
2021-08-27 18:14:41 +02:00
|
|
|
|
if (timezoneAbbr != match[1]) {
|
|
|
|
|
return;
|
2020-11-04 22:59:32 +01:00
|
|
|
|
}
|
2021-08-27 18:14:41 +02:00
|
|
|
|
}
|
2022-10-03 09:52:08 +02:00
|
|
|
|
if (result.start.isOnlyDate()) {
|
|
|
|
|
if (timezoneAbbr != match[1]) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-08-27 18:14:41 +02:00
|
|
|
|
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;
|
|
|
|
|
}
|
2020-11-04 22:59:32 +01:00
|
|
|
|
}
|
2024-10-14 11:01:38 +02:00
|
|
|
|
;// ./node_modules/chrono-node/dist/esm/common/refiners/ExtractTimezoneOffsetRefiner.js
|
2022-10-03 09:52:08 +02:00
|
|
|
|
const TIMEZONE_OFFSET_PATTERN = new RegExp("^\\s*(?:\\(?(?:GMT|UTC)\\s?)?([+-])(\\d{1,2})(?::?(\\d{2}))?\\)?", "i");
|
2021-08-27 18:14:41 +02:00
|
|
|
|
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;
|
2022-10-03 09:52:08 +02:00
|
|
|
|
if (timezoneOffset > 14 * 60) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
2021-08-27 18:14:41 +02:00
|
|
|
|
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;
|
|
|
|
|
}
|
2020-11-04 22:59:32 +01:00
|
|
|
|
}
|
2024-10-14 11:01:38 +02:00
|
|
|
|
;// ./node_modules/chrono-node/dist/esm/common/refiners/OverlapRemovalRefiner.js
|
2023-06-27 17:25:14 +02:00
|
|
|
|
class OverlapRemovalRefiner {
|
2021-08-27 18:14:41 +02:00
|
|
|
|
refine(context, results) {
|
2023-06-27 17:25:14 +02:00
|
|
|
|
if (results.length < 2) {
|
2021-08-27 18:14:41 +02:00
|
|
|
|
return results;
|
2020-11-04 22:59:32 +01:00
|
|
|
|
}
|
2023-06-27 17:25:14 +02:00
|
|
|
|
const filteredResults = [];
|
|
|
|
|
let prevResult = results[0];
|
|
|
|
|
for (let i = 1; i < results.length; i++) {
|
|
|
|
|
const result = results[i];
|
2024-10-14 11:01:38 +02:00
|
|
|
|
if (result.index >= prevResult.index + prevResult.text.length) {
|
2023-06-27 17:25:14 +02:00
|
|
|
|
filteredResults.push(prevResult);
|
|
|
|
|
prevResult = result;
|
2024-10-14 11:01:38 +02:00
|
|
|
|
continue;
|
2021-08-27 18:14:41 +02:00
|
|
|
|
}
|
2024-10-14 11:01:38 +02:00
|
|
|
|
let kept = null;
|
|
|
|
|
let removed = null;
|
|
|
|
|
if (result.text.length > prevResult.text.length) {
|
|
|
|
|
kept = result;
|
|
|
|
|
removed = prevResult;
|
|
|
|
|
} else {
|
|
|
|
|
kept = prevResult;
|
|
|
|
|
removed = result;
|
|
|
|
|
}
|
|
|
|
|
context.debug(() => {
|
|
|
|
|
console.log(`${this.constructor.name} remove ${removed} by ${kept}`);
|
|
|
|
|
});
|
|
|
|
|
prevResult = kept;
|
2020-11-04 22:59:32 +01:00
|
|
|
|
}
|
2021-08-27 18:14:41 +02:00
|
|
|
|
if (prevResult != null) {
|
|
|
|
|
filteredResults.push(prevResult);
|
|
|
|
|
}
|
|
|
|
|
return filteredResults;
|
2023-06-27 17:25:14 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
2024-10-14 11:01:38 +02:00
|
|
|
|
;// ./node_modules/chrono-node/dist/esm/common/refiners/ForwardDateRefiner.js
|
2021-08-27 18:14:41 +02:00
|
|
|
|
|
|
|
|
|
|
2023-06-27 17:25:14 +02:00
|
|
|
|
class ForwardDateRefiner {
|
|
|
|
|
refine(context, results) {
|
|
|
|
|
if (!context.option.forwardDate) {
|
|
|
|
|
return results;
|
|
|
|
|
}
|
2024-10-14 11:01:38 +02:00
|
|
|
|
results.forEach(result => {
|
2023-06-27 17:25:14 +02:00
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-10-14 11:01:38 +02:00
|
|
|
|
context.debug(() => {
|
|
|
|
|
console.log(`${this.constructor.name} adjusted ${result} time result (${result.start})`);
|
|
|
|
|
});
|
2023-06-27 17:25:14 +02:00
|
|
|
|
}
|
|
|
|
|
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(() => {
|
2024-10-14 11:01:38 +02:00
|
|
|
|
console.log(`${this.constructor.name} adjusted ${result} weekday (${result.start})`);
|
2023-06-27 17:25:14 +02:00
|
|
|
|
});
|
|
|
|
|
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(() => {
|
2024-10-14 11:01:38 +02:00
|
|
|
|
console.log(`${this.constructor.name} adjusted ${result} weekday (${result.end})`);
|
2023-06-27 17:25:14 +02:00
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
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(() => {
|
2024-10-14 11:01:38 +02:00
|
|
|
|
console.log(`${this.constructor.name} adjusted ${result} year (${result.start})`);
|
2023-06-27 17:25:14 +02:00
|
|
|
|
});
|
|
|
|
|
if (result.end && !result.end.isCertain("year")) {
|
|
|
|
|
result.end.imply("year", result.end.get("year") + 1);
|
|
|
|
|
context.debug(() => {
|
2024-10-14 11:01:38 +02:00
|
|
|
|
console.log(`${this.constructor.name} adjusted ${result} month (${result.start})`);
|
2023-06-27 17:25:14 +02:00
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
return results;
|
2022-10-03 09:52:08 +02:00
|
|
|
|
}
|
2023-06-27 17:25:14 +02:00
|
|
|
|
}
|
2024-10-14 11:01:38 +02:00
|
|
|
|
;// ./node_modules/chrono-node/dist/esm/common/refiners/UnlikelyFormatFilter.js
|
2022-10-03 09:52:08 +02:00
|
|
|
|
|
2023-06-27 17:25:14 +02:00
|
|
|
|
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;
|
2021-08-27 18:14:41 +02:00
|
|
|
|
}
|
2023-06-27 17:25:14 +02:00
|
|
|
|
}
|
2024-10-14 11:01:38 +02:00
|
|
|
|
;// ./node_modules/chrono-node/dist/esm/common/parsers/ISOFormatParser.js
|
2021-08-27 18:14:41 +02:00
|
|
|
|
|
2024-10-14 11:01:38 +02:00
|
|
|
|
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");
|
2023-06-27 17:25:14 +02:00
|
|
|
|
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;
|
2024-10-14 11:01:38 +02:00
|
|
|
|
const TZD_GROUP = 8;
|
|
|
|
|
const TZD_HOUR_OFFSET_GROUP = 9;
|
|
|
|
|
const TZD_MINUTE_OFFSET_GROUP = 10;
|
2023-06-27 17:25:14 +02:00
|
|
|
|
class ISOFormatParser extends AbstractParserWithWordBoundaryChecking {
|
|
|
|
|
innerPattern() {
|
|
|
|
|
return ISOFormatParser_PATTERN;
|
|
|
|
|
}
|
|
|
|
|
innerExtract(context, match) {
|
2024-10-14 11:01:38 +02:00
|
|
|
|
const components = context.createParsingComponents({
|
|
|
|
|
"year": parseInt(match[ISOFormatParser_YEAR_NUMBER_GROUP]),
|
|
|
|
|
"month": parseInt(match[ISOFormatParser_MONTH_NUMBER_GROUP]),
|
|
|
|
|
"day": parseInt(match[ISOFormatParser_DATE_NUMBER_GROUP])
|
|
|
|
|
});
|
2023-06-27 17:25:14 +02:00
|
|
|
|
if (match[HOUR_NUMBER_GROUP] != null) {
|
2024-10-14 11:01:38 +02:00
|
|
|
|
components.assign("hour", parseInt(match[HOUR_NUMBER_GROUP]));
|
|
|
|
|
components.assign("minute", parseInt(match[MINUTE_NUMBER_GROUP]));
|
2023-06-27 17:25:14 +02:00
|
|
|
|
if (match[SECOND_NUMBER_GROUP] != null) {
|
2024-10-14 11:01:38 +02:00
|
|
|
|
components.assign("second", parseInt(match[SECOND_NUMBER_GROUP]));
|
2023-06-27 17:25:14 +02:00
|
|
|
|
}
|
|
|
|
|
if (match[MILLISECOND_NUMBER_GROUP] != null) {
|
2024-10-14 11:01:38 +02:00
|
|
|
|
components.assign("millisecond", parseInt(match[MILLISECOND_NUMBER_GROUP]));
|
2023-06-27 17:25:14 +02:00
|
|
|
|
}
|
2024-10-14 11:01:38 +02:00
|
|
|
|
if (match[TZD_GROUP] != null) {
|
|
|
|
|
let offset = 0;
|
|
|
|
|
if (match[TZD_HOUR_OFFSET_GROUP]) {
|
|
|
|
|
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]);
|
|
|
|
|
}
|
|
|
|
|
offset = hourOffset * 60;
|
|
|
|
|
if (offset < 0) {
|
|
|
|
|
offset -= minuteOffset;
|
|
|
|
|
} else {
|
|
|
|
|
offset += minuteOffset;
|
|
|
|
|
}
|
2023-06-27 17:25:14 +02:00
|
|
|
|
}
|
2024-10-14 11:01:38 +02:00
|
|
|
|
components.assign("timezoneOffset", offset);
|
2023-06-27 17:25:14 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
2024-10-14 11:01:38 +02:00
|
|
|
|
return components.addTag("parser/ISOFormatParser");
|
2023-06-27 17:25:14 +02:00
|
|
|
|
}
|
2020-11-04 22:59:32 +01:00
|
|
|
|
}
|
2024-10-14 11:01:38 +02:00
|
|
|
|
;// ./node_modules/chrono-node/dist/esm/common/refiners/MergeWeekdayComponentRefiner.js
|
2020-11-04 22:59:32 +01:00
|
|
|
|
|
2023-06-27 17:25:14 +02:00
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-10-14 11:01:38 +02:00
|
|
|
|
;// ./node_modules/chrono-node/dist/esm/configurations.js
|
2020-11-04 22:59:32 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-08-27 18:14:41 +02:00
|
|
|
|
|
|
|
|
|
|
2022-10-03 09:52:08 +02:00
|
|
|
|
|
2023-06-27 17:25:14 +02:00
|
|
|
|
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;
|
2020-11-04 22:59:32 +01:00
|
|
|
|
}
|
2024-10-14 11:01:38 +02:00
|
|
|
|
;// ./node_modules/chrono-node/dist/esm/common/casualReferences.js
|
2021-08-27 18:14:41 +02:00
|
|
|
|
|
2020-11-04 22:59:32 +01:00
|
|
|
|
|
|
|
|
|
|
2022-10-03 09:52:08 +02:00
|
|
|
|
|
2023-06-27 17:25:14 +02:00
|
|
|
|
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());
|
2022-10-03 09:52:08 +02:00
|
|
|
|
}
|
2024-10-14 11:01:38 +02:00
|
|
|
|
component.addTag("casualReference/now");
|
2023-06-27 17:25:14 +02:00
|
|
|
|
return component;
|
2021-08-27 18:14:41 +02:00
|
|
|
|
}
|
2023-06-27 17:25:14 +02:00
|
|
|
|
function today(reference) {
|
|
|
|
|
const targetDate = dayjs_min(reference.instant);
|
|
|
|
|
const component = new results_ParsingComponents(reference, {});
|
|
|
|
|
dayjs_assignSimilarDate(component, targetDate);
|
|
|
|
|
implySimilarTime(component, targetDate);
|
2024-10-14 11:01:38 +02:00
|
|
|
|
component.addTag("casualReference/today");
|
2023-06-27 17:25:14 +02:00
|
|
|
|
return component;
|
2021-08-27 18:14:41 +02:00
|
|
|
|
}
|
2023-06-27 17:25:14 +02:00
|
|
|
|
function yesterday(reference) {
|
2024-10-14 11:01:38 +02:00
|
|
|
|
return theDayBefore(reference, 1).addTag("casualReference/yesterday");
|
2020-11-04 22:59:32 +01:00
|
|
|
|
}
|
2023-06-27 17:25:14 +02:00
|
|
|
|
function theDayBefore(reference, numDay) {
|
|
|
|
|
return theDayAfter(reference, -numDay);
|
|
|
|
|
}
|
|
|
|
|
function tomorrow(reference) {
|
2024-10-14 11:01:38 +02:00
|
|
|
|
return theDayAfter(reference, 1).addTag("casualReference/tomorrow");
|
2023-06-27 17:25:14 +02:00
|
|
|
|
}
|
|
|
|
|
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, {});
|
|
|
|
|
dayjs_assignSimilarDate(component, targetDate);
|
2024-10-14 11:01:38 +02:00
|
|
|
|
component.imply("hour", implyHour);
|
|
|
|
|
component.imply("meridiem", types_Meridiem.PM);
|
|
|
|
|
component.addTag("casualReference/tonight");
|
2023-06-27 17:25:14 +02:00
|
|
|
|
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");
|
2021-08-27 18:14:41 +02:00
|
|
|
|
}
|
2023-06-27 17:25:14 +02:00
|
|
|
|
assignSimilarDate(component, targetDate);
|
|
|
|
|
component.imply("hour", implyHour);
|
|
|
|
|
return component;
|
|
|
|
|
}
|
|
|
|
|
function evening(reference, implyHour = 20) {
|
|
|
|
|
const component = new results_ParsingComponents(reference, {});
|
2024-10-14 11:01:38 +02:00
|
|
|
|
component.imply("meridiem", types_Meridiem.PM);
|
2023-06-27 17:25:14 +02:00
|
|
|
|
component.imply("hour", implyHour);
|
2024-10-14 11:01:38 +02:00
|
|
|
|
component.addTag("casualReference/evening");
|
2023-06-27 17:25:14 +02:00
|
|
|
|
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);
|
2024-10-14 11:01:38 +02:00
|
|
|
|
component.addTag("casualReference/yesterday");
|
|
|
|
|
component.addTag("casualReference/evening");
|
2023-06-27 17:25:14 +02:00
|
|
|
|
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);
|
2024-10-14 11:01:38 +02:00
|
|
|
|
component.addTag("casualReference/midnight");
|
2023-06-27 17:25:14 +02:00
|
|
|
|
return component;
|
|
|
|
|
}
|
|
|
|
|
function morning(reference, implyHour = 6) {
|
|
|
|
|
const component = new results_ParsingComponents(reference, {});
|
2024-10-14 11:01:38 +02:00
|
|
|
|
component.imply("meridiem", types_Meridiem.AM);
|
2023-06-27 17:25:14 +02:00
|
|
|
|
component.imply("hour", implyHour);
|
|
|
|
|
component.imply("minute", 0);
|
|
|
|
|
component.imply("second", 0);
|
|
|
|
|
component.imply("millisecond", 0);
|
2024-10-14 11:01:38 +02:00
|
|
|
|
component.addTag("casualReference/morning");
|
2023-06-27 17:25:14 +02:00
|
|
|
|
return component;
|
|
|
|
|
}
|
|
|
|
|
function afternoon(reference, implyHour = 15) {
|
|
|
|
|
const component = new results_ParsingComponents(reference, {});
|
2024-10-14 11:01:38 +02:00
|
|
|
|
component.imply("meridiem", types_Meridiem.PM);
|
2023-06-27 17:25:14 +02:00
|
|
|
|
component.imply("hour", implyHour);
|
|
|
|
|
component.imply("minute", 0);
|
|
|
|
|
component.imply("second", 0);
|
|
|
|
|
component.imply("millisecond", 0);
|
2024-10-14 11:01:38 +02:00
|
|
|
|
component.addTag("casualReference/afternoon");
|
2023-06-27 17:25:14 +02:00
|
|
|
|
return component;
|
2020-11-04 22:59:32 +01:00
|
|
|
|
}
|
2023-06-27 17:25:14 +02:00
|
|
|
|
function noon(reference) {
|
|
|
|
|
const component = new results_ParsingComponents(reference, {});
|
2024-10-14 11:01:38 +02:00
|
|
|
|
component.imply("meridiem", types_Meridiem.AM);
|
2023-06-27 17:25:14 +02:00
|
|
|
|
component.imply("hour", 12);
|
|
|
|
|
component.imply("minute", 0);
|
|
|
|
|
component.imply("second", 0);
|
|
|
|
|
component.imply("millisecond", 0);
|
2024-10-14 11:01:38 +02:00
|
|
|
|
component.addTag("casualReference/noon");
|
2023-06-27 17:25:14 +02:00
|
|
|
|
return component;
|
2020-11-04 22:59:32 +01:00
|
|
|
|
}
|
2024-10-14 11:01:38 +02:00
|
|
|
|
;// ./node_modules/chrono-node/dist/esm/locales/en/parsers/ENCasualDateParser.js
|
2020-11-04 22:59:32 +01:00
|
|
|
|
|
|
|
|
|
|
2020-10-20 17:47:54 +02:00
|
|
|
|
|
|
|
|
|
|
2023-06-27 17:25:14 +02:00
|
|
|
|
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();
|
2024-10-14 11:01:38 +02:00
|
|
|
|
let component = context.createParsingComponents();
|
2023-06-27 17:25:14 +02:00
|
|
|
|
switch (lowerText) {
|
|
|
|
|
case "now":
|
2024-10-14 11:01:38 +02:00
|
|
|
|
component = now(context.reference);
|
|
|
|
|
break;
|
2023-06-27 17:25:14 +02:00
|
|
|
|
case "today":
|
2024-10-14 11:01:38 +02:00
|
|
|
|
component = today(context.reference);
|
|
|
|
|
break;
|
2023-06-27 17:25:14 +02:00
|
|
|
|
case "yesterday":
|
2024-10-14 11:01:38 +02:00
|
|
|
|
component = yesterday(context.reference);
|
|
|
|
|
break;
|
2023-06-27 17:25:14 +02:00
|
|
|
|
case "tomorrow":
|
|
|
|
|
case "tmr":
|
|
|
|
|
case "tmrw":
|
2024-10-14 11:01:38 +02:00
|
|
|
|
component = tomorrow(context.reference);
|
|
|
|
|
break;
|
2023-06-27 17:25:14 +02:00
|
|
|
|
case "tonight":
|
2024-10-14 11:01:38 +02:00
|
|
|
|
component = tonight(context.reference);
|
|
|
|
|
break;
|
2023-06-27 17:25:14 +02:00
|
|
|
|
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;
|
|
|
|
|
}
|
2024-10-14 11:01:38 +02:00
|
|
|
|
component.addTag("parser/ENCasualDateParser");
|
2023-06-27 17:25:14 +02:00
|
|
|
|
return component;
|
2021-08-27 18:14:41 +02:00
|
|
|
|
}
|
2020-11-04 22:59:32 +01:00
|
|
|
|
}
|
2024-10-14 11:01:38 +02:00
|
|
|
|
;// ./node_modules/chrono-node/dist/esm/locales/en/parsers/ENCasualTimeParser.js
|
2020-11-04 22:59:32 +01:00
|
|
|
|
|
|
|
|
|
|
2023-06-27 17:25:14 +02:00
|
|
|
|
const ENCasualTimeParser_PATTERN = /(?:this)?\s{0,3}(morning|afternoon|evening|night|midnight|midday|noon)(?=\W|$)/i;
|
|
|
|
|
class ENCasualTimeParser extends AbstractParserWithWordBoundaryChecking {
|
|
|
|
|
innerPattern() {
|
|
|
|
|
return ENCasualTimeParser_PATTERN;
|
2021-08-27 18:14:41 +02:00
|
|
|
|
}
|
2023-06-27 17:25:14 +02:00
|
|
|
|
innerExtract(context, match) {
|
2024-10-14 11:01:38 +02:00
|
|
|
|
let component = null;
|
2023-06-27 17:25:14 +02:00
|
|
|
|
switch (match[1].toLowerCase()) {
|
|
|
|
|
case "afternoon":
|
2024-10-14 11:01:38 +02:00
|
|
|
|
component = afternoon(context.reference);
|
|
|
|
|
break;
|
2023-06-27 17:25:14 +02:00
|
|
|
|
case "evening":
|
|
|
|
|
case "night":
|
2024-10-14 11:01:38 +02:00
|
|
|
|
component = evening(context.reference);
|
|
|
|
|
break;
|
2023-06-27 17:25:14 +02:00
|
|
|
|
case "midnight":
|
2024-10-14 11:01:38 +02:00
|
|
|
|
component = midnight(context.reference);
|
|
|
|
|
break;
|
2023-06-27 17:25:14 +02:00
|
|
|
|
case "morning":
|
2024-10-14 11:01:38 +02:00
|
|
|
|
component = morning(context.reference);
|
|
|
|
|
break;
|
2023-06-27 17:25:14 +02:00
|
|
|
|
case "noon":
|
|
|
|
|
case "midday":
|
2024-10-14 11:01:38 +02:00
|
|
|
|
component = noon(context.reference);
|
|
|
|
|
break;
|
2023-06-27 17:25:14 +02:00
|
|
|
|
}
|
2024-10-14 11:01:38 +02:00
|
|
|
|
if (component) {
|
|
|
|
|
component.addTag("parser/ENCasualTimeParser");
|
|
|
|
|
}
|
|
|
|
|
return component;
|
2021-08-27 18:14:41 +02:00
|
|
|
|
}
|
2020-11-04 22:59:32 +01:00
|
|
|
|
}
|
2024-10-14 11:01:38 +02:00
|
|
|
|
;// ./node_modules/chrono-node/dist/esm/common/calculation/weekdays.js
|
2020-11-04 22:59:32 +01:00
|
|
|
|
|
|
|
|
|
|
2022-10-03 09:52:08 +02:00
|
|
|
|
|
2023-06-27 17:25:14 +02:00
|
|
|
|
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;
|
2022-10-03 09:52:08 +02:00
|
|
|
|
}
|
2023-06-27 17:25:14 +02:00
|
|
|
|
if (refWeekday == Weekday.SATURDAY) {
|
|
|
|
|
if (weekday == Weekday.SATURDAY) return 7;
|
|
|
|
|
if (weekday == Weekday.SUNDAY) return 8;
|
|
|
|
|
return 1 + weekday;
|
2022-10-03 09:52:08 +02:00
|
|
|
|
}
|
2023-06-27 17:25:14 +02:00
|
|
|
|
if (weekday < refWeekday && weekday != Weekday.SUNDAY) {
|
|
|
|
|
return getDaysForwardToWeekday(refDate, weekday);
|
|
|
|
|
} else {
|
|
|
|
|
return getDaysForwardToWeekday(refDate, weekday) + 7;
|
2022-10-03 09:52:08 +02:00
|
|
|
|
}
|
2023-06-27 17:25:14 +02:00
|
|
|
|
}
|
|
|
|
|
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;
|
|
|
|
|
}
|
2024-10-14 11:01:38 +02:00
|
|
|
|
;// ./node_modules/chrono-node/dist/esm/locales/en/parsers/ENWeekdayParser.js
|
2022-10-03 09:52:08 +02:00
|
|
|
|
|
2020-11-04 22:59:32 +01:00
|
|
|
|
|
2022-10-03 09:52:08 +02:00
|
|
|
|
|
2020-11-04 22:59:32 +01:00
|
|
|
|
|
2023-06-27 17:25:14 +02:00
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-10-14 11:01:38 +02:00
|
|
|
|
;// ./node_modules/chrono-node/dist/esm/locales/en/parsers/ENRelativeDateFormatParser.js
|
2020-11-04 22:59:32 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-06-27 17:25:14 +02:00
|
|
|
|
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());
|
2020-11-04 22:59:32 +01:00
|
|
|
|
}
|
2023-06-27 17:25:14 +02:00
|
|
|
|
return components;
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-10-14 11:01:38 +02:00
|
|
|
|
;// ./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) {
|
|
|
|
|
const index = match.index + match[OPENING_GROUP].length;
|
|
|
|
|
const indexEnd = match.index + match[0].length - match[ENDING_GROUP].length;
|
|
|
|
|
if (index > 0) {
|
|
|
|
|
const textBefore = context.text.substring(0, index);
|
|
|
|
|
if (textBefore.match("\\d/?$")) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (indexEnd < context.text.length) {
|
|
|
|
|
const textAfter = context.text.substring(indexEnd);
|
|
|
|
|
if (textAfter.match("^/?\\d")) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
const text = context.text.substring(index, indexEnd);
|
|
|
|
|
if (text.match(/^\d\.\d$/) || text.match(/^\d\.\d{1,2}\.\d{1,2}\s*$/)) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (!match[SlashDateFormatParser_YEAR_GROUP] && text.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;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
;// ./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]);
|
|
|
|
|
if (!timeUnits) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
switch (prefix) {
|
|
|
|
|
case "last":
|
|
|
|
|
case "past":
|
|
|
|
|
case "-":
|
|
|
|
|
timeUnits = reverseTimeUnits(timeUnits);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
return results_ParsingComponents.createRelativeFromReference(context.reference, timeUnits);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
;// ./node_modules/chrono-node/dist/esm/locales/en/refiners/ENMergeRelativeAfterDateRefiner.js
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function IsPositiveFollowingReference(result) {
|
|
|
|
|
return result.text.match(/^[+-]/i) != null;
|
|
|
|
|
}
|
|
|
|
|
function IsNegativeFollowingReference(result) {
|
|
|
|
|
return result.text.match(/^-/i) != null;
|
|
|
|
|
}
|
|
|
|
|
class ENMergeRelativeAfterDateRefiner extends MergingRefiner {
|
|
|
|
|
shouldMergeResults(textBetween, currentResult, nextResult) {
|
|
|
|
|
if (!textBetween.match(/^\s*$/i)) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
return IsPositiveFollowingReference(nextResult) || IsNegativeFollowingReference(nextResult);
|
|
|
|
|
}
|
|
|
|
|
mergeResults(textBetween, currentResult, nextResult, context) {
|
|
|
|
|
let timeUnits = parseTimeUnits(nextResult.text);
|
|
|
|
|
if (IsNegativeFollowingReference(nextResult)) {
|
|
|
|
|
timeUnits = reverseTimeUnits(timeUnits);
|
|
|
|
|
}
|
|
|
|
|
const components = results_ParsingComponents.createRelativeFromReference(new ReferenceWithTimezone(currentResult.start.date()), timeUnits);
|
|
|
|
|
return new ParsingResult(currentResult.reference, currentResult.index, `${currentResult.text}${textBetween}${nextResult.text}`, components);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
;// ./node_modules/chrono-node/dist/esm/locales/en/refiners/ENMergeRelativeFollowByDateRefiner.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 ENMergeRelativeFollowByDateRefiner 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);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
;// ./node_modules/chrono-node/dist/esm/locales/en/refiners/ENExtractYearSuffixRefiner.js
|
|
|
|
|
|
|
|
|
|
const YEAR_SUFFIX_PATTERN = new RegExp(`^\\s*(${YEAR_PATTERN})`, "i");
|
|
|
|
|
const ENExtractYearSuffixRefiner_YEAR_GROUP = 1;
|
|
|
|
|
class ENExtractYearSuffixRefiner {
|
|
|
|
|
refine(context, results) {
|
|
|
|
|
results.forEach(function (result) {
|
|
|
|
|
if (!result.start.isDateWithUnknownYear()) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
const suffix = context.text.substring(result.index + result.text.length);
|
|
|
|
|
const match = YEAR_SUFFIX_PATTERN.exec(suffix);
|
|
|
|
|
if (!match) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
context.debug(() => {
|
|
|
|
|
console.log(`Extracting year: '${match[0]}' into : ${result}`);
|
|
|
|
|
});
|
|
|
|
|
const year = parseYear(match[ENExtractYearSuffixRefiner_YEAR_GROUP]);
|
|
|
|
|
if (result.end != null) {
|
|
|
|
|
result.end.assign("year", year);
|
|
|
|
|
}
|
|
|
|
|
result.start.assign("year", year);
|
|
|
|
|
result.text += match[0];
|
|
|
|
|
});
|
|
|
|
|
return results;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
;// ./node_modules/chrono-node/dist/esm/locales/en/configuration.js
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ENDefaultConfiguration {
|
|
|
|
|
createCasualConfiguration(littleEndian = false) {
|
|
|
|
|
const option = this.createConfiguration(false, littleEndian);
|
|
|
|
|
option.parsers.push(new ENCasualDateParser());
|
|
|
|
|
option.parsers.push(new ENCasualTimeParser());
|
|
|
|
|
option.parsers.push(new ENMonthNameParser());
|
|
|
|
|
option.parsers.push(new ENRelativeDateFormatParser());
|
|
|
|
|
option.parsers.push(new ENTimeUnitCasualRelativeFormatParser());
|
|
|
|
|
return option;
|
|
|
|
|
}
|
|
|
|
|
createConfiguration(strictMode = true, littleEndian = false) {
|
|
|
|
|
const options = includeCommonConfiguration({
|
|
|
|
|
parsers: [new SlashDateFormatParser(littleEndian), new ENTimeUnitWithinFormatParser(strictMode), new ENMonthNameLittleEndianParser(), new ENMonthNameMiddleEndianParser(littleEndian), new ENWeekdayParser(), new ENSlashMonthFormatParser(), new ENTimeExpressionParser(strictMode), new ENTimeUnitAgoFormatParser(strictMode), new ENTimeUnitLaterFormatParser(strictMode)],
|
|
|
|
|
refiners: [new ENMergeDateTimeRefiner()]
|
|
|
|
|
}, strictMode);
|
|
|
|
|
options.parsers.unshift(new ENYearMonthDayParser(strictMode));
|
|
|
|
|
options.refiners.unshift(new ENMergeRelativeFollowByDateRefiner());
|
|
|
|
|
options.refiners.unshift(new ENMergeRelativeAfterDateRefiner());
|
|
|
|
|
options.refiners.unshift(new OverlapRemovalRefiner());
|
|
|
|
|
options.refiners.push(new ENMergeDateTimeRefiner());
|
|
|
|
|
options.refiners.push(new ENExtractYearSuffixRefiner());
|
|
|
|
|
options.refiners.push(new ENMergeDateRangeRefiner());
|
|
|
|
|
return options;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
;// ./node_modules/chrono-node/dist/esm/chrono.js
|
2020-11-04 22:59:32 +01:00
|
|
|
|
|
|
|
|
|
|
2023-06-27 17:25:14 +02:00
|
|
|
|
class Chrono {
|
|
|
|
|
constructor(configuration) {
|
2024-10-14 11:01:38 +02:00
|
|
|
|
this.defaultConfig = new ENDefaultConfiguration();
|
|
|
|
|
configuration = configuration || this.defaultConfig.createCasualConfiguration();
|
2023-06-27 17:25:14 +02:00
|
|
|
|
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);
|
2021-08-27 18:14:41 +02:00
|
|
|
|
continue;
|
|
|
|
|
}
|
2023-06-27 17:25:14 +02:00
|
|
|
|
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);
|
2022-10-03 09:52:08 +02:00
|
|
|
|
}
|
2024-10-14 11:01:38 +02:00
|
|
|
|
const parsedIndex = parsedResult.index;
|
|
|
|
|
const parsedText = parsedResult.text;
|
|
|
|
|
context.debug(() => console.log(`${parser.constructor.name} extracted (at index=${parsedIndex}) '${parsedText}'`));
|
2023-06-27 17:25:14 +02:00
|
|
|
|
results.push(parsedResult);
|
2024-10-14 11:01:38 +02:00
|
|
|
|
remainingText = originalText.substring(parsedIndex + parsedText.length);
|
2023-06-27 17:25:14 +02:00
|
|
|
|
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);
|
2022-10-03 09:52:08 +02:00
|
|
|
|
}
|
2023-06-27 17:25:14 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-10-14 11:01:38 +02:00
|
|
|
|
;// ./node_modules/chrono-node/dist/esm/locales/en/index.js
|
2020-11-04 22:59:32 +01:00
|
|
|
|
|
2021-08-27 18:14:41 +02:00
|
|
|
|
|
2020-11-02 15:34:34 +01:00
|
|
|
|
|
2020-11-04 22:59:32 +01:00
|
|
|
|
|
2022-03-31 12:21:33 +02:00
|
|
|
|
|
|
|
|
|
|
2024-10-14 11:01:38 +02:00
|
|
|
|
const configuration = new ENDefaultConfiguration();
|
|
|
|
|
const casual = new Chrono(configuration.createCasualConfiguration(false));
|
|
|
|
|
const strict = new Chrono(configuration.createConfiguration(true, false));
|
|
|
|
|
const GB = new Chrono(configuration.createCasualConfiguration(true));
|
2023-06-27 17:25:14 +02:00
|
|
|
|
function parse(text, ref, option) {
|
|
|
|
|
return casual.parse(text, ref, option);
|
|
|
|
|
}
|
|
|
|
|
function parseDate(text, ref, option) {
|
|
|
|
|
return casual.parseDate(text, ref, option);
|
|
|
|
|
}
|
2024-10-14 11:01:38 +02:00
|
|
|
|
;// ./node_modules/chrono-node/dist/esm/index.js
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-10-03 09:52:08 +02:00
|
|
|
|
|
2020-11-04 13:05:34 +01:00
|
|
|
|
|
|
|
|
|
|
2020-11-04 22:59:32 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-08-27 18:14:41 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-11-04 22:59:32 +01:00
|
|
|
|
|
|
|
|
|
|
2023-06-27 17:25:14 +02:00
|
|
|
|
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);
|
|
|
|
|
}
|
2024-10-14 11:01:38 +02:00
|
|
|
|
;// ./node_modules/chrono-node/dist/esm/locales/de/parsers/DETimeExpressionParser.js
|
2020-11-04 22:59:32 +01:00
|
|
|
|
|
2023-06-27 17:25:14 +02:00
|
|
|
|
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;
|
2021-08-27 18:14:41 +02:00
|
|
|
|
}
|
2023-06-27 17:25:14 +02:00
|
|
|
|
return super.extractPrimaryTimeComponents(context, match);
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-10-14 11:01:38 +02:00
|
|
|
|
;// ./node_modules/chrono-node/dist/esm/locales/de/constants.js
|
2020-11-04 22:59:32 +01:00
|
|
|
|
|
2023-06-27 17:25:14 +02:00
|
|
|
|
|
|
|
|
|
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, ""));
|
2021-08-27 18:14:41 +02:00
|
|
|
|
}
|
2023-06-27 17:25:14 +02:00
|
|
|
|
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;
|
2021-08-27 18:14:41 +02:00
|
|
|
|
}
|
2023-06-27 17:25:14 +02:00
|
|
|
|
function constants_collectDateTimeFragment(fragments, match) {
|
|
|
|
|
const num = constants_parseNumberPattern(match[1]);
|
|
|
|
|
const unit = constants_TIME_UNIT_DICTIONARY[match[2].toLowerCase()];
|
|
|
|
|
fragments[unit] = num;
|
|
|
|
|
}
|
2024-10-14 11:01:38 +02:00
|
|
|
|
;// ./node_modules/chrono-node/dist/esm/locales/de/parsers/DEWeekdayParser.js
|
2021-08-27 18:14:41 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-06-27 17:25:14 +02:00
|
|
|
|
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);
|
|
|
|
|
}
|
2022-10-03 09:52:08 +02:00
|
|
|
|
}
|
2024-10-14 11:01:38 +02:00
|
|
|
|
;// ./node_modules/chrono-node/dist/esm/locales/de/parsers/DESpecificTimeExpressionParser.js
|
2021-08-27 18:14:41 +02:00
|
|
|
|
|
2023-06-27 17:25:14 +02:00
|
|
|
|
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;
|
2022-10-03 09:52:08 +02:00
|
|
|
|
}
|
2023-06-27 17:25:14 +02:00
|
|
|
|
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];
|
2022-10-03 09:52:08 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
2023-06-27 17:25:14 +02:00
|
|
|
|
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) {
|
2024-10-14 11:01:38 +02:00
|
|
|
|
meridiem = types_Meridiem.PM;
|
2023-06-27 17:25:14 +02:00
|
|
|
|
}
|
|
|
|
|
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/)) {
|
2024-10-14 11:01:38 +02:00
|
|
|
|
meridiem = types_Meridiem.AM;
|
2023-06-27 17:25:14 +02:00
|
|
|
|
if (hour == 12) {
|
|
|
|
|
hour = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (ampm.match(/nachmittag|abend/)) {
|
2024-10-14 11:01:38 +02:00
|
|
|
|
meridiem = types_Meridiem.PM;
|
2023-06-27 17:25:14 +02:00
|
|
|
|
if (hour != 12) {
|
|
|
|
|
hour += 12;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (ampm.match(/nacht/)) {
|
|
|
|
|
if (hour == 12) {
|
2024-10-14 11:01:38 +02:00
|
|
|
|
meridiem = types_Meridiem.AM;
|
2023-06-27 17:25:14 +02:00
|
|
|
|
hour = 0;
|
|
|
|
|
} else if (hour < 6) {
|
2024-10-14 11:01:38 +02:00
|
|
|
|
meridiem = types_Meridiem.AM;
|
2023-06-27 17:25:14 +02:00
|
|
|
|
} else {
|
2024-10-14 11:01:38 +02:00
|
|
|
|
meridiem = types_Meridiem.PM;
|
2023-06-27 17:25:14 +02:00
|
|
|
|
hour += 12;
|
|
|
|
|
}
|
2022-10-03 09:52:08 +02:00
|
|
|
|
}
|
2020-11-04 22:59:32 +01:00
|
|
|
|
}
|
2023-06-27 17:25:14 +02:00
|
|
|
|
extractingComponents.assign("hour", hour);
|
|
|
|
|
extractingComponents.assign("minute", minute);
|
|
|
|
|
if (meridiem !== null) {
|
|
|
|
|
extractingComponents.assign("meridiem", meridiem);
|
|
|
|
|
} else {
|
|
|
|
|
if (hour < 12) {
|
2024-10-14 11:01:38 +02:00
|
|
|
|
extractingComponents.imply("meridiem", types_Meridiem.AM);
|
2023-06-27 17:25:14 +02:00
|
|
|
|
} else {
|
2024-10-14 11:01:38 +02:00
|
|
|
|
extractingComponents.imply("meridiem", types_Meridiem.PM);
|
2023-06-27 17:25:14 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (match[DESpecificTimeExpressionParser_SECOND_GROUP] != null) {
|
|
|
|
|
const second = parseInt(match[DESpecificTimeExpressionParser_SECOND_GROUP]);
|
|
|
|
|
if (second >= 60) return null;
|
|
|
|
|
extractingComponents.assign("second", second);
|
|
|
|
|
}
|
|
|
|
|
return extractingComponents;
|
2021-08-27 18:14:41 +02:00
|
|
|
|
}
|
2020-11-04 22:59:32 +01:00
|
|
|
|
}
|
2024-10-14 11:01:38 +02:00
|
|
|
|
;// ./node_modules/chrono-node/dist/esm/locales/de/refiners/DEMergeDateRangeRefiner.js
|
2022-10-03 09:52:08 +02:00
|
|
|
|
|
2023-06-27 17:25:14 +02:00
|
|
|
|
class DEMergeDateRangeRefiner extends AbstractMergeDateRangeRefiner {
|
|
|
|
|
patternBetween() {
|
|
|
|
|
return /^\s*(bis(?:\s*(?:am|zum))?|-)\s*$/i;
|
2021-08-27 18:14:41 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
2024-10-14 11:01:38 +02:00
|
|
|
|
;// ./node_modules/chrono-node/dist/esm/locales/de/refiners/DEMergeDateTimeRefiner.js
|
2022-10-03 09:52:08 +02:00
|
|
|
|
|
2023-06-27 17:25:14 +02:00
|
|
|
|
class DEMergeDateTimeRefiner extends AbstractMergeDateTimeRefiner {
|
|
|
|
|
patternBetween() {
|
|
|
|
|
return new RegExp("^\\s*(T|um|am|,|-)?\\s*$");
|
|
|
|
|
}
|
2022-10-03 09:52:08 +02:00
|
|
|
|
}
|
2024-10-14 11:01:38 +02:00
|
|
|
|
;// ./node_modules/chrono-node/dist/esm/locales/de/parsers/DECasualTimeParser.js
|
2021-08-27 18:14:41 +02:00
|
|
|
|
|
2020-11-04 22:59:32 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-08-27 18:14:41 +02:00
|
|
|
|
|
2023-06-27 17:25:14 +02:00
|
|
|
|
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);
|
2024-10-14 11:01:38 +02:00
|
|
|
|
component.imply("meridiem", types_Meridiem.AM);
|
2023-06-27 17:25:14 +02:00
|
|
|
|
break;
|
|
|
|
|
case "vormittag":
|
|
|
|
|
component.imply("hour", 9);
|
|
|
|
|
component.imply("minute", 0);
|
|
|
|
|
component.imply("second", 0);
|
2024-10-14 11:01:38 +02:00
|
|
|
|
component.imply("meridiem", types_Meridiem.AM);
|
2023-06-27 17:25:14 +02:00
|
|
|
|
break;
|
|
|
|
|
case "mittag":
|
|
|
|
|
case "mittags":
|
|
|
|
|
component.imply("hour", 12);
|
|
|
|
|
component.imply("minute", 0);
|
|
|
|
|
component.imply("second", 0);
|
2024-10-14 11:01:38 +02:00
|
|
|
|
component.imply("meridiem", types_Meridiem.AM);
|
2023-06-27 17:25:14 +02:00
|
|
|
|
break;
|
|
|
|
|
case "nachmittag":
|
|
|
|
|
component.imply("hour", 15);
|
|
|
|
|
component.imply("minute", 0);
|
|
|
|
|
component.imply("second", 0);
|
2024-10-14 11:01:38 +02:00
|
|
|
|
component.imply("meridiem", types_Meridiem.PM);
|
2023-06-27 17:25:14 +02:00
|
|
|
|
break;
|
|
|
|
|
case "abend":
|
|
|
|
|
component.imply("hour", 18);
|
|
|
|
|
component.imply("minute", 0);
|
|
|
|
|
component.imply("second", 0);
|
2024-10-14 11:01:38 +02:00
|
|
|
|
component.imply("meridiem", types_Meridiem.PM);
|
2023-06-27 17:25:14 +02:00
|
|
|
|
break;
|
|
|
|
|
case "nacht":
|
|
|
|
|
component.imply("hour", 22);
|
|
|
|
|
component.imply("minute", 0);
|
|
|
|
|
component.imply("second", 0);
|
2024-10-14 11:01:38 +02:00
|
|
|
|
component.imply("meridiem", types_Meridiem.PM);
|
2023-06-27 17:25:14 +02:00
|
|
|
|
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);
|
2024-10-14 11:01:38 +02:00
|
|
|
|
component.imply("meridiem", types_Meridiem.AM);
|
2023-06-27 17:25:14 +02:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
return component;
|
2021-08-27 18:14:41 +02:00
|
|
|
|
}
|
2020-11-04 22:59:32 +01:00
|
|
|
|
}
|
2024-10-14 11:01:38 +02:00
|
|
|
|
;// ./node_modules/chrono-node/dist/esm/locales/de/parsers/DECasualDateParser.js
|
2020-11-04 22:59:32 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-08-27 18:14:41 +02:00
|
|
|
|
|
|
|
|
|
|
2023-06-27 17:25:14 +02:00
|
|
|
|
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;
|
2021-08-27 18:14:41 +02:00
|
|
|
|
}
|
2023-06-27 17:25:14 +02:00
|
|
|
|
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;
|
2022-10-03 09:52:08 +02:00
|
|
|
|
}
|
2023-06-27 17:25:14 +02:00
|
|
|
|
}
|
2024-10-14 11:01:38 +02:00
|
|
|
|
;// ./node_modules/chrono-node/dist/esm/locales/de/parsers/DEMonthNameLittleEndianParser.js
|
2020-11-04 22:59:32 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-10-03 09:52:08 +02:00
|
|
|
|
|
2020-11-04 22:59:32 +01:00
|
|
|
|
|
2023-06-27 17:25:14 +02:00
|
|
|
|
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;
|
2022-10-03 09:52:08 +02:00
|
|
|
|
}
|
2023-06-27 17:25:14 +02:00
|
|
|
|
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;
|
2022-10-03 09:52:08 +02:00
|
|
|
|
}
|
2023-06-27 17:25:14 +02:00
|
|
|
|
}
|
2024-10-14 11:01:38 +02:00
|
|
|
|
;// ./node_modules/chrono-node/dist/esm/locales/de/parsers/DETimeUnitRelativeFormatParser.js
|
2022-10-03 09:52:08 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-11-04 22:59:32 +01:00
|
|
|
|
|
|
|
|
|
|
2023-06-27 17:25:14 +02:00
|
|
|
|
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);
|
|
|
|
|
}
|
2022-10-03 09:52:08 +02:00
|
|
|
|
}
|
2024-10-14 11:01:38 +02:00
|
|
|
|
;// ./node_modules/chrono-node/dist/esm/locales/de/parsers/DETimeUnitWithinFormatParser.js
|
2022-10-03 09:52:08 +02:00
|
|
|
|
|
2020-11-04 22:59:32 +01:00
|
|
|
|
|
2023-06-27 17:25:14 +02:00
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
}
|
2022-10-03 09:52:08 +02:00
|
|
|
|
}
|
2024-10-14 11:01:38 +02:00
|
|
|
|
;// ./node_modules/chrono-node/dist/esm/locales/de/index.js
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-06-27 17:25:14 +02:00
|
|
|
|
|
2020-11-04 22:59:32 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-10-03 09:52:08 +02:00
|
|
|
|
|
2020-11-04 22:59:32 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-10-03 09:52:08 +02:00
|
|
|
|
|
2020-11-04 22:59:32 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-10-14 11:01:38 +02:00
|
|
|
|
|
|
|
|
|
const de_casual = new Chrono(createCasualConfiguration());
|
|
|
|
|
const de_strict = new Chrono(createConfiguration(true));
|
2023-06-27 17:25:14 +02:00
|
|
|
|
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);
|
|
|
|
|
}
|
2024-10-14 11:01:38 +02:00
|
|
|
|
function createCasualConfiguration(littleEndian = true) {
|
|
|
|
|
const option = createConfiguration(false, littleEndian);
|
2023-06-27 17:25:14 +02:00
|
|
|
|
option.parsers.unshift(new DECasualTimeParser());
|
|
|
|
|
option.parsers.unshift(new DECasualDateParser());
|
|
|
|
|
option.parsers.unshift(new DETimeUnitAgoFormatParser());
|
|
|
|
|
return option;
|
|
|
|
|
}
|
2024-10-14 11:01:38 +02:00
|
|
|
|
function createConfiguration(strictMode = true, littleEndian = true) {
|
2023-06-27 17:25:14 +02:00
|
|
|
|
return includeCommonConfiguration({
|
|
|
|
|
parsers: [new ISOFormatParser(), new SlashDateFormatParser(littleEndian), new DETimeExpressionParser(), new DESpecificTimeExpressionParser(), new DEMonthNameLittleEndianParser(), new DEWeekdayParser(), new DETimeUnitWithinFormatParser()],
|
|
|
|
|
refiners: [new DEMergeDateRangeRefiner(), new DEMergeDateTimeRefiner()]
|
|
|
|
|
}, strictMode);
|
|
|
|
|
}
|
2024-10-14 11:01:38 +02:00
|
|
|
|
;// ./src/utils.ts
|
2023-06-27 17:25:14 +02:00
|
|
|
|
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);
|
|
|
|
|
}
|
2020-11-04 22:59:32 +01:00
|
|
|
|
|
2024-10-14 11:50:06 +02:00
|
|
|
|
;// ./src/gm-fetch/utils.ts
|
2024-10-14 11:01:38 +02:00
|
|
|
|
function parseRawHeaders(h) {
|
|
|
|
|
const s = h.trim();
|
|
|
|
|
if (!s) {
|
|
|
|
|
return new Headers();
|
|
|
|
|
}
|
|
|
|
|
const array = s.split("\r\n").map((value) => {
|
|
|
|
|
let s = value.split(":");
|
|
|
|
|
return [s[0].trim(), s[1].trim()];
|
2023-06-27 17:25:14 +02:00
|
|
|
|
});
|
2024-10-14 11:01:38 +02:00
|
|
|
|
return new Headers(array);
|
|
|
|
|
}
|
|
|
|
|
function parseGMResponse(req, res) {
|
|
|
|
|
return new ResImpl(res.response, {
|
|
|
|
|
statusCode: res.status,
|
|
|
|
|
statusText: res.statusText,
|
|
|
|
|
headers: parseRawHeaders(res.responseHeaders),
|
|
|
|
|
finalUrl: res.finalUrl,
|
|
|
|
|
redirected: res.finalUrl === req.url,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
class ResImpl {
|
2024-10-14 11:50:06 +02:00
|
|
|
|
_bodyUsed;
|
|
|
|
|
rawBody;
|
|
|
|
|
init;
|
|
|
|
|
body;
|
|
|
|
|
headers;
|
|
|
|
|
redirected;
|
|
|
|
|
status;
|
|
|
|
|
statusText;
|
|
|
|
|
type;
|
|
|
|
|
url;
|
2024-10-14 11:01:38 +02:00
|
|
|
|
constructor(body, init) {
|
|
|
|
|
this.rawBody = body;
|
|
|
|
|
this.init = init;
|
2024-10-14 11:50:06 +02:00
|
|
|
|
//this.body = toReadableStream(body);
|
2024-10-14 11:01:38 +02:00
|
|
|
|
const { headers, statusCode, statusText, finalUrl, redirected } = init;
|
|
|
|
|
this.headers = headers;
|
|
|
|
|
this.status = statusCode;
|
|
|
|
|
this.statusText = statusText;
|
|
|
|
|
this.url = finalUrl;
|
|
|
|
|
this.type = "basic";
|
|
|
|
|
this.redirected = redirected;
|
|
|
|
|
this._bodyUsed = false;
|
|
|
|
|
}
|
|
|
|
|
get bodyUsed() {
|
|
|
|
|
return this._bodyUsed;
|
|
|
|
|
}
|
|
|
|
|
get ok() {
|
|
|
|
|
return this.status < 300;
|
|
|
|
|
}
|
|
|
|
|
arrayBuffer() {
|
|
|
|
|
if (this.bodyUsed) {
|
|
|
|
|
throw new TypeError("Failed to execute 'arrayBuffer' on 'Response': body stream already read");
|
|
|
|
|
}
|
|
|
|
|
this._bodyUsed = true;
|
|
|
|
|
return this.rawBody.arrayBuffer();
|
|
|
|
|
}
|
|
|
|
|
blob() {
|
|
|
|
|
if (this.bodyUsed) {
|
|
|
|
|
throw new TypeError("Failed to execute 'blob' on 'Response': body stream already read");
|
|
|
|
|
}
|
|
|
|
|
this._bodyUsed = true;
|
|
|
|
|
// `slice` will use empty string as default value, so need to pass all arguments.
|
|
|
|
|
return Promise.resolve(this.rawBody.slice(0, this.rawBody.size, this.rawBody.type));
|
|
|
|
|
}
|
|
|
|
|
clone() {
|
|
|
|
|
if (this.bodyUsed) {
|
|
|
|
|
throw new TypeError("Failed to execute 'clone' on 'Response': body stream already read");
|
|
|
|
|
}
|
|
|
|
|
return new ResImpl(this.rawBody, this.init);
|
|
|
|
|
}
|
|
|
|
|
formData() {
|
|
|
|
|
if (this.bodyUsed) {
|
|
|
|
|
throw new TypeError("Failed to execute 'formData' on 'Response': body stream already read");
|
|
|
|
|
}
|
|
|
|
|
this._bodyUsed = true;
|
|
|
|
|
return this.rawBody.text().then(decode);
|
|
|
|
|
}
|
|
|
|
|
async json() {
|
|
|
|
|
if (this.bodyUsed) {
|
|
|
|
|
throw new TypeError("Failed to execute 'json' on 'Response': body stream already read");
|
|
|
|
|
}
|
|
|
|
|
this._bodyUsed = true;
|
|
|
|
|
return JSON.parse(await this.rawBody.text());
|
|
|
|
|
}
|
|
|
|
|
text() {
|
|
|
|
|
if (this.bodyUsed) {
|
|
|
|
|
throw new TypeError("Failed to execute 'text' on 'Response': body stream already read");
|
|
|
|
|
}
|
|
|
|
|
this._bodyUsed = true;
|
|
|
|
|
return this.rawBody.text();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
function decode(body) {
|
|
|
|
|
const form = new FormData();
|
|
|
|
|
body
|
|
|
|
|
.trim()
|
|
|
|
|
.split("&")
|
|
|
|
|
.forEach(function (bytes) {
|
|
|
|
|
if (bytes) {
|
|
|
|
|
const split = bytes.split("=");
|
|
|
|
|
const name = split.shift()?.replace(/\+/g, " ");
|
|
|
|
|
const value = split.join("=").replace(/\+/g, " ");
|
|
|
|
|
form.append(decodeURIComponent(name), decodeURIComponent(value));
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
return form;
|
|
|
|
|
}
|
2024-10-14 11:50:06 +02:00
|
|
|
|
/*
|
|
|
|
|
function toReadableStream(value: Blob) {
|
|
|
|
|
return new ReadableStream({
|
|
|
|
|
start(controller) {
|
|
|
|
|
controller.enqueue(value);
|
|
|
|
|
controller.close();
|
|
|
|
|
},
|
|
|
|
|
});
|
2024-10-14 11:01:38 +02:00
|
|
|
|
}
|
2024-10-14 11:50:06 +02:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
;// ./src/gm-fetch/index.ts
|
2024-10-14 11:01:38 +02:00
|
|
|
|
|
|
|
|
|
async function GM_fetch(input, init) {
|
|
|
|
|
const request = new Request(input, init);
|
|
|
|
|
let data;
|
|
|
|
|
if (init?.body) {
|
|
|
|
|
data = await request.text();
|
|
|
|
|
}
|
|
|
|
|
return await XHR(request, init, data);
|
|
|
|
|
}
|
|
|
|
|
function XHR(request, init, data) {
|
|
|
|
|
return new Promise((resolve, reject) => {
|
|
|
|
|
if (request.signal && request.signal.aborted) {
|
|
|
|
|
return reject(new DOMException("Aborted", "AbortError"));
|
|
|
|
|
}
|
|
|
|
|
GM.xmlHttpRequest({
|
|
|
|
|
url: request.url,
|
|
|
|
|
method: gmXHRMethod(request.method.toUpperCase()),
|
|
|
|
|
headers: Object.fromEntries(new Headers(init?.headers).entries()),
|
|
|
|
|
data: data,
|
|
|
|
|
responseType: "blob",
|
|
|
|
|
onload(res) {
|
|
|
|
|
resolve(parseGMResponse(request, res));
|
|
|
|
|
},
|
|
|
|
|
onabort() {
|
|
|
|
|
reject(new DOMException("Aborted", "AbortError"));
|
|
|
|
|
},
|
|
|
|
|
ontimeout() {
|
|
|
|
|
reject(new TypeError("Network request failed, timeout"));
|
|
|
|
|
},
|
|
|
|
|
onerror(err) {
|
|
|
|
|
reject(new TypeError("Failed to fetch: " + err.finalUrl));
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
const httpMethods = ["GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", "TRACE", "OPTIONS", "CONNECT"];
|
|
|
|
|
// a ts type helper to narrow type
|
|
|
|
|
function includes(array, element) {
|
|
|
|
|
return array.includes(element);
|
|
|
|
|
}
|
|
|
|
|
function gmXHRMethod(method) {
|
|
|
|
|
if (includes(httpMethods, method)) {
|
|
|
|
|
return method;
|
|
|
|
|
}
|
|
|
|
|
throw new Error(`unsupported http method ${method}`);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
;// ./src/call-history.ts
|
|
|
|
|
|
2023-06-27 17:25:14 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class CallHistory {
|
2024-10-14 11:01:38 +02:00
|
|
|
|
callerIds = {};
|
2023-06-27 17:25:14 +02:00
|
|
|
|
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);
|
|
|
|
|
}
|
2024-10-14 11:01:38 +02:00
|
|
|
|
async showCallHistory(element) {
|
|
|
|
|
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 = await GM_fetch('http://cpatapi.cpsrvweb2016.cp-austria.at/callerid/' + encodeURIComponent(number));
|
|
|
|
|
var callerId = { tD_NAME: '' };
|
|
|
|
|
if (response.status === 200) {
|
|
|
|
|
callerId = await response.json();
|
2023-06-27 17:25:14 +02:00
|
|
|
|
}
|
2024-10-14 11:01:38 +02:00
|
|
|
|
console.log('TAPI call histroy callerid response', number, response, callerId);
|
|
|
|
|
this.callerIds[number] = callerId;
|
|
|
|
|
this.updateCallHistoryEntry(element, callerId);
|
|
|
|
|
}
|
2023-06-27 17:25:14 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
2020-11-04 22:59:32 +01:00
|
|
|
|
|
2024-10-14 11:01:38 +02:00
|
|
|
|
;// ./src/call-notification.ts
|
|
|
|
|
|
2023-06-27 17:25:14 +02:00
|
|
|
|
|
|
|
|
|
class CallNotification {
|
2024-10-14 11:01:38 +02:00
|
|
|
|
async showCallNotification(element) {
|
|
|
|
|
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 = await GM_fetch('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 = await response.json();
|
|
|
|
|
if (callerId) {
|
|
|
|
|
notification.text = callerId.tD_NAME + '\r\n' + number + ' (' + callerId.tD_MEDIUM + ')';
|
2023-06-27 17:25:14 +02:00
|
|
|
|
}
|
2024-10-14 11:01:38 +02:00
|
|
|
|
}
|
|
|
|
|
// eslint-disable-next-line no-undef
|
|
|
|
|
GM.notification(notification.text, 'TAPI Anruf');
|
2023-06-27 17:25:14 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
2020-11-04 22:59:32 +01:00
|
|
|
|
|
2022-03-31 12:21:33 +02:00
|
|
|
|
// 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);
|
2022-10-03 09:52:08 +02:00
|
|
|
|
// 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);
|
2022-03-31 12:21:33 +02:00
|
|
|
|
// 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");
|
2024-10-14 11:01:38 +02:00
|
|
|
|
;// ./src/search.css
|
2022-03-31 12:21:33 +02:00
|
|
|
|
|
2022-10-03 09:52:08 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-03-31 12:21:33 +02:00
|
|
|
|
|
|
|
|
|
var options = {};
|
|
|
|
|
|
2022-10-03 09:52:08 +02:00
|
|
|
|
options.styleTagTransform = (styleTagTransform_default());
|
|
|
|
|
options.setAttributes = (setAttributesWithoutAttributes_default());
|
2024-10-14 11:01:38 +02:00
|
|
|
|
options.insert = insertBySelector_default().bind(null, "head");
|
2022-10-03 09:52:08 +02:00
|
|
|
|
options.domAPI = (styleDomAPI_default());
|
|
|
|
|
options.insertStyleElement = (insertStyleElement_default());
|
2022-03-31 12:21:33 +02:00
|
|
|
|
|
2024-10-14 11:01:38 +02:00
|
|
|
|
var update = injectStylesIntoStyleTag_default()(search/* default */.A, options);
|
2022-03-31 12:21:33 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-10-03 09:52:08 +02:00
|
|
|
|
|
2024-10-14 11:01:38 +02:00
|
|
|
|
/* harmony default export */ const src_search = (search/* default */.A && search/* default */.A.locals ? search/* default */.A.locals : undefined);
|
2022-10-03 09:52:08 +02:00
|
|
|
|
|
2024-10-14 11:01:38 +02:00
|
|
|
|
;// ./src/debounce.js
|
2021-08-27 18:14:41 +02:00
|
|
|
|
function debounce(func, wait) {
|
|
|
|
|
let timeout;
|
2024-10-14 11:01:38 +02:00
|
|
|
|
return function executedFunction(...args) {
|
2021-08-27 18:14:41 +02:00
|
|
|
|
const later = () => {
|
|
|
|
|
clearTimeout(timeout);
|
|
|
|
|
func(...args);
|
|
|
|
|
};
|
|
|
|
|
clearTimeout(timeout);
|
|
|
|
|
timeout = setTimeout(later, wait);
|
|
|
|
|
};
|
2020-11-04 22:59:32 +01:00
|
|
|
|
}
|
2024-10-14 11:01:38 +02:00
|
|
|
|
;// ./src/search.ts
|
|
|
|
|
|
2023-06-27 17:25:14 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Search {
|
2024-10-14 11:01:38 +02:00
|
|
|
|
currentSearchText = '';
|
2023-06-27 17:25:14 +02:00
|
|
|
|
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();
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-10-14 11:01:38 +02:00
|
|
|
|
doSearch = debounce(async () => {
|
|
|
|
|
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 = await GM_fetch('http://cpatapi.cpsrvweb2016.cp-austria.at/search?query=' + encodeURIComponent(searchText));
|
|
|
|
|
console.log('TAPI Search response', response);
|
|
|
|
|
var contacts = await response.json();
|
|
|
|
|
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);
|
2023-06-27 17:25:14 +02:00
|
|
|
|
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();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-11-04 22:59:32 +01:00
|
|
|
|
|
2021-08-27 18:14:41 +02:00
|
|
|
|
// 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");
|
2024-10-14 11:01:38 +02:00
|
|
|
|
;// ./src/status.css
|
2020-11-04 22:59:32 +01:00
|
|
|
|
|
2022-10-03 09:52:08 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-11-04 22:59:32 +01:00
|
|
|
|
|
2022-03-31 12:21:33 +02:00
|
|
|
|
var status_options = {};
|
2020-11-04 22:59:32 +01:00
|
|
|
|
|
2022-10-03 09:52:08 +02:00
|
|
|
|
status_options.styleTagTransform = (styleTagTransform_default());
|
|
|
|
|
status_options.setAttributes = (setAttributesWithoutAttributes_default());
|
2024-10-14 11:01:38 +02:00
|
|
|
|
status_options.insert = insertBySelector_default().bind(null, "head");
|
2022-10-03 09:52:08 +02:00
|
|
|
|
status_options.domAPI = (styleDomAPI_default());
|
|
|
|
|
status_options.insertStyleElement = (insertStyleElement_default());
|
2020-11-04 22:59:32 +01:00
|
|
|
|
|
2024-10-14 11:01:38 +02:00
|
|
|
|
var status_update = injectStylesIntoStyleTag_default()(cjs_js_src_status/* default */.A, status_options);
|
2020-11-04 13:05:34 +01:00
|
|
|
|
|
2020-11-04 22:59:32 +01:00
|
|
|
|
|
|
|
|
|
|
2022-10-03 09:52:08 +02:00
|
|
|
|
|
2024-10-14 11:01:38 +02:00
|
|
|
|
/* harmony default export */ const src_status = (cjs_js_src_status/* default */.A && cjs_js_src_status/* default */.A.locals ? cjs_js_src_status/* default */.A.locals : undefined);
|
2022-10-03 09:52:08 +02:00
|
|
|
|
|
2024-10-14 11:01:38 +02:00
|
|
|
|
;// ./src/status.ts
|
2023-06-27 17:25:14 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Status {
|
2024-10-14 11:01:38 +02:00
|
|
|
|
_user;
|
|
|
|
|
_enabled = false;
|
|
|
|
|
_statusOn = 'menuAvailable';
|
|
|
|
|
_statusOff = 'menuAway';
|
|
|
|
|
_currentStatus = undefined;
|
|
|
|
|
async showStatus(element) {
|
|
|
|
|
this._user = await GM.getValue('tapi-zc-user', '');
|
|
|
|
|
this._enabled = await GM.getValue('tapi-zc-enabled', false);
|
|
|
|
|
this._statusOn = await GM.getValue('tapi-zc-on', 'menuAvailable');
|
|
|
|
|
this._statusOff = await 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);
|
|
|
|
|
}
|
|
|
|
|
async checkStatus() {
|
|
|
|
|
if (this._enabled) {
|
|
|
|
|
try {
|
|
|
|
|
var response = await GM_fetch('http://cpatapi.cpsrvweb2016.cp-austria.at/availability/' + encodeURIComponent(this._user));
|
|
|
|
|
if (response.status == 200) {
|
|
|
|
|
var status = await response.json();
|
|
|
|
|
if (this._currentStatus !== status.loggedIn) {
|
|
|
|
|
this._currentStatus = status.loggedIn;
|
|
|
|
|
console.log('New status, loggedIn', this._currentStatus);
|
|
|
|
|
var accMenu = document.getElementsByTagName("wc-account-menu")[0];
|
|
|
|
|
var avatar = accMenu.getElementsByTagName("app-avatar")[0];
|
|
|
|
|
avatar.click();
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
var statusId = this._currentStatus ? this._statusOn : this._statusOff;
|
|
|
|
|
console.log('Clicking status', statusId);
|
|
|
|
|
document.getElementById(statusId).click();
|
|
|
|
|
}, 1000);
|
2023-06-27 17:25:14 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-10-14 11:01:38 +02:00
|
|
|
|
catch (error) {
|
|
|
|
|
console.log(error);
|
|
|
|
|
}
|
|
|
|
|
setTimeout(() => this.checkStatus(), 30000);
|
|
|
|
|
}
|
2023-06-27 17:25:14 +02:00
|
|
|
|
}
|
|
|
|
|
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">' +
|
2024-10-14 11:01:38 +02:00
|
|
|
|
' <h4 class="modal-title">ZeitConsens Status</h4><button id="zc-btnClose" type="button" aria-label="Close" class="btn-close" data-qa="modal-cross"></button>' +
|
2023-06-27 17:25:14 +02:00
|
|
|
|
' </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>' +
|
2024-10-14 11:01:38 +02:00
|
|
|
|
' </label>' +
|
|
|
|
|
' </div>' +
|
2023-06-27 17:25:14 +02:00
|
|
|
|
' </div>' +
|
2024-10-14 11:01:38 +02:00
|
|
|
|
//' <div class="modal-footer">' +
|
|
|
|
|
//' <button id="zc-btnOk" type="button" class="btn btn-primary" data-qa="modal-ok">OK </button>' +
|
|
|
|
|
//' <button id="zc-btnCancel" type="button" class="btn btn-border" data-qa="modal-close">Cancel </button>' +
|
|
|
|
|
//' </div>' +
|
2023-06-27 17:25:14 +02:00
|
|
|
|
' </div>' +
|
|
|
|
|
'</div>';
|
|
|
|
|
var modal = document.createElement('modal-container');
|
|
|
|
|
modal.id = 'zc-modal';
|
|
|
|
|
modal.classList.add('modal');
|
|
|
|
|
modal.classList.add('fade');
|
|
|
|
|
modal.innerHTML = html;
|
2024-10-14 11:01:38 +02:00
|
|
|
|
document.getElementsByTagName('body')[0].appendChild(modal);
|
2023-06-27 17:25:14 +02:00
|
|
|
|
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;
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-11-04 22:59:32 +01:00
|
|
|
|
|
2024-10-14 11:01:38 +02:00
|
|
|
|
;// ./src/index.js
|
2021-08-27 18:14:41 +02:00
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
2020-11-04 22:59:32 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-08-27 18:14:41 +02:00
|
|
|
|
console.log('script start');
|
2023-06-27 17:25:14 +02:00
|
|
|
|
const src_search_0 = new Search();
|
|
|
|
|
// eslint-disable-next-line no-undef
|
2021-11-30 14:39:28 +01:00
|
|
|
|
waitForKeyElements('ongoing-call-button', element => {
|
2022-03-31 12:21:33 +02:00
|
|
|
|
src_search_0.createSearchWindow(element);
|
2022-10-03 09:52:08 +02:00
|
|
|
|
}, false);
|
2023-06-27 17:25:14 +02:00
|
|
|
|
const callNotification = new CallNotification();
|
|
|
|
|
// eslint-disable-next-line no-undef
|
2021-08-27 18:14:41 +02:00
|
|
|
|
waitForKeyElements('call-view', element => {
|
|
|
|
|
callNotification.showCallNotification(element);
|
|
|
|
|
}, false);
|
2023-06-27 17:25:14 +02:00
|
|
|
|
const callHistory = new CallHistory();
|
|
|
|
|
// eslint-disable-next-line no-undef
|
2021-08-27 18:14:41 +02:00
|
|
|
|
waitForKeyElements('.call-history-list call', element => {
|
|
|
|
|
callHistory.showCallHistory(element);
|
|
|
|
|
}, false);
|
2023-06-27 17:25:14 +02:00
|
|
|
|
const src_status_0 = new Status();
|
|
|
|
|
// eslint-disable-next-line no-undef
|
2021-11-30 14:39:28 +01:00
|
|
|
|
waitForKeyElements('wc-account-menu', element => {
|
2021-08-27 18:14:41 +02:00
|
|
|
|
src_status_0.showStatus(element);
|
|
|
|
|
}, false);
|
2023-06-27 17:25:14 +02:00
|
|
|
|
})();
|
|
|
|
|
|
2021-08-27 18:14:41 +02:00
|
|
|
|
/******/ })()
|
|
|
|
|
;
|