@forcecalendar/interface 1.0.13 → 1.0.14

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.
@@ -1,7 +1,7 @@
1
- var B = Object.defineProperty;
2
- var P = (m, e, t) => e in m ? B(m, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : m[e] = t;
3
- var S = (m, e, t) => P(m, typeof e != "symbol" ? e + "" : e, t);
4
- class E extends HTMLElement {
1
+ var P = Object.defineProperty;
2
+ var U = (p, e, t) => e in p ? P(p, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : p[e] = t;
3
+ var z = (p, e, t) => U(p, typeof e != "symbol" ? e + "" : e, t);
4
+ class $ extends HTMLElement {
5
5
  constructor() {
6
6
  super(), this.attachShadow({ mode: "open" }), this._listeners = [], this._state = null, this._props = /* @__PURE__ */ new Map(), this._initialized = !1;
7
7
  }
@@ -108,7 +108,7 @@ class E extends HTMLElement {
108
108
  this.setProp(e, s), this._initialized && this.render();
109
109
  }
110
110
  }
111
- class U {
111
+ class V {
112
112
  constructor() {
113
113
  this.timezones = {
114
114
  // UTC
@@ -120,36 +120,141 @@ class U {
120
120
  "Africa/Addis_Ababa": { offset: 180, dst: null },
121
121
  "Africa/Algiers": { offset: 60, dst: null },
122
122
  "Africa/Cairo": { offset: 120, dst: null },
123
- "Africa/Casablanca": { offset: 60, dst: { start: { month: 3, week: -1, day: 0 }, end: { month: 10, week: -1, day: 0 }, offset: 60 } },
123
+ "Africa/Casablanca": {
124
+ offset: 60,
125
+ dst: {
126
+ start: { month: 3, week: -1, day: 0 },
127
+ end: { month: 10, week: -1, day: 0 },
128
+ offset: 60
129
+ }
130
+ },
124
131
  "Africa/Johannesburg": { offset: 120, dst: null },
125
132
  "Africa/Lagos": { offset: 60, dst: null },
126
133
  "Africa/Nairobi": { offset: 180, dst: null },
127
134
  // Americas
128
- "America/Anchorage": { offset: -540, dst: { start: { month: 3, week: 2, day: 0 }, end: { month: 11, week: 1, day: 0 }, offset: 60 } },
135
+ "America/Anchorage": {
136
+ offset: -540,
137
+ dst: {
138
+ start: { month: 3, week: 2, day: 0 },
139
+ end: { month: 11, week: 1, day: 0 },
140
+ offset: 60
141
+ }
142
+ },
129
143
  "America/Argentina/Buenos_Aires": { offset: -180, dst: null },
130
144
  "America/Bogota": { offset: -300, dst: null },
131
145
  "America/Caracas": { offset: -240, dst: null },
132
- "America/Chicago": { offset: -360, dst: { start: { month: 3, week: 2, day: 0 }, end: { month: 11, week: 1, day: 0 }, offset: 60 } },
133
- "America/Denver": { offset: -420, dst: { start: { month: 3, week: 2, day: 0 }, end: { month: 11, week: 1, day: 0 }, offset: 60 } },
134
- "America/Detroit": { offset: -300, dst: { start: { month: 3, week: 2, day: 0 }, end: { month: 11, week: 1, day: 0 }, offset: 60 } },
135
- "America/Halifax": { offset: -240, dst: { start: { month: 3, week: 2, day: 0 }, end: { month: 11, week: 1, day: 0 }, offset: 60 } },
136
- "America/Los_Angeles": { offset: -480, dst: { start: { month: 3, week: 2, day: 0 }, end: { month: 11, week: 1, day: 0 }, offset: 60 } },
137
- "America/Mexico_City": { offset: -360, dst: { start: { month: 4, week: 1, day: 0 }, end: { month: 10, week: -1, day: 0 }, offset: 60 } },
138
- "America/New_York": { offset: -300, dst: { start: { month: 3, week: 2, day: 0 }, end: { month: 11, week: 1, day: 0 }, offset: 60 } },
146
+ "America/Chicago": {
147
+ offset: -360,
148
+ dst: {
149
+ start: { month: 3, week: 2, day: 0 },
150
+ end: { month: 11, week: 1, day: 0 },
151
+ offset: 60
152
+ }
153
+ },
154
+ "America/Denver": {
155
+ offset: -420,
156
+ dst: {
157
+ start: { month: 3, week: 2, day: 0 },
158
+ end: { month: 11, week: 1, day: 0 },
159
+ offset: 60
160
+ }
161
+ },
162
+ "America/Detroit": {
163
+ offset: -300,
164
+ dst: {
165
+ start: { month: 3, week: 2, day: 0 },
166
+ end: { month: 11, week: 1, day: 0 },
167
+ offset: 60
168
+ }
169
+ },
170
+ "America/Halifax": {
171
+ offset: -240,
172
+ dst: {
173
+ start: { month: 3, week: 2, day: 0 },
174
+ end: { month: 11, week: 1, day: 0 },
175
+ offset: 60
176
+ }
177
+ },
178
+ "America/Los_Angeles": {
179
+ offset: -480,
180
+ dst: {
181
+ start: { month: 3, week: 2, day: 0 },
182
+ end: { month: 11, week: 1, day: 0 },
183
+ offset: 60
184
+ }
185
+ },
186
+ "America/Mexico_City": {
187
+ offset: -360,
188
+ dst: {
189
+ start: { month: 4, week: 1, day: 0 },
190
+ end: { month: 10, week: -1, day: 0 },
191
+ offset: 60
192
+ }
193
+ },
194
+ "America/New_York": {
195
+ offset: -300,
196
+ dst: {
197
+ start: { month: 3, week: 2, day: 0 },
198
+ end: { month: 11, week: 1, day: 0 },
199
+ offset: 60
200
+ }
201
+ },
139
202
  "America/Phoenix": { offset: -420, dst: null },
140
203
  "America/Regina": { offset: -360, dst: null },
141
- "America/Santiago": { offset: -180, dst: { start: { month: 9, week: 1, day: 0 }, end: { month: 4, week: 1, day: 0 }, offset: 60 } },
142
- "America/Sao_Paulo": { offset: -180, dst: { start: { month: 10, week: 3, day: 0 }, end: { month: 2, week: 3, day: 0 }, offset: 60 } },
143
- "America/St_Johns": { offset: -210, dst: { start: { month: 3, week: 2, day: 0 }, end: { month: 11, week: 1, day: 0 }, offset: 60 } },
144
- "America/Toronto": { offset: -300, dst: { start: { month: 3, week: 2, day: 0 }, end: { month: 11, week: 1, day: 0 }, offset: 60 } },
145
- "America/Vancouver": { offset: -480, dst: { start: { month: 3, week: 2, day: 0 }, end: { month: 11, week: 1, day: 0 }, offset: 60 } },
204
+ "America/Santiago": {
205
+ offset: -180,
206
+ dst: {
207
+ start: { month: 9, week: 1, day: 0 },
208
+ end: { month: 4, week: 1, day: 0 },
209
+ offset: 60
210
+ }
211
+ },
212
+ "America/Sao_Paulo": {
213
+ offset: -180,
214
+ dst: {
215
+ start: { month: 10, week: 3, day: 0 },
216
+ end: { month: 2, week: 3, day: 0 },
217
+ offset: 60
218
+ }
219
+ },
220
+ "America/St_Johns": {
221
+ offset: -210,
222
+ dst: {
223
+ start: { month: 3, week: 2, day: 0 },
224
+ end: { month: 11, week: 1, day: 0 },
225
+ offset: 60
226
+ }
227
+ },
228
+ "America/Toronto": {
229
+ offset: -300,
230
+ dst: {
231
+ start: { month: 3, week: 2, day: 0 },
232
+ end: { month: 11, week: 1, day: 0 },
233
+ offset: 60
234
+ }
235
+ },
236
+ "America/Vancouver": {
237
+ offset: -480,
238
+ dst: {
239
+ start: { month: 3, week: 2, day: 0 },
240
+ end: { month: 11, week: 1, day: 0 },
241
+ offset: 60
242
+ }
243
+ },
146
244
  // Asia
147
245
  "Asia/Baghdad": { offset: 180, dst: null },
148
246
  "Asia/Bangkok": { offset: 420, dst: null },
149
247
  "Asia/Dubai": { offset: 240, dst: null },
150
248
  "Asia/Hong_Kong": { offset: 480, dst: null },
151
249
  "Asia/Jakarta": { offset: 420, dst: null },
152
- "Asia/Jerusalem": { offset: 120, dst: { start: { month: 3, week: -1, day: 5 }, end: { month: 10, week: -1, day: 0 }, offset: 60 } },
250
+ "Asia/Jerusalem": {
251
+ offset: 120,
252
+ dst: {
253
+ start: { month: 3, week: -1, day: 5 },
254
+ end: { month: 10, week: -1, day: 0 },
255
+ offset: 60
256
+ }
257
+ },
153
258
  "Asia/Karachi": { offset: 300, dst: null },
154
259
  "Asia/Kolkata": { offset: 330, dst: null },
155
260
  "Asia/Kuala_Lumpur": { offset: 480, dst: null },
@@ -158,49 +263,252 @@ class U {
158
263
  "Asia/Shanghai": { offset: 480, dst: null },
159
264
  "Asia/Singapore": { offset: 480, dst: null },
160
265
  "Asia/Taipei": { offset: 480, dst: null },
161
- "Asia/Tehran": { offset: 210, dst: { start: { month: 3, week: 4, day: 0 }, end: { month: 9, week: 4, day: 0 }, offset: 60 } },
266
+ "Asia/Tehran": {
267
+ offset: 210,
268
+ dst: {
269
+ start: { month: 3, week: 4, day: 0 },
270
+ end: { month: 9, week: 4, day: 0 },
271
+ offset: 60
272
+ }
273
+ },
162
274
  "Asia/Tokyo": { offset: 540, dst: null },
163
275
  // Atlantic
164
- "Atlantic/Azores": { offset: -60, dst: { start: { month: 3, week: -1, day: 0 }, end: { month: 10, week: -1, day: 0 }, offset: 60 } },
165
- "Atlantic/Bermuda": { offset: -240, dst: { start: { month: 3, week: 2, day: 0 }, end: { month: 11, week: 1, day: 0 }, offset: 60 } },
276
+ "Atlantic/Azores": {
277
+ offset: -60,
278
+ dst: {
279
+ start: { month: 3, week: -1, day: 0 },
280
+ end: { month: 10, week: -1, day: 0 },
281
+ offset: 60
282
+ }
283
+ },
284
+ "Atlantic/Bermuda": {
285
+ offset: -240,
286
+ dst: {
287
+ start: { month: 3, week: 2, day: 0 },
288
+ end: { month: 11, week: 1, day: 0 },
289
+ offset: 60
290
+ }
291
+ },
166
292
  "Atlantic/Reykjavik": { offset: 0, dst: null },
167
293
  // Australia & Pacific
168
- "Australia/Adelaide": { offset: 570, dst: { start: { month: 10, week: 1, day: 0 }, end: { month: 4, week: 1, day: 0 }, offset: 60 } },
294
+ "Australia/Adelaide": {
295
+ offset: 570,
296
+ dst: {
297
+ start: { month: 10, week: 1, day: 0 },
298
+ end: { month: 4, week: 1, day: 0 },
299
+ offset: 60
300
+ }
301
+ },
169
302
  "Australia/Brisbane": { offset: 600, dst: null },
170
303
  "Australia/Darwin": { offset: 570, dst: null },
171
- "Australia/Hobart": { offset: 600, dst: { start: { month: 10, week: 1, day: 0 }, end: { month: 4, week: 1, day: 0 }, offset: 60 } },
172
- "Australia/Melbourne": { offset: 600, dst: { start: { month: 10, week: 1, day: 0 }, end: { month: 4, week: 1, day: 0 }, offset: 60 } },
304
+ "Australia/Hobart": {
305
+ offset: 600,
306
+ dst: {
307
+ start: { month: 10, week: 1, day: 0 },
308
+ end: { month: 4, week: 1, day: 0 },
309
+ offset: 60
310
+ }
311
+ },
312
+ "Australia/Melbourne": {
313
+ offset: 600,
314
+ dst: {
315
+ start: { month: 10, week: 1, day: 0 },
316
+ end: { month: 4, week: 1, day: 0 },
317
+ offset: 60
318
+ }
319
+ },
173
320
  "Australia/Perth": { offset: 480, dst: null },
174
- "Australia/Sydney": { offset: 600, dst: { start: { month: 10, week: 1, day: 0 }, end: { month: 4, week: 1, day: 0 }, offset: 60 } },
321
+ "Australia/Sydney": {
322
+ offset: 600,
323
+ dst: {
324
+ start: { month: 10, week: 1, day: 0 },
325
+ end: { month: 4, week: 1, day: 0 },
326
+ offset: 60
327
+ }
328
+ },
175
329
  // Europe
176
- "Europe/Amsterdam": { offset: 60, dst: { start: { month: 3, week: -1, day: 0 }, end: { month: 10, week: -1, day: 0 }, offset: 60 } },
177
- "Europe/Athens": { offset: 120, dst: { start: { month: 3, week: -1, day: 0 }, end: { month: 10, week: -1, day: 0 }, offset: 60 } },
178
- "Europe/Berlin": { offset: 60, dst: { start: { month: 3, week: -1, day: 0 }, end: { month: 10, week: -1, day: 0 }, offset: 60 } },
179
- "Europe/Brussels": { offset: 60, dst: { start: { month: 3, week: -1, day: 0 }, end: { month: 10, week: -1, day: 0 }, offset: 60 } },
180
- "Europe/Budapest": { offset: 60, dst: { start: { month: 3, week: -1, day: 0 }, end: { month: 10, week: -1, day: 0 }, offset: 60 } },
181
- "Europe/Copenhagen": { offset: 60, dst: { start: { month: 3, week: -1, day: 0 }, end: { month: 10, week: -1, day: 0 }, offset: 60 } },
182
- "Europe/Dublin": { offset: 0, dst: { start: { month: 3, week: -1, day: 0 }, end: { month: 10, week: -1, day: 0 }, offset: 60 } },
183
- "Europe/Helsinki": { offset: 120, dst: { start: { month: 3, week: -1, day: 0 }, end: { month: 10, week: -1, day: 0 }, offset: 60 } },
330
+ "Europe/Amsterdam": {
331
+ offset: 60,
332
+ dst: {
333
+ start: { month: 3, week: -1, day: 0 },
334
+ end: { month: 10, week: -1, day: 0 },
335
+ offset: 60
336
+ }
337
+ },
338
+ "Europe/Athens": {
339
+ offset: 120,
340
+ dst: {
341
+ start: { month: 3, week: -1, day: 0 },
342
+ end: { month: 10, week: -1, day: 0 },
343
+ offset: 60
344
+ }
345
+ },
346
+ "Europe/Berlin": {
347
+ offset: 60,
348
+ dst: {
349
+ start: { month: 3, week: -1, day: 0 },
350
+ end: { month: 10, week: -1, day: 0 },
351
+ offset: 60
352
+ }
353
+ },
354
+ "Europe/Brussels": {
355
+ offset: 60,
356
+ dst: {
357
+ start: { month: 3, week: -1, day: 0 },
358
+ end: { month: 10, week: -1, day: 0 },
359
+ offset: 60
360
+ }
361
+ },
362
+ "Europe/Budapest": {
363
+ offset: 60,
364
+ dst: {
365
+ start: { month: 3, week: -1, day: 0 },
366
+ end: { month: 10, week: -1, day: 0 },
367
+ offset: 60
368
+ }
369
+ },
370
+ "Europe/Copenhagen": {
371
+ offset: 60,
372
+ dst: {
373
+ start: { month: 3, week: -1, day: 0 },
374
+ end: { month: 10, week: -1, day: 0 },
375
+ offset: 60
376
+ }
377
+ },
378
+ "Europe/Dublin": {
379
+ offset: 0,
380
+ dst: {
381
+ start: { month: 3, week: -1, day: 0 },
382
+ end: { month: 10, week: -1, day: 0 },
383
+ offset: 60
384
+ }
385
+ },
386
+ "Europe/Helsinki": {
387
+ offset: 120,
388
+ dst: {
389
+ start: { month: 3, week: -1, day: 0 },
390
+ end: { month: 10, week: -1, day: 0 },
391
+ offset: 60
392
+ }
393
+ },
184
394
  "Europe/Istanbul": { offset: 180, dst: null },
185
- "Europe/Kiev": { offset: 120, dst: { start: { month: 3, week: -1, day: 0 }, end: { month: 10, week: -1, day: 0 }, offset: 60 } },
186
- "Europe/Lisbon": { offset: 0, dst: { start: { month: 3, week: -1, day: 0 }, end: { month: 10, week: -1, day: 0 }, offset: 60 } },
187
- "Europe/London": { offset: 0, dst: { start: { month: 3, week: -1, day: 0 }, end: { month: 10, week: -1, day: 0 }, offset: 60 } },
188
- "Europe/Madrid": { offset: 60, dst: { start: { month: 3, week: -1, day: 0 }, end: { month: 10, week: -1, day: 0 }, offset: 60 } },
395
+ "Europe/Kiev": {
396
+ offset: 120,
397
+ dst: {
398
+ start: { month: 3, week: -1, day: 0 },
399
+ end: { month: 10, week: -1, day: 0 },
400
+ offset: 60
401
+ }
402
+ },
403
+ "Europe/Lisbon": {
404
+ offset: 0,
405
+ dst: {
406
+ start: { month: 3, week: -1, day: 0 },
407
+ end: { month: 10, week: -1, day: 0 },
408
+ offset: 60
409
+ }
410
+ },
411
+ "Europe/London": {
412
+ offset: 0,
413
+ dst: {
414
+ start: { month: 3, week: -1, day: 0 },
415
+ end: { month: 10, week: -1, day: 0 },
416
+ offset: 60
417
+ }
418
+ },
419
+ "Europe/Madrid": {
420
+ offset: 60,
421
+ dst: {
422
+ start: { month: 3, week: -1, day: 0 },
423
+ end: { month: 10, week: -1, day: 0 },
424
+ offset: 60
425
+ }
426
+ },
189
427
  "Europe/Moscow": { offset: 180, dst: null },
190
- "Europe/Oslo": { offset: 60, dst: { start: { month: 3, week: -1, day: 0 }, end: { month: 10, week: -1, day: 0 }, offset: 60 } },
191
- "Europe/Paris": { offset: 60, dst: { start: { month: 3, week: -1, day: 0 }, end: { month: 10, week: -1, day: 0 }, offset: 60 } },
192
- "Europe/Prague": { offset: 60, dst: { start: { month: 3, week: -1, day: 0 }, end: { month: 10, week: -1, day: 0 }, offset: 60 } },
193
- "Europe/Rome": { offset: 60, dst: { start: { month: 3, week: -1, day: 0 }, end: { month: 10, week: -1, day: 0 }, offset: 60 } },
194
- "Europe/Stockholm": { offset: 60, dst: { start: { month: 3, week: -1, day: 0 }, end: { month: 10, week: -1, day: 0 }, offset: 60 } },
195
- "Europe/Vienna": { offset: 60, dst: { start: { month: 3, week: -1, day: 0 }, end: { month: 10, week: -1, day: 0 }, offset: 60 } },
196
- "Europe/Warsaw": { offset: 60, dst: { start: { month: 3, week: -1, day: 0 }, end: { month: 10, week: -1, day: 0 }, offset: 60 } },
197
- "Europe/Zurich": { offset: 60, dst: { start: { month: 3, week: -1, day: 0 }, end: { month: 10, week: -1, day: 0 }, offset: 60 } },
428
+ "Europe/Oslo": {
429
+ offset: 60,
430
+ dst: {
431
+ start: { month: 3, week: -1, day: 0 },
432
+ end: { month: 10, week: -1, day: 0 },
433
+ offset: 60
434
+ }
435
+ },
436
+ "Europe/Paris": {
437
+ offset: 60,
438
+ dst: {
439
+ start: { month: 3, week: -1, day: 0 },
440
+ end: { month: 10, week: -1, day: 0 },
441
+ offset: 60
442
+ }
443
+ },
444
+ "Europe/Prague": {
445
+ offset: 60,
446
+ dst: {
447
+ start: { month: 3, week: -1, day: 0 },
448
+ end: { month: 10, week: -1, day: 0 },
449
+ offset: 60
450
+ }
451
+ },
452
+ "Europe/Rome": {
453
+ offset: 60,
454
+ dst: {
455
+ start: { month: 3, week: -1, day: 0 },
456
+ end: { month: 10, week: -1, day: 0 },
457
+ offset: 60
458
+ }
459
+ },
460
+ "Europe/Stockholm": {
461
+ offset: 60,
462
+ dst: {
463
+ start: { month: 3, week: -1, day: 0 },
464
+ end: { month: 10, week: -1, day: 0 },
465
+ offset: 60
466
+ }
467
+ },
468
+ "Europe/Vienna": {
469
+ offset: 60,
470
+ dst: {
471
+ start: { month: 3, week: -1, day: 0 },
472
+ end: { month: 10, week: -1, day: 0 },
473
+ offset: 60
474
+ }
475
+ },
476
+ "Europe/Warsaw": {
477
+ offset: 60,
478
+ dst: {
479
+ start: { month: 3, week: -1, day: 0 },
480
+ end: { month: 10, week: -1, day: 0 },
481
+ offset: 60
482
+ }
483
+ },
484
+ "Europe/Zurich": {
485
+ offset: 60,
486
+ dst: {
487
+ start: { month: 3, week: -1, day: 0 },
488
+ end: { month: 10, week: -1, day: 0 },
489
+ offset: 60
490
+ }
491
+ },
198
492
  // Indian
199
493
  "Indian/Maldives": { offset: 300, dst: null },
200
494
  "Indian/Mauritius": { offset: 240, dst: null },
201
495
  // Pacific
202
- "Pacific/Auckland": { offset: 720, dst: { start: { month: 9, week: -1, day: 0 }, end: { month: 4, week: 1, day: 0 }, offset: 60 } },
203
- "Pacific/Fiji": { offset: 720, dst: { start: { month: 11, week: 1, day: 0 }, end: { month: 1, week: 3, day: 0 }, offset: 60 } },
496
+ "Pacific/Auckland": {
497
+ offset: 720,
498
+ dst: {
499
+ start: { month: 9, week: -1, day: 0 },
500
+ end: { month: 4, week: 1, day: 0 },
501
+ offset: 60
502
+ }
503
+ },
504
+ "Pacific/Fiji": {
505
+ offset: 720,
506
+ dst: {
507
+ start: { month: 11, week: 1, day: 0 },
508
+ end: { month: 1, week: 3, day: 0 },
509
+ offset: 60
510
+ }
511
+ },
204
512
  "Pacific/Guam": { offset: 600, dst: null },
205
513
  "Pacific/Honolulu": { offset: -600, dst: null },
206
514
  "Pacific/Midway": { offset: -660, dst: null },
@@ -361,18 +669,29 @@ class U {
361
669
  "Pacific/Auckland",
362
670
  "Pacific/Honolulu"
363
671
  ],
364
- Africa: [
365
- "Africa/Cairo",
366
- "Africa/Lagos",
367
- "Africa/Johannesburg",
368
- "Africa/Nairobi"
369
- ]
672
+ Africa: ["Africa/Cairo", "Africa/Lagos", "Africa/Johannesburg", "Africa/Nairobi"]
370
673
  };
371
674
  }
372
675
  }
373
- class A {
676
+ let E = null;
677
+ class S {
678
+ /**
679
+ * Get the shared singleton instance of TimezoneManager
680
+ * This should be used instead of creating new instances to avoid memory bloat
681
+ * @returns {TimezoneManager} The shared instance
682
+ */
683
+ static getInstance() {
684
+ return E || (E = new S()), E;
685
+ }
686
+ /**
687
+ * Reset the singleton instance (useful for testing)
688
+ * @private
689
+ */
690
+ static _resetInstance() {
691
+ E && E.clearCache(), E = null;
692
+ }
374
693
  constructor() {
375
- this.database = new U(), this.offsetCache = /* @__PURE__ */ new Map(), this.dstCache = /* @__PURE__ */ new Map(), this.maxCacheSize = 1e3, this.cacheHits = 0, this.cacheMisses = 0;
694
+ this.database = new V(), this.offsetCache = /* @__PURE__ */ new Map(), this.dstCache = /* @__PURE__ */ new Map(), this.maxCacheSize = 1e3, this.cacheHits = 0, this.cacheMisses = 0;
376
695
  }
377
696
  /**
378
697
  * Convert date from one timezone to another
@@ -384,8 +703,8 @@ class A {
384
703
  convertTimezone(e, t, s) {
385
704
  if (!e) return null;
386
705
  if (t === s) return new Date(e);
387
- const i = this.getTimezoneOffset(e, t), a = (this.getTimezoneOffset(e, s) - i) * 60 * 1e3;
388
- return new Date(e.getTime() + a);
706
+ const i = this.getTimezoneOffset(e, t), n = (this.getTimezoneOffset(e, s) - i) * 60 * 1e3;
707
+ return new Date(e.getTime() + n);
389
708
  }
390
709
  /**
391
710
  * Convert date to UTC
@@ -424,7 +743,7 @@ class A {
424
743
  return this.cacheHits++, this._manageCacheSize(), this.offsetCache.get(s);
425
744
  if (this.cacheMisses++, typeof Intl < "u" && Intl.DateTimeFormat)
426
745
  try {
427
- const n = new Intl.DateTimeFormat("en-US", {
746
+ const a = new Intl.DateTimeFormat("en-US", {
428
747
  timeZone: t,
429
748
  year: "numeric",
430
749
  month: "2-digit",
@@ -434,12 +753,12 @@ class A {
434
753
  second: "2-digit",
435
754
  hour12: !1
436
755
  }).formatToParts(e), c = (new Date(
437
- n.find((l) => l.type === "year").value,
438
- n.find((l) => l.type === "month").value - 1,
439
- n.find((l) => l.type === "day").value,
440
- n.find((l) => l.type === "hour").value,
441
- n.find((l) => l.type === "minute").value,
442
- n.find((l) => l.type === "second").value
756
+ a.find((l) => l.type === "year").value,
757
+ a.find((l) => l.type === "month").value - 1,
758
+ a.find((l) => l.type === "day").value,
759
+ a.find((l) => l.type === "hour").value,
760
+ a.find((l) => l.type === "minute").value,
761
+ a.find((l) => l.type === "second").value
443
762
  ).getTime() - e.getTime()) / (1e3 * 60);
444
763
  return this.offsetCache.set(s, -c), this._manageCacheSize(), -c;
445
764
  } catch {
@@ -459,22 +778,32 @@ class A {
459
778
  */
460
779
  isDST(e, t, s = null) {
461
780
  if (!s) {
462
- const n = this.database.getTimezone(t);
463
- if (!n || !n.dst) return !1;
464
- s = n.dst;
781
+ const a = this.database.getTimezone(t);
782
+ if (!a || !a.dst) return !1;
783
+ s = a.dst;
465
784
  }
466
- const i = e.getFullYear(), r = this.getNthWeekdayOfMonth(i, s.start.month, s.start.week, s.start.day), a = this.getNthWeekdayOfMonth(i, s.end.month, s.end.week, s.end.day);
467
- return r > a ? e >= r || e < a : e >= r && e < a;
785
+ const i = e.getFullYear(), r = this.getNthWeekdayOfMonth(
786
+ i,
787
+ s.start.month,
788
+ s.start.week,
789
+ s.start.day
790
+ ), n = this.getNthWeekdayOfMonth(
791
+ i,
792
+ s.end.month,
793
+ s.end.week,
794
+ s.end.day
795
+ );
796
+ return r > n ? e >= r || e < n : e >= r && e < n;
468
797
  }
469
798
  /**
470
799
  * Get nth weekday of month
471
800
  * @private
472
801
  */
473
802
  getNthWeekdayOfMonth(e, t, s, i) {
474
- const r = new Date(e, t, 1), a = r.getDay();
475
- let n = i - a;
476
- if (n < 0 && (n += 7), s > 0)
477
- r.setDate(1 + n + (s - 1) * 7);
803
+ const r = new Date(e, t, 1), n = r.getDay();
804
+ let a = i - n;
805
+ if (a < 0 && (a += 7), s > 0)
806
+ r.setDate(1 + a + (s - 1) * 7);
478
807
  else {
479
808
  const o = new Date(e, t + 1, 0).getDate();
480
809
  r.setDate(o);
@@ -512,11 +841,15 @@ class A {
512
841
  { value: "Asia/Seoul", label: "Korea Time (Seoul)", region: "Asia" },
513
842
  { value: "Asia/Singapore", label: "Singapore Time", region: "Asia" },
514
843
  { value: "Australia/Sydney", label: "Australian Eastern Time (Sydney)", region: "Oceania" },
515
- { value: "Australia/Melbourne", label: "Australian Eastern Time (Melbourne)", region: "Oceania" },
844
+ {
845
+ value: "Australia/Melbourne",
846
+ label: "Australian Eastern Time (Melbourne)",
847
+ region: "Oceania"
848
+ },
516
849
  { value: "Pacific/Auckland", label: "New Zealand Time (Auckland)", region: "Oceania" },
517
850
  { value: "UTC", label: "UTC", region: "UTC" }
518
851
  ].map((s) => {
519
- const i = this.getTimezoneOffset(e, s.value), r = -i / 60, a = Math.floor(Math.abs(r)), n = Math.round(Math.abs(r % 1) * 60), c = `UTC${r >= 0 ? "+" : "-"}${a.toString().padStart(2, "0")}:${n.toString().padStart(2, "0")}`;
852
+ const i = this.getTimezoneOffset(e, s.value), r = -i / 60, n = Math.floor(Math.abs(r)), a = Math.round(Math.abs(r % 1) * 60), c = `UTC${r >= 0 ? "+" : "-"}${n.toString().padStart(2, "0")}:${a.toString().padStart(2, "0")}`;
520
853
  return {
521
854
  ...s,
522
855
  offset: c,
@@ -572,16 +905,16 @@ class A {
572
905
  */
573
906
  parseTimezone(e) {
574
907
  if (!e) return "UTC";
575
- if (this.database.timezones.hasOwnProperty(e))
908
+ if (Object.prototype.hasOwnProperty.call(this.database.timezones, e))
576
909
  return e;
577
910
  const t = e.toUpperCase();
578
- if (this.database.abbreviations && this.database.abbreviations.hasOwnProperty(t))
911
+ if (this.database.abbreviations && Object.prototype.hasOwnProperty.call(this.database.abbreviations, t))
579
912
  return this.database.abbreviations[t];
580
913
  const s = e.match(/^([+-])(\d{2}):?(\d{2})$/);
581
914
  if (s) {
582
- const i = s[1] === "+" ? 1 : -1, r = parseInt(s[2], 10), a = parseInt(s[3], 10), n = i * (r + a / 60);
915
+ const i = s[1] === "+" ? 1 : -1, r = parseInt(s[2], 10), n = parseInt(s[3], 10), a = i * (r + n / 60);
583
916
  for (const [o, c] of Object.entries(this.database.timezones))
584
- if (c.offset / 60 === n)
917
+ if (c.offset / 60 === a)
585
918
  return o;
586
919
  }
587
920
  return "UTC";
@@ -651,7 +984,7 @@ class T {
651
984
  */
652
985
  static normalize(e) {
653
986
  const t = { ...e };
654
- return t.start && !(t.start instanceof Date) && (t.start = new Date(t.start)), t.end && !(t.end instanceof Date) && (t.end = new Date(t.end)), t.end || (t.end = t.start ? new Date(t.start) : null), t.allDay && t.start && (t.start.setHours(0, 0, 0, 0), t.end && t.end.setHours(23, 59, 59, 999)), t.id = String(t.id || "").trim(), t.title = String(t.title || "").trim(), t.description = String(t.description || "").trim(), t.location = String(t.location || "").trim(), t.attendees = Array.isArray(t.attendees) ? t.attendees : [], t.reminders = Array.isArray(t.reminders) ? t.reminders : [], e.category && !e.categories ? t.categories = [e.category] : t.categories ? t.categories = Array.isArray(t.categories) ? t.categories : [] : t.categories = [], t.attachments = Array.isArray(t.attachments) ? t.attachments : [], ["confirmed", "tentative", "cancelled"].includes(t.status) || (t.status = "confirmed"), ["public", "private", "confidential"].includes(t.visibility) || (t.visibility = "public"), t.color && !t.backgroundColor && (t.backgroundColor = t.color), t.color && !t.borderColor && (t.borderColor = t.color), t;
987
+ return t.start && (t.start = new Date(t.start)), t.end && (t.end = new Date(t.end)), t.end || (t.end = t.start ? new Date(t.start) : null), t.allDay && t.start && (t.start.setHours(0, 0, 0, 0), t.end && t.end.setHours(23, 59, 59, 999)), t.id = String(t.id || "").trim(), t.title = String(t.title || "").trim(), t.description = String(t.description || "").trim(), t.location = String(t.location || "").trim(), t.attendees = Array.isArray(t.attendees) ? t.attendees : [], t.reminders = Array.isArray(t.reminders) ? t.reminders : [], e.category && !e.categories ? t.categories = [e.category] : t.categories ? t.categories = Array.isArray(t.categories) ? t.categories : [] : t.categories = [], t.attachments = Array.isArray(t.attachments) ? t.attachments : [], ["confirmed", "tentative", "cancelled"].includes(t.status) || (t.status = "confirmed"), ["public", "private", "confidential"].includes(t.visibility) || (t.visibility = "public"), t.color && !t.backgroundColor && (t.backgroundColor = t.color), t.color && !t.borderColor && (t.borderColor = t.color), t;
655
988
  }
656
989
  /**
657
990
  * Validate event data
@@ -701,63 +1034,63 @@ class T {
701
1034
  start: s,
702
1035
  end: i,
703
1036
  allDay: r = !1,
704
- description: a = "",
705
- location: n = "",
1037
+ description: n = "",
1038
+ location: a = "",
706
1039
  color: o = null,
707
1040
  backgroundColor: c = null,
708
1041
  borderColor: l = null,
709
1042
  textColor: d = null,
710
1043
  recurring: h = !1,
711
1044
  recurrenceRule: g = null,
712
- timeZone: b = null,
1045
+ timeZone: w = null,
713
1046
  endTimeZone: f = null,
714
- status: D = "confirmed",
715
- visibility: x = "public",
1047
+ status: k = "confirmed",
1048
+ visibility: b = "public",
716
1049
  organizer: M = null,
717
- attendees: I = [],
718
- reminders: z = [],
719
- category: _,
1050
+ attendees: A = [],
1051
+ reminders: I = [],
1052
+ category: L,
720
1053
  // Support singular category (no default)
721
- categories: L,
1054
+ categories: F,
722
1055
  // Support plural categories (no default)
723
- attachments: F = [],
724
- conferenceData: O = null,
725
- metadata: R = {},
726
- ...H
1056
+ attachments: O = [],
1057
+ conferenceData: R = null,
1058
+ metadata: H = {},
1059
+ ...B
727
1060
  // Capture any extra properties
728
1061
  }) {
729
- const p = T.normalize({
1062
+ const m = T.normalize({
730
1063
  id: e,
731
1064
  title: t,
732
1065
  start: s,
733
1066
  end: i,
734
1067
  allDay: r,
735
- description: a,
736
- location: n,
1068
+ description: n,
1069
+ location: a,
737
1070
  color: o,
738
1071
  backgroundColor: c,
739
1072
  borderColor: l,
740
1073
  textColor: d,
741
1074
  recurring: h,
742
1075
  recurrenceRule: g,
743
- timeZone: b,
1076
+ timeZone: w,
744
1077
  endTimeZone: f,
745
- status: D,
746
- visibility: x,
1078
+ status: k,
1079
+ visibility: b,
747
1080
  organizer: M,
748
- attendees: I,
749
- reminders: z,
750
- category: _,
1081
+ attendees: A,
1082
+ reminders: I,
1083
+ category: L,
751
1084
  // Pass category to normalize
752
- categories: L,
1085
+ categories: F,
753
1086
  // Pass categories to normalize
754
- attachments: F,
755
- conferenceData: O,
756
- metadata: R,
757
- ...H
1087
+ attachments: O,
1088
+ conferenceData: R,
1089
+ metadata: H,
1090
+ ...B
758
1091
  // Pass any extra properties
759
1092
  });
760
- T.validate(p), this.id = p.id, this.title = p.title, this._timezoneManager = new A(), this.timeZone = p.timeZone || this._timezoneManager.getSystemTimezone(), this.endTimeZone = p.endTimeZone || this.timeZone, this.start = p.start, this.end = p.end, this.startUTC = this._timezoneManager.toUTC(this.start, this.timeZone), this.endUTC = this._timezoneManager.toUTC(this.end, this.endTimeZone), this.allDay = p.allDay, this.description = p.description, this.location = p.location, this.color = p.color, this.backgroundColor = p.backgroundColor, this.borderColor = p.borderColor, this.textColor = p.textColor, this.recurring = p.recurring, this.recurrenceRule = p.recurrenceRule, this._originalTimeZone = p.timeZone || null, this.status = p.status, this.visibility = p.visibility, this.organizer = p.organizer, this.attendees = [...p.attendees], this.reminders = [...p.reminders], this.categories = p.categories ? [...p.categories] : [], this.attachments = [...p.attachments], this.conferenceData = p.conferenceData, this.metadata = { ...p.metadata }, this._cache = {}, this._validateAttendees(), this._validateReminders();
1093
+ T.validate(m), this.id = m.id, this.title = m.title, this._timezoneManager = S.getInstance(), this.timeZone = m.timeZone || this._timezoneManager.getSystemTimezone(), this.endTimeZone = m.endTimeZone || this.timeZone, this.start = m.start, this.end = m.end, this.startUTC = this._timezoneManager.toUTC(this.start, this.timeZone), this.endUTC = this._timezoneManager.toUTC(this.end, this.endTimeZone), this.allDay = m.allDay, this.description = m.description, this.location = m.location, this.color = m.color, this.backgroundColor = m.backgroundColor, this.borderColor = m.borderColor, this.textColor = m.textColor, this.recurring = m.recurring, this.recurrenceRule = m.recurrenceRule, this._originalTimeZone = m.timeZone || null, this.status = m.status, this.visibility = m.visibility, this.organizer = m.organizer, this.attendees = [...m.attendees], this.reminders = [...m.reminders], this.categories = m.categories ? [...m.categories] : [], this.attachments = [...m.attachments], this.conferenceData = m.conferenceData, this.metadata = { ...m.metadata }, this._cache = {}, this._validateAttendees(), this._validateReminders();
761
1094
  }
762
1095
  /**
763
1096
  * Get event duration in milliseconds
@@ -811,7 +1144,7 @@ class T {
811
1144
  * @returns {boolean} True if event spans multiple days
812
1145
  */
813
1146
  get isMultiDay() {
814
- if (!this._cache.hasOwnProperty("isMultiDay")) {
1147
+ if (!Object.prototype.hasOwnProperty.call(this._cache, "isMultiDay")) {
815
1148
  const e = this.start.toDateString(), t = this.end.toDateString();
816
1149
  this._cache.isMultiDay = e !== t;
817
1150
  }
@@ -835,10 +1168,10 @@ class T {
835
1168
  if (this.allDay)
836
1169
  return e >= new Date(s) && e <= new Date(i);
837
1170
  if (this.isMultiDay) {
838
- const r = new Date(t), a = new Date(t);
839
- return a.setHours(23, 59, 59, 999), this.start <= a && this.end >= r;
840
- } else
841
- return s === t;
1171
+ const r = new Date(t), n = new Date(t);
1172
+ return n.setHours(23, 59, 59, 999), this.start <= n && this.end >= r;
1173
+ }
1174
+ return s === t;
842
1175
  }
843
1176
  /**
844
1177
  * Check if this event overlaps with another event
@@ -958,9 +1291,7 @@ class T {
958
1291
  * @returns {boolean} True if attendee was removed
959
1292
  */
960
1293
  removeAttendee(e) {
961
- const t = this.attendees.findIndex(
962
- (s) => s.email === e || s.id === e
963
- );
1294
+ const t = this.attendees.findIndex((s) => s.email === e || s.id === e);
964
1295
  return t !== -1 ? (this.attendees.splice(t, 1), !0) : !1;
965
1296
  }
966
1297
  /**
@@ -1064,9 +1395,7 @@ class T {
1064
1395
  * @returns {boolean} True if category was removed
1065
1396
  */
1066
1397
  removeCategory(e) {
1067
- const t = e.trim().toLowerCase(), s = this.categories.findIndex(
1068
- (i) => i.toLowerCase() === t
1069
- );
1398
+ const t = e.trim().toLowerCase(), s = this.categories.findIndex((i) => i.toLowerCase() === t);
1070
1399
  return s !== -1 ? (this.categories.splice(s, 1), !0) : !1;
1071
1400
  }
1072
1401
  /**
@@ -1202,7 +1531,7 @@ class T {
1202
1531
  return this.conferenceData !== null;
1203
1532
  }
1204
1533
  }
1205
- let u = class k {
1534
+ let u = class D {
1206
1535
  /**
1207
1536
  * Get the start of a day
1208
1537
  * @param {Date} date - The date
@@ -1229,7 +1558,7 @@ let u = class k {
1229
1558
  */
1230
1559
  static startOfWeek(e, t = 0) {
1231
1560
  const s = new Date(e), i = s.getDay(), r = (i < t ? 7 : 0) + i - t;
1232
- return s.setTime(s.getTime() - r * 24 * 60 * 60 * 1e3), s.setHours(0, 0, 0, 0), s;
1561
+ return s.setDate(s.getDate() - r), s.setHours(0, 0, 0, 0), s;
1233
1562
  }
1234
1563
  /**
1235
1564
  * Get the end of a week
@@ -1238,8 +1567,8 @@ let u = class k {
1238
1567
  * @returns {Date}
1239
1568
  */
1240
1569
  static endOfWeek(e, t = 0) {
1241
- const s = k.startOfWeek(e, t);
1242
- return s.setTime(s.getTime() + 6 * 24 * 60 * 60 * 1e3), s.setHours(23, 59, 59, 999), s;
1570
+ const s = D.startOfWeek(e, t);
1571
+ return s.setDate(s.getDate() + 6), s.setHours(23, 59, 59, 999), s;
1243
1572
  }
1244
1573
  /**
1245
1574
  * Get the start of a month
@@ -1281,7 +1610,7 @@ let u = class k {
1281
1610
  */
1282
1611
  static addDays(e, t) {
1283
1612
  const s = new Date(e);
1284
- return s.setTime(s.getTime() + t * 24 * 60 * 60 * 1e3), s;
1613
+ return s.setDate(s.getDate() + t), s;
1285
1614
  }
1286
1615
  /**
1287
1616
  * Add weeks to a date
@@ -1290,7 +1619,7 @@ let u = class k {
1290
1619
  * @returns {Date}
1291
1620
  */
1292
1621
  static addWeeks(e, t) {
1293
- return k.addDays(e, t * 7);
1622
+ return D.addDays(e, t * 7);
1294
1623
  }
1295
1624
  /**
1296
1625
  * Add months to a date
@@ -1372,7 +1701,7 @@ let u = class k {
1372
1701
  * @returns {boolean}
1373
1702
  */
1374
1703
  static isSameWeek(e, t, s = 0) {
1375
- const i = k.startOfWeek(e, s), r = k.startOfWeek(t, s);
1704
+ const i = D.startOfWeek(e, s), r = D.startOfWeek(t, s);
1376
1705
  return i.toDateString() === r.toDateString();
1377
1706
  }
1378
1707
  /**
@@ -1410,7 +1739,7 @@ let u = class k {
1410
1739
  * @returns {number}
1411
1740
  */
1412
1741
  static differenceInWeeks(e, t) {
1413
- return Math.floor(k.differenceInDays(e, t) / 7);
1742
+ return Math.floor(D.differenceInDays(e, t) / 7);
1414
1743
  }
1415
1744
  /**
1416
1745
  * Get the difference in months between two dates
@@ -1466,7 +1795,7 @@ let u = class k {
1466
1795
  * @returns {string}
1467
1796
  */
1468
1797
  static getMonthName(e, t = "en-US", s = "long") {
1469
- return k.format(e, t, { month: s });
1798
+ return D.format(e, t, { month: s });
1470
1799
  }
1471
1800
  /**
1472
1801
  * Get day name
@@ -1476,7 +1805,7 @@ let u = class k {
1476
1805
  * @returns {string}
1477
1806
  */
1478
1807
  static getDayName(e, t = "en-US", s = "long") {
1479
- return k.format(e, t, { weekday: s });
1808
+ return D.format(e, t, { weekday: s });
1480
1809
  }
1481
1810
  /**
1482
1811
  * Format time
@@ -1486,7 +1815,7 @@ let u = class k {
1486
1815
  * @returns {string}
1487
1816
  */
1488
1817
  static formatTime(e, t = "en-US", s = !1) {
1489
- return k.format(e, t, {
1818
+ return D.format(e, t, {
1490
1819
  hour: "numeric",
1491
1820
  minute: "2-digit",
1492
1821
  hour12: !s
@@ -1508,7 +1837,7 @@ let u = class k {
1508
1837
  * @returns {Date}
1509
1838
  */
1510
1839
  static setTime(e, t) {
1511
- const s = new Date(e), { hours: i, minutes: r } = k.parseTime(t);
1840
+ const s = new Date(e), { hours: i, minutes: r } = D.parseTime(t);
1512
1841
  return s.setHours(i, r, 0, 0), s;
1513
1842
  }
1514
1843
  /**
@@ -1528,7 +1857,7 @@ let u = class k {
1528
1857
  static getDateRange(e, t) {
1529
1858
  const s = [], i = new Date(e), r = t.getTime();
1530
1859
  for (; i.getTime() <= r; )
1531
- s.push(new Date(i)), i.setTime(i.getTime() + 24 * 60 * 60 * 1e3);
1860
+ s.push(new Date(i)), i.setDate(i.getDate() + 1);
1532
1861
  return s;
1533
1862
  }
1534
1863
  /**
@@ -1564,8 +1893,8 @@ let u = class k {
1564
1893
  second: "2-digit",
1565
1894
  hour12: !1
1566
1895
  }).formatToParts(e), r = {};
1567
- return i.forEach((a) => {
1568
- a.type !== "literal" && (r[a.type] = a.value);
1896
+ return i.forEach((n) => {
1897
+ n.type !== "literal" && (r[n.type] = n.value);
1569
1898
  }), /* @__PURE__ */ new Date(
1570
1899
  `${r.year}-${r.month}-${r.day}T${r.hour}:${r.minute}:${r.second}`
1571
1900
  );
@@ -1587,8 +1916,8 @@ let u = class k {
1587
1916
  * @returns {boolean}
1588
1917
  */
1589
1918
  static isDST(e, t) {
1590
- const s = new Date(e.getFullYear(), 0, 1), i = new Date(e.getFullYear(), 6, 1), r = k.getTimezoneOffset(s, t), a = k.getTimezoneOffset(i, t), n = k.getTimezoneOffset(e, t);
1591
- return Math.max(r, a) === n;
1919
+ const s = new Date(e.getFullYear(), 0, 1), i = new Date(e.getFullYear(), 6, 1), r = D.getTimezoneOffset(s, t), n = D.getTimezoneOffset(i, t), a = D.getTimezoneOffset(e, t);
1920
+ return Math.max(r, n) === a;
1592
1921
  }
1593
1922
  /**
1594
1923
  * Add time accounting for DST transitions
@@ -1598,12 +1927,12 @@ let u = class k {
1598
1927
  * @returns {Date}
1599
1928
  */
1600
1929
  static addHoursWithDST(e, t, s) {
1601
- const i = new Date(e), r = k.getTimezoneOffset(e, s);
1930
+ const i = new Date(e), r = D.getTimezoneOffset(e, s);
1602
1931
  i.setTime(i.getTime() + t * 60 * 60 * 1e3);
1603
- const a = k.getTimezoneOffset(i, s);
1604
- if (r !== a) {
1605
- const n = (a - r) * 6e4;
1606
- i.setTime(i.getTime() + n);
1932
+ const n = D.getTimezoneOffset(i, s);
1933
+ if (r !== n) {
1934
+ const a = (n - r) * 6e4;
1935
+ i.setTime(i.getTime() + a);
1607
1936
  }
1608
1937
  return i;
1609
1938
  }
@@ -1618,12 +1947,12 @@ let u = class k {
1618
1947
  * @param {string} timeZone - IANA timezone string
1619
1948
  * @returns {Date}
1620
1949
  */
1621
- static createInTimeZone(e, t, s, i = 0, r = 0, a = 0, n) {
1622
- const o = `${e}-${String(t + 1).padStart(2, "0")}-${String(s).padStart(2, "0")}`, c = `${String(i).padStart(2, "0")}:${String(r).padStart(2, "0")}:${String(a).padStart(2, "0")}`, l = /* @__PURE__ */ new Date(`${o}T${c}`), d = k.getTimezoneOffset(l, n), h = l.getTime() + d * 6e4;
1950
+ static createInTimeZone(e, t, s, i = 0, r = 0, n = 0, a) {
1951
+ const o = `${e}-${String(t + 1).padStart(2, "0")}-${String(s).padStart(2, "0")}`, c = `${String(i).padStart(2, "0")}:${String(r).padStart(2, "0")}:${String(n).padStart(2, "0")}`, l = /* @__PURE__ */ new Date(`${o}T${c}`), d = D.getTimezoneOffset(l, a), h = l.getTime() + d * 6e4;
1623
1952
  return new Date(h);
1624
1953
  }
1625
1954
  };
1626
- class V {
1955
+ class Y {
1627
1956
  /**
1628
1957
  * Parse an RRULE string into a structured rule object
1629
1958
  * @param {string|Object} rrule - RRULE string or rule object
@@ -1652,55 +1981,55 @@ class V {
1652
1981
  tzid: null
1653
1982
  }, s = e.toUpperCase().split(";");
1654
1983
  for (const i of s) {
1655
- const [r, a] = i.split("=");
1984
+ const [r, n] = i.split("=");
1656
1985
  switch (r) {
1657
1986
  case "FREQ":
1658
- t.freq = this.parseFrequency(a);
1987
+ t.freq = this.parseFrequency(n);
1659
1988
  break;
1660
1989
  case "INTERVAL":
1661
- t.interval = parseInt(a, 10), t.interval < 1 && (t.interval = 1);
1990
+ t.interval = parseInt(n, 10), t.interval < 1 && (t.interval = 1);
1662
1991
  break;
1663
1992
  case "COUNT":
1664
- t.count = parseInt(a, 10);
1993
+ t.count = parseInt(n, 10);
1665
1994
  break;
1666
1995
  case "UNTIL":
1667
- t.until = this.parseDateTime(a);
1996
+ t.until = this.parseDateTime(n);
1668
1997
  break;
1669
1998
  case "BYDAY":
1670
- t.byDay = this.parseByDay(a);
1999
+ t.byDay = this.parseByDay(n);
1671
2000
  break;
1672
2001
  case "BYWEEKNO":
1673
- t.byWeekNo = this.parseIntList(a);
2002
+ t.byWeekNo = this.parseIntList(n);
1674
2003
  break;
1675
2004
  case "BYMONTH":
1676
- t.byMonth = this.parseIntList(a);
2005
+ t.byMonth = this.parseIntList(n);
1677
2006
  break;
1678
2007
  case "BYMONTHDAY":
1679
- t.byMonthDay = this.parseIntList(a);
2008
+ t.byMonthDay = this.parseIntList(n);
1680
2009
  break;
1681
2010
  case "BYYEARDAY":
1682
- t.byYearDay = this.parseIntList(a);
2011
+ t.byYearDay = this.parseIntList(n);
1683
2012
  break;
1684
2013
  case "BYSETPOS":
1685
- t.bySetPos = this.parseIntList(a);
2014
+ t.bySetPos = this.parseIntList(n);
1686
2015
  break;
1687
2016
  case "BYHOUR":
1688
- t.byHour = this.parseIntList(a);
2017
+ t.byHour = this.parseIntList(n);
1689
2018
  break;
1690
2019
  case "BYMINUTE":
1691
- t.byMinute = this.parseIntList(a);
2020
+ t.byMinute = this.parseIntList(n);
1692
2021
  break;
1693
2022
  case "BYSECOND":
1694
- t.bySecond = this.parseIntList(a);
2023
+ t.bySecond = this.parseIntList(n);
1695
2024
  break;
1696
2025
  case "WKST":
1697
- t.wkst = a;
2026
+ t.wkst = n;
1698
2027
  break;
1699
2028
  case "EXDATE":
1700
- t.exceptions = this.parseExceptionDates(a);
2029
+ t.exceptions = this.parseExceptionDates(n);
1701
2030
  break;
1702
2031
  case "TZID":
1703
- t.tzid = a;
2032
+ t.tzid = n;
1704
2033
  break;
1705
2034
  }
1706
2035
  }
@@ -1711,7 +2040,15 @@ class V {
1711
2040
  * @private
1712
2041
  */
1713
2042
  static parseFrequency(e) {
1714
- return ["SECONDLY", "MINUTELY", "HOURLY", "DAILY", "WEEKLY", "MONTHLY", "YEARLY"].includes(e) ? e : "DAILY";
2043
+ return [
2044
+ "SECONDLY",
2045
+ "MINUTELY",
2046
+ "HOURLY",
2047
+ "DAILY",
2048
+ "WEEKLY",
2049
+ "MONTHLY",
2050
+ "YEARLY"
2051
+ ].includes(e) ? e : "DAILY";
1715
2052
  }
1716
2053
  /**
1717
2054
  * Parse BYDAY value
@@ -1721,9 +2058,9 @@ class V {
1721
2058
  static parseByDay(e) {
1722
2059
  const t = e.split(","), s = ["SU", "MO", "TU", "WE", "TH", "FR", "SA"], i = [];
1723
2060
  for (const r of t) {
1724
- const n = r.trim().toUpperCase().match(/^([+-]?\d*)([A-Z]{2})$/);
1725
- if (n) {
1726
- const [o, c, l] = n;
2061
+ const a = r.trim().toUpperCase().match(/^([+-]?\d*)([A-Z]{2})$/);
2062
+ if (a) {
2063
+ const [o, c, l] = a;
1727
2064
  s.includes(l) && i.push(c ? `${c}${l}` : l);
1728
2065
  }
1729
2066
  }
@@ -1746,12 +2083,12 @@ class V {
1746
2083
  return new Date(t, s, i);
1747
2084
  }
1748
2085
  if (e.length === 15 && e[8] === "T") {
1749
- const t = parseInt(e.substr(0, 4), 10), s = parseInt(e.substr(4, 2), 10) - 1, i = parseInt(e.substr(6, 2), 10), r = parseInt(e.substr(9, 2), 10), a = parseInt(e.substr(11, 2), 10), n = parseInt(e.substr(13, 2), 10);
1750
- return new Date(t, s, i, r, a, n);
2086
+ const t = parseInt(e.substr(0, 4), 10), s = parseInt(e.substr(4, 2), 10) - 1, i = parseInt(e.substr(6, 2), 10), r = parseInt(e.substr(9, 2), 10), n = parseInt(e.substr(11, 2), 10), a = parseInt(e.substr(13, 2), 10);
2087
+ return new Date(t, s, i, r, n, a);
1751
2088
  }
1752
2089
  if (e.length === 16 && e[8] === "T" && e[15] === "Z") {
1753
- const t = parseInt(e.substr(0, 4), 10), s = parseInt(e.substr(4, 2), 10) - 1, i = parseInt(e.substr(6, 2), 10), r = parseInt(e.substr(9, 2), 10), a = parseInt(e.substr(11, 2), 10), n = parseInt(e.substr(13, 2), 10);
1754
- return new Date(Date.UTC(t, s, i, r, a, n));
2090
+ const t = parseInt(e.substr(0, 4), 10), s = parseInt(e.substr(4, 2), 10) - 1, i = parseInt(e.substr(6, 2), 10), r = parseInt(e.substr(9, 2), 10), n = parseInt(e.substr(11, 2), 10), a = parseInt(e.substr(13, 2), 10);
2091
+ return new Date(Date.UTC(t, s, i, r, n, a));
1755
2092
  }
1756
2093
  return new Date(e);
1757
2094
  }
@@ -1770,7 +2107,7 @@ class V {
1770
2107
  if (e.freq || (e.freq = "DAILY"), e.count && e.until)
1771
2108
  throw new Error("RRULE cannot have both COUNT and UNTIL");
1772
2109
  e.interval < 1 && (e.interval = 1);
1773
- const t = (s, i, r) => s.filter((a) => a >= i && a <= r);
2110
+ const t = (s, i, r) => s.filter((n) => n >= i && n <= r);
1774
2111
  return e.byMonth = t(e.byMonth || [], 1, 12), e.byMonthDay = t(e.byMonthDay || [], -31, 31).filter((s) => s !== 0), e.byYearDay = t(e.byYearDay || [], -366, 366).filter((s) => s !== 0), e.byWeekNo = t(e.byWeekNo || [], -53, 53).filter((s) => s !== 0), e.byHour = t(e.byHour || [], 0, 23), e.byMinute = t(e.byMinute || [], 0, 59), e.bySecond = t(e.bySecond || [], 0, 59), e;
1775
2112
  }
1776
2113
  /**
@@ -1781,7 +2118,7 @@ class V {
1781
2118
  static buildRRule(e) {
1782
2119
  const t = [];
1783
2120
  if (t.push(`FREQ=${e.freq}`), e.interval && e.interval > 1 && t.push(`INTERVAL=${e.interval}`), e.count ? t.push(`COUNT=${e.count}`) : e.until && t.push(`UNTIL=${this.formatDateTime(e.until)}`), e.byDay && e.byDay.length > 0) {
1784
- const s = e.byDay.map((i) => i.nth ? `${i.nth}${i.weekday}` : i.weekday).join(",");
2121
+ const s = e.byDay.map((i) => typeof i == "string" ? i : i.nth ? `${i.nth}${i.weekday}` : i.weekday).join(",");
1785
2122
  t.push(`BYDAY=${s}`);
1786
2123
  }
1787
2124
  return e.byMonth && e.byMonth.length > 0 && t.push(`BYMONTH=${e.byMonth.join(",")}`), e.byMonthDay && e.byMonthDay.length > 0 && t.push(`BYMONTHDAY=${e.byMonthDay.join(",")}`), e.byYearDay && e.byYearDay.length > 0 && t.push(`BYYEARDAY=${e.byYearDay.join(",")}`), e.byWeekNo && e.byWeekNo.length > 0 && t.push(`BYWEEKNO=${e.byWeekNo.join(",")}`), e.bySetPos && e.bySetPos.length > 0 && t.push(`BYSETPOS=${e.bySetPos.join(",")}`), e.byHour && e.byHour.length > 0 && t.push(`BYHOUR=${e.byHour.join(",")}`), e.byMinute && e.byMinute.length > 0 && t.push(`BYMINUTE=${e.byMinute.join(",")}`), e.bySecond && e.bySecond.length > 0 && t.push(`BYSECOND=${e.bySecond.join(",")}`), e.wkst && e.wkst !== "MO" && t.push(`WKST=${e.wkst}`), t.join(";");
@@ -1791,8 +2128,8 @@ class V {
1791
2128
  * @private
1792
2129
  */
1793
2130
  static formatDateTime(e) {
1794
- const t = e.getUTCFullYear(), s = String(e.getUTCMonth() + 1).padStart(2, "0"), i = String(e.getUTCDate()).padStart(2, "0"), r = String(e.getUTCHours()).padStart(2, "0"), a = String(e.getUTCMinutes()).padStart(2, "0"), n = String(e.getUTCSeconds()).padStart(2, "0");
1795
- return `${t}${s}${i}T${r}${a}${n}Z`;
2131
+ const t = e.getUTCFullYear(), s = String(e.getUTCMonth() + 1).padStart(2, "0"), i = String(e.getUTCDate()).padStart(2, "0"), r = String(e.getUTCHours()).padStart(2, "0"), n = String(e.getUTCMinutes()).padStart(2, "0"), a = String(e.getUTCSeconds()).padStart(2, "0");
2132
+ return `${t}${s}${i}T${r}${n}${a}Z`;
1796
2133
  }
1797
2134
  /**
1798
2135
  * Get human-readable description of rule
@@ -1827,20 +2164,30 @@ class V {
1827
2164
  };
1828
2165
  let r = "Every";
1829
2166
  if (e.interval > 1 && (r += ` ${e.interval}`), r += ` ${t[e.freq]}`, e.interval > 1 && (r += "s"), e.byDay && e.byDay.length > 0) {
2167
+ const n = (a) => {
2168
+ if (typeof a == "string") {
2169
+ const o = a.match(/^(-?\d+)?([A-Z]{2})$/);
2170
+ return o ? { nth: o[1] ? parseInt(o[1], 10) : null, weekday: o[2] } : { nth: null, weekday: a };
2171
+ }
2172
+ return a;
2173
+ };
1830
2174
  if (e.freq === "WEEKLY") {
1831
- const a = e.byDay.map((n) => s[n.weekday]).join(", ");
2175
+ const a = e.byDay.map((o) => s[n(o).weekday]).join(", ");
1832
2176
  r += ` on ${a}`;
1833
2177
  } else if (e.freq === "MONTHLY" || e.freq === "YEARLY") {
1834
- const a = e.byDay.map((n) => n.nth ? `the ${i[n.nth] || n.nth} ${s[n.weekday]}` : s[n.weekday]).join(", ");
2178
+ const a = e.byDay.map((o) => {
2179
+ const c = n(o);
2180
+ return c.nth ? `the ${i[c.nth] || c.nth} ${s[c.weekday]}` : s[c.weekday];
2181
+ }).join(", ");
1835
2182
  r += ` on ${a}`;
1836
2183
  }
1837
2184
  }
1838
2185
  if (e.byMonthDay && e.byMonthDay.length > 0) {
1839
- const a = e.byMonthDay.map((n) => n < 0 ? `${Math.abs(n)} day(s) from the end` : `day ${n}`).join(", ");
1840
- r += ` on ${a}`;
2186
+ const n = e.byMonthDay.map((a) => a < 0 ? `${Math.abs(a)} day(s) from the end` : `day ${a}`).join(", ");
2187
+ r += ` on ${n}`;
1841
2188
  }
1842
2189
  if (e.byMonth && e.byMonth.length > 0) {
1843
- const a = [
2190
+ const n = [
1844
2191
  "January",
1845
2192
  "February",
1846
2193
  "March",
@@ -1853,13 +2200,13 @@ class V {
1853
2200
  "October",
1854
2201
  "November",
1855
2202
  "December"
1856
- ], n = e.byMonth.map((o) => a[o - 1]).join(", ");
1857
- r += ` in ${n}`;
2203
+ ], a = e.byMonth.map((o) => n[o - 1]).join(", ");
2204
+ r += ` in ${a}`;
1858
2205
  }
1859
2206
  return e.count ? r += `, ${e.count} time${e.count > 1 ? "s" : ""}` : e.until && (r += `, until ${e.until.toLocaleDateString()}`), r;
1860
2207
  }
1861
2208
  }
1862
- class Y {
2209
+ class N {
1863
2210
  /**
1864
2211
  * Expand a recurring event into individual occurrences
1865
2212
  * @param {import('./Event.js').Event} event - The recurring event
@@ -1872,29 +2219,38 @@ class Y {
1872
2219
  static expandEvent(e, t, s, i = 365, r = null) {
1873
2220
  if (!e.recurring || !e.recurrenceRule)
1874
2221
  return [{ start: e.start, end: e.end, timezone: e.timeZone }];
1875
- const a = this.parseRule(e.recurrenceRule), n = [], o = e.end - e.start, c = r || e.timeZone || "UTC", l = new A();
2222
+ const n = this.parseRule(e.recurrenceRule), a = [], o = e.end - e.start, c = r || e.timeZone || "UTC", l = S.getInstance();
1876
2223
  let d = new Date(e.start), h = 0;
1877
- a.until && a.until < s && (s = a.until);
1878
- let g = l.getTimezoneOffset(d, c);
2224
+ n.until && n.until < s && (s = n.until);
2225
+ let g = l.getTimezoneOffset(d, c), w = 0;
2226
+ const f = 3;
1879
2227
  for (; d <= s && h < i; ) {
1880
2228
  if (d >= t) {
1881
- const b = new Date(d), f = new Date(d.getTime() + o), D = l.getTimezoneOffset(b, c);
1882
- if (D !== g) {
1883
- const x = g - D;
1884
- b.setMinutes(b.getMinutes() + x), f.setMinutes(f.getMinutes() + x);
2229
+ const b = new Date(d), M = new Date(d.getTime() + o), A = l.getTimezoneOffset(b, c);
2230
+ if (A !== g) {
2231
+ const I = g - A;
2232
+ b.setMinutes(b.getMinutes() + I), M.setMinutes(M.getMinutes() + I);
1885
2233
  }
1886
- g = D, this.isException(b, a, e.id) || n.push({
2234
+ g = A, this.isException(b, n, e.id) || a.push({
1887
2235
  start: b,
1888
- end: f,
2236
+ end: M,
1889
2237
  recurringEventId: e.id,
1890
2238
  timezone: c,
1891
2239
  originalStart: e.start
1892
2240
  });
1893
2241
  }
1894
- if (d = this.getNextOccurrence(d, a, c), h++, a.count && h >= a.count)
2242
+ const k = d.getTime();
2243
+ if (d = this.getNextOccurrence(d, n, c), h++, d.getTime() === k) {
2244
+ if (w++, w >= f) {
2245
+ console.warn("RecurrenceEngine: Date not advancing, breaking to prevent infinite loop");
2246
+ break;
2247
+ }
2248
+ } else
2249
+ w = 0;
2250
+ if (n.count && h >= n.count)
1895
2251
  break;
1896
2252
  }
1897
- return n;
2253
+ return a;
1898
2254
  }
1899
2255
  /**
1900
2256
  * Parse an RRULE string into a rule object
@@ -1902,7 +2258,7 @@ class Y {
1902
2258
  * @returns {import('../../types.js').RecurrenceRule} Parsed rule object
1903
2259
  */
1904
2260
  static parseRule(e) {
1905
- return V.parse(e);
2261
+ return Y.parse(e);
1906
2262
  }
1907
2263
  /**
1908
2264
  * Calculate the next occurrence based on the rule
@@ -1919,10 +2275,11 @@ class Y {
1919
2275
  break;
1920
2276
  case "WEEKLY":
1921
2277
  if (t.byDay && t.byDay.length > 0) {
1922
- let a = 0;
1923
- for (i.setDate(i.getDate() + 1); !this.matchesByDay(i, t.byDay) && a < 8; )
1924
- i.setDate(i.getDate() + 1), a++;
1925
- a >= 8 && (console.warn("RecurrenceEngine: Invalid byDay rule, falling back to weekly interval"), i.setDate(i.getDate() + 7 * t.interval - 8));
2278
+ let n = 0;
2279
+ const a = i.getDate();
2280
+ for (i.setDate(i.getDate() + 1); !this.matchesByDay(i, t.byDay) && n < 8; )
2281
+ i.setDate(i.getDate() + 1), n++;
2282
+ n >= 8 && (console.warn("RecurrenceEngine: Invalid byDay rule, falling back to weekly interval"), i.setDate(a + 7 * t.interval));
1926
2283
  } else
1927
2284
  i.setDate(i.getDate() + 7 * t.interval);
1928
2285
  break;
@@ -1957,10 +2314,10 @@ class Y {
1957
2314
  SA: 6
1958
2315
  }, i = e.getDay();
1959
2316
  return t.some((r) => {
1960
- const a = r.match(/^(-?\d+)?([A-Z]{2})$/);
1961
- if (a) {
1962
- const n = a[2];
1963
- return s[n] === i;
2317
+ const n = r.match(/^(-?\d+)?([A-Z]{2})$/);
2318
+ if (n) {
2319
+ const a = n[2];
2320
+ return s[a] === i;
1964
2321
  }
1965
2322
  return !1;
1966
2323
  });
@@ -1980,14 +2337,14 @@ class Y {
1980
2337
  TH: 4,
1981
2338
  FR: 5,
1982
2339
  SA: 6
1983
- }, r = t.match(/^(-?\d+)?([A-Z]{2})$/), a = r ? r[2] : t, n = i[a];
1984
- for (e.setDate(1); e.getDay() !== n; )
2340
+ }, r = t.match(/^(-?\d+)?([A-Z]{2})$/), n = r ? r[2] : t, a = i[n];
2341
+ for (e.setDate(1); e.getDay() !== a; )
1985
2342
  e.setDate(e.getDate() + 1);
1986
2343
  if (s > 1)
1987
2344
  e.setDate(e.getDate() + 7 * (s - 1));
1988
2345
  else if (s === -1) {
1989
2346
  const o = new Date(e);
1990
- for (o.setMonth(o.getMonth() + 1), o.setDate(0); o.getDay() !== n; )
2347
+ for (o.setMonth(o.getMonth() + 1), o.setDate(0); o.getDay() !== a; )
1991
2348
  o.setDate(o.getDate() - 1);
1992
2349
  e.setTime(o.getTime());
1993
2350
  }
@@ -2003,12 +2360,12 @@ class Y {
2003
2360
  if (!t.exceptions || t.exceptions.length === 0)
2004
2361
  return !1;
2005
2362
  const i = e.toDateString(), r = e.getTime();
2006
- return t.exceptions.some((a) => {
2007
- if (typeof a == "object" && a.date) {
2008
- const n = a.date instanceof Date ? a.date : new Date(a.date);
2009
- return a.matchTime ? Math.abs(n.getTime() - r) < 1e3 : n.toDateString() === i;
2010
- } else
2011
- return (a instanceof Date ? a : new Date(a)).toDateString() === i;
2363
+ return t.exceptions.some((n) => {
2364
+ if (typeof n == "object" && n.date) {
2365
+ const o = n.date instanceof Date ? n.date : new Date(n.date);
2366
+ return n.matchTime ? Math.abs(o.getTime() - r) < 1e3 : o.toDateString() === i;
2367
+ }
2368
+ return (n instanceof Date ? n : new Date(n)).toDateString() === i;
2012
2369
  });
2013
2370
  }
2014
2371
  /**
@@ -2037,8 +2394,8 @@ class Y {
2037
2394
  const t = parseInt(e.substr(0, 4), 10), s = parseInt(e.substr(4, 2), 10) - 1, i = parseInt(e.substr(6, 2), 10);
2038
2395
  return new Date(t, s, i);
2039
2396
  } else if (e.length === 15 || e.length === 16) {
2040
- const t = parseInt(e.substr(0, 4), 10), s = parseInt(e.substr(4, 2), 10) - 1, i = parseInt(e.substr(6, 2), 10), r = parseInt(e.substr(9, 2), 10), a = parseInt(e.substr(11, 2), 10), n = parseInt(e.substr(13, 2), 10);
2041
- return e.endsWith("Z") ? new Date(Date.UTC(t, s, i, r, a, n)) : new Date(t, s, i, r, a, n);
2397
+ const t = parseInt(e.substr(0, 4), 10), s = parseInt(e.substr(4, 2), 10) - 1, i = parseInt(e.substr(6, 2), 10), r = parseInt(e.substr(9, 2), 10), n = parseInt(e.substr(11, 2), 10), a = parseInt(e.substr(13, 2), 10);
2398
+ return e.endsWith("Z") ? new Date(Date.UTC(t, s, i, r, n, a)) : new Date(t, s, i, r, n, a);
2042
2399
  }
2043
2400
  return new Date(e);
2044
2401
  }
@@ -2085,11 +2442,11 @@ class Y {
2085
2442
  FR: "Friday",
2086
2443
  SA: "Saturday"
2087
2444
  }, s = e.match(/^(-?\d+)?([A-Z]{2})$/), i = s ? s[2] : e, r = s && s[1] ? parseInt(s[1], 10) : null;
2088
- let a = t[i] || e;
2089
- return r && (a = `${r === -1 ? "Last" : ["", "1st", "2nd", "3rd", "4th", "5th"][r] || `${r}th`} ${a}`), a;
2445
+ let n = t[i] || e;
2446
+ return r && (n = `${r === -1 ? "Last" : ["", "1st", "2nd", "3rd", "4th", "5th"][r] || `${r}th`} ${n}`), n;
2090
2447
  }
2091
2448
  }
2092
- class $ {
2449
+ class _ {
2093
2450
  /**
2094
2451
  * Create a new LRU Cache
2095
2452
  * @param {number} capacity - Maximum number of items in cache
@@ -2176,7 +2533,7 @@ class $ {
2176
2533
  return this.cache.size;
2177
2534
  }
2178
2535
  }
2179
- class N {
2536
+ class j {
2180
2537
  constructor(e = {}) {
2181
2538
  this.config = {
2182
2539
  checkInterval: 3e4,
@@ -2258,12 +2615,12 @@ class N {
2258
2615
  return e.usedJSHeapSize / e.jsHeapSizeLimit;
2259
2616
  }
2260
2617
  try {
2261
- const t = (typeof globalThis < "u" ? globalThis : {}).process;
2262
- if (t && typeof t == "object") {
2263
- const s = t.memoryUsage;
2264
- if (typeof s == "function") {
2265
- const i = s.call(t);
2266
- return i.heapUsed / i.heapTotal;
2618
+ const e = typeof globalThis < "u" ? globalThis : {}, t = "process", s = "memoryUsage", i = e[t];
2619
+ if (i && typeof i == "object") {
2620
+ const r = i[s];
2621
+ if (typeof r == "function") {
2622
+ const n = r.call(i);
2623
+ return n.heapUsed / n.heapTotal;
2267
2624
  }
2268
2625
  }
2269
2626
  } catch {
@@ -2285,13 +2642,14 @@ class N {
2285
2642
  * @param {number} memoryUsage - Current memory usage percentage
2286
2643
  */
2287
2644
  reduceCacheSizes(e) {
2288
- const t = (e - this.config.memoryThreshold) / (this.config.criticalThreshold - this.config.memoryThreshold), s = Array.from(this.caches.entries()).sort((i, r) => i[1].priority - r[1].priority);
2645
+ const t = (e - this.config.memoryThreshold) / (this.config.criticalThreshold - this.config.memoryThreshold), s = Array.from(this.caches.entries()).sort(
2646
+ (i, r) => i[1].priority - r[1].priority
2647
+ );
2289
2648
  for (const [i, r] of s) {
2290
- const a = Math.floor(r.currentCapacity * r.scaleFactor * t), n = Math.max(
2291
- r.minCapacity,
2292
- r.currentCapacity - a
2293
- );
2294
- n < r.currentCapacity && this.resizeCache(i, r, n);
2649
+ const n = Math.floor(
2650
+ r.currentCapacity * r.scaleFactor * t
2651
+ ), a = Math.max(r.minCapacity, r.currentCapacity - n);
2652
+ a < r.currentCapacity && this.resizeCache(i, r, a);
2295
2653
  }
2296
2654
  this.stats.adjustments++;
2297
2655
  }
@@ -2301,10 +2659,7 @@ class N {
2301
2659
  increaseCacheSizes() {
2302
2660
  for (const [e, t] of this.caches)
2303
2661
  if (Date.now() - t.lastAccess < 6e4) {
2304
- const i = Math.floor(t.currentCapacity * 0.2), r = Math.min(
2305
- t.maxCapacity,
2306
- t.currentCapacity + i
2307
- );
2662
+ const i = Math.floor(t.currentCapacity * 0.2), r = Math.min(t.maxCapacity, t.currentCapacity + i);
2308
2663
  r > t.currentCapacity && this.resizeCache(e, t, r);
2309
2664
  }
2310
2665
  }
@@ -2384,7 +2739,10 @@ class N {
2384
2739
  * @param {Object} thresholds - New threshold values
2385
2740
  */
2386
2741
  setThresholds(e) {
2387
- e.memoryThreshold !== void 0 && (this.config.memoryThreshold = Math.max(0.5, Math.min(0.95, e.memoryThreshold))), e.criticalThreshold !== void 0 && (this.config.criticalThreshold = Math.max(this.config.memoryThreshold + 0.05, Math.min(1, e.criticalThreshold)));
2742
+ e.memoryThreshold !== void 0 && (this.config.memoryThreshold = Math.max(0.5, Math.min(0.95, e.memoryThreshold))), e.criticalThreshold !== void 0 && (this.config.criticalThreshold = Math.max(
2743
+ this.config.memoryThreshold + 0.05,
2744
+ Math.min(1, e.criticalThreshold)
2745
+ ));
2388
2746
  }
2389
2747
  /**
2390
2748
  * Destroy manager and clean up
@@ -2393,7 +2751,7 @@ class N {
2393
2751
  this.stopMonitoring(), this.caches.clear();
2394
2752
  }
2395
2753
  }
2396
- class j {
2754
+ class W {
2397
2755
  constructor(e = {}) {
2398
2756
  this.config = {
2399
2757
  enableCache: !0,
@@ -2408,7 +2766,7 @@ class j {
2408
2766
  enableAdaptiveMemory: !0,
2409
2767
  // Enable adaptive memory management
2410
2768
  ...e
2411
- }, this.eventCache = new $(this.config.cacheCapacity), this.queryCache = new $(Math.floor(this.config.cacheCapacity / 2)), this.dateRangeCache = new $(Math.floor(this.config.cacheCapacity / 4)), this.config.enableAdaptiveMemory && (this.memoryManager = new N({
2769
+ }, this.eventCache = new _(this.config.cacheCapacity), this.queryCache = new _(Math.floor(this.config.cacheCapacity / 2)), this.dateRangeCache = new _(Math.floor(this.config.cacheCapacity / 4)), this.config.enableAdaptiveMemory && (this.memoryManager = new j({
2412
2770
  checkInterval: 3e4,
2413
2771
  memoryThreshold: 0.75,
2414
2772
  criticalThreshold: 0.9
@@ -2527,9 +2885,7 @@ class j {
2527
2885
  * @returns {boolean} True if should use lazy indexing
2528
2886
  */
2529
2887
  shouldUseLazyIndexing(e) {
2530
- return Math.ceil(
2531
- (e.end - e.start) / 864e5
2532
- ) > this.config.maxIndexDays;
2888
+ return Math.ceil((e.end - e.start) / 864e5) > this.config.maxIndexDays;
2533
2889
  }
2534
2890
  /**
2535
2891
  * Create lazy index markers for large events
@@ -2560,14 +2916,14 @@ class j {
2560
2916
  if (i.pending)
2561
2917
  return this.pendingIndexes.get(e);
2562
2918
  i.pending = !0;
2563
- const r = new Promise((a) => {
2919
+ const r = new Promise((n) => {
2564
2920
  setTimeout(() => {
2565
- const n = /* @__PURE__ */ new Set(), o = new Date(t);
2921
+ const a = /* @__PURE__ */ new Set(), o = new Date(t);
2566
2922
  for (; o <= s; ) {
2567
2923
  const c = o.toDateString();
2568
- i.indexed.has(c) || (n.add(c), i.indexed.add(c)), o.setDate(o.getDate() + 1);
2924
+ i.indexed.has(c) || (a.add(c), i.indexed.add(c)), o.setDate(o.getDate() + 1);
2569
2925
  }
2570
- i.pending = !1, this.pendingIndexes.delete(e), a(n);
2926
+ i.pending = !1, this.pendingIndexes.delete(e), n(a);
2571
2927
  }, 0);
2572
2928
  });
2573
2929
  return this.pendingIndexes.set(e, r), r;
@@ -2651,14 +3007,14 @@ class j {
2651
3007
  processBatch() {
2652
3008
  if (this.batchTimer && (clearTimeout(this.batchTimer), this.batchTimer = null), this.batchQueue.length === 0) return;
2653
3009
  const e = this.batchQueue.splice(0), t = this.batchCallbacks.splice(0), s = [], i = [];
2654
- e.forEach((r, a) => {
3010
+ e.forEach((r, n) => {
2655
3011
  try {
2656
- s[a] = r();
2657
- } catch (n) {
2658
- i[a] = n;
3012
+ s[n] = r();
3013
+ } catch (a) {
3014
+ i[n] = a;
2659
3015
  }
2660
- }), t.forEach((r, a) => {
2661
- i[a] ? r.reject(i[a]) : r.resolve(s[a]);
3016
+ }), t.forEach((r, n) => {
3017
+ i[n] ? r.reject(i[n]) : r.resolve(s[n]);
2662
3018
  });
2663
3019
  }
2664
3020
  /**
@@ -2700,7 +3056,7 @@ class j {
2700
3056
  this.cleanupTimer && (clearInterval(this.cleanupTimer), this.cleanupTimer = null), this.batchTimer && (clearTimeout(this.batchTimer), this.batchTimer = null), this.eventCache.clear(), this.queryCache.clear(), this.dateRangeCache.clear(), this.lazyIndexes.clear(), this.pendingIndexes.clear();
2701
3057
  }
2702
3058
  }
2703
- class W {
3059
+ class Z {
2704
3060
  /**
2705
3061
  * Create a new ConflictDetector
2706
3062
  * @param {import('../events/EventStore.js').EventStore} eventStore - Event store instance
@@ -2727,16 +3083,12 @@ class W {
2727
3083
  };
2728
3084
  if (!e.start || !e.end)
2729
3085
  throw new Error("Event must have start and end dates");
2730
- const i = [], r = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set(), n = new Date(e.start.getTime() - s.bufferMinutes * 6e4), o = new Date(e.end.getTime() + s.bufferMinutes * 6e4), c = this.eventStore.getEventsInRange(n, o, !1).filter((l) => !(l.id === e.id || s.excludeEventIds.includes(l.id) || !s.includeStatuses.includes(l.status) || s.ignoreAllDay && (l.allDay || e.allDay) || l.status === "cancelled"));
3086
+ const i = [], r = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set(), a = new Date(e.start.getTime() - s.bufferMinutes * 6e4), o = new Date(e.end.getTime() + s.bufferMinutes * 6e4), c = this.eventStore.getEventsInRange(a, o, !1).filter((l) => !(l.id === e.id || s.excludeEventIds.includes(l.id) || !s.includeStatuses.includes(l.status) || s.ignoreAllDay && (l.allDay || e.allDay) || l.status === "cancelled"));
2731
3087
  for (const l of c) {
2732
- const d = this._detectEventConflicts(
2733
- e,
2734
- l,
2735
- s
2736
- );
2737
- d.length > 0 && (i.push(...d), r.add(e.id), r.add(l.id), e.attendees && e.attendees.forEach((h) => a.add(h.email)), l.attendees && l.attendees.forEach((h) => a.add(h.email)));
3088
+ const d = this._detectEventConflicts(e, l, s);
3089
+ d.length > 0 && (i.push(...d), r.add(e.id), r.add(l.id), e.attendees && e.attendees.forEach((h) => n.add(h.email)), l.attendees && l.attendees.forEach((h) => n.add(h.email)));
2738
3090
  }
2739
- return this._buildConflictSummary(i, r, a);
3091
+ return this._buildConflictSummary(i, r, n);
2740
3092
  }
2741
3093
  /**
2742
3094
  * Check for conflicts between two specific events
@@ -2768,16 +3120,14 @@ class W {
2768
3120
  includeStatuses: ["confirmed", "tentative"],
2769
3121
  mergePeriods: !0,
2770
3122
  ...i
2771
- }, a = [];
2772
- return this.eventStore.getEventsInRange(t, s, !1).filter((c) => !r.includeStatuses.includes(c.status) || c.status === "cancelled" ? !1 : c.attendees && c.attendees.some(
2773
- (l) => e.includes(l.email)
2774
- )).forEach((c) => {
2775
- a.push({
3123
+ }, n = [];
3124
+ return this.eventStore.getEventsInRange(t, s, !1).filter((c) => !r.includeStatuses.includes(c.status) || c.status === "cancelled" ? !1 : c.attendees && c.attendees.some((l) => e.includes(l.email))).forEach((c) => {
3125
+ n.push({
2776
3126
  start: c.start,
2777
3127
  end: c.end,
2778
3128
  eventIds: [c.id]
2779
3129
  });
2780
- }), r.mergePeriods && a.length > 1 ? this._mergeBusyPeriods(a) : a.sort((c, l) => c.start - l.start);
3130
+ }), r.mergePeriods && n.length > 1 ? this._mergeBusyPeriods(n) : n.sort((c, l) => c.start - l.start);
2781
3131
  }
2782
3132
  /**
2783
3133
  * Get free time slots
@@ -2794,17 +3144,17 @@ class W {
2794
3144
  businessHours: { start: "09:00", end: "17:00" },
2795
3145
  excludeWeekends: !1,
2796
3146
  ...i
2797
- }, a = [], n = r.attendeeEmails.length > 0 ? this.getBusyPeriods(r.attendeeEmails, e, t) : this._getAllBusyPeriods(e, t);
3147
+ }, n = [], a = r.attendeeEmails.length > 0 ? this.getBusyPeriods(r.attendeeEmails, e, t) : this._getAllBusyPeriods(e, t);
2798
3148
  let o = new Date(e);
2799
- for (const c of n)
2800
- o < c.start && (c.start - o) / 6e4 >= s && (!r.businessHoursOnly || this._isWithinBusinessHours(o, c.start, r)) && a.push({
3149
+ for (const c of a)
3150
+ o < c.start && (c.start - o) / 6e4 >= s && (!r.businessHoursOnly || this._isWithinBusinessHours(o, c.start, r)) && n.push({
2801
3151
  start: new Date(o),
2802
3152
  end: new Date(c.start)
2803
3153
  }), o = new Date(Math.max(o.getTime(), c.end.getTime()));
2804
- return o < t && (t - o) / 6e4 >= s && (!r.businessHoursOnly || this._isWithinBusinessHours(o, t, r)) && a.push({
3154
+ return o < t && (t - o) / 6e4 >= s && (!r.businessHoursOnly || this._isWithinBusinessHours(o, t, r)) && n.push({
2805
3155
  start: new Date(o),
2806
3156
  end: new Date(t)
2807
- }), a;
3157
+ }), n;
2808
3158
  }
2809
3159
  /**
2810
3160
  * Detect conflicts between two events
@@ -2812,23 +3162,19 @@ class W {
2812
3162
  */
2813
3163
  _detectEventConflicts(e, t, s) {
2814
3164
  const i = [];
2815
- if (this._checkTimeOverlap(
2816
- e,
2817
- t,
2818
- s.bufferMinutes
2819
- )) {
2820
- const a = this._createTimeConflict(e, t);
2821
- if (i.push(a), s.checkAttendees) {
2822
- const n = this._checkAttendeeConflicts(e, t);
2823
- i.push(...n);
3165
+ if (this._checkTimeOverlap(e, t, s.bufferMinutes)) {
3166
+ const n = this._createTimeConflict(e, t);
3167
+ if (i.push(n), s.checkAttendees) {
3168
+ const a = this._checkAttendeeConflicts(e, t);
3169
+ i.push(...a);
2824
3170
  }
2825
3171
  if (s.checkResources) {
2826
- const n = this._checkResourceConflicts(e, t);
2827
- i.push(...n);
3172
+ const a = this._checkResourceConflicts(e, t);
3173
+ i.push(...a);
2828
3174
  }
2829
3175
  if (s.checkLocation) {
2830
- const n = this._checkLocationConflict(e, t);
2831
- n && i.push(n);
3176
+ const a = this._checkLocationConflict(e, t);
3177
+ a && i.push(a);
2832
3178
  }
2833
3179
  }
2834
3180
  return i;
@@ -2838,8 +3184,8 @@ class W {
2838
3184
  * @private
2839
3185
  */
2840
3186
  _checkTimeOverlap(e, t, s = 0) {
2841
- const i = s * 6e4, r = e.start.getTime() - i, a = e.end.getTime() + i, n = t.start.getTime(), o = t.end.getTime();
2842
- return !(a <= n || o <= r);
3187
+ const i = s * 6e4, r = e.start.getTime() - i, n = e.end.getTime() + i, a = t.start.getTime(), o = t.end.getTime();
3188
+ return !(n <= a || o <= r);
2843
3189
  }
2844
3190
  /**
2845
3191
  * Create time conflict details
@@ -2847,11 +3193,11 @@ class W {
2847
3193
  */
2848
3194
  _createTimeConflict(e, t) {
2849
3195
  const s = new Date(Math.max(e.start.getTime(), t.start.getTime())), i = new Date(Math.min(e.end.getTime(), t.end.getTime())), r = (i - s) / 6e4;
2850
- let a = "low";
2851
- return r >= 60 ? a = "high" : r >= 30 && (a = "medium"), e.status === "confirmed" && t.status === "confirmed" && (a = a === "low" ? "medium" : a === "medium" ? "high" : "critical"), {
3196
+ let n = "low";
3197
+ return r >= 60 ? n = "high" : r >= 30 && (n = "medium"), e.status === "confirmed" && t.status === "confirmed" && (n = n === "low" ? "medium" : n === "medium" ? "high" : "critical"), {
2852
3198
  id: `conflict_${++this.conflictIdCounter}`,
2853
3199
  type: "time",
2854
- severity: a,
3200
+ severity: n,
2855
3201
  eventId: e.id,
2856
3202
  conflictingEventId: t.id,
2857
3203
  description: `Time overlap: ${e.title} conflicts with ${t.title}`,
@@ -2876,12 +3222,12 @@ class W {
2876
3222
  return s;
2877
3223
  const i = [];
2878
3224
  for (const r of e.attendees)
2879
- for (const a of t.attendees)
2880
- r.email === a.email && i.push(r.email);
3225
+ for (const n of t.attendees)
3226
+ r.email === n.email && i.push(r.email);
2881
3227
  if (i.length > 0) {
2882
3228
  let r = "medium";
2883
- i.some((n) => {
2884
- const o = e.attendees.find((l) => l.email === n), c = t.attendees.find((l) => l.email === n);
3229
+ i.some((a) => {
3230
+ const o = e.attendees.find((l) => l.email === a), c = t.attendees.find((l) => l.email === a);
2885
3231
  return (o == null ? void 0 : o.responseStatus) === "accepted" && (c == null ? void 0 : c.responseStatus) === "accepted";
2886
3232
  }) && (r = "critical"), s.push({
2887
3233
  id: `conflict_${++this.conflictIdCounter}`,
@@ -2904,8 +3250,8 @@ class W {
2904
3250
  * @private
2905
3251
  */
2906
3252
  _checkResourceConflicts(e, t) {
2907
- var a, n;
2908
- const s = [], i = ((a = e.attendees) == null ? void 0 : a.filter((o) => o.resource)) || [], r = ((n = t.attendees) == null ? void 0 : n.filter((o) => o.resource)) || [];
3253
+ var n, a;
3254
+ const s = [], i = ((n = e.attendees) == null ? void 0 : n.filter((o) => o.resource)) || [], r = ((a = t.attendees) == null ? void 0 : a.filter((o) => o.resource)) || [];
2909
3255
  for (const o of i)
2910
3256
  for (const c of r)
2911
3257
  o.email === c.email && s.push({
@@ -2951,8 +3297,8 @@ class W {
2951
3297
  */
2952
3298
  _buildConflictSummary(e, t, s) {
2953
3299
  const i = {}, r = {};
2954
- for (const a of e)
2955
- i[a.type] = (i[a.type] || 0) + 1, r[a.severity] = (r[a.severity] || 0) + 1;
3300
+ for (const n of e)
3301
+ i[n.type] = (i[n.type] || 0) + 1, r[n.severity] = (r[n.severity] || 0) + 1;
2956
3302
  return {
2957
3303
  hasConflicts: e.length > 0,
2958
3304
  totalConflicts: e.length,
@@ -2993,11 +3339,11 @@ class W {
2993
3339
  * @private
2994
3340
  */
2995
3341
  _isWithinBusinessHours(e, t, s) {
2996
- const i = e.getHours(), r = t.getHours(), a = parseInt(s.businessHours.start.split(":")[0]), n = parseInt(s.businessHours.end.split(":")[0]);
2997
- return i >= a && r <= n;
3342
+ const i = e.getHours(), r = t.getHours(), n = parseInt(s.businessHours.start.split(":")[0]), a = parseInt(s.businessHours.end.split(":")[0]);
3343
+ return i >= n && r <= a;
2998
3344
  }
2999
3345
  }
3000
- class Z {
3346
+ class q {
3001
3347
  constructor(e = {}) {
3002
3348
  this.events = /* @__PURE__ */ new Map(), this.indices = {
3003
3349
  /** @type {Map<string, Set<string>>} UTC Date string -> Set of event IDs */
@@ -3010,7 +3356,7 @@ class Z {
3010
3356
  byCategory: /* @__PURE__ */ new Map(),
3011
3357
  /** @type {Map<string, Set<string>>} Status -> Set of event IDs */
3012
3358
  byStatus: /* @__PURE__ */ new Map()
3013
- }, this.timezoneManager = new A(), this.defaultTimezone = e.timezone || this.timezoneManager.getSystemTimezone(), this.optimizer = new j(e.performance), this.conflictDetector = new W(this), this.isBatchMode = !1, this.batchNotifications = [], this.batchBackup = null, this.version = 0, this.listeners = /* @__PURE__ */ new Set();
3359
+ }, this.timezoneManager = S.getInstance(), this.defaultTimezone = e.timezone || this.timezoneManager.getSystemTimezone(), this.optimizer = new W(e.performance), this.conflictDetector = new Z(this), this.isBatchMode = !1, this.batchNotifications = [], this.batchBackup = null, this.version = 0, this.listeners = /* @__PURE__ */ new Set();
3014
3360
  }
3015
3361
  /**
3016
3362
  * Add an event to the store
@@ -3104,9 +3450,11 @@ class Z {
3104
3450
  const s = `${e.year}-${String(e.month).padStart(2, "0")}`, i = this.indices.byMonth.get(s) || /* @__PURE__ */ new Set();
3105
3451
  t = t.filter((r) => i.has(r.id));
3106
3452
  }
3107
- return e.hasOwnProperty("allDay") && (t = t.filter((s) => s.allDay === e.allDay)), e.hasOwnProperty("recurring") && (t = t.filter((s) => s.recurring === e.recurring)), e.status && (t = t.filter((s) => s.status === e.status)), e.categories && e.categories.length > 0 && (t = t.filter(
3453
+ return Object.prototype.hasOwnProperty.call(e, "allDay") && (t = t.filter((s) => s.allDay === e.allDay)), Object.prototype.hasOwnProperty.call(e, "recurring") && (t = t.filter((s) => s.recurring === e.recurring)), e.status && (t = t.filter((s) => s.status === e.status)), e.categories && e.categories.length > 0 && (t = t.filter(
3108
3454
  (s) => e.matchAllCategories ? s.hasAllCategories(e.categories) : s.hasAnyCategory(e.categories)
3109
- )), e.hasOwnProperty("hasAttendees") && (t = t.filter((s) => e.hasAttendees ? s.hasAttendees : !s.hasAttendees)), e.organizerEmail && (t = t.filter(
3455
+ )), Object.prototype.hasOwnProperty.call(e, "hasAttendees") && (t = t.filter(
3456
+ (s) => e.hasAttendees ? s.hasAttendees : !s.hasAttendees
3457
+ )), e.organizerEmail && (t = t.filter(
3110
3458
  (s) => s.organizer && s.organizer.email === e.organizerEmail
3111
3459
  )), e.sort && t.sort((s, i) => {
3112
3460
  switch (e.sort) {
@@ -3136,11 +3484,11 @@ class Z {
3136
3484
  const d = new Date(i);
3137
3485
  d.setDate(d.getDate() + l);
3138
3486
  const h = u.getLocalDateString(d), g = this.indices.byDate.get(h);
3139
- g && g.forEach((b) => s.add(b));
3487
+ g && g.forEach((w) => s.add(w));
3140
3488
  }
3141
- const r = `${e.getFullYear()}-${String(e.getMonth() + 1).padStart(2, "0")}`, a = this.indices.byMonth.get(r);
3142
- a && a.forEach((l) => s.add(l));
3143
- const n = [], o = new Date(e);
3489
+ const r = `${e.getFullYear()}-${String(e.getMonth() + 1).padStart(2, "0")}`, n = this.indices.byMonth.get(r);
3490
+ n && n.forEach((l) => s.add(l));
3491
+ const a = [], o = new Date(e);
3144
3492
  o.setHours(0, 0, 0, 0);
3145
3493
  const c = new Date(e);
3146
3494
  c.setHours(23, 59, 59, 999);
@@ -3148,12 +3496,12 @@ class Z {
3148
3496
  const d = this.events.get(l);
3149
3497
  if (d) {
3150
3498
  const h = d.getStartInTimezone(t), g = d.getEndInTimezone(t);
3151
- h <= c && g >= o && n.push(d);
3499
+ h <= c && g >= o && a.push(d);
3152
3500
  }
3153
3501
  }
3154
- return n.sort((l, d) => {
3155
- const h = l.getStartInTimezone(t), g = d.getStartInTimezone(t), b = h - g;
3156
- return b !== 0 ? b : d.duration - l.duration;
3502
+ return a.sort((l, d) => {
3503
+ const h = l.getStartInTimezone(t), g = d.getStartInTimezone(t), w = h - g;
3504
+ return w !== 0 ? w : d.duration - l.duration;
3157
3505
  });
3158
3506
  }
3159
3507
  /**
@@ -3164,9 +3512,9 @@ class Z {
3164
3512
  * @returns {Event[]} Array of overlapping events
3165
3513
  */
3166
3514
  getOverlappingEvents(e, t, s = null) {
3167
- const i = [], r = u.startOfDay(e), a = u.endOfDay(t), n = u.getDateRange(r, a), o = /* @__PURE__ */ new Set();
3168
- return n.forEach((c) => {
3169
- const l = c.toDateString();
3515
+ const i = [], r = u.startOfDay(e), n = u.endOfDay(t), a = u.getDateRange(r, n), o = /* @__PURE__ */ new Set();
3516
+ return a.forEach((c) => {
3517
+ const l = u.getLocalDateString(c);
3170
3518
  (this.indices.byDate.get(l) || /* @__PURE__ */ new Set()).forEach((h) => {
3171
3519
  if (!o.has(h) && h !== s) {
3172
3520
  o.add(h);
@@ -3195,20 +3543,20 @@ class Z {
3195
3543
  */
3196
3544
  getOverlapGroups(e, t = !0) {
3197
3545
  let s = this.getEventsForDate(e);
3198
- t && (s = s.filter((a) => !a.allDay));
3546
+ t && (s = s.filter((n) => !n.allDay));
3199
3547
  const i = [], r = /* @__PURE__ */ new Set();
3200
- return s.forEach((a) => {
3201
- if (r.has(a.id)) return;
3202
- const n = [a];
3203
- r.add(a.id);
3548
+ return s.forEach((n) => {
3549
+ if (r.has(n.id)) return;
3550
+ const a = [n];
3551
+ r.add(n.id);
3204
3552
  let o = 0;
3205
- for (; o < n.length; ) {
3206
- const c = n[o];
3553
+ for (; o < a.length; ) {
3554
+ const c = a[o];
3207
3555
  s.forEach((l) => {
3208
- !r.has(l.id) && c.overlaps(l) && (n.push(l), r.add(l.id));
3556
+ !r.has(l.id) && c.overlaps(l) && (a.push(l), r.add(l.id));
3209
3557
  }), o++;
3210
3558
  }
3211
- i.push(n);
3559
+ i.push(a);
3212
3560
  }), i;
3213
3561
  }
3214
3562
  /**
@@ -3219,17 +3567,17 @@ class Z {
3219
3567
  calculateEventPositions(e) {
3220
3568
  const t = /* @__PURE__ */ new Map();
3221
3569
  if (e.length === 0) return t;
3222
- e.sort((r, a) => {
3223
- const n = r.start - a.start;
3224
- return n !== 0 ? n : a.end - a.start - (r.end - r.start);
3570
+ e.sort((r, n) => {
3571
+ const a = r.start - n.start;
3572
+ return a !== 0 ? a : n.end - n.start - (r.end - r.start);
3225
3573
  });
3226
3574
  const s = [];
3227
3575
  e.forEach((r) => {
3228
- let a = 0;
3229
- for (; a < s.length && s[a].some((c) => c.overlaps(r)); )
3230
- a++;
3231
- s[a] || (s[a] = []), s[a].push(r), t.set(r.id, {
3232
- column: a,
3576
+ let n = 0;
3577
+ for (; n < s.length && s[n].some((c) => c.overlaps(r)); )
3578
+ n++;
3579
+ s[n] || (s[n] = []), s[n].push(r), t.set(r.id, {
3580
+ column: n,
3233
3581
  totalColumns: 0
3234
3582
  // Will be updated after all events are placed
3235
3583
  });
@@ -3249,15 +3597,15 @@ class Z {
3249
3597
  */
3250
3598
  getEventsInRange(e, t, s = !0, i = null) {
3251
3599
  typeof s == "string" && (i = s, s = !0), i = i || this.defaultTimezone;
3252
- const r = this.timezoneManager.toUTC(e, i), a = this.timezoneManager.toUTC(t, i), n = this.queryEvents({
3600
+ const r = this.timezoneManager.toUTC(e, i), n = this.timezoneManager.toUTC(t, i), a = this.queryEvents({
3253
3601
  start: r,
3254
- end: a,
3602
+ end: n,
3255
3603
  sort: "start"
3256
3604
  });
3257
3605
  if (!s)
3258
- return n;
3606
+ return a;
3259
3607
  const o = [];
3260
- return n.forEach((c) => {
3608
+ return a.forEach((c) => {
3261
3609
  if (c.recurring && c.recurrenceRule) {
3262
3610
  const l = this.expandRecurringEvent(c, e, t, i);
3263
3611
  o.push(...l);
@@ -3281,10 +3629,10 @@ class Z {
3281
3629
  return [e];
3282
3630
  i = i || this.defaultTimezone;
3283
3631
  const r = e.timeZone || i;
3284
- return Y.expandEvent(e, t, s).map((n, o) => e.clone({
3632
+ return N.expandEvent(e, t, s).map((a, o) => e.clone({
3285
3633
  id: `${e.id}_occurrence_${o}`,
3286
- start: n.start,
3287
- end: n.end,
3634
+ start: a.start,
3635
+ end: a.end,
3288
3636
  timeZone: r,
3289
3637
  metadata: {
3290
3638
  ...e.metadata,
@@ -3337,10 +3685,10 @@ class Z {
3337
3685
  const c = u.getLocalDateString(o);
3338
3686
  this.indices.byDate.has(c) || this.indices.byDate.set(c, /* @__PURE__ */ new Set()), this.indices.byDate.get(c).add(e.id);
3339
3687
  }), `${i.getFullYear()}${String(i.getMonth() + 1).padStart(2, "0")}`, `${r.getFullYear()}${String(r.getMonth() + 1).padStart(2, "0")}`;
3340
- const n = new Date(i.getFullYear(), i.getMonth(), 1);
3341
- for (; n <= r; ) {
3342
- const o = `${n.getFullYear()}-${String(n.getMonth() + 1).padStart(2, "0")}`;
3343
- this.indices.byMonth.has(o) || this.indices.byMonth.set(o, /* @__PURE__ */ new Set()), this.indices.byMonth.get(o).add(e.id), n.setMonth(n.getMonth() + 1);
3688
+ const a = new Date(i.getFullYear(), i.getMonth(), 1);
3689
+ for (; a <= r; ) {
3690
+ const o = `${a.getFullYear()}-${String(a.getMonth() + 1).padStart(2, "0")}`;
3691
+ this.indices.byMonth.has(o) || this.indices.byMonth.set(o, /* @__PURE__ */ new Set()), this.indices.byMonth.get(o).add(e.id), a.setMonth(a.getMonth() + 1);
3344
3692
  }
3345
3693
  e.categories && e.categories.length > 0 && e.categories.forEach((o) => {
3346
3694
  this.indices.byCategory.has(o) || this.indices.byCategory.set(o, /* @__PURE__ */ new Set()), this.indices.byCategory.get(o).add(e.id);
@@ -3352,14 +3700,14 @@ class Z {
3352
3700
  */
3353
3701
  _indexEventLazy(e) {
3354
3702
  this.optimizer.createLazyIndexMarkers(e);
3355
- const t = e.getStartInTimezone(e.timeZone), s = e.getEndInTimezone(e.endTimeZone || e.timeZone), i = u.startOfDay(t), r = u.endOfDay(s), a = new Date(i);
3356
- if (a.setDate(a.getDate() + 7), u.getDateRange(
3703
+ const t = e.getStartInTimezone(e.timeZone), s = e.getEndInTimezone(e.endTimeZone || e.timeZone), i = u.startOfDay(t), r = u.endOfDay(s), n = new Date(i);
3704
+ if (n.setDate(n.getDate() + 7), u.getDateRange(
3357
3705
  i,
3358
- a < r ? a : r
3706
+ n < r ? n : r
3359
3707
  ).forEach((c) => {
3360
3708
  const l = u.getLocalDateString(c);
3361
3709
  this.indices.byDate.has(l) || this.indices.byDate.set(l, /* @__PURE__ */ new Set()), this.indices.byDate.get(l).add(e.id);
3362
- }), r > a) {
3710
+ }), r > n) {
3363
3711
  const c = new Date(r);
3364
3712
  c.setDate(c.getDate() - 7), u.getDateRange(
3365
3713
  c > i ? c : i,
@@ -3427,11 +3775,19 @@ class Z {
3427
3775
  this.isBatchMode = !0, this.batchNotifications = [], e && (this.batchBackup = {
3428
3776
  events: new Map(this.events),
3429
3777
  indices: {
3430
- byDate: new Map(Array.from(this.indices.byDate.entries()).map(([t, s]) => [t, new Set(s)])),
3431
- byMonth: new Map(Array.from(this.indices.byMonth.entries()).map(([t, s]) => [t, new Set(s)])),
3778
+ byDate: new Map(
3779
+ Array.from(this.indices.byDate.entries()).map(([t, s]) => [t, new Set(s)])
3780
+ ),
3781
+ byMonth: new Map(
3782
+ Array.from(this.indices.byMonth.entries()).map(([t, s]) => [t, new Set(s)])
3783
+ ),
3432
3784
  recurring: new Set(this.indices.recurring),
3433
- byCategory: new Map(Array.from(this.indices.byCategory.entries()).map(([t, s]) => [t, new Set(s)])),
3434
- byStatus: new Map(Array.from(this.indices.byStatus.entries()).map(([t, s]) => [t, new Set(s)]))
3785
+ byCategory: new Map(
3786
+ Array.from(this.indices.byCategory.entries()).map(([t, s]) => [t, new Set(s)])
3787
+ ),
3788
+ byStatus: new Map(
3789
+ Array.from(this.indices.byStatus.entries()).map(([t, s]) => [t, new Set(s)])
3790
+ )
3435
3791
  },
3436
3792
  version: this.version
3437
3793
  });
@@ -3501,8 +3857,8 @@ class Z {
3501
3857
  for (const { id: i, updates: r } of e)
3502
3858
  try {
3503
3859
  t.push(this.updateEvent(i, r));
3504
- } catch (a) {
3505
- s.push({ id: i, error: a.message });
3860
+ } catch (n) {
3861
+ s.push({ id: i, error: n.message });
3506
3862
  }
3507
3863
  return this.commitBatch(), s.length > 0 && console.warn(`Failed to update ${s.length} events:`, s), t;
3508
3864
  });
@@ -3544,15 +3900,15 @@ class Z {
3544
3900
  let t = 0;
3545
3901
  for (const [s, i] of this.indices.byDate)
3546
3902
  if (new Date(s) < e) {
3547
- let a = !1;
3548
- for (const n of i) {
3549
- const o = this.events.get(n);
3903
+ let n = !1;
3904
+ for (const a of i) {
3905
+ const o = this.events.get(a);
3550
3906
  if (o && o.end >= e) {
3551
- a = !0;
3907
+ n = !0;
3552
3908
  break;
3553
3909
  }
3554
3910
  }
3555
- a || (this.indices.byDate.delete(s), t++);
3911
+ n || (this.indices.byDate.delete(s), t++);
3556
3912
  }
3557
3913
  return console.log(`Optimized indices: removed ${t} old date entries`), t;
3558
3914
  }
@@ -3593,14 +3949,14 @@ class Z {
3593
3949
  * @returns {import('../../types.js').ConflictSummary} All conflicts in range
3594
3950
  */
3595
3951
  getAllConflicts(e, t, s = {}) {
3596
- const i = this.getEventsInRange(e, t, !1), r = [], a = /* @__PURE__ */ new Set();
3597
- for (let n = 0; n < i.length; n++)
3598
- for (let o = n + 1; o < i.length; o++) {
3599
- const c = `${i[n].id}-${i[o].id}`;
3600
- if (!a.has(c)) {
3601
- a.add(c);
3952
+ const i = this.getEventsInRange(e, t, !1), r = [], n = /* @__PURE__ */ new Set();
3953
+ for (let a = 0; a < i.length; a++)
3954
+ for (let o = a + 1; o < i.length; o++) {
3955
+ const c = `${i[a].id}-${i[o].id}`;
3956
+ if (!n.has(c)) {
3957
+ n.add(c);
3602
3958
  const l = this.conflictDetector.checkEventPairConflicts(
3603
- i[n],
3959
+ i[a],
3604
3960
  i[o],
3605
3961
  s
3606
3962
  );
@@ -3609,7 +3965,7 @@ class Z {
3609
3965
  }
3610
3966
  return this.conflictDetector._buildConflictSummary(
3611
3967
  r,
3612
- new Set(i.map((n) => n.id)),
3968
+ new Set(i.map((a) => a.id)),
3613
3969
  /* @__PURE__ */ new Set()
3614
3970
  );
3615
3971
  }
@@ -3667,7 +4023,7 @@ class Z {
3667
4023
  return t;
3668
4024
  }
3669
4025
  }
3670
- let q = class {
4026
+ let K = class {
3671
4027
  /**
3672
4028
  * Create a new StateManager instance
3673
4029
  * @param {Partial<import('../../types.js').CalendarState>} [initialState={}] - Initial state values
@@ -3981,24 +4337,24 @@ let q = class {
3981
4337
  if (s.add(e), s.add(t), Array.isArray(e)) {
3982
4338
  if (!Array.isArray(t) || e.length !== t.length)
3983
4339
  return s.delete(e), s.delete(t), !1;
3984
- for (let a = 0; a < e.length; a++)
3985
- if (!this._deepEqual(e[a], t[a], s))
4340
+ for (let n = 0; n < e.length; n++)
4341
+ if (!this._deepEqual(e[n], t[n], s))
3986
4342
  return s.delete(e), s.delete(t), !1;
3987
4343
  return s.delete(e), s.delete(t), !0;
3988
4344
  }
3989
4345
  if (e instanceof Date && t instanceof Date) {
3990
- const a = e.getTime() === t.getTime();
3991
- return s.delete(e), s.delete(t), a;
4346
+ const n = e.getTime() === t.getTime();
4347
+ return s.delete(e), s.delete(t), n;
3992
4348
  }
3993
4349
  const i = Object.keys(e), r = Object.keys(t);
3994
4350
  if (i.length !== r.length)
3995
4351
  return s.delete(e), s.delete(t), !1;
3996
4352
  i.sort(), r.sort();
3997
- for (let a = 0; a < i.length; a++)
3998
- if (i[a] !== r[a])
4353
+ for (let n = 0; n < i.length; n++)
4354
+ if (i[n] !== r[n])
3999
4355
  return s.delete(e), s.delete(t), !1;
4000
- for (const a of i)
4001
- if (!this._deepEqual(e[a], t[a], s))
4356
+ for (const n of i)
4357
+ if (!this._deepEqual(e[n], t[n], s))
4002
4358
  return s.delete(e), s.delete(t), !1;
4003
4359
  return s.delete(e), s.delete(t), !0;
4004
4360
  }
@@ -4007,7 +4363,25 @@ let q = class {
4007
4363
  * @private
4008
4364
  */
4009
4365
  _addToHistory(e) {
4010
- this.historyIndex < this.history.length - 1 && (this.history = this.history.slice(0, this.historyIndex + 1)), this.history.push({ ...e }), this.historyIndex++, this.history.length > this.maxHistorySize && (this.history.shift(), this.historyIndex--);
4366
+ this.historyIndex < this.history.length - 1 && (this.history = this.history.slice(0, this.historyIndex + 1));
4367
+ const t = this._deepClone(e);
4368
+ this.history.push(t), this.historyIndex++, this.history.length > this.maxHistorySize && (this.history.shift(), this.historyIndex--);
4369
+ }
4370
+ /**
4371
+ * Deep clone a value for history storage
4372
+ * @private
4373
+ */
4374
+ _deepClone(e) {
4375
+ if (e === null || typeof e != "object")
4376
+ return e;
4377
+ if (e instanceof Date)
4378
+ return new Date(e);
4379
+ if (Array.isArray(e))
4380
+ return e.map((s) => this._deepClone(s));
4381
+ const t = {};
4382
+ for (const s in e)
4383
+ Object.prototype.hasOwnProperty.call(e, s) && (t[s] = this._deepClone(e[s]));
4384
+ return t;
4011
4385
  }
4012
4386
  /**
4013
4387
  * Notify listeners of state changes
@@ -4025,18 +4399,18 @@ let q = class {
4025
4399
  for (const r of i)
4026
4400
  try {
4027
4401
  r(t[s], e[s], t, e);
4028
- } catch (a) {
4029
- console.error(`Error in state listener for key "${s}":`, a);
4402
+ } catch (n) {
4403
+ console.error(`Error in state listener for key "${s}":`, n);
4030
4404
  }
4031
4405
  }
4032
4406
  };
4033
- class K {
4407
+ class G {
4034
4408
  /**
4035
4409
  * Create a new Calendar instance
4036
4410
  * @param {import('../../types.js').CalendarConfig} [config={}] - Configuration options
4037
4411
  */
4038
4412
  constructor(e = {}) {
4039
- this.timezoneManager = new A(), this.config = {
4413
+ this.timezoneManager = S.getInstance(), this.config = {
4040
4414
  view: "month",
4041
4415
  date: /* @__PURE__ */ new Date(),
4042
4416
  weekStartsOn: 0,
@@ -4051,7 +4425,7 @@ class K {
4051
4425
  end: "17:00"
4052
4426
  },
4053
4427
  ...e
4054
- }, this.eventStore = new Z({ timezone: this.config.timeZone }), this.state = new q({
4428
+ }, this.eventStore = new q({ timezone: this.config.timeZone }), this.state = new K({
4055
4429
  view: this.config.view,
4056
4430
  currentDate: this.config.date,
4057
4431
  weekStartsOn: this.config.weekStartsOn,
@@ -4290,11 +4664,7 @@ class K {
4290
4664
  * @returns {string} Formatted date string
4291
4665
  */
4292
4666
  formatInTimezone(e, t = null, s = {}) {
4293
- return this.timezoneManager.formatInTimezone(
4294
- e,
4295
- t || this.config.timeZone,
4296
- s
4297
- );
4667
+ return this.timezoneManager.formatInTimezone(e, t || this.config.timeZone, s);
4298
4668
  }
4299
4669
  /**
4300
4670
  * Get list of common timezones with offsets
@@ -4344,21 +4714,21 @@ class K {
4344
4714
  * @private
4345
4715
  */
4346
4716
  _getMonthViewData(e) {
4347
- const t = e.getFullYear(), s = e.getMonth(), i = this.state.get("weekStartsOn"), r = this.state.get("fixedWeekCount"), a = new Date(t, s, 1), n = new Date(t, s + 1, 0), o = u.startOfWeek(a, i), c = [];
4717
+ const t = e.getFullYear(), s = e.getMonth(), i = this.state.get("weekStartsOn"), r = this.state.get("fixedWeekCount"), n = new Date(t, s, 1), a = new Date(t, s + 1, 0), o = u.startOfWeek(n, i), c = [];
4348
4718
  let l = new Date(o);
4349
- const d = r ? 6 : Math.ceil((n.getDate() + u.getDayOfWeek(a, i)) / 7);
4719
+ const d = r ? 6 : Math.ceil((a.getDate() + u.getDayOfWeek(n, i)) / 7);
4350
4720
  for (let h = 0; h < d; h++) {
4351
4721
  const g = {
4352
4722
  weekNumber: u.getWeekNumber(l),
4353
4723
  days: []
4354
4724
  };
4355
- for (let b = 0; b < 7; b++) {
4356
- const f = new Date(l), D = f.getMonth() === s, x = u.isToday(f), M = f.getDay() === 0 || f.getDay() === 6;
4725
+ for (let w = 0; w < 7; w++) {
4726
+ const f = new Date(l), k = f.getMonth() === s, b = u.isToday(f), M = f.getDay() === 0 || f.getDay() === 6;
4357
4727
  g.days.push({
4358
4728
  date: f,
4359
4729
  dayOfMonth: f.getDate(),
4360
- isCurrentMonth: D,
4361
- isToday: x,
4730
+ isCurrentMonth: k,
4731
+ isToday: b,
4362
4732
  isWeekend: M,
4363
4733
  events: this.getEventsForDate(f)
4364
4734
  }), l = u.addDays(l, 1);
@@ -4381,9 +4751,9 @@ class K {
4381
4751
  * @private
4382
4752
  */
4383
4753
  _getWeekViewData(e) {
4384
- const t = this.state.get("weekStartsOn"), s = u.startOfWeek(e, t), i = u.endOfWeek(e, t), r = [], a = new Date(s);
4385
- for (let n = 0; n < 7; n++) {
4386
- const o = new Date(a);
4754
+ const t = this.state.get("weekStartsOn"), s = u.startOfWeek(e, t), i = u.endOfWeek(e, t), r = [], n = new Date(s);
4755
+ for (let a = 0; a < 7; a++) {
4756
+ const o = new Date(n);
4387
4757
  r.push({
4388
4758
  date: o,
4389
4759
  dayOfMonth: o.getDate(),
@@ -4395,7 +4765,7 @@ class K {
4395
4765
  // Add overlap groups for positioning overlapping events
4396
4766
  overlapGroups: this.eventStore.getOverlapGroups(o, !0),
4397
4767
  getEventPositions: (c) => this.eventStore.calculateEventPositions(c)
4398
- }), a.setDate(a.getDate() + 1);
4768
+ }), n.setDate(n.getDate() + 1);
4399
4769
  }
4400
4770
  return {
4401
4771
  type: "week",
@@ -4410,15 +4780,15 @@ class K {
4410
4780
  * @private
4411
4781
  */
4412
4782
  _getDayViewData(e) {
4413
- const t = this.getEventsForDate(e), s = t.filter((a) => a.allDay), i = t.filter((a) => !a.allDay), r = [];
4414
- for (let a = 0; a < 24; a++) {
4415
- const n = new Date(e);
4416
- n.setHours(a, 0, 0, 0);
4783
+ const t = this.getEventsForDate(e), s = t.filter((n) => n.allDay), i = t.filter((n) => !n.allDay), r = [];
4784
+ for (let n = 0; n < 24; n++) {
4785
+ const a = new Date(e);
4786
+ a.setHours(n, 0, 0, 0);
4417
4787
  const o = new Date(e);
4418
- o.setHours(a + 1, 0, 0, 0), r.push({
4419
- hour: a,
4420
- time: u.formatTime(n, this.state.get("locale")),
4421
- events: i.filter((c) => c.start < o && c.end > n)
4788
+ o.setHours(n + 1, 0, 0, 0), r.push({
4789
+ hour: n,
4790
+ time: u.formatTime(a, this.state.get("locale")),
4791
+ events: i.filter((c) => c.start < o && c.end > a)
4422
4792
  });
4423
4793
  }
4424
4794
  return {
@@ -4440,23 +4810,23 @@ class K {
4440
4810
  const s = new Date(t);
4441
4811
  s.setDate(s.getDate() + 30);
4442
4812
  const i = this.getEventsInRange(t, s), r = /* @__PURE__ */ new Map();
4443
- i.forEach((n) => {
4444
- const o = n.start.toDateString();
4813
+ i.forEach((a) => {
4814
+ const o = a.start.toDateString();
4445
4815
  r.has(o) || r.set(o, {
4446
- date: new Date(n.start),
4816
+ date: new Date(a.start),
4447
4817
  events: []
4448
- }), r.get(o).events.push(n);
4818
+ }), r.get(o).events.push(a);
4449
4819
  });
4450
- const a = Array.from(r.values()).sort((n, o) => n.date - o.date).map((n) => ({
4451
- ...n,
4452
- dayName: u.getDayName(n.date, this.state.get("locale")),
4453
- isToday: u.isToday(n.date)
4820
+ const n = Array.from(r.values()).sort((a, o) => a.date - o.date).map((a) => ({
4821
+ ...a,
4822
+ dayName: u.getDayName(a.date, this.state.get("locale")),
4823
+ isToday: u.isToday(a.date)
4454
4824
  }));
4455
4825
  return {
4456
4826
  type: "list",
4457
4827
  startDate: t,
4458
4828
  endDate: s,
4459
- days: a,
4829
+ days: n,
4460
4830
  totalEvents: i.length
4461
4831
  };
4462
4832
  }
@@ -4550,12 +4920,12 @@ class K {
4550
4920
  * Destroy the calendar and clean up
4551
4921
  */
4552
4922
  destroy() {
4553
- this.listeners.clear(), this.eventStore.clear(), this.plugins.forEach((e) => {
4923
+ this.listeners.clear(), this.eventStore.destroy(), this.plugins.forEach((e) => {
4554
4924
  typeof e.uninstall == "function" && e.uninstall(this);
4555
- }), this.plugins.clear(), this._emit("destroy");
4925
+ }), this.plugins.clear(), this.views.clear(), this._emit("destroy");
4556
4926
  }
4557
4927
  }
4558
- class G {
4928
+ class Q {
4559
4929
  constructor() {
4560
4930
  this.events = /* @__PURE__ */ new Map(), this.wildcardHandlers = /* @__PURE__ */ new Set();
4561
4931
  }
@@ -4573,10 +4943,10 @@ class G {
4573
4943
  return this.wildcardHandlers.add(o), () => this.wildcardHandlers.delete(o);
4574
4944
  }
4575
4945
  this.events.has(e) || this.events.set(e, []);
4576
- const a = { handler: t, once: i, priority: r }, n = this.events.get(e);
4577
- return n.push(a), n.sort((o, c) => c.priority - o.priority), () => {
4578
- const o = n.indexOf(a);
4579
- o > -1 && n.splice(o, 1);
4946
+ const n = { handler: t, once: i, priority: r }, a = this.events.get(e);
4947
+ return a.push(n), a.sort((o, c) => c.priority - o.priority), () => {
4948
+ const o = a.indexOf(n);
4949
+ o > -1 && a.splice(o, 1);
4580
4950
  };
4581
4951
  }
4582
4952
  /**
@@ -4603,11 +4973,11 @@ class G {
4603
4973
  const s = [];
4604
4974
  if (this.events.has(e)) {
4605
4975
  const r = [...this.events.get(e)];
4606
- for (const a of r) {
4607
- const { handler: n, once: o } = a;
4608
- o && this.off(e, n);
4976
+ for (const n of r) {
4977
+ const { handler: a, once: o } = n;
4978
+ o && this.off(e, a);
4609
4979
  try {
4610
- const c = n(t, e);
4980
+ const c = a(t, e);
4611
4981
  c instanceof Promise && s.push(c);
4612
4982
  } catch (c) {
4613
4983
  console.error(`Error in event handler for ${e}:`, c);
@@ -4617,10 +4987,10 @@ class G {
4617
4987
  const i = [];
4618
4988
  for (const r of [...this.wildcardHandlers])
4619
4989
  if (this.matchesPattern(e, r.pattern)) {
4620
- const { handler: a, once: n } = r;
4621
- n && i.push(r);
4990
+ const { handler: n, once: a } = r;
4991
+ a && i.push(r);
4622
4992
  try {
4623
- const o = a(t, e);
4993
+ const o = n(t, e);
4624
4994
  o instanceof Promise && s.push(o);
4625
4995
  } catch (o) {
4626
4996
  console.error(`Error in wildcard handler for ${e}:`, o);
@@ -4653,10 +5023,10 @@ class G {
4653
5023
  return this.events.has(e) ? this.events.get(e).length : 0;
4654
5024
  }
4655
5025
  }
4656
- const y = new G();
4657
- class Q {
5026
+ const y = new Q();
5027
+ class J {
4658
5028
  constructor(e = {}) {
4659
- this.calendar = new K({
5029
+ this.calendar = new G({
4660
5030
  view: e.view || "month",
4661
5031
  date: e.date || /* @__PURE__ */ new Date(),
4662
5032
  weekStartsOn: e.weekStartsOn ?? 0,
@@ -4747,7 +5117,7 @@ class Q {
4747
5117
  const s = this.calendar.updateEvent(e, t);
4748
5118
  if (!s)
4749
5119
  return console.error(`Failed to update event: ${e}`), y.emit("event:error", { action: "update", eventId: e, updates: t, error: "Event not found in calendar" }), null;
4750
- const i = this.state.events.findIndex((a) => a.id === e);
5120
+ const i = this.state.events.findIndex((n) => n.id === e);
4751
5121
  if (i === -1)
4752
5122
  return console.error(`Event ${e} not found in state`), y.emit("event:error", { action: "update", eventId: e, error: "Event not found in state" }), null;
4753
5123
  const r = [...this.state.events];
@@ -4779,11 +5149,11 @@ class Q {
4779
5149
  if (e.weeks && (e.weeks = e.weeks.map((i) => ({
4780
5150
  ...i,
4781
5151
  days: i.days.map((r) => {
4782
- const a = new Date(r.date);
5152
+ const n = new Date(r.date);
4783
5153
  return {
4784
5154
  ...r,
4785
- isSelected: a.toDateString() === t,
4786
- events: r.events || this.getEventsForDate(a)
5155
+ isSelected: n.toDateString() === t,
5156
+ events: r.events || this.getEventsForDate(n)
4787
5157
  };
4788
5158
  })
4789
5159
  }))), e.days && (e.days = e.days.map((i) => {
@@ -4848,7 +5218,7 @@ class Q {
4848
5218
  this.subscribers.clear(), this.state = null, this.calendar = null;
4849
5219
  }
4850
5220
  }
4851
- class w extends u {
5221
+ class x extends u {
4852
5222
  /**
4853
5223
  * Format date for display
4854
5224
  */
@@ -4910,8 +5280,8 @@ class w extends u {
4910
5280
  * Get relative time string (e.g., "2 hours ago", "in 3 days")
4911
5281
  */
4912
5282
  static getRelativeTime(e, t = /* @__PURE__ */ new Date(), s = "en-US") {
4913
- const i = new Intl.RelativeTimeFormat(s, { numeric: "auto" }), r = e - t, a = Math.floor(r / 1e3), n = Math.floor(a / 60), o = Math.floor(n / 60), c = Math.floor(o / 24), l = Math.floor(c / 7), d = Math.floor(c / 30), h = Math.floor(c / 365);
4914
- return Math.abs(a) < 60 ? i.format(a, "second") : Math.abs(n) < 60 ? i.format(n, "minute") : Math.abs(o) < 24 ? i.format(o, "hour") : Math.abs(c) < 7 ? i.format(c, "day") : Math.abs(l) < 4 ? i.format(l, "week") : Math.abs(d) < 12 ? i.format(d, "month") : i.format(h, "year");
5283
+ const i = new Intl.RelativeTimeFormat(s, { numeric: "auto" }), r = e - t, n = Math.floor(r / 1e3), a = Math.floor(n / 60), o = Math.floor(a / 60), c = Math.floor(o / 24), l = Math.floor(c / 7), d = Math.floor(c / 30), h = Math.floor(c / 365);
5284
+ return Math.abs(n) < 60 ? i.format(n, "second") : Math.abs(a) < 60 ? i.format(a, "minute") : Math.abs(o) < 24 ? i.format(o, "hour") : Math.abs(c) < 7 ? i.format(c, "day") : Math.abs(l) < 4 ? i.format(l, "week") : Math.abs(d) < 12 ? i.format(d, "month") : i.format(h, "year");
4915
5285
  }
4916
5286
  /**
4917
5287
  * Check if date is today
@@ -4957,9 +5327,9 @@ class w extends u {
4957
5327
  * Parse time string (e.g., "14:30" or "2:30 PM")
4958
5328
  */
4959
5329
  static parseTimeString(e, t = /* @__PURE__ */ new Date()) {
4960
- const s = new Date(t), [i, r] = e.split(/\s+/), [a, n] = i.split(":").map(Number);
4961
- let o = a;
4962
- return r && (r.toLowerCase() === "pm" && a < 12 ? o = a + 12 : r.toLowerCase() === "am" && a === 12 && (o = 0)), s.setHours(o, n || 0, 0, 0), s;
5330
+ const s = new Date(t), [i, r] = e.split(/\s+/), [n, a] = i.split(":").map(Number);
5331
+ let o = n;
5332
+ return r && (r.toLowerCase() === "pm" && n < 12 ? o = n + 12 : r.toLowerCase() === "am" && n === 12 && (o = 0)), s.setHours(o, a || 0, 0, 0), s;
4963
5333
  }
4964
5334
  }
4965
5335
  class C {
@@ -4968,18 +5338,18 @@ class C {
4968
5338
  */
4969
5339
  static createElement(e, t = {}, s = []) {
4970
5340
  const i = document.createElement(e);
4971
- return Object.entries(t).forEach(([r, a]) => {
5341
+ return Object.entries(t).forEach(([r, n]) => {
4972
5342
  if (r === "className")
4973
- i.className = a;
4974
- else if (r === "style" && typeof a == "object")
4975
- Object.assign(i.style, a);
5343
+ i.className = n;
5344
+ else if (r === "style" && typeof n == "object")
5345
+ Object.assign(i.style, n);
4976
5346
  else if (r.startsWith("data-"))
4977
- i.setAttribute(r, a);
4978
- else if (r.startsWith("on") && typeof a == "function") {
4979
- const n = r.slice(2).toLowerCase();
4980
- i.addEventListener(n, a);
5347
+ i.setAttribute(r, n);
5348
+ else if (r.startsWith("on") && typeof n == "function") {
5349
+ const a = r.slice(2).toLowerCase();
5350
+ i.addEventListener(a, n);
4981
5351
  } else
4982
- i[r] = a;
5352
+ i[r] = n;
4983
5353
  }), s.forEach((r) => {
4984
5354
  typeof r == "string" ? i.appendChild(document.createTextNode(r)) : r instanceof Node && i.appendChild(r);
4985
5355
  }), i;
@@ -5000,9 +5370,9 @@ class C {
5000
5370
  * Delegate event handling
5001
5371
  */
5002
5372
  static delegate(e, t, s, i) {
5003
- const r = (a) => {
5004
- const n = a.target.closest(t);
5005
- n && e.contains(n) && i.call(n, a);
5373
+ const r = (n) => {
5374
+ const a = n.target.closest(t);
5375
+ a && e.contains(a) && i.call(a, n);
5006
5376
  };
5007
5377
  return e.addEventListener(s, r), () => e.removeEventListener(s, r);
5008
5378
  }
@@ -5089,10 +5459,10 @@ class C {
5089
5459
  static debounce(e, t = 250) {
5090
5460
  let s;
5091
5461
  return function(...r) {
5092
- const a = () => {
5462
+ const n = () => {
5093
5463
  clearTimeout(s), e(...r);
5094
5464
  };
5095
- clearTimeout(s), s = setTimeout(a, t);
5465
+ clearTimeout(s), s = setTimeout(n, t);
5096
5466
  };
5097
5467
  }
5098
5468
  /**
@@ -5151,8 +5521,8 @@ class C {
5151
5521
  );
5152
5522
  if (t.length === 0)
5153
5523
  return e.setAttribute("tabindex", "-1"), e.focus(), () => e.removeAttribute("tabindex");
5154
- const s = t[0], i = t[t.length - 1], r = (a) => {
5155
- a.key === "Tab" && (a.shiftKey ? document.activeElement === s && (i == null || i.focus(), a.preventDefault()) : document.activeElement === i && (s == null || s.focus(), a.preventDefault()));
5524
+ const s = t[0], i = t[t.length - 1], r = (n) => {
5525
+ n.key === "Tab" && (n.shiftKey ? document.activeElement === s && (i == null || i.focus(), n.preventDefault()) : document.activeElement === i && (s == null || s.focus(), n.preventDefault()));
5156
5526
  };
5157
5527
  return e.addEventListener("keydown", r), s == null || s.focus(), () => e.removeEventListener("keydown", r);
5158
5528
  }
@@ -5325,15 +5695,15 @@ class v {
5325
5695
  * Darken color by percentage
5326
5696
  */
5327
5697
  static darken(e, t) {
5328
- const s = parseInt(e.replace("#", ""), 16), i = Math.round(2.55 * t), r = (s >> 16) - i, a = (s >> 8 & 255) - i, n = (s & 255) - i;
5329
- return "#" + (16777216 + (r < 255 ? r < 1 ? 0 : r : 255) * 65536 + (a < 255 ? a < 1 ? 0 : a : 255) * 256 + (n < 255 ? n < 1 ? 0 : n : 255)).toString(16).slice(1);
5698
+ const s = parseInt(e.replace("#", ""), 16), i = Math.round(2.55 * t), r = (s >> 16) - i, n = (s >> 8 & 255) - i, a = (s & 255) - i;
5699
+ return "#" + (16777216 + (r < 255 ? r < 1 ? 0 : r : 255) * 65536 + (n < 255 ? n < 1 ? 0 : n : 255) * 256 + (a < 255 ? a < 1 ? 0 : a : 255)).toString(16).slice(1);
5330
5700
  }
5331
5701
  /**
5332
5702
  * Lighten color by percentage
5333
5703
  */
5334
5704
  static lighten(e, t) {
5335
- const s = parseInt(e.replace("#", ""), 16), i = Math.round(2.55 * t), r = (s >> 16) + i, a = (s >> 8 & 255) + i, n = (s & 255) + i;
5336
- return "#" + (16777216 + (r < 255 ? r < 1 ? 0 : r : 255) * 65536 + (a < 255 ? a < 1 ? 0 : a : 255) * 256 + (n < 255 ? n < 1 ? 0 : n : 255)).toString(16).slice(1);
5705
+ const s = parseInt(e.replace("#", ""), 16), i = Math.round(2.55 * t), r = (s >> 16) + i, n = (s >> 8 & 255) + i, a = (s & 255) + i;
5706
+ return "#" + (16777216 + (r < 255 ? r < 1 ? 0 : r : 255) * 65536 + (n < 255 ? n < 1 ? 0 : n : 255) * 256 + (a < 255 ? a < 1 ? 0 : a : 255)).toString(16).slice(1);
5337
5707
  }
5338
5708
  /**
5339
5709
  * Get contrast color (black or white) for background
@@ -5382,8 +5752,8 @@ class v {
5382
5752
  * Convert hex to rgba
5383
5753
  */
5384
5754
  static hexToRgba(e, t = 1) {
5385
- const s = e.replace("#", ""), i = parseInt(s.substr(0, 2), 16), r = parseInt(s.substr(2, 2), 16), a = parseInt(s.substr(4, 2), 16);
5386
- return `rgba(${i}, ${r}, ${a}, ${t})`;
5755
+ const s = e.replace("#", ""), i = parseInt(s.substr(0, 2), 16), r = parseInt(s.substr(2, 2), 16), n = parseInt(s.substr(4, 2), 16);
5756
+ return `rgba(${i}, ${r}, ${n}, ${t})`;
5387
5757
  }
5388
5758
  /**
5389
5759
  * Generate grid styles
@@ -5494,7 +5864,7 @@ class v {
5494
5864
  /**
5495
5865
  * Default theme colors
5496
5866
  */
5497
- S(v, "colors", {
5867
+ z(v, "colors", {
5498
5868
  primary: "#3B82F6",
5499
5869
  // Modern Blue
5500
5870
  secondary: "#64748B",
@@ -5527,7 +5897,7 @@ S(v, "colors", {
5527
5897
  }), /**
5528
5898
  * Common CSS variables
5529
5899
  */
5530
- S(v, "cssVariables", {
5900
+ z(v, "cssVariables", {
5531
5901
  // "Pro" Palette - Functional & Sharp
5532
5902
  "--fc-primary-color": "#2563EB",
5533
5903
  // International Blue (Focus)
@@ -5595,7 +5965,7 @@ S(v, "cssVariables", {
5595
5965
  }), /**
5596
5966
  * Get responsive breakpoints
5597
5967
  */
5598
- S(v, "breakpoints", {
5968
+ z(v, "breakpoints", {
5599
5969
  xs: "320px",
5600
5970
  sm: "576px",
5601
5971
  md: "768px",
@@ -5603,7 +5973,7 @@ S(v, "breakpoints", {
5603
5973
  xl: "1200px",
5604
5974
  "2xl": "1400px"
5605
5975
  });
5606
- class J extends E {
5976
+ class X extends $ {
5607
5977
  constructor() {
5608
5978
  super(), this._stateManager = null, this.viewData = null, this.config = {
5609
5979
  maxEventsToShow: 3
@@ -5678,15 +6048,15 @@ class J extends E {
5678
6048
  processViewData(e) {
5679
6049
  var i, r;
5680
6050
  if (!e || !e.weeks) return null;
5681
- const t = (r = (i = this.stateManager) == null ? void 0 : i.getState()) == null ? void 0 : r.selectedDate, s = e.weeks.map((a) => a.days.map((n) => {
5682
- const o = new Date(n.date), c = t && o.toDateString() === t.toDateString(), l = n.events.map((d) => ({
6051
+ const t = (r = (i = this.stateManager) == null ? void 0 : i.getState()) == null ? void 0 : r.selectedDate, s = e.weeks.map((n) => n.days.map((a) => {
6052
+ const o = new Date(a.date), c = t && o.toDateString() === t.toDateString(), l = a.events.map((d) => ({
5683
6053
  ...d,
5684
6054
  textColor: this.getContrastingTextColor(d.backgroundColor)
5685
6055
  }));
5686
6056
  return {
5687
- ...n,
6057
+ ...a,
5688
6058
  date: o,
5689
- isOtherMonth: !n.isCurrentMonth,
6059
+ isOtherMonth: !a.isCurrentMonth,
5690
6060
  isSelected: c,
5691
6061
  events: l
5692
6062
  };
@@ -5703,10 +6073,10 @@ class J extends E {
5703
6073
  const t = e.charAt(0) === "#" ? e.substring(1) : e;
5704
6074
  if (!/^[0-9A-Fa-f]{3}$|^[0-9A-Fa-f]{6}$/.test(t))
5705
6075
  return "white";
5706
- const s = t.length === 3 ? t[0] + t[0] + t[1] + t[1] + t[2] + t[2] : t, i = parseInt(s.substring(0, 2), 16), r = parseInt(s.substring(2, 4), 16), a = parseInt(s.substring(4, 6), 16);
5707
- if (isNaN(i) || isNaN(r) || isNaN(a))
6076
+ const s = t.length === 3 ? t[0] + t[0] + t[1] + t[1] + t[2] + t[2] : t, i = parseInt(s.substring(0, 2), 16), r = parseInt(s.substring(2, 4), 16), n = parseInt(s.substring(4, 6), 16);
6077
+ if (isNaN(i) || isNaN(r) || isNaN(n))
5708
6078
  return "white";
5709
- const o = [i / 255, r / 255, a / 255].map((l) => l <= 0.03928 ? l / 12.92 : Math.pow((l + 0.055) / 1.055, 2.4));
6079
+ const o = [i / 255, r / 255, n / 255].map((l) => l <= 0.03928 ? l / 12.92 : Math.pow((l + 0.055) / 1.055, 2.4));
5710
6080
  return 0.2126 * o[0] + 0.7152 * o[1] + 0.0722 * o[2] > 0.179 ? "black" : "white";
5711
6081
  }
5712
6082
  isSelectedDate(e) {
@@ -5948,8 +6318,8 @@ class J extends E {
5948
6318
  renderHeader() {
5949
6319
  const { config: e } = this.stateManager.getState(), t = [], s = e.weekStartsOn || 0;
5950
6320
  for (let i = 0; i < 7; i++) {
5951
- const r = (s + i) % 7, a = w.getDayAbbreviation(r, e.locale);
5952
- t.push(`<div class="month-header-cell">${a}</div>`);
6321
+ const r = (s + i) % 7, n = x.getDayAbbreviation(r, e.locale);
6322
+ t.push(`<div class="month-header-cell">${n}</div>`);
5953
6323
  }
5954
6324
  return `
5955
6325
  <div class="month-header">
@@ -5981,9 +6351,9 @@ class J extends E {
5981
6351
  `;
5982
6352
  }
5983
6353
  renderDay(e) {
5984
- const { date: t, dayOfMonth: s, isOtherMonth: i, isToday: r, isSelected: a, isWeekend: n, events: o = [] } = e, c = s, l = ["month-day"];
5985
- i && l.push("other-month"), r && l.push("today"), a && l.push("selected"), n && l.push("weekend");
5986
- const d = o.slice(0, this.config.maxEventsToShow), h = o.length - this.config.maxEventsToShow, g = d.map((f) => this.renderEvent(f)).join(""), b = h > 0 ? `<div class="more-events">+${h} more</div>` : "";
6354
+ const { date: t, dayOfMonth: s, isOtherMonth: i, isToday: r, isSelected: n, isWeekend: a, events: o = [] } = e, c = s, l = ["month-day"];
6355
+ i && l.push("other-month"), r && l.push("today"), n && l.push("selected"), a && l.push("weekend");
6356
+ const d = o.slice(0, this.config.maxEventsToShow), h = o.length - this.config.maxEventsToShow, g = d.map((f) => this.renderEvent(f)).join(""), w = h > 0 ? `<div class="more-events">+${h} more</div>` : "";
5987
6357
  return `
5988
6358
  <div class="${l.join(" ")}"
5989
6359
  data-date="${t.toISOString()}"
@@ -5993,24 +6363,24 @@ class J extends E {
5993
6363
  </div>
5994
6364
  <div class="day-events">
5995
6365
  ${g}
5996
- ${b}
6366
+ ${w}
5997
6367
  </div>
5998
6368
  </div>
5999
6369
  `;
6000
6370
  }
6001
6371
  renderEvent(e) {
6002
- const { title: t, start: s, allDay: i, backgroundColor: r, textColor: a } = e;
6003
- let n = "";
6372
+ const { title: t, start: s, allDay: i, backgroundColor: r, textColor: n } = e;
6373
+ let a = "";
6004
6374
  if (r) {
6005
- const l = v.sanitizeColor(r), d = v.sanitizeColor(a, "white");
6006
- n += `background-color: ${l}; color: ${d};`;
6375
+ const l = v.sanitizeColor(r), d = v.sanitizeColor(n, "white");
6376
+ a += `background-color: ${l}; color: ${d};`;
6007
6377
  }
6008
6378
  let o = "";
6009
- !i && s && (o = w.formatTime(new Date(s), !1, !1));
6379
+ !i && s && (o = x.formatTime(new Date(s), !1, !1));
6010
6380
  const c = ["event-item"];
6011
6381
  return i && c.push("all-day"), `
6012
6382
  <div class="${c.join(" ")}"
6013
- style="${n}"
6383
+ style="${a}"
6014
6384
  data-event-id="${e.id}"
6015
6385
  title="${C.escapeHTML(t)}">
6016
6386
  ${o ? `<span class="event-time">${o}</span>` : ""}
@@ -6046,7 +6416,7 @@ class J extends E {
6046
6416
  this.unsubscribe && this.unsubscribe();
6047
6417
  }
6048
6418
  }
6049
- class X extends E {
6419
+ class ee extends $ {
6050
6420
  constructor() {
6051
6421
  super(), this._stateManager = null, this.viewData = null, this.hours = Array.from({ length: 24 }, (e, t) => t), this._registryCheckInterval = null;
6052
6422
  }
@@ -6112,7 +6482,7 @@ class X extends E {
6112
6482
  return {
6113
6483
  ...s,
6114
6484
  date: i,
6115
- isToday: w.isToday(i),
6485
+ isToday: x.isToday(i),
6116
6486
  timedEvents: (s.events || []).filter((r) => !r.allDay),
6117
6487
  allDayEvents: (s.events || []).filter((r) => r.allDay)
6118
6488
  };
@@ -6309,7 +6679,7 @@ class X extends E {
6309
6679
  <div class="time-gutter-header"></div>
6310
6680
  ${this.viewData.days.map((e) => `
6311
6681
  <div class="day-column-header ${e.isToday ? "is-today" : ""}">
6312
- <span class="day-name">${w.getDayAbbreviation(e.date.getDay())}</span>
6682
+ <span class="day-name">${x.getDayAbbreviation(e.date.getDay())}</span>
6313
6683
  <span class="day-number">${e.date.getDate()}</span>
6314
6684
  </div>
6315
6685
  `).join("")}
@@ -6332,7 +6702,7 @@ class X extends E {
6332
6702
  <div class="time-gutter">
6333
6703
  ${this.hours.map((e) => `
6334
6704
  <div class="time-slot-label">
6335
- ${e === 0 ? "" : w.formatTime((/* @__PURE__ */ new Date()).setHours(e, 0), !1)}
6705
+ ${e === 0 ? "" : x.formatTime((/* @__PURE__ */ new Date()).setHours(e, 0), !1)}
6336
6706
  </div>
6337
6707
  `).join("")}
6338
6708
  </div>
@@ -6348,13 +6718,13 @@ class X extends E {
6348
6718
  ` : '<div class="week-view">Loading...</div>';
6349
6719
  }
6350
6720
  renderTimedEvent(e) {
6351
- const t = new Date(e.start), s = new Date(e.end), i = t.getHours() * 60 + t.getMinutes(), r = (s - t) / (1e3 * 60), a = i, n = Math.max(r, 20), o = v.sanitizeColor(e.backgroundColor), c = v.sanitizeColor(v.getContrastColor(o), "white");
6721
+ const t = new Date(e.start), s = new Date(e.end), i = t.getHours() * 60 + t.getMinutes(), r = (s - t) / (1e3 * 60), n = i, a = Math.max(r, 20), o = v.sanitizeColor(e.backgroundColor), c = v.sanitizeColor(v.getContrastColor(o), "white");
6352
6722
  return `
6353
6723
  <div class="event-container"
6354
- style="top: ${a}px; height: ${n}px; background-color: ${o}; color: ${c};"
6724
+ style="top: ${n}px; height: ${a}px; background-color: ${o}; color: ${c};"
6355
6725
  data-event-id="${e.id}">
6356
6726
  <span class="event-title">${C.escapeHTML(e.title)}</span>
6357
- <span class="event-time">${w.formatTime(t)}</span>
6727
+ <span class="event-time">${x.formatTime(t)}</span>
6358
6728
  </div>
6359
6729
  `;
6360
6730
  }
@@ -6377,13 +6747,13 @@ class X extends E {
6377
6747
  e && !this._scrolled && (e.scrollTop = 8 * 60 - 50, this._scrolled = !0), this.$$("[data-event-id]").forEach((t) => {
6378
6748
  this.addListener(t, "click", (s) => {
6379
6749
  s.stopPropagation();
6380
- const i = s.currentTarget.dataset.eventId, r = this.stateManager.getEvents().find((a) => a.id === i);
6750
+ const i = s.currentTarget.dataset.eventId, r = this.stateManager.getEvents().find((n) => n.id === i);
6381
6751
  r && this.emit("event-click", { event: r });
6382
6752
  });
6383
6753
  }), this.$$(".day-column").forEach((t) => {
6384
6754
  this.addListener(t, "click", (s) => {
6385
- const i = s.currentTarget, r = this.$("#scroll-container"), a = i.getBoundingClientRect(), n = s.clientY - a.top + (r ? r.scrollTop : 0), o = new Date(i.dataset.date);
6386
- o.setHours(Math.floor(n / 60), Math.floor(n % 60), 0, 0), this.stateManager.selectDate(o), this.emit("day-click", { date: o });
6755
+ const i = s.currentTarget, r = this.$("#scroll-container"), n = i.getBoundingClientRect(), a = s.clientY - n.top + (r ? r.scrollTop : 0), o = new Date(i.dataset.date);
6756
+ o.setHours(Math.floor(a / 60), Math.floor(a % 60), 0, 0), this.stateManager.selectDate(o), this.emit("day-click", { date: o });
6387
6757
  });
6388
6758
  });
6389
6759
  }
@@ -6391,7 +6761,7 @@ class X extends E {
6391
6761
  this.unsubscribe && this.unsubscribe();
6392
6762
  }
6393
6763
  }
6394
- class ee extends E {
6764
+ class te extends $ {
6395
6765
  constructor() {
6396
6766
  super(), this._stateManager = null, this.viewData = null, this.hours = Array.from({ length: 24 }, (e, t) => t), this._registryCheckInterval = null;
6397
6767
  }
@@ -6435,7 +6805,7 @@ class ee extends E {
6435
6805
  updateSelection(e, t) {
6436
6806
  const s = this.shadowRoot.querySelector(".day-column");
6437
6807
  if (!s) return;
6438
- ((r) => r && w.isSameDay(r, new Date(s.dataset.date)))(e) ? s.classList.add("selected") : s.classList.remove("selected");
6808
+ ((r) => r && x.isSameDay(r, new Date(s.dataset.date)))(e) ? s.classList.add("selected") : s.classList.remove("selected");
6439
6809
  }
6440
6810
  loadViewData() {
6441
6811
  if (!this.stateManager) return;
@@ -6443,15 +6813,15 @@ class ee extends E {
6443
6813
  this.viewData = this.processViewData(e), this.render();
6444
6814
  }
6445
6815
  processViewData(e) {
6446
- var a;
6816
+ var n;
6447
6817
  if (!e) return null;
6448
6818
  let t = null;
6449
- const s = (a = this.stateManager) == null ? void 0 : a.getState(), i = (s == null ? void 0 : s.currentDate) || /* @__PURE__ */ new Date();
6819
+ const s = (n = this.stateManager) == null ? void 0 : n.getState(), i = (s == null ? void 0 : s.currentDate) || /* @__PURE__ */ new Date();
6450
6820
  if (e.days && Array.isArray(e.days) && e.days.length > 0)
6451
- t = e.days.find((n) => w.isSameDay(new Date(n.date), i)) || e.days[0];
6821
+ t = e.days.find((a) => x.isSameDay(new Date(a.date), i)) || e.days[0];
6452
6822
  else if (e.weeks && Array.isArray(e.weeks) && e.weeks.length > 0) {
6453
- const n = e.weeks.flatMap((o) => o.days || []);
6454
- t = n.find((o) => w.isSameDay(new Date(o.date), i)) || n[0];
6823
+ const a = e.weeks.flatMap((o) => o.days || []);
6824
+ t = a.find((o) => x.isSameDay(new Date(o.date), i)) || a[0];
6455
6825
  } else e.date && (t = e);
6456
6826
  if (!t) return null;
6457
6827
  const r = new Date(t.date);
@@ -6460,9 +6830,9 @@ class ee extends E {
6460
6830
  day: {
6461
6831
  ...t,
6462
6832
  date: r,
6463
- isToday: w.isToday(r),
6464
- timedEvents: (t.events || []).filter((n) => !n.allDay),
6465
- allDayEvents: (t.events || []).filter((n) => n.allDay)
6833
+ isToday: x.isToday(r),
6834
+ timedEvents: (t.events || []).filter((a) => !a.allDay),
6835
+ allDayEvents: (t.events || []).filter((a) => a.allDay)
6466
6836
  }
6467
6837
  };
6468
6838
  }
@@ -6635,10 +7005,10 @@ class ee extends E {
6635
7005
  `;
6636
7006
  }
6637
7007
  template() {
6638
- var i, r, a;
7008
+ var i, r, n;
6639
7009
  if (!this.viewData || !this.viewData.day)
6640
7010
  return '<div class="day-view" style="padding: 20px; color: var(--fc-text-light);">No data available.</div>';
6641
- const { day: e } = this.viewData, t = ((a = (r = (i = this.stateManager) == null ? void 0 : i.state) == null ? void 0 : r.config) == null ? void 0 : a.locale) || "en-US", s = w.formatDate(e.date, "day", t).split(" ")[0];
7011
+ const { day: e } = this.viewData, t = ((n = (r = (i = this.stateManager) == null ? void 0 : i.state) == null ? void 0 : r.config) == null ? void 0 : n.locale) || "en-US", s = x.formatDate(e.date, "day", t).split(" ")[0];
6642
7012
  return `
6643
7013
  <div class="day-view">
6644
7014
  <div class="day-header">
@@ -6652,7 +7022,7 @@ class ee extends E {
6652
7022
  <div class="all-day-row">
6653
7023
  <div class="all-day-label">All day</div>
6654
7024
  <div class="all-day-cell">
6655
- ${e.allDayEvents.map((n) => this.renderAllDayEvent(n)).join("")}
7025
+ ${e.allDayEvents.map((a) => this.renderAllDayEvent(a)).join("")}
6656
7026
  </div>
6657
7027
  </div>
6658
7028
 
@@ -6662,29 +7032,29 @@ class ee extends E {
6662
7032
  </div>
6663
7033
 
6664
7034
  <div class="time-gutter">
6665
- ${this.hours.map((n) => `
7035
+ ${this.hours.map((a) => `
6666
7036
  <div class="time-slot-label">
6667
- ${n === 0 ? "" : w.formatTime((/* @__PURE__ */ new Date()).setHours(n, 0), !1)}
7037
+ ${a === 0 ? "" : x.formatTime((/* @__PURE__ */ new Date()).setHours(a, 0), !1)}
6668
7038
  </div>
6669
7039
  `).join("")}
6670
7040
  </div>
6671
7041
 
6672
7042
  <div class="day-column" data-date="${e.date.toISOString()}">
6673
7043
  ${e.isToday ? this.renderNowIndicator() : ""}
6674
- ${e.timedEvents.map((n) => this.renderTimedEvent(n)).join("")}
7044
+ ${e.timedEvents.map((a) => this.renderTimedEvent(a)).join("")}
6675
7045
  </div>
6676
7046
  </div>
6677
7047
  </div>
6678
7048
  `;
6679
7049
  }
6680
7050
  renderTimedEvent(e) {
6681
- const t = new Date(e.start), s = new Date(e.end), i = t.getHours() * 60 + t.getMinutes(), r = (s - t) / (1e3 * 60), a = i, n = Math.max(r, 30), o = v.sanitizeColor(e.backgroundColor), c = v.sanitizeColor(v.getContrastColor(o), "white");
7051
+ const t = new Date(e.start), s = new Date(e.end), i = t.getHours() * 60 + t.getMinutes(), r = (s - t) / (1e3 * 60), n = i, a = Math.max(r, 30), o = v.sanitizeColor(e.backgroundColor), c = v.sanitizeColor(v.getContrastColor(o), "white");
6682
7052
  return `
6683
7053
  <div class="event-container"
6684
- style="top: ${a}px; height: ${n}px; background-color: ${o}; color: ${c};"
7054
+ style="top: ${n}px; height: ${a}px; background-color: ${o}; color: ${c};"
6685
7055
  data-event-id="${e.id}">
6686
7056
  <span class="event-title">${C.escapeHTML(e.title)}</span>
6687
- <span class="event-time">${w.formatTime(t)} - ${w.formatTime(s)}</span>
7057
+ <span class="event-time">${x.formatTime(t)} - ${x.formatTime(s)}</span>
6688
7058
  </div>
6689
7059
  `;
6690
7060
  }
@@ -6707,21 +7077,21 @@ class ee extends E {
6707
7077
  e && !this._scrolled && (e.scrollTop = 8 * 60 - 50, this._scrolled = !0), this.$$("[data-event-id]").forEach((s) => {
6708
7078
  this.addListener(s, "click", (i) => {
6709
7079
  i.stopPropagation();
6710
- const r = i.currentTarget.dataset.eventId, a = this.stateManager.getEvents().find((n) => n.id === r);
6711
- a && this.emit("event-click", { event: a });
7080
+ const r = i.currentTarget.dataset.eventId, n = this.stateManager.getEvents().find((a) => a.id === r);
7081
+ n && this.emit("event-click", { event: n });
6712
7082
  });
6713
7083
  });
6714
7084
  const t = this.$(".day-column");
6715
7085
  t && this.addListener(t, "click", (s) => {
6716
- const i = s.currentTarget, r = this.$("#scroll-container"), a = i.getBoundingClientRect(), n = s.clientY - a.top + (r ? r.scrollTop : 0), o = new Date(i.dataset.date);
6717
- o.setHours(Math.floor(n / 60), Math.floor(n % 60), 0, 0), this.stateManager.selectDate(o), this.emit("day-click", { date: o });
7086
+ const i = s.currentTarget, r = this.$("#scroll-container"), n = i.getBoundingClientRect(), a = s.clientY - n.top + (r ? r.scrollTop : 0), o = new Date(i.dataset.date);
7087
+ o.setHours(Math.floor(a / 60), Math.floor(a % 60), 0, 0), this.stateManager.selectDate(o), this.emit("day-click", { date: o });
6718
7088
  });
6719
7089
  }
6720
7090
  unmount() {
6721
7091
  this.unsubscribe && this.unsubscribe();
6722
7092
  }
6723
7093
  }
6724
- class te extends E {
7094
+ class se extends $ {
6725
7095
  constructor() {
6726
7096
  super(), this._isVisible = !1, this._cleanupFocusTrap = null, this.config = {
6727
7097
  title: "New Event",
@@ -7017,18 +7387,18 @@ class te extends E {
7017
7387
  this.emit("save", e), this.close();
7018
7388
  }
7019
7389
  formatDateForInput(e) {
7020
- const t = (o) => String(o).padStart(2, "0"), s = e.getFullYear(), i = t(e.getMonth() + 1), r = t(e.getDate()), a = t(e.getHours()), n = t(e.getMinutes());
7021
- return `${s}-${i}-${r}T${a}:${n}`;
7390
+ const t = (o) => String(o).padStart(2, "0"), s = e.getFullYear(), i = t(e.getMonth() + 1), r = t(e.getDate()), n = t(e.getHours()), a = t(e.getMinutes());
7391
+ return `${s}-${i}-${r}T${n}:${a}`;
7022
7392
  }
7023
7393
  unmount() {
7024
7394
  this._cleanupFocusTrap && this._cleanupFocusTrap(), window.removeEventListener("keydown", this._handleKeyDown);
7025
7395
  }
7026
7396
  }
7027
- customElements.get("forcecal-event-form") || customElements.define("forcecal-event-form", te);
7028
- customElements.get("forcecal-month") || customElements.define("forcecal-month", J);
7029
- customElements.get("forcecal-week") || customElements.define("forcecal-week", X);
7030
- customElements.get("forcecal-day") || customElements.define("forcecal-day", ee);
7031
- class se extends E {
7397
+ customElements.get("forcecal-event-form") || customElements.define("forcecal-event-form", se);
7398
+ customElements.get("forcecal-month") || customElements.define("forcecal-month", X);
7399
+ customElements.get("forcecal-week") || customElements.define("forcecal-week", ee);
7400
+ customElements.get("forcecal-day") || customElements.define("forcecal-day", te);
7401
+ class ie extends $ {
7032
7402
  static get observedAttributes() {
7033
7403
  return ["view", "date", "locale", "timezone", "week-starts-on", "height"];
7034
7404
  }
@@ -7043,7 +7413,7 @@ class se extends E {
7043
7413
  timeZone: this.getAttribute("timezone") || Intl.DateTimeFormat().resolvedOptions().timeZone,
7044
7414
  weekStartsOn: parseInt(this.getAttribute("week-starts-on") || "0")
7045
7415
  };
7046
- this.stateManager = new Q(e), this.stateManager.subscribe(this.handleStateChange.bind(this)), this.setupEventListeners();
7416
+ this.stateManager = new J(e), this.stateManager.subscribe(this.handleStateChange.bind(this)), this.setupEventListeners();
7047
7417
  }
7048
7418
  setupEventListeners() {
7049
7419
  y.on("navigation:*", (e, t) => {
@@ -7464,7 +7834,7 @@ class se extends E {
7464
7834
  </div>
7465
7835
  </div>
7466
7836
  `;
7467
- const a = this.getTitle(t, s);
7837
+ const n = this.getTitle(t, s);
7468
7838
  return `
7469
7839
  <div class="force-calendar">
7470
7840
  <header class="fc-header">
@@ -7478,7 +7848,7 @@ class se extends E {
7478
7848
  <button class="fc-nav-arrow" data-action="previous" title="Previous">
7479
7849
  ${this.getIcon("chevron-left")}
7480
7850
  </button>
7481
- <h2 class="fc-title">${a}</h2>
7851
+ <h2 class="fc-title">${n}</h2>
7482
7852
  <button class="fc-nav-arrow" data-action="next" title="Next">
7483
7853
  ${this.getIcon("chevron-right")}
7484
7854
  </button>
@@ -7529,8 +7899,8 @@ class se extends E {
7529
7899
  this._currentViewInstance && (this._currentViewInstance.cleanup && this._currentViewInstance.cleanup(), this._viewUnsubscribe && (this._viewUnsubscribe(), this._viewUnsubscribe = null)), console.log("[ForceCalendar] Creating view for:", this.currentView);
7530
7900
  try {
7531
7901
  const i = this._createViewRenderer(this.currentView);
7532
- i && (i._viewType = this.currentView, this._currentViewInstance = i, i.stateManager = this.stateManager, i.container = e, console.log("[ForceCalendar] Calling viewRenderer.render()"), i.render(), console.log("[ForceCalendar] viewRenderer.render() completed"), this._viewUnsubscribe = this.stateManager.subscribe((r, a) => {
7533
- (r.events !== (a == null ? void 0 : a.events) || r.currentDate !== (a == null ? void 0 : a.currentDate)) && i && i.render && i.render();
7902
+ i && (i._viewType = this.currentView, this._currentViewInstance = i, i.stateManager = this.stateManager, i.container = e, console.log("[ForceCalendar] Calling viewRenderer.render()"), i.render(), console.log("[ForceCalendar] viewRenderer.render() completed"), this._viewUnsubscribe = this.stateManager.subscribe((r, n) => {
7903
+ (r.events !== (n == null ? void 0 : n.events) || r.currentDate !== (n == null ? void 0 : n.currentDate)) && i && i.render && i.render();
7534
7904
  }));
7535
7905
  } catch (i) {
7536
7906
  console.error("[ForceCalendar] Error creating/rendering view:", i);
@@ -7547,9 +7917,9 @@ class se extends E {
7547
7917
  }), this.addListener(this.shadowRoot, "day-click", (i) => {
7548
7918
  t && t.open(i.detail.date);
7549
7919
  }), t && this.addListener(t, "save", (i) => {
7550
- const r = i.detail, a = window.crypto && typeof window.crypto.randomUUID == "function" ? window.crypto.randomUUID() : Math.random().toString(36).substring(2, 15);
7920
+ const r = i.detail, n = window.crypto && typeof window.crypto.randomUUID == "function" ? window.crypto.randomUUID() : Math.random().toString(36).substring(2, 15);
7551
7921
  this.stateManager.addEvent({
7552
- id: a,
7922
+ id: n,
7553
7923
  ...r
7554
7924
  });
7555
7925
  });
@@ -7598,48 +7968,48 @@ class se extends E {
7598
7968
  this.container.innerHTML = r, this._attachEventHandlers(t);
7599
7969
  },
7600
7970
  _renderMonthView(s, i) {
7601
- const r = i.weekStartsOn || 0, a = [];
7971
+ const r = i.weekStartsOn || 0, n = [];
7602
7972
  for (let o = 0; o < 7; o++) {
7603
7973
  const c = (r + o) % 7;
7604
- a.push(["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"][c]);
7974
+ n.push(["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"][c]);
7605
7975
  }
7606
- let n = `
7976
+ let a = `
7607
7977
  <div class="fc-month-view" style="display: flex; flex-direction: column; height: 100%; min-height: 400px; background: #fff; border: 1px solid #e5e7eb;">
7608
7978
  <div class="fc-month-header" style="display: grid; grid-template-columns: repeat(7, 1fr); border-bottom: 1px solid #e5e7eb; background: #f9fafb;">
7609
- ${a.map((o) => `<div class="fc-month-header-cell" style="padding: 12px 8px; text-align: center; font-size: 11px; font-weight: 600; color: #6b7280; text-transform: uppercase;">${o}</div>`).join("")}
7979
+ ${n.map((o) => `<div class="fc-month-header-cell" style="padding: 12px 8px; text-align: center; font-size: 11px; font-weight: 600; color: #6b7280; text-transform: uppercase;">${o}</div>`).join("")}
7610
7980
  </div>
7611
7981
  <div class="fc-month-body" style="display: flex; flex-direction: column; flex: 1;">
7612
7982
  `;
7613
7983
  return s.weeks.forEach((o) => {
7614
- n += '<div class="fc-month-week" style="display: grid; grid-template-columns: repeat(7, 1fr); flex: 1; min-height: 80px;">', o.days.forEach((c) => {
7615
- const l = !c.isCurrentMonth, d = c.isToday, h = l ? "#f3f4f6" : "#fff", g = l ? "#9ca3af" : "#111827", b = d ? "background: #2563eb; color: white; border-radius: 50%; width: 24px; height: 24px; display: flex; align-items: center; justify-content: center;" : "", f = c.events || [], D = f.slice(0, 3), x = f.length - 3;
7616
- n += `
7984
+ a += '<div class="fc-month-week" style="display: grid; grid-template-columns: repeat(7, 1fr); flex: 1; min-height: 80px;">', o.days.forEach((c) => {
7985
+ const l = !c.isCurrentMonth, d = c.isToday, h = l ? "#f3f4f6" : "#fff", g = l ? "#9ca3af" : "#111827", w = d ? "background: #2563eb; color: white; border-radius: 50%; width: 24px; height: 24px; display: flex; align-items: center; justify-content: center;" : "", f = c.events || [], k = f.slice(0, 3), b = f.length - 3;
7986
+ a += `
7617
7987
  <div class="fc-month-day" data-date="${c.date}" style="background: ${h}; border-right: 1px solid #e5e7eb; border-bottom: 1px solid #e5e7eb; padding: 4px; min-height: 80px; cursor: pointer;">
7618
- <div class="fc-day-number" style="font-size: 13px; font-weight: 500; color: ${g}; padding: 2px 4px; margin-bottom: 4px; ${b}">${c.dayOfMonth}</div>
7988
+ <div class="fc-day-number" style="font-size: 13px; font-weight: 500; color: ${g}; padding: 2px 4px; margin-bottom: 4px; ${w}">${c.dayOfMonth}</div>
7619
7989
  <div class="fc-day-events" style="display: flex; flex-direction: column; gap: 2px;">
7620
- ${D.map((M) => `
7990
+ ${k.map((M) => `
7621
7991
  <div class="fc-event" data-event-id="${M.id}" style="background-color: ${M.backgroundColor || "#2563eb"}; font-size: 11px; padding: 2px 6px; border-radius: 3px; color: white; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer;">
7622
7992
  ${M.title}
7623
7993
  </div>
7624
7994
  `).join("")}
7625
- ${x > 0 ? `<div class="fc-more-events" style="font-size: 10px; color: #6b7280; padding: 2px 4px; font-weight: 500;">+${x} more</div>` : ""}
7995
+ ${b > 0 ? `<div class="fc-more-events" style="font-size: 10px; color: #6b7280; padding: 2px 4px; font-weight: 500;">+${b} more</div>` : ""}
7626
7996
  </div>
7627
7997
  </div>
7628
7998
  `;
7629
- }), n += "</div>";
7630
- }), n += "</div></div>", n;
7999
+ }), a += "</div>";
8000
+ }), a += "</div></div>", a;
7631
8001
  },
7632
8002
  _renderWeekView(s, i) {
7633
8003
  const r = s.days || [];
7634
8004
  if (r.length === 0)
7635
8005
  return '<div style="padding: 20px; text-align: center; color: #666;">No data available for week view.</div>';
7636
8006
  i.weekStartsOn;
7637
- const a = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], n = Array.from({ length: 24 }, (l, d) => d), o = r.map((l) => {
8007
+ const n = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], a = Array.from({ length: 24 }, (l, d) => d), o = r.map((l) => {
7638
8008
  const d = new Date(l.date), h = l.events || [];
7639
8009
  return {
7640
8010
  ...l,
7641
8011
  date: d,
7642
- dayName: a[d.getDay()],
8012
+ dayName: n[d.getDay()],
7643
8013
  dayOfMonth: d.getDate(),
7644
8014
  isToday: this._isToday(d),
7645
8015
  timedEvents: h.filter((g) => !g.allDay),
@@ -7678,7 +8048,7 @@ class se extends E {
7678
8048
  <div style="display: grid; grid-template-columns: 60px repeat(7, 1fr); position: relative; height: 1440px;">
7679
8049
  <!-- Time Gutter -->
7680
8050
  <div style="border-right: 1px solid #e5e7eb; background: #fafafa;">
7681
- ${n.map((l) => `
8051
+ ${a.map((l) => `
7682
8052
  <div style="height: 60px; font-size: 10px; color: #6b7280; text-align: right; padding-right: 8px; font-weight: 500;">
7683
8053
  ${l === 0 ? "" : this._formatHour(l)}
7684
8054
  </div>
@@ -7689,7 +8059,7 @@ class se extends E {
7689
8059
  ${o.map((l) => `
7690
8060
  <div class="fc-week-day-column" data-date="${l.date.toISOString()}" style="border-right: 1px solid #e5e7eb; position: relative; cursor: pointer;">
7691
8061
  <!-- Hour grid lines -->
7692
- ${n.map(() => '<div style="height: 60px; border-bottom: 1px solid #f3f4f6;"></div>').join("")}
8062
+ ${a.map(() => '<div style="height: 60px; border-bottom: 1px solid #f3f4f6;"></div>').join("")}
7693
8063
 
7694
8064
  <!-- Now indicator for today -->
7695
8065
  ${l.isToday ? this._renderNowIndicator() : ""}
@@ -7704,35 +8074,35 @@ class se extends E {
7704
8074
  `;
7705
8075
  },
7706
8076
  _renderDayView(s, i) {
7707
- var g, b;
7708
- const r = ((b = (g = this.stateManager) == null ? void 0 : g.getState()) == null ? void 0 : b.currentDate) || /* @__PURE__ */ new Date();
7709
- let a, n, o, c, l;
8077
+ var g, w;
8078
+ const r = ((w = (g = this.stateManager) == null ? void 0 : g.getState()) == null ? void 0 : w.currentDate) || /* @__PURE__ */ new Date();
8079
+ let n, a, o, c, l;
7710
8080
  if (s.type === "day" && s.date)
7711
- if (a = new Date(s.date), n = s.dayName || ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"][a.getDay()], o = s.isToday !== void 0 ? s.isToday : this._isToday(a), c = s.allDayEvents || [], s.hours && Array.isArray(s.hours)) {
8081
+ if (n = new Date(s.date), a = s.dayName || ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"][n.getDay()], o = s.isToday !== void 0 ? s.isToday : this._isToday(n), c = s.allDayEvents || [], s.hours && Array.isArray(s.hours)) {
7712
8082
  const f = /* @__PURE__ */ new Map();
7713
- s.hours.forEach((D) => {
7714
- (D.events || []).forEach((x) => {
7715
- f.has(x.id) || f.set(x.id, x);
8083
+ s.hours.forEach((k) => {
8084
+ (k.events || []).forEach((b) => {
8085
+ f.has(b.id) || f.set(b.id, b);
7716
8086
  });
7717
8087
  }), l = Array.from(f.values());
7718
8088
  } else
7719
8089
  l = [];
7720
8090
  else if (s.days && s.days.length > 0) {
7721
- const f = s.days.find((x) => this._isSameDay(new Date(x.date), r)) || s.days[0];
7722
- a = new Date(f.date), n = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"][a.getDay()], o = this._isToday(a);
7723
- const D = f.events || [];
7724
- c = D.filter((x) => x.allDay), l = D.filter((x) => !x.allDay);
8091
+ const f = s.days.find((b) => this._isSameDay(new Date(b.date), r)) || s.days[0];
8092
+ n = new Date(f.date), a = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"][n.getDay()], o = this._isToday(n);
8093
+ const k = f.events || [];
8094
+ c = k.filter((b) => b.allDay), l = k.filter((b) => !b.allDay);
7725
8095
  } else
7726
8096
  return '<div style="padding: 20px; text-align: center; color: #666;">No data available for day view.</div>';
7727
- const d = Array.from({ length: 24 }, (f, D) => D);
8097
+ const d = Array.from({ length: 24 }, (f, k) => k);
7728
8098
  return `
7729
8099
  <div class="fc-day-view" style="display: flex; flex-direction: column; height: 100%; background: #fff; overflow: hidden;">
7730
8100
  <!-- Header -->
7731
8101
  <div style="display: grid; grid-template-columns: 60px 1fr; border-bottom: 1px solid #e5e7eb; background: #f9fafb; flex-shrink: 0;">
7732
8102
  <div style="border-right: 1px solid #e5e7eb;"></div>
7733
8103
  <div style="padding: 16px 24px;">
7734
- <div style="font-size: 12px; font-weight: 700; color: #6b7280; text-transform: uppercase; letter-spacing: 0.1em;">${n}</div>
7735
- <div style="font-size: 24px; font-weight: 600; margin-top: 4px; ${o ? "color: #dc2626;" : "color: #111827;"}">${a.getDate()}</div>
8104
+ <div style="font-size: 12px; font-weight: 700; color: #6b7280; text-transform: uppercase; letter-spacing: 0.1em;">${a}</div>
8105
+ <div style="font-size: 24px; font-weight: 600; margin-top: 4px; ${o ? "color: #dc2626;" : "color: #111827;"}">${n.getDate()}</div>
7736
8106
  </div>
7737
8107
  </div>
7738
8108
 
@@ -7761,7 +8131,7 @@ class se extends E {
7761
8131
  </div>
7762
8132
 
7763
8133
  <!-- Day Column -->
7764
- <div class="fc-day-column" data-date="${a.toISOString()}" style="position: relative; cursor: pointer;">
8134
+ <div class="fc-day-column" data-date="${n.toISOString()}" style="position: relative; cursor: pointer;">
7765
8135
  <!-- Hour grid lines -->
7766
8136
  ${d.map(() => '<div style="height: 60px; border-bottom: 1px solid #f3f4f6;"></div>').join("")}
7767
8137
 
@@ -7777,10 +8147,10 @@ class se extends E {
7777
8147
  `;
7778
8148
  },
7779
8149
  _renderTimedEvent(s) {
7780
- const i = new Date(s.start), r = new Date(s.end), a = i.getHours() * 60 + i.getMinutes(), n = Math.max((r - i) / (1e3 * 60), 20), o = s.backgroundColor || "#2563eb";
8150
+ const i = new Date(s.start), r = new Date(s.end), n = i.getHours() * 60 + i.getMinutes(), a = Math.max((r - i) / (1e3 * 60), 20), o = s.backgroundColor || "#2563eb";
7781
8151
  return `
7782
8152
  <div class="fc-event" data-event-id="${s.id}"
7783
- style="position: absolute; top: ${a}px; height: ${n}px; left: 2px; right: 2px;
8153
+ style="position: absolute; top: ${n}px; height: ${a}px; left: 2px; right: 2px;
7784
8154
  background-color: ${o}; border-radius: 4px; padding: 4px 8px; font-size: 11px;
7785
8155
  font-weight: 500; color: white; overflow: hidden; box-shadow: 0 1px 2px rgba(0,0,0,0.1);
7786
8156
  cursor: pointer; z-index: 5;">
@@ -7790,10 +8160,10 @@ class se extends E {
7790
8160
  `;
7791
8161
  },
7792
8162
  _renderTimedEventDay(s) {
7793
- const i = new Date(s.start), r = new Date(s.end), a = i.getHours() * 60 + i.getMinutes(), n = Math.max((r - i) / (1e3 * 60), 30), o = s.backgroundColor || "#2563eb";
8163
+ const i = new Date(s.start), r = new Date(s.end), n = i.getHours() * 60 + i.getMinutes(), a = Math.max((r - i) / (1e3 * 60), 30), o = s.backgroundColor || "#2563eb";
7794
8164
  return `
7795
8165
  <div class="fc-event" data-event-id="${s.id}"
7796
- style="position: absolute; top: ${a}px; height: ${n}px; left: 12px; right: 24px;
8166
+ style="position: absolute; top: ${n}px; height: ${a}px; left: 12px; right: 24px;
7797
8167
  background-color: ${o}; border-radius: 6px; padding: 8px 12px; font-size: 13px;
7798
8168
  font-weight: 500; color: white; overflow: hidden; box-shadow: 0 2px 4px rgba(0,0,0,0.1);
7799
8169
  cursor: pointer; z-index: 5;">
@@ -7811,8 +8181,8 @@ class se extends E {
7811
8181
  return `${s % 12 || 12} ${i}`;
7812
8182
  },
7813
8183
  _formatTime(s) {
7814
- const i = s.getHours(), r = s.getMinutes(), a = i >= 12 ? "PM" : "AM", n = i % 12 || 12;
7815
- return r === 0 ? `${n} ${a}` : `${n}:${r.toString().padStart(2, "0")} ${a}`;
8184
+ const i = s.getHours(), r = s.getMinutes(), n = i >= 12 ? "PM" : "AM", a = i % 12 || 12;
8185
+ return r === 0 ? `${a} ${n}` : `${a}:${r.toString().padStart(2, "0")} ${n}`;
7816
8186
  },
7817
8187
  _isToday(s) {
7818
8188
  const i = /* @__PURE__ */ new Date();
@@ -7824,31 +8194,31 @@ class se extends E {
7824
8194
  _attachEventHandlers(s) {
7825
8195
  const i = this.stateManager;
7826
8196
  if (this.container.querySelectorAll(".fc-month-day").forEach((r) => {
7827
- this.addListener(r, "click", (a) => {
7828
- const n = new Date(r.dataset.date);
7829
- i.selectDate(n);
8197
+ this.addListener(r, "click", (n) => {
8198
+ const a = new Date(r.dataset.date);
8199
+ i.selectDate(a);
7830
8200
  });
7831
8201
  }), this.container.querySelectorAll(".fc-week-day-column").forEach((r) => {
7832
- this.addListener(r, "click", (a) => {
7833
- if (a.target.closest(".fc-event")) return;
7834
- const n = new Date(r.dataset.date), o = r.getBoundingClientRect(), c = this.container.querySelector("#week-scroll-container"), l = a.clientY - o.top + (c ? c.scrollTop : 0);
7835
- n.setHours(Math.floor(l / 60), Math.floor(l % 60), 0, 0), i.selectDate(n);
8202
+ this.addListener(r, "click", (n) => {
8203
+ if (n.target.closest(".fc-event")) return;
8204
+ const a = new Date(r.dataset.date), o = r.getBoundingClientRect(), c = this.container.querySelector("#week-scroll-container"), l = n.clientY - o.top + (c ? c.scrollTop : 0);
8205
+ a.setHours(Math.floor(l / 60), Math.floor(l % 60), 0, 0), i.selectDate(a);
7836
8206
  });
7837
8207
  }), this.container.querySelectorAll(".fc-day-column").forEach((r) => {
7838
- this.addListener(r, "click", (a) => {
7839
- if (a.target.closest(".fc-event")) return;
7840
- const n = new Date(r.dataset.date), o = r.getBoundingClientRect(), c = this.container.querySelector("#day-scroll-container"), l = a.clientY - o.top + (c ? c.scrollTop : 0);
7841
- n.setHours(Math.floor(l / 60), Math.floor(l % 60), 0, 0), i.selectDate(n);
8208
+ this.addListener(r, "click", (n) => {
8209
+ if (n.target.closest(".fc-event")) return;
8210
+ const a = new Date(r.dataset.date), o = r.getBoundingClientRect(), c = this.container.querySelector("#day-scroll-container"), l = n.clientY - o.top + (c ? c.scrollTop : 0);
8211
+ a.setHours(Math.floor(l / 60), Math.floor(l % 60), 0, 0), i.selectDate(a);
7842
8212
  });
7843
8213
  }), this.container.querySelectorAll(".fc-event").forEach((r) => {
7844
- this.addListener(r, "click", (a) => {
7845
- a.stopPropagation();
7846
- const n = r.dataset.eventId, o = i.getEvents().find((c) => c.id === n);
8214
+ this.addListener(r, "click", (n) => {
8215
+ n.stopPropagation();
8216
+ const a = r.dataset.eventId, o = i.getEvents().find((c) => c.id === a);
7847
8217
  o && i.selectEvent(o);
7848
8218
  });
7849
8219
  }), s === "week" || s === "day") {
7850
- const r = s === "week" ? "#week-scroll-container" : "#day-scroll-container", a = this.container.querySelector(r);
7851
- a && !this._scrolled && (a.scrollTop = 8 * 60 - 50, this._scrolled = !0);
8220
+ const r = s === "week" ? "#week-scroll-container" : "#day-scroll-container", n = this.container.querySelector(r);
8221
+ n && !this._scrolled && (n.scrollTop = 8 * 60 - 50, this._scrolled = !0);
7852
8222
  }
7853
8223
  }
7854
8224
  };
@@ -7874,14 +8244,14 @@ class se extends E {
7874
8244
  const s = this.stateManager.state.config.locale;
7875
8245
  switch (t) {
7876
8246
  case "month":
7877
- return w.formatDate(e, "month", s);
8247
+ return x.formatDate(e, "month", s);
7878
8248
  case "week":
7879
- const i = w.startOfWeek(e), r = w.endOfWeek(e);
7880
- return w.formatDateRange(i, r, s);
8249
+ const i = x.startOfWeek(e), r = x.endOfWeek(e);
8250
+ return x.formatDateRange(i, r, s);
7881
8251
  case "day":
7882
- return w.formatDate(e, "long", s);
8252
+ return x.formatDate(e, "long", s);
7883
8253
  default:
7884
- return w.formatDate(e, "month", s);
8254
+ return x.formatDate(e, "month", s);
7885
8255
  }
7886
8256
  }
7887
8257
  getIcon(e) {
@@ -7935,19 +8305,19 @@ class se extends E {
7935
8305
  this.stateManager && this.stateManager.destroy(), y.clear(), super.cleanup();
7936
8306
  }
7937
8307
  }
7938
- customElements.get("forcecal-main") || customElements.define("forcecal-main", se);
8308
+ customElements.get("forcecal-main") || customElements.define("forcecal-main", ie);
7939
8309
  typeof window < "u" && typeof customElements < "u" && console.log("Force Calendar Interface loading...");
7940
8310
  export {
7941
- E as BaseComponent,
8311
+ $ as BaseComponent,
7942
8312
  C as DOMUtils,
7943
- w as DateUtils,
7944
- ee as DayView,
7945
- G as EventBus,
7946
- se as ForceCalendar,
7947
- J as MonthView,
7948
- Q as StateManager,
8313
+ x as DateUtils,
8314
+ te as DayView,
8315
+ Q as EventBus,
8316
+ ie as ForceCalendar,
8317
+ X as MonthView,
8318
+ J as StateManager,
7949
8319
  v as StyleUtils,
7950
- X as WeekView,
8320
+ ee as WeekView,
7951
8321
  y as eventBus
7952
8322
  };
7953
8323
  //# sourceMappingURL=force-calendar-interface.esm.js.map