ai-client-sdk 4.1.1 → 4.1.3
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/es/ai-client-sdk.mjs +2519 -0
- package/dist/es/rolldown-runtime-DC4cgjXG.mjs +20 -0
- package/dist/es/vendor-ajv-BgE6aqKX.mjs +4290 -0
- package/dist/es/vendor-chrono-node-CYhWNUSM.mjs +2015 -0
- package/dist/es/vendor-markdown-CMw5eKCm.mjs +7664 -0
- package/dist/es/vendor-react-dom-Dt3jXKg5.mjs +33454 -0
- package/dist/{ai-client-sdk.umd.js → umd/ai-client-sdk.umd.js} +103 -103
- package/package.json +8 -7
- package/dist/ai-client-sdk.mjs +0 -49944
|
@@ -0,0 +1,2015 @@
|
|
|
1
|
+
//#region node_modules/.pnpm/chrono-node@2.9.1/node_modules/chrono-node/dist/esm/types.js
|
|
2
|
+
var e;
|
|
3
|
+
(function(e) {
|
|
4
|
+
e[e.AM = 0] = "AM", e[e.PM = 1] = "PM";
|
|
5
|
+
})(e ||= {});
|
|
6
|
+
var t;
|
|
7
|
+
(function(e) {
|
|
8
|
+
e[e.SUNDAY = 0] = "SUNDAY", e[e.MONDAY = 1] = "MONDAY", e[e.TUESDAY = 2] = "TUESDAY", e[e.WEDNESDAY = 3] = "WEDNESDAY", e[e.THURSDAY = 4] = "THURSDAY", e[e.FRIDAY = 5] = "FRIDAY", e[e.SATURDAY = 6] = "SATURDAY";
|
|
9
|
+
})(t ||= {});
|
|
10
|
+
var n;
|
|
11
|
+
(function(e) {
|
|
12
|
+
e[e.JANUARY = 1] = "JANUARY", e[e.FEBRUARY = 2] = "FEBRUARY", e[e.MARCH = 3] = "MARCH", e[e.APRIL = 4] = "APRIL", e[e.MAY = 5] = "MAY", e[e.JUNE = 6] = "JUNE", e[e.JULY = 7] = "JULY", e[e.AUGUST = 8] = "AUGUST", e[e.SEPTEMBER = 9] = "SEPTEMBER", e[e.OCTOBER = 10] = "OCTOBER", e[e.NOVEMBER = 11] = "NOVEMBER", e[e.DECEMBER = 12] = "DECEMBER";
|
|
13
|
+
})(n ||= {});
|
|
14
|
+
//#endregion
|
|
15
|
+
//#region node_modules/.pnpm/chrono-node@2.9.1/node_modules/chrono-node/dist/esm/utils/dates.js
|
|
16
|
+
function r(e, t) {
|
|
17
|
+
e.assign("day", t.getDate()), e.assign("month", t.getMonth() + 1), e.assign("year", t.getFullYear());
|
|
18
|
+
}
|
|
19
|
+
function i(t, n) {
|
|
20
|
+
t.assign("hour", n.getHours()), t.assign("minute", n.getMinutes()), t.assign("second", n.getSeconds()), t.assign("millisecond", n.getMilliseconds()), t.assign("meridiem", n.getHours() < 12 ? e.AM : e.PM);
|
|
21
|
+
}
|
|
22
|
+
function a(e, t) {
|
|
23
|
+
e.imply("day", t.getDate()), e.imply("month", t.getMonth() + 1), e.imply("year", t.getFullYear());
|
|
24
|
+
}
|
|
25
|
+
function o(t, n) {
|
|
26
|
+
t.imply("hour", n.getHours()), t.imply("minute", n.getMinutes()), t.imply("second", n.getSeconds()), t.imply("millisecond", n.getMilliseconds()), t.imply("meridiem", n.getHours() < 12 ? e.AM : e.PM);
|
|
27
|
+
}
|
|
28
|
+
//#endregion
|
|
29
|
+
//#region node_modules/.pnpm/chrono-node@2.9.1/node_modules/chrono-node/dist/esm/timezone.js
|
|
30
|
+
var s = {
|
|
31
|
+
ACDT: 630,
|
|
32
|
+
ACST: 570,
|
|
33
|
+
ADT: -180,
|
|
34
|
+
AEDT: 660,
|
|
35
|
+
AEST: 600,
|
|
36
|
+
AFT: 270,
|
|
37
|
+
AKDT: -480,
|
|
38
|
+
AKST: -540,
|
|
39
|
+
ALMT: 360,
|
|
40
|
+
AMST: -180,
|
|
41
|
+
AMT: -240,
|
|
42
|
+
ANAST: 720,
|
|
43
|
+
ANAT: 720,
|
|
44
|
+
AQTT: 300,
|
|
45
|
+
ART: -180,
|
|
46
|
+
AST: -240,
|
|
47
|
+
AWDT: 540,
|
|
48
|
+
AWST: 480,
|
|
49
|
+
AZOST: 0,
|
|
50
|
+
AZOT: -60,
|
|
51
|
+
AZST: 300,
|
|
52
|
+
AZT: 240,
|
|
53
|
+
BNT: 480,
|
|
54
|
+
BOT: -240,
|
|
55
|
+
BRST: -120,
|
|
56
|
+
BRT: -180,
|
|
57
|
+
BST: 60,
|
|
58
|
+
BTT: 360,
|
|
59
|
+
CAST: 480,
|
|
60
|
+
CAT: 120,
|
|
61
|
+
CCT: 390,
|
|
62
|
+
CDT: -300,
|
|
63
|
+
CEST: 120,
|
|
64
|
+
CET: {
|
|
65
|
+
timezoneOffsetDuringDst: 120,
|
|
66
|
+
timezoneOffsetNonDst: 60,
|
|
67
|
+
dstStart: (e) => l(e, n.MARCH, t.SUNDAY, 2),
|
|
68
|
+
dstEnd: (e) => l(e, n.OCTOBER, t.SUNDAY, 3)
|
|
69
|
+
},
|
|
70
|
+
CHADT: 825,
|
|
71
|
+
CHAST: 765,
|
|
72
|
+
CKT: -600,
|
|
73
|
+
CLST: -180,
|
|
74
|
+
CLT: -240,
|
|
75
|
+
COT: -300,
|
|
76
|
+
CST: -360,
|
|
77
|
+
CT: {
|
|
78
|
+
timezoneOffsetDuringDst: -300,
|
|
79
|
+
timezoneOffsetNonDst: -360,
|
|
80
|
+
dstStart: (e) => c(e, n.MARCH, t.SUNDAY, 2, 2),
|
|
81
|
+
dstEnd: (e) => c(e, n.NOVEMBER, t.SUNDAY, 1, 2)
|
|
82
|
+
},
|
|
83
|
+
CVT: -60,
|
|
84
|
+
CXT: 420,
|
|
85
|
+
ChST: 600,
|
|
86
|
+
DAVT: 420,
|
|
87
|
+
EASST: -300,
|
|
88
|
+
EAST: -360,
|
|
89
|
+
EAT: 180,
|
|
90
|
+
ECT: -300,
|
|
91
|
+
EDT: -240,
|
|
92
|
+
EEST: 180,
|
|
93
|
+
EET: 120,
|
|
94
|
+
EGST: 0,
|
|
95
|
+
EGT: -60,
|
|
96
|
+
EST: -300,
|
|
97
|
+
ET: {
|
|
98
|
+
timezoneOffsetDuringDst: -240,
|
|
99
|
+
timezoneOffsetNonDst: -300,
|
|
100
|
+
dstStart: (e) => c(e, n.MARCH, t.SUNDAY, 2, 2),
|
|
101
|
+
dstEnd: (e) => c(e, n.NOVEMBER, t.SUNDAY, 1, 2)
|
|
102
|
+
},
|
|
103
|
+
FJST: 780,
|
|
104
|
+
FJT: 720,
|
|
105
|
+
FKST: -180,
|
|
106
|
+
FKT: -240,
|
|
107
|
+
FNT: -120,
|
|
108
|
+
GALT: -360,
|
|
109
|
+
GAMT: -540,
|
|
110
|
+
GET: 240,
|
|
111
|
+
GFT: -180,
|
|
112
|
+
GILT: 720,
|
|
113
|
+
GMT: 0,
|
|
114
|
+
GST: 240,
|
|
115
|
+
GYT: -240,
|
|
116
|
+
HAA: -180,
|
|
117
|
+
HAC: -300,
|
|
118
|
+
HADT: -540,
|
|
119
|
+
HAE: -240,
|
|
120
|
+
HAP: -420,
|
|
121
|
+
HAR: -360,
|
|
122
|
+
HAST: -600,
|
|
123
|
+
HAT: -90,
|
|
124
|
+
HAY: -480,
|
|
125
|
+
HKT: 480,
|
|
126
|
+
HLV: -210,
|
|
127
|
+
HNA: -240,
|
|
128
|
+
HNC: -360,
|
|
129
|
+
HNE: -300,
|
|
130
|
+
HNP: -480,
|
|
131
|
+
HNR: -420,
|
|
132
|
+
HNT: -150,
|
|
133
|
+
HNY: -540,
|
|
134
|
+
HOVT: 420,
|
|
135
|
+
ICT: 420,
|
|
136
|
+
IDT: 180,
|
|
137
|
+
IOT: 360,
|
|
138
|
+
IRDT: 270,
|
|
139
|
+
IRKST: 540,
|
|
140
|
+
IRKT: 540,
|
|
141
|
+
IRST: 210,
|
|
142
|
+
IST: 330,
|
|
143
|
+
JST: 540,
|
|
144
|
+
KGT: 360,
|
|
145
|
+
KRAST: 480,
|
|
146
|
+
KRAT: 480,
|
|
147
|
+
KST: 540,
|
|
148
|
+
KUYT: 240,
|
|
149
|
+
LHDT: 660,
|
|
150
|
+
LHST: 630,
|
|
151
|
+
LINT: 840,
|
|
152
|
+
MAGST: 720,
|
|
153
|
+
MAGT: 720,
|
|
154
|
+
MART: -510,
|
|
155
|
+
MAWT: 300,
|
|
156
|
+
MDT: -360,
|
|
157
|
+
MESZ: 120,
|
|
158
|
+
MEZ: 60,
|
|
159
|
+
MHT: 720,
|
|
160
|
+
MMT: 390,
|
|
161
|
+
MSD: 240,
|
|
162
|
+
MSK: 180,
|
|
163
|
+
MST: -420,
|
|
164
|
+
MT: {
|
|
165
|
+
timezoneOffsetDuringDst: -360,
|
|
166
|
+
timezoneOffsetNonDst: -420,
|
|
167
|
+
dstStart: (e) => c(e, n.MARCH, t.SUNDAY, 2, 2),
|
|
168
|
+
dstEnd: (e) => c(e, n.NOVEMBER, t.SUNDAY, 1, 2)
|
|
169
|
+
},
|
|
170
|
+
MUT: 240,
|
|
171
|
+
MVT: 300,
|
|
172
|
+
MYT: 480,
|
|
173
|
+
NCT: 660,
|
|
174
|
+
NDT: -90,
|
|
175
|
+
NFT: 690,
|
|
176
|
+
NOVST: 420,
|
|
177
|
+
NOVT: 360,
|
|
178
|
+
NPT: 345,
|
|
179
|
+
NST: -150,
|
|
180
|
+
NUT: -660,
|
|
181
|
+
NZDT: 780,
|
|
182
|
+
NZST: 720,
|
|
183
|
+
OMSST: 420,
|
|
184
|
+
OMST: 420,
|
|
185
|
+
PDT: -420,
|
|
186
|
+
PET: -300,
|
|
187
|
+
PETST: 720,
|
|
188
|
+
PETT: 720,
|
|
189
|
+
PGT: 600,
|
|
190
|
+
PHOT: 780,
|
|
191
|
+
PHT: 480,
|
|
192
|
+
PKT: 300,
|
|
193
|
+
PMDT: -120,
|
|
194
|
+
PMST: -180,
|
|
195
|
+
PONT: 660,
|
|
196
|
+
PST: -480,
|
|
197
|
+
PT: {
|
|
198
|
+
timezoneOffsetDuringDst: -420,
|
|
199
|
+
timezoneOffsetNonDst: -480,
|
|
200
|
+
dstStart: (e) => c(e, n.MARCH, t.SUNDAY, 2, 2),
|
|
201
|
+
dstEnd: (e) => c(e, n.NOVEMBER, t.SUNDAY, 1, 2)
|
|
202
|
+
},
|
|
203
|
+
PWT: 540,
|
|
204
|
+
PYST: -180,
|
|
205
|
+
PYT: -240,
|
|
206
|
+
RET: 240,
|
|
207
|
+
SAMT: 240,
|
|
208
|
+
SAST: 120,
|
|
209
|
+
SBT: 660,
|
|
210
|
+
SCT: 240,
|
|
211
|
+
SGT: 480,
|
|
212
|
+
SRT: -180,
|
|
213
|
+
SST: -660,
|
|
214
|
+
TAHT: -600,
|
|
215
|
+
TFT: 300,
|
|
216
|
+
TJT: 300,
|
|
217
|
+
TKT: 780,
|
|
218
|
+
TLT: 540,
|
|
219
|
+
TMT: 300,
|
|
220
|
+
TVT: 720,
|
|
221
|
+
ULAT: 480,
|
|
222
|
+
UTC: 0,
|
|
223
|
+
UYST: -120,
|
|
224
|
+
UYT: -180,
|
|
225
|
+
UZT: 300,
|
|
226
|
+
VET: -210,
|
|
227
|
+
VLAST: 660,
|
|
228
|
+
VLAT: 660,
|
|
229
|
+
VUT: 660,
|
|
230
|
+
WAST: 120,
|
|
231
|
+
WAT: 60,
|
|
232
|
+
WEST: 60,
|
|
233
|
+
WESZ: 60,
|
|
234
|
+
WET: 0,
|
|
235
|
+
WEZ: 0,
|
|
236
|
+
WFT: 720,
|
|
237
|
+
WGST: -120,
|
|
238
|
+
WGT: -180,
|
|
239
|
+
WIB: 420,
|
|
240
|
+
WIT: 540,
|
|
241
|
+
WITA: 480,
|
|
242
|
+
WST: 780,
|
|
243
|
+
WT: 0,
|
|
244
|
+
YAKST: 600,
|
|
245
|
+
YAKT: 600,
|
|
246
|
+
YAPT: 600,
|
|
247
|
+
YEKST: 360,
|
|
248
|
+
YEKT: 360
|
|
249
|
+
};
|
|
250
|
+
function c(e, t, n, r, i = 0) {
|
|
251
|
+
let a = 0, o = 0;
|
|
252
|
+
for (; o < r;) a++, new Date(e, t - 1, a).getDay() === n && o++;
|
|
253
|
+
return new Date(e, t - 1, a, i);
|
|
254
|
+
}
|
|
255
|
+
function l(e, t, n, r = 0) {
|
|
256
|
+
let i = n === 0 ? 7 : n, a = new Date(e, t - 1 + 1, 1, 12), o = a.getDay() === 0 ? 7 : a.getDay(), s;
|
|
257
|
+
return s = o === i ? 7 : o < i ? 7 + o - i : o - i, a.setDate(a.getDate() - s), new Date(e, t - 1, a.getDate(), r);
|
|
258
|
+
}
|
|
259
|
+
function u(e, t, n = {}) {
|
|
260
|
+
if (e == null) return null;
|
|
261
|
+
if (typeof e == "number") return e;
|
|
262
|
+
let r = n[e] ?? s[e];
|
|
263
|
+
return r == null ? null : typeof r == "number" ? r : t == null ? null : t > r.dstStart(t.getFullYear()) && !(t > r.dstEnd(t.getFullYear())) ? r.timezoneOffsetDuringDst : r.timezoneOffsetNonDst;
|
|
264
|
+
}
|
|
265
|
+
//#endregion
|
|
266
|
+
//#region node_modules/.pnpm/chrono-node@2.9.1/node_modules/chrono-node/dist/esm/calculation/duration.js
|
|
267
|
+
var d = {
|
|
268
|
+
day: 0,
|
|
269
|
+
second: 0,
|
|
270
|
+
millisecond: 0
|
|
271
|
+
};
|
|
272
|
+
function f(e, t) {
|
|
273
|
+
let n = new Date(e);
|
|
274
|
+
if (t.y && (t.year = t.y, delete t.y), t.mo && (t.month = t.mo, delete t.mo), t.M && (t.month = t.M, delete t.M), t.w && (t.week = t.w, delete t.w), t.d && (t.day = t.d, delete t.d), t.h && (t.hour = t.h, delete t.h), t.m && (t.minute = t.m, delete t.m), t.s && (t.second = t.s, delete t.s), t.ms && (t.millisecond = t.ms, delete t.ms), "year" in t) {
|
|
275
|
+
let e = Math.floor(t.year);
|
|
276
|
+
n.setFullYear(n.getFullYear() + e);
|
|
277
|
+
let r = t.year - e;
|
|
278
|
+
r > 0 && (t.month = t?.month ?? 0, t.month += r * 12);
|
|
279
|
+
}
|
|
280
|
+
if ("quarter" in t) {
|
|
281
|
+
let e = Math.floor(t.quarter);
|
|
282
|
+
n.setMonth(n.getMonth() + e * 3);
|
|
283
|
+
}
|
|
284
|
+
if ("month" in t) {
|
|
285
|
+
let e = Math.floor(t.month);
|
|
286
|
+
n.setMonth(n.getMonth() + e);
|
|
287
|
+
let r = t.month - e;
|
|
288
|
+
r > 0 && (t.week = t?.week ?? 0, t.week += r * 4);
|
|
289
|
+
}
|
|
290
|
+
if ("week" in t) {
|
|
291
|
+
let e = Math.floor(t.week);
|
|
292
|
+
n.setDate(n.getDate() + e * 7);
|
|
293
|
+
let r = t.week - e;
|
|
294
|
+
r > 0 && (t.day = t?.day ?? 0, t.day += Math.round(r * 7));
|
|
295
|
+
}
|
|
296
|
+
if ("day" in t) {
|
|
297
|
+
let e = Math.floor(t.day);
|
|
298
|
+
n.setDate(n.getDate() + e);
|
|
299
|
+
let r = t.day - e;
|
|
300
|
+
r > 0 && (t.hour = t?.hour ?? 0, t.hour += Math.round(r * 24));
|
|
301
|
+
}
|
|
302
|
+
if ("hour" in t) {
|
|
303
|
+
let e = Math.floor(t.hour);
|
|
304
|
+
n.setHours(n.getHours() + e);
|
|
305
|
+
let r = t.hour - e;
|
|
306
|
+
r > 0 && (t.minute = t?.minute ?? 0, t.minute += Math.round(r * 60));
|
|
307
|
+
}
|
|
308
|
+
if ("minute" in t) {
|
|
309
|
+
let e = Math.floor(t.minute);
|
|
310
|
+
n.setMinutes(n.getMinutes() + e);
|
|
311
|
+
let r = t.minute - e;
|
|
312
|
+
r > 0 && (t.second = t?.second ?? 0, t.second += Math.round(r * 60));
|
|
313
|
+
}
|
|
314
|
+
if ("second" in t) {
|
|
315
|
+
let e = Math.floor(t.second);
|
|
316
|
+
n.setSeconds(n.getSeconds() + e);
|
|
317
|
+
let r = t.second - e;
|
|
318
|
+
r > 0 && (t.millisecond = t?.millisecond ?? 0, t.millisecond += Math.round(r * 1e3));
|
|
319
|
+
}
|
|
320
|
+
if ("millisecond" in t) {
|
|
321
|
+
let e = Math.floor(t.millisecond);
|
|
322
|
+
n.setMilliseconds(n.getMilliseconds() + e);
|
|
323
|
+
}
|
|
324
|
+
return n;
|
|
325
|
+
}
|
|
326
|
+
function p(e) {
|
|
327
|
+
let t = {};
|
|
328
|
+
for (let n in e) t[n] = -e[n];
|
|
329
|
+
return t;
|
|
330
|
+
}
|
|
331
|
+
//#endregion
|
|
332
|
+
//#region node_modules/.pnpm/chrono-node@2.9.1/node_modules/chrono-node/dist/esm/results.js
|
|
333
|
+
var ee = class e {
|
|
334
|
+
instant;
|
|
335
|
+
timezoneOffset;
|
|
336
|
+
constructor(e, t) {
|
|
337
|
+
this.instant = e ?? /* @__PURE__ */ new Date(), this.timezoneOffset = t ?? null;
|
|
338
|
+
}
|
|
339
|
+
static fromDate(t) {
|
|
340
|
+
return new e(t);
|
|
341
|
+
}
|
|
342
|
+
static fromInput(t, n) {
|
|
343
|
+
if (t instanceof Date) return e.fromDate(t);
|
|
344
|
+
let r = t?.instant ?? /* @__PURE__ */ new Date();
|
|
345
|
+
return new e(r, u(t?.timezone, r, n));
|
|
346
|
+
}
|
|
347
|
+
getDateWithAdjustedTimezone() {
|
|
348
|
+
let e = new Date(this.instant);
|
|
349
|
+
return this.timezoneOffset !== null && e.setMinutes(e.getMinutes() - this.getSystemTimezoneAdjustmentMinute(this.instant)), e;
|
|
350
|
+
}
|
|
351
|
+
getSystemTimezoneAdjustmentMinute(e, t) {
|
|
352
|
+
e ||= /* @__PURE__ */ new Date();
|
|
353
|
+
let n = -e.getTimezoneOffset();
|
|
354
|
+
return n - (t ?? this.timezoneOffset ?? n);
|
|
355
|
+
}
|
|
356
|
+
getTimezoneOffset() {
|
|
357
|
+
return this.timezoneOffset ?? -this.instant.getTimezoneOffset();
|
|
358
|
+
}
|
|
359
|
+
}, m = class e {
|
|
360
|
+
knownValues;
|
|
361
|
+
impliedValues;
|
|
362
|
+
reference;
|
|
363
|
+
_tags = /* @__PURE__ */ new Set();
|
|
364
|
+
constructor(e, t) {
|
|
365
|
+
if (this.reference = e, this.knownValues = {}, this.impliedValues = {}, t) for (let e in t) this.knownValues[e] = t[e];
|
|
366
|
+
let n = e.getDateWithAdjustedTimezone();
|
|
367
|
+
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);
|
|
368
|
+
}
|
|
369
|
+
static createRelativeFromReference(t, n = d) {
|
|
370
|
+
let a = f(t.getDateWithAdjustedTimezone(), n), s = new e(t);
|
|
371
|
+
return s.addTag("result/relativeDate"), "hour" in n || "minute" in n || "second" in n || "millisecond" in n ? (s.addTag("result/relativeDateAndTime"), i(s, a), r(s, a), s.assign("timezoneOffset", t.getTimezoneOffset())) : (o(s, a), s.imply("timezoneOffset", t.getTimezoneOffset()), "day" in n ? (s.assign("day", a.getDate()), s.assign("month", a.getMonth() + 1), s.assign("year", a.getFullYear()), s.assign("weekday", a.getDay())) : "week" in n ? (s.assign("day", a.getDate()), s.assign("month", a.getMonth() + 1), s.assign("year", a.getFullYear()), s.imply("weekday", a.getDay())) : (s.imply("day", a.getDate()), "month" in n ? (s.assign("month", a.getMonth() + 1), s.assign("year", a.getFullYear())) : (s.imply("month", a.getMonth() + 1), "year" in n ? s.assign("year", a.getFullYear()) : s.imply("year", a.getFullYear())))), s;
|
|
372
|
+
}
|
|
373
|
+
get(e) {
|
|
374
|
+
return e in this.knownValues ? this.knownValues[e] : e in this.impliedValues ? this.impliedValues[e] : null;
|
|
375
|
+
}
|
|
376
|
+
isCertain(e) {
|
|
377
|
+
return e in this.knownValues;
|
|
378
|
+
}
|
|
379
|
+
getCertainComponents() {
|
|
380
|
+
return Object.keys(this.knownValues);
|
|
381
|
+
}
|
|
382
|
+
imply(e, t) {
|
|
383
|
+
return e in this.knownValues || (this.impliedValues[e] = t), this;
|
|
384
|
+
}
|
|
385
|
+
assign(e, t) {
|
|
386
|
+
return this.knownValues[e] = t, delete this.impliedValues[e], this;
|
|
387
|
+
}
|
|
388
|
+
addDurationAsImplied(e) {
|
|
389
|
+
let t = f(this.dateWithoutTimezoneAdjustment(), e);
|
|
390
|
+
return ("day" in e || "week" in e || "month" in e || "year" in e) && (this.delete([
|
|
391
|
+
"day",
|
|
392
|
+
"weekday",
|
|
393
|
+
"month",
|
|
394
|
+
"year"
|
|
395
|
+
]), this.imply("day", t.getDate()), this.imply("weekday", t.getDay()), this.imply("month", t.getMonth() + 1), this.imply("year", t.getFullYear())), ("second" in e || "minute" in e || "hour" in e) && (this.delete([
|
|
396
|
+
"second",
|
|
397
|
+
"minute",
|
|
398
|
+
"hour"
|
|
399
|
+
]), this.imply("second", t.getSeconds()), this.imply("minute", t.getMinutes()), this.imply("hour", t.getHours())), this;
|
|
400
|
+
}
|
|
401
|
+
delete(e) {
|
|
402
|
+
typeof e == "string" && (e = [e]);
|
|
403
|
+
for (let t of e) delete this.knownValues[t], delete this.impliedValues[t];
|
|
404
|
+
}
|
|
405
|
+
clone() {
|
|
406
|
+
let t = new e(this.reference);
|
|
407
|
+
t.knownValues = {}, t.impliedValues = {};
|
|
408
|
+
for (let e in this.knownValues) t.knownValues[e] = this.knownValues[e];
|
|
409
|
+
for (let e in this.impliedValues) t.impliedValues[e] = this.impliedValues[e];
|
|
410
|
+
return t;
|
|
411
|
+
}
|
|
412
|
+
isOnlyDate() {
|
|
413
|
+
return !this.isCertain("hour") && !this.isCertain("minute") && !this.isCertain("second");
|
|
414
|
+
}
|
|
415
|
+
isOnlyTime() {
|
|
416
|
+
return !this.isCertain("weekday") && !this.isCertain("day") && !this.isCertain("month") && !this.isCertain("year");
|
|
417
|
+
}
|
|
418
|
+
isOnlyWeekdayComponent() {
|
|
419
|
+
return this.isCertain("weekday") && !this.isCertain("day") && !this.isCertain("month");
|
|
420
|
+
}
|
|
421
|
+
isDateWithUnknownYear() {
|
|
422
|
+
return this.isCertain("month") && !this.isCertain("year");
|
|
423
|
+
}
|
|
424
|
+
isValidDate() {
|
|
425
|
+
let e = this.dateWithoutTimezoneAdjustment();
|
|
426
|
+
return !(e.getFullYear() !== this.get("year") || e.getMonth() !== this.get("month") - 1 || e.getDate() !== this.get("day") || this.get("hour") != null && e.getHours() != this.get("hour") || this.get("minute") != null && e.getMinutes() != this.get("minute"));
|
|
427
|
+
}
|
|
428
|
+
toString() {
|
|
429
|
+
return `[ParsingComponents {
|
|
430
|
+
tags: ${JSON.stringify(Array.from(this._tags).sort())},
|
|
431
|
+
knownValues: ${JSON.stringify(this.knownValues)},
|
|
432
|
+
impliedValues: ${JSON.stringify(this.impliedValues)}},
|
|
433
|
+
reference: ${JSON.stringify(this.reference)}]`;
|
|
434
|
+
}
|
|
435
|
+
date() {
|
|
436
|
+
let e = this.dateWithoutTimezoneAdjustment(), t = this.reference.getSystemTimezoneAdjustmentMinute(e, this.get("timezoneOffset"));
|
|
437
|
+
return new Date(e.getTime() + t * 6e4);
|
|
438
|
+
}
|
|
439
|
+
addTag(e) {
|
|
440
|
+
return this._tags.add(e), this;
|
|
441
|
+
}
|
|
442
|
+
addTags(e) {
|
|
443
|
+
for (let t of e) this._tags.add(t);
|
|
444
|
+
return this;
|
|
445
|
+
}
|
|
446
|
+
tags() {
|
|
447
|
+
return new Set(this._tags);
|
|
448
|
+
}
|
|
449
|
+
dateWithoutTimezoneAdjustment() {
|
|
450
|
+
let e = new Date(this.get("year"), this.get("month") - 1, this.get("day"), this.get("hour"), this.get("minute"), this.get("second"), this.get("millisecond"));
|
|
451
|
+
return e.setFullYear(this.get("year")), e;
|
|
452
|
+
}
|
|
453
|
+
}, h = class e {
|
|
454
|
+
refDate;
|
|
455
|
+
index;
|
|
456
|
+
text;
|
|
457
|
+
reference;
|
|
458
|
+
start;
|
|
459
|
+
end;
|
|
460
|
+
constructor(e, t, n, r, i) {
|
|
461
|
+
this.reference = e, this.refDate = e.instant, this.index = t, this.text = n, this.start = r || new m(e), this.end = i;
|
|
462
|
+
}
|
|
463
|
+
clone() {
|
|
464
|
+
let t = new e(this.reference, this.index, this.text);
|
|
465
|
+
return t.start = this.start ? this.start.clone() : null, t.end = this.end ? this.end.clone() : null, t;
|
|
466
|
+
}
|
|
467
|
+
date() {
|
|
468
|
+
return this.start.date();
|
|
469
|
+
}
|
|
470
|
+
addTag(e) {
|
|
471
|
+
return this.start.addTag(e), this.end && this.end.addTag(e), this;
|
|
472
|
+
}
|
|
473
|
+
addTags(e) {
|
|
474
|
+
return this.start.addTags(e), this.end && this.end.addTags(e), this;
|
|
475
|
+
}
|
|
476
|
+
tags() {
|
|
477
|
+
let e = new Set(this.start.tags());
|
|
478
|
+
if (this.end) for (let t of this.end.tags()) e.add(t);
|
|
479
|
+
return e;
|
|
480
|
+
}
|
|
481
|
+
toString() {
|
|
482
|
+
let e = Array.from(this.tags()).sort();
|
|
483
|
+
return `[ParsingResult {index: ${this.index}, text: '${this.text}', tags: ${JSON.stringify(e)} ...}]`;
|
|
484
|
+
}
|
|
485
|
+
};
|
|
486
|
+
//#endregion
|
|
487
|
+
//#region node_modules/.pnpm/chrono-node@2.9.1/node_modules/chrono-node/dist/esm/utils/pattern.js
|
|
488
|
+
function te(e, t, n = "\\s{0,5},?\\s{0,5}") {
|
|
489
|
+
let r = t.replace(/\((?!\?)/g, "(?:");
|
|
490
|
+
return `${e}${r}(?:${n}${r}){0,10}`;
|
|
491
|
+
}
|
|
492
|
+
function ne(e) {
|
|
493
|
+
let t;
|
|
494
|
+
return t = e instanceof Array ? [...e] : e instanceof Map ? Array.from(e.keys()) : Object.keys(e), t;
|
|
495
|
+
}
|
|
496
|
+
function g(e) {
|
|
497
|
+
return `(?:${ne(e).sort((e, t) => t.length - e.length).join("|").replace(/\./g, "\\.")})`;
|
|
498
|
+
}
|
|
499
|
+
//#endregion
|
|
500
|
+
//#region node_modules/.pnpm/chrono-node@2.9.1/node_modules/chrono-node/dist/esm/calculation/years.js
|
|
501
|
+
function re(e) {
|
|
502
|
+
return e < 100 && (e > 50 ? e += 1900 : e += 2e3), e;
|
|
503
|
+
}
|
|
504
|
+
function _(e, t, n) {
|
|
505
|
+
let r = new Date(e);
|
|
506
|
+
r.setMonth(n - 1), r.setDate(t);
|
|
507
|
+
let i = f(r, { year: 1 }), a = f(r, { year: -1 });
|
|
508
|
+
return Math.abs(i.getTime() - e.getTime()) < Math.abs(r.getTime() - e.getTime()) ? r = i : Math.abs(a.getTime() - e.getTime()) < Math.abs(r.getTime() - e.getTime()) && (r = a), r.getFullYear();
|
|
509
|
+
}
|
|
510
|
+
//#endregion
|
|
511
|
+
//#region node_modules/.pnpm/chrono-node@2.9.1/node_modules/chrono-node/dist/esm/locales/en/constants.js
|
|
512
|
+
var ie = {
|
|
513
|
+
sunday: 0,
|
|
514
|
+
sun: 0,
|
|
515
|
+
"sun.": 0,
|
|
516
|
+
monday: 1,
|
|
517
|
+
mon: 1,
|
|
518
|
+
"mon.": 1,
|
|
519
|
+
tuesday: 2,
|
|
520
|
+
tue: 2,
|
|
521
|
+
"tue.": 2,
|
|
522
|
+
wednesday: 3,
|
|
523
|
+
wed: 3,
|
|
524
|
+
"wed.": 3,
|
|
525
|
+
thursday: 4,
|
|
526
|
+
thurs: 4,
|
|
527
|
+
"thurs.": 4,
|
|
528
|
+
thur: 4,
|
|
529
|
+
"thur.": 4,
|
|
530
|
+
thu: 4,
|
|
531
|
+
"thu.": 4,
|
|
532
|
+
friday: 5,
|
|
533
|
+
fri: 5,
|
|
534
|
+
"fri.": 5,
|
|
535
|
+
saturday: 6,
|
|
536
|
+
sat: 6,
|
|
537
|
+
"sat.": 6
|
|
538
|
+
}, ae = {
|
|
539
|
+
january: 1,
|
|
540
|
+
february: 2,
|
|
541
|
+
march: 3,
|
|
542
|
+
april: 4,
|
|
543
|
+
may: 5,
|
|
544
|
+
june: 6,
|
|
545
|
+
july: 7,
|
|
546
|
+
august: 8,
|
|
547
|
+
september: 9,
|
|
548
|
+
october: 10,
|
|
549
|
+
november: 11,
|
|
550
|
+
december: 12
|
|
551
|
+
}, v = {
|
|
552
|
+
...ae,
|
|
553
|
+
jan: 1,
|
|
554
|
+
"jan.": 1,
|
|
555
|
+
feb: 2,
|
|
556
|
+
"feb.": 2,
|
|
557
|
+
mar: 3,
|
|
558
|
+
"mar.": 3,
|
|
559
|
+
apr: 4,
|
|
560
|
+
"apr.": 4,
|
|
561
|
+
jun: 6,
|
|
562
|
+
"jun.": 6,
|
|
563
|
+
jul: 7,
|
|
564
|
+
"jul.": 7,
|
|
565
|
+
aug: 8,
|
|
566
|
+
"aug.": 8,
|
|
567
|
+
sep: 9,
|
|
568
|
+
"sep.": 9,
|
|
569
|
+
sept: 9,
|
|
570
|
+
"sept.": 9,
|
|
571
|
+
oct: 10,
|
|
572
|
+
"oct.": 10,
|
|
573
|
+
nov: 11,
|
|
574
|
+
"nov.": 11,
|
|
575
|
+
dec: 12,
|
|
576
|
+
"dec.": 12
|
|
577
|
+
}, oe = {
|
|
578
|
+
one: 1,
|
|
579
|
+
two: 2,
|
|
580
|
+
three: 3,
|
|
581
|
+
four: 4,
|
|
582
|
+
five: 5,
|
|
583
|
+
six: 6,
|
|
584
|
+
seven: 7,
|
|
585
|
+
eight: 8,
|
|
586
|
+
nine: 9,
|
|
587
|
+
ten: 10,
|
|
588
|
+
eleven: 11,
|
|
589
|
+
twelve: 12
|
|
590
|
+
}, se = {
|
|
591
|
+
first: 1,
|
|
592
|
+
second: 2,
|
|
593
|
+
third: 3,
|
|
594
|
+
fourth: 4,
|
|
595
|
+
fifth: 5,
|
|
596
|
+
sixth: 6,
|
|
597
|
+
seventh: 7,
|
|
598
|
+
eighth: 8,
|
|
599
|
+
ninth: 9,
|
|
600
|
+
tenth: 10,
|
|
601
|
+
eleventh: 11,
|
|
602
|
+
twelfth: 12,
|
|
603
|
+
thirteenth: 13,
|
|
604
|
+
fourteenth: 14,
|
|
605
|
+
fifteenth: 15,
|
|
606
|
+
sixteenth: 16,
|
|
607
|
+
seventeenth: 17,
|
|
608
|
+
eighteenth: 18,
|
|
609
|
+
nineteenth: 19,
|
|
610
|
+
twentieth: 20,
|
|
611
|
+
"twenty first": 21,
|
|
612
|
+
"twenty-first": 21,
|
|
613
|
+
"twenty second": 22,
|
|
614
|
+
"twenty-second": 22,
|
|
615
|
+
"twenty third": 23,
|
|
616
|
+
"twenty-third": 23,
|
|
617
|
+
"twenty fourth": 24,
|
|
618
|
+
"twenty-fourth": 24,
|
|
619
|
+
"twenty fifth": 25,
|
|
620
|
+
"twenty-fifth": 25,
|
|
621
|
+
"twenty sixth": 26,
|
|
622
|
+
"twenty-sixth": 26,
|
|
623
|
+
"twenty seventh": 27,
|
|
624
|
+
"twenty-seventh": 27,
|
|
625
|
+
"twenty eighth": 28,
|
|
626
|
+
"twenty-eighth": 28,
|
|
627
|
+
"twenty ninth": 29,
|
|
628
|
+
"twenty-ninth": 29,
|
|
629
|
+
thirtieth: 30,
|
|
630
|
+
"thirty first": 31,
|
|
631
|
+
"thirty-first": 31
|
|
632
|
+
}, ce = {
|
|
633
|
+
second: "second",
|
|
634
|
+
seconds: "second",
|
|
635
|
+
minute: "minute",
|
|
636
|
+
minutes: "minute",
|
|
637
|
+
hour: "hour",
|
|
638
|
+
hours: "hour",
|
|
639
|
+
day: "day",
|
|
640
|
+
days: "day",
|
|
641
|
+
week: "week",
|
|
642
|
+
weeks: "week",
|
|
643
|
+
month: "month",
|
|
644
|
+
months: "month",
|
|
645
|
+
quarter: "quarter",
|
|
646
|
+
quarters: "quarter",
|
|
647
|
+
year: "year",
|
|
648
|
+
years: "year"
|
|
649
|
+
}, y = {
|
|
650
|
+
s: "second",
|
|
651
|
+
sec: "second",
|
|
652
|
+
second: "second",
|
|
653
|
+
seconds: "second",
|
|
654
|
+
m: "minute",
|
|
655
|
+
min: "minute",
|
|
656
|
+
mins: "minute",
|
|
657
|
+
minute: "minute",
|
|
658
|
+
minutes: "minute",
|
|
659
|
+
h: "hour",
|
|
660
|
+
hr: "hour",
|
|
661
|
+
hrs: "hour",
|
|
662
|
+
hour: "hour",
|
|
663
|
+
hours: "hour",
|
|
664
|
+
d: "day",
|
|
665
|
+
day: "day",
|
|
666
|
+
days: "day",
|
|
667
|
+
w: "week",
|
|
668
|
+
week: "week",
|
|
669
|
+
weeks: "week",
|
|
670
|
+
mo: "month",
|
|
671
|
+
mon: "month",
|
|
672
|
+
mos: "month",
|
|
673
|
+
month: "month",
|
|
674
|
+
months: "month",
|
|
675
|
+
qtr: "quarter",
|
|
676
|
+
quarter: "quarter",
|
|
677
|
+
quarters: "quarter",
|
|
678
|
+
y: "year",
|
|
679
|
+
yr: "year",
|
|
680
|
+
year: "year",
|
|
681
|
+
years: "year",
|
|
682
|
+
...ce
|
|
683
|
+
}, le = `(?:${g(oe)}|[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)?)`;
|
|
684
|
+
function ue(e) {
|
|
685
|
+
let t = e.toLowerCase();
|
|
686
|
+
return oe[t] === void 0 ? t === "a" || t === "an" || t == "the" ? 1 : t.match(/few/) ? 3 : t.match(/half/) ? .5 : t.match(/couple/) ? 2 : t.match(/several/) ? 7 : parseFloat(t) : oe[t];
|
|
687
|
+
}
|
|
688
|
+
var b = `(?:${g(se)}|[0-9]{1,2}(?:st|nd|rd|th)?)`;
|
|
689
|
+
function x(e) {
|
|
690
|
+
let t = e.toLowerCase();
|
|
691
|
+
return se[t] === void 0 ? (t = t.replace(/(?:st|nd|rd|th)$/i, ""), parseInt(t)) : se[t];
|
|
692
|
+
}
|
|
693
|
+
var S = "(?:[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])";
|
|
694
|
+
function C(e) {
|
|
695
|
+
return /BE/i.test(e) ? (e = e.replace(/BE/i, ""), parseInt(e) - 543) : /BCE?/i.test(e) ? (e = e.replace(/BCE?/i, ""), -parseInt(e)) : /(AD|CE)/i.test(e) ? (e = e.replace(/(AD|CE)/i, ""), parseInt(e)) : re(parseInt(e));
|
|
696
|
+
}
|
|
697
|
+
var de = `(${le})\\s{0,3}(${g(y)})`, fe = new RegExp(de, "i"), pe = `(${le})\\s{0,3}(${g(ce)})`, me = "\\s{0,5},?(?:\\s*and)?\\s{0,5}", w = te("(?:(?:about|around)\\s{0,3})?", de, me), he = te("(?:(?:about|around)\\s{0,3})?", pe, me);
|
|
698
|
+
function T(e) {
|
|
699
|
+
let t = {}, n = e, r = fe.exec(n);
|
|
700
|
+
for (; r;) ge(t, r), n = n.substring(r[0].length).trim(), r = fe.exec(n);
|
|
701
|
+
return Object.keys(t).length == 0 ? null : t;
|
|
702
|
+
}
|
|
703
|
+
function ge(e, t) {
|
|
704
|
+
if (t[0].match(/^[a-zA-Z]+$/)) return;
|
|
705
|
+
let n = ue(t[1]), r = y[t[2].toLowerCase()];
|
|
706
|
+
e[r] = n;
|
|
707
|
+
}
|
|
708
|
+
//#endregion
|
|
709
|
+
//#region node_modules/.pnpm/chrono-node@2.9.1/node_modules/chrono-node/dist/esm/common/parsers/AbstractParserWithWordBoundary.js
|
|
710
|
+
var E = class {
|
|
711
|
+
innerPatternHasChange(e, t) {
|
|
712
|
+
return this.innerPattern(e) !== t;
|
|
713
|
+
}
|
|
714
|
+
patternLeftBoundary() {
|
|
715
|
+
return "(\\W|^)";
|
|
716
|
+
}
|
|
717
|
+
cachedInnerPattern = null;
|
|
718
|
+
cachedPattern = null;
|
|
719
|
+
pattern(e) {
|
|
720
|
+
return this.cachedInnerPattern && !this.innerPatternHasChange(e, this.cachedInnerPattern) ? this.cachedPattern : (this.cachedInnerPattern = this.innerPattern(e), this.cachedPattern = RegExp(`${this.patternLeftBoundary()}${this.cachedInnerPattern.source}`, this.cachedInnerPattern.flags), this.cachedPattern);
|
|
721
|
+
}
|
|
722
|
+
extract(e, t) {
|
|
723
|
+
let n = t[1] ?? "";
|
|
724
|
+
t.index += n.length, t[0] = t[0].substring(n.length);
|
|
725
|
+
for (let e = 2; e < t.length; e++) t[e - 1] = t[e];
|
|
726
|
+
return this.innerExtract(e, t);
|
|
727
|
+
}
|
|
728
|
+
}, _e = RegExp(`(?:(?:within|in|for)\\s*)?(?:(?:about|around|roughly|approximately|just)\\s*(?:~\\s*)?)?(${w})(?=\\W|$)`, "i"), ve = RegExp(`(?:within|in|for)\\s*(?:(?:about|around|roughly|approximately|just)\\s*(?:~\\s*)?)?(${w})(?=\\W|$)`, "i"), ye = RegExp(`(?:within|in|for)\\s*(?:(?:about|around|roughly|approximately|just)\\s*(?:~\\s*)?)?(${he})(?=\\W|$)`, "i"), be = class extends E {
|
|
729
|
+
strictMode;
|
|
730
|
+
constructor(e) {
|
|
731
|
+
super(), this.strictMode = e;
|
|
732
|
+
}
|
|
733
|
+
innerPattern(e) {
|
|
734
|
+
return this.strictMode ? ye : e.option.forwardDate ? _e : ve;
|
|
735
|
+
}
|
|
736
|
+
innerExtract(e, t) {
|
|
737
|
+
if (t[0].match(/^for\s*the\s*\w+/)) return null;
|
|
738
|
+
let n = T(t[1]);
|
|
739
|
+
return n ? m.createRelativeFromReference(e.reference, n) : null;
|
|
740
|
+
}
|
|
741
|
+
}, xe = RegExp(`(?:on\\s{0,3})?(${b})(?:\\s{0,3}(?:to|\\-|\\–|until|through|till)?\\s{0,3}(${b}))?(?:-|/|\\s{0,3}(?:of)?\\s{0,3})(${g(v)})(?:(?:-|/|,?\\s{0,3})(${S}(?!\\w)))?(?=\\W|\$)`, "i"), Se = 1, Ce = 2, we = 3, Te = 4, Ee = class extends E {
|
|
742
|
+
innerPattern() {
|
|
743
|
+
return xe;
|
|
744
|
+
}
|
|
745
|
+
innerExtract(e, t) {
|
|
746
|
+
let n = e.createParsingResult(t.index, t[0]), r = v[t[we].toLowerCase()], i = x(t[Se]);
|
|
747
|
+
if (i > 31) return t.index += t[Se].length, null;
|
|
748
|
+
if (n.start.assign("month", r), n.start.assign("day", i), t[Te]) {
|
|
749
|
+
let e = C(t[Te]);
|
|
750
|
+
n.start.assign("year", e);
|
|
751
|
+
} else {
|
|
752
|
+
let t = _(e.refDate, i, r);
|
|
753
|
+
n.start.imply("year", t);
|
|
754
|
+
}
|
|
755
|
+
if (t[Ce]) {
|
|
756
|
+
let e = x(t[Ce]);
|
|
757
|
+
n.end = n.start.clone(), n.end.assign("day", e);
|
|
758
|
+
}
|
|
759
|
+
return n;
|
|
760
|
+
}
|
|
761
|
+
}, De = RegExp(`(${g(v)})(?:-|/|\\s*,?\\s*)(${b})(?!\\s*(?:am|pm))\\s*(?:(?:to|\\-)\\s*(${b})\\s*)?(?:(?:-|/|\\s*,\\s*|\\s+)(${S}))?(?=\\W|\$)(?!\\:\\d)`, "i"), Oe = 1, ke = 2, Ae = 3, je = 4, Me = class extends E {
|
|
762
|
+
shouldSkipYearLikeDate;
|
|
763
|
+
constructor(e) {
|
|
764
|
+
super(), this.shouldSkipYearLikeDate = e;
|
|
765
|
+
}
|
|
766
|
+
innerPattern() {
|
|
767
|
+
return De;
|
|
768
|
+
}
|
|
769
|
+
innerExtract(e, t) {
|
|
770
|
+
let n = v[t[Oe].toLowerCase()], r = x(t[ke]);
|
|
771
|
+
if (r > 31 || this.shouldSkipYearLikeDate && !t[Ae] && !t[je] && t[ke].match(/^2[0-5]$/)) return null;
|
|
772
|
+
let i = e.createParsingComponents({
|
|
773
|
+
day: r,
|
|
774
|
+
month: n
|
|
775
|
+
}).addTag("parser/ENMonthNameMiddleEndianParser");
|
|
776
|
+
if (t[je]) {
|
|
777
|
+
let e = C(t[je]);
|
|
778
|
+
i.assign("year", e);
|
|
779
|
+
} else {
|
|
780
|
+
let t = _(e.refDate, r, n);
|
|
781
|
+
i.imply("year", t);
|
|
782
|
+
}
|
|
783
|
+
if (!t[Ae]) return i;
|
|
784
|
+
let a = x(t[Ae]), o = e.createParsingResult(t.index, t[0]);
|
|
785
|
+
return o.start = i, o.end = i.clone(), o.end.assign("day", a), o;
|
|
786
|
+
}
|
|
787
|
+
}, Ne = RegExp(`((?:in)\\s*)?(${g(v)})\\s*(?:(?:,|-|of)?\\s*(${S})?)?(?=[^\\s\\w]|\\s+[^0-9]|\\s+\$|\$)`, "i"), Pe = 1, Fe = 2, Ie = 3, Le = class extends E {
|
|
788
|
+
innerPattern() {
|
|
789
|
+
return Ne;
|
|
790
|
+
}
|
|
791
|
+
innerExtract(e, t) {
|
|
792
|
+
let n = t[Fe].toLowerCase();
|
|
793
|
+
if (t[0].length <= 3 && !ae[n]) return null;
|
|
794
|
+
let r = e.createParsingResult(t.index + (t[Pe] || "").length, t.index + t[0].length);
|
|
795
|
+
r.start.imply("day", 1), r.start.addTag("parser/ENMonthNameParser");
|
|
796
|
+
let i = v[n];
|
|
797
|
+
if (r.start.assign("month", i), t[Ie]) {
|
|
798
|
+
let e = C(t[Ie]);
|
|
799
|
+
r.start.assign("year", e);
|
|
800
|
+
} else {
|
|
801
|
+
let t = _(e.refDate, 1, i);
|
|
802
|
+
r.start.imply("year", t);
|
|
803
|
+
}
|
|
804
|
+
return r;
|
|
805
|
+
}
|
|
806
|
+
}, Re = RegExp(`([0-9]{4})[-\\.\\/\\s](?:(${g(v)})|([0-9]{1,2}))[-\\.\\/\\s]([0-9]{1,2})(?=\\W|\$)`, "i"), ze = 1, Be = 2, Ve = 3, He = 4, Ue = class extends E {
|
|
807
|
+
strictMonthDateOrder;
|
|
808
|
+
constructor(e) {
|
|
809
|
+
super(), this.strictMonthDateOrder = e;
|
|
810
|
+
}
|
|
811
|
+
innerPattern() {
|
|
812
|
+
return Re;
|
|
813
|
+
}
|
|
814
|
+
innerExtract(e, t) {
|
|
815
|
+
let n = parseInt(t[ze]), r = parseInt(t[He]), i = t[Ve] ? parseInt(t[Ve]) : v[t[Be].toLowerCase()];
|
|
816
|
+
if (i < 1 || i > 12) {
|
|
817
|
+
if (this.strictMonthDateOrder) return null;
|
|
818
|
+
r >= 1 && r <= 12 && ([i, r] = [r, i]);
|
|
819
|
+
}
|
|
820
|
+
return r < 1 || r > 31 ? null : {
|
|
821
|
+
day: r,
|
|
822
|
+
month: i,
|
|
823
|
+
year: n
|
|
824
|
+
};
|
|
825
|
+
}
|
|
826
|
+
}, We = /* @__PURE__ */ RegExp("([0-9]|0[1-9]|1[012])/([0-9]{4})", "i"), Ge = 1, Ke = 2, qe = class extends E {
|
|
827
|
+
innerPattern() {
|
|
828
|
+
return We;
|
|
829
|
+
}
|
|
830
|
+
innerExtract(e, t) {
|
|
831
|
+
let n = parseInt(t[Ke]), r = parseInt(t[Ge]);
|
|
832
|
+
return e.createParsingComponents().imply("day", 1).assign("month", r).assign("year", n);
|
|
833
|
+
}
|
|
834
|
+
};
|
|
835
|
+
//#endregion
|
|
836
|
+
//#region node_modules/.pnpm/chrono-node@2.9.1/node_modules/chrono-node/dist/esm/common/parsers/AbstractTimeExpressionParser.js
|
|
837
|
+
function Je(e, t, n, r) {
|
|
838
|
+
return RegExp(`${e}${t}(\\d{1,4})(?:(?:\\.|:|:)(\\d{1,2})(?:(?::|:)(\\d{2})(?:\\.(\\d{1,6}))?)?)?(?:\\s*(a\\.m\\.|p\\.m\\.|am?|pm?))?${n}`, r);
|
|
839
|
+
}
|
|
840
|
+
function Ye(e, t) {
|
|
841
|
+
return RegExp(`^(${e})(\\d{1,4})(?:(?:\\.|\\:|\\:)(\\d{1,2})(?:(?:\\.|\\:|\\:)(\\d{1,2})(?:\\.(\\d{1,6}))?)?)?(?:\\s*(a\\.m\\.|p\\.m\\.|am?|pm?))?${t}`, "i");
|
|
842
|
+
}
|
|
843
|
+
var Xe = 2, D = 3, O = 4, k = 5, A = 6, Ze = class {
|
|
844
|
+
strictMode;
|
|
845
|
+
constructor(e = !1) {
|
|
846
|
+
this.strictMode = e;
|
|
847
|
+
}
|
|
848
|
+
patternFlags() {
|
|
849
|
+
return "i";
|
|
850
|
+
}
|
|
851
|
+
primaryPatternLeftBoundary() {
|
|
852
|
+
return "(^|\\s|T|\\b)";
|
|
853
|
+
}
|
|
854
|
+
primarySuffix() {
|
|
855
|
+
return "(?!/)(?=\\W|$)";
|
|
856
|
+
}
|
|
857
|
+
followingSuffix() {
|
|
858
|
+
return "(?!/)(?=\\W|$)";
|
|
859
|
+
}
|
|
860
|
+
pattern(e) {
|
|
861
|
+
return this.getPrimaryTimePatternThroughCache();
|
|
862
|
+
}
|
|
863
|
+
extract(e, t) {
|
|
864
|
+
let n = this.extractPrimaryTimeComponents(e, t);
|
|
865
|
+
if (!n) return t[0].match(/^\d{4}/) ? (t.index += 4, null) : (t.index += t[0].length, null);
|
|
866
|
+
let r = t.index + t[1].length, i = t[0].substring(t[1].length), a = e.createParsingResult(r, i, n);
|
|
867
|
+
t.index += t[0].length;
|
|
868
|
+
let o = e.text.substring(t.index), s = this.getFollowingTimePatternThroughCache().exec(o);
|
|
869
|
+
return i.match(/^\d{3,4}/) && s && (s[0].match(/^\s*([+-])\s*\d{2,4}$/) || s[0].match(/^\s*([+-])\s*\d{2}\W\d{2}/)) ? null : !s || s[0].match(/^\s*([+-])\s*\d{3,4}$/) ? this.checkAndReturnWithoutFollowingPattern(a) : (a.end = this.extractFollowingTimeComponents(e, s, a), a.end && (a.text += s[0]), this.checkAndReturnWithFollowingPattern(a));
|
|
870
|
+
}
|
|
871
|
+
extractPrimaryTimeComponents(t, n, r = !1) {
|
|
872
|
+
let i = t.createParsingComponents(), a = 0, o = null, s = parseInt(n[Xe]);
|
|
873
|
+
if (s > 100) {
|
|
874
|
+
if (n[Xe].length == 4 && n[D] == null && !n[A] || this.strictMode || n[D] != null) return null;
|
|
875
|
+
a = s % 100, s = Math.floor(s / 100);
|
|
876
|
+
}
|
|
877
|
+
if (s > 24) return null;
|
|
878
|
+
if (n[D] != null) {
|
|
879
|
+
if (n[D].length == 1 && !n[A]) return null;
|
|
880
|
+
a = parseInt(n[D]);
|
|
881
|
+
}
|
|
882
|
+
if (a >= 60) return null;
|
|
883
|
+
if (s > 12 && (o = e.PM), n[A] != null) {
|
|
884
|
+
if (s > 12) return null;
|
|
885
|
+
let t = n[A][0].toLowerCase();
|
|
886
|
+
t == "a" && (o = e.AM, s == 12 && (s = 0)), t == "p" && (o = e.PM, s != 12 && (s += 12));
|
|
887
|
+
}
|
|
888
|
+
if (i.assign("hour", s), i.assign("minute", a), o === null ? s < 12 ? i.imply("meridiem", e.AM) : i.imply("meridiem", e.PM) : i.assign("meridiem", o), n[k] != null) {
|
|
889
|
+
let e = parseInt(n[k].substring(0, 3));
|
|
890
|
+
if (e >= 1e3) return null;
|
|
891
|
+
i.assign("millisecond", e);
|
|
892
|
+
}
|
|
893
|
+
if (n[O] != null) {
|
|
894
|
+
let e = parseInt(n[O]);
|
|
895
|
+
if (e >= 60) return null;
|
|
896
|
+
i.assign("second", e);
|
|
897
|
+
}
|
|
898
|
+
return i;
|
|
899
|
+
}
|
|
900
|
+
extractFollowingTimeComponents(t, n, r) {
|
|
901
|
+
let i = t.createParsingComponents();
|
|
902
|
+
if (n[k] != null) {
|
|
903
|
+
let e = parseInt(n[k].substring(0, 3));
|
|
904
|
+
if (e >= 1e3) return null;
|
|
905
|
+
i.assign("millisecond", e);
|
|
906
|
+
}
|
|
907
|
+
if (n[O] != null) {
|
|
908
|
+
let e = parseInt(n[O]);
|
|
909
|
+
if (e >= 60) return null;
|
|
910
|
+
i.assign("second", e);
|
|
911
|
+
}
|
|
912
|
+
let a = parseInt(n[Xe]), o = 0, s = -1;
|
|
913
|
+
if (n[D] == null ? a > 100 && (o = a % 100, a = Math.floor(a / 100)) : o = parseInt(n[D]), o >= 60 || a > 24) return null;
|
|
914
|
+
if (a >= 12 && (s = e.PM), n[A] != null) {
|
|
915
|
+
if (a > 12) return null;
|
|
916
|
+
let t = n[A][0].toLowerCase();
|
|
917
|
+
t == "a" && (s = e.AM, a == 12 && (a = 0, i.isCertain("day") || i.imply("day", i.get("day") + 1))), t == "p" && (s = e.PM, a != 12 && (a += 12)), r.start.isCertain("meridiem") || (s == e.AM ? (r.start.imply("meridiem", e.AM), r.start.get("hour") == 12 && r.start.assign("hour", 0)) : (r.start.imply("meridiem", e.PM), r.start.get("hour") != 12 && r.start.assign("hour", r.start.get("hour") + 12)));
|
|
918
|
+
}
|
|
919
|
+
return i.assign("hour", a), i.assign("minute", o), s >= 0 ? i.assign("meridiem", s) : r.start.isCertain("meridiem") && r.start.get("hour") > 12 ? r.start.get("hour") - 12 > a ? i.imply("meridiem", e.AM) : a <= 12 && (i.assign("hour", a + 12), i.assign("meridiem", e.PM)) : a > 12 ? i.imply("meridiem", e.PM) : a <= 12 && i.imply("meridiem", e.AM), i.date().getTime() < r.start.date().getTime() && i.imply("day", i.get("day") + 1), i;
|
|
920
|
+
}
|
|
921
|
+
checkAndReturnWithoutFollowingPattern(e) {
|
|
922
|
+
if (e.text.match(/^\d$/) || e.text.match(/^\d\d\d+$/) || e.text.match(/\d[apAP]$/)) return null;
|
|
923
|
+
let t = e.text.match(/[^\d:.](\d[\d.]+)$/);
|
|
924
|
+
if (t) {
|
|
925
|
+
let e = t[1];
|
|
926
|
+
if (this.strictMode || e.includes(".") && !e.match(/\d(\.\d{2})+$/) || parseInt(e) > 24) return null;
|
|
927
|
+
}
|
|
928
|
+
return e;
|
|
929
|
+
}
|
|
930
|
+
checkAndReturnWithFollowingPattern(e) {
|
|
931
|
+
if (e.text.match(/^\d+-\d+$/)) return null;
|
|
932
|
+
let t = e.text.match(/[^\d:.](\d[\d.]+)\s*-\s*(\d[\d.]+)$/);
|
|
933
|
+
if (t) {
|
|
934
|
+
if (this.strictMode) return null;
|
|
935
|
+
let e = t[1], n = t[2];
|
|
936
|
+
if (n.includes(".") && !n.match(/\d(\.\d{2})+$/) || parseInt(n) > 24 || parseInt(e) > 24) return null;
|
|
937
|
+
}
|
|
938
|
+
return e;
|
|
939
|
+
}
|
|
940
|
+
cachedPrimaryPrefix = null;
|
|
941
|
+
cachedPrimarySuffix = null;
|
|
942
|
+
cachedPrimaryTimePattern = null;
|
|
943
|
+
getPrimaryTimePatternThroughCache() {
|
|
944
|
+
let e = this.primaryPrefix(), t = this.primarySuffix();
|
|
945
|
+
return this.cachedPrimaryPrefix === e && this.cachedPrimarySuffix === t ? this.cachedPrimaryTimePattern : (this.cachedPrimaryTimePattern = Je(this.primaryPatternLeftBoundary(), e, t, this.patternFlags()), this.cachedPrimaryPrefix = e, this.cachedPrimarySuffix = t, this.cachedPrimaryTimePattern);
|
|
946
|
+
}
|
|
947
|
+
cachedFollowingPhase = null;
|
|
948
|
+
cachedFollowingSuffix = null;
|
|
949
|
+
cachedFollowingTimePatten = null;
|
|
950
|
+
getFollowingTimePatternThroughCache() {
|
|
951
|
+
let e = this.followingPhase(), t = this.followingSuffix();
|
|
952
|
+
return this.cachedFollowingPhase === e && this.cachedFollowingSuffix === t ? this.cachedFollowingTimePatten : (this.cachedFollowingTimePatten = Ye(e, t), this.cachedFollowingPhase = e, this.cachedFollowingSuffix = t, this.cachedFollowingTimePatten);
|
|
953
|
+
}
|
|
954
|
+
}, Qe = class extends Ze {
|
|
955
|
+
constructor(e) {
|
|
956
|
+
super(e);
|
|
957
|
+
}
|
|
958
|
+
followingPhase() {
|
|
959
|
+
return "\\s*(?:\\-|\\–|\\~|\\〜|to|until|through|till|\\?)\\s*";
|
|
960
|
+
}
|
|
961
|
+
primaryPrefix() {
|
|
962
|
+
return "(?:(?:at|from)\\s*)??";
|
|
963
|
+
}
|
|
964
|
+
primarySuffix() {
|
|
965
|
+
return "(?:\\s*(?:o\\W*clock|at\\s*night|in\\s*the\\s*(?:morning|afternoon)))?(?!/)(?=\\W|$)";
|
|
966
|
+
}
|
|
967
|
+
extractPrimaryTimeComponents(t, n) {
|
|
968
|
+
let r = super.extractPrimaryTimeComponents(t, n);
|
|
969
|
+
if (!r) return r;
|
|
970
|
+
if (n[0].endsWith("night")) {
|
|
971
|
+
let t = r.get("hour");
|
|
972
|
+
t >= 6 && t < 12 ? (r.assign("hour", r.get("hour") + 12), r.assign("meridiem", e.PM)) : t < 6 && r.assign("meridiem", e.AM);
|
|
973
|
+
}
|
|
974
|
+
if (n[0].endsWith("afternoon")) {
|
|
975
|
+
r.assign("meridiem", e.PM);
|
|
976
|
+
let t = r.get("hour");
|
|
977
|
+
t >= 0 && t <= 6 && r.assign("hour", r.get("hour") + 12);
|
|
978
|
+
}
|
|
979
|
+
return n[0].endsWith("morning") && (r.assign("meridiem", e.AM), r.get("hour") < 12 && r.assign("hour", r.get("hour"))), r.addTag("parser/ENTimeExpressionParser");
|
|
980
|
+
}
|
|
981
|
+
extractFollowingTimeComponents(e, t, n) {
|
|
982
|
+
let r = super.extractFollowingTimeComponents(e, t, n);
|
|
983
|
+
return r && r.addTag("parser/ENTimeExpressionParser"), r;
|
|
984
|
+
}
|
|
985
|
+
}, $e = RegExp(`(${w})\\s{0,5}(?:ago|before|earlier)(?=\\W|$)`, "i"), et = RegExp(`(${he})\\s{0,5}(?:ago|before|earlier)(?=\\W|$)`, "i"), tt = class extends E {
|
|
986
|
+
strictMode;
|
|
987
|
+
constructor(e) {
|
|
988
|
+
super(), this.strictMode = e;
|
|
989
|
+
}
|
|
990
|
+
innerPattern() {
|
|
991
|
+
return this.strictMode ? et : $e;
|
|
992
|
+
}
|
|
993
|
+
innerExtract(e, t) {
|
|
994
|
+
let n = T(t[1]);
|
|
995
|
+
return n ? m.createRelativeFromReference(e.reference, p(n)) : null;
|
|
996
|
+
}
|
|
997
|
+
}, nt = RegExp(`(${w})\\s{0,5}(?:later|after|from now|henceforth|forward|out)(?=(?:\\W|\$))`, "i"), rt = RegExp(`(${he})\\s{0,5}(later|after|from now)(?=\\W|$)`, "i"), it = 1, at = class extends E {
|
|
998
|
+
strictMode;
|
|
999
|
+
constructor(e) {
|
|
1000
|
+
super(), this.strictMode = e;
|
|
1001
|
+
}
|
|
1002
|
+
innerPattern() {
|
|
1003
|
+
return this.strictMode ? rt : nt;
|
|
1004
|
+
}
|
|
1005
|
+
innerExtract(e, t) {
|
|
1006
|
+
let n = T(t[it]);
|
|
1007
|
+
return n ? m.createRelativeFromReference(e.reference, n) : null;
|
|
1008
|
+
}
|
|
1009
|
+
}, ot = class {
|
|
1010
|
+
refine(e, t) {
|
|
1011
|
+
return t.filter((t) => this.isValid(e, t));
|
|
1012
|
+
}
|
|
1013
|
+
}, j = class {
|
|
1014
|
+
refine(e, t) {
|
|
1015
|
+
if (t.length < 2) return t;
|
|
1016
|
+
let n = [], r = t[0], i = null;
|
|
1017
|
+
for (let a = 1; a < t.length; a++) {
|
|
1018
|
+
i = t[a];
|
|
1019
|
+
let o = e.text.substring(r.index + r.text.length, i.index);
|
|
1020
|
+
if (!this.shouldMergeResults(o, r, i, e)) n.push(r), r = i;
|
|
1021
|
+
else {
|
|
1022
|
+
let t = r, n = i, a = this.mergeResults(o, t, n, e);
|
|
1023
|
+
e.debug(() => {
|
|
1024
|
+
console.log(`${this.constructor.name} merged ${t} and ${n} into ${a}`);
|
|
1025
|
+
}), r = a;
|
|
1026
|
+
}
|
|
1027
|
+
}
|
|
1028
|
+
return r != null && n.push(r), n;
|
|
1029
|
+
}
|
|
1030
|
+
}, st = class extends j {
|
|
1031
|
+
shouldMergeResults(e, t, n) {
|
|
1032
|
+
return !t.end && !n.end && e.match(this.patternBetween()) != null;
|
|
1033
|
+
}
|
|
1034
|
+
mergeResults(e, t, n) {
|
|
1035
|
+
if (!t.start.isOnlyWeekdayComponent() && !n.start.isOnlyWeekdayComponent() && (n.start.getCertainComponents().forEach((e) => {
|
|
1036
|
+
t.start.isCertain(e) || t.start.imply(e, n.start.get(e));
|
|
1037
|
+
}), t.start.getCertainComponents().forEach((e) => {
|
|
1038
|
+
n.start.isCertain(e) || n.start.imply(e, t.start.get(e));
|
|
1039
|
+
})), t.start.date() > n.start.date()) {
|
|
1040
|
+
let e = t.start.date(), r = n.start.date();
|
|
1041
|
+
n.start.isOnlyWeekdayComponent() && f(r, { day: 7 }) > e ? (r = f(r, { day: 7 }), n.start.imply("day", r.getDate()), n.start.imply("month", r.getMonth() + 1), n.start.imply("year", r.getFullYear())) : t.start.isOnlyWeekdayComponent() && f(e, { day: -7 }) < r ? (e = f(e, { day: -7 }), t.start.imply("day", e.getDate()), t.start.imply("month", e.getMonth() + 1), t.start.imply("year", e.getFullYear())) : n.start.isDateWithUnknownYear() && f(r, { year: 1 }) > e ? (r = f(r, { year: 1 }), n.start.imply("year", r.getFullYear())) : t.start.isDateWithUnknownYear() && f(e, { year: -1 }) < r ? (e = f(e, { year: -1 }), t.start.imply("year", e.getFullYear())) : [n, t] = [t, n];
|
|
1042
|
+
}
|
|
1043
|
+
let r = t.clone();
|
|
1044
|
+
return r.start = t.start, r.end = n.start, r.index = Math.min(t.index, n.index), t.index < n.index ? r.text = t.text + e + n.text : r.text = n.text + e + t.text, r;
|
|
1045
|
+
}
|
|
1046
|
+
}, ct = class extends st {
|
|
1047
|
+
patternBetween() {
|
|
1048
|
+
return /^\s*(to|-|–|until|through|till)\s*$/i;
|
|
1049
|
+
}
|
|
1050
|
+
};
|
|
1051
|
+
//#endregion
|
|
1052
|
+
//#region node_modules/.pnpm/chrono-node@2.9.1/node_modules/chrono-node/dist/esm/calculation/mergingCalculation.js
|
|
1053
|
+
function lt(e, t) {
|
|
1054
|
+
let n = e.clone(), i = e.start, o = t.start;
|
|
1055
|
+
if (n.start = ut(i, o), e.end != null || t.end != null) {
|
|
1056
|
+
let i = ut(e.end == null ? e.start : e.end, t.end == null ? t.start : t.end);
|
|
1057
|
+
if (e.end == null && i.date().getTime() < n.start.date().getTime()) {
|
|
1058
|
+
let e = new Date(i.date().getTime());
|
|
1059
|
+
e.setDate(e.getDate() + 1), i.isCertain("day") ? r(i, e) : a(i, e);
|
|
1060
|
+
}
|
|
1061
|
+
n.end = i;
|
|
1062
|
+
}
|
|
1063
|
+
return n;
|
|
1064
|
+
}
|
|
1065
|
+
function ut(t, n) {
|
|
1066
|
+
let r = t.clone();
|
|
1067
|
+
n.isCertain("hour") ? (r.assign("hour", n.get("hour")), r.assign("minute", n.get("minute")), n.isCertain("second") ? (r.assign("second", n.get("second")), n.isCertain("millisecond") ? r.assign("millisecond", n.get("millisecond")) : r.imply("millisecond", n.get("millisecond"))) : (r.imply("second", n.get("second")), r.imply("millisecond", n.get("millisecond")))) : (r.imply("hour", n.get("hour")), r.imply("minute", n.get("minute")), r.imply("second", n.get("second")), r.imply("millisecond", n.get("millisecond"))), n.isCertain("timezoneOffset") && r.assign("timezoneOffset", n.get("timezoneOffset"));
|
|
1068
|
+
let i = t.get("meridiem") != null && (t.isCertain("meridiem") || Array.from(t.tags()).some((e) => e.startsWith("casualReference/")));
|
|
1069
|
+
return n.isCertain("meridiem") ? r.assign("meridiem", n.get("meridiem")) : n.get("meridiem") != null && !i && r.imply("meridiem", n.get("meridiem")), r.get("meridiem") == e.PM && r.get("hour") < 12 && (n.isCertain("hour") ? r.assign("hour", r.get("hour") + 12) : r.imply("hour", r.get("hour") + 12)), r.addTags(t.tags()), r.addTags(n.tags()), r;
|
|
1070
|
+
}
|
|
1071
|
+
//#endregion
|
|
1072
|
+
//#region node_modules/.pnpm/chrono-node@2.9.1/node_modules/chrono-node/dist/esm/common/refiners/AbstractMergeDateTimeRefiner.js
|
|
1073
|
+
var dt = class extends j {
|
|
1074
|
+
shouldMergeResults(e, t, n) {
|
|
1075
|
+
return (t.start.isOnlyDate() && n.start.isOnlyTime() || n.start.isOnlyDate() && t.start.isOnlyTime()) && e.match(this.patternBetween()) != null;
|
|
1076
|
+
}
|
|
1077
|
+
mergeResults(e, t, n) {
|
|
1078
|
+
let r = t.start.isOnlyDate() ? lt(t, n) : lt(n, t);
|
|
1079
|
+
return r.index = t.index, r.text = t.text + e + n.text, r;
|
|
1080
|
+
}
|
|
1081
|
+
}, ft = class extends dt {
|
|
1082
|
+
patternBetween() {
|
|
1083
|
+
return /* @__PURE__ */ RegExp("^\\s*(T|at|after|before|on|of|,|-|\\.|∙|:)?\\s*$");
|
|
1084
|
+
}
|
|
1085
|
+
}, pt = /* @__PURE__ */ RegExp("^\\s*,?\\s*\\(?([A-Z]{2,4})\\)?(?=\\W|$)", "i"), mt = class {
|
|
1086
|
+
timezoneOverrides;
|
|
1087
|
+
constructor(e) {
|
|
1088
|
+
this.timezoneOverrides = e;
|
|
1089
|
+
}
|
|
1090
|
+
refine(e, t) {
|
|
1091
|
+
let n = e.option.timezones ?? {};
|
|
1092
|
+
return t.forEach((t) => {
|
|
1093
|
+
let r = e.text.substring(t.index + t.text.length), i = pt.exec(r);
|
|
1094
|
+
if (!i) return;
|
|
1095
|
+
let a = i[1].toUpperCase(), o = u(a, t.start.date() ?? t.refDate ?? /* @__PURE__ */ new Date(), {
|
|
1096
|
+
...this.timezoneOverrides,
|
|
1097
|
+
...n
|
|
1098
|
+
});
|
|
1099
|
+
if (o == null) return;
|
|
1100
|
+
e.debug(() => {
|
|
1101
|
+
console.log(`Extracting timezone: '${a}' into: ${o} for: ${t.start}`);
|
|
1102
|
+
});
|
|
1103
|
+
let s = t.start.get("timezoneOffset");
|
|
1104
|
+
s !== null && o != s && (t.start.isCertain("timezoneOffset") || a != i[1]) || t.start.isOnlyDate() && a != i[1] || (t.text += i[0], t.start.isCertain("timezoneOffset") || t.start.assign("timezoneOffset", o), t.end != null && !t.end.isCertain("timezoneOffset") && t.end.assign("timezoneOffset", o));
|
|
1105
|
+
}), t;
|
|
1106
|
+
}
|
|
1107
|
+
}, ht = /* @__PURE__ */ RegExp("^\\s*(?:\\(?(?:GMT|UTC)\\s?)?([+-])(\\d{1,2})(?::?(\\d{2}))?\\)?", "i"), gt = 1, _t = 2, vt = 3, yt = class {
|
|
1108
|
+
refine(e, t) {
|
|
1109
|
+
return t.forEach(function(t) {
|
|
1110
|
+
if (t.start.isCertain("timezoneOffset")) return;
|
|
1111
|
+
let n = e.text.substring(t.index + t.text.length), r = ht.exec(n);
|
|
1112
|
+
if (!r) return;
|
|
1113
|
+
e.debug(() => {
|
|
1114
|
+
console.log(`Extracting timezone: '${r[0]}' into : ${t}`);
|
|
1115
|
+
});
|
|
1116
|
+
let i = parseInt(r[_t]), a = parseInt(r[vt] || "0"), o = i * 60 + a;
|
|
1117
|
+
o > 840 || (r[gt] === "-" && (o = -o), t.end != null && t.end.assign("timezoneOffset", o), t.start.assign("timezoneOffset", o), t.text += r[0]);
|
|
1118
|
+
}), t;
|
|
1119
|
+
}
|
|
1120
|
+
}, bt = class {
|
|
1121
|
+
refine(e, t) {
|
|
1122
|
+
if (t.length < 2) return t;
|
|
1123
|
+
let n = [], r = t[0];
|
|
1124
|
+
for (let i = 1; i < t.length; i++) {
|
|
1125
|
+
let a = t[i];
|
|
1126
|
+
if (a.index >= r.index + r.text.length) {
|
|
1127
|
+
n.push(r), r = a;
|
|
1128
|
+
continue;
|
|
1129
|
+
}
|
|
1130
|
+
let o = null, s = null;
|
|
1131
|
+
a.text.length > r.text.length ? (o = a, s = r) : (o = r, s = a), e.debug(() => {
|
|
1132
|
+
console.log(`${this.constructor.name} remove ${s} by ${o}`);
|
|
1133
|
+
}), r = o;
|
|
1134
|
+
}
|
|
1135
|
+
return r != null && n.push(r), n;
|
|
1136
|
+
}
|
|
1137
|
+
};
|
|
1138
|
+
//#endregion
|
|
1139
|
+
//#region node_modules/.pnpm/chrono-node@2.9.1/node_modules/chrono-node/dist/esm/calculation/weekdays.js
|
|
1140
|
+
function xt(e, t, n) {
|
|
1141
|
+
let r = St(e.getDateWithAdjustedTimezone(), t, n), i = new m(e);
|
|
1142
|
+
return i = i.addDurationAsImplied({ day: r }), i.assign("weekday", t), i;
|
|
1143
|
+
}
|
|
1144
|
+
function St(e, n, r) {
|
|
1145
|
+
let i = e.getDay();
|
|
1146
|
+
switch (r) {
|
|
1147
|
+
case "this": return M(e, n);
|
|
1148
|
+
case "last": return wt(e, n);
|
|
1149
|
+
case "next": return i == t.SUNDAY ? n == t.SUNDAY ? 7 : n : i == t.SATURDAY ? n == t.SATURDAY ? 7 : n == t.SUNDAY ? 8 : 1 + n : n < i && n != t.SUNDAY ? M(e, n) : M(e, n) + 7;
|
|
1150
|
+
}
|
|
1151
|
+
return Ct(e, n);
|
|
1152
|
+
}
|
|
1153
|
+
function Ct(e, t) {
|
|
1154
|
+
let n = wt(e, t), r = M(e, t);
|
|
1155
|
+
return r < -n ? r : n;
|
|
1156
|
+
}
|
|
1157
|
+
function M(e, t) {
|
|
1158
|
+
let n = t - e.getDay();
|
|
1159
|
+
return n < 0 && (n += 7), n;
|
|
1160
|
+
}
|
|
1161
|
+
function wt(e, t) {
|
|
1162
|
+
let n = t - e.getDay();
|
|
1163
|
+
return n >= 0 && (n -= 7), n;
|
|
1164
|
+
}
|
|
1165
|
+
//#endregion
|
|
1166
|
+
//#region node_modules/.pnpm/chrono-node@2.9.1/node_modules/chrono-node/dist/esm/common/refiners/ForwardDateRefiner.js
|
|
1167
|
+
var Tt = class {
|
|
1168
|
+
refine(e, t) {
|
|
1169
|
+
return e.option.forwardDate && t.forEach((t) => {
|
|
1170
|
+
let n = e.reference.getDateWithAdjustedTimezone();
|
|
1171
|
+
if (t.start.isOnlyTime() && e.reference.instant > t.start.date()) {
|
|
1172
|
+
let n = e.reference.getDateWithAdjustedTimezone(), r = new Date(n);
|
|
1173
|
+
r.setDate(r.getDate() + 1), a(t.start, r), e.debug(() => {
|
|
1174
|
+
console.log(`${this.constructor.name} adjusted ${t} time from the ref date (${n}) to the following day (${r})`);
|
|
1175
|
+
}), t.end && t.end.isOnlyTime() && (a(t.end, r), t.start.date() > t.end.date() && (r.setDate(r.getDate() + 1), a(t.end, r)));
|
|
1176
|
+
}
|
|
1177
|
+
if (t.start.isOnlyWeekdayComponent() && n > t.start.date()) {
|
|
1178
|
+
let r = f(n, { day: M(n, t.start.get("weekday")) || 7 });
|
|
1179
|
+
if (a(t.start, r), e.debug(() => {
|
|
1180
|
+
console.log(`${this.constructor.name} adjusted ${t} weekday (${t.start})`);
|
|
1181
|
+
}), t.end && t.start.date() > t.end.date()) {
|
|
1182
|
+
let r = f(n, { day: M(n, t.start.get("weekday")) || 7 });
|
|
1183
|
+
a(t.end, r), e.debug(() => {
|
|
1184
|
+
console.log(`${this.constructor.name} adjusted ${t} weekday (${t.end})`);
|
|
1185
|
+
});
|
|
1186
|
+
}
|
|
1187
|
+
}
|
|
1188
|
+
if (t.start.isDateWithUnknownYear() && n > t.start.date()) for (let r = 0; r < 3 && n > t.start.date(); r++) t.start.imply("year", t.start.get("year") + 1), e.debug(() => {
|
|
1189
|
+
console.log(`${this.constructor.name} adjusted ${t} year (${t.start})`);
|
|
1190
|
+
}), t.end && !t.end.isCertain("year") && (t.end.imply("year", t.end.get("year") + 1), e.debug(() => {
|
|
1191
|
+
console.log(`${this.constructor.name} adjusted ${t} month (${t.start})`);
|
|
1192
|
+
}));
|
|
1193
|
+
}), t;
|
|
1194
|
+
}
|
|
1195
|
+
}, Et = class extends ot {
|
|
1196
|
+
strictMode;
|
|
1197
|
+
constructor(e) {
|
|
1198
|
+
super(), this.strictMode = e;
|
|
1199
|
+
}
|
|
1200
|
+
isValid(e, t) {
|
|
1201
|
+
return t.text.replace(" ", "").match(/^\d*(\.\d*)?$/) ? (e.debug(() => {
|
|
1202
|
+
console.log(`Removing unlikely result '${t.text}'`);
|
|
1203
|
+
}), !1) : t.start.isValidDate() ? t.end && !t.end.isValidDate() ? (e.debug(() => {
|
|
1204
|
+
console.log(`Removing invalid result: ${t} (${t.end})`);
|
|
1205
|
+
}), !1) : this.strictMode ? this.isStrictModeValid(e, t) : !0 : (e.debug(() => {
|
|
1206
|
+
console.log(`Removing invalid result: ${t} (${t.start})`);
|
|
1207
|
+
}), !1);
|
|
1208
|
+
}
|
|
1209
|
+
isStrictModeValid(e, t) {
|
|
1210
|
+
return t.start.isOnlyWeekdayComponent() ? (e.debug(() => {
|
|
1211
|
+
console.log(`(Strict) Removing weekday only component: ${t} (${t.end})`);
|
|
1212
|
+
}), !1) : !0;
|
|
1213
|
+
}
|
|
1214
|
+
}, Dt = /* @__PURE__ */ 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"), Ot = 1, kt = 2, At = 3, jt = 4, Mt = 5, Nt = 6, Pt = 7, Ft = 8, It = 9, Lt = 10, Rt = class extends E {
|
|
1215
|
+
innerPattern() {
|
|
1216
|
+
return Dt;
|
|
1217
|
+
}
|
|
1218
|
+
innerExtract(e, t) {
|
|
1219
|
+
let n = e.createParsingComponents({
|
|
1220
|
+
year: parseInt(t[Ot]),
|
|
1221
|
+
month: parseInt(t[kt]),
|
|
1222
|
+
day: parseInt(t[At])
|
|
1223
|
+
});
|
|
1224
|
+
if (t[jt] != null && (n.assign("hour", parseInt(t[jt])), n.assign("minute", parseInt(t[Mt])), t[Nt] != null && n.assign("second", parseInt(t[Nt])), t[Pt] != null && n.assign("millisecond", parseInt(t[Pt])), t[Ft] != null)) {
|
|
1225
|
+
let e = 0;
|
|
1226
|
+
if (t[It]) {
|
|
1227
|
+
let n = parseInt(t[It]), r = 0;
|
|
1228
|
+
t[Lt] != null && (r = parseInt(t[Lt])), e = n * 60, e < 0 ? e -= r : e += r;
|
|
1229
|
+
}
|
|
1230
|
+
n.assign("timezoneOffset", e);
|
|
1231
|
+
}
|
|
1232
|
+
return n.addTag("parser/ISOFormatParser");
|
|
1233
|
+
}
|
|
1234
|
+
}, zt = class extends j {
|
|
1235
|
+
mergeResults(e, t, n) {
|
|
1236
|
+
let r = n.clone();
|
|
1237
|
+
return r.index = t.index, r.text = t.text + e + r.text, r.start.assign("weekday", t.start.get("weekday")), r.end && r.end.assign("weekday", t.start.get("weekday")), r;
|
|
1238
|
+
}
|
|
1239
|
+
shouldMergeResults(e, t, n) {
|
|
1240
|
+
return t.start.isOnlyWeekdayComponent() && !t.start.isCertain("hour") && n.start.isCertain("day") && e.match(/^,?\s*$/) != null;
|
|
1241
|
+
}
|
|
1242
|
+
};
|
|
1243
|
+
//#endregion
|
|
1244
|
+
//#region node_modules/.pnpm/chrono-node@2.9.1/node_modules/chrono-node/dist/esm/configurations.js
|
|
1245
|
+
function Bt(e, t = !1) {
|
|
1246
|
+
return e.parsers.unshift(new Rt()), e.refiners.unshift(new zt()), e.refiners.unshift(new yt()), e.refiners.unshift(new bt()), e.refiners.push(new mt()), e.refiners.push(new bt()), e.refiners.push(new Tt()), e.refiners.push(new Et(t)), e;
|
|
1247
|
+
}
|
|
1248
|
+
//#endregion
|
|
1249
|
+
//#region node_modules/.pnpm/chrono-node@2.9.1/node_modules/chrono-node/dist/esm/common/casualReferences.js
|
|
1250
|
+
function Vt(e) {
|
|
1251
|
+
let t = e.getDateWithAdjustedTimezone(), n = new m(e, {});
|
|
1252
|
+
return r(n, t), i(n, t), n.assign("timezoneOffset", e.getTimezoneOffset()), n.addTag("casualReference/now"), n;
|
|
1253
|
+
}
|
|
1254
|
+
function Ht(e) {
|
|
1255
|
+
let t = e.getDateWithAdjustedTimezone(), n = new m(e, {});
|
|
1256
|
+
return r(n, t), o(n, t), n.delete("meridiem"), n.addTag("casualReference/today"), n;
|
|
1257
|
+
}
|
|
1258
|
+
function Ut(e) {
|
|
1259
|
+
return Gt(e, 1).addTag("casualReference/yesterday");
|
|
1260
|
+
}
|
|
1261
|
+
function Wt(e) {
|
|
1262
|
+
return Kt(e, 1).addTag("casualReference/tomorrow");
|
|
1263
|
+
}
|
|
1264
|
+
function Gt(e, t) {
|
|
1265
|
+
return Kt(e, -t);
|
|
1266
|
+
}
|
|
1267
|
+
function Kt(e, t) {
|
|
1268
|
+
let n = e.getDateWithAdjustedTimezone(), i = new m(e, {}), a = new Date(n.getTime());
|
|
1269
|
+
return a.setDate(a.getDate() + t), r(i, a), o(i, a), i.delete("meridiem"), i;
|
|
1270
|
+
}
|
|
1271
|
+
function qt(t, n = 22) {
|
|
1272
|
+
let i = t.getDateWithAdjustedTimezone(), a = new m(t, {});
|
|
1273
|
+
return r(a, i), a.imply("hour", n), a.imply("meridiem", e.PM), a.addTag("casualReference/tonight"), a;
|
|
1274
|
+
}
|
|
1275
|
+
function Jt(t, n = 20) {
|
|
1276
|
+
let r = new m(t, {});
|
|
1277
|
+
return r.imply("meridiem", e.PM), r.imply("hour", n), r.addTag("casualReference/evening"), r;
|
|
1278
|
+
}
|
|
1279
|
+
function Yt(e) {
|
|
1280
|
+
let t = new m(e, {});
|
|
1281
|
+
return e.getDateWithAdjustedTimezone().getHours() > 2 && t.addDurationAsImplied({ day: 1 }), t.assign("hour", 0), t.imply("minute", 0), t.imply("second", 0), t.imply("millisecond", 0), t.addTag("casualReference/midnight"), t;
|
|
1282
|
+
}
|
|
1283
|
+
function Xt(t, n = 6) {
|
|
1284
|
+
let r = new m(t, {});
|
|
1285
|
+
return r.imply("meridiem", e.AM), r.imply("hour", n), r.imply("minute", 0), r.imply("second", 0), r.imply("millisecond", 0), r.addTag("casualReference/morning"), r;
|
|
1286
|
+
}
|
|
1287
|
+
function Zt(t, n = 15) {
|
|
1288
|
+
let r = new m(t, {});
|
|
1289
|
+
return r.imply("meridiem", e.PM), r.imply("hour", n), r.imply("minute", 0), r.imply("second", 0), r.imply("millisecond", 0), r.addTag("casualReference/afternoon"), r;
|
|
1290
|
+
}
|
|
1291
|
+
function Qt(t) {
|
|
1292
|
+
let n = new m(t, {});
|
|
1293
|
+
return n.imply("meridiem", e.AM), n.assign("hour", 12), n.imply("minute", 0), n.imply("second", 0), n.imply("millisecond", 0), n.addTag("casualReference/noon"), n;
|
|
1294
|
+
}
|
|
1295
|
+
//#endregion
|
|
1296
|
+
//#region node_modules/.pnpm/chrono-node@2.9.1/node_modules/chrono-node/dist/esm/locales/en/parsers/ENCasualDateParser.js
|
|
1297
|
+
var $t = /(now|today|tonight|tomorrow|overmorrow|tmr|tmrw|yesterday|last\s*night)(?=\W|$)/i, en = class extends E {
|
|
1298
|
+
innerPattern(e) {
|
|
1299
|
+
return $t;
|
|
1300
|
+
}
|
|
1301
|
+
innerExtract(e, t) {
|
|
1302
|
+
let n = e.refDate, i = t[0].toLowerCase(), a = e.createParsingComponents();
|
|
1303
|
+
switch (i) {
|
|
1304
|
+
case "now":
|
|
1305
|
+
a = Vt(e.reference);
|
|
1306
|
+
break;
|
|
1307
|
+
case "today":
|
|
1308
|
+
a = Ht(e.reference);
|
|
1309
|
+
break;
|
|
1310
|
+
case "yesterday":
|
|
1311
|
+
a = Ut(e.reference);
|
|
1312
|
+
break;
|
|
1313
|
+
case "tomorrow":
|
|
1314
|
+
case "tmr":
|
|
1315
|
+
case "tmrw":
|
|
1316
|
+
a = Wt(e.reference);
|
|
1317
|
+
break;
|
|
1318
|
+
case "tonight":
|
|
1319
|
+
a = qt(e.reference);
|
|
1320
|
+
break;
|
|
1321
|
+
case "overmorrow":
|
|
1322
|
+
a = Kt(e.reference, 2);
|
|
1323
|
+
break;
|
|
1324
|
+
default:
|
|
1325
|
+
if (i.match(/last\s*night/)) {
|
|
1326
|
+
if (n.getHours() > 6) {
|
|
1327
|
+
let e = new Date(n.getTime());
|
|
1328
|
+
e.setDate(e.getDate() - 1), n = e;
|
|
1329
|
+
}
|
|
1330
|
+
r(a, n), a.imply("hour", 0);
|
|
1331
|
+
}
|
|
1332
|
+
break;
|
|
1333
|
+
}
|
|
1334
|
+
return a.addTag("parser/ENCasualDateParser"), a;
|
|
1335
|
+
}
|
|
1336
|
+
}, tn = /(?:this)?\s{0,3}(morning|afternoon|evening|night|midnight|midday|noon)(?=\W|$)/i, nn = class extends E {
|
|
1337
|
+
innerPattern() {
|
|
1338
|
+
return tn;
|
|
1339
|
+
}
|
|
1340
|
+
innerExtract(e, t) {
|
|
1341
|
+
let n = null;
|
|
1342
|
+
switch (t[1].toLowerCase()) {
|
|
1343
|
+
case "afternoon":
|
|
1344
|
+
n = Zt(e.reference);
|
|
1345
|
+
break;
|
|
1346
|
+
case "evening":
|
|
1347
|
+
case "night":
|
|
1348
|
+
n = Jt(e.reference);
|
|
1349
|
+
break;
|
|
1350
|
+
case "midnight":
|
|
1351
|
+
n = Yt(e.reference);
|
|
1352
|
+
break;
|
|
1353
|
+
case "morning":
|
|
1354
|
+
n = Xt(e.reference);
|
|
1355
|
+
break;
|
|
1356
|
+
case "noon":
|
|
1357
|
+
case "midday":
|
|
1358
|
+
n = Qt(e.reference);
|
|
1359
|
+
break;
|
|
1360
|
+
}
|
|
1361
|
+
return n && n.addTag("parser/ENCasualTimeParser"), n;
|
|
1362
|
+
}
|
|
1363
|
+
}, rn = RegExp(`(?:(?:\\,|\\(|\\()\\s*)?(?:on\\s*?)?(?:(this|last|past|next)\\s*)?(${g(ie)}|weekend|weekday)(?:\\s*(?:\\,|\\)|\\)))?(?:\\s*(?:of\\s*)?(this|last|past|next)\\s*week)?(?=\\W|\$)`, "i"), an = 1, on = 2, sn = 3, cn = class extends E {
|
|
1364
|
+
innerPattern() {
|
|
1365
|
+
return rn;
|
|
1366
|
+
}
|
|
1367
|
+
innerExtract(e, n) {
|
|
1368
|
+
let r = n[an], i = n[sn], a = r || i;
|
|
1369
|
+
a ||= "", a = a.toLowerCase();
|
|
1370
|
+
let o = null;
|
|
1371
|
+
a == "last" || a == "past" ? o = "last" : a == "next" ? o = "next" : a == "this" && (o = "this");
|
|
1372
|
+
let s = n[on].toLowerCase(), c;
|
|
1373
|
+
if (ie[s] !== void 0) c = ie[s];
|
|
1374
|
+
else if (s == "weekend") c = o == "last" ? t.SUNDAY : t.SATURDAY;
|
|
1375
|
+
else if (s == "weekday") {
|
|
1376
|
+
let n = e.reference.getDateWithAdjustedTimezone().getDay();
|
|
1377
|
+
n == t.SUNDAY || n == t.SATURDAY ? c = o == "last" ? t.FRIDAY : t.MONDAY : (c = n - 1, c = o == "last" ? c - 1 : c + 1, c = c % 5 + 1);
|
|
1378
|
+
} else return null;
|
|
1379
|
+
return xt(e.reference, c, o);
|
|
1380
|
+
}
|
|
1381
|
+
}, ln = RegExp(`(this|last|past|next|after\\s*this)\\s*(${g(y)})(?=\\s*)(?=\\W|\$)`, "i"), un = 1, dn = 2, fn = class extends E {
|
|
1382
|
+
innerPattern() {
|
|
1383
|
+
return ln;
|
|
1384
|
+
}
|
|
1385
|
+
innerExtract(e, t) {
|
|
1386
|
+
let n = t[un].toLowerCase(), r = t[dn].toLowerCase(), i = y[r];
|
|
1387
|
+
if (n == "next" || n.startsWith("after")) {
|
|
1388
|
+
let t = {};
|
|
1389
|
+
return t[i] = 1, m.createRelativeFromReference(e.reference, t);
|
|
1390
|
+
}
|
|
1391
|
+
if (n == "last" || n == "past") {
|
|
1392
|
+
let t = {};
|
|
1393
|
+
return t[i] = -1, m.createRelativeFromReference(e.reference, t);
|
|
1394
|
+
}
|
|
1395
|
+
let a = e.createParsingComponents(), o = new Date(e.reference.instant.getTime());
|
|
1396
|
+
return r.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())) : r.match(/month/i) ? (o.setDate(1), a.imply("day", o.getDate()), a.assign("year", o.getFullYear()), a.assign("month", o.getMonth() + 1)) : r.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;
|
|
1397
|
+
}
|
|
1398
|
+
}, pn = /* @__PURE__ */ RegExp("([^\\d]|^)([0-3]{0,1}[0-9]{1})[\\/\\.\\-]([0-3]{0,1}[0-9]{1})(?:[\\/\\.\\-]([0-9]{4}|[0-9]{2}))?(\\W|$)", "i"), mn = 1, hn = 5, gn = 2, _n = 3, vn = 4, yn = class {
|
|
1399
|
+
groupNumberMonth;
|
|
1400
|
+
groupNumberDay;
|
|
1401
|
+
constructor(e) {
|
|
1402
|
+
this.groupNumberMonth = e ? _n : gn, this.groupNumberDay = e ? gn : _n;
|
|
1403
|
+
}
|
|
1404
|
+
pattern() {
|
|
1405
|
+
return pn;
|
|
1406
|
+
}
|
|
1407
|
+
extract(e, t) {
|
|
1408
|
+
let n = t.index + t[mn].length, r = t.index + t[0].length - t[hn].length;
|
|
1409
|
+
if (n > 0 && e.text.substring(0, n).match("\\d/?$") || r < e.text.length && e.text.substring(r).match("^/?\\d")) return;
|
|
1410
|
+
let i = e.text.substring(n, r);
|
|
1411
|
+
if (i.match(/^\d\.\d$/) || i.match(/^\d\.\d{1,2}\.\d{1,2}\s*$/) || !t[vn] && i.indexOf("/") < 0) return;
|
|
1412
|
+
let a = e.createParsingResult(n, i), o = parseInt(t[this.groupNumberMonth]), s = parseInt(t[this.groupNumberDay]);
|
|
1413
|
+
if ((o < 1 || o > 12) && o > 12) if (s >= 1 && s <= 12 && o <= 31) [s, o] = [o, s];
|
|
1414
|
+
else return null;
|
|
1415
|
+
if (s < 1 || s > 31) return null;
|
|
1416
|
+
if (a.start.assign("day", s), a.start.assign("month", o), t[vn]) {
|
|
1417
|
+
let e = re(parseInt(t[vn]));
|
|
1418
|
+
a.start.assign("year", e);
|
|
1419
|
+
} else {
|
|
1420
|
+
let t = _(e.refDate, s, o);
|
|
1421
|
+
a.start.imply("year", t);
|
|
1422
|
+
}
|
|
1423
|
+
return a.addTag("parser/SlashDateFormatParser");
|
|
1424
|
+
}
|
|
1425
|
+
}, bn = RegExp(`(this|last|past|next|after|\\+|-)\\s*(${w})(?=\\W|$)`, "i"), xn = RegExp(`(this|last|past|next|after|\\+|-)\\s*(${he})(?=\\W|$)`, "i"), Sn = class extends E {
|
|
1426
|
+
allowAbbreviations;
|
|
1427
|
+
constructor(e = !0) {
|
|
1428
|
+
super(), this.allowAbbreviations = e;
|
|
1429
|
+
}
|
|
1430
|
+
innerPattern() {
|
|
1431
|
+
return this.allowAbbreviations ? bn : xn;
|
|
1432
|
+
}
|
|
1433
|
+
innerExtract(e, t) {
|
|
1434
|
+
let n = t[1].toLowerCase(), r = T(t[2]);
|
|
1435
|
+
if (!r) return null;
|
|
1436
|
+
switch (n) {
|
|
1437
|
+
case "last":
|
|
1438
|
+
case "past":
|
|
1439
|
+
case "-":
|
|
1440
|
+
r = p(r);
|
|
1441
|
+
break;
|
|
1442
|
+
}
|
|
1443
|
+
return m.createRelativeFromReference(e.reference, r);
|
|
1444
|
+
}
|
|
1445
|
+
};
|
|
1446
|
+
//#endregion
|
|
1447
|
+
//#region node_modules/.pnpm/chrono-node@2.9.1/node_modules/chrono-node/dist/esm/locales/en/refiners/ENMergeRelativeAfterDateRefiner.js
|
|
1448
|
+
function Cn(e) {
|
|
1449
|
+
return e.text.match(/^[+-]/i) != null;
|
|
1450
|
+
}
|
|
1451
|
+
function wn(e) {
|
|
1452
|
+
return e.text.match(/^-/i) != null;
|
|
1453
|
+
}
|
|
1454
|
+
var Tn = class extends j {
|
|
1455
|
+
shouldMergeResults(e, t, n) {
|
|
1456
|
+
return e.match(/^\s*$/i) ? Cn(n) || wn(n) : !1;
|
|
1457
|
+
}
|
|
1458
|
+
mergeResults(e, t, n, r) {
|
|
1459
|
+
let i = T(n.text);
|
|
1460
|
+
wn(n) && (i = p(i));
|
|
1461
|
+
let a = m.createRelativeFromReference(ee.fromDate(t.start.date()), i);
|
|
1462
|
+
return new h(t.reference, t.index, `${t.text}${e}${n.text}`, a);
|
|
1463
|
+
}
|
|
1464
|
+
};
|
|
1465
|
+
//#endregion
|
|
1466
|
+
//#region node_modules/.pnpm/chrono-node@2.9.1/node_modules/chrono-node/dist/esm/locales/en/refiners/ENMergeRelativeFollowByDateRefiner.js
|
|
1467
|
+
function En(e) {
|
|
1468
|
+
return e.text.match(/\s+(before|from)$/i) != null;
|
|
1469
|
+
}
|
|
1470
|
+
function Dn(e) {
|
|
1471
|
+
return e.text.match(/\s+(after|since)$/i) != null;
|
|
1472
|
+
}
|
|
1473
|
+
var On = class extends j {
|
|
1474
|
+
patternBetween() {
|
|
1475
|
+
return /^\s*$/i;
|
|
1476
|
+
}
|
|
1477
|
+
shouldMergeResults(e, t, n) {
|
|
1478
|
+
return !e.match(this.patternBetween()) || !En(t) && !Dn(t) ? !1 : !!n.start.get("day") && !!n.start.get("month") && !!n.start.get("year");
|
|
1479
|
+
}
|
|
1480
|
+
mergeResults(e, t, n) {
|
|
1481
|
+
let r = T(t.text);
|
|
1482
|
+
En(t) && (r = p(r));
|
|
1483
|
+
let i = m.createRelativeFromReference(ee.fromDate(n.start.date()), r);
|
|
1484
|
+
return new h(n.reference, t.index, `${t.text}${e}${n.text}`, i);
|
|
1485
|
+
}
|
|
1486
|
+
}, kn = RegExp(`^\\s*(${S})`, "i"), An = 1, jn = class {
|
|
1487
|
+
refine(e, t) {
|
|
1488
|
+
return t.forEach(function(t) {
|
|
1489
|
+
if (!t.start.isDateWithUnknownYear()) return;
|
|
1490
|
+
let n = e.text.substring(t.index + t.text.length), r = kn.exec(n);
|
|
1491
|
+
if (!r || r[0].trim().length <= 3) return;
|
|
1492
|
+
e.debug(() => {
|
|
1493
|
+
console.log(`Extracting year: '${r[0]}' into : ${t}`);
|
|
1494
|
+
});
|
|
1495
|
+
let i = C(r[An]);
|
|
1496
|
+
t.end != null && t.end.assign("year", i), t.start.assign("year", i), t.text += r[0];
|
|
1497
|
+
}), t;
|
|
1498
|
+
}
|
|
1499
|
+
}, Mn = class extends ot {
|
|
1500
|
+
constructor() {
|
|
1501
|
+
super();
|
|
1502
|
+
}
|
|
1503
|
+
isValid(e, t) {
|
|
1504
|
+
let n = t.text.trim();
|
|
1505
|
+
return n === e.text.trim() ? !0 : n.toLowerCase() === "may" && !e.text.substring(0, t.index).trim().match(/\b(in)$/i) ? (e.debug(() => {
|
|
1506
|
+
console.log(`Removing unlikely result: ${t}`);
|
|
1507
|
+
}), !1) : n.toLowerCase().endsWith("the second") ? (e.text.substring(t.index + t.text.length).trim().length > 0 && e.debug(() => {
|
|
1508
|
+
console.log(`Removing unlikely result: ${t}`);
|
|
1509
|
+
}), !1) : !0;
|
|
1510
|
+
}
|
|
1511
|
+
}, Nn = class {
|
|
1512
|
+
createCasualConfiguration(e = !1) {
|
|
1513
|
+
let t = this.createConfiguration(!1, e);
|
|
1514
|
+
return t.parsers.push(new en()), t.parsers.push(new nn()), t.parsers.push(new Le()), t.parsers.push(new fn()), t.parsers.push(new Sn()), t.refiners.push(new Mn()), t;
|
|
1515
|
+
}
|
|
1516
|
+
createConfiguration(e = !0, t = !1) {
|
|
1517
|
+
let n = Bt({
|
|
1518
|
+
parsers: [
|
|
1519
|
+
new yn(t),
|
|
1520
|
+
new be(e),
|
|
1521
|
+
new Ee(),
|
|
1522
|
+
new Me(t),
|
|
1523
|
+
new cn(),
|
|
1524
|
+
new qe(),
|
|
1525
|
+
new Qe(e),
|
|
1526
|
+
new tt(e),
|
|
1527
|
+
new at(e)
|
|
1528
|
+
],
|
|
1529
|
+
refiners: [new ft()]
|
|
1530
|
+
}, e);
|
|
1531
|
+
return n.parsers.unshift(new Ue(e)), n.refiners.unshift(new On()), n.refiners.unshift(new Tn()), n.refiners.unshift(new bt()), n.refiners.push(new ft()), n.refiners.push(new jn()), n.refiners.push(new ct()), n;
|
|
1532
|
+
}
|
|
1533
|
+
}, Pn = class e {
|
|
1534
|
+
parsers;
|
|
1535
|
+
refiners;
|
|
1536
|
+
defaultConfig = new Nn();
|
|
1537
|
+
constructor(e) {
|
|
1538
|
+
e ||= this.defaultConfig.createCasualConfiguration(), this.parsers = [...e.parsers], this.refiners = [...e.refiners];
|
|
1539
|
+
}
|
|
1540
|
+
clone() {
|
|
1541
|
+
return new e({
|
|
1542
|
+
parsers: [...this.parsers],
|
|
1543
|
+
refiners: [...this.refiners]
|
|
1544
|
+
});
|
|
1545
|
+
}
|
|
1546
|
+
parseDate(e, t, n) {
|
|
1547
|
+
let r = this.parse(e, t, n);
|
|
1548
|
+
return r.length > 0 ? r[0].start.date() : null;
|
|
1549
|
+
}
|
|
1550
|
+
parse(t, n, r) {
|
|
1551
|
+
let i = new Fn(t, n, r), a = [];
|
|
1552
|
+
return this.parsers.forEach((t) => {
|
|
1553
|
+
let n = e.executeParser(i, t);
|
|
1554
|
+
a = a.concat(n);
|
|
1555
|
+
}), a.sort((e, t) => e.index - t.index), this.refiners.forEach(function(e) {
|
|
1556
|
+
a = e.refine(i, a);
|
|
1557
|
+
}), a;
|
|
1558
|
+
}
|
|
1559
|
+
static executeParser(e, t) {
|
|
1560
|
+
let n = [], r = t.pattern(e), i = e.text, a = e.text, o = r.exec(a);
|
|
1561
|
+
for (; o;) {
|
|
1562
|
+
let s = o.index + i.length - a.length;
|
|
1563
|
+
o.index = s;
|
|
1564
|
+
let c = t.extract(e, o);
|
|
1565
|
+
if (!c) {
|
|
1566
|
+
a = i.substring(o.index + 1), o = r.exec(a);
|
|
1567
|
+
continue;
|
|
1568
|
+
}
|
|
1569
|
+
let l = null;
|
|
1570
|
+
c instanceof h ? l = c : c instanceof m ? (l = e.createParsingResult(o.index, o[0]), l.start = c) : l = e.createParsingResult(o.index, o[0], c);
|
|
1571
|
+
let u = l.index, d = l.text;
|
|
1572
|
+
e.debug(() => console.log(`${t.constructor.name} extracted (at index=${u}) '${d}'`)), n.push(l), a = i.substring(u + d.length), o = r.exec(a);
|
|
1573
|
+
}
|
|
1574
|
+
return n;
|
|
1575
|
+
}
|
|
1576
|
+
}, Fn = class {
|
|
1577
|
+
text;
|
|
1578
|
+
option;
|
|
1579
|
+
reference;
|
|
1580
|
+
refDate;
|
|
1581
|
+
constructor(e, t, n) {
|
|
1582
|
+
this.text = e, this.option = n ?? {}, this.reference = ee.fromInput(t, this.option.timezones), this.refDate = this.reference.instant;
|
|
1583
|
+
}
|
|
1584
|
+
createParsingComponents(e) {
|
|
1585
|
+
return e instanceof m ? e : new m(this.reference, e);
|
|
1586
|
+
}
|
|
1587
|
+
createParsingResult(e, t, n, r) {
|
|
1588
|
+
let i = typeof t == "string" ? t : this.text.substring(e, t), a = n ? this.createParsingComponents(n) : null, o = r ? this.createParsingComponents(r) : null;
|
|
1589
|
+
return new h(this.reference, e, i, a, o);
|
|
1590
|
+
}
|
|
1591
|
+
debug(e) {
|
|
1592
|
+
this.option.debug && (this.option.debug instanceof Function ? this.option.debug(e) : this.option.debug.debug(e));
|
|
1593
|
+
}
|
|
1594
|
+
}, N = {
|
|
1595
|
+
零: 0,
|
|
1596
|
+
〇: 0,
|
|
1597
|
+
一: 1,
|
|
1598
|
+
二: 2,
|
|
1599
|
+
两: 2,
|
|
1600
|
+
三: 3,
|
|
1601
|
+
四: 4,
|
|
1602
|
+
五: 5,
|
|
1603
|
+
六: 6,
|
|
1604
|
+
七: 7,
|
|
1605
|
+
八: 8,
|
|
1606
|
+
九: 9,
|
|
1607
|
+
十: 10
|
|
1608
|
+
}, P = {
|
|
1609
|
+
天: 0,
|
|
1610
|
+
日: 0,
|
|
1611
|
+
一: 1,
|
|
1612
|
+
二: 2,
|
|
1613
|
+
三: 3,
|
|
1614
|
+
四: 4,
|
|
1615
|
+
五: 5,
|
|
1616
|
+
六: 6
|
|
1617
|
+
};
|
|
1618
|
+
function F(e) {
|
|
1619
|
+
let t = 0;
|
|
1620
|
+
for (let n = 0; n < e.length; n++) {
|
|
1621
|
+
let r = e[n];
|
|
1622
|
+
r === "十" ? t = t === 0 ? N[r] : t * N[r] : t += N[r];
|
|
1623
|
+
}
|
|
1624
|
+
return t;
|
|
1625
|
+
}
|
|
1626
|
+
function In(e) {
|
|
1627
|
+
let t = "";
|
|
1628
|
+
for (let n = 0; n < e.length; n++) {
|
|
1629
|
+
let r = e[n];
|
|
1630
|
+
t += N[r];
|
|
1631
|
+
}
|
|
1632
|
+
return parseInt(t);
|
|
1633
|
+
}
|
|
1634
|
+
//#endregion
|
|
1635
|
+
//#region node_modules/.pnpm/chrono-node@2.9.1/node_modules/chrono-node/dist/esm/locales/zh/hans/parsers/ZHHansDateParser.js
|
|
1636
|
+
var Ln = 1, Rn = 2, zn = 3, Bn = class extends E {
|
|
1637
|
+
innerPattern() {
|
|
1638
|
+
return RegExp("(\\d{2,4}|[" + Object.keys(N).join("") + "]{4}|[" + Object.keys(N).join("") + "]{2})?(?:\\s*)(?:年)?(?:[\\s|,|,]*)(\\d{1,2}|[" + Object.keys(N).join("") + "]{1,3})(?:\\s*)(?:月)(?:\\s*)(\\d{1,2}|[" + Object.keys(N).join("") + "]{1,3})?(?:\\s*)(?:日|号)?");
|
|
1639
|
+
}
|
|
1640
|
+
innerExtract(e, t) {
|
|
1641
|
+
let n = e.createParsingResult(t.index, t[0]), r = parseInt(t[Rn]);
|
|
1642
|
+
if (isNaN(r) && (r = F(t[Rn])), n.start.assign("month", r), t[zn]) {
|
|
1643
|
+
let e = parseInt(t[zn]);
|
|
1644
|
+
isNaN(e) && (e = F(t[zn])), n.start.assign("day", e);
|
|
1645
|
+
} else n.start.imply("day", e.refDate.getDate());
|
|
1646
|
+
if (t[Ln]) {
|
|
1647
|
+
let e = parseInt(t[Ln]);
|
|
1648
|
+
isNaN(e) && (e = In(t[Ln])), n.start.assign("year", e);
|
|
1649
|
+
} else n.start.imply("year", e.refDate.getFullYear());
|
|
1650
|
+
return n;
|
|
1651
|
+
}
|
|
1652
|
+
}, Vn = RegExp("(\\d+|[" + Object.keys(N).join("") + "]+|半|几)(?:\\s*)(?:个)?(秒(?:钟)?|分钟|小时|钟|日|天|星期|礼拜|月|年)(?:(?:之|过)?后|(?:之)?内)", "i"), Hn = 1, Un = 2, Wn = class extends E {
|
|
1653
|
+
innerPattern() {
|
|
1654
|
+
return Vn;
|
|
1655
|
+
}
|
|
1656
|
+
innerExtract(e, t) {
|
|
1657
|
+
let n = e.createParsingResult(t.index, t[0]), r = parseInt(t[Hn]);
|
|
1658
|
+
if (isNaN(r) && (r = F(t[Hn])), isNaN(r)) {
|
|
1659
|
+
let e = t[Hn];
|
|
1660
|
+
if (e === "几") r = 3;
|
|
1661
|
+
else if (e === "半") r = .5;
|
|
1662
|
+
else return null;
|
|
1663
|
+
}
|
|
1664
|
+
let i = {}, a = t[Un][0];
|
|
1665
|
+
if (a.match(/[日天星礼月年]/)) {
|
|
1666
|
+
a == "日" || a == "天" ? i.day = r : a == "星" || a == "礼" ? i.week = r : a == "月" ? i.month = r : a == "年" && (i.year = r);
|
|
1667
|
+
let t = f(e.refDate, i);
|
|
1668
|
+
return n.start.assign("year", t.getFullYear()), n.start.assign("month", t.getMonth() + 1), n.start.assign("day", t.getDate()), n;
|
|
1669
|
+
}
|
|
1670
|
+
a == "秒" ? i.second = r : a == "分" ? i.minute = r : (a == "小" || a == "钟") && (i.hour = r);
|
|
1671
|
+
let o = f(e.refDate, i);
|
|
1672
|
+
return n.start.imply("year", o.getFullYear()), n.start.imply("month", o.getMonth() + 1), n.start.imply("day", o.getDate()), n.start.assign("hour", o.getHours()), n.start.assign("minute", o.getMinutes()), n.start.assign("second", o.getSeconds()), n;
|
|
1673
|
+
}
|
|
1674
|
+
}, Gn = RegExp("(?<prefix>上|下|这)(?:个)?(?:星期|礼拜|周)(?<weekday>" + Object.keys(P).join("|") + ")"), Kn = class extends E {
|
|
1675
|
+
innerPattern() {
|
|
1676
|
+
return Gn;
|
|
1677
|
+
}
|
|
1678
|
+
innerExtract(e, t) {
|
|
1679
|
+
let n = e.createParsingResult(t.index, t[0]), r = P[t.groups.weekday];
|
|
1680
|
+
if (r === void 0) return null;
|
|
1681
|
+
let i = null, a = t.groups.prefix;
|
|
1682
|
+
a == "上" ? i = "last" : a == "下" ? i = "next" : a == "这" && (i = "this");
|
|
1683
|
+
let o = new Date(e.refDate.getTime()), s = !1, c = o.getDay();
|
|
1684
|
+
if (i == "last" || i == "past") o.setDate(o.getDate() + (r - 7 - c)), s = !0;
|
|
1685
|
+
else if (i == "next") o.setDate(o.getDate() + (r + 7 - c)), s = !0;
|
|
1686
|
+
else if (i == "this") o.setDate(o.getDate() + (r - c));
|
|
1687
|
+
else {
|
|
1688
|
+
let e = r - c;
|
|
1689
|
+
Math.abs(e - 7) < Math.abs(e) && (e -= 7), Math.abs(e + 7) < Math.abs(e) && (e += 7), o.setDate(o.getDate() + e);
|
|
1690
|
+
}
|
|
1691
|
+
return n.start.assign("weekday", r), s ? (n.start.assign("day", o.getDate()), n.start.assign("month", o.getMonth() + 1), n.start.assign("year", o.getFullYear())) : (n.start.imply("day", o.getDate()), n.start.imply("month", o.getMonth() + 1), n.start.imply("year", o.getFullYear())), n;
|
|
1692
|
+
}
|
|
1693
|
+
}, qn = RegExp("(?:从|自)?(?:(今|明|前|大前|后|大后|昨)(早|朝|晚)|(上(?:午)|早(?:上)|下(?:午)|晚(?:上)|夜(?:晚)?|中(?:午)|凌(?:晨))|(今|明|前|大前|后|大后|昨)(?:日|天)(?:[\\s,,]*)(?:(上(?:午)|早(?:上)|下(?:午)|晚(?:上)|夜(?:晚)?|中(?:午)|凌(?:晨)))?)?(?:[\\s,,]*)(?:(\\d+|[" + Object.keys(N).join("") + "]+)(?:\\s*)(?:点|时|:|:)(?:\\s*)(\\d+|半|正|整|[" + Object.keys(N).join("") + "]+)?(?:\\s*)(?:分|:|:)?(?:\\s*)(\\d+|[" + Object.keys(N).join("") + "]+)?(?:\\s*)(?:秒)?)(?:\\s*(A.M.|P.M.|AM?|PM?))?", "i"), Jn = RegExp("(?:^\\s*(?:到|至|\\-|\\–|\\~|\\〜)\\s*)(?:(今|明|前|大前|后|大后|昨)(早|朝|晚)|(上(?:午)|早(?:上)|下(?:午)|晚(?:上)|夜(?:晚)?|中(?:午)|凌(?:晨))|(今|明|前|大前|后|大后|昨)(?:日|天)(?:[\\s,,]*)(?:(上(?:午)|早(?:上)|下(?:午)|晚(?:上)|夜(?:晚)?|中(?:午)|凌(?:晨)))?)?(?:[\\s,,]*)(?:(\\d+|[" + Object.keys(N).join("") + "]+)(?:\\s*)(?:点|时|:|:)(?:\\s*)(\\d+|半|正|整|[" + Object.keys(N).join("") + "]+)?(?:\\s*)(?:分|:|:)?(?:\\s*)(\\d+|[" + Object.keys(N).join("") + "]+)?(?:\\s*)(?:秒)?)(?:\\s*(A.M.|P.M.|AM?|PM?))?", "i"), I = 1, L = 2, R = 3, z = 4, B = 5, V = 6, H = 7, U = 8, W = 9, Yn = class extends E {
|
|
1694
|
+
patternLeftBoundary() {
|
|
1695
|
+
return "()";
|
|
1696
|
+
}
|
|
1697
|
+
innerPattern() {
|
|
1698
|
+
return qn;
|
|
1699
|
+
}
|
|
1700
|
+
innerExtract(e, t) {
|
|
1701
|
+
if (t.index > 0 && e.text[t.index - 1].match(/\w/)) return null;
|
|
1702
|
+
let n = e.createParsingResult(t.index, t[0]), r = new Date(e.reference.instant.getTime());
|
|
1703
|
+
if (t[I]) {
|
|
1704
|
+
let i = t[I];
|
|
1705
|
+
i == "明" ? e.reference.instant.getHours() > 1 && r.setDate(r.getDate() + 1) : i == "昨" ? r.setDate(r.getDate() - 1) : i == "前" ? r.setDate(r.getDate() - 2) : i == "大前" ? r.setDate(r.getDate() - 3) : i == "后" ? r.setDate(r.getDate() + 2) : i == "大后" && r.setDate(r.getDate() + 3), n.start.assign("day", r.getDate()), n.start.assign("month", r.getMonth() + 1), n.start.assign("year", r.getFullYear());
|
|
1706
|
+
} else if (t[z]) {
|
|
1707
|
+
let e = t[z];
|
|
1708
|
+
e == "明" ? r.setDate(r.getDate() + 1) : e == "昨" ? r.setDate(r.getDate() - 1) : e == "前" ? r.setDate(r.getDate() - 2) : e == "大前" ? r.setDate(r.getDate() - 3) : e == "后" ? r.setDate(r.getDate() + 2) : e == "大后" && r.setDate(r.getDate() + 3), n.start.assign("day", r.getDate()), n.start.assign("month", r.getMonth() + 1), n.start.assign("year", r.getFullYear());
|
|
1709
|
+
} else n.start.imply("day", r.getDate()), n.start.imply("month", r.getMonth() + 1), n.start.imply("year", r.getFullYear());
|
|
1710
|
+
let i = 0, a = 0, o = -1;
|
|
1711
|
+
if (t[U]) {
|
|
1712
|
+
let e = parseInt(t[U]);
|
|
1713
|
+
if (isNaN(e) && (e = F(t[U])), e >= 60) return null;
|
|
1714
|
+
n.start.assign("second", e);
|
|
1715
|
+
}
|
|
1716
|
+
if (i = parseInt(t[V]), isNaN(i) && (i = F(t[V])), t[H] ? t[H] == "半" ? a = 30 : t[H] == "正" || t[H] == "整" ? a = 0 : (a = parseInt(t[H]), isNaN(a) && (a = F(t[H]))) : i > 100 && (a = i % 100, i = Math.floor(i / 100)), a >= 60 || i > 24) return null;
|
|
1717
|
+
if (i >= 12 && (o = 1), t[W]) {
|
|
1718
|
+
if (i > 12) return null;
|
|
1719
|
+
let e = t[W][0].toLowerCase();
|
|
1720
|
+
e == "a" && (o = 0, i == 12 && (i = 0)), e == "p" && (o = 1, i != 12 && (i += 12));
|
|
1721
|
+
} else if (t[L]) {
|
|
1722
|
+
let e = t[L][0];
|
|
1723
|
+
e == "早" ? (o = 0, i == 12 && (i = 0)) : e == "晚" && (o = 1, i != 12 && (i += 12));
|
|
1724
|
+
} else if (t[R]) {
|
|
1725
|
+
let e = t[R][0];
|
|
1726
|
+
e == "上" || e == "早" || e == "凌" ? (o = 0, i == 12 && (i = 0)) : (e == "下" || e == "晚") && (o = 1, i != 12 && (i += 12));
|
|
1727
|
+
} else if (t[B]) {
|
|
1728
|
+
let e = t[B][0];
|
|
1729
|
+
e == "上" || e == "早" || e == "凌" ? (o = 0, i == 12 && (i = 0)) : (e == "下" || e == "晚") && (o = 1, i != 12 && (i += 12));
|
|
1730
|
+
}
|
|
1731
|
+
n.start.assign("hour", i), n.start.assign("minute", a), o >= 0 ? n.start.assign("meridiem", o) : i < 12 ? n.start.imply("meridiem", 0) : n.start.imply("meridiem", 1);
|
|
1732
|
+
let s = Jn.exec(e.text.substring(n.index + n.text.length));
|
|
1733
|
+
if (!s) return n.text.match(/^\d+$/) ? null : n;
|
|
1734
|
+
let c = new Date(r.getTime());
|
|
1735
|
+
if ((s[I] || s[z]) && (c = new Date(e.reference.instant.getTime())), n.end = e.createParsingComponents(), s[I]) {
|
|
1736
|
+
let t = s[I];
|
|
1737
|
+
t == "明" ? e.reference.instant.getHours() > 1 && c.setDate(c.getDate() + 1) : t == "昨" ? c.setDate(c.getDate() - 1) : t == "前" ? c.setDate(c.getDate() - 2) : t == "大前" ? c.setDate(c.getDate() - 3) : t == "后" ? c.setDate(c.getDate() + 2) : t == "大后" && c.setDate(c.getDate() + 3), n.end.assign("day", c.getDate()), n.end.assign("month", c.getMonth() + 1), n.end.assign("year", c.getFullYear());
|
|
1738
|
+
} else if (s[z]) {
|
|
1739
|
+
let e = s[z];
|
|
1740
|
+
e == "明" ? c.setDate(c.getDate() + 1) : e == "昨" ? c.setDate(c.getDate() - 1) : e == "前" ? c.setDate(c.getDate() - 2) : e == "大前" ? c.setDate(c.getDate() - 3) : e == "后" ? c.setDate(c.getDate() + 2) : e == "大后" && c.setDate(c.getDate() + 3), n.end.assign("day", c.getDate()), n.end.assign("month", c.getMonth() + 1), n.end.assign("year", c.getFullYear());
|
|
1741
|
+
} else n.end.imply("day", c.getDate()), n.end.imply("month", c.getMonth() + 1), n.end.imply("year", c.getFullYear());
|
|
1742
|
+
if (i = 0, a = 0, o = -1, s[U]) {
|
|
1743
|
+
let e = parseInt(s[U]);
|
|
1744
|
+
if (isNaN(e) && (e = F(s[U])), e >= 60) return null;
|
|
1745
|
+
n.end.assign("second", e);
|
|
1746
|
+
}
|
|
1747
|
+
if (i = parseInt(s[V]), isNaN(i) && (i = F(s[V])), s[H] ? s[H] == "半" ? a = 30 : s[H] == "正" || s[H] == "整" ? a = 0 : (a = parseInt(s[H]), isNaN(a) && (a = F(s[H]))) : i > 100 && (a = i % 100, i = Math.floor(i / 100)), a >= 60 || i > 24) return null;
|
|
1748
|
+
if (i >= 12 && (o = 1), s[W]) {
|
|
1749
|
+
if (i > 12) return null;
|
|
1750
|
+
let e = s[W][0].toLowerCase();
|
|
1751
|
+
e == "a" && (o = 0, i == 12 && (i = 0)), e == "p" && (o = 1, i != 12 && (i += 12)), n.start.isCertain("meridiem") || (o == 0 ? (n.start.imply("meridiem", 0), n.start.get("hour") == 12 && n.start.assign("hour", 0)) : (n.start.imply("meridiem", 1), n.start.get("hour") != 12 && n.start.assign("hour", n.start.get("hour") + 12)));
|
|
1752
|
+
} else if (s[L]) {
|
|
1753
|
+
let e = s[L][0];
|
|
1754
|
+
e == "早" ? (o = 0, i == 12 && (i = 0)) : e == "晚" && (o = 1, i != 12 && (i += 12));
|
|
1755
|
+
} else if (s[R]) {
|
|
1756
|
+
let e = s[R][0];
|
|
1757
|
+
e == "上" || e == "早" || e == "凌" ? (o = 0, i == 12 && (i = 0)) : (e == "下" || e == "晚") && (o = 1, i != 12 && (i += 12));
|
|
1758
|
+
} else if (s[B]) {
|
|
1759
|
+
let e = s[B][0];
|
|
1760
|
+
e == "上" || e == "早" || e == "凌" ? (o = 0, i == 12 && (i = 0)) : (e == "下" || e == "晚") && (o = 1, i != 12 && (i += 12));
|
|
1761
|
+
}
|
|
1762
|
+
return n.text += s[0], n.end.assign("hour", i), n.end.assign("minute", a), o >= 0 ? n.end.assign("meridiem", o) : n.start.isCertain("meridiem") && n.start.get("meridiem") == 1 && n.start.get("hour") > i ? n.end.imply("meridiem", 0) : i > 12 && n.end.imply("meridiem", 1), n.end.date().getTime() < n.start.date().getTime() && n.end.imply("day", n.end.get("day") + 1), n;
|
|
1763
|
+
}
|
|
1764
|
+
}, Xn = RegExp("(?:星期|礼拜|周)(?<weekday>" + Object.keys(P).join("|") + ")"), Zn = class extends E {
|
|
1765
|
+
innerPattern() {
|
|
1766
|
+
return Xn;
|
|
1767
|
+
}
|
|
1768
|
+
innerExtract(e, t) {
|
|
1769
|
+
let n = e.createParsingResult(t.index, t[0]), r = P[t.groups.weekday];
|
|
1770
|
+
if (r === void 0) return null;
|
|
1771
|
+
let i = new Date(e.refDate.getTime()), a = r - i.getDay();
|
|
1772
|
+
return Math.abs(a - 7) < Math.abs(a) && (a -= 7), Math.abs(a + 7) < Math.abs(a) && (a += 7), i.setDate(i.getDate() + a), n.start.assign("weekday", r), n.start.imply("day", i.getDate()), n.start.imply("month", i.getMonth() + 1), n.start.imply("year", i.getFullYear()), n;
|
|
1773
|
+
}
|
|
1774
|
+
}, Qn = 1, $n = 2, er = 3, tr = 4, nr = 5, rr = 6, ir = class extends E {
|
|
1775
|
+
innerPattern(e) {
|
|
1776
|
+
return /* @__PURE__ */ RegExp("(而家|立(?:刻|即)|即刻)|(今|明|前|大前|後|大後|聽|昨|尋|琴)(早|朝|晚)|(上(?:午|晝)|朝(?:早)|早(?:上)|下(?:午|晝)|晏(?:晝)|晚(?:上)|夜(?:晚)?|中(?:午)|凌(?:晨))|(今|明|前|大前|後|大後|聽|昨|尋|琴)(?:日|天)(?:[\\s|,|,]*)(?:(上(?:午|晝)|朝(?:早)|早(?:上)|下(?:午|晝)|晏(?:晝)|晚(?:上)|夜(?:晚)?|中(?:午)|凌(?:晨)))?", "i");
|
|
1777
|
+
}
|
|
1778
|
+
innerExtract(e, t) {
|
|
1779
|
+
let n = t.index, r = e.createParsingResult(n, t[0]), i = e.refDate, a = new Date(i.getTime());
|
|
1780
|
+
if (t[Qn]) r.start.imply("hour", i.getHours()), r.start.imply("minute", i.getMinutes()), r.start.imply("second", i.getSeconds()), r.start.imply("millisecond", i.getMilliseconds());
|
|
1781
|
+
else if (t[$n]) {
|
|
1782
|
+
let e = t[$n], n = t[er];
|
|
1783
|
+
e == "明" || e == "聽" ? i.getHours() > 1 && a.setDate(a.getDate() + 1) : e == "昨" || e == "尋" || e == "琴" ? a.setDate(a.getDate() - 1) : e == "前" ? a.setDate(a.getDate() - 2) : e == "大前" ? a.setDate(a.getDate() - 3) : e == "後" ? a.setDate(a.getDate() + 2) : e == "大後" && a.setDate(a.getDate() + 3), n == "早" || n == "朝" ? r.start.imply("hour", 6) : n == "晚" && (r.start.imply("hour", 22), r.start.imply("meridiem", 1));
|
|
1784
|
+
} else if (t[tr]) {
|
|
1785
|
+
let e = t[tr][0];
|
|
1786
|
+
e == "早" || e == "朝" || e == "上" ? r.start.imply("hour", 6) : e == "下" || e == "晏" ? (r.start.imply("hour", 15), r.start.imply("meridiem", 1)) : e == "中" ? (r.start.imply("hour", 12), r.start.imply("meridiem", 1)) : e == "夜" || e == "晚" ? (r.start.imply("hour", 22), r.start.imply("meridiem", 1)) : e == "凌" && r.start.imply("hour", 0);
|
|
1787
|
+
} else if (t[nr]) {
|
|
1788
|
+
let e = t[nr];
|
|
1789
|
+
e == "明" || e == "聽" ? i.getHours() > 1 && a.setDate(a.getDate() + 1) : e == "昨" || e == "尋" || e == "琴" ? a.setDate(a.getDate() - 1) : e == "前" ? a.setDate(a.getDate() - 2) : e == "大前" ? a.setDate(a.getDate() - 3) : e == "後" ? a.setDate(a.getDate() + 2) : e == "大後" && a.setDate(a.getDate() + 3);
|
|
1790
|
+
let n = t[rr];
|
|
1791
|
+
if (n) {
|
|
1792
|
+
let e = n[0];
|
|
1793
|
+
e == "早" || e == "朝" || e == "上" ? r.start.imply("hour", 6) : e == "下" || e == "晏" ? (r.start.imply("hour", 15), r.start.imply("meridiem", 1)) : e == "中" ? (r.start.imply("hour", 12), r.start.imply("meridiem", 1)) : e == "夜" || e == "晚" ? (r.start.imply("hour", 22), r.start.imply("meridiem", 1)) : e == "凌" && r.start.imply("hour", 0);
|
|
1794
|
+
}
|
|
1795
|
+
}
|
|
1796
|
+
return r.start.assign("day", a.getDate()), r.start.assign("month", a.getMonth() + 1), r.start.assign("year", a.getFullYear()), r;
|
|
1797
|
+
}
|
|
1798
|
+
}, G = {
|
|
1799
|
+
零: 0,
|
|
1800
|
+
一: 1,
|
|
1801
|
+
二: 2,
|
|
1802
|
+
兩: 2,
|
|
1803
|
+
三: 3,
|
|
1804
|
+
四: 4,
|
|
1805
|
+
五: 5,
|
|
1806
|
+
六: 6,
|
|
1807
|
+
七: 7,
|
|
1808
|
+
八: 8,
|
|
1809
|
+
九: 9,
|
|
1810
|
+
十: 10,
|
|
1811
|
+
廿: 20,
|
|
1812
|
+
卅: 30
|
|
1813
|
+
}, K = {
|
|
1814
|
+
天: 0,
|
|
1815
|
+
日: 0,
|
|
1816
|
+
一: 1,
|
|
1817
|
+
二: 2,
|
|
1818
|
+
三: 3,
|
|
1819
|
+
四: 4,
|
|
1820
|
+
五: 5,
|
|
1821
|
+
六: 6
|
|
1822
|
+
};
|
|
1823
|
+
function q(e) {
|
|
1824
|
+
let t = 0;
|
|
1825
|
+
for (let n = 0; n < e.length; n++) {
|
|
1826
|
+
let r = e[n];
|
|
1827
|
+
r === "十" ? t = t === 0 ? G[r] : t * G[r] : t += G[r];
|
|
1828
|
+
}
|
|
1829
|
+
return t;
|
|
1830
|
+
}
|
|
1831
|
+
function ar(e) {
|
|
1832
|
+
let t = "";
|
|
1833
|
+
for (let n = 0; n < e.length; n++) {
|
|
1834
|
+
let r = e[n];
|
|
1835
|
+
t += G[r];
|
|
1836
|
+
}
|
|
1837
|
+
return parseInt(t);
|
|
1838
|
+
}
|
|
1839
|
+
//#endregion
|
|
1840
|
+
//#region node_modules/.pnpm/chrono-node@2.9.1/node_modules/chrono-node/dist/esm/locales/zh/hant/parsers/ZHHantDateParser.js
|
|
1841
|
+
var or = 1, sr = 2, cr = 3, lr = class extends E {
|
|
1842
|
+
innerPattern() {
|
|
1843
|
+
return RegExp("(\\d{2,4}|[" + Object.keys(G).join("") + "]{4}|[" + Object.keys(G).join("") + "]{2})?(?:\\s*)(?:年)?(?:[\\s|,|,]*)(\\d{1,2}|[" + Object.keys(G).join("") + "]{1,2})(?:\\s*)(?:月)(?:\\s*)(\\d{1,2}|[" + Object.keys(G).join("") + "]{1,2})?(?:\\s*)(?:日|號)?");
|
|
1844
|
+
}
|
|
1845
|
+
innerExtract(e, t) {
|
|
1846
|
+
let n = e.createParsingResult(t.index, t[0]), r = parseInt(t[sr]);
|
|
1847
|
+
if (isNaN(r) && (r = q(t[sr])), n.start.assign("month", r), t[cr]) {
|
|
1848
|
+
let e = parseInt(t[cr]);
|
|
1849
|
+
isNaN(e) && (e = q(t[cr])), n.start.assign("day", e);
|
|
1850
|
+
} else n.start.imply("day", e.refDate.getDate());
|
|
1851
|
+
if (t[or]) {
|
|
1852
|
+
let e = parseInt(t[or]);
|
|
1853
|
+
isNaN(e) && (e = ar(t[or])), n.start.assign("year", e);
|
|
1854
|
+
} else n.start.imply("year", e.refDate.getFullYear());
|
|
1855
|
+
return n;
|
|
1856
|
+
}
|
|
1857
|
+
}, ur = RegExp("(\\d+|[" + Object.keys(G).join("") + "]+|半|幾)(?:\\s*)(?:個)?(秒(?:鐘)?|分鐘|小時|鐘|日|天|星期|禮拜|月|年)(?:(?:之|過)?後|(?:之)?內)", "i"), dr = 1, fr = 2, pr = class extends E {
|
|
1858
|
+
innerPattern() {
|
|
1859
|
+
return ur;
|
|
1860
|
+
}
|
|
1861
|
+
innerExtract(e, t) {
|
|
1862
|
+
let n = e.createParsingResult(t.index, t[0]), r = parseInt(t[dr]);
|
|
1863
|
+
if (isNaN(r) && (r = q(t[dr])), isNaN(r)) {
|
|
1864
|
+
let e = t[dr];
|
|
1865
|
+
if (e === "幾") r = 3;
|
|
1866
|
+
else if (e === "半") r = .5;
|
|
1867
|
+
else return null;
|
|
1868
|
+
}
|
|
1869
|
+
let i = {}, a = t[fr][0];
|
|
1870
|
+
if (a.match(/[日天星禮月年]/)) {
|
|
1871
|
+
a == "日" || a == "天" ? i.day = r : a == "星" || a == "禮" ? i.week = r : a == "月" ? i.month = r : a == "年" && (i.year = r);
|
|
1872
|
+
let t = f(e.refDate, i);
|
|
1873
|
+
return n.start.assign("year", t.getFullYear()), n.start.assign("month", t.getMonth() + 1), n.start.assign("day", t.getDate()), n;
|
|
1874
|
+
}
|
|
1875
|
+
a == "秒" ? i.second = r : a == "分" ? i.minute = r : (a == "小" || a == "鐘") && (i.hour = r);
|
|
1876
|
+
let o = f(e.refDate, i);
|
|
1877
|
+
return n.start.imply("year", o.getFullYear()), n.start.imply("month", o.getMonth() + 1), n.start.imply("day", o.getDate()), n.start.assign("hour", o.getHours()), n.start.assign("minute", o.getMinutes()), n.start.assign("second", o.getSeconds()), n;
|
|
1878
|
+
}
|
|
1879
|
+
}, mr = RegExp("(?<prefix>上|今|下|這|呢)(?:個)?(?:星期|禮拜|週)(?<weekday>" + Object.keys(K).join("|") + ")"), hr = class extends E {
|
|
1880
|
+
innerPattern() {
|
|
1881
|
+
return mr;
|
|
1882
|
+
}
|
|
1883
|
+
innerExtract(e, t) {
|
|
1884
|
+
let n = e.createParsingResult(t.index, t[0]), r = K[t.groups.weekday];
|
|
1885
|
+
if (r === void 0) return null;
|
|
1886
|
+
let i = null, a = t.groups.prefix;
|
|
1887
|
+
a == "上" ? i = "last" : a == "下" ? i = "next" : (a == "今" || a == "這" || a == "呢") && (i = "this");
|
|
1888
|
+
let o = new Date(e.refDate.getTime()), s = !1, c = o.getDay();
|
|
1889
|
+
if (i == "last" || i == "past") o.setDate(o.getDate() + (r - 7 - c)), s = !0;
|
|
1890
|
+
else if (i == "next") o.setDate(o.getDate() + (r + 7 - c)), s = !0;
|
|
1891
|
+
else if (i == "this") o.setDate(o.getDate() + (r - c));
|
|
1892
|
+
else {
|
|
1893
|
+
let e = r - c;
|
|
1894
|
+
Math.abs(e - 7) < Math.abs(e) && (e -= 7), Math.abs(e + 7) < Math.abs(e) && (e += 7), o.setDate(o.getDate() + e);
|
|
1895
|
+
}
|
|
1896
|
+
return n.start.assign("weekday", r), s ? (n.start.assign("day", o.getDate()), n.start.assign("month", o.getMonth() + 1), n.start.assign("year", o.getFullYear())) : (n.start.imply("day", o.getDate()), n.start.imply("month", o.getMonth() + 1), n.start.imply("year", o.getFullYear())), n;
|
|
1897
|
+
}
|
|
1898
|
+
}, gr = RegExp("(?:由|從|自)?(?:(今|明|前|大前|後|大後|聽|昨|尋|琴)(早|朝|晚)|(上(?:午|晝)|朝(?:早)|早(?:上)|下(?:午|晝)|晏(?:晝)|晚(?:上)|夜(?:晚)?|中(?:午)|凌(?:晨))|(今|明|前|大前|後|大後|聽|昨|尋|琴)(?:日|天)(?:[\\s,,]*)(?:(上(?:午|晝)|朝(?:早)|早(?:上)|下(?:午|晝)|晏(?:晝)|晚(?:上)|夜(?:晚)?|中(?:午)|凌(?:晨)))?)?(?:[\\s,,]*)(?:(\\d+|[" + Object.keys(G).join("") + "]+)(?:\\s*)(?:點|時|:|:)(?:\\s*)(\\d+|半|正|整|[" + Object.keys(G).join("") + "]+)?(?:\\s*)(?:分|:|:)?(?:\\s*)(\\d+|[" + Object.keys(G).join("") + "]+)?(?:\\s*)(?:秒)?)(?:\\s*(A.M.|P.M.|AM?|PM?))?", "i"), _r = RegExp("(?:^\\s*(?:到|至|\\-|\\–|\\~|\\〜)\\s*)(?:(今|明|前|大前|後|大後|聽|昨|尋|琴)(早|朝|晚)|(上(?:午|晝)|朝(?:早)|早(?:上)|下(?:午|晝)|晏(?:晝)|晚(?:上)|夜(?:晚)?|中(?:午)|凌(?:晨))|(今|明|前|大前|後|大後|聽|昨|尋|琴)(?:日|天)(?:[\\s,,]*)(?:(上(?:午|晝)|朝(?:早)|早(?:上)|下(?:午|晝)|晏(?:晝)|晚(?:上)|夜(?:晚)?|中(?:午)|凌(?:晨)))?)?(?:[\\s,,]*)(?:(\\d+|[" + Object.keys(G).join("") + "]+)(?:\\s*)(?:點|時|:|:)(?:\\s*)(\\d+|半|正|整|[" + Object.keys(G).join("") + "]+)?(?:\\s*)(?:分|:|:)?(?:\\s*)(\\d+|[" + Object.keys(G).join("") + "]+)?(?:\\s*)(?:秒)?)(?:\\s*(A.M.|P.M.|AM?|PM?))?", "i"), J = 1, vr = 2, Y = 3, X = 4, yr = 5, br = 6, Z = 7, Q = 8, $ = 9, xr = class extends E {
|
|
1899
|
+
patternLeftBoundary() {
|
|
1900
|
+
return "()";
|
|
1901
|
+
}
|
|
1902
|
+
innerPattern() {
|
|
1903
|
+
return gr;
|
|
1904
|
+
}
|
|
1905
|
+
innerExtract(e, t) {
|
|
1906
|
+
if (t.index > 0 && e.text[t.index - 1].match(/\w/)) return null;
|
|
1907
|
+
let n = e.createParsingResult(t.index, t[0]), r = new Date(e.reference.instant.getTime());
|
|
1908
|
+
if (t[J]) {
|
|
1909
|
+
let i = t[J];
|
|
1910
|
+
i == "明" || i == "聽" ? e.refDate.getHours() > 1 && r.setDate(r.getDate() + 1) : i == "昨" || i == "尋" || i == "琴" ? r.setDate(r.getDate() - 1) : i == "前" ? r.setDate(r.getDate() - 2) : i == "大前" ? r.setDate(r.getDate() - 3) : i == "後" ? r.setDate(r.getDate() + 2) : i == "大後" && r.setDate(r.getDate() + 3), n.start.assign("day", r.getDate()), n.start.assign("month", r.getMonth() + 1), n.start.assign("year", r.getFullYear());
|
|
1911
|
+
} else if (t[X]) {
|
|
1912
|
+
let e = t[X];
|
|
1913
|
+
e == "明" || e == "聽" ? r.setDate(r.getDate() + 1) : e == "昨" || e == "尋" || e == "琴" ? r.setDate(r.getDate() - 1) : e == "前" ? r.setDate(r.getDate() - 2) : e == "大前" ? r.setDate(r.getDate() - 3) : e == "後" ? r.setDate(r.getDate() + 2) : e == "大後" && r.setDate(r.getDate() + 3), n.start.assign("day", r.getDate()), n.start.assign("month", r.getMonth() + 1), n.start.assign("year", r.getFullYear());
|
|
1914
|
+
} else n.start.imply("day", r.getDate()), n.start.imply("month", r.getMonth() + 1), n.start.imply("year", r.getFullYear());
|
|
1915
|
+
let i = 0, a = 0, o = -1;
|
|
1916
|
+
if (t[Q]) {
|
|
1917
|
+
var s = parseInt(t[Q]);
|
|
1918
|
+
if (isNaN(s) && (s = q(t[Q])), s >= 60) return null;
|
|
1919
|
+
n.start.assign("second", s);
|
|
1920
|
+
}
|
|
1921
|
+
if (i = parseInt(t[br]), isNaN(i) && (i = q(t[br])), t[Z] ? t[Z] == "半" ? a = 30 : t[Z] == "正" || t[Z] == "整" ? a = 0 : (a = parseInt(t[Z]), isNaN(a) && (a = q(t[Z]))) : i > 100 && (a = i % 100, i = Math.floor(i / 100)), a >= 60 || i > 24) return null;
|
|
1922
|
+
if (i >= 12 && (o = 1), t[$]) {
|
|
1923
|
+
if (i > 12) return null;
|
|
1924
|
+
var c = t[$][0].toLowerCase();
|
|
1925
|
+
c == "a" && (o = 0, i == 12 && (i = 0)), c == "p" && (o = 1, i != 12 && (i += 12));
|
|
1926
|
+
} else if (t[vr]) {
|
|
1927
|
+
var l = t[vr][0];
|
|
1928
|
+
l == "朝" || l == "早" ? (o = 0, i == 12 && (i = 0)) : l == "晚" && (o = 1, i != 12 && (i += 12));
|
|
1929
|
+
} else if (t[Y]) {
|
|
1930
|
+
var u = t[Y][0];
|
|
1931
|
+
u == "上" || u == "朝" || u == "早" || u == "凌" ? (o = 0, i == 12 && (i = 0)) : (u == "下" || u == "晏" || u == "晚") && (o = 1, i != 12 && (i += 12));
|
|
1932
|
+
} else if (t[yr]) {
|
|
1933
|
+
var d = t[yr][0];
|
|
1934
|
+
d == "上" || d == "朝" || d == "早" || d == "凌" ? (o = 0, i == 12 && (i = 0)) : (d == "下" || d == "晏" || d == "晚") && (o = 1, i != 12 && (i += 12));
|
|
1935
|
+
}
|
|
1936
|
+
n.start.assign("hour", i), n.start.assign("minute", a), o >= 0 ? n.start.assign("meridiem", o) : i < 12 ? n.start.imply("meridiem", 0) : n.start.imply("meridiem", 1);
|
|
1937
|
+
let f = _r.exec(e.text.substring(n.index + n.text.length));
|
|
1938
|
+
if (!f) return n.text.match(/^\d+$/) ? null : n;
|
|
1939
|
+
let p = new Date(r.getTime());
|
|
1940
|
+
if ((f[J] || f[X]) && (p = new Date(e.reference.instant.getTime())), n.end = e.createParsingComponents(), f[J]) {
|
|
1941
|
+
let t = f[J];
|
|
1942
|
+
t == "明" || t == "聽" ? e.refDate.getHours() > 1 && p.setDate(p.getDate() + 1) : t == "昨" || t == "尋" || t == "琴" ? p.setDate(p.getDate() - 1) : t == "前" ? p.setDate(p.getDate() - 2) : t == "大前" ? p.setDate(p.getDate() - 3) : t == "後" ? p.setDate(p.getDate() + 2) : t == "大後" && p.setDate(p.getDate() + 3), n.end.assign("day", p.getDate()), n.end.assign("month", p.getMonth() + 1), n.end.assign("year", p.getFullYear());
|
|
1943
|
+
} else if (f[X]) {
|
|
1944
|
+
let e = f[X];
|
|
1945
|
+
e == "明" || e == "聽" ? p.setDate(p.getDate() + 1) : e == "昨" || e == "尋" || e == "琴" ? p.setDate(p.getDate() - 1) : e == "前" ? p.setDate(p.getDate() - 2) : e == "大前" ? p.setDate(p.getDate() - 3) : e == "後" ? p.setDate(p.getDate() + 2) : e == "大後" && p.setDate(p.getDate() + 3), n.end.assign("day", p.getDate()), n.end.assign("month", p.getMonth() + 1), n.end.assign("year", p.getFullYear());
|
|
1946
|
+
} else n.end.imply("day", p.getDate()), n.end.imply("month", p.getMonth() + 1), n.end.imply("year", p.getFullYear());
|
|
1947
|
+
if (i = 0, a = 0, o = -1, f[Q]) {
|
|
1948
|
+
let e = parseInt(f[Q]);
|
|
1949
|
+
if (isNaN(e) && (e = q(f[Q])), e >= 60) return null;
|
|
1950
|
+
n.end.assign("second", e);
|
|
1951
|
+
}
|
|
1952
|
+
if (i = parseInt(f[br]), isNaN(i) && (i = q(f[br])), f[Z] ? f[Z] == "半" ? a = 30 : f[Z] == "正" || f[Z] == "整" ? a = 0 : (a = parseInt(f[Z]), isNaN(a) && (a = q(f[Z]))) : i > 100 && (a = i % 100, i = Math.floor(i / 100)), a >= 60 || i > 24) return null;
|
|
1953
|
+
if (i >= 12 && (o = 1), f[$]) {
|
|
1954
|
+
if (i > 12) return null;
|
|
1955
|
+
var c = f[$][0].toLowerCase();
|
|
1956
|
+
c == "a" && (o = 0, i == 12 && (i = 0)), c == "p" && (o = 1, i != 12 && (i += 12)), n.start.isCertain("meridiem") || (o == 0 ? (n.start.imply("meridiem", 0), n.start.get("hour") == 12 && n.start.assign("hour", 0)) : (n.start.imply("meridiem", 1), n.start.get("hour") != 12 && n.start.assign("hour", n.start.get("hour") + 12)));
|
|
1957
|
+
} else if (f[vr]) {
|
|
1958
|
+
var l = f[vr][0];
|
|
1959
|
+
l == "朝" || l == "早" ? (o = 0, i == 12 && (i = 0)) : l == "晚" && (o = 1, i != 12 && (i += 12));
|
|
1960
|
+
} else if (f[Y]) {
|
|
1961
|
+
var u = f[Y][0];
|
|
1962
|
+
u == "上" || u == "朝" || u == "早" || u == "凌" ? (o = 0, i == 12 && (i = 0)) : (u == "下" || u == "晏" || u == "晚") && (o = 1, i != 12 && (i += 12));
|
|
1963
|
+
} else if (f[yr]) {
|
|
1964
|
+
var d = f[yr][0];
|
|
1965
|
+
d == "上" || d == "朝" || d == "早" || d == "凌" ? (o = 0, i == 12 && (i = 0)) : (d == "下" || d == "晏" || d == "晚") && (o = 1, i != 12 && (i += 12));
|
|
1966
|
+
}
|
|
1967
|
+
return n.text += f[0], n.end.assign("hour", i), n.end.assign("minute", a), o >= 0 ? n.end.assign("meridiem", o) : n.start.isCertain("meridiem") && n.start.get("meridiem") == 1 && n.start.get("hour") > i ? n.end.imply("meridiem", 0) : i > 12 && n.end.imply("meridiem", 1), n.end.date().getTime() < n.start.date().getTime() && n.end.imply("day", n.end.get("day") + 1), n;
|
|
1968
|
+
}
|
|
1969
|
+
}, Sr = RegExp("(?:星期|禮拜|週)(?<weekday>" + Object.keys(K).join("|") + ")"), Cr = class extends E {
|
|
1970
|
+
innerPattern() {
|
|
1971
|
+
return Sr;
|
|
1972
|
+
}
|
|
1973
|
+
innerExtract(e, t) {
|
|
1974
|
+
let n = e.createParsingResult(t.index, t[0]), r = K[t.groups.weekday];
|
|
1975
|
+
if (r === void 0) return null;
|
|
1976
|
+
let i = new Date(e.refDate.getTime()), a = r - i.getDay();
|
|
1977
|
+
return Math.abs(a - 7) < Math.abs(a) && (a -= 7), Math.abs(a + 7) < Math.abs(a) && (a += 7), i.setDate(i.getDate() + a), n.start.assign("weekday", r), n.start.imply("day", i.getDate()), n.start.imply("month", i.getMonth() + 1), n.start.imply("year", i.getFullYear()), n;
|
|
1978
|
+
}
|
|
1979
|
+
}, wr = class extends st {
|
|
1980
|
+
patternBetween() {
|
|
1981
|
+
return /^\s*(至|到|\-|\~|~|-|ー)\s*$/i;
|
|
1982
|
+
}
|
|
1983
|
+
}, Tr = class extends dt {
|
|
1984
|
+
patternBetween() {
|
|
1985
|
+
return /^\s*$/i;
|
|
1986
|
+
}
|
|
1987
|
+
}, Er = new Pn(Or());
|
|
1988
|
+
new Pn(kr());
|
|
1989
|
+
function Dr(e, t, n) {
|
|
1990
|
+
return Er.parseDate(e, t, n);
|
|
1991
|
+
}
|
|
1992
|
+
function Or() {
|
|
1993
|
+
let e = kr();
|
|
1994
|
+
return e.parsers.unshift(new ir()), e;
|
|
1995
|
+
}
|
|
1996
|
+
function kr() {
|
|
1997
|
+
let e = Bt({
|
|
1998
|
+
parsers: [
|
|
1999
|
+
new lr(),
|
|
2000
|
+
new Bn(),
|
|
2001
|
+
new hr(),
|
|
2002
|
+
new Kn(),
|
|
2003
|
+
new Cr(),
|
|
2004
|
+
new Zn(),
|
|
2005
|
+
new xr(),
|
|
2006
|
+
new Yn(),
|
|
2007
|
+
new pr(),
|
|
2008
|
+
new Wn()
|
|
2009
|
+
],
|
|
2010
|
+
refiners: [new wr(), new Tr()]
|
|
2011
|
+
});
|
|
2012
|
+
return e.refiners = e.refiners.filter((e) => !(e instanceof yt)), e;
|
|
2013
|
+
}
|
|
2014
|
+
//#endregion
|
|
2015
|
+
export { Dr as t };
|