@luckydye/calendar 1.2.2 → 1.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/calendar.js +198 -210
  2. package/package.json +1 -1
package/dist/calendar.js CHANGED
@@ -1613,8 +1613,8 @@ function ds(n, t) {
1613
1613
  if (F(t.byweekno, -1))
1614
1614
  C = -1;
1615
1615
  else {
1616
- var H = Gt(Wt(n - 1, 1, 1)), M = lt(7 - H.valueOf() + t.wkst, 7), x = oe(n - 1) ? 366 : 365, $ = void 0;
1617
- M >= 4 ? (M = 0, $ = x + lt(H - t.wkst, 7)) : $ = i - d, C = Math.floor(52 + lt($, 7) / 4);
1616
+ var H = Gt(Wt(n - 1, 1, 1)), M = lt(7 - H.valueOf() + t.wkst, 7), E = oe(n - 1) ? 366 : 365, $ = void 0;
1617
+ M >= 4 ? (M = 0, $ = E + lt(H - t.wkst, 7)) : $ = i - d, C = Math.floor(52 + lt($, 7) / 4);
1618
1618
  }
1619
1619
  if (F(t.byweekno, C))
1620
1620
  for (var p = 0; p < d; p++)
@@ -1839,8 +1839,8 @@ function nn(n, t) {
1839
1839
  for (var y = f; y < v; y++) {
1840
1840
  var M = u[y];
1841
1841
  if (V(M))
1842
- for (var x = Ji(c.yearordinal + M), $ = 0; $ < d.length; $++) {
1843
- var w = d[$], C = Qi(x, w);
1842
+ for (var E = Ji(c.yearordinal + M), $ = 0; $ < d.length; $++) {
1843
+ var w = d[$], C = Qi(E, w);
1844
1844
  if (r && C > r)
1845
1845
  return xt(n);
1846
1846
  if (C >= e) {
@@ -2236,9 +2236,9 @@ const As = [
2236
2236
  { label: "2 hours before", value: 120 },
2237
2237
  { label: "1 day before", value: 1440 }
2238
2238
  ], Os = 12, _s = 12, Hs = 96;
2239
- class U {
2239
+ class N {
2240
2240
  constructor(t) {
2241
- this.startDate = /* @__PURE__ */ new Date(), this.endDate = U.addDays(/* @__PURE__ */ new Date(), 182), this.weekStart = 0, this.filter = "", this.calendarEvents = /* @__PURE__ */ new Map(), this.selectedEvents = /* @__PURE__ */ new Set(), this.enabledCalendars = /* @__PURE__ */ new Set(), this.lockedCalendars = /* @__PURE__ */ new Set(), this.sync = (i, s, r) => {
2241
+ this.startDate = /* @__PURE__ */ new Date(), this.endDate = N.addDays(/* @__PURE__ */ new Date(), 182), this.weekStart = 0, this.filter = "", this.calendarEvents = /* @__PURE__ */ new Map(), this.selectedEvents = /* @__PURE__ */ new Set(), this.enabledCalendars = /* @__PURE__ */ new Set(), this.lockedCalendars = /* @__PURE__ */ new Set(), this.sync = (i, s, r) => {
2242
2242
  const o = [];
2243
2243
  for (const l of r) {
2244
2244
  const c = {
@@ -2254,7 +2254,7 @@ class U {
2254
2254
  return this.storage?.sync(o, a).catch((l) => {
2255
2255
  console.error("Failed to persist events:", l);
2256
2256
  }), o;
2257
- }, this.locale = t?.locale || navigator.language, this.weekStart = t?.weekStart || U.getWeekStartFromLocale(this.locale), this.startDate = this.getStartOfWeek(U.addDays(/* @__PURE__ */ new Date(), -182));
2257
+ }, this.locale = t?.locale || navigator.language, this.weekStart = t?.weekStart || N.getWeekStartFromLocale(this.locale), this.startDate = this.getStartOfWeek(N.addDays(/* @__PURE__ */ new Date(), -182));
2258
2258
  const e = {
2259
2259
  start: (i) => {
2260
2260
  this.controller = i;
@@ -2421,10 +2421,10 @@ RRULE:${t.rrule}`, h = Fe(d), u = /* @__PURE__ */ new Date();
2421
2421
  for (; s < e; ) {
2422
2422
  const r = [];
2423
2423
  for (let l = 0; l < 7; l++)
2424
- r.push(new Date(s)), s = U.addDays(s, 1);
2424
+ r.push(new Date(s)), s = N.addDays(s, 1);
2425
2425
  const o = r[0], a = r[3];
2426
2426
  o && a && i.push({
2427
- weekNumber: U.getWeekNumber(o),
2427
+ weekNumber: N.getWeekNumber(o),
2428
2428
  year: a.getFullYear(),
2429
2429
  // Use Thursday for year
2430
2430
  days: r,
@@ -2438,15 +2438,15 @@ RRULE:${t.rrule}`, h = Fe(d), u = /* @__PURE__ */ new Date();
2438
2438
  extendRange(t) {
2439
2439
  const e = _s, i = [];
2440
2440
  if (t === "past") {
2441
- const s = U.addDays(this.startDate, -e * 7);
2441
+ const s = N.addDays(this.startDate, -e * 7);
2442
2442
  let r = new Date(s);
2443
2443
  for (; r < this.startDate; ) {
2444
2444
  const o = [];
2445
2445
  for (let c = 0; c < 7; c++)
2446
- o.push(new Date(r)), r = U.addDays(r, 1);
2446
+ o.push(new Date(r)), r = N.addDays(r, 1);
2447
2447
  const a = o[0], l = o[3];
2448
2448
  a && l && i.push({
2449
- weekNumber: U.getWeekNumber(a),
2449
+ weekNumber: N.getWeekNumber(a),
2450
2450
  year: l.getFullYear(),
2451
2451
  days: o,
2452
2452
  yOffset: 0,
@@ -2455,15 +2455,15 @@ RRULE:${t.rrule}`, h = Fe(d), u = /* @__PURE__ */ new Date();
2455
2455
  }
2456
2456
  this.startDate = s;
2457
2457
  } else {
2458
- const s = U.addDays(this.endDate, e * 7);
2458
+ const s = N.addDays(this.endDate, e * 7);
2459
2459
  let r = new Date(this.endDate);
2460
2460
  for (; r < s; ) {
2461
2461
  const o = [];
2462
2462
  for (let c = 0; c < 7; c++)
2463
- o.push(new Date(r)), r = U.addDays(r, 1);
2463
+ o.push(new Date(r)), r = N.addDays(r, 1);
2464
2464
  const a = o[0], l = o[3];
2465
2465
  a && l && i.push({
2466
- weekNumber: U.getWeekNumber(a),
2466
+ weekNumber: N.getWeekNumber(a),
2467
2467
  year: l.getFullYear(),
2468
2468
  days: o,
2469
2469
  yOffset: 0,
@@ -2481,12 +2481,12 @@ RRULE:${t.rrule}`, h = Fe(d), u = /* @__PURE__ */ new Date();
2481
2481
  return Hs;
2482
2482
  }
2483
2483
  trimRange(t, e) {
2484
- t === "past" ? this.startDate = U.addDays(this.startDate, -e * 7) : this.endDate = U.addDays(this.endDate, -e * 7);
2484
+ t === "past" ? this.startDate = N.addDays(this.startDate, -e * 7) : this.endDate = N.addDays(this.endDate, -e * 7);
2485
2485
  }
2486
2486
  // Resets the range to be centered around the target date
2487
2487
  resetRangeAroundDate(t) {
2488
2488
  const e = new Date(t);
2489
- return e.setHours(0, 0, 0, 0), this.startDate = this.getStartOfWeek(U.addDays(e, -182)), this.endDate = U.addDays(e, 182), this.generateWeeks();
2489
+ return e.setHours(0, 0, 0, 0), this.startDate = this.getStartOfWeek(N.addDays(e, -182)), this.endDate = N.addDays(e, 182), this.generateWeeks();
2490
2490
  }
2491
2491
  getWeekdayNames() {
2492
2492
  const t = new Intl.DateTimeFormat(this.locale, { weekday: "short" }), e = [];
@@ -2521,7 +2521,7 @@ RRULE:${t.rrule}`, h = Fe(d), u = /* @__PURE__ */ new Date();
2521
2521
  }
2522
2522
  // Returns timestamp for end of day using pure math (no Date object creation)
2523
2523
  static endOfDayTime(t) {
2524
- return t ? U.startOfDayTime(t) + 864e5 - 1 : 0;
2524
+ return t ? N.startOfDayTime(t) + 864e5 - 1 : 0;
2525
2525
  }
2526
2526
  static getWeekStartFromLocale(t) {
2527
2527
  const e = ["en-US", "en-CA", "ja-JP", "ko-KR", "zh-TW"], i = t.split("-")[0];
@@ -3012,15 +3012,15 @@ const Nt = 100, me = 3e3, z = 60, Yi = 12, ye = 20, ni = class ni extends Kt {
3012
3012
  super(), this._dayHeight = Nt, this._scrollTop = 0, this.viewportHeight = 0, this.currentTime = /* @__PURE__ */ new Date(), this.selection = null, this.canvas = null, this.ctx = null, this.overlayCanvas = null, this.overlayCtx = null, this.minimapBufferCanvas = null, this.minimapBufferCtx = null, this.stripePatternCanvas = null, this.scrollContainer = null, this.scrollContent = null, this.resizeObserver = null, this.totalHeight = 0, this.isDraggingZoom = !1, this.zoomDragStartY = 0, this.zoomDragStartHeight = 0, this.zoomOriginY = 0, this.zoomViewportY = 0, this.isPanning = !1, this.panStartX = 0, this.panStartY = 0, this.panStartScrollTop = 0, this.isSelecting = !1, this.selectionStartX = 0, this.selectionStartY = 0, this.potentialSelectionStart = null, this.selectionModifierKey = !1, this.cursorPosition = null, this.animationFrame = null, this.isDraggingMinimap = !1, this.isFiltered = !1, this.timeUpdateInterval = null, this.isExtendingRange = !1, this.isCreatingEvent = !1, this.eventCreationStart = null, this.eventCreationEnd = null, this.eventCreationShiftPressed = !1, this.eventCreationPreviousShiftPressed = !1, this.eventCreationInitialDuration = null, this.movingEvent = null, this.movingEventOrigin = null, this.movingEventEnd = null, this.isDraggingEvent = !1, this.movingEventDuplicateMode = !1, this.movingEventMouseEvent = null, this.isDraggingFile = !1, this.resizingEvent = null, this.resizingEdge = null, this.resizingOriginalStart = null, this.resizingOriginalEnd = null, this.isResizingEvent = !1, this._columnsPerRow = 7, this.historyStack = [], this.historyIndex = 0, this.saveHistoryTimeout = null, this.weeks = [], this.events = [], this.eventRects = [], this.hoveredEventId = null, this.selectedEventForDetail = null, this.selectedEventRect = null, this.isDescriptionExpanded = !1, this.notificationPopoverOpen = !1, this.scheduledNotifications = [], this.updateEventTimeout = null, this.currentUserEmails = /* @__PURE__ */ new Set(), this.currentTheme = Ls(), this.activeCalendarColor = null, this.scrollToToday = (t = !0) => {
3013
3013
  const e = /* @__PURE__ */ new Date();
3014
3014
  let i = this.weeks.findIndex(
3015
- (r) => r.days.some((o) => U.isSameDay(o, e))
3015
+ (r) => r.days.some((o) => N.isSameDay(o, e))
3016
3016
  );
3017
3017
  i < 0 && (this.weeks = this.internal.resetRangeAroundDate(e), i = this.weeks.findIndex(
3018
- (r) => r.days.some((o) => U.isSameDay(o, e))
3018
+ (r) => r.days.some((o) => N.isSameDay(o, e))
3019
3019
  ));
3020
3020
  let s = 0.5;
3021
3021
  if (i >= 0) {
3022
3022
  const o = this.weeks[i].days.findIndex(
3023
- (a) => U.isSameDay(a, e)
3023
+ (a) => N.isSameDay(a, e)
3024
3024
  );
3025
3025
  if (o >= 0) {
3026
3026
  const a = Math.floor(o / this._columnsPerRow), l = (e.getHours() + e.getMinutes() / 60) / 24;
@@ -3257,7 +3257,7 @@ const Nt = 100, me = 3e3, z = 60, Yi = 12, ye = 20, ni = class ni extends Kt {
3257
3257
  if (a && l) {
3258
3258
  const c = l.getTime() - a.getTime(), d = (f) => {
3259
3259
  const v = f.getMinutes();
3260
- return f.setMinutes(Math.floor(v / 15) * 15, 0, 0), f;
3260
+ return f.setMinutes(Math.round(v / 15) * 15, 0, 0), f;
3261
3261
  }, h = d(
3262
3262
  new Date(this.movingEvent.start.getTime() + c)
3263
3263
  ), u = d(
@@ -3355,7 +3355,7 @@ const Nt = 100, me = 3e3, z = 60, Yi = 12, ye = 20, ni = class ni extends Kt {
3355
3355
  }
3356
3356
  const o = this.scrollContainer.clientHeight / 2, a = this.scrollTop + o, l = i / s, d = a * l - o;
3357
3357
  this.setView(i, d);
3358
- }, this.minimapCanvas = document.createElement("canvas"), this.internal = new U({
3358
+ }, this.minimapCanvas = document.createElement("canvas"), this.internal = new N({
3359
3359
  locale: this.getAttribute("locale") || void 0,
3360
3360
  weekStart: Number(this.getAttribute("week-start")),
3361
3361
  storage: new zs()
@@ -3476,10 +3476,10 @@ const Nt = 100, me = 3e3, z = 60, Yi = 12, ye = 20, ni = class ni extends Kt {
3476
3476
  scrollToDate(t, e = 0.5, i = !1, s = !1, r) {
3477
3477
  const o = r ?? this._dayHeight;
3478
3478
  let a = this.weeks.findIndex(
3479
- (l) => l.days.some((c) => U.isSameDay(c, t)) || l.days[0] && l.days[6] && l.days[0] <= t && t <= l.days[6]
3479
+ (l) => l.days.some((c) => N.isSameDay(c, t)) || l.days[0] && l.days[6] && l.days[0] <= t && t <= l.days[6]
3480
3480
  );
3481
3481
  if (a < 0 && s && (this.weeks = this.internal.resetRangeAroundDate(t), a = this.weeks.findIndex(
3482
- (l) => l.days.some((c) => U.isSameDay(c, t)) || l.days[0] && l.days[6] && l.days[0] <= t && t <= l.days[6]
3482
+ (l) => l.days.some((c) => N.isSameDay(c, t)) || l.days[0] && l.days[6] && l.days[0] <= t && t <= l.days[6]
3483
3483
  )), a >= 0) {
3484
3484
  const l = this._dayHeight;
3485
3485
  this._dayHeight = o, this.updateWeekOffsets();
@@ -3559,8 +3559,8 @@ const Nt = 100, me = 3e3, z = 60, Yi = 12, ye = 20, ni = class ni extends Kt {
3559
3559
  const e = this.dayHeight * this.rowsPerWeek;
3560
3560
  if (this.filter) {
3561
3561
  const s = this.events.map((r) => ({
3562
- start: U.startOfDayTime(r.start),
3563
- end: U.endOfDayTime(r.end)
3562
+ start: N.startOfDayTime(r.start),
3563
+ end: N.endOfDayTime(r.end)
3564
3564
  }));
3565
3565
  for (const r of this.weeks) {
3566
3566
  r.yOffset = t;
@@ -3600,15 +3600,15 @@ const Nt = 100, me = 3e3, z = 60, Yi = 12, ye = 20, ni = class ni extends Kt {
3600
3600
  ), d = this.dayHeight >= 300;
3601
3601
  for (const h of c) {
3602
3602
  const u = h.days.findIndex(
3603
- (f) => U.isSameDay(f, l)
3603
+ (f) => N.isSameDay(f, l)
3604
3604
  );
3605
3605
  if (u >= 0) {
3606
3606
  const { row: f, col: v } = this.getDayVisualPosition(u), g = z + v * a, p = h.yOffset + f * this.dayHeight - r, y = getComputedStyle(this).getPropertyValue("--bg-today").trim() || "rgba(255, 255, 255, 0.05)";
3607
3607
  if (t.fillStyle = y, t.fillRect(g, p, a, this.dayHeight), d) {
3608
3608
  const C = /* @__PURE__ */ new Date(), H = C.getHours() * 60 + C.getMinutes(), M = p + H / 1440 * this.dayHeight;
3609
3609
  if (M >= 0 && M <= i) {
3610
- const x = getComputedStyle(this).getPropertyValue("--accent-current-time").trim() || "rgba(255, 0, 0, 0.8)";
3611
- t.strokeStyle = x, t.lineWidth = 1, t.beginPath(), t.moveTo(g, M), t.lineTo(g + a, M), t.stroke(), t.lineWidth = 1;
3610
+ const E = getComputedStyle(this).getPropertyValue("--accent-current-time").trim() || "rgba(255, 0, 0, 0.8)";
3611
+ t.strokeStyle = E, t.lineWidth = 1, t.beginPath(), t.moveTo(g, M), t.lineTo(g + a, M), t.stroke(), t.lineWidth = 1;
3612
3612
  }
3613
3613
  }
3614
3614
  }
@@ -3625,13 +3625,13 @@ const Nt = 100, me = 3e3, z = 60, Yi = 12, ye = 20, ni = class ni extends Kt {
3625
3625
  if (this.filter && h > 0) {
3626
3626
  const w = c[h - 1];
3627
3627
  if (!w) continue;
3628
- const S = this.weeks.indexOf(w), A = this.weeks.indexOf(u) - S - 1;
3629
- if (A > 0) {
3630
- const b = f, E = getComputedStyle(this).getPropertyValue("--grid-color-strong").trim() || "rgba(255, 255, 255, 0.3)";
3631
- t.strokeStyle = E, t.lineWidth = 1, t.setLineDash([4, 4]), t.beginPath(), t.moveTo(z, b), t.lineTo(e, b), t.stroke(), t.setLineDash([]);
3628
+ const S = this.weeks.indexOf(w), O = this.weeks.indexOf(u) - S - 1;
3629
+ if (O > 0) {
3630
+ const b = f, x = getComputedStyle(this).getPropertyValue("--grid-color-strong").trim() || "rgba(255, 255, 255, 0.3)";
3631
+ t.strokeStyle = x, t.lineWidth = 1, t.setLineDash([4, 4]), t.beginPath(), t.moveTo(z, b), t.lineTo(e, b), t.stroke(), t.setLineDash([]);
3632
3632
  const T = getComputedStyle(this).getPropertyValue("--text-muted").trim() || "rgba(255, 255, 255, 0.4)";
3633
3633
  t.fillStyle = T, t.textAlign = "center";
3634
- const D = `⋯ ${A} week${A > 1 ? "s" : ""}`, N = t.measureText(D).width, L = 8, P = (z + e) / 2 - N / 2 - L, B = b - 8, R = N + L * 2, W = 16, K = getComputedStyle(this).getPropertyValue("--bg-primary").trim() || "rgba(30, 30, 30, 0.9)";
3634
+ const D = `⋯ ${O} week${O > 1 ? "s" : ""}`, U = t.measureText(D).width, L = 8, P = (z + e) / 2 - U / 2 - L, B = b - 8, R = U + L * 2, W = 16, K = getComputedStyle(this).getPropertyValue("--bg-primary").trim() || "rgba(30, 30, 30, 0.9)";
3635
3635
  t.fillStyle = K, t.beginPath(), t.roundRect(P, B, R, W, 8), t.fill(), t.fillStyle = T, t.fillText(D, (z + e) / 2, b + 4);
3636
3636
  }
3637
3637
  }
@@ -3655,28 +3655,28 @@ const Nt = 100, me = 3e3, z = 60, Yi = 12, ye = 20, ni = class ni extends Kt {
3655
3655
  );
3656
3656
  for (let w = 0; w < this.rowsPerWeek; w++) {
3657
3657
  const S = f + w * this.dayHeight;
3658
- for (let O = 0; O < 24; O++) {
3659
- const A = S + O / 24 * this.dayHeight;
3660
- if (A >= 0 && A <= i && (t.beginPath(), t.moveTo(z, A), t.lineTo(e, A), t.stroke(), v > 0.1)) {
3661
- const b = `${O.toString().padStart(2, "0")}:00`;
3662
- t.fillText(b, 48, A + 4);
3658
+ for (let A = 0; A < 24; A++) {
3659
+ const O = S + A / 24 * this.dayHeight;
3660
+ if (O >= 0 && O <= i && (t.beginPath(), t.moveTo(z, O), t.lineTo(e, O), t.stroke(), v > 0.1)) {
3661
+ const b = `${A.toString().padStart(2, "0")}:00`;
3662
+ t.fillText(b, 48, O + 4);
3663
3663
  }
3664
3664
  }
3665
3665
  }
3666
3666
  if (v > 0.1) {
3667
3667
  const w = /* @__PURE__ */ new Date(), S = u.days.findIndex(
3668
- (O) => U.isSameDay(O, w)
3668
+ (A) => N.isSameDay(A, w)
3669
3669
  );
3670
3670
  if (S >= 0) {
3671
- const { row: O } = this.getDayVisualPosition(S), A = w.getHours() * 60 + w.getMinutes(), b = f + O * this.dayHeight + A / 1440 * this.dayHeight;
3671
+ const { row: A } = this.getDayVisualPosition(S), O = w.getHours() * 60 + w.getMinutes(), b = f + A * this.dayHeight + O / 1440 * this.dayHeight;
3672
3672
  if (b >= 0 && b <= i) {
3673
- const E = w.getHours().toString().padStart(2, "0"), T = w.getMinutes().toString().padStart(2, "0"), D = `${E}:${T}`;
3673
+ const x = w.getHours().toString().padStart(2, "0"), T = w.getMinutes().toString().padStart(2, "0"), D = `${x}:${T}`;
3674
3674
  t.save(), t.textAlign = "right", t.textBaseline = "middle";
3675
- const N = t.measureText(D).width, L = 6, P = 48, B = b, R = getComputedStyle(this).getPropertyValue("--bg-elevated").trim() || "rgba(0, 0, 0, 0.7)";
3675
+ const U = t.measureText(D).width, L = 6, P = 48, B = b, R = getComputedStyle(this).getPropertyValue("--bg-elevated").trim() || "rgba(0, 0, 0, 0.7)";
3676
3676
  t.fillStyle = R, t.beginPath(), t.roundRect(
3677
- P - N - L,
3677
+ P - U - L,
3678
3678
  B - 8,
3679
- N + L * 2,
3679
+ U + L * 2,
3680
3680
  16,
3681
3681
  4
3682
3682
  ), t.fill(), t.fillStyle = getComputedStyle(this).getPropertyValue("--text-primary").trim() || "rgba(255, 255, 255, 1)", t.fillText(D, P, B), t.restore();
@@ -3691,11 +3691,11 @@ const Nt = 100, me = 3e3, z = 60, Yi = 12, ye = 20, ni = class ni extends Kt {
3691
3691
  /[\d.]+\)$/,
3692
3692
  `${0.4 * y})`
3693
3693
  ), t.textAlign = "center";
3694
- const H = `W${u.weekNumber}`, M = f, x = f + u.height, $ = Math.max(
3694
+ const H = `W${u.weekNumber}`, M = f, E = f + u.height, $ = Math.max(
3695
3695
  14,
3696
- Math.min(M + u.height / 2 + 4, x - 4)
3696
+ Math.min(M + u.height / 2 + 4, E - 4)
3697
3697
  );
3698
- $ >= Math.max(0, M + 4) && $ <= Math.min(i, x) && y > 0.1 && t.fillText(H, 30, $);
3698
+ $ >= Math.max(0, M + 4) && $ <= Math.min(i, E) && y > 0.1 && t.fillText(H, 30, $);
3699
3699
  }
3700
3700
  this.renderEventsOnCanvas(t, r, i, a, c), this.renderDateLabels(), this.renderWeekdayLabels(t, a, c, r, i), this.isCreatingEvent && this.renderEventCreationPreview(), this.isDraggingEvent && this.renderEventMovePreview(), this.renderMinimap();
3701
3701
  }
@@ -3704,20 +3704,20 @@ const Nt = 100, me = 3e3, z = 60, Yi = 12, ye = 20, ni = class ni extends Kt {
3704
3704
  if (this.eventRects = [], r.length === 0) return;
3705
3705
  const d = r[0], h = r[r.length - 1], u = d.days[0], f = h.days[6], v = u.getTime(), g = f.getTime() + 864e5 - 1, p = /* @__PURE__ */ new Map(), y = /* @__PURE__ */ new Map(), C = [], H = [], M = [];
3706
3706
  for (const b of o) {
3707
- const E = b.start.getTime(), T = b.end.getTime();
3708
- if (T < v || E > g)
3707
+ const x = b.start.getTime(), T = b.end.getTime();
3708
+ if (T < v || x > g)
3709
3709
  continue;
3710
3710
  const D = [];
3711
3711
  for (const P of r) {
3712
3712
  const B = P.days[0], R = P.days[6];
3713
3713
  if (!B || !R) continue;
3714
3714
  const W = B.getTime(), K = R.getTime() + 86399999;
3715
- if (T >= W && E <= K) {
3715
+ if (T >= W && x <= K) {
3716
3716
  const J = this.weeks.indexOf(P);
3717
3717
  D.push({ weekIndex: J, week: P });
3718
3718
  }
3719
3719
  }
3720
- const N = D.length, L = b.isAllDay === !0;
3720
+ const U = D.length, L = b.isAllDay === !0;
3721
3721
  for (let P = 0; P < D.length; P++) {
3722
3722
  const { weekIndex: B, week: R } = D[P], W = P === 0, K = P === D.length - 1;
3723
3723
  let J = 0, wt = 6;
@@ -3733,16 +3733,16 @@ const Nt = 100, me = 3e3, z = 60, Yi = 12, ye = 20, ni = class ni extends Kt {
3733
3733
  endDayIndex: wt,
3734
3734
  isStart: W,
3735
3735
  isEnd: K,
3736
- totalWeeks: N
3736
+ totalWeeks: U
3737
3737
  };
3738
3738
  L ? H.push(rt) : M.push(rt);
3739
3739
  }
3740
3740
  }
3741
- const x = c ? M.flatMap((b) => {
3741
+ const E = c ? M.flatMap((b) => {
3742
3742
  if (b.startDayIndex === b.endDayIndex) return [b];
3743
- const E = [];
3743
+ const x = [];
3744
3744
  for (let T = b.startDayIndex; T <= b.endDayIndex; T++)
3745
- E.push({
3745
+ x.push({
3746
3746
  ...b,
3747
3747
  startDayIndex: T,
3748
3748
  endDayIndex: T,
@@ -3750,30 +3750,30 @@ const Nt = 100, me = 3e3, z = 60, Yi = 12, ye = 20, ni = class ni extends Kt {
3750
3750
  isEnd: T === b.endDayIndex && b.isEnd,
3751
3751
  totalWeeks: 1
3752
3752
  });
3753
- return E;
3753
+ return x;
3754
3754
  }) : M;
3755
- C.push(...H, ...x);
3755
+ C.push(...H, ...E);
3756
3756
  const $ = /* @__PURE__ */ new Map();
3757
3757
  for (const b of C) {
3758
- const E = b.event.isAllDay === !0;
3759
- if (c && !E)
3758
+ const x = b.event.isAllDay === !0;
3759
+ if (c && !x)
3760
3760
  for (let T = b.startDayIndex; T <= b.endDayIndex; T++) {
3761
3761
  const D = `${b.weekIndex}-${T}`;
3762
3762
  $.has(D) || $.set(D, []), $.get(D).push(b);
3763
3763
  }
3764
3764
  }
3765
3765
  const w = /* @__PURE__ */ new Map();
3766
- for (const [b, E] of $) {
3767
- const [T, D] = b.split("-"), N = parseInt(D), L = parseInt(T), P = [];
3768
- for (const R of E) {
3766
+ for (const [b, x] of $) {
3767
+ const [T, D] = b.split("-"), U = parseInt(D), L = parseInt(T), P = [];
3768
+ for (const R of x) {
3769
3769
  const W = this.weeks[L];
3770
3770
  if (!W) continue;
3771
- const K = new Date(W.days[N]).setHours(
3771
+ const K = new Date(W.days[U]).setHours(
3772
3772
  0,
3773
3773
  0,
3774
3774
  0,
3775
3775
  0
3776
- ), J = new Date(W.days[N]).setHours(
3776
+ ), J = new Date(W.days[U]).setHours(
3777
3777
  23,
3778
3778
  59,
3779
3779
  59,
@@ -3788,32 +3788,32 @@ const Nt = 100, me = 3e3, z = 60, Yi = 12, ye = 20, ni = class ni extends Kt {
3788
3788
  for (; W < B.length && !(B[W].endMinutes <= R.startMinutes); W++)
3789
3789
  ;
3790
3790
  W === B.length ? B.push({ endMinutes: R.endMinutes }) : B[W].endMinutes = R.endMinutes;
3791
- const K = `${R.segment.weekIndex}-${R.segment.event.id}-${N}`;
3791
+ const K = `${R.segment.weekIndex}-${R.segment.event.id}-${U}`;
3792
3792
  w.set(K, {
3793
3793
  column: W,
3794
3794
  totalColumns: B.length
3795
3795
  });
3796
3796
  }
3797
3797
  for (const R of P) {
3798
- const W = `${R.segment.weekIndex}-${R.segment.event.id}-${N}`, K = w.get(W);
3798
+ const W = `${R.segment.weekIndex}-${R.segment.event.id}-${U}`, K = w.get(W);
3799
3799
  K && (K.totalColumns = B.length);
3800
3800
  }
3801
3801
  }
3802
3802
  for (const b of C) {
3803
3803
  const {
3804
- event: E,
3804
+ event: x,
3805
3805
  week: T,
3806
3806
  weekIndex: D,
3807
- startDayIndex: N,
3807
+ startDayIndex: U,
3808
3808
  endDayIndex: L,
3809
3809
  isStart: P,
3810
3810
  isEnd: B,
3811
3811
  totalWeeks: R
3812
- } = b, W = T.yOffset, K = E.isAllDay === !0, J = this.getDayVisualPosition(N), wt = this.getDayVisualPosition(L);
3812
+ } = b, W = T.yOffset, K = x.isAllDay === !0, J = this.getDayVisualPosition(U), wt = this.getDayVisualPosition(L);
3813
3813
  J.row, wt.row;
3814
3814
  let rt, ut;
3815
3815
  if (c && !K) {
3816
- const nt = new Date(T.days[N]).setHours(
3816
+ const nt = new Date(T.days[U]).setHours(
3817
3817
  0,
3818
3818
  0,
3819
3819
  0,
@@ -3823,15 +3823,15 @@ const Nt = 100, me = 3e3, z = 60, Yi = 12, ye = 20, ni = class ni extends Kt {
3823
3823
  59,
3824
3824
  59,
3825
3825
  999
3826
- ), Et = E.start.getTime(), gt = E.end.getTime() - 6e4, st = Math.max(Et, nt), j = Math.min(gt, q), pt = new Date(st), vt = new Date(j), Pt = pt.getHours() * 60 + pt.getMinutes(), Rt = vt.getHours() * 60 + vt.getMinutes(), $t = W + J.row * this.dayHeight;
3826
+ ), Et = x.start.getTime(), gt = x.end.getTime() - 6e4, st = Math.max(Et, nt), j = Math.min(gt, q), pt = new Date(st), vt = new Date(j), Pt = pt.getHours() * 60 + pt.getMinutes(), Rt = vt.getHours() * 60 + vt.getMinutes(), $t = W + J.row * this.dayHeight;
3827
3827
  rt = $t + Pt / 1440 * this.dayHeight, ut = $t + Rt / 1440 * this.dayHeight;
3828
3828
  } else {
3829
- const nt = `${D}-${E.id}`;
3829
+ const nt = `${D}-${x.id}`;
3830
3830
  let q = y.get(nt);
3831
3831
  if (q === void 0) {
3832
3832
  for (q = 0; ; ) {
3833
3833
  let st = !0;
3834
- for (let j = N; j <= L; j++) {
3834
+ for (let j = U; j <= L; j++) {
3835
3835
  const pt = `${D}-${j}`;
3836
3836
  if (p.get(pt)?.has(q)) {
3837
3837
  st = !1;
@@ -3843,7 +3843,7 @@ const Nt = 100, me = 3e3, z = 60, Yi = 12, ye = 20, ni = class ni extends Kt {
3843
3843
  }
3844
3844
  y.set(nt, q);
3845
3845
  }
3846
- for (let st = N; st <= L; st++) {
3846
+ for (let st = U; st <= L; st++) {
3847
3847
  const j = `${D}-${st}`;
3848
3848
  let pt = p.get(j);
3849
3849
  pt || (pt = /* @__PURE__ */ new Set(), p.set(j, pt)), pt.add(q);
@@ -3859,7 +3859,7 @@ const Nt = 100, me = 3e3, z = 60, Yi = 12, ye = 20, ni = class ni extends Kt {
3859
3859
  ut - rt
3860
3860
  );
3861
3861
  let X, Tt;
3862
- const Qt = `${D}-${E.id}-${N}`, kt = w.get(Qt);
3862
+ const Qt = `${D}-${x.id}-${U}`, kt = w.get(Qt);
3863
3863
  if (c && !K && kt && kt.totalColumns > 1) {
3864
3864
  const nt = s / kt.totalColumns;
3865
3865
  X = z + J.col * s + kt.column * nt, Tt = nt;
@@ -3869,16 +3869,16 @@ const Nt = 100, me = 3e3, z = 60, Yi = 12, ye = 20, ni = class ni extends Kt {
3869
3869
  }
3870
3870
  const ft = rt - e;
3871
3871
  if (ft + Q < 0 || ft > i) continue;
3872
- const $e = E.color || "#888888", Ht = this.internal.isEventSelected(E), sn = this.hoveredEventId === E.id, ct = 2, Dt = Tt - ct * 2, te = 3, si = 6;
3872
+ const $e = x.color || "#888888", Ht = this.internal.isEventSelected(x), sn = this.hoveredEventId === x.id, ct = 2, Dt = Tt - ct * 2, te = 3, si = 6;
3873
3873
  let Ct = 4, zt = 4, Mt = 4, Ft = 4;
3874
- R > 1 && (P && !B ? (zt = 0, Ft = 0) : !P && B ? (Ct = 0, Mt = 0) : !P && !B && (Ct = 0, zt = 0, Mt = 0, Ft = 0)), t.save(), E.readOnly && (t.globalAlpha = 0.5);
3874
+ R > 1 && (P && !B ? (zt = 0, Ft = 0) : !P && B ? (Ct = 0, Mt = 0) : !P && !B && (Ct = 0, zt = 0, Mt = 0, Ft = 0)), t.save(), x.readOnly && (t.globalAlpha = 0.5);
3875
3875
  const Bt = Ps(Re($e)), ri = getComputedStyle(this).getPropertyValue("--text-primary").trim() || "rgba(255, 255, 255, 0.9)", Ae = getComputedStyle(this).getPropertyValue("--text-inverse").trim() || "rgb(0, 0, 0)", rn = Ht ? $e : `hsla(${Bt[0]}, ${Math.min(Bt[1] * 0.9, 90)}%, ${Math.min(
3876
3876
  Bt[2] + 15,
3877
3877
  40
3878
3878
  )}%, 0.45)`, on = Ht ? $e : `hsla(${Bt[0]}, ${Math.min(Bt[1] * 0.9, 90)}%, ${Math.min(
3879
3879
  Bt[2] + 10,
3880
3880
  70
3881
- )}%, 1)`, an = this.shouldRenderEventWithStripes(E);
3881
+ )}%, 1)`, an = this.shouldRenderEventWithStripes(x);
3882
3882
  if (t.beginPath(), t.roundRect(X + ct, ft, Dt, Q, [
3883
3883
  Ct,
3884
3884
  zt,
@@ -3926,13 +3926,13 @@ const Nt = 100, me = 3e3, z = 60, Yi = 12, ye = 20, ni = class ni extends Kt {
3926
3926
  ft,
3927
3927
  Dt - te,
3928
3928
  Q
3929
- ), t.clip(), E.rrule) {
3929
+ ), t.clip(), x.rrule) {
3930
3930
  t.font = `11px ${a}`;
3931
3931
  const vt = "⟳", Pt = t.measureText(vt).width;
3932
3932
  t.fillText(vt, q, Et), gt -= Pt + 4;
3933
3933
  }
3934
- const st = q + (E.rrule ? t.measureText("⟳").width + 4 : 0);
3935
- let j = E.title;
3934
+ const st = q + (x.rrule ? t.measureText("⟳").width + 4 : 0);
3935
+ let j = x.title;
3936
3936
  if (t.font = `11px ${a}`, t.measureText(j).width > gt) {
3937
3937
  const Pt = t.measureText("…").width;
3938
3938
  let Rt = 0, $t = j.length, fe = 0;
@@ -3946,7 +3946,7 @@ const Nt = 100, me = 3e3, z = 60, Yi = 12, ye = 20, ni = class ni extends Kt {
3946
3946
  const vt = (ge) => {
3947
3947
  const pe = ge.getHours(), ee = ge.getMinutes(), ie = pe >= 12 ? "PM" : "AM";
3948
3948
  return `${pe % 12 || 12}:${ee.toString().padStart(2, "0")} ${ie}`;
3949
- }, Pt = vt(E.start), Rt = vt(E.end), $t = `${Pt} – ${Rt}`, fe = Ht ? Ae : ri;
3949
+ }, Pt = vt(x.start), Rt = vt(x.end), $t = `${Pt} – ${Rt}`, fe = Ht ? Ae : ri;
3950
3950
  t.fillStyle = fe, t.font = `10px ${a}`;
3951
3951
  let ht = $t;
3952
3952
  if (t.measureText(ht).width > gt) {
@@ -3963,7 +3963,7 @@ const Nt = 100, me = 3e3, z = 60, Yi = 12, ye = 20, ni = class ni extends Kt {
3963
3963
  t.restore();
3964
3964
  }
3965
3965
  t.restore(), this.eventRects.push({
3966
- event: E,
3966
+ event: x,
3967
3967
  x: X + ct,
3968
3968
  y: rt,
3969
3969
  width: Dt,
@@ -3983,29 +3983,29 @@ const Nt = 100, me = 3e3, z = 60, Yi = 12, ye = 20, ni = class ni extends Kt {
3983
3983
  "October",
3984
3984
  "November",
3985
3985
  "December"
3986
- ], O = [], A = /* @__PURE__ */ new Set();
3986
+ ], A = [], O = /* @__PURE__ */ new Set();
3987
3987
  for (const b of r) {
3988
- const E = b.days[0];
3989
- if (!E) continue;
3990
- const T = E.getMonth(), D = E.getFullYear(), N = `${T}-${D}`;
3991
- if (!A.has(N)) {
3992
- A.add(N);
3988
+ const x = b.days[0];
3989
+ if (!x) continue;
3990
+ const T = x.getMonth(), D = x.getFullYear(), U = `${T}-${D}`;
3991
+ if (!O.has(U)) {
3992
+ O.add(U);
3993
3993
  const L = S[T];
3994
- L && O.push({
3995
- monthKey: N,
3994
+ L && A.push({
3995
+ monthKey: U,
3996
3996
  monthName: L,
3997
3997
  year: D,
3998
3998
  yOffset: b.yOffset
3999
3999
  });
4000
4000
  }
4001
4001
  }
4002
- for (let b = 0; b < O.length; b++) {
4003
- const E = O[b], T = O[b + 1], D = E.yOffset, N = T ? T.yOffset : this.totalHeight;
4004
- if (N < e) continue;
4002
+ for (let b = 0; b < A.length; b++) {
4003
+ const x = A[b], T = A[b + 1], D = x.yOffset, U = T ? T.yOffset : this.totalHeight;
4004
+ if (U < e) continue;
4005
4005
  if (D > l) break;
4006
- const L = [12, 0, 0, 12], P = Math.max(0, e - D), B = N - D - 24, R = Math.min(P, B), K = D + R - e + 32;
4006
+ const L = [12, 0, 0, 12], P = Math.max(0, e - D), B = U - D - 24, R = Math.min(P, B), K = D + R - e + 32;
4007
4007
  t.save(), t.font = `bold 18px ${a}`, t.textAlign = "left", t.textBaseline = "top";
4008
- const J = `${E.monthName} ${E.year}`, wt = t.measureText(J).width, ut = 64 + L[3] + 8, Q = K + L[0], X = 8, Tt = 8, Qt = getComputedStyle(this).getPropertyValue("--bg-elevated").trim() || "rgba(0, 0, 0, 0.7)";
4008
+ const J = `${x.monthName} ${x.year}`, wt = t.measureText(J).width, ut = 64 + L[3] + 8, Q = K + L[0], X = 8, Tt = 8, Qt = getComputedStyle(this).getPropertyValue("--bg-elevated").trim() || "rgba(0, 0, 0, 0.7)";
4009
4009
  t.fillStyle = Qt, t.beginPath(), t.roundRect(
4010
4010
  ut - X,
4011
4011
  Q - 4,
@@ -4175,16 +4175,16 @@ const Nt = 100, me = 3e3, z = 60, Yi = 12, ye = 20, ni = class ni extends Kt {
4175
4175
  if (!y) continue;
4176
4176
  const { row: C, col: H } = this.getDayVisualPosition(p);
4177
4177
  if (H < l || H > c) continue;
4178
- const M = g.yOffset + C * this.dayHeight, x = M + this.dayHeight;
4179
- if (s < M || i > x) continue;
4180
- const $ = Math.max(i, M), w = Math.min(s, x), S = $ - M, O = Math.floor(
4178
+ const M = g.yOffset + C * this.dayHeight, E = M + this.dayHeight;
4179
+ if (s < M || i > E) continue;
4180
+ const $ = Math.max(i, M), w = Math.min(s, E), S = $ - M, A = Math.floor(
4181
4181
  S / this.dayHeight * 24 * 60
4182
- ), A = Math.floor(O / 60), b = O % 60, E = w - M, T = Math.ceil(
4183
- E / this.dayHeight * 24 * 60
4184
- ), D = Math.floor(T / 60), N = T % 60, L = new Date(y);
4185
- L.setHours(A, b, 0, 0);
4182
+ ), O = Math.floor(A / 60), b = A % 60, x = w - M, T = Math.ceil(
4183
+ x / this.dayHeight * 24 * 60
4184
+ ), D = Math.floor(T / 60), U = T % 60, L = new Date(y);
4185
+ L.setHours(O, b, 0, 0);
4186
4186
  const P = new Date(y);
4187
- P.setHours(D, N, 59, 999), h.push({ start: L, end: P });
4187
+ P.setHours(D, U, 59, 999), h.push({ start: L, end: P });
4188
4188
  }
4189
4189
  else
4190
4190
  for (const g of d)
@@ -4193,8 +4193,8 @@ const Nt = 100, me = 3e3, z = 60, Yi = 12, ye = 20, ni = class ni extends Kt {
4193
4193
  if (!y) continue;
4194
4194
  const { row: C, col: H } = this.getDayVisualPosition(p);
4195
4195
  if (H < l || H > c) continue;
4196
- const M = g.yOffset + C * this.dayHeight, x = M + this.dayHeight;
4197
- if (s < M || i > x) continue;
4196
+ const M = g.yOffset + C * this.dayHeight, E = M + this.dayHeight;
4197
+ if (s < M || i > E) continue;
4198
4198
  const $ = new Date(y);
4199
4199
  $.setHours(0, 0, 0, 0);
4200
4200
  const w = new Date(y);
@@ -4364,32 +4364,32 @@ const Nt = 100, me = 3e3, z = 60, Yi = 12, ye = 20, ni = class ni extends Kt {
4364
4364
  this.movingEventEnd.y
4365
4365
  );
4366
4366
  if (!t || !e) return;
4367
- const i = e.getTime() - t.getTime(), s = (a) => (a.setMinutes(Math.round(a.getMinutes() / 15) * 15, 0, 0), a), r = s(
4367
+ const i = e.getTime() - t.getTime(), s = (c) => (c.setMinutes(Math.round(c.getMinutes() / 15) * 15, 0, 0), c), r = s(
4368
4368
  new Date(this.movingEvent.start.getTime() + i)
4369
- ), o = s(new Date(this.movingEvent.end.getTime() + i));
4369
+ ), o = s(new Date(this.movingEvent.end.getTime() + i)), a = (this.movingEvent.start.getTime() + this.movingEvent.end.getTime()) / 2, l = t.getTime() <= a;
4370
4370
  if (this.movingEventDuplicateMode) {
4371
- const a = getComputedStyle(this).getPropertyValue("--accent-primary").trim() || "rgb(100, 150, 255)";
4371
+ const c = getComputedStyle(this).getPropertyValue("--accent-primary").trim() || "rgb(100, 150, 255)";
4372
4372
  this.renderVirtualEvent(
4373
4373
  r,
4374
4374
  o,
4375
4375
  {
4376
- fill: a.replace("rgb", "rgba").replace(")", ", 0.3)"),
4377
- stroke: a.replace("rgb", "rgba").replace(")", ", 0.8)"),
4376
+ fill: c.replace("rgb", "rgba").replace(")", ", 0.3)"),
4377
+ stroke: c.replace("rgb", "rgba").replace(")", ", 0.8)"),
4378
4378
  text: "white"
4379
4379
  },
4380
- this.movingEventEnd.y
4380
+ l
4381
4381
  );
4382
4382
  } else {
4383
- const a = Re(this.movingEvent.color || "#888888");
4383
+ const c = Re(this.movingEvent.color || "#888888");
4384
4384
  this.renderVirtualEvent(
4385
4385
  r,
4386
4386
  o,
4387
4387
  {
4388
- fill: `rgba(${a[0]}, ${a[1]}, ${a[2]}, 0.5)`,
4389
- stroke: `rgba(${a[0]}, ${a[1]}, ${a[2]}, 0.5)`,
4388
+ fill: `rgba(${c[0]}, ${c[1]}, ${c[2]}, 0.5)`,
4389
+ stroke: `rgba(${c[0]}, ${c[1]}, ${c[2]}, 0.5)`,
4390
4390
  text: "rgba(255, 255, 255, 0.5)"
4391
4391
  },
4392
- this.movingEventEnd.y
4392
+ l
4393
4393
  );
4394
4394
  }
4395
4395
  }
@@ -4405,104 +4405,91 @@ const Nt = 100, me = 3e3, z = 60, Yi = 12, ye = 20, ni = class ni extends Kt {
4405
4405
  if (!t || !e) return;
4406
4406
  let i, s;
4407
4407
  if (this.eventCreationShiftPressed && this.eventCreationInitialDuration !== null) {
4408
- const a = this.convertPositionToDateTime(
4408
+ const l = this.convertPositionToDateTime(
4409
4409
  this.eventCreationEnd.x,
4410
4410
  this.eventCreationEnd.y
4411
4411
  );
4412
- if (!a) return;
4413
- s = new Date(a), i = new Date(
4414
- a.getTime() - this.eventCreationInitialDuration
4412
+ if (!l) return;
4413
+ s = new Date(l), i = new Date(
4414
+ l.getTime() - this.eventCreationInitialDuration
4415
4415
  );
4416
4416
  } else
4417
4417
  i = t < e ? t : e, s = t < e ? e : t;
4418
4418
  i.setMinutes(Math.round(i.getMinutes() / 15) * 15, 0, 0), s.setMinutes(Math.round(s.getMinutes() / 15) * 15, 0, 0);
4419
4419
  let r, o;
4420
4420
  if (this.activeCalendarColor) {
4421
- const a = Re(this.activeCalendarColor);
4422
- r = `rgba(${a[0]}, ${a[1]}, ${a[2]}, 0.3)`, o = `rgba(${a[0]}, ${a[1]}, ${a[2]}, 0.8)`;
4421
+ const l = Re(this.activeCalendarColor);
4422
+ r = `rgba(${l[0]}, ${l[1]}, ${l[2]}, 0.3)`, o = `rgba(${l[0]}, ${l[1]}, ${l[2]}, 0.8)`;
4423
4423
  } else {
4424
- const a = getComputedStyle(this).getPropertyValue("--accent-primary").trim() || "rgb(100, 150, 255)";
4425
- r = a.replace("rgb", "rgba").replace(")", ", 0.3)"), o = a.replace("rgb", "rgba").replace(")", ", 0.8)");
4426
- }
4427
- this.renderVirtualEvent(
4428
- i,
4429
- s,
4430
- {
4431
- fill: r,
4432
- stroke: o,
4433
- text: "white"
4434
- },
4435
- this.eventCreationEnd.y
4436
- );
4424
+ const l = getComputedStyle(this).getPropertyValue("--accent-primary").trim() || "rgb(100, 150, 255)";
4425
+ r = l.replace("rgb", "rgba").replace(")", ", 0.3)"), o = l.replace("rgb", "rgba").replace(")", ", 0.8)");
4426
+ }
4427
+ const a = this.eventCreationShiftPressed ? !1 : this.eventCreationEnd.y <= this.eventCreationStart.y;
4428
+ this.renderVirtualEvent(i, s, { fill: r, stroke: o, text: "white" }, a);
4437
4429
  }
4438
- renderVirtualEvent(t, e, i, s) {
4430
+ renderVirtualEvent(t, e, i, s = !0) {
4439
4431
  if (!this.overlayCanvas || !this.overlayCtx || !this.scrollContainer)
4440
4432
  return;
4441
- const r = this.overlayCtx, o = getComputedStyle(this).fontFamily, c = (this.scrollContainer.getBoundingClientRect().width - z - Yi) / this._columnsPerRow, d = (S, O, A) => {
4433
+ const r = this.overlayCtx, o = getComputedStyle(this).fontFamily, c = (this.scrollContainer.getBoundingClientRect().width - z - Yi) / this._columnsPerRow, d = (S, A, O) => {
4442
4434
  const b = this.weeks.find(
4443
4435
  (L) => L.days.some((P) => P.toDateString() === S.toDateString())
4444
4436
  );
4445
4437
  if (!b) return null;
4446
- const E = b.days.findIndex(
4438
+ const x = b.days.findIndex(
4447
4439
  (L) => L.toDateString() === S.toDateString()
4448
4440
  );
4449
- if (E < 0) return null;
4450
- const { row: T } = this.getDayVisualPosition(E), D = O * 60 + A;
4441
+ if (x < 0) return null;
4442
+ const { row: T } = this.getDayVisualPosition(x), D = A * 60 + O;
4451
4443
  return b.yOffset + T * this.dayHeight + D / 1440 * this.dayHeight - this.scrollTop;
4452
4444
  }, h = (S) => {
4453
- const O = this.weeks.find(
4454
- (E) => E.days.some((T) => T.toDateString() === S.toDateString())
4445
+ const A = this.weeks.find(
4446
+ (x) => x.days.some((T) => T.toDateString() === S.toDateString())
4455
4447
  );
4456
- if (!O) return null;
4457
- const A = O.days.findIndex(
4458
- (E) => E.toDateString() === S.toDateString()
4448
+ if (!A) return null;
4449
+ const O = A.days.findIndex(
4450
+ (x) => x.toDateString() === S.toDateString()
4459
4451
  );
4460
- if (A < 0) return null;
4461
- const { col: b } = this.getDayVisualPosition(A);
4452
+ if (O < 0) return null;
4453
+ const { col: b } = this.getDayVisualPosition(O);
4462
4454
  return b * c;
4463
- }, u = (S, O, A) => {
4464
- const b = S + 2, E = c - 4, T = Math.max(4, A - O);
4465
- r.fillStyle = i.fill, r.beginPath(), r.roundRect(b, O, E, T, 4), r.fill(), r.strokeStyle = i.stroke, r.lineWidth = 1, r.setLineDash([6, 3]), r.stroke(), r.setLineDash([]);
4455
+ }, u = (S, A, O) => {
4456
+ const b = S + 2, x = c - 4, T = Math.max(4, O - A);
4457
+ r.fillStyle = i.fill, r.beginPath(), r.roundRect(b, A, x, T, 4), r.fill(), r.strokeStyle = i.stroke, r.lineWidth = 1, r.setLineDash([6, 3]), r.stroke(), r.setLineDash([]);
4466
4458
  }, f = t.toDateString() === e.toDateString();
4467
4459
  if (f) {
4468
- const S = h(t), O = d(t, t.getHours(), t.getMinutes()), A = d(e, e.getHours(), e.getMinutes());
4469
- S != null && O != null && A != null && u(S, O, A);
4460
+ const S = h(t), A = d(t, t.getHours(), t.getMinutes()), O = d(e, e.getHours(), e.getMinutes());
4461
+ S != null && A != null && O != null && u(S, A, O);
4470
4462
  } else {
4471
4463
  const S = new Date(t);
4472
4464
  S.setHours(0, 0, 0, 0);
4473
- const O = new Date(e);
4474
- for (O.setHours(23, 59, 59, 999); S <= O; ) {
4475
- const A = h(S);
4476
- if (A != null) {
4477
- const b = S.toDateString() === t.toDateString(), E = S.toDateString() === e.toDateString();
4465
+ const A = new Date(e);
4466
+ for (A.setHours(23, 59, 59, 999); S <= A; ) {
4467
+ const O = h(S);
4468
+ if (O != null) {
4469
+ const b = S.toDateString() === t.toDateString(), x = S.toDateString() === e.toDateString();
4478
4470
  let T, D;
4479
- b ? (T = d(S, t.getHours(), t.getMinutes()), D = d(S, 23, 59)) : E ? (T = d(S, 0, 0), D = d(S, e.getHours(), e.getMinutes())) : (T = d(S, 0, 0), D = d(S, 23, 59)), T != null && D != null && u(A, T, D);
4471
+ b ? (T = d(S, t.getHours(), t.getMinutes()), D = d(S, 23, 59)) : x ? (T = d(S, 0, 0), D = d(S, e.getHours(), e.getMinutes())) : (T = d(S, 0, 0), D = d(S, 23, 59)), T != null && D != null && u(O, T, D);
4480
4472
  }
4481
4473
  S.setDate(S.getDate() + 1);
4482
4474
  }
4483
4475
  }
4484
- const v = (S) => `${S.getHours().toString().padStart(2, "0")}:${S.getMinutes().toString().padStart(2, "0")}`, g = (S) => `${S.getDate()}.${S.getMonth() + 1}`, p = f ? `${v(t)} – ${v(e)}` : `${g(t)} ${v(t)} – ${g(e)} ${v(e)}`, H = Math.abs(e.getTime() - t.getTime()) / (1e3 * 60) < 15, M = h(t), x = h(e), $ = d(t, t.getHours(), t.getMinutes()), w = d(e, e.getHours(), e.getMinutes());
4485
- if (M != null && x != null && $ != null && w != null) {
4476
+ const v = (S) => `${S.getHours().toString().padStart(2, "0")}:${S.getMinutes().toString().padStart(2, "0")}`, g = (S) => `${S.getDate()}.${S.getMonth() + 1}`, p = f ? `${v(t)} – ${v(e)}` : `${g(t)} ${v(t)} – ${g(e)} ${v(e)}`, H = Math.abs(e.getTime() - t.getTime()) / (1e3 * 60) < 15, M = h(t), E = h(e), $ = d(t, t.getHours(), t.getMinutes()), w = d(e, e.getHours(), e.getMinutes());
4477
+ if (M != null && E != null && $ != null && w != null) {
4486
4478
  r.font = `600 11px ${o}`, r.fillStyle = i.text, r.textAlign = "left";
4487
- let S = !0;
4488
- if (s !== void 0) {
4489
- const A = s - this.scrollTop, b = Math.abs(A - $), E = Math.abs(A - w);
4490
- S = b < E;
4491
- }
4492
- const O = S ? M : x;
4479
+ const S = s ? M : E;
4493
4480
  if (H) {
4494
- const A = S ? $ : w, b = A + 6, E = A + 10, T = r.measureText(p).width, D = 6, N = getComputedStyle(this).getPropertyValue("--bg-elevated").trim() || "rgba(0, 0, 0, 0.8)";
4495
- r.fillStyle = N, r.beginPath(), r.roundRect(
4496
- O + 4,
4497
- b,
4498
- T + D * 2,
4481
+ const A = s ? $ : w, O = A + 6, b = A + 10, x = r.measureText(p).width, T = 6, D = getComputedStyle(this).getPropertyValue("--bg-elevated").trim() || "rgba(0, 0, 0, 0.8)";
4482
+ r.fillStyle = D, r.beginPath(), r.roundRect(
4483
+ S + 4,
4484
+ O,
4485
+ x + T * 2,
4499
4486
  16,
4500
4487
  4
4501
- ), r.fill(), r.fillStyle = "white", r.textBaseline = "top", r.fillText(p, O + 4 + D, E);
4488
+ ), r.fill(), r.fillStyle = "white", r.textBaseline = "top", r.fillText(p, S + 4 + T, b);
4502
4489
  } else {
4503
4490
  r.textBaseline = "top";
4504
- const A = S ? $ + 4 : w - 18;
4505
- r.fillText(p, O + 8, A);
4491
+ const A = s ? $ + 4 : w - 18;
4492
+ r.fillText(p, S + 8, A);
4506
4493
  }
4507
4494
  }
4508
4495
  }
@@ -4523,13 +4510,13 @@ const Nt = 100, me = 3e3, z = 60, Yi = 12, ye = 20, ni = class ni extends Kt {
4523
4510
  if (!d) continue;
4524
4511
  const { row: h, col: u } = this.getDayVisualPosition(c), f = u * s, v = l.yOffset + h * this.dayHeight - r, g = v + this.dayHeight;
4525
4512
  if (c === 5 || c === 6) {
4526
- const x = getComputedStyle(this).getPropertyValue("--bg-weekend").trim() || "rgba(255, 255, 255, 0.03)";
4527
- t.fillStyle = x, t.fillRect(f, v, s, this.dayHeight);
4513
+ const E = getComputedStyle(this).getPropertyValue("--bg-weekend").trim() || "rgba(255, 255, 255, 0.03)";
4514
+ t.fillStyle = E, t.fillRect(f, v, s, this.dayHeight);
4528
4515
  }
4529
4516
  const p = this.dayHeight >= 300, y = /* @__PURE__ */ new Date();
4530
- if (!p && U.isSameDay(d, y)) {
4531
- const x = getComputedStyle(this).getPropertyValue("--accent-current-time").trim() || "rgba(255, 0, 0, 0.8)";
4532
- t.strokeStyle = x, t.lineWidth = 1, t.strokeRect(f + 1, v + 1, s - 2, this.dayHeight - 2), t.lineWidth = 1;
4517
+ if (!p && N.isSameDay(d, y)) {
4518
+ const E = getComputedStyle(this).getPropertyValue("--accent-current-time").trim() || "rgba(255, 0, 0, 0.8)";
4519
+ t.strokeStyle = E, t.lineWidth = 1, t.strokeRect(f + 1, v + 1, s - 2, this.dayHeight - 2), t.lineWidth = 1;
4533
4520
  }
4534
4521
  const C = 12, M = Math.min(
4535
4522
  g - C - 8,
@@ -4555,11 +4542,11 @@ const Nt = 100, me = 3e3, z = 60, Yi = 12, ye = 20, ni = class ni extends Kt {
4555
4542
  if (C >= 7) continue;
4556
4543
  const H = o[C];
4557
4544
  if (!H) continue;
4558
- const M = z + y * e + e / 2, x = t.measureText(H).width, $ = 6, w = 2;
4545
+ const M = z + y * e + e / 2, E = t.measureText(H).width, $ = 6, w = 2;
4559
4546
  t.fillStyle = c, t.beginPath(), t.roundRect(
4560
- M - x / 2 - $,
4547
+ M - E / 2 - $,
4561
4548
  p,
4562
- x + $ * 2,
4549
+ E + $ * 2,
4563
4550
  d,
4564
4551
  4
4565
4552
  ), t.fill(), t.fillStyle = l, t.fillText(H, M, p + w + 1);
@@ -4597,12 +4584,12 @@ const Nt = 100, me = 3e3, z = 60, Yi = 12, ye = 20, ni = class ni extends Kt {
4597
4584
  if (!y || y.height === 0) continue;
4598
4585
  const C = y.days[0], H = y.days[6];
4599
4586
  if (!C || !H) continue;
4600
- const M = C.getTime(), x = H.getTime() + a - 1, $ = Math.max(d, M), w = Math.min(h, x), S = Math.floor(
4587
+ const M = C.getTime(), E = H.getTime() + a - 1, $ = Math.max(d, M), w = Math.min(h, E), S = Math.floor(
4601
4588
  $ % a / l
4602
- ), O = Math.floor(
4589
+ ), A = Math.floor(
4603
4590
  w % a / l
4604
- ), A = y.yOffset / this.totalHeight * e + S / 1440 * (y.height / this.totalHeight * e), b = y.yOffset / this.totalHeight * e + O / 1440 * (y.height / this.totalHeight * e);
4605
- i.globalAlpha = c.readOnly ? 0.333 * 0.5 : 0.333, i.fillStyle = c.color || "#888", i.fillRect(2, A, t - 4, Math.max(b - A, 2));
4591
+ ), O = y.yOffset / this.totalHeight * e + S / 1440 * (y.height / this.totalHeight * e), b = y.yOffset / this.totalHeight * e + A / 1440 * (y.height / this.totalHeight * e);
4592
+ i.globalAlpha = c.readOnly ? 0.333 * 0.5 : 0.333, i.fillStyle = c.color || "#888", i.fillRect(2, O, t - 4, Math.max(b - O, 2));
4606
4593
  }
4607
4594
  }
4608
4595
  }
@@ -4828,15 +4815,15 @@ const Nt = 100, me = 3e3, z = 60, Yi = 12, ye = 20, ni = class ni extends Kt {
4828
4815
  renderEventDetail() {
4829
4816
  if (!this.selectedEventForDetail || !this.selectedEventRect)
4830
4817
  return null;
4831
- const t = this.selectedEventForDetail, e = (x) => new Intl.DateTimeFormat(this.locale, {
4818
+ const t = this.selectedEventForDetail, e = (E) => new Intl.DateTimeFormat(this.locale, {
4832
4819
  weekday: "short",
4833
4820
  year: "numeric",
4834
4821
  month: "short",
4835
4822
  day: "numeric"
4836
- }).format(x), i = (x) => new Intl.DateTimeFormat(this.locale, {
4823
+ }).format(E), i = (E) => new Intl.DateTimeFormat(this.locale, {
4837
4824
  hour: "numeric",
4838
4825
  minute: "2-digit"
4839
- }).format(x), s = U.isSameDay(t.start, t.end), r = 320, o = 550, a = 8, l = this.scrollContainer?.clientWidth || 800, c = this.scrollContainer?.clientHeight || 600, d = this.selectedEventRect.x + this.selectedEventRect.width + a, h = this.selectedEventRect.x - r - a, u = d + r <= l ? d : h, f = z + a, v = l - r - a, g = Math.max(f, Math.min(v, u)), p = this.selectedEventRect.y - this.scrollTop, y = a, C = c - o - a, H = Math.max(y, Math.min(C, p)), M = `left: ${g}px; top: ${H}px; --calendar-color: ${t.color || "#888888"};`;
4826
+ }).format(E), s = N.isSameDay(t.start, t.end), r = 320, o = 550, a = 8, l = this.scrollContainer?.clientWidth || 800, c = this.scrollContainer?.clientHeight || 600, d = this.selectedEventRect.x + this.selectedEventRect.width + a, h = this.selectedEventRect.x - r - a, u = d + r <= l ? d : h, f = z + a, v = l - r - a, g = Math.max(f, Math.min(v, u)), p = this.selectedEventRect.y - this.scrollTop, y = a, C = c - o - a, H = Math.max(y, Math.min(C, p)), M = `left: ${g}px; top: ${H}px; --calendar-color: ${t.color || "#888888"};`;
4840
4827
  return _`
4841
4828
  <div class="event-detail-overlay" style="${M}">
4842
4829
  <div class="event-detail-content">
@@ -4854,8 +4841,8 @@ const Nt = 100, me = 3e3, z = 60, Yi = 12, ye = 20, ni = class ni extends Kt {
4854
4841
  class="event-detail-title-input"
4855
4842
  .value=${t.title}
4856
4843
  placeholder="Event title"
4857
- @input=${(x) => {
4858
- const w = x.target.value;
4844
+ @input=${(E) => {
4845
+ const w = E.target.value;
4859
4846
  w !== t.title && (this.updateEventTimeout && clearTimeout(this.updateEventTimeout), this.updateEventTimeout = setTimeout(() => {
4860
4847
  this.dispatchEvent(
4861
4848
  new CustomEvent("update-event", {
@@ -4866,10 +4853,10 @@ const Nt = 100, me = 3e3, z = 60, Yi = 12, ye = 20, ni = class ni extends Kt {
4866
4853
  ), this.updateEventTimeout = null;
4867
4854
  }, 500));
4868
4855
  }}
4869
- @keydown=${(x) => {
4870
- if (x.key === "Enter") {
4856
+ @keydown=${(E) => {
4857
+ if (E.key === "Enter") {
4871
4858
  this.updateEventTimeout && (clearTimeout(this.updateEventTimeout), this.updateEventTimeout = null);
4872
- const $ = x.target, w = $.value;
4859
+ const $ = E.target, w = $.value;
4873
4860
  w !== t.title && this.dispatchEvent(
4874
4861
  new CustomEvent("update-event", {
4875
4862
  detail: { event: t, updates: { title: w } },
@@ -4929,7 +4916,7 @@ const Nt = 100, me = 3e3, z = 60, Yi = 12, ye = 20, ni = class ni extends Kt {
4929
4916
 
4930
4917
  ${(() => {
4931
4918
  if (!t.attendees || t.attendees.length === 0) return null;
4932
- const x = this.findCurrentUserAttendee(t), $ = x ? t.attendees.filter((w) => w !== x) : t.attendees;
4919
+ const E = this.findCurrentUserAttendee(t), $ = E ? t.attendees.filter((w) => w !== E) : t.attendees;
4933
4920
  return $.length > 0 ? _`
4934
4921
  <div class="event-detail-section">
4935
4922
  <div class="event-detail-label">Participants (${$.length})</div>
@@ -4994,8 +4981,8 @@ const Nt = 100, me = 3e3, z = 60, Yi = 12, ye = 20, ni = class ni extends Kt {
4994
4981
  .value=${t.description ?? ""}
4995
4982
  placeholder="Add description..."
4996
4983
  rows="3"
4997
- @input=${(x) => {
4998
- const w = x.target.value;
4984
+ @input=${(E) => {
4985
+ const w = E.target.value;
4999
4986
  this.updateEventTimeout && clearTimeout(this.updateEventTimeout), this.updateEventTimeout = setTimeout(() => {
5000
4987
  this.dispatchEvent(
5001
4988
  new CustomEvent("update-event", {
@@ -5009,8 +4996,8 @@ const Nt = 100, me = 3e3, z = 60, Yi = 12, ye = 20, ni = class ni extends Kt {
5009
4996
  ), this.updateEventTimeout = null;
5010
4997
  }, 500);
5011
4998
  }}
5012
- @blur=${(x) => {
5013
- const w = x.target.value;
4999
+ @blur=${(E) => {
5000
+ const w = E.target.value;
5014
5001
  this.updateEventTimeout && (clearTimeout(this.updateEventTimeout), this.updateEventTimeout = null), w !== (t.description ?? "") && this.dispatchEvent(
5015
5002
  new CustomEvent("update-event", {
5016
5003
  detail: {
@@ -5029,29 +5016,29 @@ const Nt = 100, me = 3e3, z = 60, Yi = 12, ye = 20, ni = class ni extends Kt {
5029
5016
 
5030
5017
  ${(() => {
5031
5018
  if (!t.attendees || t.attendees.length === 0) return null;
5032
- const x = this.findCurrentUserAttendee(t);
5033
- return !x || t.readOnly || t.organizer?.email === x.email ? null : _`
5019
+ const E = this.findCurrentUserAttendee(t);
5020
+ return !E || t.readOnly || t.organizer?.email === E.email ? null : _`
5034
5021
  <div class="event-detail-footer">
5035
5022
  <div class="invite-response-buttons">
5036
5023
  <button
5037
- class="invite-response-button ${x.status === "ACCEPTED" ? "active" : ""}"
5038
- @click=${() => this.updateAttendeeStatus(t, x, "ACCEPTED")}
5024
+ class="invite-response-button ${E.status === "ACCEPTED" ? "active" : ""}"
5025
+ @click=${() => this.updateAttendeeStatus(t, E, "ACCEPTED")}
5039
5026
  >
5040
5027
  Accept
5041
5028
  </button>
5042
5029
  <button
5043
- class="invite-response-button ${x.status === "TENTATIVE" ? "active" : ""}"
5030
+ class="invite-response-button ${E.status === "TENTATIVE" ? "active" : ""}"
5044
5031
  @click=${() => this.updateAttendeeStatus(
5045
5032
  t,
5046
- x,
5033
+ E,
5047
5034
  "TENTATIVE"
5048
5035
  )}
5049
5036
  >
5050
5037
  Maybe
5051
5038
  </button>
5052
5039
  <button
5053
- class="invite-response-button ${x.status === "DECLINED" ? "active" : ""}"
5054
- @click=${() => this.updateAttendeeStatus(t, x, "DECLINED")}
5040
+ class="invite-response-button ${E.status === "DECLINED" ? "active" : ""}"
5041
+ @click=${() => this.updateAttendeeStatus(t, E, "DECLINED")}
5055
5042
  >
5056
5043
  Decline
5057
5044
  </button>
@@ -5554,6 +5541,7 @@ ni.styles = zi`
5554
5541
  display: flex;
5555
5542
  flex-direction: column;
5556
5543
  gap: 16px;
5544
+ background: var(--bg-secondary, rgba(36, 36, 38, 0.5));
5557
5545
  }
5558
5546
 
5559
5547
  .event-detail-section {
@@ -5949,7 +5937,7 @@ De.SYNC_INTERVAL_MS = 300 * 1e3;
5949
5937
  let Li = De;
5950
5938
  export {
5951
5939
  Li as CalendarIntegration,
5952
- U as CalendarInternal,
5940
+ N as CalendarInternal,
5953
5941
  Ni as CalendarViewElement,
5954
5942
  Vs as InMemorySource,
5955
5943
  As as NOTIFICATION_PRESETS
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@luckydye/calendar",
3
- "version": "1.2.2",
3
+ "version": "1.2.3",
4
4
  "author": "Tim Havlicek",
5
5
  "contributors": [],
6
6
  "description": "",