@janus-scheduler/core 1.0.3 → 2.0.0
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/LICENSE +15 -0
- package/README.md +94 -0
- package/dist/api/EventBus.d.ts +20 -0
- package/dist/api/EventBus.d.ts.map +1 -0
- package/dist/api/api.init.d.ts +3 -0
- package/dist/api/api.init.d.ts.map +1 -0
- package/dist/api/api.types.d.ts +309 -0
- package/dist/api/api.types.d.ts.map +1 -0
- package/dist/index.d.ts +16 -464
- package/dist/index.d.ts.map +1 -0
- package/dist/interactions/interactions.init.d.ts +1 -0
- package/dist/interactions/interactions.init.d.ts.map +1 -0
- package/dist/janus-scheduler.cjs +8 -0
- package/dist/janus-scheduler.cjs.map +1 -0
- package/dist/janus-scheduler.es.js +2426 -208
- package/dist/janus-scheduler.es.js.map +1 -1
- package/dist/models/assignments/assignments.d.ts +15 -0
- package/dist/models/assignments/assignments.d.ts.map +1 -0
- package/dist/models/events/event.d.ts +19 -0
- package/dist/models/events/event.d.ts.map +1 -0
- package/dist/models/resources/resources.d.ts +19 -0
- package/dist/models/resources/resources.d.ts.map +1 -0
- package/dist/rendering/rendering.init.d.ts +1 -0
- package/dist/rendering/rendering.init.d.ts.map +1 -0
- package/dist/services/SchedulerManager.service.d.ts +284 -0
- package/dist/services/SchedulerManager.service.d.ts.map +1 -0
- package/dist/store/index.d.ts +2 -0
- package/dist/store/index.d.ts.map +1 -0
- package/dist/store/scheduler.store.d.ts +45 -0
- package/dist/store/scheduler.store.d.ts.map +1 -0
- package/dist/types/event.types.d.ts +15 -0
- package/dist/types/event.types.d.ts.map +1 -0
- package/dist/utils/conflict.d.ts +54 -0
- package/dist/utils/conflict.d.ts.map +1 -0
- package/dist/utils/recurrence.d.ts +9 -0
- package/dist/utils/recurrence.d.ts.map +1 -0
- package/dist/utils/time.d.ts +42 -0
- package/dist/utils/time.d.ts.map +1 -0
- package/package.json +45 -14
- package/dist/janus-scheduler.cjs.js +0 -2
- package/dist/janus-scheduler.cjs.js.map +0 -1
|
@@ -1,28 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const t = /* @__PURE__ */ new Set(), n = (a, c) => {
|
|
4
|
-
const h = typeof a == "function" ? a(e) : a;
|
|
5
|
-
if (!Object.is(h, e)) {
|
|
6
|
-
const g = e;
|
|
7
|
-
e = c ?? (typeof h != "object" || h === null) ? h : Object.assign({}, e, h), t.forEach((f) => f(e, g));
|
|
8
|
-
}
|
|
9
|
-
}, s = () => e, d = { setState: n, getState: s, getInitialState: () => l, subscribe: (a) => (t.add(a), () => t.delete(a)) }, l = e = o(n, s, d);
|
|
10
|
-
return d;
|
|
11
|
-
}, T = ((o) => o ? v(o) : v);
|
|
12
|
-
class A {
|
|
1
|
+
import { createStore as tt } from "zustand/vanilla";
|
|
2
|
+
class ae {
|
|
13
3
|
id;
|
|
14
4
|
title;
|
|
15
5
|
startTime;
|
|
16
6
|
endTime;
|
|
17
7
|
resourceId;
|
|
8
|
+
resourceIds;
|
|
18
9
|
status;
|
|
19
10
|
description;
|
|
11
|
+
color;
|
|
12
|
+
allDay;
|
|
13
|
+
recurrenceRule;
|
|
14
|
+
timezone;
|
|
20
15
|
constructor(e) {
|
|
21
|
-
this.id = e.id, this.title = e.title, this.startTime = e.startTime, this.endTime = e.endTime, this.resourceId = e.resourceId, this.status = e.status || "draft", this.description = e.description || "";
|
|
16
|
+
this.id = e.id, this.title = e.title, this.startTime = e.startTime, this.endTime = e.endTime, this.resourceIds = e.resourceIds && e.resourceIds.length > 0 ? e.resourceIds : e.resourceId ? [e.resourceId] : [], this.resourceId = this.resourceIds[0] || e.resourceId || "", this.status = e.status || "draft", this.description = e.description || "", this.color = e.color, this.allDay = e.allDay, this.recurrenceRule = e.recurrenceRule, this.timezone = e.timezone;
|
|
22
17
|
}
|
|
23
18
|
// Check if event data is valid
|
|
24
19
|
isValid() {
|
|
25
|
-
if (!this.id || !this.title ||
|
|
20
|
+
if (!this.id || !this.title || this.resourceIds.length === 0) return !1;
|
|
26
21
|
const e = new Date(this.startTime), t = new Date(this.endTime);
|
|
27
22
|
return !(e >= t);
|
|
28
23
|
}
|
|
@@ -32,20 +27,22 @@ class A {
|
|
|
32
27
|
return (new Date(this.endTime).getTime() - e) / (1e3 * 60);
|
|
33
28
|
}
|
|
34
29
|
}
|
|
35
|
-
class
|
|
30
|
+
class we {
|
|
36
31
|
id;
|
|
37
32
|
name;
|
|
38
33
|
type;
|
|
39
34
|
email;
|
|
35
|
+
avatar;
|
|
36
|
+
subtitle;
|
|
40
37
|
constructor(e) {
|
|
41
|
-
this.id = e.id, this.name = e.name, this.type = e.type || "person", this.email = e.email || "";
|
|
38
|
+
this.id = e.id, this.name = e.name, this.type = e.type || "person", this.email = e.email || "", this.avatar = e.avatar || "", this.subtitle = e.subtitle || "";
|
|
42
39
|
}
|
|
43
40
|
// Check if resource data is valid
|
|
44
41
|
isValid() {
|
|
45
|
-
return
|
|
42
|
+
return !(!this.id || !this.name || this.type === "person" && !this.email.trim());
|
|
46
43
|
}
|
|
47
44
|
}
|
|
48
|
-
class
|
|
45
|
+
class rt {
|
|
49
46
|
id;
|
|
50
47
|
eventId;
|
|
51
48
|
resourceId;
|
|
@@ -58,86 +55,112 @@ class I {
|
|
|
58
55
|
return !!(this.id && this.eventId && this.resourceId);
|
|
59
56
|
}
|
|
60
57
|
}
|
|
61
|
-
function
|
|
58
|
+
function nt() {
|
|
62
59
|
return Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
63
60
|
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
const
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
return
|
|
121
|
-
}
|
|
122
|
-
function
|
|
61
|
+
const it = /* @__PURE__ */ new Map(), st = /* @__PURE__ */ new Map(), $e = /* @__PURE__ */ new Map(), at = /* @__PURE__ */ new Map();
|
|
62
|
+
function X(r, e, t) {
|
|
63
|
+
let n = r.get(e);
|
|
64
|
+
return n === void 0 && (n = t(), r.size > 512 && r.clear(), r.set(e, n)), n;
|
|
65
|
+
}
|
|
66
|
+
function Te(r, e) {
|
|
67
|
+
const t = new Date(r), n = X(
|
|
68
|
+
it,
|
|
69
|
+
e,
|
|
70
|
+
() => new Intl.DateTimeFormat("en-CA", {
|
|
71
|
+
timeZone: e,
|
|
72
|
+
year: "numeric",
|
|
73
|
+
month: "2-digit",
|
|
74
|
+
day: "2-digit"
|
|
75
|
+
})
|
|
76
|
+
).formatToParts(t), i = n.find((d) => d.type === "year")?.value ?? "", s = n.find((d) => d.type === "month")?.value ?? "", a = n.find((d) => d.type === "day")?.value ?? "", o = X(
|
|
77
|
+
st,
|
|
78
|
+
e,
|
|
79
|
+
() => new Intl.DateTimeFormat("en-US", {
|
|
80
|
+
timeZone: e,
|
|
81
|
+
hour: "2-digit",
|
|
82
|
+
minute: "2-digit",
|
|
83
|
+
hour12: !1
|
|
84
|
+
})
|
|
85
|
+
).formatToParts(t);
|
|
86
|
+
let u = o.find((d) => d.type === "hour")?.value ?? "00";
|
|
87
|
+
const c = o.find((d) => d.type === "minute")?.value ?? "00";
|
|
88
|
+
return u === "24" && (u = "00"), { date: `${i}-${s}-${a}`, time: `${u}:${c}` };
|
|
89
|
+
}
|
|
90
|
+
function ot(r, e, t) {
|
|
91
|
+
const [n, i, s] = r.split("-").map(Number), [a, o] = e.split(":").map(Number), u = (y) => {
|
|
92
|
+
const m = X(
|
|
93
|
+
$e,
|
|
94
|
+
t,
|
|
95
|
+
() => new Intl.DateTimeFormat("en-US", {
|
|
96
|
+
timeZone: t,
|
|
97
|
+
year: "numeric",
|
|
98
|
+
month: "2-digit",
|
|
99
|
+
day: "2-digit",
|
|
100
|
+
hour: "2-digit",
|
|
101
|
+
minute: "2-digit",
|
|
102
|
+
second: "2-digit",
|
|
103
|
+
hour12: !1
|
|
104
|
+
})
|
|
105
|
+
).formatToParts(new Date(y)), p = Number(m.find((I) => I.type === "year")?.value), b = Number(m.find((I) => I.type === "month")?.value), E = Number(m.find((I) => I.type === "day")?.value);
|
|
106
|
+
let D = Number(m.find((I) => I.type === "hour")?.value);
|
|
107
|
+
const Y = Number(m.find((I) => I.type === "minute")?.value), z = Number(m.find((I) => I.type === "second")?.value);
|
|
108
|
+
return D === 24 && (D = 0), Date.UTC(
|
|
109
|
+
p,
|
|
110
|
+
b - 1,
|
|
111
|
+
E,
|
|
112
|
+
D,
|
|
113
|
+
Y,
|
|
114
|
+
z
|
|
115
|
+
) - y;
|
|
116
|
+
}, c = Date.UTC(n, i - 1, s, a, o, 0), d = u(c), h = c - d, l = u(h);
|
|
117
|
+
return l === d ? h : c - l;
|
|
118
|
+
}
|
|
119
|
+
function Ee(r, e, t) {
|
|
120
|
+
return new Date(ot(r, e, t)).toISOString();
|
|
121
|
+
}
|
|
122
|
+
function fr(r, e) {
|
|
123
|
+
const t = X(
|
|
124
|
+
$e,
|
|
125
|
+
e,
|
|
126
|
+
() => new Intl.DateTimeFormat("en-US", {
|
|
127
|
+
timeZone: e,
|
|
128
|
+
year: "numeric",
|
|
129
|
+
month: "2-digit",
|
|
130
|
+
day: "2-digit",
|
|
131
|
+
hour: "2-digit",
|
|
132
|
+
minute: "2-digit",
|
|
133
|
+
second: "2-digit",
|
|
134
|
+
hour12: !1
|
|
135
|
+
})
|
|
136
|
+
).formatToParts(new Date(r)), n = Number(t.find((c) => c.type === "year")?.value), i = Number(t.find((c) => c.type === "month")?.value) - 1, s = Number(t.find((c) => c.type === "day")?.value);
|
|
137
|
+
let a = Number(t.find((c) => c.type === "hour")?.value);
|
|
138
|
+
const o = Number(t.find((c) => c.type === "minute")?.value), u = Number(t.find((c) => c.type === "second")?.value);
|
|
139
|
+
return a === 24 && (a = 0), new Date(n, i, s, a, o, u);
|
|
140
|
+
}
|
|
141
|
+
function yr(r) {
|
|
123
142
|
try {
|
|
124
|
-
const e =
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
143
|
+
const e = X(
|
|
144
|
+
at,
|
|
145
|
+
r,
|
|
146
|
+
() => new Intl.DateTimeFormat("en", {
|
|
147
|
+
timeZone: r,
|
|
148
|
+
timeZoneName: "shortOffset"
|
|
149
|
+
})
|
|
150
|
+
).formatToParts(/* @__PURE__ */ new Date()).find((t) => t.type === "timeZoneName")?.value ?? "";
|
|
151
|
+
return `${r} (${e})`;
|
|
129
152
|
} catch {
|
|
130
|
-
return
|
|
153
|
+
return r;
|
|
131
154
|
}
|
|
132
155
|
}
|
|
133
|
-
function
|
|
156
|
+
function mr() {
|
|
134
157
|
try {
|
|
135
|
-
return Intl.supportedValuesOf("timeZone") ??
|
|
158
|
+
return Intl.supportedValuesOf("timeZone") ?? ke;
|
|
136
159
|
} catch {
|
|
137
|
-
return
|
|
160
|
+
return ke;
|
|
138
161
|
}
|
|
139
162
|
}
|
|
140
|
-
const
|
|
163
|
+
const ke = [
|
|
141
164
|
"UTC",
|
|
142
165
|
"America/New_York",
|
|
143
166
|
"America/Chicago",
|
|
@@ -157,100 +180,241 @@ const y = [
|
|
|
157
180
|
"Asia/Shanghai",
|
|
158
181
|
"Australia/Sydney",
|
|
159
182
|
"Pacific/Auckland"
|
|
160
|
-
],
|
|
183
|
+
], fe = "janus-scheduler:new-event-draft", ye = typeof window < "u" && typeof window.localStorage < "u", ut = () => {
|
|
184
|
+
if (!ye) return null;
|
|
185
|
+
try {
|
|
186
|
+
const r = localStorage.getItem(fe);
|
|
187
|
+
return r ? JSON.parse(r) : null;
|
|
188
|
+
} catch (r) {
|
|
189
|
+
return console.error("Failed to load draft from local storage", r), null;
|
|
190
|
+
}
|
|
191
|
+
}, ct = (r) => {
|
|
192
|
+
if (ye)
|
|
193
|
+
try {
|
|
194
|
+
localStorage.setItem(fe, JSON.stringify(r));
|
|
195
|
+
} catch (e) {
|
|
196
|
+
console.error(e);
|
|
197
|
+
}
|
|
198
|
+
}, lt = () => {
|
|
199
|
+
if (ye)
|
|
200
|
+
try {
|
|
201
|
+
localStorage.removeItem(fe);
|
|
202
|
+
} catch (r) {
|
|
203
|
+
console.error(r);
|
|
204
|
+
}
|
|
205
|
+
}, g = tt((r, e) => ({
|
|
161
206
|
events: {},
|
|
162
207
|
resources: {},
|
|
163
208
|
assignments: {},
|
|
164
|
-
timezone:
|
|
209
|
+
timezone: nt(),
|
|
210
|
+
eventDraft: null,
|
|
165
211
|
addEvent: (t) => {
|
|
166
|
-
const n = new
|
|
212
|
+
const n = new ae(t);
|
|
167
213
|
if (!n.isValid()) throw new Error("Invalid event data");
|
|
168
|
-
return
|
|
169
|
-
events: { ...
|
|
214
|
+
return r((i) => ({
|
|
215
|
+
events: { ...i.events, [n.id]: n }
|
|
170
216
|
})), n;
|
|
171
217
|
},
|
|
172
218
|
updateEvent: (t, n) => {
|
|
173
|
-
const
|
|
174
|
-
if (!
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
219
|
+
const s = e().events[t];
|
|
220
|
+
if (!s) throw new Error(`Event ${t} not found`);
|
|
221
|
+
let a = s.resourceIds, o = s.resourceId;
|
|
222
|
+
n.resourceIds ? (a = n.resourceIds, o = n.resourceIds[0] || "") : n.resourceId && (o = n.resourceId, a = [n.resourceId]);
|
|
223
|
+
const u = new ae({
|
|
224
|
+
id: s.id,
|
|
225
|
+
title: n.title !== void 0 ? n.title : s.title,
|
|
226
|
+
startTime: n.startTime !== void 0 ? n.startTime : s.startTime,
|
|
227
|
+
endTime: n.endTime !== void 0 ? n.endTime : s.endTime,
|
|
228
|
+
resourceId: o,
|
|
229
|
+
resourceIds: a,
|
|
230
|
+
status: n.status !== void 0 ? n.status : s.status,
|
|
231
|
+
description: n.description !== void 0 ? n.description : s.description,
|
|
232
|
+
color: n.color !== void 0 ? n.color : s.color,
|
|
233
|
+
allDay: n.allDay !== void 0 ? n.allDay : s.allDay,
|
|
234
|
+
recurrenceRule: n.recurrenceRule !== void 0 ? n.recurrenceRule : s.recurrenceRule,
|
|
235
|
+
timezone: n.timezone !== void 0 ? n.timezone : s.timezone
|
|
236
|
+
});
|
|
237
|
+
return r((c) => ({
|
|
238
|
+
events: { ...c.events, [t]: u }
|
|
239
|
+
})), u;
|
|
178
240
|
},
|
|
179
241
|
deleteEvent: (t) => {
|
|
180
242
|
let n = !1;
|
|
181
|
-
return
|
|
182
|
-
if (
|
|
183
|
-
const
|
|
184
|
-
return delete
|
|
243
|
+
return r((i) => {
|
|
244
|
+
if (i.events[t]) {
|
|
245
|
+
const s = { ...i.events };
|
|
246
|
+
return delete s[t], n = !0, { events: s };
|
|
185
247
|
}
|
|
186
|
-
return
|
|
248
|
+
return i;
|
|
187
249
|
}), n;
|
|
188
250
|
},
|
|
189
251
|
addResource: (t) => {
|
|
190
|
-
const n = new
|
|
252
|
+
const n = new we(t);
|
|
191
253
|
if (!n.isValid()) throw new Error("Invalid resource data");
|
|
192
|
-
return
|
|
193
|
-
resources: { ...
|
|
254
|
+
return r((i) => ({
|
|
255
|
+
resources: { ...i.resources, [n.id]: n }
|
|
194
256
|
})), n;
|
|
195
257
|
},
|
|
196
258
|
updateResource: (t, n) => {
|
|
197
|
-
const
|
|
198
|
-
if (!
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
259
|
+
const s = e().resources[t];
|
|
260
|
+
if (!s) throw new Error(`Resource ${t} not found`);
|
|
261
|
+
const a = new we({
|
|
262
|
+
id: s.id,
|
|
263
|
+
name: n.name !== void 0 ? n.name : s.name,
|
|
264
|
+
type: n.type !== void 0 ? n.type : s.type,
|
|
265
|
+
email: n.email !== void 0 ? n.email : s.email,
|
|
266
|
+
avatar: n.avatar !== void 0 ? n.avatar : s.avatar
|
|
267
|
+
});
|
|
268
|
+
if (!a.isValid()) throw new Error("Invalid resource data");
|
|
269
|
+
return r((o) => ({
|
|
270
|
+
resources: { ...o.resources, [t]: a }
|
|
271
|
+
})), a;
|
|
202
272
|
},
|
|
203
273
|
deleteResource: (t) => {
|
|
204
274
|
const n = e();
|
|
205
275
|
if (Object.values(n.events).some(
|
|
206
|
-
(
|
|
276
|
+
(a) => a.resourceIds && a.resourceIds.includes(t) || a.resourceId === t
|
|
207
277
|
))
|
|
208
278
|
throw new Error(`Cannot delete resource ${t} - has assigned events`);
|
|
209
|
-
let
|
|
210
|
-
return
|
|
211
|
-
if (
|
|
212
|
-
const
|
|
213
|
-
return delete
|
|
214
|
-
}
|
|
215
|
-
return
|
|
216
|
-
}),
|
|
279
|
+
let s = !1;
|
|
280
|
+
return r((a) => {
|
|
281
|
+
if (a.resources[t]) {
|
|
282
|
+
const o = { ...a.resources };
|
|
283
|
+
return delete o[t], s = !0, { resources: o };
|
|
284
|
+
}
|
|
285
|
+
return a;
|
|
286
|
+
}), s;
|
|
217
287
|
},
|
|
218
288
|
addAssignment: (t) => {
|
|
219
|
-
const n = e(),
|
|
220
|
-
if (!
|
|
221
|
-
if (!n.events[
|
|
222
|
-
throw new Error(`Event ${
|
|
223
|
-
if (!n.resources[
|
|
224
|
-
throw new Error(`Resource ${
|
|
225
|
-
return
|
|
226
|
-
assignments: { ...
|
|
227
|
-
})),
|
|
289
|
+
const n = e(), i = new rt(t);
|
|
290
|
+
if (!i.isValid()) throw new Error("Invalid assignment data");
|
|
291
|
+
if (!n.events[i.eventId])
|
|
292
|
+
throw new Error(`Event ${i.eventId} not found`);
|
|
293
|
+
if (!n.resources[i.resourceId])
|
|
294
|
+
throw new Error(`Resource ${i.resourceId} not found`);
|
|
295
|
+
return r((s) => ({
|
|
296
|
+
assignments: { ...s.assignments, [i.id]: i }
|
|
297
|
+
})), i;
|
|
228
298
|
},
|
|
229
299
|
deleteAssignment: (t) => {
|
|
230
300
|
let n = !1;
|
|
231
|
-
return
|
|
232
|
-
if (
|
|
233
|
-
const
|
|
234
|
-
return delete
|
|
301
|
+
return r((i) => {
|
|
302
|
+
if (i.assignments[t]) {
|
|
303
|
+
const s = { ...i.assignments };
|
|
304
|
+
return delete s[t], n = !0, { assignments: s };
|
|
235
305
|
}
|
|
236
|
-
return
|
|
306
|
+
return i;
|
|
237
307
|
}), n;
|
|
238
308
|
},
|
|
239
309
|
clearAll: () => {
|
|
240
|
-
|
|
310
|
+
r({
|
|
241
311
|
events: {},
|
|
242
312
|
resources: {},
|
|
243
313
|
assignments: {}
|
|
244
314
|
});
|
|
245
315
|
},
|
|
246
316
|
setTimezone: (t) => {
|
|
247
|
-
|
|
317
|
+
r({ timezone: t });
|
|
318
|
+
},
|
|
319
|
+
startDraft: (t, n) => {
|
|
320
|
+
let i = {
|
|
321
|
+
id: t,
|
|
322
|
+
title: n.title ?? "",
|
|
323
|
+
startDate: n.startDate ?? "",
|
|
324
|
+
startTime: n.startTime ?? "",
|
|
325
|
+
endDate: n.endDate ?? "",
|
|
326
|
+
endTime: n.endTime ?? "",
|
|
327
|
+
participants: n.participants ?? [],
|
|
328
|
+
description: n.description ?? "",
|
|
329
|
+
activeColor: n.activeColor ?? "orange",
|
|
330
|
+
timezone: n.timezone ?? e().timezone,
|
|
331
|
+
allDay: n.allDay ?? !1,
|
|
332
|
+
recurrenceRule: n.recurrenceRule ?? ""
|
|
333
|
+
};
|
|
334
|
+
if (t === null) {
|
|
335
|
+
const s = ut();
|
|
336
|
+
s && (i = {
|
|
337
|
+
...i,
|
|
338
|
+
...s,
|
|
339
|
+
id: null
|
|
340
|
+
});
|
|
341
|
+
}
|
|
342
|
+
r({ eventDraft: i });
|
|
343
|
+
},
|
|
344
|
+
updateDraft: (t) => {
|
|
345
|
+
const { eventDraft: n } = e();
|
|
346
|
+
if (!n) return;
|
|
347
|
+
const i = { ...n, ...t };
|
|
348
|
+
r({ eventDraft: i }), i.id === null && ct(i);
|
|
349
|
+
},
|
|
350
|
+
clearDraft: (t = !1) => {
|
|
351
|
+
const { eventDraft: n } = e();
|
|
352
|
+
n && n.id === null && t && lt(), r({ eventDraft: null });
|
|
248
353
|
}
|
|
249
|
-
}))
|
|
250
|
-
|
|
354
|
+
})), dt = {
|
|
355
|
+
maxUndoStackSize: 20
|
|
356
|
+
};
|
|
357
|
+
class vr {
|
|
251
358
|
_hooks;
|
|
252
|
-
|
|
253
|
-
|
|
359
|
+
_config;
|
|
360
|
+
_undoStack = [];
|
|
361
|
+
_isUndoing = !1;
|
|
362
|
+
_isBatchOperation = !1;
|
|
363
|
+
_undoListeners = /* @__PURE__ */ new Set();
|
|
364
|
+
constructor(e = {}, t = {}) {
|
|
365
|
+
this._hooks = e, this._config = { ...dt, ...t };
|
|
366
|
+
}
|
|
367
|
+
// ── Undo API ─────────────────────────────────────────────────────────────
|
|
368
|
+
canUndo() {
|
|
369
|
+
return this._undoStack.length > 0;
|
|
370
|
+
}
|
|
371
|
+
peekUndo() {
|
|
372
|
+
return this._undoStack.at(-1);
|
|
373
|
+
}
|
|
374
|
+
/**
|
|
375
|
+
* Subscribe to undo-stack changes. The listener fires whenever the stack
|
|
376
|
+
* grows or shrinks, letting UI frameworks derive `canUndo()` reactively
|
|
377
|
+
* (e.g. via React's `useSyncExternalStore`) instead of wiring a manual
|
|
378
|
+
* `onUndoStateChange` callback.
|
|
379
|
+
*
|
|
380
|
+
* @returns An unsubscribe function.
|
|
381
|
+
*/
|
|
382
|
+
subscribeUndo(e) {
|
|
383
|
+
return this._undoListeners.add(e), () => {
|
|
384
|
+
this._undoListeners.delete(e);
|
|
385
|
+
};
|
|
386
|
+
}
|
|
387
|
+
_notifyUndoChanged() {
|
|
388
|
+
this._hooks.onUndoStateChange?.(this.canUndo());
|
|
389
|
+
for (const e of this._undoListeners) e();
|
|
390
|
+
}
|
|
391
|
+
undo() {
|
|
392
|
+
if (!this.canUndo()) return;
|
|
393
|
+
this._isUndoing = !0;
|
|
394
|
+
const e = this._undoStack.pop();
|
|
395
|
+
try {
|
|
396
|
+
switch (e.type) {
|
|
397
|
+
case "addEvent":
|
|
398
|
+
this.deleteEvent(e.id);
|
|
399
|
+
break;
|
|
400
|
+
case "updateEvent":
|
|
401
|
+
this.updateEvent(e.id, e.previous);
|
|
402
|
+
break;
|
|
403
|
+
case "deleteEvent":
|
|
404
|
+
this.addEvent(e.previous);
|
|
405
|
+
break;
|
|
406
|
+
case "batchAddEvents":
|
|
407
|
+
for (const t of e.ids)
|
|
408
|
+
this.deleteEvent(t);
|
|
409
|
+
break;
|
|
410
|
+
}
|
|
411
|
+
} catch {
|
|
412
|
+
} finally {
|
|
413
|
+
this._isUndoing = !1, this._notifyUndoChanged();
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
_pushUndo(e) {
|
|
417
|
+
this._isUndoing || this._isBatchOperation || (this._undoStack.push(e), this._undoStack.length > this._config.maxUndoStackSize && this._undoStack.shift(), this._notifyUndoChanged());
|
|
254
418
|
}
|
|
255
419
|
// ── Private helper ─────────────────────────────────────────────────────────
|
|
256
420
|
/**
|
|
@@ -266,15 +430,15 @@ class U {
|
|
|
266
430
|
* @param rollback - Undoes the optimistic store write
|
|
267
431
|
*/
|
|
268
432
|
_fireHook(e, t, n) {
|
|
269
|
-
let
|
|
433
|
+
let i;
|
|
270
434
|
try {
|
|
271
|
-
|
|
272
|
-
} catch (
|
|
273
|
-
n(), this._hooks.onError?.({ operation: e, error:
|
|
435
|
+
i = t();
|
|
436
|
+
} catch (s) {
|
|
437
|
+
n(), this._hooks.onError?.({ operation: e, error: s, reverted: !0 });
|
|
274
438
|
return;
|
|
275
439
|
}
|
|
276
|
-
|
|
277
|
-
n(), this._hooks.onError?.({ operation: e, error:
|
|
440
|
+
i?.catch((s) => {
|
|
441
|
+
n(), this._hooks.onError?.({ operation: e, error: s, reverted: !0 });
|
|
278
442
|
});
|
|
279
443
|
}
|
|
280
444
|
// ============ EVENT FUNCTIONS ============
|
|
@@ -286,11 +450,54 @@ class U {
|
|
|
286
450
|
* @returns The created Event instance (already visible in the UI)
|
|
287
451
|
*/
|
|
288
452
|
addEvent(e) {
|
|
289
|
-
const t =
|
|
290
|
-
return this._fireHook(
|
|
453
|
+
const t = g.getState().addEvent(e);
|
|
454
|
+
return this._pushUndo({ type: "addEvent", id: t.id }), this._isBatchOperation || this._fireHook(
|
|
291
455
|
"addEvent",
|
|
292
456
|
() => this._hooks.onEventAdd?.(t),
|
|
293
|
-
() =>
|
|
457
|
+
() => g.getState().deleteEvent(t.id)
|
|
458
|
+
), t;
|
|
459
|
+
}
|
|
460
|
+
/**
|
|
461
|
+
* Optimistically adds multiple events to the store in a single batch.
|
|
462
|
+
* Fires a single `onBulkEventAdd` hook (or falls back to individual
|
|
463
|
+
* `onEventAdd` hooks) and pushes a single compound undo action.
|
|
464
|
+
*
|
|
465
|
+
* This avoids the N-request / N-undo-push problem when importing
|
|
466
|
+
* external data.
|
|
467
|
+
*
|
|
468
|
+
* @param dataArray - Array of raw event data to add
|
|
469
|
+
* @returns Array of created Event instances
|
|
470
|
+
*/
|
|
471
|
+
batchAddEvents(e) {
|
|
472
|
+
this._isBatchOperation = !0;
|
|
473
|
+
const t = [], n = [];
|
|
474
|
+
try {
|
|
475
|
+
for (const s of e) {
|
|
476
|
+
const a = this.addEvent(s);
|
|
477
|
+
t.push(a), n.push(a.id);
|
|
478
|
+
}
|
|
479
|
+
} finally {
|
|
480
|
+
this._isBatchOperation = !1;
|
|
481
|
+
}
|
|
482
|
+
n.length > 0 && (this._undoStack.push({ type: "batchAddEvents", ids: n }), this._undoStack.length > this._config.maxUndoStackSize && this._undoStack.shift(), this._notifyUndoChanged());
|
|
483
|
+
const i = () => {
|
|
484
|
+
for (const s of n)
|
|
485
|
+
g.getState().deleteEvent(s);
|
|
486
|
+
};
|
|
487
|
+
return this._hooks.onBulkEventAdd ? this._fireHook(
|
|
488
|
+
"batchAddEvents",
|
|
489
|
+
() => this._hooks.onBulkEventAdd(t),
|
|
490
|
+
i
|
|
491
|
+
) : this._hooks.onEventAdd && this._fireHook(
|
|
492
|
+
"batchAddEvents",
|
|
493
|
+
() => {
|
|
494
|
+
const a = t.map((o) => this._hooks.onEventAdd(o)).filter(
|
|
495
|
+
(o) => o instanceof Promise
|
|
496
|
+
);
|
|
497
|
+
return a.length > 0 ? Promise.all(a).then(() => {
|
|
498
|
+
}) : void 0;
|
|
499
|
+
},
|
|
500
|
+
i
|
|
294
501
|
), t;
|
|
295
502
|
}
|
|
296
503
|
/**
|
|
@@ -299,14 +506,51 @@ class U {
|
|
|
299
506
|
* @returns Event if found, undefined otherwise
|
|
300
507
|
*/
|
|
301
508
|
getEvent(e) {
|
|
302
|
-
|
|
509
|
+
const t = e.replace(/_occ_\d+$/, "");
|
|
510
|
+
return g.getState().events[t];
|
|
303
511
|
}
|
|
304
512
|
/**
|
|
305
513
|
* Get all events currently in the store.
|
|
306
514
|
* @returns Array of all Event instances
|
|
307
515
|
*/
|
|
308
516
|
getAllEvents() {
|
|
309
|
-
return Object.values(
|
|
517
|
+
return Object.values(g.getState().events);
|
|
518
|
+
}
|
|
519
|
+
/**
|
|
520
|
+
* The IANA timezone the scheduler is currently displaying in.
|
|
521
|
+
* Defaults to the browser's local timezone unless changed via the store's
|
|
522
|
+
* `setTimezone`. Use this (not `Intl.DateTimeFormat()`) when formatting
|
|
523
|
+
* event times outside the scheduler components, so external UI (dialogs,
|
|
524
|
+
* toasts) matches the calendar display.
|
|
525
|
+
*/
|
|
526
|
+
getTimezone() {
|
|
527
|
+
return g.getState().timezone;
|
|
528
|
+
}
|
|
529
|
+
_shiftParentEventTimes(e, t, n) {
|
|
530
|
+
const i = g.getState().events[e];
|
|
531
|
+
if (!i) return;
|
|
532
|
+
const s = Number(n[2]), a = new Date(i.startTime).getTime(), o = new Date(i.endTime).getTime();
|
|
533
|
+
if (t.startTime && t.endTime) {
|
|
534
|
+
const u = new Date(t.startTime).getTime(), c = new Date(t.endTime).getTime(), d = u - s, h = c - u;
|
|
535
|
+
t.startTime = new Date(a + d).toISOString(), t.endTime = new Date(
|
|
536
|
+
a + d + h
|
|
537
|
+
).toISOString();
|
|
538
|
+
} else if (t.startTime) {
|
|
539
|
+
const c = new Date(t.startTime).getTime() - s;
|
|
540
|
+
t.startTime = new Date(a + c).toISOString(), t.endTime = new Date(o + c).toISOString();
|
|
541
|
+
} else if (t.endTime) {
|
|
542
|
+
const c = new Date(t.endTime).getTime() - s;
|
|
543
|
+
t.startTime = i.startTime, t.endTime = new Date(a + c).toISOString();
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
_computeEventDelta(e, t) {
|
|
547
|
+
const n = {};
|
|
548
|
+
for (const i of Object.keys(e)) {
|
|
549
|
+
if (i === "id") continue;
|
|
550
|
+
const s = t[i], a = e[i];
|
|
551
|
+
i === "resourceIds" ? JSON.stringify(s) !== JSON.stringify(a) && (n.resourceIds = s) : s !== a && (n[i] = s);
|
|
552
|
+
}
|
|
553
|
+
return n;
|
|
310
554
|
}
|
|
311
555
|
/**
|
|
312
556
|
* Optimistically updates an event in the store, then fires `onEventUpdate`.
|
|
@@ -317,21 +561,38 @@ class U {
|
|
|
317
561
|
* @returns The updated Event instance (already visible in the UI)
|
|
318
562
|
*/
|
|
319
563
|
updateEvent(e, t) {
|
|
320
|
-
const n =
|
|
564
|
+
const n = /^(.+)_occ_(\d+)$/.exec(e), i = n ? n[1] : e;
|
|
565
|
+
n && this._shiftParentEventTimes(i, t, n);
|
|
566
|
+
const s = g.getState().events[i], a = s ? {
|
|
567
|
+
...s,
|
|
568
|
+
resourceIds: s.resourceIds ? [...s.resourceIds] : void 0
|
|
569
|
+
} : null, o = g.getState().updateEvent(i, t);
|
|
570
|
+
if (a) {
|
|
571
|
+
const u = this._computeEventDelta(t, a);
|
|
572
|
+
Object.keys(u).length > 0 && this._pushUndo({
|
|
573
|
+
type: "updateEvent",
|
|
574
|
+
id: i,
|
|
575
|
+
previous: u
|
|
576
|
+
});
|
|
577
|
+
}
|
|
321
578
|
return this._fireHook(
|
|
322
579
|
"updateEvent",
|
|
323
|
-
() => this._hooks.onEventUpdate?.(
|
|
580
|
+
() => this._hooks.onEventUpdate?.(o),
|
|
324
581
|
() => {
|
|
325
|
-
|
|
326
|
-
title:
|
|
327
|
-
startTime:
|
|
328
|
-
endTime:
|
|
329
|
-
status:
|
|
330
|
-
description:
|
|
331
|
-
resourceId:
|
|
582
|
+
a && g.getState().updateEvent(i, {
|
|
583
|
+
title: a.title,
|
|
584
|
+
startTime: a.startTime,
|
|
585
|
+
endTime: a.endTime,
|
|
586
|
+
status: a.status,
|
|
587
|
+
description: a.description,
|
|
588
|
+
resourceId: a.resourceId,
|
|
589
|
+
resourceIds: a.resourceIds,
|
|
590
|
+
color: a.color,
|
|
591
|
+
allDay: a.allDay,
|
|
592
|
+
recurrenceRule: a.recurrenceRule
|
|
332
593
|
});
|
|
333
594
|
}
|
|
334
|
-
),
|
|
595
|
+
), o;
|
|
335
596
|
}
|
|
336
597
|
/**
|
|
337
598
|
* Optimistically deletes an event from the store, then fires `onEventDelete`.
|
|
@@ -341,14 +602,29 @@ class U {
|
|
|
341
602
|
* @returns true if the event was found and deleted, false otherwise
|
|
342
603
|
*/
|
|
343
604
|
deleteEvent(e) {
|
|
344
|
-
const t =
|
|
345
|
-
return n && this.
|
|
605
|
+
const t = e.replace(/_occ_\d+$/, ""), n = g.getState().events[t], i = g.getState().deleteEvent(t);
|
|
606
|
+
return i && n && (this._pushUndo({
|
|
607
|
+
type: "deleteEvent",
|
|
608
|
+
previous: {
|
|
609
|
+
id: n.id,
|
|
610
|
+
title: n.title,
|
|
611
|
+
startTime: n.startTime,
|
|
612
|
+
endTime: n.endTime,
|
|
613
|
+
status: n.status,
|
|
614
|
+
description: n.description,
|
|
615
|
+
resourceId: n.resourceId,
|
|
616
|
+
resourceIds: n.resourceIds,
|
|
617
|
+
color: n.color,
|
|
618
|
+
allDay: n.allDay,
|
|
619
|
+
recurrenceRule: n.recurrenceRule
|
|
620
|
+
}
|
|
621
|
+
}), this._fireHook(
|
|
346
622
|
"deleteEvent",
|
|
347
|
-
() => this._hooks.onEventDelete?.(
|
|
623
|
+
() => this._hooks.onEventDelete?.(t),
|
|
348
624
|
() => {
|
|
349
|
-
|
|
625
|
+
g.getState().addEvent(n);
|
|
350
626
|
}
|
|
351
|
-
),
|
|
627
|
+
)), i;
|
|
352
628
|
}
|
|
353
629
|
/**
|
|
354
630
|
* Get all events assigned to a specific resource.
|
|
@@ -356,7 +632,9 @@ class U {
|
|
|
356
632
|
* @returns Filtered array of Event instances
|
|
357
633
|
*/
|
|
358
634
|
getEventsByResource(e) {
|
|
359
|
-
return this.getAllEvents().filter(
|
|
635
|
+
return this.getAllEvents().filter(
|
|
636
|
+
(t) => t.resourceIds?.includes(e) || t.resourceId === e
|
|
637
|
+
);
|
|
360
638
|
}
|
|
361
639
|
/**
|
|
362
640
|
* Get all events that start on a specific calendar date.
|
|
@@ -376,11 +654,11 @@ class U {
|
|
|
376
654
|
* @returns The created Resource instance (already visible in the UI)
|
|
377
655
|
*/
|
|
378
656
|
addResource(e) {
|
|
379
|
-
const t =
|
|
657
|
+
const t = g.getState().addResource(e);
|
|
380
658
|
return this._fireHook(
|
|
381
659
|
"addResource",
|
|
382
660
|
() => this._hooks.onResourceAdd?.(t),
|
|
383
|
-
() =>
|
|
661
|
+
() => g.getState().deleteResource(t.id)
|
|
384
662
|
), t;
|
|
385
663
|
}
|
|
386
664
|
/**
|
|
@@ -389,14 +667,14 @@ class U {
|
|
|
389
667
|
* @returns Resource if found, undefined otherwise
|
|
390
668
|
*/
|
|
391
669
|
getResource(e) {
|
|
392
|
-
return
|
|
670
|
+
return g.getState().resources[e];
|
|
393
671
|
}
|
|
394
672
|
/**
|
|
395
673
|
* Get all resources currently in the store.
|
|
396
674
|
* @returns Array of all Resource instances
|
|
397
675
|
*/
|
|
398
676
|
getAllResources() {
|
|
399
|
-
return Object.values(
|
|
677
|
+
return Object.values(g.getState().resources);
|
|
400
678
|
}
|
|
401
679
|
/**
|
|
402
680
|
* Optimistically updates a resource in the store, then fires `onResourceUpdate`.
|
|
@@ -407,18 +685,19 @@ class U {
|
|
|
407
685
|
* @returns The updated Resource instance (already visible in the UI)
|
|
408
686
|
*/
|
|
409
687
|
updateResource(e, t) {
|
|
410
|
-
const n =
|
|
688
|
+
const n = g.getState().resources[e], i = n ? { ...n } : null, s = g.getState().updateResource(e, t);
|
|
411
689
|
return this._fireHook(
|
|
412
690
|
"updateResource",
|
|
413
|
-
() => this._hooks.onResourceUpdate?.(
|
|
691
|
+
() => this._hooks.onResourceUpdate?.(s),
|
|
414
692
|
() => {
|
|
415
|
-
|
|
416
|
-
name:
|
|
417
|
-
type:
|
|
418
|
-
email:
|
|
693
|
+
i && g.getState().updateResource(e, {
|
|
694
|
+
name: i.name,
|
|
695
|
+
type: i.type,
|
|
696
|
+
email: i.email,
|
|
697
|
+
avatar: i.avatar
|
|
419
698
|
});
|
|
420
699
|
}
|
|
421
|
-
),
|
|
700
|
+
), s;
|
|
422
701
|
}
|
|
423
702
|
/**
|
|
424
703
|
* Optimistically deletes a resource from the store, then fires `onResourceDelete`.
|
|
@@ -429,12 +708,12 @@ class U {
|
|
|
429
708
|
* @returns true if the resource was found and deleted
|
|
430
709
|
*/
|
|
431
710
|
deleteResource(e) {
|
|
432
|
-
const t =
|
|
711
|
+
const t = g.getState().resources[e], n = g.getState().deleteResource(e);
|
|
433
712
|
return n && this._fireHook(
|
|
434
713
|
"deleteResource",
|
|
435
714
|
() => this._hooks.onResourceDelete?.(e),
|
|
436
715
|
() => {
|
|
437
|
-
t &&
|
|
716
|
+
t && g.getState().addResource(t);
|
|
438
717
|
}
|
|
439
718
|
), n;
|
|
440
719
|
}
|
|
@@ -447,11 +726,11 @@ class U {
|
|
|
447
726
|
* @returns The created Assignment instance (already visible in the UI)
|
|
448
727
|
*/
|
|
449
728
|
addAssignment(e) {
|
|
450
|
-
const t =
|
|
729
|
+
const t = g.getState().addAssignment(e);
|
|
451
730
|
return this._fireHook(
|
|
452
731
|
"addAssignment",
|
|
453
732
|
() => this._hooks.onAssignmentAdd?.(t),
|
|
454
|
-
() =>
|
|
733
|
+
() => g.getState().deleteAssignment(t.id)
|
|
455
734
|
), t;
|
|
456
735
|
}
|
|
457
736
|
/**
|
|
@@ -460,7 +739,7 @@ class U {
|
|
|
460
739
|
* @returns Array of Assignment instances
|
|
461
740
|
*/
|
|
462
741
|
getAssignmentsByEvent(e) {
|
|
463
|
-
return Object.values(
|
|
742
|
+
return Object.values(g.getState().assignments).filter(
|
|
464
743
|
(t) => t.eventId === e
|
|
465
744
|
);
|
|
466
745
|
}
|
|
@@ -470,7 +749,7 @@ class U {
|
|
|
470
749
|
* @returns Array of Assignment instances
|
|
471
750
|
*/
|
|
472
751
|
getAssignmentsByResource(e) {
|
|
473
|
-
return Object.values(
|
|
752
|
+
return Object.values(g.getState().assignments).filter(
|
|
474
753
|
(t) => t.resourceId === e
|
|
475
754
|
);
|
|
476
755
|
}
|
|
@@ -482,12 +761,12 @@ class U {
|
|
|
482
761
|
* @returns true if deleted, false if not found
|
|
483
762
|
*/
|
|
484
763
|
deleteAssignment(e) {
|
|
485
|
-
const t =
|
|
764
|
+
const t = g.getState().assignments[e], n = g.getState().deleteAssignment(e);
|
|
486
765
|
return n && this._fireHook(
|
|
487
766
|
"deleteAssignment",
|
|
488
767
|
() => this._hooks.onAssignmentDelete?.(e),
|
|
489
768
|
() => {
|
|
490
|
-
t &&
|
|
769
|
+
t && g.getState().addAssignment(t);
|
|
491
770
|
}
|
|
492
771
|
), n;
|
|
493
772
|
}
|
|
@@ -496,13 +775,13 @@ class U {
|
|
|
496
775
|
* Total number of events currently in the store.
|
|
497
776
|
*/
|
|
498
777
|
getEventCount() {
|
|
499
|
-
return Object.keys(
|
|
778
|
+
return Object.keys(g.getState().events).length;
|
|
500
779
|
}
|
|
501
780
|
/**
|
|
502
781
|
* Total number of resources currently in the store.
|
|
503
782
|
*/
|
|
504
783
|
getResourceCount() {
|
|
505
|
-
return Object.keys(
|
|
784
|
+
return Object.keys(g.getState().resources).length;
|
|
506
785
|
}
|
|
507
786
|
/**
|
|
508
787
|
* Remove all events, resources, and assignments from the store.
|
|
@@ -510,10 +789,10 @@ class U {
|
|
|
510
789
|
* (e.g. on logout or when switching tenants).
|
|
511
790
|
*/
|
|
512
791
|
clearAll() {
|
|
513
|
-
|
|
792
|
+
g.getState().clearAll(), this._undoStack = [], this._hooks.onUndoStateChange?.(this.canUndo());
|
|
514
793
|
}
|
|
515
794
|
}
|
|
516
|
-
class
|
|
795
|
+
class ht {
|
|
517
796
|
listeners = {};
|
|
518
797
|
/**
|
|
519
798
|
* Subscribe to a Janus Scheduler event.
|
|
@@ -528,7 +807,7 @@ class k {
|
|
|
528
807
|
if (!this.listeners[e]) return;
|
|
529
808
|
const n = this.listeners[e];
|
|
530
809
|
this.listeners[e] = n.filter(
|
|
531
|
-
(
|
|
810
|
+
(i) => i !== t
|
|
532
811
|
);
|
|
533
812
|
}
|
|
534
813
|
/**
|
|
@@ -538,27 +817,1966 @@ class k {
|
|
|
538
817
|
this.listeners[e] && this.listeners[e].forEach((n) => {
|
|
539
818
|
try {
|
|
540
819
|
n(t);
|
|
541
|
-
} catch (
|
|
542
|
-
console.error(`Error in event handler for ${e}:`,
|
|
820
|
+
} catch (i) {
|
|
821
|
+
console.error(`Error in event handler for ${e}:`, i);
|
|
543
822
|
}
|
|
544
823
|
});
|
|
545
824
|
}
|
|
546
825
|
}
|
|
547
|
-
const
|
|
826
|
+
const pr = new ht();
|
|
827
|
+
var oe = [
|
|
828
|
+
"MO",
|
|
829
|
+
"TU",
|
|
830
|
+
"WE",
|
|
831
|
+
"TH",
|
|
832
|
+
"FR",
|
|
833
|
+
"SA",
|
|
834
|
+
"SU"
|
|
835
|
+
], M = (
|
|
836
|
+
/** @class */
|
|
837
|
+
(function() {
|
|
838
|
+
function r(e, t) {
|
|
839
|
+
if (t === 0)
|
|
840
|
+
throw new Error("Can't create weekday with n == 0");
|
|
841
|
+
this.weekday = e, this.n = t;
|
|
842
|
+
}
|
|
843
|
+
return r.fromStr = function(e) {
|
|
844
|
+
return new r(oe.indexOf(e));
|
|
845
|
+
}, r.prototype.nth = function(e) {
|
|
846
|
+
return this.n === e ? this : new r(this.weekday, e);
|
|
847
|
+
}, r.prototype.equals = function(e) {
|
|
848
|
+
return this.weekday === e.weekday && this.n === e.n;
|
|
849
|
+
}, r.prototype.toString = function() {
|
|
850
|
+
var e = oe[this.weekday];
|
|
851
|
+
return this.n && (e = (this.n > 0 ? "+" : "") + String(this.n) + e), e;
|
|
852
|
+
}, r.prototype.getJsWeekday = function() {
|
|
853
|
+
return this.weekday === 6 ? 0 : this.weekday + 1;
|
|
854
|
+
}, r;
|
|
855
|
+
})()
|
|
856
|
+
), S = function(r) {
|
|
857
|
+
return r != null;
|
|
858
|
+
}, N = function(r) {
|
|
859
|
+
return typeof r == "number";
|
|
860
|
+
}, Se = function(r) {
|
|
861
|
+
return typeof r == "string" && oe.includes(r);
|
|
862
|
+
}, A = Array.isArray, W = function(r, e) {
|
|
863
|
+
e === void 0 && (e = r), arguments.length === 1 && (e = r, r = 0);
|
|
864
|
+
for (var t = [], n = r; n < e; n++)
|
|
865
|
+
t.push(n);
|
|
866
|
+
return t;
|
|
867
|
+
}, w = function(r, e) {
|
|
868
|
+
var t = 0, n = [];
|
|
869
|
+
if (A(r))
|
|
870
|
+
for (; t < e; t++)
|
|
871
|
+
n[t] = [].concat(r);
|
|
872
|
+
else
|
|
873
|
+
for (; t < e; t++)
|
|
874
|
+
n[t] = r;
|
|
875
|
+
return n;
|
|
876
|
+
}, ft = function(r) {
|
|
877
|
+
return A(r) ? r : [r];
|
|
878
|
+
};
|
|
879
|
+
function B(r, e, t) {
|
|
880
|
+
t === void 0 && (t = " ");
|
|
881
|
+
var n = String(r);
|
|
882
|
+
return e = e >> 0, n.length > e ? String(n) : (e = e - n.length, e > t.length && (t += w(t, e / t.length)), t.slice(0, e) + String(n));
|
|
883
|
+
}
|
|
884
|
+
var yt = function(r, e, t) {
|
|
885
|
+
var n = r.split(e);
|
|
886
|
+
return t ? n.slice(0, t).concat([n.slice(t).join(e)]) : n;
|
|
887
|
+
}, R = function(r, e) {
|
|
888
|
+
var t = r % e;
|
|
889
|
+
return t * e < 0 ? t + e : t;
|
|
890
|
+
}, ie = function(r, e) {
|
|
891
|
+
return { div: Math.floor(r / e), mod: R(r, e) };
|
|
892
|
+
}, C = function(r) {
|
|
893
|
+
return !S(r) || r.length === 0;
|
|
894
|
+
}, _ = function(r) {
|
|
895
|
+
return !C(r);
|
|
896
|
+
}, k = function(r, e) {
|
|
897
|
+
return _(r) && r.indexOf(e) !== -1;
|
|
898
|
+
}, F = function(r, e, t, n, i, s) {
|
|
899
|
+
return n === void 0 && (n = 0), i === void 0 && (i = 0), s === void 0 && (s = 0), new Date(Date.UTC(r, e - 1, t, n, i, s));
|
|
900
|
+
}, mt = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31], Fe = 1e3 * 60 * 60 * 24, Be = 9999, Ke = F(1970, 1, 1), vt = [6, 0, 1, 2, 3, 4, 5], J = function(r) {
|
|
901
|
+
return r % 4 === 0 && r % 100 !== 0 || r % 400 === 0;
|
|
902
|
+
}, Ze = function(r) {
|
|
903
|
+
return r instanceof Date;
|
|
904
|
+
}, G = function(r) {
|
|
905
|
+
return Ze(r) && !isNaN(r.getTime());
|
|
906
|
+
}, pt = function(r, e) {
|
|
907
|
+
var t = r.getTime(), n = e.getTime(), i = t - n;
|
|
908
|
+
return Math.round(i / Fe);
|
|
909
|
+
}, ue = function(r) {
|
|
910
|
+
return pt(r, Ke);
|
|
911
|
+
}, qe = function(r) {
|
|
912
|
+
return new Date(Ke.getTime() + r * Fe);
|
|
913
|
+
}, bt = function(r) {
|
|
914
|
+
var e = r.getUTCMonth();
|
|
915
|
+
return e === 1 && J(r.getUTCFullYear()) ? 29 : mt[e];
|
|
916
|
+
}, Z = function(r) {
|
|
917
|
+
return vt[r.getUTCDay()];
|
|
918
|
+
}, De = function(r, e) {
|
|
919
|
+
var t = F(r, e + 1, 1);
|
|
920
|
+
return [Z(t), bt(t)];
|
|
921
|
+
}, Ge = function(r, e) {
|
|
922
|
+
return e = e || r, new Date(Date.UTC(r.getUTCFullYear(), r.getUTCMonth(), r.getUTCDate(), e.getHours(), e.getMinutes(), e.getSeconds(), e.getMilliseconds()));
|
|
923
|
+
}, ce = function(r) {
|
|
924
|
+
var e = new Date(r.getTime());
|
|
925
|
+
return e;
|
|
926
|
+
}, Ie = function(r) {
|
|
927
|
+
for (var e = [], t = 0; t < r.length; t++)
|
|
928
|
+
e.push(ce(r[t]));
|
|
929
|
+
return e;
|
|
930
|
+
}, V = function(r) {
|
|
931
|
+
r.sort(function(e, t) {
|
|
932
|
+
return e.getTime() - t.getTime();
|
|
933
|
+
});
|
|
934
|
+
}, me = function(r, e) {
|
|
935
|
+
e === void 0 && (e = !0);
|
|
936
|
+
var t = new Date(r);
|
|
937
|
+
return [
|
|
938
|
+
B(t.getUTCFullYear().toString(), 4, "0"),
|
|
939
|
+
B(t.getUTCMonth() + 1, 2, "0"),
|
|
940
|
+
B(t.getUTCDate(), 2, "0"),
|
|
941
|
+
"T",
|
|
942
|
+
B(t.getUTCHours(), 2, "0"),
|
|
943
|
+
B(t.getUTCMinutes(), 2, "0"),
|
|
944
|
+
B(t.getUTCSeconds(), 2, "0"),
|
|
945
|
+
e ? "Z" : ""
|
|
946
|
+
].join("");
|
|
947
|
+
}, ve = function(r) {
|
|
948
|
+
var e = /^(\d{4})(\d{2})(\d{2})(T(\d{2})(\d{2})(\d{2})Z?)?$/, t = e.exec(r);
|
|
949
|
+
if (!t)
|
|
950
|
+
throw new Error("Invalid UNTIL value: ".concat(r));
|
|
951
|
+
return new Date(Date.UTC(parseInt(t[1], 10), parseInt(t[2], 10) - 1, parseInt(t[3], 10), parseInt(t[5], 10) || 0, parseInt(t[6], 10) || 0, parseInt(t[7], 10) || 0));
|
|
952
|
+
}, _e = function(r, e) {
|
|
953
|
+
var t = r.toLocaleString("sv-SE", { timeZone: e });
|
|
954
|
+
return t.replace(" ", "T") + "Z";
|
|
955
|
+
}, gt = function(r, e) {
|
|
956
|
+
var t = Intl.DateTimeFormat().resolvedOptions().timeZone, n = new Date(_e(r, t)), i = new Date(_e(r, e ?? "UTC")), s = i.getTime() - n.getTime();
|
|
957
|
+
return new Date(r.getTime() - s);
|
|
958
|
+
}, K = (
|
|
959
|
+
/** @class */
|
|
960
|
+
(function() {
|
|
961
|
+
function r(e, t) {
|
|
962
|
+
this.minDate = null, this.maxDate = null, this._result = [], this.total = 0, this.method = e, this.args = t, e === "between" ? (this.maxDate = t.inc ? t.before : new Date(t.before.getTime() - 1), this.minDate = t.inc ? t.after : new Date(t.after.getTime() + 1)) : e === "before" ? this.maxDate = t.inc ? t.dt : new Date(t.dt.getTime() - 1) : e === "after" && (this.minDate = t.inc ? t.dt : new Date(t.dt.getTime() + 1));
|
|
963
|
+
}
|
|
964
|
+
return r.prototype.accept = function(e) {
|
|
965
|
+
++this.total;
|
|
966
|
+
var t = this.minDate && e < this.minDate, n = this.maxDate && e > this.maxDate;
|
|
967
|
+
if (this.method === "between") {
|
|
968
|
+
if (t)
|
|
969
|
+
return !0;
|
|
970
|
+
if (n)
|
|
971
|
+
return !1;
|
|
972
|
+
} else if (this.method === "before") {
|
|
973
|
+
if (n)
|
|
974
|
+
return !1;
|
|
975
|
+
} else if (this.method === "after")
|
|
976
|
+
return t ? !0 : (this.add(e), !1);
|
|
977
|
+
return this.add(e);
|
|
978
|
+
}, r.prototype.add = function(e) {
|
|
979
|
+
return this._result.push(e), !0;
|
|
980
|
+
}, r.prototype.getValue = function() {
|
|
981
|
+
var e = this._result;
|
|
982
|
+
switch (this.method) {
|
|
983
|
+
case "all":
|
|
984
|
+
case "between":
|
|
985
|
+
return e;
|
|
986
|
+
default:
|
|
987
|
+
return e.length ? e[e.length - 1] : null;
|
|
988
|
+
}
|
|
989
|
+
}, r.prototype.clone = function() {
|
|
990
|
+
return new r(this.method, this.args);
|
|
991
|
+
}, r;
|
|
992
|
+
})()
|
|
993
|
+
), le = function(r, e) {
|
|
994
|
+
return le = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(t, n) {
|
|
995
|
+
t.__proto__ = n;
|
|
996
|
+
} || function(t, n) {
|
|
997
|
+
for (var i in n) Object.prototype.hasOwnProperty.call(n, i) && (t[i] = n[i]);
|
|
998
|
+
}, le(r, e);
|
|
999
|
+
};
|
|
1000
|
+
function pe(r, e) {
|
|
1001
|
+
if (typeof e != "function" && e !== null)
|
|
1002
|
+
throw new TypeError("Class extends value " + String(e) + " is not a constructor or null");
|
|
1003
|
+
le(r, e);
|
|
1004
|
+
function t() {
|
|
1005
|
+
this.constructor = r;
|
|
1006
|
+
}
|
|
1007
|
+
r.prototype = e === null ? Object.create(e) : (t.prototype = e.prototype, new t());
|
|
1008
|
+
}
|
|
1009
|
+
var U = function() {
|
|
1010
|
+
return U = Object.assign || function(e) {
|
|
1011
|
+
for (var t, n = 1, i = arguments.length; n < i; n++) {
|
|
1012
|
+
t = arguments[n];
|
|
1013
|
+
for (var s in t) Object.prototype.hasOwnProperty.call(t, s) && (e[s] = t[s]);
|
|
1014
|
+
}
|
|
1015
|
+
return e;
|
|
1016
|
+
}, U.apply(this, arguments);
|
|
1017
|
+
};
|
|
1018
|
+
function f(r, e, t) {
|
|
1019
|
+
if (t || arguments.length === 2) for (var n = 0, i = e.length, s; n < i; n++)
|
|
1020
|
+
(s || !(n in e)) && (s || (s = Array.prototype.slice.call(e, 0, n)), s[n] = e[n]);
|
|
1021
|
+
return r.concat(s || Array.prototype.slice.call(e));
|
|
1022
|
+
}
|
|
1023
|
+
var Oe = (
|
|
1024
|
+
/** @class */
|
|
1025
|
+
(function(r) {
|
|
1026
|
+
pe(e, r);
|
|
1027
|
+
function e(t, n, i) {
|
|
1028
|
+
var s = r.call(this, t, n) || this;
|
|
1029
|
+
return s.iterator = i, s;
|
|
1030
|
+
}
|
|
1031
|
+
return e.prototype.add = function(t) {
|
|
1032
|
+
return this.iterator(t, this._result.length) ? (this._result.push(t), !0) : !1;
|
|
1033
|
+
}, e;
|
|
1034
|
+
})(K)
|
|
1035
|
+
), ee = {
|
|
1036
|
+
dayNames: [
|
|
1037
|
+
"Sunday",
|
|
1038
|
+
"Monday",
|
|
1039
|
+
"Tuesday",
|
|
1040
|
+
"Wednesday",
|
|
1041
|
+
"Thursday",
|
|
1042
|
+
"Friday",
|
|
1043
|
+
"Saturday"
|
|
1044
|
+
],
|
|
1045
|
+
monthNames: [
|
|
1046
|
+
"January",
|
|
1047
|
+
"February",
|
|
1048
|
+
"March",
|
|
1049
|
+
"April",
|
|
1050
|
+
"May",
|
|
1051
|
+
"June",
|
|
1052
|
+
"July",
|
|
1053
|
+
"August",
|
|
1054
|
+
"September",
|
|
1055
|
+
"October",
|
|
1056
|
+
"November",
|
|
1057
|
+
"December"
|
|
1058
|
+
],
|
|
1059
|
+
tokens: {
|
|
1060
|
+
SKIP: /^[ \r\n\t]+|^\.$/,
|
|
1061
|
+
number: /^[1-9][0-9]*/,
|
|
1062
|
+
numberAsText: /^(one|two|three)/i,
|
|
1063
|
+
every: /^every/i,
|
|
1064
|
+
"day(s)": /^days?/i,
|
|
1065
|
+
"weekday(s)": /^weekdays?/i,
|
|
1066
|
+
"week(s)": /^weeks?/i,
|
|
1067
|
+
"hour(s)": /^hours?/i,
|
|
1068
|
+
"minute(s)": /^minutes?/i,
|
|
1069
|
+
"month(s)": /^months?/i,
|
|
1070
|
+
"year(s)": /^years?/i,
|
|
1071
|
+
on: /^(on|in)/i,
|
|
1072
|
+
at: /^(at)/i,
|
|
1073
|
+
the: /^the/i,
|
|
1074
|
+
first: /^first/i,
|
|
1075
|
+
second: /^second/i,
|
|
1076
|
+
third: /^third/i,
|
|
1077
|
+
nth: /^([1-9][0-9]*)(\.|th|nd|rd|st)/i,
|
|
1078
|
+
last: /^last/i,
|
|
1079
|
+
for: /^for/i,
|
|
1080
|
+
"time(s)": /^times?/i,
|
|
1081
|
+
until: /^(un)?til/i,
|
|
1082
|
+
monday: /^mo(n(day)?)?/i,
|
|
1083
|
+
tuesday: /^tu(e(s(day)?)?)?/i,
|
|
1084
|
+
wednesday: /^we(d(n(esday)?)?)?/i,
|
|
1085
|
+
thursday: /^th(u(r(sday)?)?)?/i,
|
|
1086
|
+
friday: /^fr(i(day)?)?/i,
|
|
1087
|
+
saturday: /^sa(t(urday)?)?/i,
|
|
1088
|
+
sunday: /^su(n(day)?)?/i,
|
|
1089
|
+
january: /^jan(uary)?/i,
|
|
1090
|
+
february: /^feb(ruary)?/i,
|
|
1091
|
+
march: /^mar(ch)?/i,
|
|
1092
|
+
april: /^apr(il)?/i,
|
|
1093
|
+
may: /^may/i,
|
|
1094
|
+
june: /^june?/i,
|
|
1095
|
+
july: /^july?/i,
|
|
1096
|
+
august: /^aug(ust)?/i,
|
|
1097
|
+
september: /^sep(t(ember)?)?/i,
|
|
1098
|
+
october: /^oct(ober)?/i,
|
|
1099
|
+
november: /^nov(ember)?/i,
|
|
1100
|
+
december: /^dec(ember)?/i,
|
|
1101
|
+
comma: /^(,\s*|(and|or)\s*)+/i
|
|
1102
|
+
}
|
|
1103
|
+
}, xe = function(r, e) {
|
|
1104
|
+
return r.indexOf(e) !== -1;
|
|
1105
|
+
}, wt = function(r) {
|
|
1106
|
+
return r.toString();
|
|
1107
|
+
}, Tt = function(r, e, t) {
|
|
1108
|
+
return "".concat(e, " ").concat(t, ", ").concat(r);
|
|
1109
|
+
}, P = (
|
|
1110
|
+
/** @class */
|
|
1111
|
+
(function() {
|
|
1112
|
+
function r(e, t, n, i) {
|
|
1113
|
+
if (t === void 0 && (t = wt), n === void 0 && (n = ee), i === void 0 && (i = Tt), this.text = [], this.language = n || ee, this.gettext = t, this.dateFormatter = i, this.rrule = e, this.options = e.options, this.origOptions = e.origOptions, this.origOptions.bymonthday) {
|
|
1114
|
+
var s = [].concat(this.options.bymonthday), a = [].concat(this.options.bynmonthday);
|
|
1115
|
+
s.sort(function(d, h) {
|
|
1116
|
+
return d - h;
|
|
1117
|
+
}), a.sort(function(d, h) {
|
|
1118
|
+
return h - d;
|
|
1119
|
+
}), this.bymonthday = s.concat(a), this.bymonthday.length || (this.bymonthday = null);
|
|
1120
|
+
}
|
|
1121
|
+
if (S(this.origOptions.byweekday)) {
|
|
1122
|
+
var o = A(this.origOptions.byweekday) ? this.origOptions.byweekday : [this.origOptions.byweekday], u = String(o);
|
|
1123
|
+
this.byweekday = {
|
|
1124
|
+
allWeeks: o.filter(function(d) {
|
|
1125
|
+
return !d.n;
|
|
1126
|
+
}),
|
|
1127
|
+
someWeeks: o.filter(function(d) {
|
|
1128
|
+
return !!d.n;
|
|
1129
|
+
}),
|
|
1130
|
+
isWeekdays: u.indexOf("MO") !== -1 && u.indexOf("TU") !== -1 && u.indexOf("WE") !== -1 && u.indexOf("TH") !== -1 && u.indexOf("FR") !== -1 && u.indexOf("SA") === -1 && u.indexOf("SU") === -1,
|
|
1131
|
+
isEveryDay: u.indexOf("MO") !== -1 && u.indexOf("TU") !== -1 && u.indexOf("WE") !== -1 && u.indexOf("TH") !== -1 && u.indexOf("FR") !== -1 && u.indexOf("SA") !== -1 && u.indexOf("SU") !== -1
|
|
1132
|
+
};
|
|
1133
|
+
var c = function(d, h) {
|
|
1134
|
+
return d.weekday - h.weekday;
|
|
1135
|
+
};
|
|
1136
|
+
this.byweekday.allWeeks.sort(c), this.byweekday.someWeeks.sort(c), this.byweekday.allWeeks.length || (this.byweekday.allWeeks = null), this.byweekday.someWeeks.length || (this.byweekday.someWeeks = null);
|
|
1137
|
+
} else
|
|
1138
|
+
this.byweekday = null;
|
|
1139
|
+
}
|
|
1140
|
+
return r.isFullyConvertible = function(e) {
|
|
1141
|
+
var t = !0;
|
|
1142
|
+
if (!(e.options.freq in r.IMPLEMENTED) || e.origOptions.until && e.origOptions.count)
|
|
1143
|
+
return !1;
|
|
1144
|
+
for (var n in e.origOptions) {
|
|
1145
|
+
if (xe(["dtstart", "tzid", "wkst", "freq"], n))
|
|
1146
|
+
return !0;
|
|
1147
|
+
if (!xe(r.IMPLEMENTED[e.options.freq], n))
|
|
1148
|
+
return !1;
|
|
1149
|
+
}
|
|
1150
|
+
return t;
|
|
1151
|
+
}, r.prototype.isFullyConvertible = function() {
|
|
1152
|
+
return r.isFullyConvertible(this.rrule);
|
|
1153
|
+
}, r.prototype.toString = function() {
|
|
1154
|
+
var e = this.gettext;
|
|
1155
|
+
if (!(this.options.freq in r.IMPLEMENTED))
|
|
1156
|
+
return e("RRule error: Unable to fully convert this rrule to text");
|
|
1157
|
+
if (this.text = [e("every")], this[v.FREQUENCIES[this.options.freq]](), this.options.until) {
|
|
1158
|
+
this.add(e("until"));
|
|
1159
|
+
var t = this.options.until;
|
|
1160
|
+
this.add(this.dateFormatter(t.getUTCFullYear(), this.language.monthNames[t.getUTCMonth()], t.getUTCDate()));
|
|
1161
|
+
} else this.options.count && this.add(e("for")).add(this.options.count.toString()).add(this.plural(this.options.count) ? e("times") : e("time"));
|
|
1162
|
+
return this.isFullyConvertible() || this.add(e("(~ approximate)")), this.text.join("");
|
|
1163
|
+
}, r.prototype.HOURLY = function() {
|
|
1164
|
+
var e = this.gettext;
|
|
1165
|
+
this.options.interval !== 1 && this.add(this.options.interval.toString()), this.add(this.plural(this.options.interval) ? e("hours") : e("hour"));
|
|
1166
|
+
}, r.prototype.MINUTELY = function() {
|
|
1167
|
+
var e = this.gettext;
|
|
1168
|
+
this.options.interval !== 1 && this.add(this.options.interval.toString()), this.add(this.plural(this.options.interval) ? e("minutes") : e("minute"));
|
|
1169
|
+
}, r.prototype.DAILY = function() {
|
|
1170
|
+
var e = this.gettext;
|
|
1171
|
+
this.options.interval !== 1 && this.add(this.options.interval.toString()), this.byweekday && this.byweekday.isWeekdays ? this.add(this.plural(this.options.interval) ? e("weekdays") : e("weekday")) : this.add(this.plural(this.options.interval) ? e("days") : e("day")), this.origOptions.bymonth && (this.add(e("in")), this._bymonth()), this.bymonthday ? this._bymonthday() : this.byweekday ? this._byweekday() : this.origOptions.byhour && this._byhour();
|
|
1172
|
+
}, r.prototype.WEEKLY = function() {
|
|
1173
|
+
var e = this.gettext;
|
|
1174
|
+
this.options.interval !== 1 && this.add(this.options.interval.toString()).add(this.plural(this.options.interval) ? e("weeks") : e("week")), this.byweekday && this.byweekday.isWeekdays ? this.options.interval === 1 ? this.add(this.plural(this.options.interval) ? e("weekdays") : e("weekday")) : this.add(e("on")).add(e("weekdays")) : this.byweekday && this.byweekday.isEveryDay ? this.add(this.plural(this.options.interval) ? e("days") : e("day")) : (this.options.interval === 1 && this.add(e("week")), this.origOptions.bymonth && (this.add(e("in")), this._bymonth()), this.bymonthday ? this._bymonthday() : this.byweekday && this._byweekday(), this.origOptions.byhour && this._byhour());
|
|
1175
|
+
}, r.prototype.MONTHLY = function() {
|
|
1176
|
+
var e = this.gettext;
|
|
1177
|
+
this.origOptions.bymonth ? (this.options.interval !== 1 && (this.add(this.options.interval.toString()).add(e("months")), this.plural(this.options.interval) && this.add(e("in"))), this._bymonth()) : (this.options.interval !== 1 && this.add(this.options.interval.toString()), this.add(this.plural(this.options.interval) ? e("months") : e("month"))), this.bymonthday ? this._bymonthday() : this.byweekday && this.byweekday.isWeekdays ? this.add(e("on")).add(e("weekdays")) : this.byweekday && this._byweekday();
|
|
1178
|
+
}, r.prototype.YEARLY = function() {
|
|
1179
|
+
var e = this.gettext;
|
|
1180
|
+
this.origOptions.bymonth ? (this.options.interval !== 1 && (this.add(this.options.interval.toString()), this.add(e("years"))), this._bymonth()) : (this.options.interval !== 1 && this.add(this.options.interval.toString()), this.add(this.plural(this.options.interval) ? e("years") : e("year"))), this.bymonthday ? this._bymonthday() : this.byweekday && this._byweekday(), this.options.byyearday && this.add(e("on the")).add(this.list(this.options.byyearday, this.nth, e("and"))).add(e("day")), this.options.byweekno && this.add(e("in")).add(this.plural(this.options.byweekno.length) ? e("weeks") : e("week")).add(this.list(this.options.byweekno, void 0, e("and")));
|
|
1181
|
+
}, r.prototype._bymonthday = function() {
|
|
1182
|
+
var e = this.gettext;
|
|
1183
|
+
this.byweekday && this.byweekday.allWeeks ? this.add(e("on")).add(this.list(this.byweekday.allWeeks, this.weekdaytext, e("or"))).add(e("the")).add(this.list(this.bymonthday, this.nth, e("or"))) : this.add(e("on the")).add(this.list(this.bymonthday, this.nth, e("and")));
|
|
1184
|
+
}, r.prototype._byweekday = function() {
|
|
1185
|
+
var e = this.gettext;
|
|
1186
|
+
this.byweekday.allWeeks && !this.byweekday.isWeekdays && this.add(e("on")).add(this.list(this.byweekday.allWeeks, this.weekdaytext)), this.byweekday.someWeeks && (this.byweekday.allWeeks && this.add(e("and")), this.add(e("on the")).add(this.list(this.byweekday.someWeeks, this.weekdaytext, e("and"))));
|
|
1187
|
+
}, r.prototype._byhour = function() {
|
|
1188
|
+
var e = this.gettext;
|
|
1189
|
+
this.add(e("at")).add(this.list(this.origOptions.byhour, void 0, e("and")));
|
|
1190
|
+
}, r.prototype._bymonth = function() {
|
|
1191
|
+
this.add(this.list(this.options.bymonth, this.monthtext, this.gettext("and")));
|
|
1192
|
+
}, r.prototype.nth = function(e) {
|
|
1193
|
+
e = parseInt(e.toString(), 10);
|
|
1194
|
+
var t, n = this.gettext;
|
|
1195
|
+
if (e === -1)
|
|
1196
|
+
return n("last");
|
|
1197
|
+
var i = Math.abs(e);
|
|
1198
|
+
switch (i) {
|
|
1199
|
+
case 1:
|
|
1200
|
+
case 21:
|
|
1201
|
+
case 31:
|
|
1202
|
+
t = i + n("st");
|
|
1203
|
+
break;
|
|
1204
|
+
case 2:
|
|
1205
|
+
case 22:
|
|
1206
|
+
t = i + n("nd");
|
|
1207
|
+
break;
|
|
1208
|
+
case 3:
|
|
1209
|
+
case 23:
|
|
1210
|
+
t = i + n("rd");
|
|
1211
|
+
break;
|
|
1212
|
+
default:
|
|
1213
|
+
t = i + n("th");
|
|
1214
|
+
}
|
|
1215
|
+
return e < 0 ? t + " " + n("last") : t;
|
|
1216
|
+
}, r.prototype.monthtext = function(e) {
|
|
1217
|
+
return this.language.monthNames[e - 1];
|
|
1218
|
+
}, r.prototype.weekdaytext = function(e) {
|
|
1219
|
+
var t = N(e) ? (e + 1) % 7 : e.getJsWeekday();
|
|
1220
|
+
return (e.n ? this.nth(e.n) + " " : "") + this.language.dayNames[t];
|
|
1221
|
+
}, r.prototype.plural = function(e) {
|
|
1222
|
+
return e % 100 !== 1;
|
|
1223
|
+
}, r.prototype.add = function(e) {
|
|
1224
|
+
return this.text.push(" "), this.text.push(e), this;
|
|
1225
|
+
}, r.prototype.list = function(e, t, n, i) {
|
|
1226
|
+
var s = this;
|
|
1227
|
+
i === void 0 && (i = ","), A(e) || (e = [e]);
|
|
1228
|
+
var a = function(u, c, d) {
|
|
1229
|
+
for (var h = "", l = 0; l < u.length; l++)
|
|
1230
|
+
l !== 0 && (l === u.length - 1 ? h += " " + d + " " : h += c + " "), h += u[l];
|
|
1231
|
+
return h;
|
|
1232
|
+
};
|
|
1233
|
+
t = t || function(u) {
|
|
1234
|
+
return u.toString();
|
|
1235
|
+
};
|
|
1236
|
+
var o = function(u) {
|
|
1237
|
+
return t && t.call(s, u);
|
|
1238
|
+
};
|
|
1239
|
+
return n ? a(e.map(o), i, n) : e.map(o).join(i + " ");
|
|
1240
|
+
}, r;
|
|
1241
|
+
})()
|
|
1242
|
+
), Et = (
|
|
1243
|
+
/** @class */
|
|
1244
|
+
(function() {
|
|
1245
|
+
function r(e) {
|
|
1246
|
+
this.done = !0, this.rules = e;
|
|
1247
|
+
}
|
|
1248
|
+
return r.prototype.start = function(e) {
|
|
1249
|
+
return this.text = e, this.done = !1, this.nextSymbol();
|
|
1250
|
+
}, r.prototype.isDone = function() {
|
|
1251
|
+
return this.done && this.symbol === null;
|
|
1252
|
+
}, r.prototype.nextSymbol = function() {
|
|
1253
|
+
var e, t;
|
|
1254
|
+
this.symbol = null, this.value = null;
|
|
1255
|
+
do {
|
|
1256
|
+
if (this.done)
|
|
1257
|
+
return !1;
|
|
1258
|
+
var n = void 0;
|
|
1259
|
+
e = null;
|
|
1260
|
+
for (var i in this.rules) {
|
|
1261
|
+
n = this.rules[i];
|
|
1262
|
+
var s = n.exec(this.text);
|
|
1263
|
+
s && (e === null || s[0].length > e[0].length) && (e = s, t = i);
|
|
1264
|
+
}
|
|
1265
|
+
if (e != null && (this.text = this.text.substr(e[0].length), this.text === "" && (this.done = !0)), e == null) {
|
|
1266
|
+
this.done = !0, this.symbol = null, this.value = null;
|
|
1267
|
+
return;
|
|
1268
|
+
}
|
|
1269
|
+
} while (t === "SKIP");
|
|
1270
|
+
return this.symbol = t, this.value = e, !0;
|
|
1271
|
+
}, r.prototype.accept = function(e) {
|
|
1272
|
+
if (this.symbol === e) {
|
|
1273
|
+
if (this.value) {
|
|
1274
|
+
var t = this.value;
|
|
1275
|
+
return this.nextSymbol(), t;
|
|
1276
|
+
}
|
|
1277
|
+
return this.nextSymbol(), !0;
|
|
1278
|
+
}
|
|
1279
|
+
return !1;
|
|
1280
|
+
}, r.prototype.acceptNumber = function() {
|
|
1281
|
+
return this.accept("number");
|
|
1282
|
+
}, r.prototype.expect = function(e) {
|
|
1283
|
+
if (this.accept(e))
|
|
1284
|
+
return !0;
|
|
1285
|
+
throw new Error("expected " + e + " but found " + this.symbol);
|
|
1286
|
+
}, r;
|
|
1287
|
+
})()
|
|
1288
|
+
);
|
|
1289
|
+
function Je(r, e) {
|
|
1290
|
+
e === void 0 && (e = ee);
|
|
1291
|
+
var t = {}, n = new Et(e.tokens);
|
|
1292
|
+
if (!n.start(r))
|
|
1293
|
+
return null;
|
|
1294
|
+
return i(), t;
|
|
1295
|
+
function i() {
|
|
1296
|
+
n.expect("every");
|
|
1297
|
+
var l = n.acceptNumber();
|
|
1298
|
+
if (l && (t.interval = parseInt(l[0], 10)), n.isDone())
|
|
1299
|
+
throw new Error("Unexpected end");
|
|
1300
|
+
switch (n.symbol) {
|
|
1301
|
+
case "day(s)":
|
|
1302
|
+
t.freq = v.DAILY, n.nextSymbol() && (a(), h());
|
|
1303
|
+
break;
|
|
1304
|
+
// FIXME Note: every 2 weekdays != every two weeks on weekdays.
|
|
1305
|
+
// DAILY on weekdays is not a valid rule
|
|
1306
|
+
case "weekday(s)":
|
|
1307
|
+
t.freq = v.WEEKLY, t.byweekday = [v.MO, v.TU, v.WE, v.TH, v.FR], n.nextSymbol(), a(), h();
|
|
1308
|
+
break;
|
|
1309
|
+
case "week(s)":
|
|
1310
|
+
t.freq = v.WEEKLY, n.nextSymbol() && (s(), a(), h());
|
|
1311
|
+
break;
|
|
1312
|
+
case "hour(s)":
|
|
1313
|
+
t.freq = v.HOURLY, n.nextSymbol() && (s(), h());
|
|
1314
|
+
break;
|
|
1315
|
+
case "minute(s)":
|
|
1316
|
+
t.freq = v.MINUTELY, n.nextSymbol() && (s(), h());
|
|
1317
|
+
break;
|
|
1318
|
+
case "month(s)":
|
|
1319
|
+
t.freq = v.MONTHLY, n.nextSymbol() && (s(), h());
|
|
1320
|
+
break;
|
|
1321
|
+
case "year(s)":
|
|
1322
|
+
t.freq = v.YEARLY, n.nextSymbol() && (s(), h());
|
|
1323
|
+
break;
|
|
1324
|
+
case "monday":
|
|
1325
|
+
case "tuesday":
|
|
1326
|
+
case "wednesday":
|
|
1327
|
+
case "thursday":
|
|
1328
|
+
case "friday":
|
|
1329
|
+
case "saturday":
|
|
1330
|
+
case "sunday":
|
|
1331
|
+
t.freq = v.WEEKLY;
|
|
1332
|
+
var y = n.symbol.substr(0, 2).toUpperCase();
|
|
1333
|
+
if (t.byweekday = [v[y]], !n.nextSymbol())
|
|
1334
|
+
return;
|
|
1335
|
+
for (; n.accept("comma"); ) {
|
|
1336
|
+
if (n.isDone())
|
|
1337
|
+
throw new Error("Unexpected end");
|
|
1338
|
+
var m = u();
|
|
1339
|
+
if (!m)
|
|
1340
|
+
throw new Error("Unexpected symbol " + n.symbol + ", expected weekday");
|
|
1341
|
+
t.byweekday.push(v[m]), n.nextSymbol();
|
|
1342
|
+
}
|
|
1343
|
+
a(), d(), h();
|
|
1344
|
+
break;
|
|
1345
|
+
case "january":
|
|
1346
|
+
case "february":
|
|
1347
|
+
case "march":
|
|
1348
|
+
case "april":
|
|
1349
|
+
case "may":
|
|
1350
|
+
case "june":
|
|
1351
|
+
case "july":
|
|
1352
|
+
case "august":
|
|
1353
|
+
case "september":
|
|
1354
|
+
case "october":
|
|
1355
|
+
case "november":
|
|
1356
|
+
case "december":
|
|
1357
|
+
if (t.freq = v.YEARLY, t.bymonth = [o()], !n.nextSymbol())
|
|
1358
|
+
return;
|
|
1359
|
+
for (; n.accept("comma"); ) {
|
|
1360
|
+
if (n.isDone())
|
|
1361
|
+
throw new Error("Unexpected end");
|
|
1362
|
+
var p = o();
|
|
1363
|
+
if (!p)
|
|
1364
|
+
throw new Error("Unexpected symbol " + n.symbol + ", expected month");
|
|
1365
|
+
t.bymonth.push(p), n.nextSymbol();
|
|
1366
|
+
}
|
|
1367
|
+
s(), h();
|
|
1368
|
+
break;
|
|
1369
|
+
default:
|
|
1370
|
+
throw new Error("Unknown symbol");
|
|
1371
|
+
}
|
|
1372
|
+
}
|
|
1373
|
+
function s() {
|
|
1374
|
+
var l = n.accept("on"), y = n.accept("the");
|
|
1375
|
+
if (l || y)
|
|
1376
|
+
do {
|
|
1377
|
+
var m = c(), p = u(), b = o();
|
|
1378
|
+
if (m)
|
|
1379
|
+
p ? (n.nextSymbol(), t.byweekday || (t.byweekday = []), t.byweekday.push(v[p].nth(m))) : (t.bymonthday || (t.bymonthday = []), t.bymonthday.push(m), n.accept("day(s)"));
|
|
1380
|
+
else if (p)
|
|
1381
|
+
n.nextSymbol(), t.byweekday || (t.byweekday = []), t.byweekday.push(v[p]);
|
|
1382
|
+
else if (n.symbol === "weekday(s)")
|
|
1383
|
+
n.nextSymbol(), t.byweekday || (t.byweekday = [v.MO, v.TU, v.WE, v.TH, v.FR]);
|
|
1384
|
+
else if (n.symbol === "week(s)") {
|
|
1385
|
+
n.nextSymbol();
|
|
1386
|
+
var E = n.acceptNumber();
|
|
1387
|
+
if (!E)
|
|
1388
|
+
throw new Error("Unexpected symbol " + n.symbol + ", expected week number");
|
|
1389
|
+
for (t.byweekno = [parseInt(E[0], 10)]; n.accept("comma"); ) {
|
|
1390
|
+
if (E = n.acceptNumber(), !E)
|
|
1391
|
+
throw new Error("Unexpected symbol " + n.symbol + "; expected monthday");
|
|
1392
|
+
t.byweekno.push(parseInt(E[0], 10));
|
|
1393
|
+
}
|
|
1394
|
+
} else if (b)
|
|
1395
|
+
n.nextSymbol(), t.bymonth || (t.bymonth = []), t.bymonth.push(b);
|
|
1396
|
+
else
|
|
1397
|
+
return;
|
|
1398
|
+
} while (n.accept("comma") || n.accept("the") || n.accept("on"));
|
|
1399
|
+
}
|
|
1400
|
+
function a() {
|
|
1401
|
+
var l = n.accept("at");
|
|
1402
|
+
if (l)
|
|
1403
|
+
do {
|
|
1404
|
+
var y = n.acceptNumber();
|
|
1405
|
+
if (!y)
|
|
1406
|
+
throw new Error("Unexpected symbol " + n.symbol + ", expected hour");
|
|
1407
|
+
for (t.byhour = [parseInt(y[0], 10)]; n.accept("comma"); ) {
|
|
1408
|
+
if (y = n.acceptNumber(), !y)
|
|
1409
|
+
throw new Error("Unexpected symbol " + n.symbol + "; expected hour");
|
|
1410
|
+
t.byhour.push(parseInt(y[0], 10));
|
|
1411
|
+
}
|
|
1412
|
+
} while (n.accept("comma") || n.accept("at"));
|
|
1413
|
+
}
|
|
1414
|
+
function o() {
|
|
1415
|
+
switch (n.symbol) {
|
|
1416
|
+
case "january":
|
|
1417
|
+
return 1;
|
|
1418
|
+
case "february":
|
|
1419
|
+
return 2;
|
|
1420
|
+
case "march":
|
|
1421
|
+
return 3;
|
|
1422
|
+
case "april":
|
|
1423
|
+
return 4;
|
|
1424
|
+
case "may":
|
|
1425
|
+
return 5;
|
|
1426
|
+
case "june":
|
|
1427
|
+
return 6;
|
|
1428
|
+
case "july":
|
|
1429
|
+
return 7;
|
|
1430
|
+
case "august":
|
|
1431
|
+
return 8;
|
|
1432
|
+
case "september":
|
|
1433
|
+
return 9;
|
|
1434
|
+
case "october":
|
|
1435
|
+
return 10;
|
|
1436
|
+
case "november":
|
|
1437
|
+
return 11;
|
|
1438
|
+
case "december":
|
|
1439
|
+
return 12;
|
|
1440
|
+
default:
|
|
1441
|
+
return !1;
|
|
1442
|
+
}
|
|
1443
|
+
}
|
|
1444
|
+
function u() {
|
|
1445
|
+
switch (n.symbol) {
|
|
1446
|
+
case "monday":
|
|
1447
|
+
case "tuesday":
|
|
1448
|
+
case "wednesday":
|
|
1449
|
+
case "thursday":
|
|
1450
|
+
case "friday":
|
|
1451
|
+
case "saturday":
|
|
1452
|
+
case "sunday":
|
|
1453
|
+
return n.symbol.substr(0, 2).toUpperCase();
|
|
1454
|
+
default:
|
|
1455
|
+
return !1;
|
|
1456
|
+
}
|
|
1457
|
+
}
|
|
1458
|
+
function c() {
|
|
1459
|
+
switch (n.symbol) {
|
|
1460
|
+
case "last":
|
|
1461
|
+
return n.nextSymbol(), -1;
|
|
1462
|
+
case "first":
|
|
1463
|
+
return n.nextSymbol(), 1;
|
|
1464
|
+
case "second":
|
|
1465
|
+
return n.nextSymbol(), n.accept("last") ? -2 : 2;
|
|
1466
|
+
case "third":
|
|
1467
|
+
return n.nextSymbol(), n.accept("last") ? -3 : 3;
|
|
1468
|
+
case "nth":
|
|
1469
|
+
var l = parseInt(n.value[1], 10);
|
|
1470
|
+
if (l < -366 || l > 366)
|
|
1471
|
+
throw new Error("Nth out of range: " + l);
|
|
1472
|
+
return n.nextSymbol(), n.accept("last") ? -l : l;
|
|
1473
|
+
default:
|
|
1474
|
+
return !1;
|
|
1475
|
+
}
|
|
1476
|
+
}
|
|
1477
|
+
function d() {
|
|
1478
|
+
n.accept("on"), n.accept("the");
|
|
1479
|
+
var l = c();
|
|
1480
|
+
if (l)
|
|
1481
|
+
for (t.bymonthday = [l], n.nextSymbol(); n.accept("comma"); ) {
|
|
1482
|
+
if (l = c(), !l)
|
|
1483
|
+
throw new Error("Unexpected symbol " + n.symbol + "; expected monthday");
|
|
1484
|
+
t.bymonthday.push(l), n.nextSymbol();
|
|
1485
|
+
}
|
|
1486
|
+
}
|
|
1487
|
+
function h() {
|
|
1488
|
+
if (n.symbol === "until") {
|
|
1489
|
+
var l = Date.parse(n.text);
|
|
1490
|
+
if (!l)
|
|
1491
|
+
throw new Error("Cannot parse until date:" + n.text);
|
|
1492
|
+
t.until = new Date(l);
|
|
1493
|
+
} else n.accept("for") && (t.count = parseInt(n.value[0], 10), n.expect("number"));
|
|
1494
|
+
}
|
|
1495
|
+
}
|
|
1496
|
+
var T;
|
|
1497
|
+
(function(r) {
|
|
1498
|
+
r[r.YEARLY = 0] = "YEARLY", r[r.MONTHLY = 1] = "MONTHLY", r[r.WEEKLY = 2] = "WEEKLY", r[r.DAILY = 3] = "DAILY", r[r.HOURLY = 4] = "HOURLY", r[r.MINUTELY = 5] = "MINUTELY", r[r.SECONDLY = 6] = "SECONDLY";
|
|
1499
|
+
})(T || (T = {}));
|
|
1500
|
+
function be(r) {
|
|
1501
|
+
return r < T.HOURLY;
|
|
1502
|
+
}
|
|
1503
|
+
var kt = function(r, e) {
|
|
1504
|
+
return e === void 0 && (e = ee), new v(Je(r, e) || void 0);
|
|
1505
|
+
}, q = [
|
|
1506
|
+
"count",
|
|
1507
|
+
"until",
|
|
1508
|
+
"interval",
|
|
1509
|
+
"byweekday",
|
|
1510
|
+
"bymonthday",
|
|
1511
|
+
"bymonth"
|
|
1512
|
+
];
|
|
1513
|
+
P.IMPLEMENTED = [];
|
|
1514
|
+
P.IMPLEMENTED[T.HOURLY] = q;
|
|
1515
|
+
P.IMPLEMENTED[T.MINUTELY] = q;
|
|
1516
|
+
P.IMPLEMENTED[T.DAILY] = ["byhour"].concat(q);
|
|
1517
|
+
P.IMPLEMENTED[T.WEEKLY] = q;
|
|
1518
|
+
P.IMPLEMENTED[T.MONTHLY] = q;
|
|
1519
|
+
P.IMPLEMENTED[T.YEARLY] = ["byweekno", "byyearday"].concat(q);
|
|
1520
|
+
var St = function(r, e, t, n) {
|
|
1521
|
+
return new P(r, e, t, n).toString();
|
|
1522
|
+
}, Dt = P.isFullyConvertible, te = (
|
|
1523
|
+
/** @class */
|
|
1524
|
+
(function() {
|
|
1525
|
+
function r(e, t, n, i) {
|
|
1526
|
+
this.hour = e, this.minute = t, this.second = n, this.millisecond = i || 0;
|
|
1527
|
+
}
|
|
1528
|
+
return r.prototype.getHours = function() {
|
|
1529
|
+
return this.hour;
|
|
1530
|
+
}, r.prototype.getMinutes = function() {
|
|
1531
|
+
return this.minute;
|
|
1532
|
+
}, r.prototype.getSeconds = function() {
|
|
1533
|
+
return this.second;
|
|
1534
|
+
}, r.prototype.getMilliseconds = function() {
|
|
1535
|
+
return this.millisecond;
|
|
1536
|
+
}, r.prototype.getTime = function() {
|
|
1537
|
+
return (this.hour * 60 * 60 + this.minute * 60 + this.second) * 1e3 + this.millisecond;
|
|
1538
|
+
}, r;
|
|
1539
|
+
})()
|
|
1540
|
+
), It = (
|
|
1541
|
+
/** @class */
|
|
1542
|
+
(function(r) {
|
|
1543
|
+
pe(e, r);
|
|
1544
|
+
function e(t, n, i, s, a, o, u) {
|
|
1545
|
+
var c = r.call(this, s, a, o, u) || this;
|
|
1546
|
+
return c.year = t, c.month = n, c.day = i, c;
|
|
1547
|
+
}
|
|
1548
|
+
return e.fromDate = function(t) {
|
|
1549
|
+
return new this(t.getUTCFullYear(), t.getUTCMonth() + 1, t.getUTCDate(), t.getUTCHours(), t.getUTCMinutes(), t.getUTCSeconds(), t.valueOf() % 1e3);
|
|
1550
|
+
}, e.prototype.getWeekday = function() {
|
|
1551
|
+
return Z(new Date(this.getTime()));
|
|
1552
|
+
}, e.prototype.getTime = function() {
|
|
1553
|
+
return new Date(Date.UTC(this.year, this.month - 1, this.day, this.hour, this.minute, this.second, this.millisecond)).getTime();
|
|
1554
|
+
}, e.prototype.getDay = function() {
|
|
1555
|
+
return this.day;
|
|
1556
|
+
}, e.prototype.getMonth = function() {
|
|
1557
|
+
return this.month;
|
|
1558
|
+
}, e.prototype.getYear = function() {
|
|
1559
|
+
return this.year;
|
|
1560
|
+
}, e.prototype.addYears = function(t) {
|
|
1561
|
+
this.year += t;
|
|
1562
|
+
}, e.prototype.addMonths = function(t) {
|
|
1563
|
+
if (this.month += t, this.month > 12) {
|
|
1564
|
+
var n = Math.floor(this.month / 12), i = R(this.month, 12);
|
|
1565
|
+
this.month = i, this.year += n, this.month === 0 && (this.month = 12, --this.year);
|
|
1566
|
+
}
|
|
1567
|
+
}, e.prototype.addWeekly = function(t, n) {
|
|
1568
|
+
n > this.getWeekday() ? this.day += -(this.getWeekday() + 1 + (6 - n)) + t * 7 : this.day += -(this.getWeekday() - n) + t * 7, this.fixDay();
|
|
1569
|
+
}, e.prototype.addDaily = function(t) {
|
|
1570
|
+
this.day += t, this.fixDay();
|
|
1571
|
+
}, e.prototype.addHours = function(t, n, i) {
|
|
1572
|
+
for (n && (this.hour += Math.floor((23 - this.hour) / t) * t); ; ) {
|
|
1573
|
+
this.hour += t;
|
|
1574
|
+
var s = ie(this.hour, 24), a = s.div, o = s.mod;
|
|
1575
|
+
if (a && (this.hour = o, this.addDaily(a)), C(i) || k(i, this.hour))
|
|
1576
|
+
break;
|
|
1577
|
+
}
|
|
1578
|
+
}, e.prototype.addMinutes = function(t, n, i, s) {
|
|
1579
|
+
for (n && (this.minute += Math.floor((1439 - (this.hour * 60 + this.minute)) / t) * t); ; ) {
|
|
1580
|
+
this.minute += t;
|
|
1581
|
+
var a = ie(this.minute, 60), o = a.div, u = a.mod;
|
|
1582
|
+
if (o && (this.minute = u, this.addHours(o, !1, i)), (C(i) || k(i, this.hour)) && (C(s) || k(s, this.minute)))
|
|
1583
|
+
break;
|
|
1584
|
+
}
|
|
1585
|
+
}, e.prototype.addSeconds = function(t, n, i, s, a) {
|
|
1586
|
+
for (n && (this.second += Math.floor((86399 - (this.hour * 3600 + this.minute * 60 + this.second)) / t) * t); ; ) {
|
|
1587
|
+
this.second += t;
|
|
1588
|
+
var o = ie(this.second, 60), u = o.div, c = o.mod;
|
|
1589
|
+
if (u && (this.second = c, this.addMinutes(u, !1, i, s)), (C(i) || k(i, this.hour)) && (C(s) || k(s, this.minute)) && (C(a) || k(a, this.second)))
|
|
1590
|
+
break;
|
|
1591
|
+
}
|
|
1592
|
+
}, e.prototype.fixDay = function() {
|
|
1593
|
+
if (!(this.day <= 28)) {
|
|
1594
|
+
var t = De(this.year, this.month - 1)[1];
|
|
1595
|
+
if (!(this.day <= t))
|
|
1596
|
+
for (; this.day > t; ) {
|
|
1597
|
+
if (this.day -= t, ++this.month, this.month === 13 && (this.month = 1, ++this.year, this.year > Be))
|
|
1598
|
+
return;
|
|
1599
|
+
t = De(this.year, this.month - 1)[1];
|
|
1600
|
+
}
|
|
1601
|
+
}
|
|
1602
|
+
}, e.prototype.add = function(t, n) {
|
|
1603
|
+
var i = t.freq, s = t.interval, a = t.wkst, o = t.byhour, u = t.byminute, c = t.bysecond;
|
|
1604
|
+
switch (i) {
|
|
1605
|
+
case T.YEARLY:
|
|
1606
|
+
return this.addYears(s);
|
|
1607
|
+
case T.MONTHLY:
|
|
1608
|
+
return this.addMonths(s);
|
|
1609
|
+
case T.WEEKLY:
|
|
1610
|
+
return this.addWeekly(s, a);
|
|
1611
|
+
case T.DAILY:
|
|
1612
|
+
return this.addDaily(s);
|
|
1613
|
+
case T.HOURLY:
|
|
1614
|
+
return this.addHours(s, n, o);
|
|
1615
|
+
case T.MINUTELY:
|
|
1616
|
+
return this.addMinutes(s, n, o, u);
|
|
1617
|
+
case T.SECONDLY:
|
|
1618
|
+
return this.addSeconds(s, n, o, u, c);
|
|
1619
|
+
}
|
|
1620
|
+
}, e;
|
|
1621
|
+
})(te)
|
|
1622
|
+
);
|
|
1623
|
+
function Xe(r) {
|
|
1624
|
+
for (var e = [], t = Object.keys(r), n = 0, i = t; n < i.length; n++) {
|
|
1625
|
+
var s = i[n];
|
|
1626
|
+
k(rr, s) || e.push(s), Ze(r[s]) && !G(r[s]) && e.push(s);
|
|
1627
|
+
}
|
|
1628
|
+
if (e.length)
|
|
1629
|
+
throw new Error("Invalid options: " + e.join(", "));
|
|
1630
|
+
return U({}, r);
|
|
1631
|
+
}
|
|
1632
|
+
function _t(r) {
|
|
1633
|
+
var e = U(U({}, ge), Xe(r));
|
|
1634
|
+
if (S(e.byeaster) && (e.freq = v.YEARLY), !(S(e.freq) && v.FREQUENCIES[e.freq]))
|
|
1635
|
+
throw new Error("Invalid frequency: ".concat(e.freq, " ").concat(r.freq));
|
|
1636
|
+
if (e.dtstart || (e.dtstart = new Date((/* @__PURE__ */ new Date()).setMilliseconds(0))), S(e.wkst) ? N(e.wkst) || (e.wkst = e.wkst.weekday) : e.wkst = v.MO.weekday, S(e.bysetpos)) {
|
|
1637
|
+
N(e.bysetpos) && (e.bysetpos = [e.bysetpos]);
|
|
1638
|
+
for (var t = 0; t < e.bysetpos.length; t++) {
|
|
1639
|
+
var n = e.bysetpos[t];
|
|
1640
|
+
if (n === 0 || !(n >= -366 && n <= 366))
|
|
1641
|
+
throw new Error("bysetpos must be between 1 and 366, or between -366 and -1");
|
|
1642
|
+
}
|
|
1643
|
+
}
|
|
1644
|
+
if (!(e.byweekno || _(e.byweekno) || _(e.byyearday) || e.bymonthday || _(e.bymonthday) || S(e.byweekday) || S(e.byeaster)))
|
|
1645
|
+
switch (e.freq) {
|
|
1646
|
+
case v.YEARLY:
|
|
1647
|
+
e.bymonth || (e.bymonth = e.dtstart.getUTCMonth() + 1), e.bymonthday = e.dtstart.getUTCDate();
|
|
1648
|
+
break;
|
|
1649
|
+
case v.MONTHLY:
|
|
1650
|
+
e.bymonthday = e.dtstart.getUTCDate();
|
|
1651
|
+
break;
|
|
1652
|
+
case v.WEEKLY:
|
|
1653
|
+
e.byweekday = [Z(e.dtstart)];
|
|
1654
|
+
break;
|
|
1655
|
+
}
|
|
1656
|
+
if (S(e.bymonth) && !A(e.bymonth) && (e.bymonth = [e.bymonth]), S(e.byyearday) && !A(e.byyearday) && N(e.byyearday) && (e.byyearday = [e.byyearday]), !S(e.bymonthday))
|
|
1657
|
+
e.bymonthday = [], e.bynmonthday = [];
|
|
1658
|
+
else if (A(e.bymonthday)) {
|
|
1659
|
+
for (var i = [], s = [], t = 0; t < e.bymonthday.length; t++) {
|
|
1660
|
+
var n = e.bymonthday[t];
|
|
1661
|
+
n > 0 ? i.push(n) : n < 0 && s.push(n);
|
|
1662
|
+
}
|
|
1663
|
+
e.bymonthday = i, e.bynmonthday = s;
|
|
1664
|
+
} else e.bymonthday < 0 ? (e.bynmonthday = [e.bymonthday], e.bymonthday = []) : (e.bynmonthday = [], e.bymonthday = [e.bymonthday]);
|
|
1665
|
+
if (S(e.byweekno) && !A(e.byweekno) && (e.byweekno = [e.byweekno]), !S(e.byweekday))
|
|
1666
|
+
e.bynweekday = null;
|
|
1667
|
+
else if (N(e.byweekday))
|
|
1668
|
+
e.byweekday = [e.byweekday], e.bynweekday = null;
|
|
1669
|
+
else if (Se(e.byweekday))
|
|
1670
|
+
e.byweekday = [M.fromStr(e.byweekday).weekday], e.bynweekday = null;
|
|
1671
|
+
else if (e.byweekday instanceof M)
|
|
1672
|
+
!e.byweekday.n || e.freq > v.MONTHLY ? (e.byweekday = [e.byweekday.weekday], e.bynweekday = null) : (e.bynweekday = [[e.byweekday.weekday, e.byweekday.n]], e.byweekday = null);
|
|
1673
|
+
else {
|
|
1674
|
+
for (var a = [], o = [], t = 0; t < e.byweekday.length; t++) {
|
|
1675
|
+
var u = e.byweekday[t];
|
|
1676
|
+
if (N(u)) {
|
|
1677
|
+
a.push(u);
|
|
1678
|
+
continue;
|
|
1679
|
+
} else if (Se(u)) {
|
|
1680
|
+
a.push(M.fromStr(u).weekday);
|
|
1681
|
+
continue;
|
|
1682
|
+
}
|
|
1683
|
+
!u.n || e.freq > v.MONTHLY ? a.push(u.weekday) : o.push([u.weekday, u.n]);
|
|
1684
|
+
}
|
|
1685
|
+
e.byweekday = _(a) ? a : null, e.bynweekday = _(o) ? o : null;
|
|
1686
|
+
}
|
|
1687
|
+
return S(e.byhour) ? N(e.byhour) && (e.byhour = [e.byhour]) : e.byhour = e.freq < v.HOURLY ? [e.dtstart.getUTCHours()] : null, S(e.byminute) ? N(e.byminute) && (e.byminute = [e.byminute]) : e.byminute = e.freq < v.MINUTELY ? [e.dtstart.getUTCMinutes()] : null, S(e.bysecond) ? N(e.bysecond) && (e.bysecond = [e.bysecond]) : e.bysecond = e.freq < v.SECONDLY ? [e.dtstart.getUTCSeconds()] : null, { parsedOptions: e };
|
|
1688
|
+
}
|
|
1689
|
+
function Ot(r) {
|
|
1690
|
+
var e = r.dtstart.getTime() % 1e3;
|
|
1691
|
+
if (!be(r.freq))
|
|
1692
|
+
return [];
|
|
1693
|
+
var t = [];
|
|
1694
|
+
return r.byhour.forEach(function(n) {
|
|
1695
|
+
r.byminute.forEach(function(i) {
|
|
1696
|
+
r.bysecond.forEach(function(s) {
|
|
1697
|
+
t.push(new te(n, i, s, e));
|
|
1698
|
+
});
|
|
1699
|
+
});
|
|
1700
|
+
}), t;
|
|
1701
|
+
}
|
|
1702
|
+
function de(r) {
|
|
1703
|
+
var e = r.split(`
|
|
1704
|
+
`).map(xt).filter(function(t) {
|
|
1705
|
+
return t !== null;
|
|
1706
|
+
});
|
|
1707
|
+
return U(U({}, e[0]), e[1]);
|
|
1708
|
+
}
|
|
1709
|
+
function re(r) {
|
|
1710
|
+
var e = {}, t = /DTSTART(?:;TZID=([^:=]+?))?(?::|=)([^;\s]+)/i.exec(r);
|
|
1711
|
+
if (!t)
|
|
1712
|
+
return e;
|
|
1713
|
+
var n = t[1], i = t[2];
|
|
1714
|
+
return n && (e.tzid = n), e.dtstart = ve(i), e;
|
|
1715
|
+
}
|
|
1716
|
+
function xt(r) {
|
|
1717
|
+
if (r = r.replace(/^\s+|\s+$/, ""), !r.length)
|
|
1718
|
+
return null;
|
|
1719
|
+
var e = /^([A-Z]+?)[:;]/.exec(r.toUpperCase());
|
|
1720
|
+
if (!e)
|
|
1721
|
+
return Me(r);
|
|
1722
|
+
var t = e[1];
|
|
1723
|
+
switch (t.toUpperCase()) {
|
|
1724
|
+
case "RRULE":
|
|
1725
|
+
case "EXRULE":
|
|
1726
|
+
return Me(r);
|
|
1727
|
+
case "DTSTART":
|
|
1728
|
+
return re(r);
|
|
1729
|
+
default:
|
|
1730
|
+
throw new Error("Unsupported RFC prop ".concat(t, " in ").concat(r));
|
|
1731
|
+
}
|
|
1732
|
+
}
|
|
1733
|
+
function Me(r) {
|
|
1734
|
+
var e = r.replace(/^RRULE:/i, ""), t = re(e), n = r.replace(/^(?:RRULE|EXRULE):/i, "").split(";");
|
|
1735
|
+
return n.forEach(function(i) {
|
|
1736
|
+
var s = i.split("="), a = s[0], o = s[1];
|
|
1737
|
+
switch (a.toUpperCase()) {
|
|
1738
|
+
case "FREQ":
|
|
1739
|
+
t.freq = T[o.toUpperCase()];
|
|
1740
|
+
break;
|
|
1741
|
+
case "WKST":
|
|
1742
|
+
t.wkst = L[o.toUpperCase()];
|
|
1743
|
+
break;
|
|
1744
|
+
case "COUNT":
|
|
1745
|
+
case "INTERVAL":
|
|
1746
|
+
case "BYSETPOS":
|
|
1747
|
+
case "BYMONTH":
|
|
1748
|
+
case "BYMONTHDAY":
|
|
1749
|
+
case "BYYEARDAY":
|
|
1750
|
+
case "BYWEEKNO":
|
|
1751
|
+
case "BYHOUR":
|
|
1752
|
+
case "BYMINUTE":
|
|
1753
|
+
case "BYSECOND":
|
|
1754
|
+
var u = Mt(o), c = a.toLowerCase();
|
|
1755
|
+
t[c] = u;
|
|
1756
|
+
break;
|
|
1757
|
+
case "BYWEEKDAY":
|
|
1758
|
+
case "BYDAY":
|
|
1759
|
+
t.byweekday = At(o);
|
|
1760
|
+
break;
|
|
1761
|
+
case "DTSTART":
|
|
1762
|
+
case "TZID":
|
|
1763
|
+
var d = re(r);
|
|
1764
|
+
t.tzid = d.tzid, t.dtstart = d.dtstart;
|
|
1765
|
+
break;
|
|
1766
|
+
case "UNTIL":
|
|
1767
|
+
t.until = ve(o);
|
|
1768
|
+
break;
|
|
1769
|
+
case "BYEASTER":
|
|
1770
|
+
t.byeaster = Number(o);
|
|
1771
|
+
break;
|
|
1772
|
+
default:
|
|
1773
|
+
throw new Error("Unknown RRULE property '" + a + "'");
|
|
1774
|
+
}
|
|
1775
|
+
}), t;
|
|
1776
|
+
}
|
|
1777
|
+
function Mt(r) {
|
|
1778
|
+
if (r.indexOf(",") !== -1) {
|
|
1779
|
+
var e = r.split(",");
|
|
1780
|
+
return e.map(Ae);
|
|
1781
|
+
}
|
|
1782
|
+
return Ae(r);
|
|
1783
|
+
}
|
|
1784
|
+
function Ae(r) {
|
|
1785
|
+
return /^[+-]?\d+$/.test(r) ? Number(r) : r;
|
|
1786
|
+
}
|
|
1787
|
+
function At(r) {
|
|
1788
|
+
var e = r.split(",");
|
|
1789
|
+
return e.map(function(t) {
|
|
1790
|
+
if (t.length === 2)
|
|
1791
|
+
return L[t];
|
|
1792
|
+
var n = t.match(/^([+-]?\d{1,2})([A-Z]{2})$/);
|
|
1793
|
+
if (!n || n.length < 3)
|
|
1794
|
+
throw new SyntaxError("Invalid weekday string: ".concat(t));
|
|
1795
|
+
var i = Number(n[1]), s = n[2], a = L[s].weekday;
|
|
1796
|
+
return new M(a, i);
|
|
1797
|
+
});
|
|
1798
|
+
}
|
|
1799
|
+
var ne = (
|
|
1800
|
+
/** @class */
|
|
1801
|
+
(function() {
|
|
1802
|
+
function r(e, t) {
|
|
1803
|
+
if (isNaN(e.getTime()))
|
|
1804
|
+
throw new RangeError("Invalid date passed to DateWithZone");
|
|
1805
|
+
this.date = e, this.tzid = t;
|
|
1806
|
+
}
|
|
1807
|
+
return Object.defineProperty(r.prototype, "isUTC", {
|
|
1808
|
+
get: function() {
|
|
1809
|
+
return !this.tzid || this.tzid.toUpperCase() === "UTC";
|
|
1810
|
+
},
|
|
1811
|
+
enumerable: !1,
|
|
1812
|
+
configurable: !0
|
|
1813
|
+
}), r.prototype.toString = function() {
|
|
1814
|
+
var e = me(this.date.getTime(), this.isUTC);
|
|
1815
|
+
return this.isUTC ? ":".concat(e) : ";TZID=".concat(this.tzid, ":").concat(e);
|
|
1816
|
+
}, r.prototype.getTime = function() {
|
|
1817
|
+
return this.date.getTime();
|
|
1818
|
+
}, r.prototype.rezonedDate = function() {
|
|
1819
|
+
return this.isUTC ? this.date : gt(this.date, this.tzid);
|
|
1820
|
+
}, r;
|
|
1821
|
+
})()
|
|
1822
|
+
);
|
|
1823
|
+
function he(r) {
|
|
1824
|
+
for (var e = [], t = "", n = Object.keys(r), i = Object.keys(ge), s = 0; s < n.length; s++)
|
|
1825
|
+
if (n[s] !== "tzid" && k(i, n[s])) {
|
|
1826
|
+
var a = n[s].toUpperCase(), o = r[n[s]], u = "";
|
|
1827
|
+
if (!(!S(o) || A(o) && !o.length)) {
|
|
1828
|
+
switch (a) {
|
|
1829
|
+
case "FREQ":
|
|
1830
|
+
u = v.FREQUENCIES[r.freq];
|
|
1831
|
+
break;
|
|
1832
|
+
case "WKST":
|
|
1833
|
+
N(o) ? u = new M(o).toString() : u = o.toString();
|
|
1834
|
+
break;
|
|
1835
|
+
case "BYWEEKDAY":
|
|
1836
|
+
a = "BYDAY", u = ft(o).map(function(y) {
|
|
1837
|
+
return y instanceof M ? y : A(y) ? new M(y[0], y[1]) : new M(y);
|
|
1838
|
+
}).toString();
|
|
1839
|
+
break;
|
|
1840
|
+
case "DTSTART":
|
|
1841
|
+
t = Ut(o, r.tzid);
|
|
1842
|
+
break;
|
|
1843
|
+
case "UNTIL":
|
|
1844
|
+
u = me(o, !r.tzid);
|
|
1845
|
+
break;
|
|
1846
|
+
default:
|
|
1847
|
+
if (A(o)) {
|
|
1848
|
+
for (var c = [], d = 0; d < o.length; d++)
|
|
1849
|
+
c[d] = String(o[d]);
|
|
1850
|
+
u = c.toString();
|
|
1851
|
+
} else
|
|
1852
|
+
u = String(o);
|
|
1853
|
+
}
|
|
1854
|
+
u && e.push([a, u]);
|
|
1855
|
+
}
|
|
1856
|
+
}
|
|
1857
|
+
var h = e.map(function(y) {
|
|
1858
|
+
var m = y[0], p = y[1];
|
|
1859
|
+
return "".concat(m, "=").concat(p.toString());
|
|
1860
|
+
}).join(";"), l = "";
|
|
1861
|
+
return h !== "" && (l = "RRULE:".concat(h)), [t, l].filter(function(y) {
|
|
1862
|
+
return !!y;
|
|
1863
|
+
}).join(`
|
|
1864
|
+
`);
|
|
1865
|
+
}
|
|
1866
|
+
function Ut(r, e) {
|
|
1867
|
+
return r ? "DTSTART" + new ne(new Date(r), e).toString() : "";
|
|
1868
|
+
}
|
|
1869
|
+
function Rt(r, e) {
|
|
1870
|
+
return Array.isArray(r) ? !Array.isArray(e) || r.length !== e.length ? !1 : r.every(function(t, n) {
|
|
1871
|
+
return t.getTime() === e[n].getTime();
|
|
1872
|
+
}) : r instanceof Date ? e instanceof Date && r.getTime() === e.getTime() : r === e;
|
|
1873
|
+
}
|
|
1874
|
+
var Lt = (
|
|
1875
|
+
/** @class */
|
|
1876
|
+
(function() {
|
|
1877
|
+
function r() {
|
|
1878
|
+
this.all = !1, this.before = [], this.after = [], this.between = [];
|
|
1879
|
+
}
|
|
1880
|
+
return r.prototype._cacheAdd = function(e, t, n) {
|
|
1881
|
+
t && (t = t instanceof Date ? ce(t) : Ie(t)), e === "all" ? this.all = t : (n._value = t, this[e].push(n));
|
|
1882
|
+
}, r.prototype._cacheGet = function(e, t) {
|
|
1883
|
+
var n = !1, i = t ? Object.keys(t) : [], s = function(d) {
|
|
1884
|
+
for (var h = 0; h < i.length; h++) {
|
|
1885
|
+
var l = i[h];
|
|
1886
|
+
if (!Rt(t[l], d[l]))
|
|
1887
|
+
return !0;
|
|
1888
|
+
}
|
|
1889
|
+
return !1;
|
|
1890
|
+
}, a = this[e];
|
|
1891
|
+
if (e === "all")
|
|
1892
|
+
n = this.all;
|
|
1893
|
+
else if (A(a))
|
|
1894
|
+
for (var o = 0; o < a.length; o++) {
|
|
1895
|
+
var u = a[o];
|
|
1896
|
+
if (!(i.length && s(u))) {
|
|
1897
|
+
n = u._value;
|
|
1898
|
+
break;
|
|
1899
|
+
}
|
|
1900
|
+
}
|
|
1901
|
+
if (!n && this.all) {
|
|
1902
|
+
for (var c = new K(e, t), o = 0; o < this.all.length && c.accept(this.all[o]); o++)
|
|
1903
|
+
;
|
|
1904
|
+
n = c.getValue(), this._cacheAdd(e, n, t);
|
|
1905
|
+
}
|
|
1906
|
+
return A(n) ? Ie(n) : n instanceof Date ? ce(n) : n;
|
|
1907
|
+
}, r;
|
|
1908
|
+
})()
|
|
1909
|
+
), Yt = f(f(f(f(f(f(f(f(f(f(f(f(f([], w(1, 31), !0), w(2, 28), !0), w(3, 31), !0), w(4, 30), !0), w(5, 31), !0), w(6, 30), !0), w(7, 31), !0), w(8, 31), !0), w(9, 30), !0), w(10, 31), !0), w(11, 30), !0), w(12, 31), !0), w(1, 7), !0), Nt = f(f(f(f(f(f(f(f(f(f(f(f(f([], w(1, 31), !0), w(2, 29), !0), w(3, 31), !0), w(4, 30), !0), w(5, 31), !0), w(6, 30), !0), w(7, 31), !0), w(8, 31), !0), w(9, 30), !0), w(10, 31), !0), w(11, 30), !0), w(12, 31), !0), w(1, 7), !0), Ct = W(1, 29), Wt = W(1, 30), j = W(1, 31), O = W(1, 32), zt = f(f(f(f(f(f(f(f(f(f(f(f(f([], O, !0), Wt, !0), O, !0), j, !0), O, !0), j, !0), O, !0), O, !0), j, !0), O, !0), j, !0), O, !0), O.slice(0, 7), !0), Ht = f(f(f(f(f(f(f(f(f(f(f(f(f([], O, !0), Ct, !0), O, !0), j, !0), O, !0), j, !0), O, !0), O, !0), j, !0), O, !0), j, !0), O, !0), O.slice(0, 7), !0), Pt = W(-28, 0), jt = W(-29, 0), $ = W(-30, 0), x = W(-31, 0), $t = f(f(f(f(f(f(f(f(f(f(f(f(f([], x, !0), jt, !0), x, !0), $, !0), x, !0), $, !0), x, !0), x, !0), $, !0), x, !0), $, !0), x, !0), x.slice(0, 7), !0), Ft = f(f(f(f(f(f(f(f(f(f(f(f(f([], x, !0), Pt, !0), x, !0), $, !0), x, !0), $, !0), x, !0), x, !0), $, !0), x, !0), $, !0), x, !0), x.slice(0, 7), !0), Bt = [0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366], Kt = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365], Ue = (function() {
|
|
1910
|
+
for (var r = [], e = 0; e < 55; e++)
|
|
1911
|
+
r = r.concat(W(7));
|
|
1912
|
+
return r;
|
|
1913
|
+
})();
|
|
1914
|
+
function Zt(r, e) {
|
|
1915
|
+
var t = F(r, 1, 1), n = J(r) ? 366 : 365, i = J(r + 1) ? 366 : 365, s = ue(t), a = Z(t), o = U(U({ yearlen: n, nextyearlen: i, yearordinal: s, yearweekday: a }, qt(r)), { wnomask: null });
|
|
1916
|
+
if (C(e.byweekno))
|
|
1917
|
+
return o;
|
|
1918
|
+
o.wnomask = w(0, n + 7);
|
|
1919
|
+
var u, c, d = u = R(7 - a + e.wkst, 7);
|
|
1920
|
+
d >= 4 ? (d = 0, c = o.yearlen + R(a - e.wkst, 7)) : c = n - d;
|
|
1921
|
+
for (var h = Math.floor(c / 7), l = R(c, 7), y = Math.floor(h + l / 4), m = 0; m < e.byweekno.length; m++) {
|
|
1922
|
+
var p = e.byweekno[m];
|
|
1923
|
+
if (p < 0 && (p += y + 1), p > 0 && p <= y) {
|
|
1924
|
+
var b = void 0;
|
|
1925
|
+
p > 1 ? (b = d + (p - 1) * 7, d !== u && (b -= 7 - u)) : b = d;
|
|
1926
|
+
for (var E = 0; E < 7 && (o.wnomask[b] = 1, b++, o.wdaymask[b] !== e.wkst); E++)
|
|
1927
|
+
;
|
|
1928
|
+
}
|
|
1929
|
+
}
|
|
1930
|
+
if (k(e.byweekno, 1)) {
|
|
1931
|
+
var b = d + y * 7;
|
|
1932
|
+
if (d !== u && (b -= 7 - u), b < n)
|
|
1933
|
+
for (var m = 0; m < 7 && (o.wnomask[b] = 1, b += 1, o.wdaymask[b] !== e.wkst); m++)
|
|
1934
|
+
;
|
|
1935
|
+
}
|
|
1936
|
+
if (d) {
|
|
1937
|
+
var D = void 0;
|
|
1938
|
+
if (k(e.byweekno, -1))
|
|
1939
|
+
D = -1;
|
|
1940
|
+
else {
|
|
1941
|
+
var Y = Z(F(r - 1, 1, 1)), z = R(7 - Y.valueOf() + e.wkst, 7), Q = J(r - 1) ? 366 : 365, I = void 0;
|
|
1942
|
+
z >= 4 ? (z = 0, I = Q + R(Y - e.wkst, 7)) : I = n - d, D = Math.floor(52 + R(I, 7) / 4);
|
|
1943
|
+
}
|
|
1944
|
+
if (k(e.byweekno, D))
|
|
1945
|
+
for (var b = 0; b < d; b++)
|
|
1946
|
+
o.wnomask[b] = 1;
|
|
1947
|
+
}
|
|
1948
|
+
return o;
|
|
1949
|
+
}
|
|
1950
|
+
function qt(r) {
|
|
1951
|
+
var e = J(r) ? 366 : 365, t = F(r, 1, 1), n = Z(t);
|
|
1952
|
+
return e === 365 ? {
|
|
1953
|
+
mmask: Yt,
|
|
1954
|
+
mdaymask: Ht,
|
|
1955
|
+
nmdaymask: Ft,
|
|
1956
|
+
wdaymask: Ue.slice(n),
|
|
1957
|
+
mrange: Kt
|
|
1958
|
+
} : {
|
|
1959
|
+
mmask: Nt,
|
|
1960
|
+
mdaymask: zt,
|
|
1961
|
+
nmdaymask: $t,
|
|
1962
|
+
wdaymask: Ue.slice(n),
|
|
1963
|
+
mrange: Bt
|
|
1964
|
+
};
|
|
1965
|
+
}
|
|
1966
|
+
function Gt(r, e, t, n, i, s) {
|
|
1967
|
+
var a = {
|
|
1968
|
+
lastyear: r,
|
|
1969
|
+
lastmonth: e,
|
|
1970
|
+
nwdaymask: []
|
|
1971
|
+
}, o = [];
|
|
1972
|
+
if (s.freq === v.YEARLY)
|
|
1973
|
+
if (C(s.bymonth))
|
|
1974
|
+
o = [[0, t]];
|
|
1975
|
+
else
|
|
1976
|
+
for (var u = 0; u < s.bymonth.length; u++)
|
|
1977
|
+
e = s.bymonth[u], o.push(n.slice(e - 1, e + 1));
|
|
1978
|
+
else s.freq === v.MONTHLY && (o = [n.slice(e - 1, e + 1)]);
|
|
1979
|
+
if (C(o))
|
|
1980
|
+
return a;
|
|
1981
|
+
a.nwdaymask = w(0, t);
|
|
1982
|
+
for (var u = 0; u < o.length; u++)
|
|
1983
|
+
for (var c = o[u], d = c[0], h = c[1] - 1, l = 0; l < s.bynweekday.length; l++) {
|
|
1984
|
+
var y = void 0, m = s.bynweekday[l], p = m[0], b = m[1];
|
|
1985
|
+
b < 0 ? (y = h + (b + 1) * 7, y -= R(i[y] - p, 7)) : (y = d + (b - 1) * 7, y += R(7 - i[y] + p, 7)), d <= y && y <= h && (a.nwdaymask[y] = 1);
|
|
1986
|
+
}
|
|
1987
|
+
return a;
|
|
1988
|
+
}
|
|
1989
|
+
function Jt(r, e) {
|
|
1990
|
+
e === void 0 && (e = 0);
|
|
1991
|
+
var t = r % 19, n = Math.floor(r / 100), i = r % 100, s = Math.floor(n / 4), a = n % 4, o = Math.floor((n + 8) / 25), u = Math.floor((n - o + 1) / 3), c = Math.floor(19 * t + n - s - u + 15) % 30, d = Math.floor(i / 4), h = i % 4, l = Math.floor(32 + 2 * a + 2 * d - c - h) % 7, y = Math.floor((t + 11 * c + 22 * l) / 451), m = Math.floor((c + l - 7 * y + 114) / 31), p = (c + l - 7 * y + 114) % 31 + 1, b = Date.UTC(r, m - 1, p + e), E = Date.UTC(r, 0, 1);
|
|
1992
|
+
return [Math.ceil((b - E) / (1e3 * 60 * 60 * 24))];
|
|
1993
|
+
}
|
|
1994
|
+
var Xt = (
|
|
1995
|
+
/** @class */
|
|
1996
|
+
(function() {
|
|
1997
|
+
function r(e) {
|
|
1998
|
+
this.options = e;
|
|
1999
|
+
}
|
|
2000
|
+
return r.prototype.rebuild = function(e, t) {
|
|
2001
|
+
var n = this.options;
|
|
2002
|
+
if (e !== this.lastyear && (this.yearinfo = Zt(e, n)), _(n.bynweekday) && (t !== this.lastmonth || e !== this.lastyear)) {
|
|
2003
|
+
var i = this.yearinfo, s = i.yearlen, a = i.mrange, o = i.wdaymask;
|
|
2004
|
+
this.monthinfo = Gt(e, t, s, a, o, n);
|
|
2005
|
+
}
|
|
2006
|
+
S(n.byeaster) && (this.eastermask = Jt(e, n.byeaster));
|
|
2007
|
+
}, Object.defineProperty(r.prototype, "lastyear", {
|
|
2008
|
+
get: function() {
|
|
2009
|
+
return this.monthinfo ? this.monthinfo.lastyear : null;
|
|
2010
|
+
},
|
|
2011
|
+
enumerable: !1,
|
|
2012
|
+
configurable: !0
|
|
2013
|
+
}), Object.defineProperty(r.prototype, "lastmonth", {
|
|
2014
|
+
get: function() {
|
|
2015
|
+
return this.monthinfo ? this.monthinfo.lastmonth : null;
|
|
2016
|
+
},
|
|
2017
|
+
enumerable: !1,
|
|
2018
|
+
configurable: !0
|
|
2019
|
+
}), Object.defineProperty(r.prototype, "yearlen", {
|
|
2020
|
+
get: function() {
|
|
2021
|
+
return this.yearinfo.yearlen;
|
|
2022
|
+
},
|
|
2023
|
+
enumerable: !1,
|
|
2024
|
+
configurable: !0
|
|
2025
|
+
}), Object.defineProperty(r.prototype, "yearordinal", {
|
|
2026
|
+
get: function() {
|
|
2027
|
+
return this.yearinfo.yearordinal;
|
|
2028
|
+
},
|
|
2029
|
+
enumerable: !1,
|
|
2030
|
+
configurable: !0
|
|
2031
|
+
}), Object.defineProperty(r.prototype, "mrange", {
|
|
2032
|
+
get: function() {
|
|
2033
|
+
return this.yearinfo.mrange;
|
|
2034
|
+
},
|
|
2035
|
+
enumerable: !1,
|
|
2036
|
+
configurable: !0
|
|
2037
|
+
}), Object.defineProperty(r.prototype, "wdaymask", {
|
|
2038
|
+
get: function() {
|
|
2039
|
+
return this.yearinfo.wdaymask;
|
|
2040
|
+
},
|
|
2041
|
+
enumerable: !1,
|
|
2042
|
+
configurable: !0
|
|
2043
|
+
}), Object.defineProperty(r.prototype, "mmask", {
|
|
2044
|
+
get: function() {
|
|
2045
|
+
return this.yearinfo.mmask;
|
|
2046
|
+
},
|
|
2047
|
+
enumerable: !1,
|
|
2048
|
+
configurable: !0
|
|
2049
|
+
}), Object.defineProperty(r.prototype, "wnomask", {
|
|
2050
|
+
get: function() {
|
|
2051
|
+
return this.yearinfo.wnomask;
|
|
2052
|
+
},
|
|
2053
|
+
enumerable: !1,
|
|
2054
|
+
configurable: !0
|
|
2055
|
+
}), Object.defineProperty(r.prototype, "nwdaymask", {
|
|
2056
|
+
get: function() {
|
|
2057
|
+
return this.monthinfo ? this.monthinfo.nwdaymask : [];
|
|
2058
|
+
},
|
|
2059
|
+
enumerable: !1,
|
|
2060
|
+
configurable: !0
|
|
2061
|
+
}), Object.defineProperty(r.prototype, "nextyearlen", {
|
|
2062
|
+
get: function() {
|
|
2063
|
+
return this.yearinfo.nextyearlen;
|
|
2064
|
+
},
|
|
2065
|
+
enumerable: !1,
|
|
2066
|
+
configurable: !0
|
|
2067
|
+
}), Object.defineProperty(r.prototype, "mdaymask", {
|
|
2068
|
+
get: function() {
|
|
2069
|
+
return this.yearinfo.mdaymask;
|
|
2070
|
+
},
|
|
2071
|
+
enumerable: !1,
|
|
2072
|
+
configurable: !0
|
|
2073
|
+
}), Object.defineProperty(r.prototype, "nmdaymask", {
|
|
2074
|
+
get: function() {
|
|
2075
|
+
return this.yearinfo.nmdaymask;
|
|
2076
|
+
},
|
|
2077
|
+
enumerable: !1,
|
|
2078
|
+
configurable: !0
|
|
2079
|
+
}), r.prototype.ydayset = function() {
|
|
2080
|
+
return [W(this.yearlen), 0, this.yearlen];
|
|
2081
|
+
}, r.prototype.mdayset = function(e, t) {
|
|
2082
|
+
for (var n = this.mrange[t - 1], i = this.mrange[t], s = w(null, this.yearlen), a = n; a < i; a++)
|
|
2083
|
+
s[a] = a;
|
|
2084
|
+
return [s, n, i];
|
|
2085
|
+
}, r.prototype.wdayset = function(e, t, n) {
|
|
2086
|
+
for (var i = w(null, this.yearlen + 7), s = ue(F(e, t, n)) - this.yearordinal, a = s, o = 0; o < 7 && (i[s] = s, ++s, this.wdaymask[s] !== this.options.wkst); o++)
|
|
2087
|
+
;
|
|
2088
|
+
return [i, a, s];
|
|
2089
|
+
}, r.prototype.ddayset = function(e, t, n) {
|
|
2090
|
+
var i = w(null, this.yearlen), s = ue(F(e, t, n)) - this.yearordinal;
|
|
2091
|
+
return i[s] = s, [i, s, s + 1];
|
|
2092
|
+
}, r.prototype.htimeset = function(e, t, n, i) {
|
|
2093
|
+
var s = this, a = [];
|
|
2094
|
+
return this.options.byminute.forEach(function(o) {
|
|
2095
|
+
a = a.concat(s.mtimeset(e, o, n, i));
|
|
2096
|
+
}), V(a), a;
|
|
2097
|
+
}, r.prototype.mtimeset = function(e, t, n, i) {
|
|
2098
|
+
var s = this.options.bysecond.map(function(a) {
|
|
2099
|
+
return new te(e, t, a, i);
|
|
2100
|
+
});
|
|
2101
|
+
return V(s), s;
|
|
2102
|
+
}, r.prototype.stimeset = function(e, t, n, i) {
|
|
2103
|
+
return [new te(e, t, n, i)];
|
|
2104
|
+
}, r.prototype.getdayset = function(e) {
|
|
2105
|
+
switch (e) {
|
|
2106
|
+
case T.YEARLY:
|
|
2107
|
+
return this.ydayset.bind(this);
|
|
2108
|
+
case T.MONTHLY:
|
|
2109
|
+
return this.mdayset.bind(this);
|
|
2110
|
+
case T.WEEKLY:
|
|
2111
|
+
return this.wdayset.bind(this);
|
|
2112
|
+
case T.DAILY:
|
|
2113
|
+
return this.ddayset.bind(this);
|
|
2114
|
+
default:
|
|
2115
|
+
return this.ddayset.bind(this);
|
|
2116
|
+
}
|
|
2117
|
+
}, r.prototype.gettimeset = function(e) {
|
|
2118
|
+
switch (e) {
|
|
2119
|
+
case T.HOURLY:
|
|
2120
|
+
return this.htimeset.bind(this);
|
|
2121
|
+
case T.MINUTELY:
|
|
2122
|
+
return this.mtimeset.bind(this);
|
|
2123
|
+
case T.SECONDLY:
|
|
2124
|
+
return this.stimeset.bind(this);
|
|
2125
|
+
}
|
|
2126
|
+
}, r;
|
|
2127
|
+
})()
|
|
2128
|
+
);
|
|
2129
|
+
function Vt(r, e, t, n, i, s) {
|
|
2130
|
+
for (var a = [], o = 0; o < r.length; o++) {
|
|
2131
|
+
var u = void 0, c = void 0, d = r[o];
|
|
2132
|
+
d < 0 ? (u = Math.floor(d / e.length), c = R(d, e.length)) : (u = Math.floor((d - 1) / e.length), c = R(d - 1, e.length));
|
|
2133
|
+
for (var h = [], l = t; l < n; l++) {
|
|
2134
|
+
var y = s[l];
|
|
2135
|
+
S(y) && h.push(y);
|
|
2136
|
+
}
|
|
2137
|
+
var m = void 0;
|
|
2138
|
+
u < 0 ? m = h.slice(u)[0] : m = h[u];
|
|
2139
|
+
var p = e[c], b = qe(i.yearordinal + m), E = Ge(b, p);
|
|
2140
|
+
k(a, E) || a.push(E);
|
|
2141
|
+
}
|
|
2142
|
+
return V(a), a;
|
|
2143
|
+
}
|
|
2144
|
+
function Ve(r, e) {
|
|
2145
|
+
var t = e.dtstart, n = e.freq, i = e.interval, s = e.until, a = e.bysetpos, o = e.count;
|
|
2146
|
+
if (o === 0 || i === 0)
|
|
2147
|
+
return H(r);
|
|
2148
|
+
var u = It.fromDate(t), c = new Xt(e);
|
|
2149
|
+
c.rebuild(u.year, u.month);
|
|
2150
|
+
for (var d = tr(c, u, e); ; ) {
|
|
2151
|
+
var h = c.getdayset(n)(u.year, u.month, u.day), l = h[0], y = h[1], m = h[2], p = er(l, y, m, c, e);
|
|
2152
|
+
if (_(a))
|
|
2153
|
+
for (var b = Vt(a, d, y, m, c, l), E = 0; E < b.length; E++) {
|
|
2154
|
+
var D = b[E];
|
|
2155
|
+
if (s && D > s)
|
|
2156
|
+
return H(r);
|
|
2157
|
+
if (D >= t) {
|
|
2158
|
+
var Y = Re(D, e);
|
|
2159
|
+
if (!r.accept(Y) || o && (--o, !o))
|
|
2160
|
+
return H(r);
|
|
2161
|
+
}
|
|
2162
|
+
}
|
|
2163
|
+
else
|
|
2164
|
+
for (var E = y; E < m; E++) {
|
|
2165
|
+
var z = l[E];
|
|
2166
|
+
if (S(z))
|
|
2167
|
+
for (var Q = qe(c.yearordinal + z), I = 0; I < d.length; I++) {
|
|
2168
|
+
var et = d[I], D = Ge(Q, et);
|
|
2169
|
+
if (s && D > s)
|
|
2170
|
+
return H(r);
|
|
2171
|
+
if (D >= t) {
|
|
2172
|
+
var Y = Re(D, e);
|
|
2173
|
+
if (!r.accept(Y) || o && (--o, !o))
|
|
2174
|
+
return H(r);
|
|
2175
|
+
}
|
|
2176
|
+
}
|
|
2177
|
+
}
|
|
2178
|
+
if (e.interval === 0 || (u.add(e, p), u.year > Be))
|
|
2179
|
+
return H(r);
|
|
2180
|
+
be(n) || (d = c.gettimeset(n)(u.hour, u.minute, u.second, 0)), c.rebuild(u.year, u.month);
|
|
2181
|
+
}
|
|
2182
|
+
}
|
|
2183
|
+
function Qt(r, e, t) {
|
|
2184
|
+
var n = t.bymonth, i = t.byweekno, s = t.byweekday, a = t.byeaster, o = t.bymonthday, u = t.bynmonthday, c = t.byyearday;
|
|
2185
|
+
return _(n) && !k(n, r.mmask[e]) || _(i) && !r.wnomask[e] || _(s) && !k(s, r.wdaymask[e]) || _(r.nwdaymask) && !r.nwdaymask[e] || a !== null && !k(r.eastermask, e) || (_(o) || _(u)) && !k(o, r.mdaymask[e]) && !k(u, r.nmdaymask[e]) || _(c) && (e < r.yearlen && !k(c, e + 1) && !k(c, -r.yearlen + e) || e >= r.yearlen && !k(c, e + 1 - r.yearlen) && !k(c, -r.nextyearlen + e - r.yearlen));
|
|
2186
|
+
}
|
|
2187
|
+
function Re(r, e) {
|
|
2188
|
+
return new ne(r, e.tzid).rezonedDate();
|
|
2189
|
+
}
|
|
2190
|
+
function H(r) {
|
|
2191
|
+
return r.getValue();
|
|
2192
|
+
}
|
|
2193
|
+
function er(r, e, t, n, i) {
|
|
2194
|
+
for (var s = !1, a = e; a < t; a++) {
|
|
2195
|
+
var o = r[a];
|
|
2196
|
+
s = Qt(n, o, i), s && (r[o] = null);
|
|
2197
|
+
}
|
|
2198
|
+
return s;
|
|
2199
|
+
}
|
|
2200
|
+
function tr(r, e, t) {
|
|
2201
|
+
var n = t.freq, i = t.byhour, s = t.byminute, a = t.bysecond;
|
|
2202
|
+
return be(n) ? Ot(t) : n >= v.HOURLY && _(i) && !k(i, e.hour) || n >= v.MINUTELY && _(s) && !k(s, e.minute) || n >= v.SECONDLY && _(a) && !k(a, e.second) ? [] : r.gettimeset(n)(e.hour, e.minute, e.second, e.millisecond);
|
|
2203
|
+
}
|
|
2204
|
+
var L = {
|
|
2205
|
+
MO: new M(0),
|
|
2206
|
+
TU: new M(1),
|
|
2207
|
+
WE: new M(2),
|
|
2208
|
+
TH: new M(3),
|
|
2209
|
+
FR: new M(4),
|
|
2210
|
+
SA: new M(5),
|
|
2211
|
+
SU: new M(6)
|
|
2212
|
+
}, ge = {
|
|
2213
|
+
freq: T.YEARLY,
|
|
2214
|
+
dtstart: null,
|
|
2215
|
+
interval: 1,
|
|
2216
|
+
wkst: L.MO,
|
|
2217
|
+
count: null,
|
|
2218
|
+
until: null,
|
|
2219
|
+
tzid: null,
|
|
2220
|
+
bysetpos: null,
|
|
2221
|
+
bymonth: null,
|
|
2222
|
+
bymonthday: null,
|
|
2223
|
+
bynmonthday: null,
|
|
2224
|
+
byyearday: null,
|
|
2225
|
+
byweekno: null,
|
|
2226
|
+
byweekday: null,
|
|
2227
|
+
bynweekday: null,
|
|
2228
|
+
byhour: null,
|
|
2229
|
+
byminute: null,
|
|
2230
|
+
bysecond: null,
|
|
2231
|
+
byeaster: null
|
|
2232
|
+
}, rr = Object.keys(ge), v = (
|
|
2233
|
+
/** @class */
|
|
2234
|
+
(function() {
|
|
2235
|
+
function r(e, t) {
|
|
2236
|
+
e === void 0 && (e = {}), t === void 0 && (t = !1), this._cache = t ? null : new Lt(), this.origOptions = Xe(e);
|
|
2237
|
+
var n = _t(e).parsedOptions;
|
|
2238
|
+
this.options = n;
|
|
2239
|
+
}
|
|
2240
|
+
return r.parseText = function(e, t) {
|
|
2241
|
+
return Je(e, t);
|
|
2242
|
+
}, r.fromText = function(e, t) {
|
|
2243
|
+
return kt(e, t);
|
|
2244
|
+
}, r.fromString = function(e) {
|
|
2245
|
+
return new r(r.parseString(e) || void 0);
|
|
2246
|
+
}, r.prototype._iter = function(e) {
|
|
2247
|
+
return Ve(e, this.options);
|
|
2248
|
+
}, r.prototype._cacheGet = function(e, t) {
|
|
2249
|
+
return this._cache ? this._cache._cacheGet(e, t) : !1;
|
|
2250
|
+
}, r.prototype._cacheAdd = function(e, t, n) {
|
|
2251
|
+
if (this._cache)
|
|
2252
|
+
return this._cache._cacheAdd(e, t, n);
|
|
2253
|
+
}, r.prototype.all = function(e) {
|
|
2254
|
+
if (e)
|
|
2255
|
+
return this._iter(new Oe("all", {}, e));
|
|
2256
|
+
var t = this._cacheGet("all");
|
|
2257
|
+
return t === !1 && (t = this._iter(new K("all", {})), this._cacheAdd("all", t)), t;
|
|
2258
|
+
}, r.prototype.between = function(e, t, n, i) {
|
|
2259
|
+
if (n === void 0 && (n = !1), !G(e) || !G(t))
|
|
2260
|
+
throw new Error("Invalid date passed in to RRule.between");
|
|
2261
|
+
var s = {
|
|
2262
|
+
before: t,
|
|
2263
|
+
after: e,
|
|
2264
|
+
inc: n
|
|
2265
|
+
};
|
|
2266
|
+
if (i)
|
|
2267
|
+
return this._iter(new Oe("between", s, i));
|
|
2268
|
+
var a = this._cacheGet("between", s);
|
|
2269
|
+
return a === !1 && (a = this._iter(new K("between", s)), this._cacheAdd("between", a, s)), a;
|
|
2270
|
+
}, r.prototype.before = function(e, t) {
|
|
2271
|
+
if (t === void 0 && (t = !1), !G(e))
|
|
2272
|
+
throw new Error("Invalid date passed in to RRule.before");
|
|
2273
|
+
var n = { dt: e, inc: t }, i = this._cacheGet("before", n);
|
|
2274
|
+
return i === !1 && (i = this._iter(new K("before", n)), this._cacheAdd("before", i, n)), i;
|
|
2275
|
+
}, r.prototype.after = function(e, t) {
|
|
2276
|
+
if (t === void 0 && (t = !1), !G(e))
|
|
2277
|
+
throw new Error("Invalid date passed in to RRule.after");
|
|
2278
|
+
var n = { dt: e, inc: t }, i = this._cacheGet("after", n);
|
|
2279
|
+
return i === !1 && (i = this._iter(new K("after", n)), this._cacheAdd("after", i, n)), i;
|
|
2280
|
+
}, r.prototype.count = function() {
|
|
2281
|
+
return this.all().length;
|
|
2282
|
+
}, r.prototype.toString = function() {
|
|
2283
|
+
return he(this.origOptions);
|
|
2284
|
+
}, r.prototype.toText = function(e, t, n) {
|
|
2285
|
+
return St(this, e, t, n);
|
|
2286
|
+
}, r.prototype.isFullyConvertibleToText = function() {
|
|
2287
|
+
return Dt(this);
|
|
2288
|
+
}, r.prototype.clone = function() {
|
|
2289
|
+
return new r(this.origOptions);
|
|
2290
|
+
}, r.FREQUENCIES = [
|
|
2291
|
+
"YEARLY",
|
|
2292
|
+
"MONTHLY",
|
|
2293
|
+
"WEEKLY",
|
|
2294
|
+
"DAILY",
|
|
2295
|
+
"HOURLY",
|
|
2296
|
+
"MINUTELY",
|
|
2297
|
+
"SECONDLY"
|
|
2298
|
+
], r.YEARLY = T.YEARLY, r.MONTHLY = T.MONTHLY, r.WEEKLY = T.WEEKLY, r.DAILY = T.DAILY, r.HOURLY = T.HOURLY, r.MINUTELY = T.MINUTELY, r.SECONDLY = T.SECONDLY, r.MO = L.MO, r.TU = L.TU, r.WE = L.WE, r.TH = L.TH, r.FR = L.FR, r.SA = L.SA, r.SU = L.SU, r.parseString = de, r.optionsToString = he, r;
|
|
2299
|
+
})()
|
|
2300
|
+
);
|
|
2301
|
+
function nr(r, e, t, n, i, s) {
|
|
2302
|
+
var a = {}, o = r.accept;
|
|
2303
|
+
function u(l, y) {
|
|
2304
|
+
t.forEach(function(m) {
|
|
2305
|
+
m.between(l, y, !0).forEach(function(p) {
|
|
2306
|
+
a[Number(p)] = !0;
|
|
2307
|
+
});
|
|
2308
|
+
});
|
|
2309
|
+
}
|
|
2310
|
+
i.forEach(function(l) {
|
|
2311
|
+
var y = new ne(l, s).rezonedDate();
|
|
2312
|
+
a[Number(y)] = !0;
|
|
2313
|
+
}), r.accept = function(l) {
|
|
2314
|
+
var y = Number(l);
|
|
2315
|
+
return isNaN(y) ? o.call(this, l) : !a[y] && (u(new Date(y - 1), new Date(y + 1)), !a[y]) ? (a[y] = !0, o.call(this, l)) : !0;
|
|
2316
|
+
}, r.method === "between" && (u(r.args.after, r.args.before), r.accept = function(l) {
|
|
2317
|
+
var y = Number(l);
|
|
2318
|
+
return a[y] ? !0 : (a[y] = !0, o.call(this, l));
|
|
2319
|
+
});
|
|
2320
|
+
for (var c = 0; c < n.length; c++) {
|
|
2321
|
+
var d = new ne(n[c], s).rezonedDate();
|
|
2322
|
+
if (!r.accept(new Date(d.getTime())))
|
|
2323
|
+
break;
|
|
2324
|
+
}
|
|
2325
|
+
e.forEach(function(l) {
|
|
2326
|
+
Ve(r, l.options);
|
|
2327
|
+
});
|
|
2328
|
+
var h = r._result;
|
|
2329
|
+
switch (V(h), r.method) {
|
|
2330
|
+
case "all":
|
|
2331
|
+
case "between":
|
|
2332
|
+
return h;
|
|
2333
|
+
case "before":
|
|
2334
|
+
return h.length && h[h.length - 1] || null;
|
|
2335
|
+
default:
|
|
2336
|
+
return h.length && h[0] || null;
|
|
2337
|
+
}
|
|
2338
|
+
}
|
|
2339
|
+
var Le = {
|
|
2340
|
+
dtstart: null,
|
|
2341
|
+
cache: !1,
|
|
2342
|
+
unfold: !1,
|
|
2343
|
+
forceset: !1,
|
|
2344
|
+
compatible: !1,
|
|
2345
|
+
tzid: null
|
|
2346
|
+
};
|
|
2347
|
+
function ir(r, e) {
|
|
2348
|
+
var t = [], n = [], i = [], s = [], a = re(r), o = a.dtstart, u = a.tzid, c = cr(r, e.unfold);
|
|
2349
|
+
return c.forEach(function(d) {
|
|
2350
|
+
var h;
|
|
2351
|
+
if (d) {
|
|
2352
|
+
var l = ur(d), y = l.name, m = l.parms, p = l.value;
|
|
2353
|
+
switch (y.toUpperCase()) {
|
|
2354
|
+
case "RRULE":
|
|
2355
|
+
if (m.length)
|
|
2356
|
+
throw new Error("unsupported RRULE parm: ".concat(m.join(",")));
|
|
2357
|
+
t.push(de(d));
|
|
2358
|
+
break;
|
|
2359
|
+
case "RDATE":
|
|
2360
|
+
var b = (h = /RDATE(?:;TZID=([^:=]+))?/i.exec(d)) !== null && h !== void 0 ? h : [], E = b[1];
|
|
2361
|
+
E && !u && (u = E), n = n.concat(Ne(p, m));
|
|
2362
|
+
break;
|
|
2363
|
+
case "EXRULE":
|
|
2364
|
+
if (m.length)
|
|
2365
|
+
throw new Error("unsupported EXRULE parm: ".concat(m.join(",")));
|
|
2366
|
+
i.push(de(p));
|
|
2367
|
+
break;
|
|
2368
|
+
case "EXDATE":
|
|
2369
|
+
s = s.concat(Ne(p, m));
|
|
2370
|
+
break;
|
|
2371
|
+
case "DTSTART":
|
|
2372
|
+
break;
|
|
2373
|
+
default:
|
|
2374
|
+
throw new Error("unsupported property: " + y);
|
|
2375
|
+
}
|
|
2376
|
+
}
|
|
2377
|
+
}), {
|
|
2378
|
+
dtstart: o,
|
|
2379
|
+
tzid: u,
|
|
2380
|
+
rrulevals: t,
|
|
2381
|
+
rdatevals: n,
|
|
2382
|
+
exrulevals: i,
|
|
2383
|
+
exdatevals: s
|
|
2384
|
+
};
|
|
2385
|
+
}
|
|
2386
|
+
function sr(r, e) {
|
|
2387
|
+
var t = ir(r, e), n = t.rrulevals, i = t.rdatevals, s = t.exrulevals, a = t.exdatevals, o = t.dtstart, u = t.tzid, c = e.cache === !1;
|
|
2388
|
+
if (e.compatible && (e.forceset = !0, e.unfold = !0), e.forceset || n.length > 1 || i.length || s.length || a.length) {
|
|
2389
|
+
var d = new dr(c);
|
|
2390
|
+
return d.dtstart(o), d.tzid(u || void 0), n.forEach(function(l) {
|
|
2391
|
+
d.rrule(new v(se(l, o, u), c));
|
|
2392
|
+
}), i.forEach(function(l) {
|
|
2393
|
+
d.rdate(l);
|
|
2394
|
+
}), s.forEach(function(l) {
|
|
2395
|
+
d.exrule(new v(se(l, o, u), c));
|
|
2396
|
+
}), a.forEach(function(l) {
|
|
2397
|
+
d.exdate(l);
|
|
2398
|
+
}), e.compatible && e.dtstart && d.rdate(o), d;
|
|
2399
|
+
}
|
|
2400
|
+
var h = n[0] || {};
|
|
2401
|
+
return new v(se(h, h.dtstart || e.dtstart || o, h.tzid || e.tzid || u), c);
|
|
2402
|
+
}
|
|
2403
|
+
function Ye(r, e) {
|
|
2404
|
+
return e === void 0 && (e = {}), sr(r, ar(e));
|
|
2405
|
+
}
|
|
2406
|
+
function se(r, e, t) {
|
|
2407
|
+
return U(U({}, r), { dtstart: e, tzid: t });
|
|
2408
|
+
}
|
|
2409
|
+
function ar(r) {
|
|
2410
|
+
var e = [], t = Object.keys(r), n = Object.keys(Le);
|
|
2411
|
+
if (t.forEach(function(i) {
|
|
2412
|
+
k(n, i) || e.push(i);
|
|
2413
|
+
}), e.length)
|
|
2414
|
+
throw new Error("Invalid options: " + e.join(", "));
|
|
2415
|
+
return U(U({}, Le), r);
|
|
2416
|
+
}
|
|
2417
|
+
function or(r) {
|
|
2418
|
+
if (r.indexOf(":") === -1)
|
|
2419
|
+
return {
|
|
2420
|
+
name: "RRULE",
|
|
2421
|
+
value: r
|
|
2422
|
+
};
|
|
2423
|
+
var e = yt(r, ":", 1), t = e[0], n = e[1];
|
|
2424
|
+
return {
|
|
2425
|
+
name: t,
|
|
2426
|
+
value: n
|
|
2427
|
+
};
|
|
2428
|
+
}
|
|
2429
|
+
function ur(r) {
|
|
2430
|
+
var e = or(r), t = e.name, n = e.value, i = t.split(";");
|
|
2431
|
+
if (!i)
|
|
2432
|
+
throw new Error("empty property name");
|
|
2433
|
+
return {
|
|
2434
|
+
name: i[0].toUpperCase(),
|
|
2435
|
+
parms: i.slice(1),
|
|
2436
|
+
value: n
|
|
2437
|
+
};
|
|
2438
|
+
}
|
|
2439
|
+
function cr(r, e) {
|
|
2440
|
+
if (e === void 0 && (e = !1), r = r && r.trim(), !r)
|
|
2441
|
+
throw new Error("Invalid empty string");
|
|
2442
|
+
if (!e)
|
|
2443
|
+
return r.split(/\s/);
|
|
2444
|
+
for (var t = r.split(`
|
|
2445
|
+
`), n = 0; n < t.length; ) {
|
|
2446
|
+
var i = t[n] = t[n].replace(/\s+$/g, "");
|
|
2447
|
+
i ? n > 0 && i[0] === " " ? (t[n - 1] += i.slice(1), t.splice(n, 1)) : n += 1 : t.splice(n, 1);
|
|
2448
|
+
}
|
|
2449
|
+
return t;
|
|
2450
|
+
}
|
|
2451
|
+
function lr(r) {
|
|
2452
|
+
r.forEach(function(e) {
|
|
2453
|
+
if (!/(VALUE=DATE(-TIME)?)|(TZID=)/.test(e))
|
|
2454
|
+
throw new Error("unsupported RDATE/EXDATE parm: " + e);
|
|
2455
|
+
});
|
|
2456
|
+
}
|
|
2457
|
+
function Ne(r, e) {
|
|
2458
|
+
return lr(e), r.split(",").map(function(t) {
|
|
2459
|
+
return ve(t);
|
|
2460
|
+
});
|
|
2461
|
+
}
|
|
2462
|
+
function Ce(r) {
|
|
2463
|
+
var e = this;
|
|
2464
|
+
return function(t) {
|
|
2465
|
+
if (t !== void 0 && (e["_".concat(r)] = t), e["_".concat(r)] !== void 0)
|
|
2466
|
+
return e["_".concat(r)];
|
|
2467
|
+
for (var n = 0; n < e._rrule.length; n++) {
|
|
2468
|
+
var i = e._rrule[n].origOptions[r];
|
|
2469
|
+
if (i)
|
|
2470
|
+
return i;
|
|
2471
|
+
}
|
|
2472
|
+
};
|
|
2473
|
+
}
|
|
2474
|
+
var dr = (
|
|
2475
|
+
/** @class */
|
|
2476
|
+
(function(r) {
|
|
2477
|
+
pe(e, r);
|
|
2478
|
+
function e(t) {
|
|
2479
|
+
t === void 0 && (t = !1);
|
|
2480
|
+
var n = r.call(this, {}, t) || this;
|
|
2481
|
+
return n.dtstart = Ce.apply(n, ["dtstart"]), n.tzid = Ce.apply(n, ["tzid"]), n._rrule = [], n._rdate = [], n._exrule = [], n._exdate = [], n;
|
|
2482
|
+
}
|
|
2483
|
+
return e.prototype._iter = function(t) {
|
|
2484
|
+
return nr(t, this._rrule, this._exrule, this._rdate, this._exdate, this.tzid());
|
|
2485
|
+
}, e.prototype.rrule = function(t) {
|
|
2486
|
+
We(t, this._rrule);
|
|
2487
|
+
}, e.prototype.exrule = function(t) {
|
|
2488
|
+
We(t, this._exrule);
|
|
2489
|
+
}, e.prototype.rdate = function(t) {
|
|
2490
|
+
ze(t, this._rdate);
|
|
2491
|
+
}, e.prototype.exdate = function(t) {
|
|
2492
|
+
ze(t, this._exdate);
|
|
2493
|
+
}, e.prototype.rrules = function() {
|
|
2494
|
+
return this._rrule.map(function(t) {
|
|
2495
|
+
return Ye(t.toString());
|
|
2496
|
+
});
|
|
2497
|
+
}, e.prototype.exrules = function() {
|
|
2498
|
+
return this._exrule.map(function(t) {
|
|
2499
|
+
return Ye(t.toString());
|
|
2500
|
+
});
|
|
2501
|
+
}, e.prototype.rdates = function() {
|
|
2502
|
+
return this._rdate.map(function(t) {
|
|
2503
|
+
return new Date(t.getTime());
|
|
2504
|
+
});
|
|
2505
|
+
}, e.prototype.exdates = function() {
|
|
2506
|
+
return this._exdate.map(function(t) {
|
|
2507
|
+
return new Date(t.getTime());
|
|
2508
|
+
});
|
|
2509
|
+
}, e.prototype.valueOf = function() {
|
|
2510
|
+
var t = [];
|
|
2511
|
+
return !this._rrule.length && this._dtstart && (t = t.concat(he({ dtstart: this._dtstart }))), this._rrule.forEach(function(n) {
|
|
2512
|
+
t = t.concat(n.toString().split(`
|
|
2513
|
+
`));
|
|
2514
|
+
}), this._exrule.forEach(function(n) {
|
|
2515
|
+
t = t.concat(n.toString().split(`
|
|
2516
|
+
`).map(function(i) {
|
|
2517
|
+
return i.replace(/^RRULE:/, "EXRULE:");
|
|
2518
|
+
}).filter(function(i) {
|
|
2519
|
+
return !/^DTSTART/.test(i);
|
|
2520
|
+
}));
|
|
2521
|
+
}), this._rdate.length && t.push(He("RDATE", this._rdate, this.tzid())), this._exdate.length && t.push(He("EXDATE", this._exdate, this.tzid())), t;
|
|
2522
|
+
}, e.prototype.toString = function() {
|
|
2523
|
+
return this.valueOf().join(`
|
|
2524
|
+
`);
|
|
2525
|
+
}, e.prototype.clone = function() {
|
|
2526
|
+
var t = new e(!!this._cache);
|
|
2527
|
+
return this._rrule.forEach(function(n) {
|
|
2528
|
+
return t.rrule(n.clone());
|
|
2529
|
+
}), this._exrule.forEach(function(n) {
|
|
2530
|
+
return t.exrule(n.clone());
|
|
2531
|
+
}), this._rdate.forEach(function(n) {
|
|
2532
|
+
return t.rdate(new Date(n.getTime()));
|
|
2533
|
+
}), this._exdate.forEach(function(n) {
|
|
2534
|
+
return t.exdate(new Date(n.getTime()));
|
|
2535
|
+
}), t;
|
|
2536
|
+
}, e;
|
|
2537
|
+
})(v)
|
|
2538
|
+
);
|
|
2539
|
+
function We(r, e) {
|
|
2540
|
+
if (!(r instanceof v))
|
|
2541
|
+
throw new TypeError(String(r) + " is not RRule instance");
|
|
2542
|
+
k(e.map(String), String(r)) || e.push(r);
|
|
2543
|
+
}
|
|
2544
|
+
function ze(r, e) {
|
|
2545
|
+
if (!(r instanceof Date))
|
|
2546
|
+
throw new TypeError(String(r) + " is not Date instance");
|
|
2547
|
+
k(e.map(Number), Number(r)) || (e.push(r), V(e));
|
|
2548
|
+
}
|
|
2549
|
+
function He(r, e, t) {
|
|
2550
|
+
var n = !t || t.toUpperCase() === "UTC", i = n ? "".concat(r, ":") : "".concat(r, ";TZID=").concat(t, ":"), s = e.map(function(a) {
|
|
2551
|
+
return me(a.valueOf(), n);
|
|
2552
|
+
}).join(",");
|
|
2553
|
+
return "".concat(i).concat(s);
|
|
2554
|
+
}
|
|
2555
|
+
function Pe(r, e, t) {
|
|
2556
|
+
const n = [];
|
|
2557
|
+
for (const i of r) {
|
|
2558
|
+
if (!i.recurrenceRule) {
|
|
2559
|
+
n.push({
|
|
2560
|
+
id: i.id,
|
|
2561
|
+
title: i.title,
|
|
2562
|
+
startTime: i.startTime,
|
|
2563
|
+
endTime: i.endTime,
|
|
2564
|
+
resourceId: i.resourceId,
|
|
2565
|
+
resourceIds: i.resourceIds,
|
|
2566
|
+
status: i.status,
|
|
2567
|
+
description: i.description,
|
|
2568
|
+
color: i.color,
|
|
2569
|
+
allDay: i.allDay
|
|
2570
|
+
});
|
|
2571
|
+
continue;
|
|
2572
|
+
}
|
|
2573
|
+
try {
|
|
2574
|
+
const s = new Date(e), a = new Date(t), o = v.parseString(i.recurrenceRule);
|
|
2575
|
+
o.dtstart = new Date(i.startTime);
|
|
2576
|
+
const c = new v(o).between(s, a, !0), d = new Date(i.endTime).getTime() - new Date(i.startTime).getTime();
|
|
2577
|
+
for (const h of c) {
|
|
2578
|
+
const l = h.getTime(), y = l + d;
|
|
2579
|
+
n.push({
|
|
2580
|
+
id: `${i.id}_occ_${l}`,
|
|
2581
|
+
title: i.title,
|
|
2582
|
+
startTime: new Date(l).toISOString(),
|
|
2583
|
+
endTime: new Date(y).toISOString(),
|
|
2584
|
+
resourceId: i.resourceId,
|
|
2585
|
+
resourceIds: i.resourceIds,
|
|
2586
|
+
status: i.status,
|
|
2587
|
+
description: i.description,
|
|
2588
|
+
color: i.color,
|
|
2589
|
+
allDay: i.allDay,
|
|
2590
|
+
recurrenceRule: i.recurrenceRule
|
|
2591
|
+
});
|
|
2592
|
+
}
|
|
2593
|
+
} catch (s) {
|
|
2594
|
+
console.error(
|
|
2595
|
+
`Failed to expand recurrence rule for event ${i.id}:`,
|
|
2596
|
+
s
|
|
2597
|
+
), n.push({
|
|
2598
|
+
id: i.id,
|
|
2599
|
+
title: i.title,
|
|
2600
|
+
startTime: i.startTime,
|
|
2601
|
+
endTime: i.endTime,
|
|
2602
|
+
resourceId: i.resourceId,
|
|
2603
|
+
resourceIds: i.resourceIds,
|
|
2604
|
+
status: i.status,
|
|
2605
|
+
description: i.description,
|
|
2606
|
+
color: i.color,
|
|
2607
|
+
allDay: i.allDay
|
|
2608
|
+
});
|
|
2609
|
+
}
|
|
2610
|
+
}
|
|
2611
|
+
return n;
|
|
2612
|
+
}
|
|
2613
|
+
function je(r, e, t = 50) {
|
|
2614
|
+
const n = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set();
|
|
2615
|
+
if (!r.events || r.events.length <= 1)
|
|
2616
|
+
return { conflictingEventIds: n, messages: [] };
|
|
2617
|
+
const s = [...r.events].sort((a, o) => a.startMs - o.startMs);
|
|
2618
|
+
for (let a = 0; a < s.length; a++) {
|
|
2619
|
+
const o = s[a];
|
|
2620
|
+
for (let u = a + 1; u < s.length; u++) {
|
|
2621
|
+
const c = s[u];
|
|
2622
|
+
if (c.startMs >= o.endMs)
|
|
2623
|
+
break;
|
|
2624
|
+
if (n.add(o.id), n.add(c.id), i.size < t) {
|
|
2625
|
+
const d = Math.max(o.startMs, c.startMs), h = Math.min(o.endMs, c.endMs), { dateLabel: l, startTimeLabel: y, endTimeLabel: m } = Qe(
|
|
2626
|
+
new Date(d).toISOString(),
|
|
2627
|
+
new Date(h).toISOString(),
|
|
2628
|
+
e
|
|
2629
|
+
), p = `Conflict: ${r.name} has overlapping events "${o.title}" and "${c.title}" on ${l} between ${y} and ${m}.`;
|
|
2630
|
+
i.add(p);
|
|
2631
|
+
}
|
|
2632
|
+
}
|
|
2633
|
+
}
|
|
2634
|
+
return {
|
|
2635
|
+
conflictingEventIds: n,
|
|
2636
|
+
messages: Array.from(i)
|
|
2637
|
+
};
|
|
2638
|
+
}
|
|
2639
|
+
function br(r, e) {
|
|
2640
|
+
const t = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set();
|
|
2641
|
+
for (const i of r)
|
|
2642
|
+
if (n.size >= 50 && t.size > 0) {
|
|
2643
|
+
const s = je(i, e, 0);
|
|
2644
|
+
for (const a of s.conflictingEventIds)
|
|
2645
|
+
t.add(a);
|
|
2646
|
+
} else {
|
|
2647
|
+
const s = je(
|
|
2648
|
+
i,
|
|
2649
|
+
e,
|
|
2650
|
+
Math.max(0, 50 - n.size)
|
|
2651
|
+
);
|
|
2652
|
+
for (const a of s.conflictingEventIds)
|
|
2653
|
+
t.add(a);
|
|
2654
|
+
for (const a of s.messages)
|
|
2655
|
+
n.size < 50 && n.add(a);
|
|
2656
|
+
}
|
|
2657
|
+
return {
|
|
2658
|
+
hasConflict: t.size > 0,
|
|
2659
|
+
messages: Array.from(n),
|
|
2660
|
+
conflictingEventIds: t
|
|
2661
|
+
};
|
|
2662
|
+
}
|
|
2663
|
+
function gr(r, e, t, n) {
|
|
2664
|
+
const i = n ? n.replace(/_occ_\d+$/, "") : null;
|
|
2665
|
+
for (const s of r)
|
|
2666
|
+
if (!(i && s.id.replace(/_occ_\d+$/, "") === i) && e < s.endMs && t > s.startMs)
|
|
2667
|
+
return !0;
|
|
2668
|
+
return !1;
|
|
2669
|
+
}
|
|
2670
|
+
function wr(r, e, t) {
|
|
2671
|
+
if (!r.title || r.participants.length === 0)
|
|
2672
|
+
return { hasConflict: !1, message: "", resourceIds: [] };
|
|
2673
|
+
const n = (/* @__PURE__ */ new Date(r.startDate + "T00:00:00")).getTime();
|
|
2674
|
+
let i = (/* @__PURE__ */ new Date(r.endDate + "T23:59:59")).getTime();
|
|
2675
|
+
if (r.recurrenceRule) {
|
|
2676
|
+
let c = n + 31536e6;
|
|
2677
|
+
const d = r.recurrenceRule.match(/UNTIL=([0-9T]+)/);
|
|
2678
|
+
if (d) {
|
|
2679
|
+
const h = d[1], l = h.slice(0, 4), y = h.slice(4, 6), m = h.slice(6, 8), p = (/* @__PURE__ */ new Date(`${l}-${y}-${m}T23:59:59`)).getTime();
|
|
2680
|
+
isNaN(p) || (c = p);
|
|
2681
|
+
}
|
|
2682
|
+
i = c;
|
|
2683
|
+
}
|
|
2684
|
+
let s;
|
|
2685
|
+
try {
|
|
2686
|
+
const c = Ee(
|
|
2687
|
+
r.startDate,
|
|
2688
|
+
r.startTime,
|
|
2689
|
+
t
|
|
2690
|
+
), d = Ee(r.endDate, r.endTime, t), h = new ae({
|
|
2691
|
+
id: "draft",
|
|
2692
|
+
title: r.title,
|
|
2693
|
+
startTime: c,
|
|
2694
|
+
endTime: d,
|
|
2695
|
+
resourceIds: r.participants,
|
|
2696
|
+
allDay: r.allDay,
|
|
2697
|
+
recurrenceRule: r.recurrenceRule
|
|
2698
|
+
});
|
|
2699
|
+
s = Pe([h], n, i);
|
|
2700
|
+
} catch {
|
|
2701
|
+
return { hasConflict: !1, message: "", resourceIds: [] };
|
|
2702
|
+
}
|
|
2703
|
+
if (s.length === 0)
|
|
2704
|
+
return { hasConflict: !1, message: "", resourceIds: [] };
|
|
2705
|
+
const a = r.id ? r.id.replace(/_occ_\d+$/, "") : null, o = e.filter(
|
|
2706
|
+
(c) => c.id.replace(/_occ_\d+$/, "") !== a
|
|
2707
|
+
), u = Pe(
|
|
2708
|
+
o,
|
|
2709
|
+
n,
|
|
2710
|
+
i
|
|
2711
|
+
);
|
|
2712
|
+
for (const c of s) {
|
|
2713
|
+
const d = new Date(c.startTime).getTime(), h = new Date(c.endTime).getTime();
|
|
2714
|
+
for (const l of u) {
|
|
2715
|
+
const y = new Date(l.startTime).getTime(), m = new Date(l.endTime).getTime();
|
|
2716
|
+
if (d < m && h > y) {
|
|
2717
|
+
const p = c.resourceIds || (c.resourceId ? [c.resourceId] : []), b = l.resourceIds || (l.resourceId ? [l.resourceId] : []), E = p.filter(
|
|
2718
|
+
(D) => b.includes(D)
|
|
2719
|
+
);
|
|
2720
|
+
if (E.length > 0) {
|
|
2721
|
+
const { dateLabel: D, startTimeLabel: Y, endTimeLabel: z } = Qe(l.startTime, l.endTime, t);
|
|
2722
|
+
return {
|
|
2723
|
+
hasConflict: !0,
|
|
2724
|
+
message: `Conflict: [REPLACE_RESOURCES] already scheduled on ${D} between ${Y} and ${z} in "${l.title}".`,
|
|
2725
|
+
resourceIds: E
|
|
2726
|
+
};
|
|
2727
|
+
}
|
|
2728
|
+
}
|
|
2729
|
+
}
|
|
2730
|
+
}
|
|
2731
|
+
return { hasConflict: !1, message: "", resourceIds: [] };
|
|
2732
|
+
}
|
|
2733
|
+
function Qe(r, e, t) {
|
|
2734
|
+
const { date: n, time: i } = Te(
|
|
2735
|
+
r,
|
|
2736
|
+
t
|
|
2737
|
+
), { time: s } = Te(e, t), [, a, o] = n.split("-"), u = [
|
|
2738
|
+
"Jan",
|
|
2739
|
+
"Feb",
|
|
2740
|
+
"Mar",
|
|
2741
|
+
"Apr",
|
|
2742
|
+
"May",
|
|
2743
|
+
"Jun",
|
|
2744
|
+
"Jul",
|
|
2745
|
+
"Aug",
|
|
2746
|
+
"Sep",
|
|
2747
|
+
"Oct",
|
|
2748
|
+
"Nov",
|
|
2749
|
+
"Dec"
|
|
2750
|
+
], c = parseInt(a, 10) - 1, d = c >= 0 && c < 12 ? `${u[c]} ${parseInt(o, 10)}` : n, h = (l) => {
|
|
2751
|
+
if (!l) return "";
|
|
2752
|
+
const [y, m] = l.split(":").map(Number);
|
|
2753
|
+
return `${y % 12 || 12}:${String(m).padStart(2, "0")} ${y >= 12 ? "PM" : "AM"}`;
|
|
2754
|
+
};
|
|
2755
|
+
return {
|
|
2756
|
+
dateLabel: d,
|
|
2757
|
+
startTimeLabel: h(i),
|
|
2758
|
+
endTimeLabel: h(s)
|
|
2759
|
+
};
|
|
2760
|
+
}
|
|
548
2761
|
export {
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
2762
|
+
rt as Assignment,
|
|
2763
|
+
ae as Event,
|
|
2764
|
+
ht as JanusEventBus,
|
|
2765
|
+
we as Resource,
|
|
2766
|
+
vr as SchedulerManager,
|
|
2767
|
+
wr as checkDraftConflict,
|
|
2768
|
+
gr as checkSlotConflict,
|
|
2769
|
+
je as computeSingleResourceConflicts,
|
|
2770
|
+
br as computeTimelineConflicts,
|
|
2771
|
+
Pe as expandEvents,
|
|
2772
|
+
yr as formatTimezoneLabel,
|
|
2773
|
+
mr as getAllTimezones,
|
|
2774
|
+
nt as getBrowserTimezone,
|
|
2775
|
+
ot as getUtcMsForZonedDatetime,
|
|
2776
|
+
Te as isoToZonedDisplay,
|
|
2777
|
+
pr as janusEventBus,
|
|
2778
|
+
g as schedulerStore,
|
|
2779
|
+
fr as toFakeLocalDate,
|
|
2780
|
+
Ee as zonedInputToISO
|
|
563
2781
|
};
|
|
564
2782
|
//# sourceMappingURL=janus-scheduler.es.js.map
|