@belonguniverseai/react-sdk 0.6.19 → 0.6.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/client.d.ts +83 -5
- package/dist/api/questions.d.ts +2 -6
- package/dist/component/{abnfDiagram-N423BO3Z-p8pf1oUu.js → abnfDiagram-N423BO3Z-DZRUOUZQ.js} +4 -4
- package/dist/component/{arc-CDN3jDNB.js → arc-B4biduil.js} +2 -2
- package/dist/component/{architectureDiagram-T3A2C74G-Dd8FlfDW.js → architectureDiagram-T3A2C74G-q8voStNN.js} +3 -3
- package/dist/component/{blockDiagram-VBNYF7ZC-CUgNh_GL.js → blockDiagram-VBNYF7ZC-C0TDyTgw.js} +4 -4
- package/dist/component/{c4Diagram-5PPSVZJV-CSjftNi_.js → c4Diagram-5PPSVZJV-rxRyd6rh.js} +3 -3
- package/dist/component/{channel-RXp4rUai.js → channel-CUruDJSx.js} +2 -2
- package/dist/component/{chunk-2GRJ4B5K-Conm-Udw.js → chunk-2GRJ4B5K-Kff5Fvbi.js} +2 -2
- package/dist/component/{chunk-2Q5K7J3B-BJVcNqca.js → chunk-2Q5K7J3B-BT3ZD31a.js} +2 -2
- package/dist/component/{chunk-5RXB4S5H-ClnvuSUP.js → chunk-5RXB4S5H-CYZ36tQD.js} +5 -5
- package/dist/component/{chunk-5VM5RSS4-CZSg676A.js → chunk-5VM5RSS4-BweQRk7u.js} +2 -2
- package/dist/component/{chunk-6Q2QTUOP-d6e2hDQ3.js → chunk-6Q2QTUOP-DHcoXRhe.js} +2 -2
- package/dist/component/{chunk-GF5L2VYU-DMNXiX_5.js → chunk-GF5L2VYU-DtE5ljCc.js} +6 -6
- package/dist/component/{chunk-JWPE2WC7-Be-HKBKg.js → chunk-JWPE2WC7-ClHq4gN2.js} +2 -2
- package/dist/component/{chunk-KBJHAD2P-CSs5ejAq.js → chunk-KBJHAD2P-BeCfHf5W.js} +2 -2
- package/dist/component/{chunk-RYQCIY6F-BM0CmhLz.js → chunk-RYQCIY6F-CuAngwHt.js} +2 -2
- package/dist/component/{chunk-XXDRQBXY-Xj8K5wzT.js → chunk-XXDRQBXY-D9c0CJyR.js} +2 -2
- package/dist/component/{classDiagram-JCYQIIEL-DTZI6cPh.js → classDiagram-JCYQIIEL-DdzIbKj1.js} +3 -3
- package/dist/component/{classDiagram-v2-OCEON4UE-DTZI6cPh.js → classDiagram-v2-OCEON4UE-DdzIbKj1.js} +3 -3
- package/dist/component/{cose-bilkent-JH36ORCC-DaY5o18F.js → cose-bilkent-JH36ORCC-hME9BYGm.js} +2 -2
- package/dist/component/{cynefinDiagram-MW4NZA55-DoTeA4Ye.js → cynefinDiagram-MW4NZA55-BiceKBPh.js} +3 -3
- package/dist/component/{dagre-VZM6K2ZE-CF3eWDN_.js → dagre-VZM6K2ZE-DiPOLAUX.js} +3 -3
- package/dist/component/{diagram-7IWD3JNH-D4CVwoPP.js → diagram-7IWD3JNH-BSDWgxjs.js} +4 -4
- package/dist/component/{diagram-B4RE2ZJO-DTk-yH1g.js → diagram-B4RE2ZJO-BdpGOPaT.js} +3 -3
- package/dist/component/{diagram-LBJQPF4R-C82NaEDn.js → diagram-LBJQPF4R-B0V6_5ih.js} +3 -3
- package/dist/component/{diagram-Q27KOJAE-DVbW2GPm.js → diagram-Q27KOJAE-CYDb40TJ.js} +4 -4
- package/dist/component/{diagram-UB23O5K3-fLwqL8Hl.js → diagram-UB23O5K3-DgwjRdl5.js} +3 -3
- package/dist/component/{ebnfDiagram-BXEA7PRR-BLEKzcRB.js → ebnfDiagram-BXEA7PRR-D-C7SWec.js} +4 -4
- package/dist/component/{erDiagram-JOGREHBK-D9srj1qV.js → erDiagram-JOGREHBK-DLJCjcXM.js} +5 -5
- package/dist/component/{flowDiagram-UKHOOZJN-CeyLyzYo.js → flowDiagram-UKHOOZJN-BZfBucKB.js} +7 -7
- package/dist/component/{ganttDiagram-PKOTCBZU-D_wnN-8z.js → ganttDiagram-PKOTCBZU-CxTHmusv.js} +3 -3
- package/dist/component/{gitGraphDiagram-DS77QQ5N-PeHi2KIR.js → gitGraphDiagram-DS77QQ5N-B_dWXxMf.js} +4 -4
- package/dist/component/{highlighted-body-OFNGDK62-CuSKYiPW.js → highlighted-body-OFNGDK62-CQ1ZdhQ-.js} +2 -2
- package/dist/component/{index-Dips44uG.js → index-i49DPVb4.js} +960 -464
- package/dist/component/index.js +2 -2
- package/dist/component/{infoDiagram-6WML65LV-CGnUeTPG.js → infoDiagram-6WML65LV-P4GO-aVw.js} +2 -2
- package/dist/component/{ishikawaDiagram-WSZJBQD7-DhbZTdB_.js → ishikawaDiagram-WSZJBQD7-BMXMrxKI.js} +2 -2
- package/dist/component/{journeyDiagram-NVQOT4AX-DbAZyk3F.js → journeyDiagram-NVQOT4AX-DPdTmxkF.js} +5 -5
- package/dist/component/{kanban-definition-27J2QSJJ-CPIUg4vz.js → kanban-definition-27J2QSJJ-sYw64NrE.js} +3 -3
- package/dist/component/{linear-CpcRfWUV.js → linear-DYjDg3gl.js} +2 -2
- package/dist/component/{mermaid-GHXKKRXX-CnsSyJhK.js → mermaid-GHXKKRXX-DfdCmrs3.js} +31367 -29801
- package/dist/component/{mindmap-definition-FAOFIHXS-RIm66-oB.js → mindmap-definition-FAOFIHXS-UkAbrucA.js} +4 -4
- package/dist/component/{pegDiagram-VL7TDLO6-C6uB8Ash.js → pegDiagram-VL7TDLO6-BGab1it6.js} +4 -4
- package/dist/component/{pieDiagram-7S7Q4E2Y-6m7QqfK3.js → pieDiagram-7S7Q4E2Y-BnY70Pr-.js} +4 -4
- package/dist/component/{quadrantDiagram-CIZ2JOQS-Dge2oJ5y.js → quadrantDiagram-CIZ2JOQS-Cv1bjdQb.js} +3 -3
- package/dist/component/{railroadDiagram-AXF67PYL-DWfg1byS.js → railroadDiagram-AXF67PYL-DJhLbGB_.js} +4 -4
- package/dist/component/{requirementDiagram-LRYGKXZP-C_mrqai9.js → requirementDiagram-LRYGKXZP-CLW3CgbU.js} +4 -4
- package/dist/component/{sankeyDiagram-W5VNT64P-D1MhEv2a.js → sankeyDiagram-W5VNT64P-vnapx0yf.js} +2 -2
- package/dist/component/{sequenceDiagram-SI44F4Z6-mn9it5es.js → sequenceDiagram-SI44F4Z6-I43iQsY0.js} +4 -4
- package/dist/component/{sizeCapture-X5ZJPWSS-Do_vnkJp.js → sizeCapture-X5ZJPWSS-D9LGwwwC.js} +2 -2
- package/dist/component/{stateDiagram-OKZ733FA-Pru5Vhsh.js → stateDiagram-OKZ733FA-BXejMYGk.js} +3 -3
- package/dist/component/{stateDiagram-v2-UEYNNEHI-BvRl8AHY.js → stateDiagram-v2-UEYNNEHI-BP05TJSl.js} +3 -3
- package/dist/component/{swimlanes-SLNWSIFB-CfaY_lmO.js → swimlanes-SLNWSIFB-CfmDVYhs.js} +4 -4
- package/dist/component/{swimlanesDiagram-ULZ7WXOC-BFIfCk31.js → swimlanesDiagram-ULZ7WXOC-DfjQBUfV.js} +3 -3
- package/dist/component/{timeline-definition-Z64GVDOM-BFU8eZDJ.js → timeline-definition-Z64GVDOM-C0BwzTs3.js} +3 -3
- package/dist/component/{vennDiagram-T6HMQDX7-C475K8TJ.js → vennDiagram-T6HMQDX7-CRf8sGBL.js} +2 -2
- package/dist/component/{wardleyDiagram-T6FBY63Y-DZEN3DyJ.js → wardleyDiagram-T6FBY63Y-C2h7TQ4a.js} +3 -3
- package/dist/component/{xychartDiagram-ELKLHX3M-B6MDNNoT.js → xychartDiagram-ELKLHX3M-CBcAwmdF.js} +3 -3
- package/dist/components/ui/badge.d.ts +1 -1
- package/dist/embed/copy.d.ts +1 -0
- package/dist/embed/dev-mode.d.ts +5 -7
- package/dist/embed/locale.d.ts +1 -1
- package/dist/embed/voice/line-run-reader.d.ts +8 -0
- package/dist/embed/voice-call.d.ts +4 -0
- package/dist/i18n/messages/en.d.ts +13 -5
- package/dist/i18n/messages/it.d.ts +3 -0
- package/dist/i18n/messages/surfaces/aiElements.d.ts +52 -0
- package/dist/i18n/messages/surfaces/app.d.ts +18 -0
- package/dist/i18n/messages/surfaces/connectors.d.ts +235 -0
- package/dist/i18n/messages/surfaces/embedMisc.d.ts +45 -0
- package/dist/i18n/messages/surfaces/feedback.d.ts +9 -0
- package/dist/i18n/messages/surfaces/files.d.ts +37 -0
- package/dist/i18n/messages/surfaces/header.d.ts +28 -0
- package/dist/i18n/messages/surfaces/login.d.ts +8 -0
- package/dist/i18n/messages/surfaces/plan.d.ts +17 -0
- package/dist/i18n/messages/surfaces/prompts.d.ts +43 -0
- package/dist/i18n/messages/surfaces/scheduled.d.ts +108 -0
- package/dist/i18n/messages/surfaces/sessions.d.ts +23 -0
- package/dist/i18n/messages/surfaces/stats.d.ts +18 -0
- package/dist/i18n/messages/surfaces/stream.d.ts +145 -5
- package/dist/i18n/messages/surfaces/usage.d.ts +26 -0
- package/dist/i18n/messages/surfaces/workspace.d.ts +10 -0
- package/dist/stream/ai-sdk-part-renderers.d.ts +7 -1
- package/dist/stream/belong-chat-transport.d.ts +5 -0
- package/dist/stream/belong-data-parts.d.ts +7 -3
- package/dist/stream/message-continuation.d.ts +29 -0
- package/dist/stream/run-line-progress.d.ts +1 -0
- package/dist/types/public.d.ts +1 -1
- package/package.json +1 -1
|
@@ -4,27 +4,27 @@ var c;
|
|
|
4
4
|
(function(r) {
|
|
5
5
|
r[r.AM = 0] = "AM", r[r.PM = 1] = "PM";
|
|
6
6
|
})(c || (c = {}));
|
|
7
|
-
var
|
|
7
|
+
var m;
|
|
8
8
|
(function(r) {
|
|
9
9
|
r[r.SUNDAY = 0] = "SUNDAY", r[r.MONDAY = 1] = "MONDAY", r[r.TUESDAY = 2] = "TUESDAY", r[r.WEDNESDAY = 3] = "WEDNESDAY", r[r.THURSDAY = 4] = "THURSDAY", r[r.FRIDAY = 5] = "FRIDAY", r[r.SATURDAY = 6] = "SATURDAY";
|
|
10
|
-
})(
|
|
11
|
-
var
|
|
10
|
+
})(m || (m = {}));
|
|
11
|
+
var y;
|
|
12
12
|
(function(r) {
|
|
13
13
|
r[r.JANUARY = 1] = "JANUARY", r[r.FEBRUARY = 2] = "FEBRUARY", r[r.MARCH = 3] = "MARCH", r[r.APRIL = 4] = "APRIL", r[r.MAY = 5] = "MAY", r[r.JUNE = 6] = "JUNE", r[r.JULY = 7] = "JULY", r[r.AUGUST = 8] = "AUGUST", r[r.SEPTEMBER = 9] = "SEPTEMBER", r[r.OCTOBER = 10] = "OCTOBER", r[r.NOVEMBER = 11] = "NOVEMBER", r[r.DECEMBER = 12] = "DECEMBER";
|
|
14
|
-
})(
|
|
14
|
+
})(y || (y = {}));
|
|
15
15
|
function P(r, e) {
|
|
16
16
|
r.assign("day", e.getDate()), r.assign("month", e.getMonth() + 1), r.assign("year", e.getFullYear());
|
|
17
17
|
}
|
|
18
|
-
function
|
|
18
|
+
function lt(r, e) {
|
|
19
19
|
r.assign("hour", e.getHours()), r.assign("minute", e.getMinutes()), r.assign("second", e.getSeconds()), r.assign("millisecond", e.getMilliseconds()), r.assign("meridiem", e.getHours() < 12 ? c.AM : c.PM);
|
|
20
20
|
}
|
|
21
|
-
function
|
|
21
|
+
function _(r, e) {
|
|
22
22
|
r.imply("day", e.getDate()), r.imply("month", e.getMonth() + 1), r.imply("year", e.getFullYear());
|
|
23
23
|
}
|
|
24
|
-
function
|
|
24
|
+
function U(r, e) {
|
|
25
25
|
r.imply("hour", e.getHours()), r.imply("minute", e.getMinutes()), r.imply("second", e.getSeconds()), r.imply("millisecond", e.getMilliseconds()), r.imply("meridiem", e.getHours() < 12 ? c.AM : c.PM);
|
|
26
26
|
}
|
|
27
|
-
const
|
|
27
|
+
const Ct = {
|
|
28
28
|
ACDT: 630,
|
|
29
29
|
ACST: 570,
|
|
30
30
|
ADT: -180,
|
|
@@ -61,8 +61,8 @@ const at = {
|
|
|
61
61
|
CET: {
|
|
62
62
|
timezoneOffsetDuringDst: 120,
|
|
63
63
|
timezoneOffsetNonDst: 60,
|
|
64
|
-
dstStart: (r) =>
|
|
65
|
-
dstEnd: (r) =>
|
|
64
|
+
dstStart: (r) => Ne(r, y.MARCH, m.SUNDAY, 2),
|
|
65
|
+
dstEnd: (r) => Ne(r, y.OCTOBER, m.SUNDAY, 3)
|
|
66
66
|
},
|
|
67
67
|
CHADT: 825,
|
|
68
68
|
CHAST: 765,
|
|
@@ -74,8 +74,8 @@ const at = {
|
|
|
74
74
|
CT: {
|
|
75
75
|
timezoneOffsetDuringDst: -300,
|
|
76
76
|
timezoneOffsetNonDst: -360,
|
|
77
|
-
dstStart: (r) =>
|
|
78
|
-
dstEnd: (r) =>
|
|
77
|
+
dstStart: (r) => $(r, y.MARCH, m.SUNDAY, 2, 2),
|
|
78
|
+
dstEnd: (r) => $(r, y.NOVEMBER, m.SUNDAY, 1, 2)
|
|
79
79
|
},
|
|
80
80
|
CVT: -60,
|
|
81
81
|
CXT: 420,
|
|
@@ -94,8 +94,8 @@ const at = {
|
|
|
94
94
|
ET: {
|
|
95
95
|
timezoneOffsetDuringDst: -240,
|
|
96
96
|
timezoneOffsetNonDst: -300,
|
|
97
|
-
dstStart: (r) =>
|
|
98
|
-
dstEnd: (r) =>
|
|
97
|
+
dstStart: (r) => $(r, y.MARCH, m.SUNDAY, 2, 2),
|
|
98
|
+
dstEnd: (r) => $(r, y.NOVEMBER, m.SUNDAY, 1, 2)
|
|
99
99
|
},
|
|
100
100
|
FJST: 780,
|
|
101
101
|
FJT: 720,
|
|
@@ -161,8 +161,8 @@ const at = {
|
|
|
161
161
|
MT: {
|
|
162
162
|
timezoneOffsetDuringDst: -360,
|
|
163
163
|
timezoneOffsetNonDst: -420,
|
|
164
|
-
dstStart: (r) =>
|
|
165
|
-
dstEnd: (r) =>
|
|
164
|
+
dstStart: (r) => $(r, y.MARCH, m.SUNDAY, 2, 2),
|
|
165
|
+
dstEnd: (r) => $(r, y.NOVEMBER, m.SUNDAY, 1, 2)
|
|
166
166
|
},
|
|
167
167
|
MUT: 240,
|
|
168
168
|
MVT: 300,
|
|
@@ -194,8 +194,8 @@ const at = {
|
|
|
194
194
|
PT: {
|
|
195
195
|
timezoneOffsetDuringDst: -420,
|
|
196
196
|
timezoneOffsetNonDst: -480,
|
|
197
|
-
dstStart: (r) =>
|
|
198
|
-
dstEnd: (r) =>
|
|
197
|
+
dstStart: (r) => $(r, y.MARCH, m.SUNDAY, 2, 2),
|
|
198
|
+
dstEnd: (r) => $(r, y.NOVEMBER, m.SUNDAY, 1, 2)
|
|
199
199
|
},
|
|
200
200
|
PWT: 540,
|
|
201
201
|
PYST: -180,
|
|
@@ -244,31 +244,31 @@ const at = {
|
|
|
244
244
|
YEKST: 360,
|
|
245
245
|
YEKT: 360
|
|
246
246
|
};
|
|
247
|
-
function
|
|
247
|
+
function $(r, e, t, n, s = 0) {
|
|
248
248
|
let i = 0, a = 0;
|
|
249
249
|
for (; a < n; )
|
|
250
250
|
i++, new Date(r, e - 1, i).getDay() === t && a++;
|
|
251
251
|
return new Date(r, e - 1, i, s);
|
|
252
252
|
}
|
|
253
|
-
function
|
|
253
|
+
function Ne(r, e, t, n = 0) {
|
|
254
254
|
const s = t === 0 ? 7 : t, i = new Date(r, e - 1 + 1, 1, 12), a = i.getDay() === 0 ? 7 : i.getDay();
|
|
255
255
|
let o;
|
|
256
256
|
return a === s ? o = 7 : a < s ? o = 7 + a - s : o = a - s, i.setDate(i.getDate() - o), new Date(r, e - 1, i.getDate(), n);
|
|
257
257
|
}
|
|
258
|
-
function
|
|
258
|
+
function ct(r, e, t = {}) {
|
|
259
259
|
if (r == null)
|
|
260
260
|
return null;
|
|
261
261
|
if (typeof r == "number")
|
|
262
262
|
return r;
|
|
263
|
-
const n = t[r] ??
|
|
263
|
+
const n = t[r] ?? Ct[r];
|
|
264
264
|
return n == null ? null : typeof n == "number" ? n : e == null ? null : e > n.dstStart(e.getFullYear()) && !(e > n.dstEnd(e.getFullYear())) ? n.timezoneOffsetDuringDst : n.timezoneOffsetNonDst;
|
|
265
265
|
}
|
|
266
|
-
const
|
|
266
|
+
const Ut = {
|
|
267
267
|
day: 0,
|
|
268
268
|
second: 0,
|
|
269
269
|
millisecond: 0
|
|
270
270
|
};
|
|
271
|
-
function
|
|
271
|
+
function p(r, e) {
|
|
272
272
|
let t = new Date(r);
|
|
273
273
|
if (e.y && (e.year = e.y, delete e.y), e.mo && (e.month = e.mo, delete e.mo), e.M && (e.month = e.M, delete e.M), e.w && (e.week = e.w, delete e.w), e.d && (e.day = e.d, delete e.d), e.h && (e.hour = e.h, delete e.h), e.m && (e.minute = e.m, delete e.m), e.s && (e.second = e.s, delete e.s), e.ms && (e.millisecond = e.ms, delete e.ms), "year" in e) {
|
|
274
274
|
const n = Math.floor(e.year);
|
|
@@ -322,7 +322,7 @@ function T(r, e) {
|
|
|
322
322
|
}
|
|
323
323
|
return t;
|
|
324
324
|
}
|
|
325
|
-
function
|
|
325
|
+
function x(r) {
|
|
326
326
|
const e = {};
|
|
327
327
|
for (const t in r)
|
|
328
328
|
e[t] = -r[t];
|
|
@@ -340,7 +340,7 @@ class E {
|
|
|
340
340
|
static fromInput(e, t) {
|
|
341
341
|
if (e instanceof Date)
|
|
342
342
|
return E.fromDate(e);
|
|
343
|
-
const n = e?.instant ?? /* @__PURE__ */ new Date(), s =
|
|
343
|
+
const n = e?.instant ?? /* @__PURE__ */ new Date(), s = ct(e?.timezone, n, t);
|
|
344
344
|
return new E(n, s);
|
|
345
345
|
}
|
|
346
346
|
getDateWithAdjustedTimezone() {
|
|
@@ -368,10 +368,10 @@ class d {
|
|
|
368
368
|
const n = e.getDateWithAdjustedTimezone();
|
|
369
369
|
this.imply("day", n.getDate()), this.imply("month", n.getMonth() + 1), this.imply("year", n.getFullYear()), this.imply("hour", 12), this.imply("minute", 0), this.imply("second", 0), this.imply("millisecond", 0);
|
|
370
370
|
}
|
|
371
|
-
static createRelativeFromReference(e, t =
|
|
372
|
-
let n =
|
|
371
|
+
static createRelativeFromReference(e, t = Ut) {
|
|
372
|
+
let n = p(e.getDateWithAdjustedTimezone(), t);
|
|
373
373
|
const s = new d(e);
|
|
374
|
-
return s.addTag("result/relativeDate"), "hour" in t || "minute" in t || "second" in t || "millisecond" in t ? (s.addTag("result/relativeDateAndTime"),
|
|
374
|
+
return s.addTag("result/relativeDate"), "hour" in t || "minute" in t || "second" in t || "millisecond" in t ? (s.addTag("result/relativeDateAndTime"), lt(s, n), P(s, n), s.assign("timezoneOffset", e.getTimezoneOffset())) : (U(s, n), s.imply("timezoneOffset", e.getTimezoneOffset()), "day" in t ? (s.assign("day", n.getDate()), s.assign("month", n.getMonth() + 1), s.assign("year", n.getFullYear()), s.assign("weekday", n.getDay())) : "week" in t ? (s.assign("day", n.getDate()), s.assign("month", n.getMonth() + 1), s.assign("year", n.getFullYear()), s.imply("weekday", n.getDay())) : (s.imply("day", n.getDate()), "month" in t ? (s.assign("month", n.getMonth() + 1), s.assign("year", n.getFullYear())) : (s.imply("month", n.getMonth() + 1), "year" in t ? s.assign("year", n.getFullYear()) : s.imply("year", n.getFullYear())))), s;
|
|
375
375
|
}
|
|
376
376
|
get(e) {
|
|
377
377
|
return e in this.knownValues ? this.knownValues[e] : e in this.impliedValues ? this.impliedValues[e] : null;
|
|
@@ -389,7 +389,7 @@ class d {
|
|
|
389
389
|
return this.knownValues[e] = t, delete this.impliedValues[e], this;
|
|
390
390
|
}
|
|
391
391
|
addDurationAsImplied(e) {
|
|
392
|
-
const t = this.dateWithoutTimezoneAdjustment(), n =
|
|
392
|
+
const t = this.dateWithoutTimezoneAdjustment(), n = p(t, e);
|
|
393
393
|
return ("day" in e || "week" in e || "month" in e || "year" in e) && (this.delete(["day", "weekday", "month", "year"]), this.imply("day", n.getDate()), this.imply("weekday", n.getDay()), this.imply("month", n.getMonth() + 1), this.imply("year", n.getFullYear())), ("second" in e || "minute" in e || "hour" in e) && (this.delete(["second", "minute", "hour"]), this.imply("second", n.getSeconds()), this.imply("minute", n.getMinutes()), this.imply("hour", n.getHours())), this;
|
|
394
394
|
}
|
|
395
395
|
delete(e) {
|
|
@@ -452,7 +452,7 @@ class d {
|
|
|
452
452
|
return e.setFullYear(this.get("year")), e;
|
|
453
453
|
}
|
|
454
454
|
}
|
|
455
|
-
class
|
|
455
|
+
class R {
|
|
456
456
|
refDate;
|
|
457
457
|
index;
|
|
458
458
|
text;
|
|
@@ -463,7 +463,7 @@ class D {
|
|
|
463
463
|
this.reference = e, this.refDate = e.instant, this.index = t, this.text = n, this.start = s || new d(e), this.end = i;
|
|
464
464
|
}
|
|
465
465
|
clone() {
|
|
466
|
-
const e = new
|
|
466
|
+
const e = new R(this.reference, this.index, this.text);
|
|
467
467
|
return e.start = this.start ? this.start.clone() : null, e.end = this.end ? this.end.clone() : null, e;
|
|
468
468
|
}
|
|
469
469
|
date() {
|
|
@@ -487,27 +487,27 @@ class D {
|
|
|
487
487
|
return `[ParsingResult {index: ${this.index}, text: '${this.text}', tags: ${JSON.stringify(e)} ...}]`;
|
|
488
488
|
}
|
|
489
489
|
}
|
|
490
|
-
function
|
|
490
|
+
function H(r, e, t = "\\s{0,5},?\\s{0,5}") {
|
|
491
491
|
const n = e.replace(/\((?!\?)/g, "(?:");
|
|
492
492
|
return `${r}${n}(?:${t}${n}){0,10}`;
|
|
493
493
|
}
|
|
494
|
-
function
|
|
494
|
+
function It(r) {
|
|
495
495
|
let e;
|
|
496
496
|
return r instanceof Array ? e = [...r] : r instanceof Map ? e = Array.from(r.keys()) : e = Object.keys(r), e;
|
|
497
497
|
}
|
|
498
|
-
function
|
|
499
|
-
return `(?:${
|
|
498
|
+
function g(r) {
|
|
499
|
+
return `(?:${It(r).sort((t, n) => n.length - t.length).join("|").replace(/\./g, "\\.")})`;
|
|
500
500
|
}
|
|
501
|
-
function
|
|
501
|
+
function Ee(r) {
|
|
502
502
|
return r < 100 && (r > 50 ? r = r + 1900 : r = r + 2e3), r;
|
|
503
503
|
}
|
|
504
|
-
function
|
|
504
|
+
function D(r, e, t) {
|
|
505
505
|
let n = new Date(r);
|
|
506
506
|
n.setMonth(t - 1), n.setDate(e);
|
|
507
|
-
const s =
|
|
507
|
+
const s = p(n, { year: 1 }), i = p(n, { year: -1 });
|
|
508
508
|
return Math.abs(s.getTime() - r.getTime()) < Math.abs(n.getTime() - r.getTime()) ? n = s : Math.abs(i.getTime() - r.getTime()) < Math.abs(n.getTime() - r.getTime()) && (n = i), n.getFullYear();
|
|
509
509
|
}
|
|
510
|
-
const
|
|
510
|
+
const fe = {
|
|
511
511
|
sunday: 0,
|
|
512
512
|
sun: 0,
|
|
513
513
|
"sun.": 0,
|
|
@@ -533,7 +533,7 @@ const K = {
|
|
|
533
533
|
saturday: 6,
|
|
534
534
|
sat: 6,
|
|
535
535
|
"sat.": 6
|
|
536
|
-
},
|
|
536
|
+
}, ut = {
|
|
537
537
|
january: 1,
|
|
538
538
|
february: 2,
|
|
539
539
|
march: 3,
|
|
@@ -547,7 +547,7 @@ const K = {
|
|
|
547
547
|
november: 11,
|
|
548
548
|
december: 12
|
|
549
549
|
}, w = {
|
|
550
|
-
...
|
|
550
|
+
...ut,
|
|
551
551
|
jan: 1,
|
|
552
552
|
"jan.": 1,
|
|
553
553
|
feb: 2,
|
|
@@ -572,7 +572,7 @@ const K = {
|
|
|
572
572
|
"nov.": 11,
|
|
573
573
|
dec: 12,
|
|
574
574
|
"dec.": 12
|
|
575
|
-
},
|
|
575
|
+
}, me = {
|
|
576
576
|
one: 1,
|
|
577
577
|
two: 2,
|
|
578
578
|
three: 3,
|
|
@@ -585,7 +585,7 @@ const K = {
|
|
|
585
585
|
ten: 10,
|
|
586
586
|
eleven: 11,
|
|
587
587
|
twelve: 12
|
|
588
|
-
},
|
|
588
|
+
}, ge = {
|
|
589
589
|
first: 1,
|
|
590
590
|
second: 2,
|
|
591
591
|
third: 3,
|
|
@@ -627,7 +627,7 @@ const K = {
|
|
|
627
627
|
thirtieth: 30,
|
|
628
628
|
"thirty first": 31,
|
|
629
629
|
"thirty-first": 31
|
|
630
|
-
},
|
|
630
|
+
}, dt = {
|
|
631
631
|
second: "second",
|
|
632
632
|
seconds: "second",
|
|
633
633
|
minute: "minute",
|
|
@@ -644,7 +644,7 @@ const K = {
|
|
|
644
644
|
quarters: "quarter",
|
|
645
645
|
year: "year",
|
|
646
646
|
years: "year"
|
|
647
|
-
},
|
|
647
|
+
}, j = {
|
|
648
648
|
s: "second",
|
|
649
649
|
sec: "second",
|
|
650
650
|
second: "second",
|
|
@@ -677,19 +677,19 @@ const K = {
|
|
|
677
677
|
yr: "year",
|
|
678
678
|
year: "year",
|
|
679
679
|
years: "year",
|
|
680
|
-
...
|
|
681
|
-
},
|
|
682
|
-
function
|
|
680
|
+
...dt
|
|
681
|
+
}, ft = `(?:${g(me)}|[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)?)`;
|
|
682
|
+
function St(r) {
|
|
683
683
|
const e = r.toLowerCase();
|
|
684
|
-
return
|
|
684
|
+
return me[e] !== void 0 ? me[e] : e === "a" || e === "an" || e == "the" ? 1 : e.match(/few/) ? 3 : e.match(/half/) ? 0.5 : e.match(/couple/) ? 2 : e.match(/several/) ? 7 : parseFloat(e);
|
|
685
685
|
}
|
|
686
|
-
const
|
|
687
|
-
function
|
|
686
|
+
const G = `(?:${g(ge)}|[0-9]{1,2}(?:st|nd|rd|th)?)`;
|
|
687
|
+
function L(r) {
|
|
688
688
|
let e = r.toLowerCase();
|
|
689
|
-
return
|
|
689
|
+
return ge[e] !== void 0 ? ge[e] : (e = e.replace(/(?:st|nd|rd|th)$/i, ""), parseInt(e));
|
|
690
690
|
}
|
|
691
|
-
const
|
|
692
|
-
function
|
|
691
|
+
const V = "(?:[1-9][0-9]{0,3}\\s{0,2}(?:BE|AD|BC|BCE|CE)|[1-9][0-9]{3}|[5-9][0-9]|2[0-5])";
|
|
692
|
+
function F(r) {
|
|
693
693
|
if (/BE/i.test(r))
|
|
694
694
|
return r = r.replace(/BE/i, ""), parseInt(r) - 543;
|
|
695
695
|
if (/BCE?/i.test(r))
|
|
@@ -697,23 +697,23 @@ function _(r) {
|
|
|
697
697
|
if (/(AD|CE)/i.test(r))
|
|
698
698
|
return r = r.replace(/(AD|CE)/i, ""), parseInt(r);
|
|
699
699
|
const e = parseInt(r);
|
|
700
|
-
return
|
|
700
|
+
return Ee(e);
|
|
701
701
|
}
|
|
702
|
-
const
|
|
703
|
-
function
|
|
702
|
+
const mt = `(${ft})\\s{0,3}(${g(j)})`, xe = new RegExp(mt, "i"), bt = `(${ft})\\s{0,3}(${g(dt)})`, gt = "\\s{0,5},?(?:\\s*and)?\\s{0,5}", W = H("(?:(?:about|around)\\s{0,3})?", mt, gt), q = H("(?:(?:about|around)\\s{0,3})?", bt, gt);
|
|
703
|
+
function I(r) {
|
|
704
704
|
const e = {};
|
|
705
|
-
let t = r, n =
|
|
705
|
+
let t = r, n = xe.exec(t);
|
|
706
706
|
for (; n; )
|
|
707
|
-
|
|
707
|
+
Ft(e, n), t = t.substring(n[0].length).trim(), n = xe.exec(t);
|
|
708
708
|
return Object.keys(e).length == 0 ? null : e;
|
|
709
709
|
}
|
|
710
|
-
function
|
|
710
|
+
function Ft(r, e) {
|
|
711
711
|
if (e[0].match(/^[a-zA-Z]+$/))
|
|
712
712
|
return;
|
|
713
|
-
const t =
|
|
713
|
+
const t = St(e[1]), n = j[e[2].toLowerCase()];
|
|
714
714
|
r[n] = t;
|
|
715
715
|
}
|
|
716
|
-
class
|
|
716
|
+
class u {
|
|
717
717
|
innerPatternHasChange(e, t) {
|
|
718
718
|
return this.innerPattern(e) !== t;
|
|
719
719
|
}
|
|
@@ -733,109 +733,109 @@ class g {
|
|
|
733
733
|
return this.innerExtract(e, t);
|
|
734
734
|
}
|
|
735
735
|
}
|
|
736
|
-
const
|
|
737
|
-
class
|
|
736
|
+
const Wt = new RegExp(`(?:(?:within|in|for)\\s*)?(?:(?:about|around|roughly|approximately|just)\\s*(?:~\\s*)?)?(${W})(?=\\W|$)`, "i"), Yt = new RegExp(`(?:within|in|for)\\s*(?:(?:about|around|roughly|approximately|just)\\s*(?:~\\s*)?)?(${W})(?=\\W|$)`, "i"), kt = new RegExp(`(?:within|in|for)\\s*(?:(?:about|around|roughly|approximately|just)\\s*(?:~\\s*)?)?(${q})(?=\\W|$)`, "i");
|
|
737
|
+
let vt = class extends u {
|
|
738
738
|
strictMode;
|
|
739
739
|
constructor(e) {
|
|
740
740
|
super(), this.strictMode = e;
|
|
741
741
|
}
|
|
742
742
|
innerPattern(e) {
|
|
743
|
-
return this.strictMode ?
|
|
743
|
+
return this.strictMode ? kt : e.option.forwardDate ? Wt : Yt;
|
|
744
744
|
}
|
|
745
745
|
innerExtract(e, t) {
|
|
746
746
|
if (t[0].match(/^for\s*the\s*\w+/))
|
|
747
747
|
return null;
|
|
748
|
-
const n =
|
|
748
|
+
const n = I(t[1]);
|
|
749
749
|
return n ? d.createRelativeFromReference(e.reference, n) : null;
|
|
750
750
|
}
|
|
751
|
-
}
|
|
752
|
-
const
|
|
753
|
-
class
|
|
751
|
+
};
|
|
752
|
+
const Gt = new RegExp(`(?:on\\s{0,3})?(${G})(?:\\s{0,3}(?:to|\\-|\\–|until|through|till)\\s{0,3}(${G}))?(?:-|/|\\s{0,3}(?:of)?\\s{0,3})(${g(w)})(?:(?:-|/|,?\\s{0,3})(${V}(?!\\w)))?(?=\\W|$)`, "i"), Me = 1, Oe = 2, Lt = 3, _e = 4;
|
|
753
|
+
let zt = class extends u {
|
|
754
754
|
innerPattern() {
|
|
755
|
-
return
|
|
755
|
+
return Gt;
|
|
756
756
|
}
|
|
757
757
|
innerExtract(e, t) {
|
|
758
|
-
const n = e.createParsingResult(t.index, t[0]), s = w[t[
|
|
758
|
+
const n = e.createParsingResult(t.index, t[0]), s = w[t[Lt].toLowerCase()], i = L(t[Me]);
|
|
759
759
|
if (i > 31)
|
|
760
|
-
return t.index = t.index + t[
|
|
761
|
-
if (n.start.assign("month", s), n.start.assign("day", i), t[
|
|
762
|
-
const a =
|
|
760
|
+
return t.index = t.index + t[Me].length, null;
|
|
761
|
+
if (n.start.assign("month", s), n.start.assign("day", i), t[_e]) {
|
|
762
|
+
const a = F(t[_e]);
|
|
763
763
|
n.start.assign("year", a);
|
|
764
764
|
} else {
|
|
765
|
-
const a =
|
|
765
|
+
const a = D(e.refDate, i, s);
|
|
766
766
|
n.start.imply("year", a);
|
|
767
767
|
}
|
|
768
|
-
if (t[
|
|
769
|
-
const a =
|
|
768
|
+
if (t[Oe]) {
|
|
769
|
+
const a = L(t[Oe]);
|
|
770
770
|
n.end = n.start.clone(), n.end.assign("day", a);
|
|
771
771
|
}
|
|
772
772
|
return n;
|
|
773
773
|
}
|
|
774
|
-
}
|
|
775
|
-
const
|
|
776
|
-
class
|
|
774
|
+
};
|
|
775
|
+
const Bt = new RegExp(`(${g(w)})(?:-|/|\\s*,?\\s*)(${G})(?!\\s*(?:am|pm))\\s*(?:(?:to|\\-)\\s*(${G})\\s*)?(?:(?:-|/|\\s*,\\s*|\\s+)(${V}))?(?=\\W|$)(?!\\:\\d)`, "i"), Ht = 1, Ce = 2, le = 3, ce = 4;
|
|
776
|
+
let jt = class extends u {
|
|
777
777
|
shouldSkipYearLikeDate;
|
|
778
778
|
constructor(e) {
|
|
779
779
|
super(), this.shouldSkipYearLikeDate = e;
|
|
780
780
|
}
|
|
781
781
|
innerPattern() {
|
|
782
|
-
return
|
|
782
|
+
return Bt;
|
|
783
783
|
}
|
|
784
784
|
innerExtract(e, t) {
|
|
785
|
-
const n = w[t[
|
|
786
|
-
if (s > 31 || this.shouldSkipYearLikeDate && !t[
|
|
785
|
+
const n = w[t[Ht].toLowerCase()], s = L(t[Ce]);
|
|
786
|
+
if (s > 31 || this.shouldSkipYearLikeDate && !t[le] && !t[ce] && t[Ce].match(/^2[0-5]$/))
|
|
787
787
|
return null;
|
|
788
788
|
const i = e.createParsingComponents({
|
|
789
789
|
day: s,
|
|
790
790
|
month: n
|
|
791
791
|
}).addTag("parser/ENMonthNameMiddleEndianParser");
|
|
792
|
-
if (t[
|
|
793
|
-
const l =
|
|
792
|
+
if (t[ce]) {
|
|
793
|
+
const l = F(t[ce]);
|
|
794
794
|
i.assign("year", l);
|
|
795
795
|
} else {
|
|
796
|
-
const l =
|
|
796
|
+
const l = D(e.refDate, s, n);
|
|
797
797
|
i.imply("year", l);
|
|
798
798
|
}
|
|
799
|
-
if (!t[
|
|
799
|
+
if (!t[le])
|
|
800
800
|
return i;
|
|
801
|
-
const a =
|
|
801
|
+
const a = L(t[le]), o = e.createParsingResult(t.index, t[0]);
|
|
802
802
|
return o.start = i, o.end = i.clone(), o.end.assign("day", a), o;
|
|
803
803
|
}
|
|
804
|
-
}
|
|
805
|
-
const
|
|
806
|
-
class
|
|
804
|
+
};
|
|
805
|
+
const Vt = new RegExp(`((?:in)\\s*)?(${g(w)})\\s*(?:(?:,|-|of)?\\s*(${V})?)?(?=[^\\s\\w]|\\s+[^0-9]|\\s+$|$)`, "i"), qt = 1, Kt = 2, Ue = 3;
|
|
806
|
+
let Zt = class extends u {
|
|
807
807
|
innerPattern() {
|
|
808
|
-
return
|
|
808
|
+
return Vt;
|
|
809
809
|
}
|
|
810
810
|
innerExtract(e, t) {
|
|
811
|
-
const n = t[
|
|
812
|
-
if (t[0].length <= 3 && !
|
|
811
|
+
const n = t[Kt].toLowerCase();
|
|
812
|
+
if (t[0].length <= 3 && !ut[n])
|
|
813
813
|
return null;
|
|
814
|
-
const s = e.createParsingResult(t.index + (t[
|
|
814
|
+
const s = e.createParsingResult(t.index + (t[qt] || "").length, t.index + t[0].length);
|
|
815
815
|
s.start.imply("day", 1), s.start.addTag("parser/ENMonthNameParser");
|
|
816
816
|
const i = w[n];
|
|
817
|
-
if (s.start.assign("month", i), t[
|
|
818
|
-
const a =
|
|
817
|
+
if (s.start.assign("month", i), t[Ue]) {
|
|
818
|
+
const a = F(t[Ue]);
|
|
819
819
|
s.start.assign("year", a);
|
|
820
820
|
} else {
|
|
821
|
-
const a =
|
|
821
|
+
const a = D(e.refDate, 1, i);
|
|
822
822
|
s.start.imply("year", a);
|
|
823
823
|
}
|
|
824
824
|
return s;
|
|
825
825
|
}
|
|
826
|
-
}
|
|
827
|
-
const
|
|
828
|
-
class
|
|
826
|
+
};
|
|
827
|
+
const Xt = new RegExp(`([0-9]{4})[-\\.\\/\\s](?:(${g(w)})|([0-9]{1,2}))[-\\.\\/\\s]([0-9]{1,2})(?=\\W|$)`, "i"), Jt = 1, Qt = 2, Ie = 3, en = 4;
|
|
828
|
+
class tn extends u {
|
|
829
829
|
strictMonthDateOrder;
|
|
830
830
|
constructor(e) {
|
|
831
831
|
super(), this.strictMonthDateOrder = e;
|
|
832
832
|
}
|
|
833
833
|
innerPattern() {
|
|
834
|
-
return
|
|
834
|
+
return Xt;
|
|
835
835
|
}
|
|
836
836
|
innerExtract(e, t) {
|
|
837
|
-
const n = parseInt(t[
|
|
838
|
-
let s = parseInt(t[
|
|
837
|
+
const n = parseInt(t[Jt]);
|
|
838
|
+
let s = parseInt(t[en]), i = t[Ie] ? parseInt(t[Ie]) : w[t[Qt].toLowerCase()];
|
|
839
839
|
if (i < 1 || i > 12) {
|
|
840
840
|
if (this.strictMonthDateOrder)
|
|
841
841
|
return null;
|
|
@@ -848,34 +848,34 @@ class Ct extends g {
|
|
|
848
848
|
};
|
|
849
849
|
}
|
|
850
850
|
}
|
|
851
|
-
const
|
|
852
|
-
class
|
|
851
|
+
const nn = "(?:[1-9][0-9]{0,3}\\s{0,2}(?:BE|AD|BC|BCE|CE)|[1-9][0-9]{3})", sn = new RegExp(`(${nn})(?:\\s*[-.\\/,]?\\s*|\\s+of\\s+)(${g(w)})(?=[^\\s\\w]|\\s+[^0-9]|\\s+$|$)`, "i"), rn = 1, an = 2;
|
|
852
|
+
class on extends u {
|
|
853
853
|
innerPattern() {
|
|
854
|
-
return
|
|
854
|
+
return sn;
|
|
855
855
|
}
|
|
856
856
|
innerExtract(e, t) {
|
|
857
|
-
const n =
|
|
857
|
+
const n = F(t[rn]), s = t[an].toLowerCase(), i = w[s], a = e.createParsingResult(t.index, t[0]);
|
|
858
858
|
return a.start.imply("day", 1), a.start.assign("month", i), a.start.assign("year", n), a.start.addTag("parser/ENYearMonthNameParser"), a;
|
|
859
859
|
}
|
|
860
860
|
}
|
|
861
|
-
const
|
|
862
|
-
class
|
|
861
|
+
const ln = new RegExp("([0-9]|0[1-9]|1[012])/([0-9]{4})", "i"), cn = 1, un = 2;
|
|
862
|
+
let dn = class extends u {
|
|
863
863
|
innerPattern() {
|
|
864
|
-
return
|
|
864
|
+
return ln;
|
|
865
865
|
}
|
|
866
866
|
innerExtract(e, t) {
|
|
867
|
-
const n = parseInt(t[
|
|
867
|
+
const n = parseInt(t[un]), s = parseInt(t[cn]);
|
|
868
868
|
return e.createParsingComponents().imply("day", 1).assign("month", s).assign("year", n);
|
|
869
869
|
}
|
|
870
|
-
}
|
|
871
|
-
function
|
|
870
|
+
};
|
|
871
|
+
function fn(r, e, t, n) {
|
|
872
872
|
return new RegExp(`${r}${e}(\\d{1,4})(?:(?:\\.|:|:)(\\d{1,2})(?:(?::|:)(\\d{2})(?:\\.(\\d{1,6}))?)?)?(?:\\s*(a\\.m\\.|p\\.m\\.|am?|pm?))?${t}`, n);
|
|
873
873
|
}
|
|
874
|
-
function
|
|
874
|
+
function mn(r, e) {
|
|
875
875
|
return new RegExp(`^(${r})(\\d{1,4})(?:(?:\\.|\\:|\\:)(\\d{1,2})(?:(?:\\.|\\:|\\:)(\\d{1,2})(?:\\.(\\d{1,6}))?)?)?(?:\\s*(a\\.m\\.|p\\.m\\.|am?|pm?))?${e}`, "i");
|
|
876
876
|
}
|
|
877
|
-
const
|
|
878
|
-
class
|
|
877
|
+
const ue = 2, N = 3, k = 4, v = 5, O = 6;
|
|
878
|
+
class K {
|
|
879
879
|
strictMode;
|
|
880
880
|
constructor(e = !1) {
|
|
881
881
|
this.strictMode = e;
|
|
@@ -901,40 +901,40 @@ class ee {
|
|
|
901
901
|
return t[0].match(/^\d{4}/) ? (t.index += 4, null) : (t.index += t[0].length, null);
|
|
902
902
|
const s = t.index + t[1].length, i = t[0].substring(t[1].length), a = e.createParsingResult(s, i, n);
|
|
903
903
|
t.index += t[0].length;
|
|
904
|
-
const o = e.text.substring(t.index),
|
|
905
|
-
return i.match(/^\d{3,4}/) &&
|
|
904
|
+
const o = e.text.substring(t.index), f = this.getFollowingTimePatternThroughCache().exec(o);
|
|
905
|
+
return i.match(/^\d{3,4}/) && f && (f[0].match(/^\s*([+-])\s*\d{2,4}$/) || f[0].match(/^\s*([+-])\s*\d{2}\W\d{2}/)) ? null : !f || f[0].match(/^\s*([+-])\s*\d{3,4}$/) ? this.checkAndReturnWithoutFollowingPattern(a) : (a.end = this.extractFollowingTimeComponents(e, f, a), a.end && (a.text += f[0]), this.checkAndReturnWithFollowingPattern(a));
|
|
906
906
|
}
|
|
907
907
|
extractPrimaryTimeComponents(e, t, n = !1) {
|
|
908
908
|
const s = e.createParsingComponents();
|
|
909
|
-
let i = 0, a = null, o = parseInt(t[
|
|
909
|
+
let i = 0, a = null, o = parseInt(t[ue]);
|
|
910
910
|
if (o > 100) {
|
|
911
|
-
if (t[
|
|
911
|
+
if (t[ue].length == 4 && t[N] == null && !t[O] || this.strictMode || t[N] != null)
|
|
912
912
|
return null;
|
|
913
913
|
i = o % 100, o = Math.floor(o / 100);
|
|
914
914
|
}
|
|
915
915
|
if (o > 24)
|
|
916
916
|
return null;
|
|
917
|
-
if (t[
|
|
918
|
-
if (t[
|
|
917
|
+
if (t[N] != null) {
|
|
918
|
+
if (t[N].length == 1 && !t[O])
|
|
919
919
|
return null;
|
|
920
|
-
i = parseInt(t[
|
|
920
|
+
i = parseInt(t[N]);
|
|
921
921
|
}
|
|
922
922
|
if (i >= 60)
|
|
923
923
|
return null;
|
|
924
|
-
if (o > 12 && (a = c.PM), t[
|
|
924
|
+
if (o > 12 && (a = c.PM), t[O] != null) {
|
|
925
925
|
if (o > 12)
|
|
926
926
|
return null;
|
|
927
|
-
const l = t[
|
|
927
|
+
const l = t[O][0].toLowerCase();
|
|
928
928
|
l == "a" && (a = c.AM, o == 12 && (o = 0)), l == "p" && (a = c.PM, o != 12 && (o += 12));
|
|
929
929
|
}
|
|
930
|
-
if (s.assign("hour", o), s.assign("minute", i), a !== null ? s.assign("meridiem", a) : o < 12 ? s.imply("meridiem", c.AM) : s.imply("meridiem", c.PM), t[
|
|
931
|
-
const l = parseInt(t[
|
|
930
|
+
if (s.assign("hour", o), s.assign("minute", i), a !== null ? s.assign("meridiem", a) : o < 12 ? s.imply("meridiem", c.AM) : s.imply("meridiem", c.PM), t[v] != null) {
|
|
931
|
+
const l = parseInt(t[v].substring(0, 3));
|
|
932
932
|
if (l >= 1e3)
|
|
933
933
|
return null;
|
|
934
934
|
s.assign("millisecond", l);
|
|
935
935
|
}
|
|
936
|
-
if (t[
|
|
937
|
-
const l = parseInt(t[
|
|
936
|
+
if (t[k] != null) {
|
|
937
|
+
const l = parseInt(t[k]);
|
|
938
938
|
if (l >= 60)
|
|
939
939
|
return null;
|
|
940
940
|
s.assign("second", l);
|
|
@@ -943,25 +943,25 @@ class ee {
|
|
|
943
943
|
}
|
|
944
944
|
extractFollowingTimeComponents(e, t, n) {
|
|
945
945
|
const s = e.createParsingComponents();
|
|
946
|
-
if (t[
|
|
947
|
-
const l = parseInt(t[
|
|
946
|
+
if (t[v] != null) {
|
|
947
|
+
const l = parseInt(t[v].substring(0, 3));
|
|
948
948
|
if (l >= 1e3)
|
|
949
949
|
return null;
|
|
950
950
|
s.assign("millisecond", l);
|
|
951
951
|
}
|
|
952
|
-
if (t[
|
|
953
|
-
const l = parseInt(t[
|
|
952
|
+
if (t[k] != null) {
|
|
953
|
+
const l = parseInt(t[k]);
|
|
954
954
|
if (l >= 60)
|
|
955
955
|
return null;
|
|
956
956
|
s.assign("second", l);
|
|
957
957
|
}
|
|
958
|
-
let i = parseInt(t[
|
|
959
|
-
if (t[
|
|
958
|
+
let i = parseInt(t[ue]), a = 0, o = -1;
|
|
959
|
+
if (t[N] != null ? a = parseInt(t[N]) : i > 100 && (a = i % 100, i = Math.floor(i / 100)), a >= 60 || i > 24)
|
|
960
960
|
return null;
|
|
961
|
-
if (i >= 12 && (o = c.PM), t[
|
|
961
|
+
if (i >= 12 && (o = c.PM), t[O] != null) {
|
|
962
962
|
if (i > 12)
|
|
963
963
|
return null;
|
|
964
|
-
const l = t[
|
|
964
|
+
const l = t[O][0].toLowerCase();
|
|
965
965
|
l == "a" && (o = c.AM, i == 12 && (i = 0, s.isCertain("day") || s.imply("day", s.get("day") + 1))), l == "p" && (o = c.PM, i != 12 && (i += 12)), n.start.isCertain("meridiem") || (o == c.AM ? (n.start.imply("meridiem", c.AM), n.start.get("hour") == 12 && n.start.assign("hour", 0)) : (n.start.imply("meridiem", c.PM), n.start.get("hour") != 12 && n.start.assign("hour", n.start.get("hour") + 12)));
|
|
966
966
|
}
|
|
967
967
|
return s.assign("hour", i), s.assign("minute", a), o >= 0 ? s.assign("meridiem", o) : n.start.isCertain("meridiem") && n.start.get("hour") > 12 ? n.start.get("hour") - 12 > i ? s.imply("meridiem", c.AM) : i <= 12 && (s.assign("hour", i + 12), s.assign("meridiem", c.PM)) : i > 12 ? s.imply("meridiem", c.PM) : i <= 12 && s.imply("meridiem", c.AM), s.date().getTime() < n.start.date().getTime() && s.imply("day", s.get("day") + 1), s;
|
|
@@ -998,17 +998,17 @@ class ee {
|
|
|
998
998
|
cachedPrimaryTimePattern = null;
|
|
999
999
|
getPrimaryTimePatternThroughCache() {
|
|
1000
1000
|
const e = this.primaryPrefix(), t = this.primarySuffix();
|
|
1001
|
-
return this.cachedPrimaryPrefix === e && this.cachedPrimarySuffix === t ? this.cachedPrimaryTimePattern : (this.cachedPrimaryTimePattern =
|
|
1001
|
+
return this.cachedPrimaryPrefix === e && this.cachedPrimarySuffix === t ? this.cachedPrimaryTimePattern : (this.cachedPrimaryTimePattern = fn(this.primaryPatternLeftBoundary(), e, t, this.patternFlags()), this.cachedPrimaryPrefix = e, this.cachedPrimarySuffix = t, this.cachedPrimaryTimePattern);
|
|
1002
1002
|
}
|
|
1003
1003
|
cachedFollowingPhase = null;
|
|
1004
1004
|
cachedFollowingSuffix = null;
|
|
1005
1005
|
cachedFollowingTimePatten = null;
|
|
1006
1006
|
getFollowingTimePatternThroughCache() {
|
|
1007
1007
|
const e = this.followingPhase(), t = this.followingSuffix();
|
|
1008
|
-
return this.cachedFollowingPhase === e && this.cachedFollowingSuffix === t ? this.cachedFollowingTimePatten : (this.cachedFollowingTimePatten =
|
|
1008
|
+
return this.cachedFollowingPhase === e && this.cachedFollowingSuffix === t ? this.cachedFollowingTimePatten : (this.cachedFollowingTimePatten = mn(e, t), this.cachedFollowingPhase = e, this.cachedFollowingSuffix = t, this.cachedFollowingTimePatten);
|
|
1009
1009
|
}
|
|
1010
1010
|
}
|
|
1011
|
-
class
|
|
1011
|
+
let gn = class extends K {
|
|
1012
1012
|
constructor(e) {
|
|
1013
1013
|
super(e);
|
|
1014
1014
|
}
|
|
@@ -1040,41 +1040,41 @@ class zt extends ee {
|
|
|
1040
1040
|
const s = super.extractFollowingTimeComponents(e, t, n);
|
|
1041
1041
|
return s && s.addTag("parser/ENTimeExpressionParser"), s;
|
|
1042
1042
|
}
|
|
1043
|
-
}
|
|
1044
|
-
const
|
|
1045
|
-
class
|
|
1043
|
+
};
|
|
1044
|
+
const hn = new RegExp(`(${W})\\s{0,5}(?:ago|before|earlier)(?=\\W|$)`, "i"), Tn = new RegExp(`(${q})\\s{0,5}(?:ago|before|earlier)(?=\\W|$)`, "i");
|
|
1045
|
+
let pn = class extends u {
|
|
1046
1046
|
strictMode;
|
|
1047
1047
|
constructor(e) {
|
|
1048
1048
|
super(), this.strictMode = e;
|
|
1049
1049
|
}
|
|
1050
1050
|
innerPattern() {
|
|
1051
|
-
return this.strictMode ?
|
|
1051
|
+
return this.strictMode ? Tn : hn;
|
|
1052
1052
|
}
|
|
1053
1053
|
innerExtract(e, t) {
|
|
1054
|
-
const n =
|
|
1055
|
-
return n ? d.createRelativeFromReference(e.reference,
|
|
1054
|
+
const n = I(t[1]);
|
|
1055
|
+
return n ? d.createRelativeFromReference(e.reference, x(n)) : null;
|
|
1056
1056
|
}
|
|
1057
|
-
}
|
|
1058
|
-
const
|
|
1059
|
-
class
|
|
1057
|
+
};
|
|
1058
|
+
const yn = new RegExp(`(${W})\\s{0,5}(?:later|after|from now|henceforth|forward|out)(?=(?:\\W|$))`, "i"), En = new RegExp(`(${q})\\s{0,5}(later|after|from now)(?=\\W|$)`, "i"), Pn = 1;
|
|
1059
|
+
let Rn = class extends u {
|
|
1060
1060
|
strictMode;
|
|
1061
1061
|
constructor(e) {
|
|
1062
1062
|
super(), this.strictMode = e;
|
|
1063
1063
|
}
|
|
1064
1064
|
innerPattern() {
|
|
1065
|
-
return this.strictMode ?
|
|
1065
|
+
return this.strictMode ? En : yn;
|
|
1066
1066
|
}
|
|
1067
1067
|
innerExtract(e, t) {
|
|
1068
|
-
const n =
|
|
1068
|
+
const n = I(t[Pn]);
|
|
1069
1069
|
return n ? d.createRelativeFromReference(e.reference, n) : null;
|
|
1070
1070
|
}
|
|
1071
|
-
}
|
|
1072
|
-
class
|
|
1071
|
+
};
|
|
1072
|
+
class ht {
|
|
1073
1073
|
refine(e, t) {
|
|
1074
1074
|
return t.filter((n) => this.isValid(e, n));
|
|
1075
1075
|
}
|
|
1076
1076
|
}
|
|
1077
|
-
class
|
|
1077
|
+
class S {
|
|
1078
1078
|
refine(e, t) {
|
|
1079
1079
|
if (t.length < 2)
|
|
1080
1080
|
return t;
|
|
@@ -1086,16 +1086,16 @@ class I {
|
|
|
1086
1086
|
if (!this.shouldMergeResults(o, s, i, e))
|
|
1087
1087
|
n.push(s), s = i;
|
|
1088
1088
|
else {
|
|
1089
|
-
const l = s,
|
|
1089
|
+
const l = s, f = i, h = this.mergeResults(o, l, f, e);
|
|
1090
1090
|
e.debug(() => {
|
|
1091
|
-
console.log(`${this.constructor.name} merged ${l} and ${
|
|
1092
|
-
}), s =
|
|
1091
|
+
console.log(`${this.constructor.name} merged ${l} and ${f} into ${h}`);
|
|
1092
|
+
}), s = h;
|
|
1093
1093
|
}
|
|
1094
1094
|
}
|
|
1095
1095
|
return s != null && n.push(s), n;
|
|
1096
1096
|
}
|
|
1097
1097
|
}
|
|
1098
|
-
class
|
|
1098
|
+
class Z extends S {
|
|
1099
1099
|
shouldMergeResults(e, t, n) {
|
|
1100
1100
|
return !t.end && !n.end && e.match(this.patternBetween()) != null;
|
|
1101
1101
|
}
|
|
@@ -1106,51 +1106,51 @@ class te extends I {
|
|
|
1106
1106
|
n.start.isCertain(i) || n.start.imply(i, t.start.get(i));
|
|
1107
1107
|
})), t.start.date() > n.start.date()) {
|
|
1108
1108
|
let i = t.start.date(), a = n.start.date();
|
|
1109
|
-
n.start.isOnlyWeekdayComponent() &&
|
|
1109
|
+
n.start.isOnlyWeekdayComponent() && p(a, { day: 7 }) > i ? (a = p(a, { day: 7 }), n.start.imply("day", a.getDate()), n.start.imply("month", a.getMonth() + 1), n.start.imply("year", a.getFullYear())) : t.start.isOnlyWeekdayComponent() && p(i, { day: -7 }) < a ? (i = p(i, { day: -7 }), t.start.imply("day", i.getDate()), t.start.imply("month", i.getMonth() + 1), t.start.imply("year", i.getFullYear())) : n.start.isDateWithUnknownYear() && p(a, { year: 1 }) > i ? (a = p(a, { year: 1 }), n.start.imply("year", a.getFullYear())) : t.start.isDateWithUnknownYear() && p(i, { year: -1 }) < a ? (i = p(i, { year: -1 }), t.start.imply("year", i.getFullYear())) : [n, t] = [t, n];
|
|
1110
1110
|
}
|
|
1111
1111
|
const s = t.clone();
|
|
1112
1112
|
return s.start = t.start, s.end = n.start, s.index = Math.min(t.index, n.index), t.index < n.index ? s.text = t.text + e + n.text : s.text = n.text + e + t.text, s;
|
|
1113
1113
|
}
|
|
1114
1114
|
}
|
|
1115
|
-
class
|
|
1115
|
+
let wn = class extends Z {
|
|
1116
1116
|
patternBetween() {
|
|
1117
1117
|
return /^\s*(to|-|–|until|through|till)\s*$/i;
|
|
1118
1118
|
}
|
|
1119
|
-
}
|
|
1120
|
-
function
|
|
1119
|
+
};
|
|
1120
|
+
function Se(r, e) {
|
|
1121
1121
|
const t = r.clone(), n = r.start, s = e.start;
|
|
1122
|
-
if (t.start =
|
|
1123
|
-
const i = r.end == null ? r.start : r.end, a = e.end == null ? e.start : e.end, o =
|
|
1122
|
+
if (t.start = be(n, s), r.end != null || e.end != null) {
|
|
1123
|
+
const i = r.end == null ? r.start : r.end, a = e.end == null ? e.start : e.end, o = be(i, a);
|
|
1124
1124
|
if (r.end == null && o.date().getTime() < t.start.date().getTime()) {
|
|
1125
1125
|
const l = new Date(o.date().getTime());
|
|
1126
|
-
l.setDate(l.getDate() + 1), o.isCertain("day") ? P(o, l) :
|
|
1126
|
+
l.setDate(l.getDate() + 1), o.isCertain("day") ? P(o, l) : _(o, l);
|
|
1127
1127
|
}
|
|
1128
1128
|
t.end = o;
|
|
1129
1129
|
}
|
|
1130
1130
|
return t;
|
|
1131
1131
|
}
|
|
1132
|
-
function
|
|
1132
|
+
function be(r, e) {
|
|
1133
1133
|
const t = r.clone();
|
|
1134
1134
|
e.isCertain("hour") ? (t.assign("hour", e.get("hour")), t.assign("minute", e.get("minute")), e.isCertain("second") ? (t.assign("second", e.get("second")), e.isCertain("millisecond") ? t.assign("millisecond", e.get("millisecond")) : t.imply("millisecond", e.get("millisecond"))) : (t.imply("second", e.get("second")), t.imply("millisecond", e.get("millisecond")))) : (t.imply("hour", e.get("hour")), t.imply("minute", e.get("minute")), t.imply("second", e.get("second")), t.imply("millisecond", e.get("millisecond"))), e.isCertain("timezoneOffset") && t.assign("timezoneOffset", e.get("timezoneOffset"));
|
|
1135
1135
|
const n = r.get("meridiem") != null && (r.isCertain("meridiem") || Array.from(r.tags()).some((s) => s.startsWith("casualReference/")));
|
|
1136
1136
|
return e.isCertain("meridiem") ? t.assign("meridiem", e.get("meridiem")) : e.get("meridiem") != null && !n && t.imply("meridiem", e.get("meridiem")), t.get("meridiem") == c.PM && t.get("hour") < 12 && (e.isCertain("hour") ? t.assign("hour", t.get("hour") + 12) : t.imply("hour", t.get("hour") + 12)), t.addTags(r.tags()), t.addTags(e.tags()), t;
|
|
1137
1137
|
}
|
|
1138
|
-
class
|
|
1138
|
+
class X extends S {
|
|
1139
1139
|
shouldMergeResults(e, t, n) {
|
|
1140
1140
|
return (t.start.isOnlyDate() && n.start.isOnlyTime() || n.start.isOnlyDate() && t.start.isOnlyTime()) && e.match(this.patternBetween()) != null;
|
|
1141
1141
|
}
|
|
1142
1142
|
mergeResults(e, t, n) {
|
|
1143
|
-
const s = t.start.isOnlyDate() ?
|
|
1143
|
+
const s = t.start.isOnlyDate() ? Se(t, n) : Se(n, t);
|
|
1144
1144
|
return s.index = t.index, s.text = t.text + e + n.text, s;
|
|
1145
1145
|
}
|
|
1146
1146
|
}
|
|
1147
|
-
class
|
|
1147
|
+
let Fe = class extends X {
|
|
1148
1148
|
patternBetween() {
|
|
1149
1149
|
return new RegExp("^\\s*(T|at|after|before|on|of|,|-|\\.|∙|:)?\\s*$");
|
|
1150
1150
|
}
|
|
1151
|
-
}
|
|
1152
|
-
const
|
|
1153
|
-
class
|
|
1151
|
+
};
|
|
1152
|
+
const Dn = new RegExp("^\\s*,?\\s*\\(?([A-Z]{2,4})\\)?(?=\\W|$)", "i");
|
|
1153
|
+
class $n {
|
|
1154
1154
|
timezoneOverrides;
|
|
1155
1155
|
constructor(e) {
|
|
1156
1156
|
this.timezoneOverrides = e;
|
|
@@ -1158,39 +1158,39 @@ class Xt {
|
|
|
1158
1158
|
refine(e, t) {
|
|
1159
1159
|
const n = e.option.timezones ?? {};
|
|
1160
1160
|
return t.forEach((s) => {
|
|
1161
|
-
const i = e.text.substring(s.index + s.text.length), a =
|
|
1161
|
+
const i = e.text.substring(s.index + s.text.length), a = Dn.exec(i);
|
|
1162
1162
|
if (!a)
|
|
1163
1163
|
return;
|
|
1164
|
-
const o = a[1].toUpperCase(), l = s.start.date() ?? s.refDate ?? /* @__PURE__ */ new Date(),
|
|
1165
|
-
if (
|
|
1164
|
+
const o = a[1].toUpperCase(), l = s.start.date() ?? s.refDate ?? /* @__PURE__ */ new Date(), f = { ...this.timezoneOverrides, ...n }, h = ct(o, l, f);
|
|
1165
|
+
if (h == null)
|
|
1166
1166
|
return;
|
|
1167
1167
|
e.debug(() => {
|
|
1168
|
-
console.log(`Extracting timezone: '${o}' into: ${
|
|
1168
|
+
console.log(`Extracting timezone: '${o}' into: ${h} for: ${s.start}`);
|
|
1169
1169
|
});
|
|
1170
|
-
const
|
|
1171
|
-
|
|
1170
|
+
const b = s.start.get("timezoneOffset");
|
|
1171
|
+
b !== null && h != b && (s.start.isCertain("timezoneOffset") || o != a[1]) || s.start.isOnlyDate() && o != a[1] || (s.text += a[0], s.start.isCertain("timezoneOffset") || s.start.assign("timezoneOffset", h), s.end != null && !s.end.isCertain("timezoneOffset") && s.end.assign("timezoneOffset", h));
|
|
1172
1172
|
}), t;
|
|
1173
1173
|
}
|
|
1174
1174
|
}
|
|
1175
|
-
const
|
|
1176
|
-
class
|
|
1175
|
+
const An = new RegExp("^\\s*(?:\\(?(?:GMT|UTC)\\s?)?([+-])(\\d{1,2})(?::?(\\d{2}))?\\)?", "i"), Nn = 1, xn = 2, Mn = 3;
|
|
1176
|
+
class On {
|
|
1177
1177
|
refine(e, t) {
|
|
1178
1178
|
return t.forEach(function(n) {
|
|
1179
1179
|
if (n.start.isCertain("timezoneOffset"))
|
|
1180
1180
|
return;
|
|
1181
|
-
const s = e.text.substring(n.index + n.text.length), i =
|
|
1181
|
+
const s = e.text.substring(n.index + n.text.length), i = An.exec(s);
|
|
1182
1182
|
if (!i)
|
|
1183
1183
|
return;
|
|
1184
1184
|
e.debug(() => {
|
|
1185
1185
|
console.log(`Extracting timezone: '${i[0]}' into : ${n}`);
|
|
1186
1186
|
});
|
|
1187
|
-
const a = parseInt(i[
|
|
1187
|
+
const a = parseInt(i[xn]), o = parseInt(i[Mn] || "0");
|
|
1188
1188
|
let l = a * 60 + o;
|
|
1189
|
-
l > 840 || (i[
|
|
1189
|
+
l > 840 || (i[Nn] === "-" && (l = -l), n.end != null && n.end.assign("timezoneOffset", l), n.start.assign("timezoneOffset", l), n.text += i[0]);
|
|
1190
1190
|
}), t;
|
|
1191
1191
|
}
|
|
1192
1192
|
}
|
|
1193
|
-
class
|
|
1193
|
+
class he {
|
|
1194
1194
|
refine(e, t) {
|
|
1195
1195
|
if (t.length < 2)
|
|
1196
1196
|
return t;
|
|
@@ -1210,56 +1210,56 @@ class J {
|
|
|
1210
1210
|
return s != null && n.push(s), n;
|
|
1211
1211
|
}
|
|
1212
1212
|
}
|
|
1213
|
-
function
|
|
1214
|
-
const n = r.getDateWithAdjustedTimezone(), s =
|
|
1213
|
+
function J(r, e, t) {
|
|
1214
|
+
const n = r.getDateWithAdjustedTimezone(), s = _n(n, e, t);
|
|
1215
1215
|
let i = new d(r);
|
|
1216
1216
|
return i = i.addDurationAsImplied({ day: s }), i.assign("weekday", e), i;
|
|
1217
1217
|
}
|
|
1218
|
-
function
|
|
1218
|
+
function _n(r, e, t) {
|
|
1219
1219
|
const n = r.getDay();
|
|
1220
1220
|
switch (t) {
|
|
1221
1221
|
case "this":
|
|
1222
|
-
return
|
|
1222
|
+
return C(r, e);
|
|
1223
1223
|
case "last":
|
|
1224
|
-
return
|
|
1224
|
+
return Tt(r, e);
|
|
1225
1225
|
case "next":
|
|
1226
|
-
return n ==
|
|
1226
|
+
return n == m.SUNDAY ? e == m.SUNDAY ? 7 : e : n == m.SATURDAY ? e == m.SATURDAY ? 7 : e == m.SUNDAY ? 8 : 1 + e : e < n && e != m.SUNDAY ? C(r, e) : C(r, e) + 7;
|
|
1227
1227
|
}
|
|
1228
|
-
return
|
|
1228
|
+
return Cn(r, e);
|
|
1229
1229
|
}
|
|
1230
|
-
function
|
|
1231
|
-
const t =
|
|
1230
|
+
function Cn(r, e) {
|
|
1231
|
+
const t = Tt(r, e), n = C(r, e);
|
|
1232
1232
|
return n < -t ? n : t;
|
|
1233
1233
|
}
|
|
1234
|
-
function
|
|
1234
|
+
function C(r, e) {
|
|
1235
1235
|
const t = r.getDay();
|
|
1236
1236
|
let n = e - t;
|
|
1237
1237
|
return n < 0 && (n += 7), n;
|
|
1238
1238
|
}
|
|
1239
|
-
function
|
|
1239
|
+
function Tt(r, e) {
|
|
1240
1240
|
const t = r.getDay();
|
|
1241
1241
|
let n = e - t;
|
|
1242
1242
|
return n >= 0 && (n -= 7), n;
|
|
1243
1243
|
}
|
|
1244
|
-
class
|
|
1244
|
+
class Un {
|
|
1245
1245
|
refine(e, t) {
|
|
1246
1246
|
return e.option.forwardDate && t.forEach((n) => {
|
|
1247
1247
|
let s = e.reference.getDateWithAdjustedTimezone();
|
|
1248
1248
|
if (n.start.isOnlyTime() && e.reference.instant > n.start.date()) {
|
|
1249
1249
|
const i = e.reference.getDateWithAdjustedTimezone(), a = new Date(i);
|
|
1250
|
-
a.setDate(a.getDate() + 1),
|
|
1250
|
+
a.setDate(a.getDate() + 1), _(n.start, a), e.debug(() => {
|
|
1251
1251
|
console.log(`${this.constructor.name} adjusted ${n} time from the ref date (${i}) to the following day (${a})`);
|
|
1252
|
-
}), n.end && n.end.isOnlyTime() && (
|
|
1252
|
+
}), n.end && n.end.isOnlyTime() && (_(n.end, a), n.start.date() > n.end.date() && (a.setDate(a.getDate() + 1), _(n.end, a)));
|
|
1253
1253
|
}
|
|
1254
1254
|
if (n.start.isOnlyWeekdayComponent() && s > n.start.date()) {
|
|
1255
|
-
let i =
|
|
1256
|
-
const a =
|
|
1257
|
-
if (
|
|
1255
|
+
let i = C(s, n.start.get("weekday")) || 7;
|
|
1256
|
+
const a = p(s, { day: i });
|
|
1257
|
+
if (_(n.start, a), e.debug(() => {
|
|
1258
1258
|
console.log(`${this.constructor.name} adjusted ${n} weekday (${n.start})`);
|
|
1259
1259
|
}), n.end && n.start.date() > n.end.date()) {
|
|
1260
|
-
let o =
|
|
1261
|
-
const l =
|
|
1262
|
-
|
|
1260
|
+
let o = C(s, n.start.get("weekday")) || 7;
|
|
1261
|
+
const l = p(s, { day: o });
|
|
1262
|
+
_(n.end, l), e.debug(() => {
|
|
1263
1263
|
console.log(`${this.constructor.name} adjusted ${n} weekday (${n.end})`);
|
|
1264
1264
|
});
|
|
1265
1265
|
}
|
|
@@ -1274,7 +1274,7 @@ class on {
|
|
|
1274
1274
|
}), t;
|
|
1275
1275
|
}
|
|
1276
1276
|
}
|
|
1277
|
-
class
|
|
1277
|
+
class In extends ht {
|
|
1278
1278
|
strictMode;
|
|
1279
1279
|
constructor(e) {
|
|
1280
1280
|
super(), this.strictMode = e;
|
|
@@ -1294,30 +1294,30 @@ class ln extends Ze {
|
|
|
1294
1294
|
}), !1) : !0;
|
|
1295
1295
|
}
|
|
1296
1296
|
}
|
|
1297
|
-
const
|
|
1298
|
-
class
|
|
1297
|
+
const Sn = 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"), bn = 1, Fn = 2, Wn = 3, We = 4, Yn = 5, Ye = 6, ke = 7, kn = 8, ve = 9, Ge = 10;
|
|
1298
|
+
class vn extends u {
|
|
1299
1299
|
innerPattern() {
|
|
1300
|
-
return
|
|
1300
|
+
return Sn;
|
|
1301
1301
|
}
|
|
1302
1302
|
innerExtract(e, t) {
|
|
1303
1303
|
const n = e.createParsingComponents({
|
|
1304
|
-
year: parseInt(t[
|
|
1305
|
-
month: parseInt(t[
|
|
1306
|
-
day: parseInt(t[
|
|
1304
|
+
year: parseInt(t[bn]),
|
|
1305
|
+
month: parseInt(t[Fn]),
|
|
1306
|
+
day: parseInt(t[Wn])
|
|
1307
1307
|
});
|
|
1308
|
-
if (t[
|
|
1308
|
+
if (t[We] != null && (n.assign("hour", parseInt(t[We])), n.assign("minute", parseInt(t[Yn])), t[Ye] != null && n.assign("second", parseInt(t[Ye])), t[ke] != null && n.assign("millisecond", parseInt(t[ke])), t[kn] != null)) {
|
|
1309
1309
|
let s = 0;
|
|
1310
|
-
if (t[
|
|
1311
|
-
const i = parseInt(t[
|
|
1310
|
+
if (t[ve]) {
|
|
1311
|
+
const i = parseInt(t[ve]);
|
|
1312
1312
|
let a = 0;
|
|
1313
|
-
t[
|
|
1313
|
+
t[Ge] != null && (a = parseInt(t[Ge])), s = i * 60, s < 0 ? s -= a : s += a;
|
|
1314
1314
|
}
|
|
1315
1315
|
n.assign("timezoneOffset", s);
|
|
1316
1316
|
}
|
|
1317
1317
|
return n.addTag("parser/ISOFormatParser");
|
|
1318
1318
|
}
|
|
1319
1319
|
}
|
|
1320
|
-
class
|
|
1320
|
+
class Gn extends S {
|
|
1321
1321
|
mergeResults(e, t, n) {
|
|
1322
1322
|
const s = n.clone();
|
|
1323
1323
|
return s.index = t.index, s.text = t.text + e + s.text, s.start.assign("weekday", t.start.get("weekday")), s.end && s.end.assign("weekday", t.start.get("weekday")), s;
|
|
@@ -1326,58 +1326,58 @@ class Tn extends I {
|
|
|
1326
1326
|
return t.start.isOnlyWeekdayComponent() && !t.start.isCertain("hour") && n.start.isCertain("day") && e.match(/^,?\s*$/) != null;
|
|
1327
1327
|
}
|
|
1328
1328
|
}
|
|
1329
|
-
function
|
|
1330
|
-
return r.parsers.unshift(new
|
|
1329
|
+
function Q(r, e = !1) {
|
|
1330
|
+
return r.parsers.unshift(new vn()), r.refiners.unshift(new Gn()), r.refiners.unshift(new On()), r.refiners.unshift(new he()), r.refiners.push(new $n()), r.refiners.push(new he()), r.refiners.push(new Un()), r.refiners.push(new In(e)), r;
|
|
1331
1331
|
}
|
|
1332
|
-
function
|
|
1332
|
+
function ee(r) {
|
|
1333
1333
|
const e = r.getDateWithAdjustedTimezone(), t = new d(r, {});
|
|
1334
|
-
return P(t, e),
|
|
1334
|
+
return P(t, e), lt(t, e), t.assign("timezoneOffset", r.getTimezoneOffset()), t.addTag("casualReference/now"), t;
|
|
1335
1335
|
}
|
|
1336
|
-
function
|
|
1336
|
+
function te(r) {
|
|
1337
1337
|
const e = r.getDateWithAdjustedTimezone(), t = new d(r, {});
|
|
1338
|
-
return P(t, e),
|
|
1338
|
+
return P(t, e), U(t, e), t.delete("meridiem"), t.addTag("casualReference/today"), t;
|
|
1339
1339
|
}
|
|
1340
|
-
function
|
|
1341
|
-
return
|
|
1340
|
+
function ne(r) {
|
|
1341
|
+
return Ln(r).addTag("casualReference/yesterday");
|
|
1342
1342
|
}
|
|
1343
|
-
function
|
|
1344
|
-
return
|
|
1343
|
+
function se(r) {
|
|
1344
|
+
return Pe(r, 1).addTag("casualReference/tomorrow");
|
|
1345
1345
|
}
|
|
1346
|
-
function
|
|
1347
|
-
return
|
|
1346
|
+
function Ln(r, e) {
|
|
1347
|
+
return Pe(r, -1);
|
|
1348
1348
|
}
|
|
1349
|
-
function
|
|
1349
|
+
function Pe(r, e) {
|
|
1350
1350
|
const t = r.getDateWithAdjustedTimezone(), n = new d(r, {}), s = new Date(t.getTime());
|
|
1351
|
-
return s.setDate(s.getDate() + e), P(n, s),
|
|
1351
|
+
return s.setDate(s.getDate() + e), P(n, s), U(n, s), n.delete("meridiem"), n;
|
|
1352
1352
|
}
|
|
1353
|
-
function
|
|
1353
|
+
function pt(r, e = 22) {
|
|
1354
1354
|
const t = r.getDateWithAdjustedTimezone(), n = new d(r, {});
|
|
1355
1355
|
return P(n, t), n.imply("hour", e), n.imply("meridiem", c.PM), n.addTag("casualReference/tonight"), n;
|
|
1356
1356
|
}
|
|
1357
|
-
function
|
|
1357
|
+
function zn(r, e = 20) {
|
|
1358
1358
|
const t = new d(r, {});
|
|
1359
1359
|
return t.imply("meridiem", c.PM), t.imply("hour", e), t.addTag("casualReference/evening"), t;
|
|
1360
1360
|
}
|
|
1361
|
-
function
|
|
1361
|
+
function Bn(r) {
|
|
1362
1362
|
const e = new d(r, {});
|
|
1363
1363
|
return r.getDateWithAdjustedTimezone().getHours() > 2 && e.addDurationAsImplied({ day: 1 }), e.assign("hour", 0), e.imply("minute", 0), e.imply("second", 0), e.imply("millisecond", 0), e.addTag("casualReference/midnight"), e;
|
|
1364
1364
|
}
|
|
1365
|
-
function
|
|
1365
|
+
function Hn(r, e = 6) {
|
|
1366
1366
|
const t = new d(r, {});
|
|
1367
1367
|
return t.imply("meridiem", c.AM), t.imply("hour", e), t.imply("minute", 0), t.imply("second", 0), t.imply("millisecond", 0), t.addTag("casualReference/morning"), t;
|
|
1368
1368
|
}
|
|
1369
|
-
function
|
|
1369
|
+
function jn(r, e = 15) {
|
|
1370
1370
|
const t = new d(r, {});
|
|
1371
1371
|
return t.imply("meridiem", c.PM), t.imply("hour", e), t.imply("minute", 0), t.imply("second", 0), t.imply("millisecond", 0), t.addTag("casualReference/afternoon"), t;
|
|
1372
1372
|
}
|
|
1373
|
-
function
|
|
1373
|
+
function Vn(r) {
|
|
1374
1374
|
const e = new d(r, {});
|
|
1375
1375
|
return e.imply("meridiem", c.AM), e.assign("hour", 12), e.imply("minute", 0), e.imply("second", 0), e.imply("millisecond", 0), e.addTag("casualReference/noon"), e;
|
|
1376
1376
|
}
|
|
1377
|
-
const
|
|
1378
|
-
class
|
|
1377
|
+
const qn = /(now|today|tonight|tomorrow|overmorrow|tmr|tmrw|yesterday|last\s*night)(?=\W|$)/i;
|
|
1378
|
+
class Kn extends u {
|
|
1379
1379
|
innerPattern(e) {
|
|
1380
|
-
return
|
|
1380
|
+
return qn;
|
|
1381
1381
|
}
|
|
1382
1382
|
innerExtract(e, t) {
|
|
1383
1383
|
let n = e.refDate;
|
|
@@ -1385,24 +1385,24 @@ class xn extends g {
|
|
|
1385
1385
|
let i = e.createParsingComponents();
|
|
1386
1386
|
switch (s) {
|
|
1387
1387
|
case "now":
|
|
1388
|
-
i =
|
|
1388
|
+
i = ee(e.reference);
|
|
1389
1389
|
break;
|
|
1390
1390
|
case "today":
|
|
1391
|
-
i =
|
|
1391
|
+
i = te(e.reference);
|
|
1392
1392
|
break;
|
|
1393
1393
|
case "yesterday":
|
|
1394
|
-
i =
|
|
1394
|
+
i = ne(e.reference);
|
|
1395
1395
|
break;
|
|
1396
1396
|
case "tomorrow":
|
|
1397
1397
|
case "tmr":
|
|
1398
1398
|
case "tmrw":
|
|
1399
|
-
i =
|
|
1399
|
+
i = se(e.reference);
|
|
1400
1400
|
break;
|
|
1401
1401
|
case "tonight":
|
|
1402
|
-
i =
|
|
1402
|
+
i = pt(e.reference);
|
|
1403
1403
|
break;
|
|
1404
1404
|
case "overmorrow":
|
|
1405
|
-
i =
|
|
1405
|
+
i = Pe(e.reference, 2);
|
|
1406
1406
|
break;
|
|
1407
1407
|
default:
|
|
1408
1408
|
if (s.match(/last\s*night/)) {
|
|
@@ -1417,67 +1417,67 @@ class xn extends g {
|
|
|
1417
1417
|
return i.addTag("parser/ENCasualDateParser"), i;
|
|
1418
1418
|
}
|
|
1419
1419
|
}
|
|
1420
|
-
const
|
|
1421
|
-
class
|
|
1420
|
+
const Zn = /(?:this)?\s{0,3}(morning|afternoon|evening|night|midnight|midday|noon)(?=\W|$)/i;
|
|
1421
|
+
class Xn extends u {
|
|
1422
1422
|
innerPattern() {
|
|
1423
|
-
return
|
|
1423
|
+
return Zn;
|
|
1424
1424
|
}
|
|
1425
1425
|
innerExtract(e, t) {
|
|
1426
1426
|
let n = null;
|
|
1427
1427
|
switch (t[1].toLowerCase()) {
|
|
1428
1428
|
case "afternoon":
|
|
1429
|
-
n =
|
|
1429
|
+
n = jn(e.reference);
|
|
1430
1430
|
break;
|
|
1431
1431
|
case "evening":
|
|
1432
1432
|
case "night":
|
|
1433
|
-
n =
|
|
1433
|
+
n = zn(e.reference);
|
|
1434
1434
|
break;
|
|
1435
1435
|
case "midnight":
|
|
1436
|
-
n =
|
|
1436
|
+
n = Bn(e.reference);
|
|
1437
1437
|
break;
|
|
1438
1438
|
case "morning":
|
|
1439
|
-
n =
|
|
1439
|
+
n = Hn(e.reference);
|
|
1440
1440
|
break;
|
|
1441
1441
|
case "noon":
|
|
1442
1442
|
case "midday":
|
|
1443
|
-
n =
|
|
1443
|
+
n = Vn(e.reference);
|
|
1444
1444
|
break;
|
|
1445
1445
|
}
|
|
1446
1446
|
return n && n.addTag("parser/ENCasualTimeParser"), n;
|
|
1447
1447
|
}
|
|
1448
1448
|
}
|
|
1449
|
-
const
|
|
1450
|
-
class
|
|
1449
|
+
const Jn = new RegExp(`(?:(?:\\,|\\(|\\()\\s*)?(?:on\\s*?)?(?:(this|last|past|next)\\s*)?(${g(fe)}|weekend|weekday)(?:\\s*(?:\\,|\\)|\\)))?(?:\\s*(?:of\\s*)?(this|last|past|next)\\s*week)?(?=\\W|$)`, "i"), Qn = 1, es = 2, ts = 3;
|
|
1450
|
+
class ns extends u {
|
|
1451
1451
|
innerPattern() {
|
|
1452
|
-
return
|
|
1452
|
+
return Jn;
|
|
1453
1453
|
}
|
|
1454
1454
|
innerExtract(e, t) {
|
|
1455
|
-
const n = t[
|
|
1455
|
+
const n = t[Qn], s = t[ts];
|
|
1456
1456
|
let i = n || s;
|
|
1457
1457
|
i = i || "", i = i.toLowerCase();
|
|
1458
1458
|
let a = null;
|
|
1459
1459
|
i == "last" || i == "past" ? a = "last" : i == "next" ? a = "next" : i == "this" && (a = "this");
|
|
1460
|
-
const o = t[
|
|
1460
|
+
const o = t[es].toLowerCase();
|
|
1461
1461
|
let l;
|
|
1462
|
-
if (
|
|
1463
|
-
l =
|
|
1462
|
+
if (fe[o] !== void 0)
|
|
1463
|
+
l = fe[o];
|
|
1464
1464
|
else if (o == "weekend")
|
|
1465
|
-
l = a == "last" ?
|
|
1465
|
+
l = a == "last" ? m.SUNDAY : m.SATURDAY;
|
|
1466
1466
|
else if (o == "weekday") {
|
|
1467
|
-
const
|
|
1468
|
-
|
|
1467
|
+
const f = e.reference.getDateWithAdjustedTimezone().getDay();
|
|
1468
|
+
f == m.SUNDAY || f == m.SATURDAY ? l = a == "last" ? m.FRIDAY : m.MONDAY : (l = f - 1, l = a == "last" ? l - 1 : l + 1, l = l % 5 + 1);
|
|
1469
1469
|
} else
|
|
1470
1470
|
return null;
|
|
1471
|
-
return
|
|
1471
|
+
return J(e.reference, l, a);
|
|
1472
1472
|
}
|
|
1473
1473
|
}
|
|
1474
|
-
const
|
|
1475
|
-
class
|
|
1474
|
+
const ss = new RegExp(`(this|last|past|next|after\\s*this)\\s*(${g(j)})(?=\\s*)(?=\\W|$)`, "i"), rs = 1, is = 2;
|
|
1475
|
+
class as extends u {
|
|
1476
1476
|
innerPattern() {
|
|
1477
|
-
return
|
|
1477
|
+
return ss;
|
|
1478
1478
|
}
|
|
1479
1479
|
innerExtract(e, t) {
|
|
1480
|
-
const n = t[
|
|
1480
|
+
const n = t[rs].toLowerCase(), s = t[is].toLowerCase(), i = j[s];
|
|
1481
1481
|
if (n == "next" || n.startsWith("after")) {
|
|
1482
1482
|
const l = {};
|
|
1483
1483
|
return l[i] = 1, d.createRelativeFromReference(e.reference, l);
|
|
@@ -1491,22 +1491,22 @@ class Yn extends g {
|
|
|
1491
1491
|
return s.match(/week/i) ? (o.setDate(o.getDate() - o.getDay()), a.imply("day", o.getDate()), a.imply("month", o.getMonth() + 1), a.imply("year", o.getFullYear())) : s.match(/month/i) ? (o.setDate(1), a.imply("day", o.getDate()), a.assign("year", o.getFullYear()), a.assign("month", o.getMonth() + 1)) : s.match(/year/i) && (o.setDate(1), o.setMonth(0), a.imply("day", o.getDate()), a.imply("month", o.getMonth() + 1), a.assign("year", o.getFullYear())), a;
|
|
1492
1492
|
}
|
|
1493
1493
|
}
|
|
1494
|
-
const
|
|
1495
|
-
class
|
|
1494
|
+
const os = 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"), ls = 1, cs = 5, Le = 2, ze = 3, de = 4;
|
|
1495
|
+
class re {
|
|
1496
1496
|
groupNumberMonth;
|
|
1497
1497
|
groupNumberDay;
|
|
1498
1498
|
constructor(e) {
|
|
1499
|
-
this.groupNumberMonth = e ?
|
|
1499
|
+
this.groupNumberMonth = e ? ze : Le, this.groupNumberDay = e ? Le : ze;
|
|
1500
1500
|
}
|
|
1501
1501
|
pattern() {
|
|
1502
|
-
return
|
|
1502
|
+
return os;
|
|
1503
1503
|
}
|
|
1504
1504
|
extract(e, t) {
|
|
1505
|
-
const n = t.index + t[
|
|
1505
|
+
const n = t.index + t[ls].length, s = t.index + t[0].length - t[cs].length;
|
|
1506
1506
|
if (n > 0 && e.text.substring(0, n).match("\\d/?$") || s < e.text.length && e.text.substring(s).match("^/?\\d"))
|
|
1507
1507
|
return;
|
|
1508
1508
|
const i = e.text.substring(n, s);
|
|
1509
|
-
if (i.match(/^\d\.\d$/) || i.match(/^\d\.\d{1,2}\.\d{1,2}\s*$/) || !t[
|
|
1509
|
+
if (i.match(/^\d\.\d$/) || i.match(/^\d\.\d{1,2}\.\d{1,2}\s*$/) || !t[de] && i.indexOf("/") < 0)
|
|
1510
1510
|
return;
|
|
1511
1511
|
const a = e.createParsingResult(n, i);
|
|
1512
1512
|
let o = parseInt(t[this.groupNumberMonth]), l = parseInt(t[this.groupNumberDay]);
|
|
@@ -1517,95 +1517,95 @@ class ue {
|
|
|
1517
1517
|
return null;
|
|
1518
1518
|
if (l < 1 || l > 31)
|
|
1519
1519
|
return null;
|
|
1520
|
-
if (a.start.assign("day", l), a.start.assign("month", o), t[
|
|
1521
|
-
const
|
|
1522
|
-
a.start.assign("year",
|
|
1520
|
+
if (a.start.assign("day", l), a.start.assign("month", o), t[de]) {
|
|
1521
|
+
const f = parseInt(t[de]), h = Ee(f);
|
|
1522
|
+
a.start.assign("year", h);
|
|
1523
1523
|
} else {
|
|
1524
|
-
const
|
|
1525
|
-
a.start.imply("year",
|
|
1524
|
+
const f = D(e.refDate, l, o);
|
|
1525
|
+
a.start.imply("year", f);
|
|
1526
1526
|
}
|
|
1527
1527
|
return a.addTag("parser/SlashDateFormatParser");
|
|
1528
1528
|
}
|
|
1529
1529
|
}
|
|
1530
|
-
const
|
|
1531
|
-
class
|
|
1530
|
+
const us = new RegExp(`(this|last|past|next|after|\\+|-)\\s*(${W})(?=\\W|$)`, "i"), ds = new RegExp(`(this|last|past|next|after|\\+|-)\\s*(${q})(?=\\W|$)`, "i");
|
|
1531
|
+
let fs = class extends u {
|
|
1532
1532
|
allowAbbreviations;
|
|
1533
1533
|
constructor(e = !0) {
|
|
1534
1534
|
super(), this.allowAbbreviations = e;
|
|
1535
1535
|
}
|
|
1536
1536
|
innerPattern() {
|
|
1537
|
-
return this.allowAbbreviations ?
|
|
1537
|
+
return this.allowAbbreviations ? us : ds;
|
|
1538
1538
|
}
|
|
1539
1539
|
innerExtract(e, t) {
|
|
1540
1540
|
const n = t[1].toLowerCase();
|
|
1541
|
-
let s =
|
|
1541
|
+
let s = I(t[2]);
|
|
1542
1542
|
if (!s)
|
|
1543
1543
|
return null;
|
|
1544
1544
|
switch (n) {
|
|
1545
1545
|
case "last":
|
|
1546
1546
|
case "past":
|
|
1547
1547
|
case "-":
|
|
1548
|
-
s =
|
|
1548
|
+
s = x(s);
|
|
1549
1549
|
break;
|
|
1550
1550
|
}
|
|
1551
1551
|
return d.createRelativeFromReference(e.reference, s);
|
|
1552
1552
|
}
|
|
1553
|
-
}
|
|
1554
|
-
function
|
|
1553
|
+
};
|
|
1554
|
+
function ms(r) {
|
|
1555
1555
|
return r.text.match(/^[+-]/i) != null;
|
|
1556
1556
|
}
|
|
1557
|
-
function
|
|
1557
|
+
function Be(r) {
|
|
1558
1558
|
return r.text.match(/^-/i) != null;
|
|
1559
1559
|
}
|
|
1560
|
-
class
|
|
1560
|
+
class gs extends S {
|
|
1561
1561
|
shouldMergeResults(e, t, n) {
|
|
1562
|
-
return e.match(/^\s*$/i) ?
|
|
1562
|
+
return e.match(/^\s*$/i) ? ms(n) || Be(n) : !1;
|
|
1563
1563
|
}
|
|
1564
1564
|
mergeResults(e, t, n, s) {
|
|
1565
|
-
let i =
|
|
1566
|
-
|
|
1565
|
+
let i = I(n.text);
|
|
1566
|
+
Be(n) && (i = x(i));
|
|
1567
1567
|
const a = d.createRelativeFromReference(E.fromDate(t.start.date()), i);
|
|
1568
|
-
return new
|
|
1568
|
+
return new R(t.reference, t.index, `${t.text}${e}${n.text}`, a);
|
|
1569
1569
|
}
|
|
1570
1570
|
}
|
|
1571
|
-
function
|
|
1571
|
+
function He(r) {
|
|
1572
1572
|
return r.text.match(/\s+(before|from)$/i) != null;
|
|
1573
1573
|
}
|
|
1574
|
-
function
|
|
1574
|
+
function hs(r) {
|
|
1575
1575
|
return r.text.match(/\s+(after|since)$/i) != null;
|
|
1576
1576
|
}
|
|
1577
|
-
class
|
|
1577
|
+
class Ts extends S {
|
|
1578
1578
|
patternBetween() {
|
|
1579
1579
|
return /^\s*$/i;
|
|
1580
1580
|
}
|
|
1581
1581
|
shouldMergeResults(e, t, n) {
|
|
1582
|
-
return !e.match(this.patternBetween()) || !
|
|
1582
|
+
return !e.match(this.patternBetween()) || !He(t) && !hs(t) ? !1 : !!n.start.get("day") && !!n.start.get("month") && !!n.start.get("year");
|
|
1583
1583
|
}
|
|
1584
1584
|
mergeResults(e, t, n) {
|
|
1585
|
-
let s =
|
|
1586
|
-
|
|
1585
|
+
let s = I(t.text);
|
|
1586
|
+
He(t) && (s = x(s));
|
|
1587
1587
|
const i = d.createRelativeFromReference(E.fromDate(n.start.date()), s);
|
|
1588
|
-
return new
|
|
1588
|
+
return new R(n.reference, t.index, `${t.text}${e}${n.text}`, i);
|
|
1589
1589
|
}
|
|
1590
1590
|
}
|
|
1591
|
-
const
|
|
1592
|
-
class
|
|
1591
|
+
const ps = new RegExp(`^\\s*(${V})`, "i"), ys = 1;
|
|
1592
|
+
class Es {
|
|
1593
1593
|
refine(e, t) {
|
|
1594
1594
|
return t.forEach(function(n) {
|
|
1595
1595
|
if (!n.start.isDateWithUnknownYear())
|
|
1596
1596
|
return;
|
|
1597
|
-
const s = e.text.substring(n.index + n.text.length), i =
|
|
1597
|
+
const s = e.text.substring(n.index + n.text.length), i = ps.exec(s);
|
|
1598
1598
|
if (!i || i[0].trim().length <= 3)
|
|
1599
1599
|
return;
|
|
1600
1600
|
e.debug(() => {
|
|
1601
1601
|
console.log(`Extracting year: '${i[0]}' into : ${n}`);
|
|
1602
1602
|
});
|
|
1603
|
-
const a =
|
|
1603
|
+
const a = F(i[ys]);
|
|
1604
1604
|
n.end != null && n.end.assign("year", a), n.start.assign("year", a), n.text += i[0];
|
|
1605
1605
|
}), t;
|
|
1606
1606
|
}
|
|
1607
1607
|
}
|
|
1608
|
-
class
|
|
1608
|
+
class Ps extends ht {
|
|
1609
1609
|
constructor() {
|
|
1610
1610
|
super();
|
|
1611
1611
|
}
|
|
@@ -1618,39 +1618,39 @@ class qn extends Ze {
|
|
|
1618
1618
|
}), !1) : !0;
|
|
1619
1619
|
}
|
|
1620
1620
|
}
|
|
1621
|
-
class
|
|
1621
|
+
class yt {
|
|
1622
1622
|
createCasualConfiguration(e = !1) {
|
|
1623
1623
|
const t = this.createConfiguration(!1, e);
|
|
1624
|
-
return t.parsers.push(new
|
|
1624
|
+
return t.parsers.push(new Kn()), t.parsers.push(new Xn()), t.parsers.push(new Zt()), t.parsers.push(new as()), t.parsers.push(new fs()), t.refiners.push(new Ps()), t;
|
|
1625
1625
|
}
|
|
1626
1626
|
createConfiguration(e = !0, t = !1) {
|
|
1627
|
-
const n =
|
|
1627
|
+
const n = Q({
|
|
1628
1628
|
parsers: [
|
|
1629
|
-
new
|
|
1630
|
-
new
|
|
1631
|
-
new
|
|
1632
|
-
new
|
|
1633
|
-
new
|
|
1634
|
-
new
|
|
1635
|
-
new
|
|
1636
|
-
new
|
|
1637
|
-
new
|
|
1638
|
-
new
|
|
1629
|
+
new re(t),
|
|
1630
|
+
new vt(e),
|
|
1631
|
+
new zt(),
|
|
1632
|
+
new jt(t),
|
|
1633
|
+
new ns(),
|
|
1634
|
+
new dn(),
|
|
1635
|
+
new gn(e),
|
|
1636
|
+
new pn(e),
|
|
1637
|
+
new Rn(e),
|
|
1638
|
+
new on()
|
|
1639
1639
|
],
|
|
1640
|
-
refiners: [new
|
|
1640
|
+
refiners: [new Fe()]
|
|
1641
1641
|
}, e);
|
|
1642
|
-
return n.parsers.unshift(new
|
|
1642
|
+
return n.parsers.unshift(new tn(e)), n.refiners.unshift(new Ts()), n.refiners.unshift(new gs()), n.refiners.unshift(new he()), n.refiners.push(new Fe()), n.refiners.push(new Es()), n.refiners.push(new wn()), n;
|
|
1643
1643
|
}
|
|
1644
1644
|
}
|
|
1645
|
-
class
|
|
1645
|
+
class T {
|
|
1646
1646
|
parsers;
|
|
1647
1647
|
refiners;
|
|
1648
|
-
defaultConfig = new
|
|
1648
|
+
defaultConfig = new yt();
|
|
1649
1649
|
constructor(e) {
|
|
1650
1650
|
e = e || this.defaultConfig.createCasualConfiguration(), this.parsers = [...e.parsers], this.refiners = [...e.refiners];
|
|
1651
1651
|
}
|
|
1652
1652
|
clone() {
|
|
1653
|
-
return new
|
|
1653
|
+
return new T({
|
|
1654
1654
|
parsers: [...this.parsers],
|
|
1655
1655
|
refiners: [...this.refiners]
|
|
1656
1656
|
});
|
|
@@ -1660,10 +1660,10 @@ class y {
|
|
|
1660
1660
|
return s.length > 0 ? s[0].start.date() : null;
|
|
1661
1661
|
}
|
|
1662
1662
|
parse(e, t, n) {
|
|
1663
|
-
const s = new
|
|
1663
|
+
const s = new Rs(e, t, n);
|
|
1664
1664
|
let i = [];
|
|
1665
1665
|
return this.parsers.forEach((a) => {
|
|
1666
|
-
const o =
|
|
1666
|
+
const o = T.executeParser(s, a);
|
|
1667
1667
|
i = i.concat(o);
|
|
1668
1668
|
}), i.sort((a, o) => a.index - o.index), this.refiners.forEach(function(a) {
|
|
1669
1669
|
i = a.refine(s, i);
|
|
@@ -1675,20 +1675,20 @@ class y {
|
|
|
1675
1675
|
for (; o; ) {
|
|
1676
1676
|
const l = o.index + i.length - a.length;
|
|
1677
1677
|
o.index = l;
|
|
1678
|
-
const
|
|
1679
|
-
if (!
|
|
1678
|
+
const f = t.extract(e, o);
|
|
1679
|
+
if (!f) {
|
|
1680
1680
|
a = i.substring(o.index + 1), o = s.exec(a);
|
|
1681
1681
|
continue;
|
|
1682
1682
|
}
|
|
1683
|
-
let
|
|
1684
|
-
|
|
1685
|
-
const
|
|
1686
|
-
e.debug(() => console.log(`${t.constructor.name} extracted (at index=${
|
|
1683
|
+
let h = null;
|
|
1684
|
+
f instanceof R ? h = f : f instanceof d ? (h = e.createParsingResult(o.index, o[0]), h.start = f) : h = e.createParsingResult(o.index, o[0], f);
|
|
1685
|
+
const b = h.index, Ae = h.text;
|
|
1686
|
+
e.debug(() => console.log(`${t.constructor.name} extracted (at index=${b}) '${Ae}'`)), n.push(h), a = i.substring(b + Ae.length), o = s.exec(a);
|
|
1687
1687
|
}
|
|
1688
1688
|
return n;
|
|
1689
1689
|
}
|
|
1690
1690
|
}
|
|
1691
|
-
class
|
|
1691
|
+
class Rs {
|
|
1692
1692
|
text;
|
|
1693
1693
|
option;
|
|
1694
1694
|
reference;
|
|
@@ -1701,30 +1701,30 @@ class Jn {
|
|
|
1701
1701
|
}
|
|
1702
1702
|
createParsingResult(e, t, n, s) {
|
|
1703
1703
|
const i = typeof t == "string" ? t : this.text.substring(e, t), a = n ? this.createParsingComponents(n) : null, o = s ? this.createParsingComponents(s) : null;
|
|
1704
|
-
return new
|
|
1704
|
+
return new R(this.reference, e, i, a, o);
|
|
1705
1705
|
}
|
|
1706
1706
|
debug(e) {
|
|
1707
1707
|
this.option.debug && (this.option.debug instanceof Function ? this.option.debug(e) : this.option.debug.debug(e));
|
|
1708
1708
|
}
|
|
1709
1709
|
}
|
|
1710
|
-
const
|
|
1711
|
-
new
|
|
1712
|
-
new
|
|
1713
|
-
const
|
|
1710
|
+
const ie = new yt(), ws = new T(ie.createCasualConfiguration(!1));
|
|
1711
|
+
new T(ie.createConfiguration(!0, !1));
|
|
1712
|
+
new T(ie.createCasualConfiguration(!0));
|
|
1713
|
+
const yi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1714
1714
|
__proto__: null,
|
|
1715
|
-
Chrono:
|
|
1715
|
+
Chrono: T,
|
|
1716
1716
|
get Meridiem() {
|
|
1717
1717
|
return c;
|
|
1718
1718
|
},
|
|
1719
1719
|
ParsingComponents: d,
|
|
1720
|
-
ParsingResult:
|
|
1720
|
+
ParsingResult: R,
|
|
1721
1721
|
ReferenceWithTimezone: E,
|
|
1722
1722
|
get Weekday() {
|
|
1723
|
-
return
|
|
1723
|
+
return m;
|
|
1724
1724
|
},
|
|
1725
|
-
casual:
|
|
1726
|
-
configuration:
|
|
1727
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
1725
|
+
casual: ws,
|
|
1726
|
+
configuration: ie
|
|
1727
|
+
}, Symbol.toStringTag, { value: "Module" })), Et = {
|
|
1728
1728
|
domingo: 0,
|
|
1729
1729
|
dom: 0,
|
|
1730
1730
|
segunda: 1,
|
|
@@ -1745,7 +1745,7 @@ const Fs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
1745
1745
|
sábado: 6,
|
|
1746
1746
|
sabado: 6,
|
|
1747
1747
|
sab: 6
|
|
1748
|
-
},
|
|
1748
|
+
}, Pt = {
|
|
1749
1749
|
janeiro: 1,
|
|
1750
1750
|
jan: 1,
|
|
1751
1751
|
"jan.": 1,
|
|
@@ -1782,31 +1782,31 @@ const Fs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
1782
1782
|
dezembro: 12,
|
|
1783
1783
|
dez: 12,
|
|
1784
1784
|
"dez.": 12
|
|
1785
|
-
},
|
|
1786
|
-
function
|
|
1785
|
+
}, Ds = "[0-9]{1,4}(?![^\\s]\\d)(?:\\s*[a|d]\\.?\\s*c\\.?|\\s*a\\.?\\s*d\\.?)?";
|
|
1786
|
+
function $s(r) {
|
|
1787
1787
|
if (r.match(/^[0-9]{1,4}$/)) {
|
|
1788
1788
|
let e = parseInt(r);
|
|
1789
1789
|
return e < 100 && (e > 50 ? e = e + 1900 : e = e + 2e3), e;
|
|
1790
1790
|
}
|
|
1791
1791
|
return r.match(/a\.?\s*c\.?/i) ? (r = r.replace(/a\.?\s*c\.?/i, ""), -parseInt(r)) : parseInt(r);
|
|
1792
1792
|
}
|
|
1793
|
-
const
|
|
1794
|
-
class
|
|
1793
|
+
const As = new RegExp(`(?:(?:\\,|\\(|\\()\\s*)?(?:(este|esta|passado|pr[oó]ximo)\\s*)?(${g(Et)})(?:\\s*(?:\\,|\\)|\\)))?(?:\\s*(este|esta|passado|pr[óo]ximo)\\s*semana)?(?=\\W|\\d|$)`, "i"), Ns = 1, xs = 2, Ms = 3;
|
|
1794
|
+
class Os extends u {
|
|
1795
1795
|
innerPattern() {
|
|
1796
|
-
return
|
|
1796
|
+
return As;
|
|
1797
1797
|
}
|
|
1798
1798
|
innerExtract(e, t) {
|
|
1799
|
-
const n = t[
|
|
1799
|
+
const n = t[xs].toLowerCase(), s = Et[n];
|
|
1800
1800
|
if (s === void 0)
|
|
1801
1801
|
return null;
|
|
1802
|
-
const i = t[
|
|
1802
|
+
const i = t[Ns], a = t[Ms];
|
|
1803
1803
|
let o = i || a || "";
|
|
1804
1804
|
o = o.toLowerCase();
|
|
1805
1805
|
let l = null;
|
|
1806
|
-
return o == "passado" ? l = "this" : o == "próximo" || o == "proximo" ? l = "next" : o == "este" && (l = "this"),
|
|
1806
|
+
return o == "passado" ? l = "this" : o == "próximo" || o == "proximo" ? l = "next" : o == "este" && (l = "this"), J(e.reference, s, l);
|
|
1807
1807
|
}
|
|
1808
1808
|
}
|
|
1809
|
-
class
|
|
1809
|
+
class _s extends K {
|
|
1810
1810
|
primaryPrefix() {
|
|
1811
1811
|
return "(?:(?:ao?|às?|das|da|de|do)\\s*)?";
|
|
1812
1812
|
}
|
|
@@ -1814,40 +1814,40 @@ class as extends ee {
|
|
|
1814
1814
|
return "\\s*(?:\\-|\\–|\\~|\\〜|a(?:o)?|\\?)\\s*";
|
|
1815
1815
|
}
|
|
1816
1816
|
}
|
|
1817
|
-
class
|
|
1817
|
+
class Cs extends X {
|
|
1818
1818
|
patternBetween() {
|
|
1819
1819
|
return new RegExp("^\\s*(?:,|à)?\\s*$");
|
|
1820
1820
|
}
|
|
1821
1821
|
}
|
|
1822
|
-
class
|
|
1822
|
+
class Us extends Z {
|
|
1823
1823
|
patternBetween() {
|
|
1824
1824
|
return /^\s*(?:-)\s*$/i;
|
|
1825
1825
|
}
|
|
1826
1826
|
}
|
|
1827
|
-
const
|
|
1828
|
-
class
|
|
1827
|
+
const Is = new RegExp(`([0-9]{1,2})(?:º|ª|°)?(?:\\s*(?:desde|de|\\-|\\–|ao?|\\s)\\s*([0-9]{1,2})(?:º|ª|°)?)?\\s*(?:de)?\\s*(?:-|/|\\s*(?:de|,)?\\s*)(${g(Pt)})(?:\\s*(?:de|,)?\\s*(${Ds}))?(?=\\W|$)`, "i"), je = 1, Ve = 2, Ss = 3, qe = 4;
|
|
1828
|
+
class bs extends u {
|
|
1829
1829
|
innerPattern() {
|
|
1830
|
-
return
|
|
1830
|
+
return Is;
|
|
1831
1831
|
}
|
|
1832
1832
|
innerExtract(e, t) {
|
|
1833
|
-
const n = e.createParsingResult(t.index, t[0]), s =
|
|
1833
|
+
const n = e.createParsingResult(t.index, t[0]), s = Pt[t[Ss].toLowerCase()], i = parseInt(t[je]);
|
|
1834
1834
|
if (i > 31)
|
|
1835
|
-
return t.index = t.index + t[
|
|
1836
|
-
if (n.start.assign("month", s), n.start.assign("day", i), t[
|
|
1837
|
-
const a =
|
|
1835
|
+
return t.index = t.index + t[je].length, null;
|
|
1836
|
+
if (n.start.assign("month", s), n.start.assign("day", i), t[qe]) {
|
|
1837
|
+
const a = $s(t[qe]);
|
|
1838
1838
|
n.start.assign("year", a);
|
|
1839
1839
|
} else {
|
|
1840
|
-
const a =
|
|
1840
|
+
const a = D(e.refDate, i, s);
|
|
1841
1841
|
n.start.imply("year", a);
|
|
1842
1842
|
}
|
|
1843
|
-
if (t[
|
|
1844
|
-
const a = parseInt(t[
|
|
1843
|
+
if (t[Ve]) {
|
|
1844
|
+
const a = parseInt(t[Ve]);
|
|
1845
1845
|
n.end = n.start.clone(), n.end.assign("day", a);
|
|
1846
1846
|
}
|
|
1847
1847
|
return n;
|
|
1848
1848
|
}
|
|
1849
1849
|
}
|
|
1850
|
-
class
|
|
1850
|
+
class Fs extends u {
|
|
1851
1851
|
innerPattern(e) {
|
|
1852
1852
|
return /(agora|hoje|amanha|amanhã|ontem)(?=\W|$)/i;
|
|
1853
1853
|
}
|
|
@@ -1855,19 +1855,19 @@ class fs extends g {
|
|
|
1855
1855
|
const n = t[0].toLowerCase(), s = e.createParsingComponents();
|
|
1856
1856
|
switch (n) {
|
|
1857
1857
|
case "agora":
|
|
1858
|
-
return
|
|
1858
|
+
return ee(e.reference);
|
|
1859
1859
|
case "hoje":
|
|
1860
|
-
return
|
|
1860
|
+
return te(e.reference);
|
|
1861
1861
|
case "amanha":
|
|
1862
1862
|
case "amanhã":
|
|
1863
|
-
return
|
|
1863
|
+
return se(e.reference);
|
|
1864
1864
|
case "ontem":
|
|
1865
|
-
return
|
|
1865
|
+
return ne(e.reference);
|
|
1866
1866
|
}
|
|
1867
1867
|
return s;
|
|
1868
1868
|
}
|
|
1869
1869
|
}
|
|
1870
|
-
class
|
|
1870
|
+
class Ws extends u {
|
|
1871
1871
|
innerPattern() {
|
|
1872
1872
|
return /(?:esta\s*)?(manha|manhã|tarde|meia-noite|meio-dia|noite)(?=\W|$)/i;
|
|
1873
1873
|
}
|
|
@@ -1886,7 +1886,7 @@ class gs extends g {
|
|
|
1886
1886
|
break;
|
|
1887
1887
|
case "meia-noite":
|
|
1888
1888
|
const i = new Date(n.getTime());
|
|
1889
|
-
i.setDate(i.getDate() + 1), P(s, i),
|
|
1889
|
+
i.setDate(i.getDate() + 1), P(s, i), U(s, i), s.imply("hour", 0), s.imply("minute", 0), s.imply("second", 0), s.addTag("casualReference/midnight");
|
|
1890
1890
|
break;
|
|
1891
1891
|
case "meio-dia":
|
|
1892
1892
|
s.imply("meridiem", c.AM), s.imply("hour", 12), s.addTag("casualReference/noon");
|
|
@@ -1895,39 +1895,39 @@ class gs extends g {
|
|
|
1895
1895
|
return s;
|
|
1896
1896
|
}
|
|
1897
1897
|
}
|
|
1898
|
-
const
|
|
1899
|
-
new
|
|
1900
|
-
function
|
|
1901
|
-
const e =
|
|
1902
|
-
return e.parsers.push(new
|
|
1898
|
+
const Ys = new T(Rt());
|
|
1899
|
+
new T(Re(!0));
|
|
1900
|
+
function Rt(r = !0) {
|
|
1901
|
+
const e = Re(!1, r);
|
|
1902
|
+
return e.parsers.push(new Fs()), e.parsers.push(new Ws()), e;
|
|
1903
1903
|
}
|
|
1904
|
-
function
|
|
1905
|
-
return
|
|
1904
|
+
function Re(r = !0, e = !0) {
|
|
1905
|
+
return Q({
|
|
1906
1906
|
parsers: [
|
|
1907
|
-
new
|
|
1908
|
-
new
|
|
1909
|
-
new
|
|
1910
|
-
new
|
|
1907
|
+
new re(e),
|
|
1908
|
+
new Os(),
|
|
1909
|
+
new _s(),
|
|
1910
|
+
new bs()
|
|
1911
1911
|
],
|
|
1912
|
-
refiners: [new
|
|
1912
|
+
refiners: [new Cs(), new Us()]
|
|
1913
1913
|
}, r);
|
|
1914
1914
|
}
|
|
1915
|
-
const
|
|
1915
|
+
const Ei = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1916
1916
|
__proto__: null,
|
|
1917
|
-
Chrono:
|
|
1917
|
+
Chrono: T,
|
|
1918
1918
|
get Meridiem() {
|
|
1919
1919
|
return c;
|
|
1920
1920
|
},
|
|
1921
1921
|
ParsingComponents: d,
|
|
1922
|
-
ParsingResult:
|
|
1922
|
+
ParsingResult: R,
|
|
1923
1923
|
ReferenceWithTimezone: E,
|
|
1924
1924
|
get Weekday() {
|
|
1925
|
-
return
|
|
1925
|
+
return m;
|
|
1926
1926
|
},
|
|
1927
|
-
casual:
|
|
1928
|
-
createCasualConfiguration:
|
|
1929
|
-
createConfiguration:
|
|
1930
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
1927
|
+
casual: Ys,
|
|
1928
|
+
createCasualConfiguration: Rt,
|
|
1929
|
+
createConfiguration: Re
|
|
1930
|
+
}, Symbol.toStringTag, { value: "Module" })), wt = {
|
|
1931
1931
|
domingo: 0,
|
|
1932
1932
|
dom: 0,
|
|
1933
1933
|
lunes: 1,
|
|
@@ -1946,7 +1946,7 @@ const Ws = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
1946
1946
|
sabado: 6,
|
|
1947
1947
|
sáb: 6,
|
|
1948
1948
|
sab: 6
|
|
1949
|
-
},
|
|
1949
|
+
}, Dt = {
|
|
1950
1950
|
enero: 1,
|
|
1951
1951
|
ene: 1,
|
|
1952
1952
|
"ene.": 1,
|
|
@@ -1984,7 +1984,7 @@ const Ws = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
1984
1984
|
diciembre: 12,
|
|
1985
1985
|
dic: 12,
|
|
1986
1986
|
"dic.": 12
|
|
1987
|
-
},
|
|
1987
|
+
}, Te = {
|
|
1988
1988
|
uno: 1,
|
|
1989
1989
|
dos: 2,
|
|
1990
1990
|
tres: 3,
|
|
@@ -1998,7 +1998,7 @@ const Ws = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
1998
1998
|
once: 11,
|
|
1999
1999
|
doce: 12,
|
|
2000
2000
|
trece: 13
|
|
2001
|
-
},
|
|
2001
|
+
}, $t = {
|
|
2002
2002
|
sec: "second",
|
|
2003
2003
|
segundo: "second",
|
|
2004
2004
|
segundos: "second",
|
|
@@ -2021,48 +2021,48 @@ const Ws = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
2021
2021
|
cuartos: "quarter",
|
|
2022
2022
|
año: "year",
|
|
2023
2023
|
años: "year"
|
|
2024
|
-
},
|
|
2025
|
-
function
|
|
2024
|
+
}, ks = `(?:${g(Te)}|[0-9]+|[0-9]+\\.[0-9]+|un?|uno?|una?|algunos?|unos?|demi-?)`;
|
|
2025
|
+
function vs(r) {
|
|
2026
2026
|
const e = r.toLowerCase();
|
|
2027
|
-
return
|
|
2027
|
+
return Te[e] !== void 0 ? Te[e] : e === "un" || e === "una" || e === "uno" ? 1 : e.match(/algunos?/) || e.match(/unos?/) ? 3 : e.match(/media?/) ? 0.5 : parseFloat(e);
|
|
2028
2028
|
}
|
|
2029
|
-
const
|
|
2030
|
-
function
|
|
2029
|
+
const Gs = "[0-9]{1,4}(?![^\\s]\\d)(?:\\s*[a|d]\\.?\\s*c\\.?|\\s*a\\.?\\s*d\\.?)?";
|
|
2030
|
+
function Ls(r) {
|
|
2031
2031
|
if (r.match(/^[0-9]{1,4}$/)) {
|
|
2032
2032
|
let e = parseInt(r);
|
|
2033
2033
|
return e < 100 && (e > 50 ? e = e + 1900 : e = e + 2e3), e;
|
|
2034
2034
|
}
|
|
2035
2035
|
return r.match(/a\.?\s*c\.?/i) ? (r = r.replace(/a\.?\s*c\.?/i, ""), -parseInt(r)) : parseInt(r);
|
|
2036
2036
|
}
|
|
2037
|
-
const
|
|
2038
|
-
function
|
|
2037
|
+
const At = `(${ks})\\s{0,5}(${g($t)})\\s{0,5}`, Ke = new RegExp(At, "i"), zs = H("", At);
|
|
2038
|
+
function Bs(r) {
|
|
2039
2039
|
const e = {};
|
|
2040
|
-
let t = r, n =
|
|
2040
|
+
let t = r, n = Ke.exec(t);
|
|
2041
2041
|
for (; n; )
|
|
2042
|
-
|
|
2042
|
+
Hs(e, n), t = t.substring(n[0].length), n = Ke.exec(t);
|
|
2043
2043
|
return e;
|
|
2044
2044
|
}
|
|
2045
|
-
function
|
|
2046
|
-
const t =
|
|
2045
|
+
function Hs(r, e) {
|
|
2046
|
+
const t = vs(e[1]), n = $t[e[2].toLowerCase()];
|
|
2047
2047
|
r[n] = t;
|
|
2048
2048
|
}
|
|
2049
|
-
const
|
|
2050
|
-
class
|
|
2049
|
+
const js = new RegExp(`(?:(?:\\,|\\(|\\()\\s*)?(?:(este|esta|pasado|pr[oó]ximo)\\s*)?(${g(wt)})(?:\\s*(?:\\,|\\)|\\)))?(?:\\s*(este|esta|pasado|pr[óo]ximo)\\s*semana)?(?=\\W|\\d|$)`, "i"), Vs = 1, qs = 2, Ks = 3;
|
|
2050
|
+
class Zs extends u {
|
|
2051
2051
|
innerPattern() {
|
|
2052
|
-
return
|
|
2052
|
+
return js;
|
|
2053
2053
|
}
|
|
2054
2054
|
innerExtract(e, t) {
|
|
2055
|
-
const n = t[
|
|
2055
|
+
const n = t[qs].toLowerCase(), s = wt[n];
|
|
2056
2056
|
if (s === void 0)
|
|
2057
2057
|
return null;
|
|
2058
|
-
const i = t[
|
|
2058
|
+
const i = t[Vs], a = t[Ks];
|
|
2059
2059
|
let o = i || a || "";
|
|
2060
2060
|
o = o.toLowerCase();
|
|
2061
2061
|
let l = null;
|
|
2062
|
-
return o == "pasado" ? l = "this" : o == "próximo" || o == "proximo" ? l = "next" : o == "este" && (l = "this"),
|
|
2062
|
+
return o == "pasado" ? l = "this" : o == "próximo" || o == "proximo" ? l = "next" : o == "este" && (l = "this"), J(e.reference, s, l);
|
|
2063
2063
|
}
|
|
2064
2064
|
}
|
|
2065
|
-
class
|
|
2065
|
+
class Xs extends K {
|
|
2066
2066
|
primaryPrefix() {
|
|
2067
2067
|
return "(?:(?:aslas|deslas|las?|al?|de|del)\\s*)?";
|
|
2068
2068
|
}
|
|
@@ -2070,40 +2070,40 @@ class Os extends ee {
|
|
|
2070
2070
|
return "\\s*(?:\\-|\\–|\\~|\\〜|a(?:l)?|\\?)\\s*";
|
|
2071
2071
|
}
|
|
2072
2072
|
}
|
|
2073
|
-
class
|
|
2073
|
+
class Js extends X {
|
|
2074
2074
|
patternBetween() {
|
|
2075
2075
|
return new RegExp("^\\s*(?:,|de|aslas|a)?\\s*$");
|
|
2076
2076
|
}
|
|
2077
2077
|
}
|
|
2078
|
-
class
|
|
2078
|
+
class Qs extends Z {
|
|
2079
2079
|
patternBetween() {
|
|
2080
2080
|
return /^\s*(?:-)\s*$/i;
|
|
2081
2081
|
}
|
|
2082
2082
|
}
|
|
2083
|
-
const
|
|
2084
|
-
class
|
|
2083
|
+
const er = new RegExp(`([0-9]{1,2})(?:º|ª|°)?(?:\\s*(?:desde|de|\\-|\\–|ao?|\\s)\\s*([0-9]{1,2})(?:º|ª|°)?)?\\s*(?:de)?\\s*(?:-|/|\\s*(?:de|,)?\\s*)(${g(Dt)})(?:\\s*(?:de|,)?\\s*(${Gs}))?(?=\\W|$)`, "i"), Ze = 1, Xe = 2, tr = 3, Je = 4;
|
|
2084
|
+
class nr extends u {
|
|
2085
2085
|
innerPattern() {
|
|
2086
|
-
return
|
|
2086
|
+
return er;
|
|
2087
2087
|
}
|
|
2088
2088
|
innerExtract(e, t) {
|
|
2089
|
-
const n = e.createParsingResult(t.index, t[0]), s =
|
|
2089
|
+
const n = e.createParsingResult(t.index, t[0]), s = Dt[t[tr].toLowerCase()], i = parseInt(t[Ze]);
|
|
2090
2090
|
if (i > 31)
|
|
2091
|
-
return t.index = t.index + t[
|
|
2092
|
-
if (n.start.assign("month", s), n.start.assign("day", i), t[
|
|
2093
|
-
const a =
|
|
2091
|
+
return t.index = t.index + t[Ze].length, null;
|
|
2092
|
+
if (n.start.assign("month", s), n.start.assign("day", i), t[Je]) {
|
|
2093
|
+
const a = Ls(t[Je]);
|
|
2094
2094
|
n.start.assign("year", a);
|
|
2095
2095
|
} else {
|
|
2096
|
-
const a =
|
|
2096
|
+
const a = D(e.refDate, i, s);
|
|
2097
2097
|
n.start.imply("year", a);
|
|
2098
2098
|
}
|
|
2099
|
-
if (t[
|
|
2100
|
-
const a = parseInt(t[
|
|
2099
|
+
if (t[Xe]) {
|
|
2100
|
+
const a = parseInt(t[Xe]);
|
|
2101
2101
|
n.end = n.start.clone(), n.end.assign("day", a);
|
|
2102
2102
|
}
|
|
2103
2103
|
return n;
|
|
2104
2104
|
}
|
|
2105
2105
|
}
|
|
2106
|
-
class
|
|
2106
|
+
class sr extends u {
|
|
2107
2107
|
innerPattern(e) {
|
|
2108
2108
|
return /(ahora|hoy|mañana|ayer)(?=\W|$)/i;
|
|
2109
2109
|
}
|
|
@@ -2111,18 +2111,18 @@ class Us extends g {
|
|
|
2111
2111
|
const n = t[0].toLowerCase(), s = e.createParsingComponents();
|
|
2112
2112
|
switch (n) {
|
|
2113
2113
|
case "ahora":
|
|
2114
|
-
return
|
|
2114
|
+
return ee(e.reference);
|
|
2115
2115
|
case "hoy":
|
|
2116
|
-
return
|
|
2116
|
+
return te(e.reference);
|
|
2117
2117
|
case "mañana":
|
|
2118
|
-
return
|
|
2118
|
+
return se(e.reference);
|
|
2119
2119
|
case "ayer":
|
|
2120
|
-
return
|
|
2120
|
+
return ne(e.reference);
|
|
2121
2121
|
}
|
|
2122
2122
|
return s;
|
|
2123
2123
|
}
|
|
2124
2124
|
}
|
|
2125
|
-
class
|
|
2125
|
+
class rr extends u {
|
|
2126
2126
|
innerPattern() {
|
|
2127
2127
|
return /(?:esta\s*)?(mañana|tarde|medianoche|mediodia|mediodía|noche)(?=\W|$)/i;
|
|
2128
2128
|
}
|
|
@@ -2140,7 +2140,7 @@ class Is extends g {
|
|
|
2140
2140
|
break;
|
|
2141
2141
|
case "medianoche":
|
|
2142
2142
|
const i = new Date(n.getTime());
|
|
2143
|
-
i.setDate(i.getDate() + 1), P(s, i),
|
|
2143
|
+
i.setDate(i.getDate() + 1), P(s, i), U(s, i), s.imply("hour", 0), s.imply("minute", 0), s.imply("second", 0), s.addTag("casualReference/midnight");
|
|
2144
2144
|
break;
|
|
2145
2145
|
case "mediodia":
|
|
2146
2146
|
case "mediodía":
|
|
@@ -2150,59 +2150,555 @@ class Is extends g {
|
|
|
2150
2150
|
return s;
|
|
2151
2151
|
}
|
|
2152
2152
|
}
|
|
2153
|
-
class
|
|
2153
|
+
class ir extends u {
|
|
2154
2154
|
innerPattern() {
|
|
2155
|
-
return new RegExp(`(?:en|por|durante|de|dentro de)\\s*(${
|
|
2155
|
+
return new RegExp(`(?:en|por|durante|de|dentro de)\\s*(${zs})(?=\\W|$)`, "i");
|
|
2156
2156
|
}
|
|
2157
2157
|
innerExtract(e, t) {
|
|
2158
|
-
const n =
|
|
2158
|
+
const n = Bs(t[1]);
|
|
2159
2159
|
return d.createRelativeFromReference(e.reference, n);
|
|
2160
2160
|
}
|
|
2161
2161
|
}
|
|
2162
|
-
const
|
|
2163
|
-
new
|
|
2164
|
-
function
|
|
2165
|
-
const e =
|
|
2166
|
-
return e.parsers.push(new
|
|
2162
|
+
const ar = new T(Nt());
|
|
2163
|
+
new T(we(!0));
|
|
2164
|
+
function Nt(r = !0) {
|
|
2165
|
+
const e = we(!1, r);
|
|
2166
|
+
return e.parsers.push(new sr()), e.parsers.push(new rr()), e;
|
|
2167
2167
|
}
|
|
2168
|
-
function
|
|
2169
|
-
return
|
|
2168
|
+
function we(r = !0, e = !0) {
|
|
2169
|
+
return Q({
|
|
2170
2170
|
parsers: [
|
|
2171
|
-
new
|
|
2172
|
-
new
|
|
2173
|
-
new
|
|
2174
|
-
new
|
|
2175
|
-
new
|
|
2171
|
+
new re(e),
|
|
2172
|
+
new Zs(),
|
|
2173
|
+
new Xs(),
|
|
2174
|
+
new nr(),
|
|
2175
|
+
new ir()
|
|
2176
2176
|
],
|
|
2177
|
-
refiners: [new
|
|
2177
|
+
refiners: [new Js(), new Qs()]
|
|
2178
2178
|
}, r);
|
|
2179
2179
|
}
|
|
2180
|
-
const
|
|
2180
|
+
const Pi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2181
2181
|
__proto__: null,
|
|
2182
|
-
Chrono:
|
|
2182
|
+
Chrono: T,
|
|
2183
2183
|
get Meridiem() {
|
|
2184
2184
|
return c;
|
|
2185
2185
|
},
|
|
2186
2186
|
ParsingComponents: d,
|
|
2187
|
-
ParsingResult:
|
|
2187
|
+
ParsingResult: R,
|
|
2188
2188
|
ReferenceWithTimezone: E,
|
|
2189
2189
|
get Weekday() {
|
|
2190
|
-
return
|
|
2190
|
+
return m;
|
|
2191
2191
|
},
|
|
2192
|
-
casual:
|
|
2193
|
-
createCasualConfiguration:
|
|
2194
|
-
createConfiguration:
|
|
2192
|
+
casual: ar,
|
|
2193
|
+
createCasualConfiguration: Nt,
|
|
2194
|
+
createConfiguration: we
|
|
2195
|
+
}, Symbol.toStringTag, { value: "Module" })), xt = {
|
|
2196
|
+
domenica: 0,
|
|
2197
|
+
dom: 0,
|
|
2198
|
+
lunedì: 1,
|
|
2199
|
+
lun: 1,
|
|
2200
|
+
martedì: 2,
|
|
2201
|
+
mar: 2,
|
|
2202
|
+
mercoledì: 3,
|
|
2203
|
+
merc: 3,
|
|
2204
|
+
giovedì: 4,
|
|
2205
|
+
giov: 4,
|
|
2206
|
+
venerdì: 5,
|
|
2207
|
+
ven: 5,
|
|
2208
|
+
sabato: 6,
|
|
2209
|
+
sab: 6
|
|
2210
|
+
}, Mt = {}, A = {
|
|
2211
|
+
...Mt,
|
|
2212
|
+
gennaio: 1,
|
|
2213
|
+
gen: 1,
|
|
2214
|
+
"gen.": 1,
|
|
2215
|
+
febbraio: 2,
|
|
2216
|
+
feb: 2,
|
|
2217
|
+
"feb.": 2,
|
|
2218
|
+
febraio: 2,
|
|
2219
|
+
febb: 2,
|
|
2220
|
+
"febb.": 2,
|
|
2221
|
+
marzo: 3,
|
|
2222
|
+
mar: 3,
|
|
2223
|
+
"mar.": 3,
|
|
2224
|
+
aprile: 4,
|
|
2225
|
+
apr: 4,
|
|
2226
|
+
"apr.": 4,
|
|
2227
|
+
maggio: 5,
|
|
2228
|
+
mag: 5,
|
|
2229
|
+
giugno: 6,
|
|
2230
|
+
giu: 6,
|
|
2231
|
+
luglio: 7,
|
|
2232
|
+
lug: 7,
|
|
2233
|
+
lugl: 7,
|
|
2234
|
+
"lug.": 7,
|
|
2235
|
+
agosto: 8,
|
|
2236
|
+
ago: 8,
|
|
2237
|
+
settembre: 9,
|
|
2238
|
+
set: 9,
|
|
2239
|
+
"set.": 9,
|
|
2240
|
+
sett: 9,
|
|
2241
|
+
"sett.": 9,
|
|
2242
|
+
ottobre: 10,
|
|
2243
|
+
ott: 10,
|
|
2244
|
+
"ott.": 10,
|
|
2245
|
+
novembre: 11,
|
|
2246
|
+
nov: 11,
|
|
2247
|
+
"nov.": 11,
|
|
2248
|
+
dicembre: 12,
|
|
2249
|
+
dic: 12,
|
|
2250
|
+
dice: 12,
|
|
2251
|
+
"dic.": 12
|
|
2252
|
+
}, pe = {
|
|
2253
|
+
uno: 1,
|
|
2254
|
+
due: 2,
|
|
2255
|
+
tre: 3,
|
|
2256
|
+
quattro: 4,
|
|
2257
|
+
cinque: 5,
|
|
2258
|
+
sei: 6,
|
|
2259
|
+
sette: 7,
|
|
2260
|
+
otto: 8,
|
|
2261
|
+
nove: 9,
|
|
2262
|
+
dieci: 10,
|
|
2263
|
+
undici: 11,
|
|
2264
|
+
dodici: 12
|
|
2265
|
+
}, ye = {
|
|
2266
|
+
primo: 1,
|
|
2267
|
+
secondo: 2,
|
|
2268
|
+
terzo: 3,
|
|
2269
|
+
quarto: 4,
|
|
2270
|
+
quinto: 5,
|
|
2271
|
+
sesto: 6,
|
|
2272
|
+
settimo: 7,
|
|
2273
|
+
ottavo: 8,
|
|
2274
|
+
nono: 9,
|
|
2275
|
+
decimo: 10,
|
|
2276
|
+
undicesimo: 11,
|
|
2277
|
+
dodicesimo: 12,
|
|
2278
|
+
tredicesimo: 13,
|
|
2279
|
+
quattordicesimo: 14,
|
|
2280
|
+
quindicesimo: 15,
|
|
2281
|
+
sedicesimo: 16,
|
|
2282
|
+
diciassettesimo: 17,
|
|
2283
|
+
diciottesimo: 18,
|
|
2284
|
+
diciannovesimo: 19,
|
|
2285
|
+
ventesimo: 20,
|
|
2286
|
+
ventunesimo: 21,
|
|
2287
|
+
ventiduesimo: 22,
|
|
2288
|
+
ventitreesimo: 23,
|
|
2289
|
+
ventiquattresimo: 24,
|
|
2290
|
+
venticinquesimo: 25,
|
|
2291
|
+
ventiseiesimo: 26,
|
|
2292
|
+
ventisettesimo: 27,
|
|
2293
|
+
ventottesimo: 28,
|
|
2294
|
+
ventinovesimo: 29,
|
|
2295
|
+
trentesimo: 30,
|
|
2296
|
+
trentunesimo: 31
|
|
2297
|
+
}, ae = {
|
|
2298
|
+
sec: "second",
|
|
2299
|
+
secondo: "second",
|
|
2300
|
+
secondi: "second",
|
|
2301
|
+
min: "minute",
|
|
2302
|
+
mins: "minute",
|
|
2303
|
+
minuti: "minute",
|
|
2304
|
+
h: "hour",
|
|
2305
|
+
hr: "hour",
|
|
2306
|
+
o: "hour",
|
|
2307
|
+
ora: "hour",
|
|
2308
|
+
ore: "hour",
|
|
2309
|
+
giorno: "day",
|
|
2310
|
+
giorni: "day",
|
|
2311
|
+
settimana: "week",
|
|
2312
|
+
settimane: "week",
|
|
2313
|
+
mese: "month",
|
|
2314
|
+
trimestre: "quarter",
|
|
2315
|
+
trimestri: "quarter",
|
|
2316
|
+
anni: "year",
|
|
2317
|
+
anno: "year"
|
|
2318
|
+
}, or = `(?:${g(pe)}|[0-9]+|[0-9]+\\.[0-9]+|half(?:\\s{0,2}un?)?|un?\\b(?:\\s{0,2}qualcuno)?|qualcuno|molti|a?\\s{0,2}alcuni\\s{0,2}(?:of)?)`;
|
|
2319
|
+
function lr(r) {
|
|
2320
|
+
const e = r.toLowerCase();
|
|
2321
|
+
return pe[e] !== void 0 ? pe[e] : e === "un" || e === "una" ? 1 : e.match(/alcuni/) ? 3 : e.match(/metá/) ? 0.5 : e.match(/paio/) ? 2 : e.match(/molti/) ? 7 : parseFloat(e);
|
|
2322
|
+
}
|
|
2323
|
+
const z = `(?:${g(ye)}|[0-9]{1,2}(?:mo|ndo|rzo|simo|esimo)?)`;
|
|
2324
|
+
function B(r) {
|
|
2325
|
+
let e = r.toLowerCase();
|
|
2326
|
+
return ye[e] !== void 0 ? ye[e] : (e = e.replace(/(?:imo|ndo|rzo|rto|nto|sto|tavo|nono|cimo|timo|esimo)$/i, ""), parseInt(e));
|
|
2327
|
+
}
|
|
2328
|
+
const De = "(?:[1-9][0-9]{0,3}\\s{0,2}(?:BE|AD|BC|BCE|CE)|[1-2][0-9]{3}|[5-9][0-9])";
|
|
2329
|
+
function $e(r) {
|
|
2330
|
+
if (/BE/i.test(r))
|
|
2331
|
+
return r = r.replace(/BE/i, ""), parseInt(r) - 543;
|
|
2332
|
+
if (/BCE?/i.test(r))
|
|
2333
|
+
return r = r.replace(/BCE?/i, ""), -parseInt(r);
|
|
2334
|
+
if (/(AD|CE)/i.test(r))
|
|
2335
|
+
return r = r.replace(/(AD|CE)/i, ""), parseInt(r);
|
|
2336
|
+
const e = parseInt(r);
|
|
2337
|
+
return Ee(e);
|
|
2338
|
+
}
|
|
2339
|
+
const Ot = `(${or})\\s{0,3}(${g(ae)})`, Qe = new RegExp(Ot, "i"), M = H("(?:(?:about|around)\\s{0,3})?", Ot);
|
|
2340
|
+
function Y(r) {
|
|
2341
|
+
const e = {};
|
|
2342
|
+
let t = r, n = Qe.exec(t);
|
|
2343
|
+
for (; n; )
|
|
2344
|
+
cr(e, n), t = t.substring(n[0].length).trim(), n = Qe.exec(t);
|
|
2345
|
+
return e;
|
|
2346
|
+
}
|
|
2347
|
+
function cr(r, e) {
|
|
2348
|
+
const t = lr(e[1]), n = ae[e[2].toLowerCase()];
|
|
2349
|
+
r[n] = t;
|
|
2350
|
+
}
|
|
2351
|
+
const ur = new RegExp(`(?:within|in|for)\\s*(?:(?:più o meno|intorno|approssimativamente|verso|verso le)\\s*(?:~\\s*)?)?(${M})(?=\\W|$)`, "i"), dr = new RegExp(`(?:(?:più o meno|intorno|approssimativamente|verso|verso le)\\s*(?:~\\s*)?)?(${M})(?=\\W|$)`, "i");
|
|
2352
|
+
class fr extends u {
|
|
2353
|
+
innerPattern(e) {
|
|
2354
|
+
return e.option.forwardDate ? dr : ur;
|
|
2355
|
+
}
|
|
2356
|
+
innerExtract(e, t) {
|
|
2357
|
+
const n = Y(t[1]);
|
|
2358
|
+
return d.createRelativeFromReference(e.reference, n);
|
|
2359
|
+
}
|
|
2360
|
+
}
|
|
2361
|
+
const mr = new RegExp(`(?:on\\s{0,3})?(${z})(?:\\s{0,3}(?:al|\\-|\\–|fino|alle|allo)?\\s{0,3}(${z}))?(?:-|/|\\s{0,3}(?:dal)?\\s{0,3})(${g(A)})(?:(?:-|/|,?\\s{0,3})(${De}(?![^\\s]\\d)))?(?=\\W|$)`, "i"), et = 1, tt = 2, gr = 3, nt = 4;
|
|
2362
|
+
class hr extends u {
|
|
2363
|
+
innerPattern() {
|
|
2364
|
+
return mr;
|
|
2365
|
+
}
|
|
2366
|
+
innerExtract(e, t) {
|
|
2367
|
+
const n = e.createParsingResult(t.index, t[0]), s = A[t[gr].toLowerCase()], i = B(t[et]);
|
|
2368
|
+
if (i > 31)
|
|
2369
|
+
return t.index = t.index + t[et].length, null;
|
|
2370
|
+
if (n.start.assign("month", s), n.start.assign("day", i), t[nt]) {
|
|
2371
|
+
const a = $e(t[nt]);
|
|
2372
|
+
n.start.assign("year", a);
|
|
2373
|
+
} else {
|
|
2374
|
+
const a = D(e.refDate, i, s);
|
|
2375
|
+
n.start.imply("year", a);
|
|
2376
|
+
}
|
|
2377
|
+
if (t[tt]) {
|
|
2378
|
+
const a = B(t[tt]);
|
|
2379
|
+
n.end = n.start.clone(), n.end.assign("day", a);
|
|
2380
|
+
}
|
|
2381
|
+
return n;
|
|
2382
|
+
}
|
|
2383
|
+
}
|
|
2384
|
+
const Tr = new RegExp(`(${g(A)})(?:-|/|\\s*,?\\s*)(${z})(?!\\s*(?:am|pm))\\s*(?:(?:al|\\-|\\alle|\\del|\\s)\\s*(${z})\\s*)?(?:(?:-|/|\\s*,?\\s*)(${De}))?(?=\\W|$)(?!\\:\\d)`, "i"), pr = 1, yr = 2, st = 3, rt = 4;
|
|
2385
|
+
class Er extends u {
|
|
2386
|
+
innerPattern() {
|
|
2387
|
+
return Tr;
|
|
2388
|
+
}
|
|
2389
|
+
innerExtract(e, t) {
|
|
2390
|
+
const n = A[t[pr].toLowerCase()], s = B(t[yr]);
|
|
2391
|
+
if (s > 31)
|
|
2392
|
+
return null;
|
|
2393
|
+
const i = e.createParsingComponents({
|
|
2394
|
+
day: s,
|
|
2395
|
+
month: n
|
|
2396
|
+
});
|
|
2397
|
+
if (t[rt]) {
|
|
2398
|
+
const l = $e(t[rt]);
|
|
2399
|
+
i.assign("year", l);
|
|
2400
|
+
} else {
|
|
2401
|
+
const l = D(e.refDate, s, n);
|
|
2402
|
+
i.imply("year", l);
|
|
2403
|
+
}
|
|
2404
|
+
if (!t[st])
|
|
2405
|
+
return i;
|
|
2406
|
+
const a = B(t[st]), o = e.createParsingResult(t.index, t[0]);
|
|
2407
|
+
return o.start = i, o.end = i.clone(), o.end.assign("day", a), o;
|
|
2408
|
+
}
|
|
2409
|
+
}
|
|
2410
|
+
const Pr = new RegExp(`((?:in)\\s*)?(${g(A)})\\s*(?:[,-]?\\s*(${De})?)?(?=[^\\s\\w]|\\s+[^0-9]|\\s+$|$)`, "i"), Rr = 1, wr = 2, it = 3;
|
|
2411
|
+
class Dr extends u {
|
|
2412
|
+
innerPattern() {
|
|
2413
|
+
return Pr;
|
|
2414
|
+
}
|
|
2415
|
+
innerExtract(e, t) {
|
|
2416
|
+
const n = t[wr].toLowerCase();
|
|
2417
|
+
if (t[0].length <= 3 && !Mt[n])
|
|
2418
|
+
return null;
|
|
2419
|
+
const s = e.createParsingResult(t.index + (t[Rr] || "").length, t.index + t[0].length);
|
|
2420
|
+
s.start.imply("day", 1);
|
|
2421
|
+
const i = A[n];
|
|
2422
|
+
if (s.start.assign("month", i), t[it]) {
|
|
2423
|
+
const a = $e(t[it]);
|
|
2424
|
+
s.start.assign("year", a);
|
|
2425
|
+
} else {
|
|
2426
|
+
const a = D(e.refDate, 1, i);
|
|
2427
|
+
s.start.imply("year", a);
|
|
2428
|
+
}
|
|
2429
|
+
return s;
|
|
2430
|
+
}
|
|
2431
|
+
}
|
|
2432
|
+
const $r = new RegExp(`([0-9]{4})[\\.\\/\\s](?:(${g(A)})|([0-9]{1,2}))[\\.\\/\\s]([0-9]{1,2})(?=\\W|$)`, "i"), Ar = 1, Nr = 2, at = 3, xr = 4;
|
|
2433
|
+
class Mr extends u {
|
|
2434
|
+
innerPattern() {
|
|
2435
|
+
return $r;
|
|
2436
|
+
}
|
|
2437
|
+
innerExtract(e, t) {
|
|
2438
|
+
const n = t[at] ? parseInt(t[at]) : A[t[Nr].toLowerCase()];
|
|
2439
|
+
if (n < 1 || n > 12)
|
|
2440
|
+
return null;
|
|
2441
|
+
const s = parseInt(t[Ar]);
|
|
2442
|
+
return {
|
|
2443
|
+
day: parseInt(t[xr]),
|
|
2444
|
+
month: n,
|
|
2445
|
+
year: s
|
|
2446
|
+
};
|
|
2447
|
+
}
|
|
2448
|
+
}
|
|
2449
|
+
const Or = new RegExp("([0-9]|0[1-9]|1[012])/([0-9]{4})", "i"), _r = 1, Cr = 2;
|
|
2450
|
+
class Ur extends u {
|
|
2451
|
+
innerPattern() {
|
|
2452
|
+
return Or;
|
|
2453
|
+
}
|
|
2454
|
+
innerExtract(e, t) {
|
|
2455
|
+
const n = parseInt(t[Cr]), s = parseInt(t[_r]);
|
|
2456
|
+
return e.createParsingComponents().imply("day", 1).assign("month", s).assign("year", n);
|
|
2457
|
+
}
|
|
2458
|
+
}
|
|
2459
|
+
class Ir extends K {
|
|
2460
|
+
constructor(e) {
|
|
2461
|
+
super(e);
|
|
2462
|
+
}
|
|
2463
|
+
followingPhase() {
|
|
2464
|
+
return "\\s*(?:\\-|\\–|\\~|\\〜|to|\\?)\\s*";
|
|
2465
|
+
}
|
|
2466
|
+
primaryPrefix() {
|
|
2467
|
+
return "(?:(?:alle|dalle)\\s*)??";
|
|
2468
|
+
}
|
|
2469
|
+
primarySuffix() {
|
|
2470
|
+
return "(?:\\s*(?:in punto|o\\W*in punto|(?:di|del|della|in|al|alla|alle)\\s*(?:mattina|pomeriggio|sera)))?(?!/)(?=\\W|$)";
|
|
2471
|
+
}
|
|
2472
|
+
extractPrimaryTimeComponents(e, t) {
|
|
2473
|
+
const n = super.extractPrimaryTimeComponents(e, t);
|
|
2474
|
+
if (n) {
|
|
2475
|
+
if (t[0].endsWith("sera")) {
|
|
2476
|
+
const s = n.get("hour");
|
|
2477
|
+
s >= 6 && s < 12 ? (n.assign("hour", n.get("hour") + 12), n.assign("meridiem", c.PM)) : s < 6 && n.assign("meridiem", c.AM);
|
|
2478
|
+
}
|
|
2479
|
+
if (t[0].endsWith("pomeriggio")) {
|
|
2480
|
+
n.assign("meridiem", c.PM);
|
|
2481
|
+
const s = n.get("hour");
|
|
2482
|
+
s >= 0 && s <= 6 && n.assign("hour", n.get("hour") + 12);
|
|
2483
|
+
}
|
|
2484
|
+
t[0].endsWith("mattina") && (n.assign("meridiem", c.AM), n.get("hour") < 12 && n.assign("hour", n.get("hour")));
|
|
2485
|
+
}
|
|
2486
|
+
return n;
|
|
2487
|
+
}
|
|
2488
|
+
}
|
|
2489
|
+
const Sr = new RegExp(`(${M})\\s{0,5}(?:fa|prima|precedente)(?=(?:\\W|$))`, "i"), br = new RegExp(`(${M})\\s{0,5}fa(?=(?:\\W|$))`, "i");
|
|
2490
|
+
class Fr extends u {
|
|
2491
|
+
strictMode;
|
|
2492
|
+
constructor(e) {
|
|
2493
|
+
super(), this.strictMode = e;
|
|
2494
|
+
}
|
|
2495
|
+
innerPattern() {
|
|
2496
|
+
return this.strictMode ? br : Sr;
|
|
2497
|
+
}
|
|
2498
|
+
innerExtract(e, t) {
|
|
2499
|
+
const n = Y(t[1]), s = x(n);
|
|
2500
|
+
return d.createRelativeFromReference(e.reference, s);
|
|
2501
|
+
}
|
|
2502
|
+
}
|
|
2503
|
+
const Wr = new RegExp(`(${M})\\s{0,5}(?:dopo|più tardi|da adesso|avanti|oltre|a seguire)(?=(?:\\W|$))`, "i"), Yr = new RegExp("(" + M + ")(dopo|più tardi)(?=(?:\\W|$))", "i"), kr = 1;
|
|
2504
|
+
class vr extends u {
|
|
2505
|
+
strictMode;
|
|
2506
|
+
constructor(e) {
|
|
2507
|
+
super(), this.strictMode = e;
|
|
2508
|
+
}
|
|
2509
|
+
innerPattern() {
|
|
2510
|
+
return this.strictMode ? Yr : Wr;
|
|
2511
|
+
}
|
|
2512
|
+
innerExtract(e, t) {
|
|
2513
|
+
const n = Y(t[kr]);
|
|
2514
|
+
return d.createRelativeFromReference(e.reference, n);
|
|
2515
|
+
}
|
|
2516
|
+
}
|
|
2517
|
+
class Gr extends Z {
|
|
2518
|
+
patternBetween() {
|
|
2519
|
+
return /^\s*(to|-)\s*$/i;
|
|
2520
|
+
}
|
|
2521
|
+
}
|
|
2522
|
+
class Lr extends X {
|
|
2523
|
+
patternBetween() {
|
|
2524
|
+
return new RegExp("^\\s*(T|alle|dopo|prima|il|di|del|delle|,|-)?\\s*$");
|
|
2525
|
+
}
|
|
2526
|
+
}
|
|
2527
|
+
const zr = /(ora|oggi|stasera|questa sera|domani|dmn|ieri\s*sera)(?=\W|$)/i;
|
|
2528
|
+
class Br extends u {
|
|
2529
|
+
innerPattern(e) {
|
|
2530
|
+
return zr;
|
|
2531
|
+
}
|
|
2532
|
+
innerExtract(e, t) {
|
|
2533
|
+
let n = e.refDate;
|
|
2534
|
+
const s = t[0].toLowerCase(), i = e.createParsingComponents();
|
|
2535
|
+
switch (s) {
|
|
2536
|
+
case "ora":
|
|
2537
|
+
return ee(e.reference);
|
|
2538
|
+
case "oggi":
|
|
2539
|
+
return te(e.reference);
|
|
2540
|
+
case "ieri":
|
|
2541
|
+
return ne(e.reference);
|
|
2542
|
+
case "domani":
|
|
2543
|
+
case "dmn":
|
|
2544
|
+
return se(e.reference);
|
|
2545
|
+
case "stasera":
|
|
2546
|
+
case "questa sera":
|
|
2547
|
+
return pt(e.reference);
|
|
2548
|
+
default:
|
|
2549
|
+
if (s.match(/ieri\s*sera/)) {
|
|
2550
|
+
if (n.getHours() > 6) {
|
|
2551
|
+
const a = new Date(n.getTime());
|
|
2552
|
+
a.setDate(a.getDate() - 1), n = a;
|
|
2553
|
+
}
|
|
2554
|
+
P(i, n), i.imply("hour", 0);
|
|
2555
|
+
}
|
|
2556
|
+
break;
|
|
2557
|
+
}
|
|
2558
|
+
return i;
|
|
2559
|
+
}
|
|
2560
|
+
}
|
|
2561
|
+
const Hr = /(?:questo|questa)?\s{0,3}(mattina|pomeriggio|sera|notte|mezzanotte|mezzogiorno)(?=\W|$)/i;
|
|
2562
|
+
class jr extends u {
|
|
2563
|
+
innerPattern() {
|
|
2564
|
+
return Hr;
|
|
2565
|
+
}
|
|
2566
|
+
innerExtract(e, t) {
|
|
2567
|
+
const n = e.refDate, s = e.createParsingComponents();
|
|
2568
|
+
switch (t[1].toLowerCase()) {
|
|
2569
|
+
case "pomeriggio":
|
|
2570
|
+
s.imply("meridiem", c.PM), s.imply("hour", 15), s.addTag("casualReference/afternoon");
|
|
2571
|
+
break;
|
|
2572
|
+
case "sera":
|
|
2573
|
+
case "notte":
|
|
2574
|
+
s.imply("meridiem", c.PM), s.imply("hour", 20), s.addTag("casualReference/evening");
|
|
2575
|
+
break;
|
|
2576
|
+
case "mezzanotte":
|
|
2577
|
+
const i = new Date(n.getTime());
|
|
2578
|
+
i.setDate(i.getDate() + 1), P(s, i), U(s, i), s.imply("hour", 0), s.imply("minute", 0), s.imply("second", 0), s.addTag("casualReference/midnight");
|
|
2579
|
+
break;
|
|
2580
|
+
case "mattina":
|
|
2581
|
+
s.imply("meridiem", c.AM), s.imply("hour", 6), s.addTag("casualReference/morning");
|
|
2582
|
+
break;
|
|
2583
|
+
case "mezzogiorno":
|
|
2584
|
+
s.imply("meridiem", c.AM), s.imply("hour", 12), s.addTag("casualReference/noon");
|
|
2585
|
+
break;
|
|
2586
|
+
}
|
|
2587
|
+
return s;
|
|
2588
|
+
}
|
|
2589
|
+
}
|
|
2590
|
+
const Vr = new RegExp(`(?:(?:\\,|\\(|\\()\\s*)?(?:il\\s*?)?(?:(questa|l'ultima|scorsa|prossima)\\s*)?(${g(xt)})(?:\\s*(?:\\,|\\)|\\)))?(?:\\s*(questa|l'ultima|scorsa|prossima)\\s*settimana)?(?=\\W|$)`, "i"), qr = 1, Kr = 2, Zr = 3;
|
|
2591
|
+
class Xr extends u {
|
|
2592
|
+
innerPattern() {
|
|
2593
|
+
return Vr;
|
|
2594
|
+
}
|
|
2595
|
+
innerExtract(e, t) {
|
|
2596
|
+
const n = t[Kr].toLowerCase(), s = xt[n], i = t[qr], a = t[Zr];
|
|
2597
|
+
let o = i || a;
|
|
2598
|
+
o = o || "", o = o.toLowerCase();
|
|
2599
|
+
let l = null;
|
|
2600
|
+
return o == "ultima" || o == "scorsa" ? l = "ultima" : o == "prossima" ? l = "prossima" : o == "questa" && (l = "questa"), J(e.reference, s, l);
|
|
2601
|
+
}
|
|
2602
|
+
}
|
|
2603
|
+
const Jr = new RegExp(`(questo|ultimo|scorso|prossimo|dopo\\s*questo|questa|ultima|scorsa|prossima\\s*questa)\\s*(${g(ae)})(?=\\s*)(?=\\W|$)`, "i"), Qr = 1, ei = 2;
|
|
2604
|
+
class ti extends u {
|
|
2605
|
+
innerPattern() {
|
|
2606
|
+
return Jr;
|
|
2607
|
+
}
|
|
2608
|
+
innerExtract(e, t) {
|
|
2609
|
+
const n = t[Qr].toLowerCase(), s = t[ei].toLowerCase(), i = ae[s];
|
|
2610
|
+
if (n == "prossimo" || n.startsWith("dopo")) {
|
|
2611
|
+
const l = {};
|
|
2612
|
+
return l[i] = 1, d.createRelativeFromReference(e.reference, l);
|
|
2613
|
+
}
|
|
2614
|
+
if (n == "prima" || n == "precedente") {
|
|
2615
|
+
const l = {};
|
|
2616
|
+
return l[i] = -1, d.createRelativeFromReference(e.reference, l);
|
|
2617
|
+
}
|
|
2618
|
+
const a = e.createParsingComponents();
|
|
2619
|
+
let o = new Date(e.reference.instant.getTime());
|
|
2620
|
+
return s.match(/settimana/i) ? (o.setDate(o.getDate() - o.getDay()), a.imply("day", o.getDate()), a.imply("month", o.getMonth() + 1), a.imply("year", o.getFullYear())) : s.match(/mese/i) ? (o.setDate(1), a.imply("day", o.getDate()), a.assign("year", o.getFullYear()), a.assign("month", o.getMonth() + 1)) : s.match(/anno/i) && (o.setDate(1), o.setMonth(0), a.imply("day", o.getDate()), a.imply("month", o.getMonth() + 1), a.assign("year", o.getFullYear())), a;
|
|
2621
|
+
}
|
|
2622
|
+
}
|
|
2623
|
+
const ni = new RegExp(`(questo|ultimo|passato|prossimo|dopo|questa|ultima|passata|prossima|\\+|-)\\s*(${M})(?=\\W|$)`, "i");
|
|
2624
|
+
class si extends u {
|
|
2625
|
+
innerPattern() {
|
|
2626
|
+
return ni;
|
|
2627
|
+
}
|
|
2628
|
+
innerExtract(e, t) {
|
|
2629
|
+
const n = t[1].toLowerCase();
|
|
2630
|
+
let s = Y(t[2]);
|
|
2631
|
+
switch (n) {
|
|
2632
|
+
case "last":
|
|
2633
|
+
case "past":
|
|
2634
|
+
case "-":
|
|
2635
|
+
s = x(s);
|
|
2636
|
+
break;
|
|
2637
|
+
}
|
|
2638
|
+
return d.createRelativeFromReference(e.reference, s);
|
|
2639
|
+
}
|
|
2640
|
+
}
|
|
2641
|
+
function ot(r) {
|
|
2642
|
+
return r.text.match(/\s+(prima|dal)$/i) != null;
|
|
2643
|
+
}
|
|
2644
|
+
function ri(r) {
|
|
2645
|
+
return r.text.match(/\s+(dopo|dal|fino)$/i) != null;
|
|
2646
|
+
}
|
|
2647
|
+
class ii extends S {
|
|
2648
|
+
patternBetween() {
|
|
2649
|
+
return /^\s*$/i;
|
|
2650
|
+
}
|
|
2651
|
+
shouldMergeResults(e, t, n) {
|
|
2652
|
+
return !e.match(this.patternBetween()) || !ot(t) && !ri(t) ? !1 : !!n.start.get("day") && !!n.start.get("month") && !!n.start.get("year");
|
|
2653
|
+
}
|
|
2654
|
+
mergeResults(e, t, n) {
|
|
2655
|
+
let s = Y(t.text);
|
|
2656
|
+
ot(t) && (s = x(s));
|
|
2657
|
+
const i = d.createRelativeFromReference(E.fromDate(n.start.date()), s);
|
|
2658
|
+
return new R(n.reference, t.index, `${t.text}${e}${n.text}`, i);
|
|
2659
|
+
}
|
|
2660
|
+
}
|
|
2661
|
+
const ai = new T(_t(!1));
|
|
2662
|
+
new T(oe(!0, !1));
|
|
2663
|
+
new T(oe(!1, !0));
|
|
2664
|
+
function _t(r = !1) {
|
|
2665
|
+
const e = oe(!1, r);
|
|
2666
|
+
return e.parsers.unshift(new Br()), e.parsers.unshift(new jr()), e.parsers.unshift(new Dr()), e.parsers.unshift(new ti()), e.parsers.unshift(new si()), e;
|
|
2667
|
+
}
|
|
2668
|
+
function oe(r = !0, e = !1) {
|
|
2669
|
+
return Q({
|
|
2670
|
+
parsers: [
|
|
2671
|
+
new re(e),
|
|
2672
|
+
new fr(),
|
|
2673
|
+
new hr(),
|
|
2674
|
+
new Er(),
|
|
2675
|
+
new Xr(),
|
|
2676
|
+
new Mr(),
|
|
2677
|
+
new Ur(),
|
|
2678
|
+
new Ir(r),
|
|
2679
|
+
new Fr(r),
|
|
2680
|
+
new vr(r)
|
|
2681
|
+
],
|
|
2682
|
+
refiners: [new ii(), new Lr(), new Gr()]
|
|
2683
|
+
}, r);
|
|
2684
|
+
}
|
|
2685
|
+
const Ri = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2686
|
+
__proto__: null,
|
|
2687
|
+
casual: ai,
|
|
2688
|
+
createCasualConfiguration: _t,
|
|
2689
|
+
createConfiguration: oe
|
|
2195
2690
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2196
2691
|
export {
|
|
2197
|
-
|
|
2692
|
+
T as Chrono,
|
|
2198
2693
|
c as Meridiem,
|
|
2199
2694
|
d as ParsingComponents,
|
|
2200
|
-
|
|
2201
|
-
|
|
2695
|
+
Rs as ParsingContext,
|
|
2696
|
+
R as ParsingResult,
|
|
2202
2697
|
E as ReferenceWithTimezone,
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2698
|
+
m as Weekday,
|
|
2699
|
+
yi as en,
|
|
2700
|
+
Pi as es,
|
|
2701
|
+
Ri as it,
|
|
2702
|
+
Ei as pt
|
|
2207
2703
|
};
|
|
2208
|
-
//# sourceMappingURL=index-
|
|
2704
|
+
//# sourceMappingURL=index-i49DPVb4.js.map
|