@weekwise/react 0.2.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,45 +1,45 @@
1
1
  "use client";
2
2
  import { createContext as e, startTransition as t, useCallback as n, useContext as r, useEffect as i, useId as a, useInsertionEffect as o, useLayoutEffect as s, useMemo as c, useReducer as l, useRef as u, useState as d, useSyncExternalStore as f } from "react";
3
- import { MONTH_WEEK_GEOMETRY as p, ROW_HEIGHTS as m, Rect as h, THEME_PROPERTIES as g, add as _, adjustScrollRect as v, applyMoveTransformModifiers as y, arrangeEventsByDay as b, arrangeMonthWeek as x, boundingDraggableContainerModifier as S, boundingResizableContainerModifier as C, buildEventMap as w, buildTimeRows as T, builtInMessages as E, cx as D, defaultCoordinates as O, emptyArray as k, formatMonthYear as ee, formatNowOffset as A, formatTimelineRange as j, fromDayMinutes as M, getCalendarSize as N, getClientRect as P, getEventTimeFrameFromInfo as F, getHiddenEvents as I, getMonthGrid as L, getMonthLaneCount as R, getNavigationTarget as z, getNowOffset as B, getRevealScrollTop as te, getScrollCoordinates as V, getScrollDirectionAndSpeed as ne, getScrollOffsets as H, getScrollableAncestors as re, getScrollableElement as ie, getTimeFrame as ae, getTimeStepEqualizerModifier as oe, getTimelineRange as se, getViewChangeTarget as ce, getViewHeading as le, getVisibleDays as ue, getWeekdayNames as de, getWindow as fe, isDevEnvironment as U, isHTMLElement as pe, isInViewPeriod as me, isNotNull as he, isPastDay as ge, match as _e, mergeCallbacks as ve, normalizeViewValue as ye, omit as be, resizeEventDays as xe, resizeEventRange as Se, resolveMessages as Ce, resolveMessages as we, round as Te, shallowEqual as Ee, splitIntoDays as De, subtract as Oe, toDayMinutes as ke, transferDay as Ae } from "@weekwise/core";
4
- import { createDragAndDropApi as je } from "@weekwise/dnd";
5
- import { DragAndDropContext as Me, useDragAndDrop as Ne } from "@weekwise/dnd/react";
6
- import { autoUpdate as Pe, flip as Fe, offset as Ie, shift as Le, useFloating as Re } from "@floating-ui/react-dom";
7
- import { Fragment as ze, jsx as W, jsxs as G } from "react/jsx-runtime";
8
- import { createPortal as Be } from "react-dom";
3
+ import { MONTH_WEEK_GEOMETRY as p, ROW_HEIGHTS as m, Rect as h, THEME_PROPERTIES as g, TOUCH_HOLD_DELAY as _, add as v, adjustScrollRect as y, applyMoveTransformModifiers as b, arrangeEventsByDay as x, arrangeMonthWeek as S, boundingDraggableContainerModifier as C, boundingResizableContainerModifier as w, buildEventMap as T, buildTimeRows as E, builtInMessages as D, cx as O, defaultCoordinates as k, emptyArray as A, formatMonthYear as j, formatNowOffset as M, formatTimelineRange as N, fromDayMinutes as ee, getCalendarSize as P, getClientRect as F, getEventTimeFrameFromInfo as I, getHiddenEvents as L, getMonthGrid as R, getMonthLaneCount as z, getNavigationTarget as B, getNowOffset as V, getRevealScrollTop as te, getScrollCoordinates as H, getScrollDirectionAndSpeed as ne, getScrollOffsets as re, getScrollableAncestors as ie, getScrollableElement as ae, getTimeFrame as oe, getTimeStepEqualizerModifier as se, getTimelineRange as ce, getViewChangeTarget as le, getViewHeading as ue, getVisibleDays as de, getWeekdayNames as fe, getWindow as pe, isDevEnvironment as U, isHTMLElement as me, isInViewPeriod as he, isNotNull as ge, isPastDay as _e, match as ve, mergeCallbacks as ye, normalizeViewValue as be, omit as xe, resizeEventDays as Se, resizeEventRange as Ce, resolveMessages as we, resolveMessages as Te, round as Ee, shallowEqual as De, splitIntoDays as Oe, subtract as ke, toDayMinutes as Ae, transferDay as je } from "@weekwise/core";
4
+ import { createDragAndDropApi as Me } from "@weekwise/dnd";
5
+ import { DragAndDropContext as Ne, useDragAndDrop as Pe } from "@weekwise/dnd/react";
6
+ import { autoUpdate as Fe, flip as Ie, offset as Le, shift as Re, useFloating as ze } from "@floating-ui/react-dom";
7
+ import { Fragment as Be, jsx as W, jsxs as G } from "react/jsx-runtime";
8
+ import { createPortal as Ve } from "react-dom";
9
9
  // src/date-localization/DateLocalizationContext.ts
10
- var Ve = e(void 0);
11
- U && (Ve.displayName = "DateLocalizationContext");
10
+ var He = e(void 0);
11
+ U && (He.displayName = "DateLocalizationContext");
12
12
  // src/date-localization/useDateUtils.ts
13
- function He() {
14
- let e = r(Ve);
13
+ function Ue() {
14
+ let e = r(He);
15
15
  if (!e) throw Error("DateLocalizationContext is required");
16
16
  return e;
17
17
  }
18
18
  function K() {
19
- return He();
19
+ return Ue();
20
20
  }
21
21
  // src/date-localization/MessagesContext.ts
22
- var Ue = e(void 0);
23
- U && (Ue.displayName = "MessagesContext");
22
+ var We = e(void 0);
23
+ U && (We.displayName = "MessagesContext");
24
24
  // src/date-localization/DateLocalizationProvider.tsx
25
- function We(e) {
26
- let { adapter: t, messages: n, children: r } = e, i = c(() => typeof t == "function" ? new t() : t, [t]), a = c(() => we(i.locale, n), [i.locale, n]);
27
- return /* @__PURE__ */ W(Ve.Provider, {
25
+ function Ge(e) {
26
+ let { adapter: t, messages: n, children: r } = e, i = c(() => typeof t == "function" ? new t() : t, [t]), a = c(() => Te(i.locale, n), [i.locale, n]);
27
+ return /* @__PURE__ */ W(He.Provider, {
28
28
  value: i,
29
- children: /* @__PURE__ */ W(Ue.Provider, {
29
+ children: /* @__PURE__ */ W(We.Provider, {
30
30
  value: a,
31
31
  children: r
32
32
  })
33
33
  });
34
34
  }
35
35
  // src/date-localization/useMessages.ts
36
- function Ge() {
37
- let e = r(Ue), t = He();
38
- return e ?? we(t.locale);
36
+ function Ke() {
37
+ let e = r(We), t = Ue();
38
+ return e ?? Te(t.locale);
39
39
  }
40
- var Ke = typeof window < "u" ? s : i;
40
+ var qe = typeof window < "u" ? s : i;
41
41
  // src/hooks/useResizeObserver.ts
42
- function qe(e, t = !1) {
42
+ function Je(e, t = !1) {
43
43
  let n = u(e);
44
44
  n.current = e;
45
45
  let r = c(() => {
@@ -50,36 +50,36 @@ function qe(e, t = !1) {
50
50
  return i(() => () => r?.disconnect(), [r]), r;
51
51
  }
52
52
  // src/hooks/useCalendarSize.ts
53
- function Je(e) {
54
- let [t, n] = d("regular"), r = qe(([e]) => {
53
+ function Ye(e) {
54
+ let [t, n] = d("regular"), r = Je(([e]) => {
55
55
  if (!e) return;
56
56
  let t = e.borderBoxSize?.[0]?.inlineSize ?? e.contentRect.width;
57
- n(N(t));
57
+ n(P(t));
58
58
  });
59
- return Ke(() => {
59
+ return qe(() => {
60
60
  let t = e.current;
61
- if (t) return n(N(t.getBoundingClientRect().width)), r?.observe(t), () => r?.unobserve(t);
61
+ if (t) return n(P(t.getBoundingClientRect().width)), r?.observe(t), () => r?.unobserve(t);
62
62
  }, [r, e]), t;
63
63
  }
64
64
  // src/hooks/useCurrentRef.ts
65
- function Ye(e) {
65
+ function Xe(e) {
66
66
  let t = u(e);
67
67
  return t.current = e, t;
68
68
  }
69
69
  // src/hooks/useComputed.ts
70
- function Xe(e, t) {
71
- let n = u(void 0), r = Ye(e);
70
+ function Ze(e, t) {
71
+ let n = u(void 0), r = Xe(e);
72
72
  return c(() => {
73
73
  let e = r.current(n.current);
74
74
  return n.current = e, e;
75
75
  }, t);
76
76
  }
77
77
  // src/hooks/useControlled.utils.ts
78
- function Ze(e) {
78
+ function Qe(e) {
79
79
  let [t] = d(() => e !== void 0);
80
80
  return t;
81
81
  }
82
- function Qe(e, t, n, r) {
82
+ function $e(e, t, n, r) {
83
83
  let a = u(/* @__PURE__ */ Error());
84
84
  i(() => {
85
85
  if (e !== (t !== void 0)) throw Error(`
@@ -103,9 +103,9 @@ function Qe(e, t, n, r) {
103
103
  ]);
104
104
  }
105
105
  // src/hooks/useControlled.ts
106
- function $e(e) {
107
- let { controlled: t, default: r } = e, [i, a] = d(() => r === void 0 && "initialState" in e && e.initialState !== void 0 ? e.initialState : r), [o] = d(r), s = Ze(t);
108
- U && Qe(s, t, o, r);
106
+ function et(e) {
107
+ let { controlled: t, default: r } = e, [i, a] = d(() => r === void 0 && "initialState" in e && e.initialState !== void 0 ? e.initialState : r), [o] = d(r), s = Qe(t);
108
+ U && $e(s, t, o, r);
109
109
  let c = n((e) => {
110
110
  s || a(e);
111
111
  }, [s]);
@@ -116,7 +116,7 @@ function $e(e) {
116
116
  ];
117
117
  }
118
118
  // src/hooks/useDocumentCursor.ts
119
- function et(e) {
119
+ function tt(e) {
120
120
  i(() => {
121
121
  if (!e) return;
122
122
  let t = `ww-cursor-${e}`, n = document.documentElement;
@@ -124,19 +124,19 @@ function et(e) {
124
124
  }, [e]);
125
125
  }
126
126
  // src/hooks/useRefWithInit.ts
127
- var tt = {};
128
- function nt(e, t) {
129
- let n = u(tt);
130
- return n.current === tt && (n.current = e(t)), n;
127
+ var nt = {};
128
+ function rt(e, t) {
129
+ let n = u(nt);
130
+ return n.current === nt && (n.current = e(t)), n;
131
131
  }
132
132
  // src/hooks/useEventCallback.utils.ts
133
- function rt() {
133
+ function it() {
134
134
  if (U) throw Error("useEventCallback: Cannot call an event handler while rendering.");
135
135
  }
136
- function it() {
136
+ function at() {
137
137
  let e = {
138
138
  next: void 0,
139
- callback: rt,
139
+ callback: it,
140
140
  trampoline: (...t) => e.callback?.(...t),
141
141
  effect: () => {
142
142
  e.callback = e.next;
@@ -146,11 +146,11 @@ function it() {
146
146
  }
147
147
  // src/hooks/useEventCallback.ts
148
148
  function q(e) {
149
- let t = nt(it).current;
149
+ let t = rt(at).current;
150
150
  return t.next = e, o(t.effect), t.trampoline;
151
151
  }
152
152
  // src/hooks/useGlobalListeners.ts
153
- function at() {
153
+ function ot() {
154
154
  let [e] = d(() => ({ current: /* @__PURE__ */ new Map() })), { addGlobalListener: t, removeGlobalListener: n, removeAllGlobalListeners: r } = c(() => {
155
155
  function t(t, n, r, i) {
156
156
  let a = typeof i != "boolean" && i?.once ? (n) => {
@@ -184,35 +184,84 @@ function at() {
184
184
  removeAllGlobalListeners: r
185
185
  };
186
186
  }
187
+ // src/hooks/useItemsLayout.ts
188
+ function st(e, t) {
189
+ let n = rt(ct, {
190
+ containerRef: e,
191
+ itemsRef: t
192
+ }).current;
193
+ return i(() => n.release, [n]), n;
194
+ }
195
+ function ct({ containerRef: e, itemsRef: t }) {
196
+ let n = null, r = [], i = null;
197
+ function a() {
198
+ let i = e.current;
199
+ if (!i) return !1;
200
+ let a = new h(F(i), i);
201
+ return n = a, r = t.current.map((e) => {
202
+ if (!e) return null;
203
+ let { left: t, top: n, right: r, bottom: i } = e.getBoundingClientRect();
204
+ return {
205
+ left: t - a.left,
206
+ top: n - a.top,
207
+ right: r - a.left,
208
+ bottom: i - a.top
209
+ };
210
+ }), !0;
211
+ }
212
+ return {
213
+ measure() {
214
+ return a() ? (typeof ResizeObserver < "u" && e.current && (i ??= new ResizeObserver(() => {
215
+ n && a();
216
+ }), i.observe(e.current)), !0) : !1;
217
+ },
218
+ release() {
219
+ i?.disconnect(), n = null, r = [];
220
+ },
221
+ container: () => n,
222
+ nearestIndex(e, t, i = "xy") {
223
+ if (!n) return -1;
224
+ let a = e - n.left, o = t - n.top, s = -1, c = 1e400;
225
+ return r.forEach((e, t) => {
226
+ if (!e) return;
227
+ let n = a < e.left ? e.left - a : a >= e.right ? a - e.right : 0, r = i === "x" ? 0 : o < e.top ? e.top - o : o >= e.bottom ? o - e.bottom : 0, l = Math.hypot(n, r);
228
+ l < c && (c = l, s = t);
229
+ }), s;
230
+ }
231
+ };
232
+ }
187
233
  // src/utils/mergeRefs.ts
188
- var ot = (e) => !e || typeof e == "function" ? e : (t) => {
234
+ var lt = (e) => !e || typeof e == "function" ? e : (t) => {
189
235
  e.current = t;
190
236
  };
191
- function st(...e) {
237
+ function ut(...e) {
192
238
  return (t) => {
193
239
  e.forEach((e) => {
194
- ot(e)?.(t);
240
+ lt(e)?.(t);
195
241
  });
196
242
  };
197
243
  }
198
244
  // src/hooks/useMergedRefs.ts
199
- function ct(...e) {
200
- return c(() => st(...e), e);
245
+ function dt(...e) {
246
+ return c(() => ut(...e), e);
201
247
  }
202
248
  // src/hooks/useMove.ts
203
- function lt(e) {
249
+ function ft(e) {
204
250
  let [{ state: t }] = d(() => ({ state: {
205
251
  activePointId: null,
206
252
  clientX: 0,
207
253
  clientY: 0,
208
254
  initialClientX: 0,
209
255
  initialClientY: 0,
210
- isDistanceReached: !1
256
+ isDistanceReached: !1,
257
+ holdTimer: null,
258
+ isTouchActive: !1
211
259
  } })), n = u(e);
212
260
  n.current = e;
213
- let { addGlobalListener: r, removeGlobalListener: i } = at();
214
- return { listeners: c(() => {
215
- let e = {}, a = (e) => {
261
+ let { addGlobalListener: r, removeGlobalListener: a } = ot();
262
+ i(() => () => ht(t), [t]);
263
+ let { listeners: o, ref: s } = c(() => {
264
+ let e = {}, i = (e) => {
216
265
  "stopPropagation" in e && "preventDefault" in e && (e.stopPropagation(), e.preventDefault());
217
266
  }, o = (e, r) => {
218
267
  let { current: { distance: i = 0, ...a } } = n, { clientX: o, clientY: s } = e, { clientX: c, clientY: l } = t;
@@ -261,7 +310,7 @@ function lt(e) {
261
310
  e.button === 0 && o(e).end("mouse", e);
262
311
  };
263
312
  e.onMouseDown = (e) => {
264
- e.button === 0 && (o(e).start("mouse", e) === !1 ? o(e, null) : (r(window, "mousemove", n, !1), r(window, "mouseup", s, !1), a(e)));
313
+ e.button === 0 && (o(e).start("mouse", e) === !1 ? o(e, null) : (r(window, "mousemove", n, !1), r(window, "mouseup", s, !1), i(e)));
265
314
  };
266
315
  let c = (e) => {
267
316
  let n = [...e.changedTouches].findIndex(({ identifier: e }) => e === t.activePointId);
@@ -271,30 +320,52 @@ function lt(e) {
271
320
  }
272
321
  }, l = (e) => {
273
322
  let n = [...e.changedTouches].findIndex(({ identifier: e }) => e === t.activePointId);
274
- n >= 0 && (o(e.changedTouches[n], null).end("touch", e), r(window, "touchmove", c), i(window, "touchend", l), i(window, "touchcancel", l));
323
+ n >= 0 && (o(e.changedTouches[n], null).end("touch", e), a(window, "touchmove", c, !1), a(window, "touchend", l), a(window, "touchcancel", l));
275
324
  };
276
325
  e.onTouchStart = (e) => {
277
326
  if (e.changedTouches.length === 0 || t.activePointId !== null) return;
278
327
  let n = e.changedTouches[0];
279
- o(n, n.identifier).start("touch", e) === !1 ? o(n, null) : (r(window, "touchmove", c, !1), r(window, "touchend", l, !1), r(window, "touchcancel", l, !1), a(e));
328
+ o(n, n.identifier).start("touch", e) === !1 ? o(n, null) : (r(window, "touchmove", c, !1), r(window, "touchend", l, !1), r(window, "touchcancel", l, !1), i(e));
280
329
  };
281
330
  } else {
282
- let n = (e) => {
283
- if (e.pointerId === t.activePointId) {
284
- let t = e.pointerType || "mouse";
285
- o(e).move(t, e);
331
+ let s = () => {
332
+ a(window, "pointermove", l, !1), a(window, "pointerup", u, !1), a(window, "pointercancel", u, !1);
333
+ }, c = () => {
334
+ ht(t), s(), o(t, null);
335
+ }, l = (e) => {
336
+ if (e.pointerId !== t.activePointId) return;
337
+ if (t.holdTimer !== null) {
338
+ let n = e.clientX - t.initialClientX, r = e.clientY - t.initialClientY;
339
+ n ** 2 + r ** 2 > mt ** 2 ? c() : o(e);
340
+ return;
286
341
  }
287
- }, s = (e) => {
288
- if (e.pointerId === t.activePointId) {
289
- let t = e.pointerType || "mouse";
290
- o(e, null).end(t, e), i(window, "pointermove", n, !1), i(window, "pointerup", s, !1), i(window, "pointercancel", s, !1);
342
+ let n = e.pointerType || "mouse";
343
+ o(e).move(n, e);
344
+ }, u = (e) => {
345
+ if (e.pointerId !== t.activePointId) return;
346
+ if (t.holdTimer !== null) {
347
+ c();
348
+ return;
291
349
  }
292
- };
350
+ let n = e.pointerType || "mouse";
351
+ t.isTouchActive = !1, o(e, null).end(n, e), s();
352
+ }, d = (e, n) => o(t).start(e, n) !== !1 && (t.isTouchActive = e === "touch", !0);
293
353
  e.onPointerDown = (e) => {
294
- if (e.button === 0 && t.activePointId === null) {
295
- let t = e.pointerType || "mouse";
296
- o(e, e.pointerId).start(t, e) === !1 ? o(e, null) : (r(window, "pointermove", n, !1), r(window, "pointerup", s, !1), r(window, "pointercancel", s, !1), a(e));
354
+ if (e.button !== 0 || t.activePointId !== null) return;
355
+ let a = e.pointerType || "mouse", { touchDelay: s = 0 } = n.current;
356
+ if (o(e, e.pointerId), a === "touch" && s > 0) {
357
+ t.initialClientX = e.clientX, t.initialClientY = e.clientY;
358
+ let n = e.nativeEvent;
359
+ t.holdTimer = setTimeout(() => {
360
+ t.holdTimer = null, d(a, n) ? "vibrate" in navigator && navigator.vibrate(pt) : c();
361
+ }, s);
362
+ } else if (!d(a, e)) {
363
+ o(e, null);
364
+ return;
297
365
  }
366
+ r(window, "pointermove", l, !1), r(window, "pointerup", u, !1), r(window, "pointercancel", u, !1), i(e);
367
+ }, e.onContextMenu = (e) => {
368
+ (t.holdTimer !== null || t.isTouchActive) && e.preventDefault();
298
369
  };
299
370
  }
300
371
  let s = (e, t, n) => {
@@ -307,39 +378,72 @@ function lt(e) {
307
378
  clientY: 0
308
379
  }, null);
309
380
  };
310
- return e.onKeyDown = (e) => {
381
+ e.onKeyDown = (e) => {
311
382
  switch (e.key) {
312
383
  case "Left":
313
384
  case "ArrowLeft":
314
- a(e), s(e, -1, 0);
385
+ i(e), s(e, -1, 0);
315
386
  break;
316
387
  case "Right":
317
388
  case "ArrowRight":
318
- a(e), s(e, 1, 0);
389
+ i(e), s(e, 1, 0);
319
390
  break;
320
391
  case "Up":
321
392
  case "ArrowUp":
322
- a(e), s(e, 0, -1);
393
+ i(e), s(e, 0, -1);
323
394
  break;
324
395
  case "Down":
325
- case "ArrowDown": a(e), s(e, 0, 1);
396
+ case "ArrowDown": i(e), s(e, 0, 1);
397
+ }
398
+ };
399
+ let c = (e) => {
400
+ t.isTouchActive && e.cancelable && e.preventDefault();
401
+ }, l = { target: null };
402
+ return {
403
+ listeners: e,
404
+ ref: (e) => {
405
+ l.target && a(l.target, "touchmove", c), l.target = e, e && r(e, "touchmove", c, { passive: !1 });
326
406
  }
327
- }, e;
407
+ };
328
408
  }, [
329
409
  r,
330
- i,
410
+ a,
331
411
  t
332
- ]) };
412
+ ]);
413
+ return {
414
+ listeners: o,
415
+ ref: s
416
+ };
417
+ }
418
+ var pt = 10, mt = 10;
419
+ function ht(e) {
420
+ e.holdTimer !== null && (clearTimeout(e.holdTimer), e.holdTimer = null);
333
421
  }
334
422
  // src/hooks/usePrevious.ts
335
- function ut(e) {
423
+ function gt(e) {
336
424
  let t = u(void 0);
337
425
  return i(() => {
338
426
  t.current = e;
339
427
  }, [e]), t.current;
340
428
  }
429
+ // src/hooks/useRefList.ts
430
+ function _t() {
431
+ return rt(vt).current;
432
+ }
433
+ function vt() {
434
+ let e = [], t = /* @__PURE__ */ new Map();
435
+ return {
436
+ elements: { current: e },
437
+ refAt(n) {
438
+ let r = t.get(n);
439
+ return r || (r = (t) => {
440
+ e[n] = t;
441
+ }, t.set(n, r)), r;
442
+ }
443
+ };
444
+ }
341
445
  // src/hooks/useScrollBarSize.ts
342
- function dt() {
446
+ function yt() {
343
447
  let e = null, n = 0, r = (t) => (n += 1, e === null && (e = document.createElement("div"), e.style.width = "99px", e.style.height = "99px", e.style.overflow = "scroll", e.style.position = "absolute", e.style.top = "-9999px", e.setAttribute("aria-hidden", "true"), e.setAttribute("role", "presentation"), document.body.appendChild(e), window.addEventListener("resize", t)), {
344
448
  element: e,
345
449
  cleanup: () => {
@@ -351,7 +455,7 @@ function dt() {
351
455
  height: 0,
352
456
  width: 0
353
457
  });
354
- return Ke(() => {
458
+ return qe(() => {
355
459
  let e = () => {
356
460
  let e = i.offsetHeight - i.clientHeight, r = i.offsetWidth - i.clientWidth;
357
461
  t(() => {
@@ -368,9 +472,9 @@ function dt() {
368
472
  }, []), e;
369
473
  };
370
474
  }
371
- var ft = dt();
475
+ var bt = yt();
372
476
  // src/hooks/useStateRef.ts
373
- function pt(e) {
477
+ function xt(e) {
374
478
  let [t, r] = d(e), i = u(e);
375
479
  return [
376
480
  t,
@@ -381,8 +485,8 @@ function pt(e) {
381
485
  ];
382
486
  }
383
487
  // src/hooks/useTimeInterval.ts
384
- function mt(e, t, n = !0) {
385
- let r = u(null), a = Ye(e);
488
+ function St(e, t, n = !0) {
489
+ let r = u(null), a = Xe(e);
386
490
  i(() => {
387
491
  if (n) {
388
492
  let e = /* @__PURE__ */ new Date(), n = t - (e.getMinutes() * 60 + e.getSeconds()) * 1e3 % t;
@@ -400,55 +504,55 @@ function mt(e, t, n = !0) {
400
504
  ]);
401
505
  }
402
506
  // src/hooks/useToday.ts
403
- var ht = (e) => e.toMillis(e.getToday());
404
- function gt() {
507
+ var Ct = (e) => e.toMillis(e.getToday());
508
+ function wt() {
405
509
  let e = K(), [t, n] = d(() => ({
406
510
  dateUtils: e,
407
- today: ht(e)
511
+ today: Ct(e)
408
512
  })), r = t;
409
513
  t.dateUtils !== e && (r = {
410
514
  dateUtils: e,
411
- today: ht(e)
515
+ today: Ct(e)
412
516
  }, n(r));
413
517
  let { today: a } = r;
414
518
  return i(() => {
415
519
  let t = e.toMillis(e.addDays(e.fromMillis(a), 1)), r = Math.max(t - Date.now(), 0) + 1e3, i = setTimeout(() => n({
416
520
  dateUtils: e,
417
- today: ht(e)
521
+ today: Ct(e)
418
522
  }), r);
419
523
  return () => clearTimeout(i);
420
524
  }, [e, a]), a;
421
525
  }
422
526
  // src/contexts/CalendarContext.ts
423
- var _t = e(void 0);
424
- U && (_t.displayName = "CalendarContext");
527
+ var Tt = e(void 0);
528
+ U && (Tt.displayName = "CalendarContext");
425
529
  function J() {
426
- let e = r(_t);
530
+ let e = r(Tt);
427
531
  if (!e) throw Error("CalendarContext is required");
428
532
  return e;
429
533
  }
430
534
  // src/contexts/ThemeSourceContext.ts
431
- var vt = e(null);
432
- U && (vt.displayName = "ThemeSourceContext");
535
+ var Et = e(null);
536
+ U && (Et.displayName = "ThemeSourceContext");
433
537
  // src/hooks/useCalendarValue.ts
434
- function yt(e) {
435
- let { view: t, defaultView: r, startWeek: a, viewValue: o, defaultViewValue: s, dateUtils: c, onChangeView: l, onChangeViewValue: d } = e, [f, p] = $e({
538
+ function Dt(e) {
539
+ let { view: t, defaultView: r, startWeek: a, viewValue: o, defaultViewValue: s, dateUtils: c, onChangeView: l, onChangeViewValue: d } = e, [f, p] = et({
436
540
  controlled: t,
437
541
  default: r,
438
542
  initialState: "week"
439
- }), m = n((e, t) => ye(c, e, t, a), [c, a]), [h, g] = $e({
543
+ }), m = n((e, t) => be(c, e, t, a), [c, a]), [h, g] = et({
440
544
  controlled: o,
441
545
  default: s,
442
546
  initialState: m(f)
443
547
  }), _ = q((e, t) => {
444
548
  g(e), d?.(e, t);
445
- }), v = q(ve((e) => {
549
+ }), v = q(ye((e) => {
446
550
  p(e);
447
- }, l)), y = Ye(h), b = u(f), x = u(a), S = u(c);
551
+ }, l)), y = Xe(h), b = u(f), x = u(a), S = u(c);
448
552
  return i(() => {
449
- let e = b.current, t = x.current !== a, n = S.current, r = n === c ? y.current : Ae(n, c, y.current);
553
+ let e = b.current, t = x.current !== a, n = S.current, r = n === c ? y.current : je(n, c, y.current);
450
554
  b.current = f, x.current = a, S.current = c;
451
- let i = e === f && !t ? m(f, r) : ce(c, e, f, r, a);
555
+ let i = e === f && !t ? m(f, r) : le(c, e, f, r, a);
452
556
  _(i, f);
453
557
  }, [
454
558
  m,
@@ -465,8 +569,8 @@ function yt(e) {
465
569
  };
466
570
  }
467
571
  // src/hooks/useNavigation.ts
468
- function bt(e) {
469
- let { dateUtils: t, view: n, viewValue: r, changeViewValue: i, startWeek: a } = e, o = (e, r) => () => i(z(t, n, e, r, a), n);
572
+ function Ot(e) {
573
+ let { dateUtils: t, view: n, viewValue: r, changeViewValue: i, startWeek: a } = e, o = (e, r) => () => i(B(t, n, e, r, a), n);
470
574
  return {
471
575
  goForward: q(o(r, 1)),
472
576
  goBackward: q(o(r, -1)),
@@ -474,7 +578,7 @@ function bt(e) {
474
578
  };
475
579
  }
476
580
  // src/icons/chevron.tsx
477
- function xt(e) {
581
+ function kt(e) {
478
582
  return /* @__PURE__ */ W("svg", {
479
583
  xmlns: "http://www.w3.org/2000/svg",
480
584
  fill: "none",
@@ -489,11 +593,11 @@ function xt(e) {
489
593
  });
490
594
  }
491
595
  // src/portal/Portal.tsx
492
- var St = () => () => {}, Ct = () => !0, wt = () => !1;
493
- function Tt() {
494
- return f(St, Ct, wt);
596
+ var At = () => () => {}, jt = () => !0, Mt = () => !1;
597
+ function Nt() {
598
+ return f(At, jt, Mt);
495
599
  }
496
- function Et(e) {
600
+ function Pt(e) {
497
601
  let t = { display: "contents" };
498
602
  if (!e) return t;
499
603
  let n = getComputedStyle(e);
@@ -503,43 +607,43 @@ function Et(e) {
503
607
  }
504
608
  return t;
505
609
  }
506
- function Dt({ children: e, container: t }) {
507
- let n = Tt(), i = r(vt);
508
- return n ? t ? Be(e, t) : Be(/* @__PURE__ */ W("div", {
509
- style: Et(i?.current),
610
+ function Ft({ children: e, container: t }) {
611
+ let n = Nt(), i = r(Et);
612
+ return n ? t ? Ve(e, t) : Ve(/* @__PURE__ */ W("div", {
613
+ style: Pt(i?.current),
510
614
  children: e
511
615
  }), document.body) : null;
512
616
  }
513
617
  var Y = {
514
- root: "_root_1aojr_1",
515
- root__toggle: "_root__toggle_1aojr_6",
516
- root__toggleLabel: "_root__toggleLabel_1aojr_30",
517
- root__toggleIcon: "_root__toggleIcon_1aojr_37",
518
- root__toggleIcon_open: "_root__toggleIcon_open_1aojr_43",
519
- popover: "_popover_1aojr_47",
520
- popover__header: "_popover__header_1aojr_71",
521
- popover__title: "_popover__title_1aojr_93",
522
- popover__navBackward: "_popover__navBackward_1aojr_98",
523
- popover__navForward: "_popover__navForward_1aojr_102",
524
- popover__grid: "_popover__grid_1aojr_106",
525
- popover__weekday: "_popover__weekday_1aojr_112",
526
- popover__day: "_popover__day_1aojr_122",
527
- popover__day_outside: "_popover__day_outside_1aojr_140",
528
- popover__day_selected: "_popover__day_selected_1aojr_145",
529
- popover__day_rangeStart: "_popover__day_rangeStart_1aojr_152",
530
- popover__day_rangeEnd: "_popover__day_rangeEnd_1aojr_157",
531
- popover__day_today: "_popover__day_today_1aojr_162"
618
+ root: "_root_39am3_1",
619
+ root__toggle: "_root__toggle_39am3_6",
620
+ root__toggleLabel: "_root__toggleLabel_39am3_30",
621
+ root__toggleIcon: "_root__toggleIcon_39am3_37",
622
+ root__toggleIcon_open: "_root__toggleIcon_open_39am3_43",
623
+ popover: "_popover_39am3_47",
624
+ popover__header: "_popover__header_39am3_73",
625
+ popover__title: "_popover__title_39am3_95",
626
+ popover__navBackward: "_popover__navBackward_39am3_100",
627
+ popover__navForward: "_popover__navForward_39am3_104",
628
+ popover__grid: "_popover__grid_39am3_108",
629
+ popover__weekday: "_popover__weekday_39am3_114",
630
+ popover__day: "_popover__day_39am3_124",
631
+ popover__day_outside: "_popover__day_outside_39am3_142",
632
+ popover__day_selected: "_popover__day_selected_39am3_147",
633
+ popover__day_rangeStart: "_popover__day_rangeStart_39am3_154",
634
+ popover__day_rangeEnd: "_popover__day_rangeEnd_39am3_159",
635
+ popover__day_today: "_popover__day_today_39am3_164"
532
636
  };
533
637
  // src/components/date-navigator/DateNavigator.tsx
534
- function Ot({ renderHeading: e, type: t = "button", onClick: n, onKeyDown: r, className: a, ...o }) {
535
- let { view: s, viewValue: l, changeViewValue: f, startWeek: p } = J(), m = K(), h = Ge(), { getStartOfWeek: g, getStartOfMonth: _, addMonths: v } = m, [y, b] = d(!1), [x, S] = d(() => _(l)), C = u(null), { refs: w, floatingStyles: T } = Re({
638
+ function It({ renderHeading: e, type: t = "button", onClick: n, onKeyDown: r, className: a, ...o }) {
639
+ let { view: s, viewValue: l, changeViewValue: f, startWeek: p } = J(), m = K(), h = Ke(), { getStartOfWeek: g, getStartOfMonth: _, addMonths: v } = m, [y, b] = d(!1), [x, S] = d(() => _(l)), C = u(null), { addGlobalListener: w, removeGlobalListener: T } = ot(), { refs: E, floatingStyles: D } = ze({
536
640
  placement: "bottom",
537
641
  middleware: [
538
- Ie(6),
539
- Fe({ padding: 8 }),
540
- Le({ padding: 8 })
642
+ Le(6),
643
+ Ie({ padding: 8 }),
644
+ Re({ padding: 8 })
541
645
  ],
542
- whileElementsMounted: Pe
646
+ whileElementsMounted: Fe
543
647
  });
544
648
  i(() => {
545
649
  y && S(_(l));
@@ -551,25 +655,30 @@ function Ot({ renderHeading: e, type: t = "button", onClick: n, onKeyDown: r, cl
551
655
  if (!y) return;
552
656
  let e = (e) => {
553
657
  let t = e.target;
554
- C.current?.contains(t) || w.floating.current?.contains(t) || b(!1);
658
+ C.current?.contains(t) || E.floating.current?.contains(t) || b(!1);
555
659
  };
556
- return document.addEventListener("pointerdown", e), () => document.removeEventListener("pointerdown", e);
557
- }, [y, w.floating]);
558
- let E = c(() => e ? e(l, s) : le(m, s, l, p), [
660
+ return w(document, "pointerdown", e), () => T(document, "pointerdown", e);
661
+ }, [
662
+ w,
663
+ y,
664
+ E.floating,
665
+ T
666
+ ]);
667
+ let k = c(() => e ? e(l, s) : ue(m, s, l, p), [
559
668
  m,
560
669
  e,
561
670
  p,
562
671
  s,
563
672
  l
564
- ]), O = c(() => L(m, x, p), [
673
+ ]), A = c(() => R(m, x, p), [
565
674
  m,
566
675
  x,
567
676
  p
568
- ]), k = (e) => {
677
+ ]), M = (e) => {
569
678
  n?.(e), b((e) => !e);
570
- }, A = (e) => {
679
+ }, N = (e) => {
571
680
  r?.(e), e.key === "Escape" && b(!1);
572
- }, j = (e) => {
681
+ }, ee = (e) => {
573
682
  f(s === "week" ? g(e, p) : e, s), b(!1);
574
683
  };
575
684
  return /* @__PURE__ */ G("div", {
@@ -581,17 +690,17 @@ function Ot({ renderHeading: e, type: t = "button", onClick: n, onKeyDown: r, cl
581
690
  "aria-expanded": y,
582
691
  "aria-haspopup": "dialog",
583
692
  ...o,
584
- onClick: k,
585
- onKeyDown: A,
586
- ref: w.setReference,
587
- className: D(a, Y.root__toggle),
693
+ onClick: M,
694
+ onKeyDown: N,
695
+ ref: E.setReference,
696
+ className: O(a, Y.root__toggle),
588
697
  children: [/* @__PURE__ */ W("span", {
589
698
  className: Y.root__toggleLabel,
590
- children: E
591
- }), /* @__PURE__ */ W(xt, { className: D(Y.root__toggleIcon, { [Y.root__toggleIcon_open]: y }) })]
592
- }), y && /* @__PURE__ */ W(Dt, { children: /* @__PURE__ */ G("div", {
593
- ref: w.setFloating,
594
- style: T,
699
+ children: k
700
+ }), /* @__PURE__ */ W(kt, { className: O(Y.root__toggleIcon, { [Y.root__toggleIcon_open]: y }) })]
701
+ }), y && /* @__PURE__ */ W(Ft, { children: /* @__PURE__ */ G("div", {
702
+ ref: E.setFloating,
703
+ style: D,
595
704
  role: "dialog",
596
705
  "aria-label": h.chooseDate,
597
706
  className: Y.popover,
@@ -602,30 +711,30 @@ function Ot({ renderHeading: e, type: t = "button", onClick: n, onKeyDown: r, cl
602
711
  type: "button",
603
712
  "aria-label": h.previousMonth,
604
713
  onClick: () => S((e) => v(e, -1)),
605
- children: /* @__PURE__ */ W(xt, { className: Y.popover__navBackward })
714
+ children: /* @__PURE__ */ W(kt, { className: Y.popover__navBackward })
606
715
  }),
607
716
  /* @__PURE__ */ W("div", {
608
717
  className: Y.popover__title,
609
- children: ee(m, x)
718
+ children: j(m, x)
610
719
  }),
611
720
  /* @__PURE__ */ W("button", {
612
721
  type: "button",
613
722
  "aria-label": h.nextMonth,
614
723
  onClick: () => S((e) => v(e, 1)),
615
- children: /* @__PURE__ */ W(xt, { className: Y.popover__navForward })
724
+ children: /* @__PURE__ */ W(kt, { className: Y.popover__navForward })
616
725
  })
617
726
  ]
618
727
  }), /* @__PURE__ */ G("div", {
619
728
  className: Y.popover__grid,
620
- children: [O.slice(0, 7).map((e) => /* @__PURE__ */ W("div", {
729
+ children: [A.slice(0, 7).map((e) => /* @__PURE__ */ W("div", {
621
730
  className: Y.popover__weekday,
622
731
  children: m.weekDayShortName(m.getWeekDay(e))
623
- }, m.getWeekDay(e))), O.map((e, t) => {
624
- let n = m.getMonths(e) !== m.getMonths(x), r = m.isToday(e), i = s !== "month" && me(m, s, l, e), a = i && (s === "day" || t % 7 == 0), o = i && (s === "day" || t % 7 == 6);
732
+ }, m.getWeekDay(e))), A.map((e, t) => {
733
+ let n = m.getMonths(e) !== m.getMonths(x), r = m.isToday(e), i = s !== "month" && he(m, s, l, e), a = i && (s === "day" || t % 7 == 0), o = i && (s === "day" || t % 7 == 6);
625
734
  return /* @__PURE__ */ W("button", {
626
735
  type: "button",
627
- onClick: () => j(e),
628
- className: D(Y.popover__day, {
736
+ onClick: () => ee(e),
737
+ className: O(Y.popover__day, {
629
738
  [Y.popover__day_outside]: n,
630
739
  [Y.popover__day_today]: r,
631
740
  [Y.popover__day_selected]: i,
@@ -639,15 +748,15 @@ function Ot({ renderHeading: e, type: t = "button", onClick: n, onKeyDown: r, cl
639
748
  }) })]
640
749
  });
641
750
  }
642
- var kt = {
643
- root: "_root_l1csz_1",
644
- root__icon: "_root__icon_l1csz_21",
645
- root__icon_forward: "_root__icon_forward_l1csz_25",
646
- root__icon_backward: "_root__icon_backward_l1csz_29"
751
+ var Lt = {
752
+ root: "_root_uo171_1",
753
+ root__icon: "_root__icon_uo171_23",
754
+ root__icon_forward: "_root__icon_forward_uo171_27",
755
+ root__icon_backward: "_root__icon_backward_uo171_31"
647
756
  };
648
757
  // src/components/nav-btn/NavBtn.tsx
649
- function At({ direction: e = "forward", type: t = "button", onClick: n, className: r, children: i, ...a }) {
650
- let { goForward: o, goBackward: s } = J(), c = Ge(), l = q(ve(n, () => {
758
+ function Rt({ direction: e = "forward", type: t = "button", onClick: n, className: r, children: i, ...a }) {
759
+ let { goForward: o, goBackward: s } = J(), c = Ke(), l = q(ye(n, () => {
651
760
  e === "forward" ? o() : e === "backward" && s();
652
761
  }));
653
762
  return /* @__PURE__ */ W("button", {
@@ -655,35 +764,35 @@ function At({ direction: e = "forward", type: t = "button", onClick: n, classNam
655
764
  "aria-label": e === "forward" ? c.next : c.previous,
656
765
  ...a,
657
766
  onClick: l,
658
- className: D(r, kt.root),
659
- children: i ?? /* @__PURE__ */ W(xt, { className: D(kt.root__icon, {
660
- [kt.root__icon_backward]: e === "backward",
661
- [kt.root__icon_forward]: e === "forward"
767
+ className: O(r, Lt.root),
768
+ children: i ?? /* @__PURE__ */ W(kt, { className: O(Lt.root__icon, {
769
+ [Lt.root__icon_backward]: e === "backward",
770
+ [Lt.root__icon_forward]: e === "forward"
662
771
  }) })
663
772
  });
664
773
  }
665
- var jt = {
666
- root: "_root_gpxmh_1",
667
- root__icon: "_root__icon_gpxmh_25",
668
- root__icon_open: "_root__icon_open_gpxmh_32",
669
- list: "_list_gpxmh_36",
670
- list__option: "_list__option_gpxmh_48",
671
- list__option_active: "_list__option_active_gpxmh_68",
672
- list__check: "_list__check_gpxmh_76"
673
- }, Mt = [
774
+ var zt = {
775
+ root: "_root_5dy7b_1",
776
+ root__icon: "_root__icon_5dy7b_27",
777
+ root__icon_open: "_root__icon_open_5dy7b_34",
778
+ list: "_list_5dy7b_38",
779
+ list__option: "_list__option_5dy7b_52",
780
+ list__option_active: "_list__option_active_5dy7b_72",
781
+ list__check: "_list__check_5dy7b_80"
782
+ }, Bt = [
674
783
  "day",
675
784
  "week",
676
785
  "month"
677
786
  ];
678
- function Nt({ className: e }) {
679
- let { view: t, changeView: n } = J(), r = Ge(), { addGlobalListener: o, removeGlobalListener: s } = at(), c = a(), [l, f] = d(!1), [p, m] = d(t), h = u(/* @__PURE__ */ new Map()), { refs: g, floatingStyles: _ } = Re({
787
+ function Vt({ className: e }) {
788
+ let { view: t, changeView: n } = J(), r = Ke(), { addGlobalListener: o, removeGlobalListener: s } = ot(), c = a(), [l, f] = d(!1), [p, m] = d(t), h = u(/* @__PURE__ */ new Map()), { refs: g, floatingStyles: _ } = ze({
680
789
  placement: "bottom-end",
681
790
  middleware: [
682
- Ie(6),
683
- Fe({ padding: 8 }),
684
- Le({ padding: 8 })
791
+ Le(6),
792
+ Ie({ padding: 8 }),
793
+ Re({ padding: 8 })
685
794
  ],
686
- whileElementsMounted: Pe
795
+ whileElementsMounted: Fe
687
796
  }), v = (e) => {
688
797
  f(!1);
689
798
  let t = g.reference.current;
@@ -712,43 +821,43 @@ function Nt({ className: e }) {
712
821
  let x = (e) => {
713
822
  (e.key === "ArrowDown" || e.key === "ArrowUp") && (e.preventDefault(), y());
714
823
  }, S = (e) => {
715
- let t = Mt.indexOf(p), n = (t) => {
716
- e.preventDefault(), m(Mt[(t + Mt.length) % Mt.length] ?? p);
824
+ let t = Bt.indexOf(p), n = (t) => {
825
+ e.preventDefault(), m(Bt[(t + Bt.length) % Bt.length] ?? p);
717
826
  };
718
827
  switch (e.key) {
719
828
  case "ArrowDown": return n(t + 1);
720
829
  case "ArrowUp": return n(t - 1);
721
830
  case "Home": return n(0);
722
- case "End": return n(Mt.length - 1);
831
+ case "End": return n(Bt.length - 1);
723
832
  case "Enter":
724
833
  case " ": return e.preventDefault(), b(p);
725
834
  case "Escape": return e.preventDefault(), v(!0);
726
835
  case "Tab": return v(!1);
727
836
  }
728
837
  }, C = `${c}-list`;
729
- return /* @__PURE__ */ G(ze, { children: [/* @__PURE__ */ G("button", {
838
+ return /* @__PURE__ */ G(Be, { children: [/* @__PURE__ */ G("button", {
730
839
  ref: g.setReference,
731
840
  type: "button",
732
841
  "aria-haspopup": "listbox",
733
842
  "aria-expanded": l,
734
843
  "aria-controls": l ? C : void 0,
735
844
  "aria-label": `${r.chooseView}: ${r[t]}`,
736
- className: D(e, jt.root),
845
+ className: O(e, zt.root),
737
846
  onClick: () => l ? v(!1) : y(),
738
847
  onKeyDown: x,
739
- children: [r[t], /* @__PURE__ */ W(xt, {
848
+ children: [r[t], /* @__PURE__ */ W(kt, {
740
849
  "aria-hidden": "true",
741
- className: D(jt.root__icon, { [jt.root__icon_open]: l })
850
+ className: O(zt.root__icon, { [zt.root__icon_open]: l })
742
851
  })]
743
- }), l && /* @__PURE__ */ W(Dt, { children: /* @__PURE__ */ W("div", {
852
+ }), l && /* @__PURE__ */ W(Ft, { children: /* @__PURE__ */ W("div", {
744
853
  ref: g.setFloating,
745
854
  id: C,
746
855
  role: "listbox",
747
856
  "aria-label": r.chooseView,
748
857
  style: _,
749
- className: jt.list,
858
+ className: zt.list,
750
859
  onKeyDown: S,
751
- children: Mt.map((e) => /* @__PURE__ */ G("div", {
860
+ children: Bt.map((e) => /* @__PURE__ */ G("div", {
752
861
  ref: (t) => {
753
862
  t ? h.current.set(e, t) : h.current.delete(e);
754
863
  },
@@ -756,12 +865,12 @@ function Nt({ className: e }) {
756
865
  role: "option",
757
866
  tabIndex: -1,
758
867
  "aria-selected": e === t,
759
- className: D(jt.list__option, { [jt.list__option_active]: e === p }),
868
+ className: O(zt.list__option, { [zt.list__option_active]: e === p }),
760
869
  onClick: () => b(e),
761
870
  onPointerMove: () => m(e),
762
871
  children: [r[e], e === t && /* @__PURE__ */ W("svg", {
763
872
  "aria-hidden": "true",
764
- className: jt.list__check,
873
+ className: zt.list__check,
765
874
  viewBox: "0 0 16 16",
766
875
  width: "14",
767
876
  height: "14",
@@ -778,37 +887,37 @@ function Nt({ className: e }) {
778
887
  }) })] });
779
888
  }
780
889
  var X = {
781
- root: "_root_1lvdm_1",
782
- root__navigationPane: "_root__navigationPane_1lvdm_12",
783
- root__viewList: "_root__viewList_1lvdm_13",
784
- root__today: "_root__today_1lvdm_26",
785
- root__viewTab: "_root__viewTab_1lvdm_55",
786
- root__viewTab_isActive: "_root__viewTab_isActive_1lvdm_75",
787
- root__viewTab_disabled: "_root__viewTab_disabled_1lvdm_83",
788
- root__viewSelect: "_root__viewSelect_1lvdm_89"
890
+ root: "_root_1gqqu_1",
891
+ root__navigationPane: "_root__navigationPane_1gqqu_12",
892
+ root__viewList: "_root__viewList_1gqqu_13",
893
+ root__today: "_root__today_1gqqu_28",
894
+ root__viewTab: "_root__viewTab_1gqqu_57",
895
+ root__viewTab_isActive: "_root__viewTab_isActive_1gqqu_79",
896
+ root__viewTab_disabled: "_root__viewTab_disabled_1gqqu_87",
897
+ root__viewSelect: "_root__viewSelect_1gqqu_93"
789
898
  };
790
899
  // src/components/calendar-toolbar/CalendarToolbar.tsx
791
- function Pt(e) {
792
- let { goToday: t, changeView: n, view: r } = J(), i = Ge(), a = e, o = {
900
+ function Ht(e) {
901
+ let { goToday: t, changeView: n, view: r } = J(), i = Ke(), a = e, o = {
793
902
  day: {
794
903
  type: "button",
795
904
  "aria-selected": r === "day",
796
- onClick: ve(void 0, () => n("day")),
797
- className: D(X.root__viewTab, { [X.root__viewTab_isActive]: r === "day" }),
905
+ onClick: ye(void 0, () => n("day")),
906
+ className: O(X.root__viewTab, { [X.root__viewTab_isActive]: r === "day" }),
798
907
  children: i.day
799
908
  },
800
909
  week: {
801
910
  type: "button",
802
911
  "aria-selected": r === "week",
803
- onClick: ve(void 0, () => n("week")),
804
- className: D(X.root__viewTab, { [X.root__viewTab_isActive]: r === "week" }),
912
+ onClick: ye(void 0, () => n("week")),
913
+ className: O(X.root__viewTab, { [X.root__viewTab_isActive]: r === "week" }),
805
914
  children: i.week
806
915
  },
807
916
  month: {
808
917
  type: "button",
809
918
  "aria-selected": r === "month",
810
- onClick: ve(void 0, () => n("month")),
811
- className: D(X.root__viewTab, { [X.root__viewTab_isActive]: r === "month" }),
919
+ onClick: ye(void 0, () => n("month")),
920
+ className: O(X.root__viewTab, { [X.root__viewTab_isActive]: r === "month" }),
812
921
  children: i.month
813
922
  }
814
923
  }, s = {
@@ -819,16 +928,16 @@ function Pt(e) {
819
928
  };
820
929
  return /* @__PURE__ */ G("div", {
821
930
  ...a,
822
- className: D(a.className, X.root),
931
+ className: O(a.className, X.root),
823
932
  children: [
824
- /* @__PURE__ */ W(Ot, {}),
933
+ /* @__PURE__ */ W(It, {}),
825
934
  /* @__PURE__ */ G("div", {
826
935
  className: X.root__navigationPane,
827
936
  role: "group",
828
937
  children: [
829
- /* @__PURE__ */ W(At, { direction: "backward" }),
938
+ /* @__PURE__ */ W(Rt, { direction: "backward" }),
830
939
  /* @__PURE__ */ W("button", { ...s }),
831
- /* @__PURE__ */ W(At, { direction: "forward" })
940
+ /* @__PURE__ */ W(Rt, { direction: "forward" })
832
941
  ]
833
942
  }),
834
943
  /* @__PURE__ */ G("div", {
@@ -841,26 +950,26 @@ function Pt(e) {
841
950
  }),
842
951
  /* @__PURE__ */ W("div", {
843
952
  className: X.root__viewSelect,
844
- children: /* @__PURE__ */ W(Nt, {})
953
+ children: /* @__PURE__ */ W(Vt, {})
845
954
  })
846
955
  ]
847
956
  });
848
957
  }
849
958
  // src/contexts/CalendarViewportContext.ts
850
- var Ft = e(void 0);
851
- U && (Ft.displayName = "CalendarViewportContext");
852
- function It() {
853
- let e = r(Ft);
959
+ var Ut = e(void 0);
960
+ U && (Ut.displayName = "CalendarViewportContext");
961
+ function Wt() {
962
+ let e = r(Ut);
854
963
  if (!e) throw Error("CalendarViewportContext is required");
855
964
  return e;
856
965
  }
857
- var Lt = { root: "_root_1pvvm_1" };
966
+ var Gt = { root: "_root_1pvvm_1" };
858
967
  // src/components/pointer-popover/PointerPopover.tsx
859
- function Rt({ coordinates: e, className: t, style: n, ...r }) {
968
+ function Kt({ coordinates: e, className: t, style: n, ...r }) {
860
969
  return /* @__PURE__ */ W("span", {
861
970
  tabIndex: -1,
862
971
  ...r,
863
- className: D(t, Lt.root),
972
+ className: O(t, Gt.root),
864
973
  style: {
865
974
  ...n,
866
975
  ...e ? {
@@ -870,18 +979,18 @@ function Rt({ coordinates: e, className: t, style: n, ...r }) {
870
979
  }
871
980
  });
872
981
  }
873
- var zt = {
982
+ var qt = {
874
983
  root: "_root_ssdmn_1",
875
984
  root_isDragging: "_root_isDragging_ssdmn_14",
876
985
  root_isReturning: "_root_isReturning_ssdmn_23",
877
986
  "ww-drag-return": "_ww-drag-return_ssdmn_39",
878
987
  root_isBlocked: "_root_isBlocked_ssdmn_36"
879
- }, Bt = {
988
+ }, Jt = {
880
989
  isStart: !0,
881
990
  isEnd: !0
882
991
  };
883
- function Vt({ showPreview: e = !0, pxPerMinute: t = 1, ...n }) {
884
- let { eventMap: r, eventRenderer: i, pointerPreviewRenderer: a, view: o } = J(), { viewportRef: s } = It(), { isDragging: l, canDrop: f, dropData: p, eventItem: m, source: h, x: g, y: _, ...v } = Ne(({ draggable: e, overlay: t, droppable: n, canDrop: r }) => {
992
+ function Yt({ showPreview: e = !0, pxPerMinute: t = 1, ...n }) {
993
+ let { eventMap: r, eventRenderer: i, pointerPreviewRenderer: a, view: o } = J(), { viewportRef: s } = Wt(), { isDragging: l, canDrop: f, dropData: p, eventItem: m, source: h, x: g, y: _, ...v } = Pe(({ draggable: e, overlay: t, droppable: n, canDrop: r }) => {
885
994
  let i = [...n.dropTargets.values()].shift(), a = [...e.dragTargets.values()].shift();
886
995
  return {
887
996
  ...t.transform,
@@ -898,7 +1007,7 @@ function Vt({ showPreview: e = !0, pxPerMinute: t = 1, ...n }) {
898
1007
  let { key: e } = JSON.parse(m.event);
899
1008
  return r.get(e)?.value ?? null;
900
1009
  }, [m, r]), b = u(null), x = u(!1), [S, C] = d(!1), [w, T] = d(null);
901
- if (Ke(() => {
1010
+ if (qe(() => {
902
1011
  if (l) {
903
1012
  x.current = f, p && h && (b.current = {
904
1013
  transform: v,
@@ -927,29 +1036,29 @@ function Vt({ showPreview: e = !0, pxPerMinute: t = 1, ...n }) {
927
1036
  "--ww-return-height": `${n.height}px`
928
1037
  }
929
1038
  });
930
- }), et(l ? f ? "grabbing" : "not-allowed" : null), !l) return w ? /* @__PURE__ */ W(Dt, {
1039
+ }), tt(l ? f ? "grabbing" : "not-allowed" : null), !l) return w ? /* @__PURE__ */ W(Ft, {
931
1040
  container: w.container,
932
1041
  children: /* @__PURE__ */ W("div", {
933
1042
  ...n,
934
- className: D(n.className, zt.root, zt.root_isReturning),
1043
+ className: O(n.className, qt.root, qt.root_isReturning),
935
1044
  style: w.style,
936
1045
  onAnimationEnd: () => T(null),
937
- children: w.eventValue == null ? null : i.current?.(w.eventValue, o, Bt)
1046
+ children: w.eventValue == null ? null : i.current?.(w.eventValue, o, Jt)
938
1047
  })
939
1048
  }) : null;
940
1049
  if (!S) return null;
941
1050
  let E = !f;
942
- return /* @__PURE__ */ G(Dt, {
1051
+ return /* @__PURE__ */ G(Ft, {
943
1052
  container: s.current,
944
1053
  children: [/* @__PURE__ */ W("div", {
945
1054
  ...n,
946
- className: D(n.className, zt.root, {
947
- [zt.root_isDragging]: l,
948
- [zt.root_isBlocked]: E
1055
+ className: O(n.className, qt.root, {
1056
+ [qt.root_isDragging]: l,
1057
+ [qt.root_isBlocked]: E
949
1058
  }),
950
1059
  style: { ...v },
951
- children: y == null ? null : i.current?.(y, o, Bt)
952
- }), e && !E && /* @__PURE__ */ W(Rt, {
1060
+ children: y == null ? null : i.current?.(y, o, Jt)
1061
+ }), e && !E && /* @__PURE__ */ W(Kt, {
953
1062
  coordinates: {
954
1063
  x: g,
955
1064
  y: _
@@ -959,50 +1068,42 @@ function Vt({ showPreview: e = !0, pxPerMinute: t = 1, ...n }) {
959
1068
  });
960
1069
  }
961
1070
  // src/components/month-view/MonthView.utils.ts
962
- function Ht(e, t) {
1071
+ function Xt(e, t) {
963
1072
  return {
964
1073
  ...t,
965
1074
  ...e
966
1075
  };
967
1076
  }
968
- function Ut(e) {
1077
+ function Zt(e) {
969
1078
  return Array.from({ length: Math.ceil(e.length / 7) }, (t, n) => e.slice(n * 7, n * 7 + 7));
970
1079
  }
971
- function Wt(e, t, n) {
972
- let r = e?.querySelectorAll("[data-day-index]") ?? [], i = -1, a = 1e400;
973
- for (let e of r) {
974
- let r = e.getBoundingClientRect(), o = t < r.left ? r.left - t : t >= r.right ? t - r.right : 0, s = n < r.top ? r.top - n : n >= r.bottom ? n - r.bottom : 0, c = Math.hypot(o, s);
975
- c < a && (a = c, i = Number(e.dataset.dayIndex));
976
- }
977
- return i;
978
- }
979
1080
  var Z = {
980
- root: "_root_fq0jy_1",
981
- root__head: "_root__head_fq0jy_11",
982
- root__weekday: "_root__weekday_fq0jy_21",
983
- root__body: "_root__body_fq0jy_31",
984
- root__viewport: "_root__viewport_fq0jy_37",
985
- root__week: "_root__week_fq0jy_21",
986
- root__day: "_root__day_fq0jy_62",
987
- root__day_isOver: "_root__day_isOver_fq0jy_86",
988
- root__dayNumber: "_root__dayNumber_fq0jy_100",
989
- root__event: "_root__event_fq0jy_122",
990
- root__event_span: "_root__event_span_fq0jy_153",
991
- root__event_continuesBefore: "_root__event_continuesBefore_fq0jy_159",
992
- root__event_continuesAfter: "_root__event_continuesAfter_fq0jy_165",
993
- root__event_isResizing: "_root__event_isResizing_fq0jy_171",
994
- root__event_isResizeSource: "_root__event_isResizeSource_fq0jy_175",
995
- root__resize: "_root__resize_fq0jy_180",
996
- root__resizeStart: "_root__resizeStart_fq0jy_188",
997
- root__resizeEnd: "_root__resizeEnd_fq0jy_192",
998
- root_isResizing: "_root_isResizing_fq0jy_196",
999
- root__event_isDragging: "_root__event_isDragging_fq0jy_201",
1000
- root__dragOverlay: "_root__dragOverlay_fq0jy_206",
1001
- root__more: "_root__more_fq0jy_231"
1081
+ root: "_root_1mb26_1",
1082
+ root__head: "_root__head_1mb26_11",
1083
+ root__weekday: "_root__weekday_1mb26_21",
1084
+ root__body: "_root__body_1mb26_31",
1085
+ root__viewport: "_root__viewport_1mb26_37",
1086
+ root__week: "_root__week_1mb26_21",
1087
+ root__day: "_root__day_1mb26_62",
1088
+ root__day_isOver: "_root__day_isOver_1mb26_86",
1089
+ root__dayNumber: "_root__dayNumber_1mb26_100",
1090
+ root__event: "_root__event_1mb26_122",
1091
+ root__event_span: "_root__event_span_1mb26_155",
1092
+ root__event_continuesBefore: "_root__event_continuesBefore_1mb26_161",
1093
+ root__event_continuesAfter: "_root__event_continuesAfter_1mb26_167",
1094
+ root__event_isResizing: "_root__event_isResizing_1mb26_173",
1095
+ root__event_isResizeSource: "_root__event_isResizeSource_1mb26_177",
1096
+ root__resize: "_root__resize_1mb26_182",
1097
+ root__resizeStart: "_root__resizeStart_1mb26_192",
1098
+ root__resizeEnd: "_root__resizeEnd_1mb26_196",
1099
+ root_isResizing: "_root_isResizing_1mb26_200",
1100
+ root__event_isDragging: "_root__event_isDragging_1mb26_205",
1101
+ root__dragOverlay: "_root__dragOverlay_1mb26_210",
1102
+ root__more: "_root__more_1mb26_235"
1002
1103
  };
1003
1104
  // src/components/month-view/MonthViewDay.tsx
1004
- function Gt(e) {
1005
- let { ref: t, targetDate: n, children: r, onDoubleClick: a, ...o } = e, { onEventChange: s, onEventCreate: c, getIsDayDisabled: l, disabled: d, eventMap: f } = J(), p = K(), { getHours: m, getMinutes: h, getNow: g } = p, _ = u(null), { register: v, isOver: y } = Ne(({ registerDropTarget: e, isOver: t }) => ({
1105
+ function Qt(e) {
1106
+ let { ref: t, targetDate: n, children: r, onDoubleClick: a, ...o } = e, { onEventChange: s, onEventCreate: c, getIsDayDisabled: l, disabled: d, eventMap: f } = J(), p = K(), { getHours: m, getMinutes: h, getNow: g } = p, _ = u(null), { register: v, isOver: y } = Pe(({ registerDropTarget: e, isOver: t }) => ({
1006
1107
  register: e,
1007
1108
  isOver: t(_.current)
1008
1109
  }));
@@ -1016,7 +1117,7 @@ function Gt(e) {
1016
1117
  return JSON.parse(t);
1017
1118
  })), r = t && f.get(t.key);
1018
1119
  if (!r) return;
1019
- let i = p.fromMillis(t.day ?? t.date), a = ke(p, i, n) / 1440;
1120
+ let i = p.fromMillis(t.day ?? t.date), a = Ae(p, i, n) / 1440;
1020
1121
  a !== 0 && s(r.key, p.addDays(p.getStartOfDay(r.date), a), {
1021
1122
  from: m(r.date) * 60 + h(r.date),
1022
1123
  duration: r.duration
@@ -1042,17 +1143,17 @@ function Gt(e) {
1042
1143
  from: m(t) * 60 + h(t),
1043
1144
  duration: 60
1044
1145
  });
1045
- }), x = ct(_, t);
1146
+ }), x = dt(_, t);
1046
1147
  return /* @__PURE__ */ W("div", {
1047
1148
  ...o,
1048
1149
  ref: x,
1049
1150
  onDoubleClick: b,
1050
- className: D(o.className, Z.root__day, { [Z.root__day_isOver]: y }),
1151
+ className: O(o.className, Z.root__day, { [Z.root__day_isOver]: y }),
1051
1152
  children: r
1052
1153
  });
1053
1154
  }
1054
1155
  // src/hooks/useInterval.ts
1055
- function Kt() {
1156
+ function $t() {
1056
1157
  let e = u(null);
1057
1158
  return [n((t, n) => {
1058
1159
  e.current = setInterval(t, n);
@@ -1061,7 +1162,7 @@ function Kt() {
1061
1162
  }, [])];
1062
1163
  }
1063
1164
  // src/hooks/useScrollIntent.ts
1064
- var qt = {
1165
+ var en = {
1065
1166
  x: {
1066
1167
  [-1]: !1,
1067
1168
  1: !1
@@ -1071,10 +1172,10 @@ var qt = {
1071
1172
  1: !1
1072
1173
  }
1073
1174
  };
1074
- function Jt({ delta: e, disabled: t }) {
1075
- let n = ut(e);
1076
- return Xe((r) => {
1077
- if (t || !n || !r) return qt;
1175
+ function tn({ delta: e, disabled: t }) {
1176
+ let n = gt(e);
1177
+ return Ze((r) => {
1178
+ if (t || !n || !r) return en;
1078
1179
  let i = {
1079
1180
  x: Math.sign(e.x - n.x),
1080
1181
  y: Math.sign(e.y - n.y)
@@ -1096,8 +1197,8 @@ function Jt({ delta: e, disabled: t }) {
1096
1197
  ]);
1097
1198
  }
1098
1199
  // src/hooks/useAutoScroller.ts
1099
- function Yt(e) {
1100
- let { acceleration: t, activator: r = 0, canScroll: a, enabled: o, interval: s = 5, pointerCoordinates: l, order: d = 0, delta: f, threshold: p, activeNodeRect: m, scrollableAncestors: h, scrollableAncestorsRects: g } = e, [_, v] = Kt(), y = Jt({
1200
+ function nn(e) {
1201
+ let { acceleration: t, activator: r = 0, canScroll: a, enabled: o, interval: s = 5, pointerCoordinates: l, order: d = 0, delta: f, threshold: p, activeNodeRect: m, scrollableAncestors: h, scrollableAncestorsRects: g } = e, [_, v] = $t(), y = tn({
1101
1202
  delta: f,
1102
1203
  disabled: !o
1103
1204
  }), b = u({
@@ -1171,7 +1272,7 @@ function Yt(e) {
1171
1272
  ]);
1172
1273
  }
1173
1274
  // src/hooks/useMutationObserver.ts
1174
- function Xt(e, t = !1) {
1275
+ function rn(e, t = !1) {
1175
1276
  let n = u(e);
1176
1277
  n.current = e;
1177
1278
  let r = c(() => {
@@ -1182,17 +1283,17 @@ function Xt(e, t = !1) {
1182
1283
  return i(() => () => r?.disconnect(), [r]), r;
1183
1284
  }
1184
1285
  // src/hooks/useRect.ts
1185
- function Zt(e, t = P, n) {
1186
- let [r, i] = l(s, null), a = Xt((t) => {
1286
+ function an(e, t = F, n) {
1287
+ let [r, i] = l(s, null), a = rn((t) => {
1187
1288
  if (e) for (let n of t) {
1188
1289
  let { type: t, target: r } = n;
1189
- if (t === "childList" && pe(r) && r.contains(e)) {
1290
+ if (t === "childList" && me(r) && r.contains(e)) {
1190
1291
  i();
1191
1292
  break;
1192
1293
  }
1193
1294
  }
1194
- }), o = qe(i);
1195
- return Ke(() => {
1295
+ }), o = Je(i);
1296
+ return qe(() => {
1196
1297
  i(), e ? (o?.observe(e), a?.observe(document.body, {
1197
1298
  childList: !0,
1198
1299
  subtree: !0
@@ -1204,30 +1305,30 @@ function Zt(e, t = P, n) {
1204
1305
  ]), r;
1205
1306
  function s(r) {
1206
1307
  if (!e) return null;
1207
- if (e.isConnected === !1) return r ?? n ?? null;
1308
+ if (!e.isConnected) return r ?? n ?? null;
1208
1309
  let i = t(e);
1209
- return Ee(i, r) ? r : i;
1310
+ return De(i, r) ? r : i;
1210
1311
  }
1211
1312
  }
1212
1313
  // src/hooks/useScrollableAncestors.ts
1213
- var Qt = [];
1214
- function $t(e, t) {
1215
- let n = u(e), r = c(() => e ? re(e, t) : Qt, [e, t]);
1314
+ var on = [];
1315
+ function sn(e, t) {
1316
+ let n = u(e), r = c(() => e ? ie(e, t) : on, [e, t]);
1216
1317
  return i(() => {
1217
1318
  n.current = e;
1218
1319
  }, [e]), r;
1219
1320
  }
1220
1321
  // src/hooks/useScrollableAncestorsRects.ts
1221
- var en = [];
1222
- function tn(e, t = P) {
1223
- let [n, r] = l(a, en), i = qe(r);
1224
- return e.length > 0 && n === en && r(), Ke(() => {
1322
+ var cn = [];
1323
+ function ln(e, t = F) {
1324
+ let [n, r] = l(a, cn), i = Je(r);
1325
+ return e.length > 0 && n === cn && r(), qe(() => {
1225
1326
  e.length ? e.forEach((e) => i?.observe(e)) : (i?.disconnect(), r());
1226
1327
  }, [e, i]), n;
1227
1328
  function a() {
1228
1329
  return e.length ? e.map((e) => {
1229
1330
  if (e === document.scrollingElement) {
1230
- let t = fe(e), n = t.innerWidth, r = t.innerHeight;
1331
+ let t = pe(e), n = t.innerWidth, r = t.innerHeight;
1231
1332
  return {
1232
1333
  top: 0,
1233
1334
  left: 0,
@@ -1238,23 +1339,23 @@ function tn(e, t = P) {
1238
1339
  };
1239
1340
  }
1240
1341
  return new h(t(e), e);
1241
- }) : en;
1342
+ }) : cn;
1242
1343
  }
1243
1344
  }
1244
1345
  // src/hooks/useScrollOffsets.ts
1245
- function nn(e) {
1346
+ function un(e) {
1246
1347
  let [t, r] = d(null), a = u(e), o = n((e) => {
1247
- let t = ie(e.target);
1248
- t && r((e) => e ? (e.set(t, V(t)), new Map(e)) : null);
1348
+ let t = ae(e.target);
1349
+ t && r((e) => e ? (e.set(t, H(t)), new Map(e)) : null);
1249
1350
  }, []);
1250
1351
  return i(() => {
1251
1352
  let t = a.current;
1252
1353
  if (e !== t) {
1253
1354
  n(t);
1254
1355
  let i = e.map((e) => {
1255
- let t = ie(e);
1256
- return t ? (t.addEventListener("scroll", o, { passive: !0 }), [t, V(t)]) : null;
1257
- }).filter((e) => he(e));
1356
+ let t = ae(e);
1357
+ return t ? (t.addEventListener("scroll", o, { passive: !0 }), [t, H(t)]) : null;
1358
+ }).filter((e) => ge(e));
1258
1359
  r(i.length ? new Map(i) : null), a.current = e;
1259
1360
  }
1260
1361
  return () => {
@@ -1262,28 +1363,28 @@ function nn(e) {
1262
1363
  };
1263
1364
  function n(e) {
1264
1365
  e.forEach((e) => {
1265
- let t = ie(e);
1366
+ let t = ae(e);
1266
1367
  t && t.removeEventListener("scroll", o);
1267
1368
  });
1268
1369
  }
1269
- }, [o, e]), c(() => e.length ? t ? Array.from(t.values()).reduce((e, t) => _(e, t), O) : H(e) : O, [e, t]);
1370
+ }, [o, e]), c(() => e.length ? t ? Array.from(t.values()).reduce((e, t) => v(e, t), k) : re(e) : k, [e, t]);
1270
1371
  }
1271
1372
  // src/hooks/useScrollOffsetsDelta.ts
1272
- function rn(e, t = k) {
1373
+ function dn(e, t = A) {
1273
1374
  let n = u(null);
1274
1375
  return i(() => {
1275
1376
  n.current = null;
1276
1377
  }, t), i(() => {
1277
- let t = e !== O;
1378
+ let t = e !== k;
1278
1379
  t && !n.current && (n.current = e), !t && n.current && (n.current = null);
1279
- }, [e]), n.current ? Oe(e, n.current) : O;
1380
+ }, [e]), n.current ? ke(e, n.current) : k;
1280
1381
  }
1281
1382
  // src/hooks/useMoveTransform.ts
1282
- var an = {
1383
+ var fn = {
1283
1384
  Start: "start",
1284
1385
  Move: "move",
1285
1386
  Stop: "stop"
1286
- }, on = {
1387
+ }, pn = {
1287
1388
  isActive: !1,
1288
1389
  initialTranslate: {
1289
1390
  x: 0,
@@ -1299,8 +1400,8 @@ var an = {
1299
1400
  },
1300
1401
  context: null
1301
1402
  };
1302
- function sn({ autoScrollEnabled: e = !0, modifiers: t = [], activeNode: n = null, containerNode: r = null }) {
1303
- let [i, a] = l(cn, on), o = typeof n == "function" ? n(i.context) : n, s = typeof r == "function" ? r(i.context) : r, u = Zt(i.isActive ? o : null), d = Zt(i.isActive ? s : null), f = $t(i.isActive ? o : null), p = tn(f), m = rn(nn(f)), h = c(() => {
1403
+ function mn({ autoScrollEnabled: e = !0, modifiers: t = [], activeNode: n = null, containerNode: r = null }) {
1404
+ let [i, a] = l(hn, pn), o = typeof n == "function" ? n(i.context) : n, s = typeof r == "function" ? r(i.context) : r, u = an(i.isActive ? o : null), d = an(i.isActive ? s : null), f = sn(i.isActive ? o : null), p = ln(f), m = dn(un(f)), h = c(() => {
1304
1405
  let e = (e) => (t, n) => {
1305
1406
  a({
1306
1407
  type: e,
@@ -1309,12 +1410,12 @@ function sn({ autoScrollEnabled: e = !0, modifiers: t = [], activeNode: n = null
1309
1410
  });
1310
1411
  };
1311
1412
  return {
1312
- start: e(an.Start),
1313
- move: e(an.Move),
1314
- stop: e(an.Stop)
1413
+ start: e(fn.Start),
1414
+ move: e(fn.Move),
1415
+ stop: e(fn.Stop)
1315
1416
  };
1316
- }, []), g = _(i.initialTranslate, i.translate);
1317
- Yt({
1417
+ }, []), g = v(i.initialTranslate, i.translate);
1418
+ nn({
1318
1419
  delta: i.translate,
1319
1420
  enabled: e && i.isActive,
1320
1421
  activeNodeRect: u,
@@ -1322,7 +1423,7 @@ function sn({ autoScrollEnabled: e = !0, modifiers: t = [], activeNode: n = null
1322
1423
  scrollableAncestors: f,
1323
1424
  scrollableAncestorsRects: p
1324
1425
  });
1325
- let b = _(i.translate, m), x = v(u, m), S = v(d, m), C = y(t, {
1426
+ let _ = v(i.translate, m), x = y(u, m), S = y(d, m), C = b(t, {
1326
1427
  delta: i.delta,
1327
1428
  transform: {
1328
1429
  ...i.translate,
@@ -1334,7 +1435,7 @@ function sn({ autoScrollEnabled: e = !0, modifiers: t = [], activeNode: n = null
1334
1435
  context: i.context,
1335
1436
  activeNodeRect: u,
1336
1437
  containerNodeRect: d,
1337
- translate: b,
1438
+ translate: _,
1338
1439
  initialTranslate: i.initialTranslate
1339
1440
  });
1340
1441
  return [
@@ -1356,18 +1457,18 @@ function sn({ autoScrollEnabled: e = !0, modifiers: t = [], activeNode: n = null
1356
1457
  }
1357
1458
  ];
1358
1459
  }
1359
- function cn(e, t) {
1460
+ function hn(e, t) {
1360
1461
  let n = {
1361
- [an.Start]: (e, { coordinates: t, context: n }) => ({
1462
+ [fn.Start]: (e, { coordinates: t, context: n }) => ({
1362
1463
  ...e,
1363
1464
  isActive: !0,
1364
- currentAction: an.Start,
1465
+ currentAction: fn.Start,
1365
1466
  initialTranslate: { ...t },
1366
1467
  context: n
1367
1468
  }),
1368
- [an.Move]: (e, { coordinates: t }) => ({
1469
+ [fn.Move]: (e, { coordinates: t }) => ({
1369
1470
  ...e,
1370
- currentAction: an.Move,
1471
+ currentAction: fn.Move,
1371
1472
  translate: {
1372
1473
  x: t.x - e.initialTranslate.x,
1373
1474
  y: t.y - e.initialTranslate.y
@@ -1377,18 +1478,18 @@ function cn(e, t) {
1377
1478
  y: t.y - (e.translate.y + e.initialTranslate.y)
1378
1479
  }
1379
1480
  }),
1380
- [an.Stop]: () => ({
1381
- ...on,
1382
- currentAction: an.Stop
1481
+ [fn.Stop]: () => ({
1482
+ ...pn,
1483
+ currentAction: fn.Stop
1383
1484
  })
1384
1485
  };
1385
- return _e(t.type, n, e, t);
1486
+ return ve(t.type, n, e, t);
1386
1487
  }
1387
1488
  // src/components/month-view/MonthViewEvent.tsx
1388
- var ln = 6;
1389
- function un(e) {
1390
- let { ref: t, eventData: n, weekDays: r, resizable: a = !1, resize: o, isResizeSource: s = !1, isAnyResizing: c = !1, children: l, ...d } = e, { disabled: f } = J(), m = K(), { viewportRef: h } = It(), g = u(null), _ = u(null), { attributes: v, isDragging: y, overElement: b, register: x, setOverlayTransform: S } = Ne(({ registerDragSource: e, draggable: t, droppable: n, setTransform: r, isActive: i }) => {
1391
- let a = i(g.current), [o] = a ? [...n.dropTargets].pop() ?? [null] : [null];
1489
+ var gn = 6;
1490
+ function _n(e) {
1491
+ let { ref: t, eventData: n, weekDays: r, weekRef: a, resizable: o = !1, resize: s, isResizeSource: c = !1, isAnyResizing: l = !1, children: d, ...f } = e, { disabled: m } = J(), h = K(), { viewportRef: g } = Wt(), _ = u(null), v = u(null), { attributes: y, isDragging: b, overElement: x, register: S, setOverlayTransform: C } = Pe(({ registerDragSource: e, draggable: t, droppable: n, setTransform: r, isActive: i }) => {
1492
+ let a = i(_.current), [o] = a ? [...n.dropTargets].pop() ?? [null] : [null];
1392
1493
  return {
1393
1494
  attributes: t.attributes,
1394
1495
  isDragging: a,
@@ -1396,47 +1497,47 @@ function un(e) {
1396
1497
  register: e,
1397
1498
  setOverlayTransform: r
1398
1499
  };
1399
- }), C = Zt(y ? b : null), [{ transform: w, context: T }, E] = sn({
1500
+ }), w = an(b ? x : null), [{ transform: T, context: E }, D] = mn({
1400
1501
  autoScrollEnabled: !1,
1401
- activeNode: () => g.current,
1402
- containerNode: () => h.current,
1502
+ activeNode: () => _.current,
1503
+ containerNode: () => g.current,
1403
1504
  modifiers: [function({ activeNodeRect: e, containerNodeRect: t, transform: n, translate: r, initialTranslate: i }) {
1404
- if (!t || !e || !C) return n;
1405
- n.x = r.x + i.x - t.left, n.y = r.y + i.y - t.top, n.left = C.left - t.left + ln, n.width = C.width - 12, n.height = e.height;
1406
- let a = e.top + r.y, o = C.top + p.header, s = C.top + C.height - e.height;
1505
+ if (!t || !e || !w) return n;
1506
+ n.x = r.x + i.x - t.left, n.y = r.y + i.y - t.top, n.left = w.left - t.left + gn, n.width = w.width - 12, n.height = e.height;
1507
+ let a = e.top + r.y, o = w.top + p.header, s = w.top + w.height - e.height;
1407
1508
  return n.top = Math.max(o, Math.min(a, s)) - t.top, n;
1408
1509
  }]
1409
- }), O = q((e) => {
1410
- T === "overlay" && b && S(e);
1510
+ }), k = q((e) => {
1511
+ E === "overlay" && x && C(e);
1411
1512
  });
1412
1513
  i(() => {
1413
- O(w);
1414
- }, [O, ...Object.values(w)]);
1415
- let k = q(() => {
1416
- let e = _.current ?? r[n.column], t = {
1514
+ k(T);
1515
+ }, [k, ...Object.values(T)]);
1516
+ let A = q(() => {
1517
+ let e = v.current ?? r[n.column], t = {
1417
1518
  ...n,
1418
- date: m.toMillis(n.date),
1419
- day: e && m.toMillis(e)
1519
+ date: h.toMillis(n.date),
1520
+ day: e && h.toMillis(e)
1420
1521
  };
1421
1522
  return [{ event: JSON.stringify(t) }];
1422
1523
  });
1423
1524
  i(() => {
1424
- if (g.current && !f) return x(g.current, {
1425
- getItems: k,
1525
+ if (_.current && !m) return S(_.current, {
1526
+ getItems: A,
1426
1527
  onDragStart(e) {
1427
- E.start({
1528
+ D.start({
1428
1529
  x: e.x,
1429
1530
  y: e.y
1430
1531
  }, "overlay");
1431
1532
  },
1432
1533
  onDragMove(e) {
1433
- E.move({
1534
+ D.move({
1434
1535
  x: e.x,
1435
1536
  y: e.y
1436
1537
  });
1437
1538
  },
1438
1539
  onDragEnd(e) {
1439
- E.stop({
1540
+ D.stop({
1440
1541
  x: e.x,
1441
1542
  y: e.y
1442
1543
  });
@@ -1446,71 +1547,71 @@ function un(e) {
1446
1547
  }
1447
1548
  });
1448
1549
  }, [
1449
- E,
1450
- f,
1451
- k,
1452
- x
1550
+ D,
1551
+ m,
1552
+ A,
1553
+ S
1453
1554
  ]);
1454
- let ee = (e) => {
1555
+ let j = (e) => {
1455
1556
  e.stopPropagation();
1456
- let t = e.currentTarget.parentElement;
1557
+ let t = a.current;
1457
1558
  if (!t) return;
1458
- let i = t.getBoundingClientRect(), a = Math.floor((e.clientX - i.left) / i.width * r.length), o = Math.min(Math.max(a, n.column), n.column + n.span - 1);
1459
- _.current = r[o] ?? null;
1460
- }, A = (e) => ({
1461
- onMoveStart: () => (o?.start(n.key, e), !0),
1462
- onMove: (e) => o?.move(e.clientX, e.clientY),
1463
- onMoveEnd: () => o?.end()
1464
- }), { listeners: j } = lt(A("start")), { listeners: M } = lt(A("end")), N = ct(g, t), P = n.span > 1 || !n.isStart || !n.isEnd, F = Ht({
1559
+ let i = t.getBoundingClientRect(), o = Math.floor((e.clientX - i.left) / i.width * r.length), s = Math.min(Math.max(o, n.column), n.column + n.span - 1);
1560
+ v.current = r[s] ?? null;
1561
+ }, M = (e) => ({
1562
+ onMoveStart: () => (s?.start(n.key, e), !0),
1563
+ onMove: (e) => s?.move(e.clientX, e.clientY),
1564
+ onMoveEnd: () => s?.end()
1565
+ }), { listeners: N } = ft(M("start")), { listeners: ee } = ft(M("end")), P = dt(_, t), F = n.span > 1 || !n.isStart || !n.isEnd, I = Xt({
1465
1566
  "--ww-column": n.column + 1,
1466
1567
  "--ww-span": n.span,
1467
1568
  "--ww-row": n.lane + 2
1468
- }, d.style);
1569
+ }, f.style);
1469
1570
  return /* @__PURE__ */ G("div", {
1470
- ...d,
1471
- ...c ? null : v,
1472
- ref: N,
1473
- style: F,
1571
+ ...f,
1572
+ ...l ? null : y,
1573
+ ref: P,
1574
+ style: I,
1474
1575
  "data-key": String(n.key),
1475
1576
  "data-continues-before": n.isStart ? void 0 : "",
1476
1577
  "data-continues-after": n.isEnd ? void 0 : "",
1477
- onPointerDown: ee,
1578
+ onPointerDown: j,
1478
1579
  onDoubleClick: (e) => e.stopPropagation(),
1479
- className: D(d.className, Z.root__event, {
1480
- [Z.root__event_span]: P,
1580
+ className: O(f.className, Z.root__event, {
1581
+ [Z.root__event_span]: F,
1481
1582
  [Z.root__event_continuesBefore]: !n.isStart,
1482
1583
  [Z.root__event_continuesAfter]: !n.isEnd,
1483
- [Z.root__event_isDragging]: y,
1484
- [Z.root__event_isResizeSource]: s
1584
+ [Z.root__event_isDragging]: b,
1585
+ [Z.root__event_isResizeSource]: c
1485
1586
  }),
1486
1587
  children: [
1487
- l,
1488
- a && n.isStart && /* @__PURE__ */ W("div", {
1489
- ...j,
1588
+ d,
1589
+ o && n.isStart && /* @__PURE__ */ W("div", {
1590
+ ...N,
1490
1591
  "data-edge": "start",
1491
- className: D(Z.root__resize, Z.root__resizeStart)
1592
+ className: O(Z.root__resize, Z.root__resizeStart)
1492
1593
  }),
1493
- a && n.isEnd && /* @__PURE__ */ W("div", {
1494
- ...M,
1594
+ o && n.isEnd && /* @__PURE__ */ W("div", {
1595
+ ...ee,
1495
1596
  "data-edge": "end",
1496
- className: D(Z.root__resize, Z.root__resizeEnd)
1597
+ className: O(Z.root__resize, Z.root__resizeEnd)
1497
1598
  })
1498
1599
  ]
1499
1600
  });
1500
1601
  }
1501
1602
  // src/components/month-view/MonthViewEventPreview.tsx
1502
- function dn({ bar: e, children: t }) {
1603
+ function vn({ bar: e, children: t }) {
1503
1604
  return /* @__PURE__ */ W("div", {
1504
1605
  "aria-hidden": "true",
1505
1606
  "data-key": String(e.key),
1506
1607
  "data-continues-before": e.isStart ? void 0 : "",
1507
1608
  "data-continues-after": e.isEnd ? void 0 : "",
1508
- className: D(Z.root__event, Z.root__event_isResizing, {
1609
+ className: O(Z.root__event, Z.root__event_isResizing, {
1509
1610
  [Z.root__event_span]: e.span > 1 || !e.isStart || !e.isEnd,
1510
1611
  [Z.root__event_continuesBefore]: !e.isStart,
1511
1612
  [Z.root__event_continuesAfter]: !e.isEnd
1512
1613
  }),
1513
- style: Ht({
1614
+ style: Xt({
1514
1615
  "--ww-column": e.column + 1,
1515
1616
  "--ww-span": e.span,
1516
1617
  "--ww-row": e.lane + 2
@@ -1519,55 +1620,58 @@ function dn({ bar: e, children: t }) {
1519
1620
  });
1520
1621
  }
1521
1622
  // src/components/month-view/MonthViewWeek.tsx
1522
- function fn(e) {
1523
- let { days: t, firstDayIndex: n, layout: r, sourceBars: i, lanes: a, resizingKey: o, resize: s } = e, { viewValue: c, eventRenderer: l, view: u, disabled: d } = J(), { getMonthDay: f, isSameMonth: p, isToday: m, toMillis: h } = K(), g = Ge(), _ = o !== void 0, v = (e) => l.current?.(e.value, u, {
1623
+ function yn(e) {
1624
+ let { days: t, firstDayIndex: n, cellRef: r, layout: i, sourceBars: a, lanes: o, resizingKey: s, resize: c } = e, l = u(null), { viewValue: d, eventRenderer: f, view: p, disabled: m } = J(), { getMonthDay: h, isSameMonth: g, isToday: _, toMillis: v } = K(), y = Ke(), b = s !== void 0, x = (e) => f.current?.(e.value, p, {
1524
1625
  isStart: e.isStart,
1525
1626
  isEnd: e.isEnd
1526
- }), y = (e, n = !1) => /* @__PURE__ */ W(un, {
1627
+ }), S = (e, n = !1) => /* @__PURE__ */ W(_n, {
1527
1628
  eventData: e,
1528
1629
  weekDays: t,
1529
- resizable: !d,
1530
- resize: s,
1630
+ weekRef: l,
1631
+ resizable: !m,
1632
+ resize: c,
1531
1633
  isResizeSource: n,
1532
- isAnyResizing: _,
1533
- children: v(e)
1634
+ isAnyResizing: b,
1635
+ children: x(e)
1534
1636
  }, e.key);
1535
1637
  return /* @__PURE__ */ G("div", {
1638
+ ref: l,
1536
1639
  className: Z.root__week,
1537
1640
  children: [
1538
- t.map((e, t) => /* @__PURE__ */ W(Gt, {
1641
+ t.map((e, t) => /* @__PURE__ */ W(Qt, {
1642
+ ref: r(n + t),
1539
1643
  targetDate: e,
1540
1644
  "data-day-index": n + t,
1541
- "data-is-outside": !p(e, c) || void 0,
1542
- "data-is-today": m(e) ? !0 : void 0,
1543
- style: Ht({ "--ww-column": t + 1 }),
1645
+ "data-is-outside": !g(e, d) || void 0,
1646
+ "data-is-today": _(e) ? !0 : void 0,
1647
+ style: Xt({ "--ww-column": t + 1 }),
1544
1648
  children: /* @__PURE__ */ W("span", {
1545
1649
  className: Z.root__dayNumber,
1546
- children: f(e)
1650
+ children: h(e)
1547
1651
  })
1548
- }, h(e))),
1549
- [...r.bars.map((e) => e.key === o ? /* @__PURE__ */ W(dn, {
1652
+ }, v(e))),
1653
+ [...i.bars.map((e) => e.key === s ? /* @__PURE__ */ W(vn, {
1550
1654
  bar: e,
1551
- children: v(e)
1552
- }, `preview-${e.key}`) : y(e)), ...i.map((e) => y(e, !0))],
1553
- t.map((e, t) => r.hidden[t] > 0 && /* @__PURE__ */ W("span", {
1655
+ children: x(e)
1656
+ }, `preview-${e.key}`) : S(e)), ...a.map((e) => S(e, !0))],
1657
+ t.map((e, t) => i.hidden[t] > 0 && /* @__PURE__ */ W("span", {
1554
1658
  className: Z.root__more,
1555
- style: Ht({
1659
+ style: Xt({
1556
1660
  "--ww-column": t + 1,
1557
- "--ww-row": a + 2
1661
+ "--ww-row": o + 2
1558
1662
  }),
1559
- children: g.more(r.hidden[t])
1560
- }, `more-${h(e)}`))
1663
+ children: y.more(i.hidden[t])
1664
+ }, `more-${v(e)}`))
1561
1665
  ]
1562
1666
  });
1563
1667
  }
1564
1668
  // src/components/month-view/useMonthLanes.ts
1565
- function pn(e, t) {
1669
+ function bn(e, t) {
1566
1670
  let [n, r] = d(t), i = () => {
1567
1671
  let n = e.current?.firstElementChild;
1568
- n?.clientHeight && r(R(n.clientHeight, t));
1569
- }, a = qe(i);
1570
- return Ke(() => {
1672
+ n?.clientHeight && r(z(n.clientHeight, t));
1673
+ }, a = Je(i);
1674
+ return qe(() => {
1571
1675
  i();
1572
1676
  let t = e.current?.firstElementChild;
1573
1677
  return t && a?.observe(t), () => {
@@ -1576,91 +1680,92 @@ function pn(e, t) {
1576
1680
  }, [a, t]), n;
1577
1681
  }
1578
1682
  // src/components/month-view/useMonthResize.ts
1579
- function mn(e) {
1580
- let { days: t, viewportRef: n, dateUtils: r, eventMap: i, disabled: a, getIsDayDisabled: o, onEventChange: s } = e, [l, u, d] = pt(null), { addGlobalListener: f, removeAllGlobalListeners: p } = at(), m = q((e = !0) => {
1581
- let t = d.current;
1582
- t && (p(), u(null), e && t.result && s(t.key, t.result.date, t.result.info));
1583
- }), h = q((e) => {
1584
- e.key === "Escape" && m(!1);
1585
- }), g = q((e, t) => {
1586
- a || d.current || (u({
1683
+ function xn(e) {
1684
+ let { days: t, viewportRef: n, cellsRef: r, dateUtils: i, eventMap: a, disabled: o, getIsDayDisabled: s, onEventChange: l } = e, [u, d, f] = xt(null), { addGlobalListener: p, removeAllGlobalListeners: m } = ot(), h = st(n, r), g = q((e = !0) => {
1685
+ let t = f.current;
1686
+ t && (m(), h.release(), d(null), e && t.result && l(t.key, t.result.date, t.result.info));
1687
+ }), _ = q((e) => {
1688
+ e.key === "Escape" && g(!1);
1689
+ }), v = q((e, t) => {
1690
+ o || f.current || (h.measure(), d({
1587
1691
  key: e,
1588
1692
  edge: t,
1589
1693
  result: null
1590
- }), f(document, "keydown", h, !0));
1591
- }), _ = q((e, a) => {
1592
- let s = d.current, c = s && i.get(s.key), l = t[Wt(n.current, e, a)];
1593
- s && c && l && !o?.(l) && u({
1594
- ...s,
1595
- result: xe(r, c, s.edge, l)
1694
+ }), p(document, "keydown", _, !0));
1695
+ }), y = q((e, n) => {
1696
+ let r = f.current, o = r && a.get(r.key), c = t[h.nearestIndex(e, n)];
1697
+ r && o && c && !s?.(c) && d({
1698
+ ...r,
1699
+ result: Se(i, o, r.edge, c)
1596
1700
  });
1597
- }), v = c(() => ({
1598
- start: g,
1599
- move: _,
1600
- end: m
1701
+ }), b = c(() => ({
1702
+ start: v,
1703
+ move: y,
1704
+ end: g
1601
1705
  }), [
1602
- m,
1603
- _,
1604
- g
1605
- ]), y = c(() => {
1606
- let e = l?.result && i.get(l.key);
1607
- if (!l?.result || !e) return i;
1608
- let [t] = F(r, l.result.date, l.result.info);
1609
- return new Map(i).set(l.key, {
1706
+ g,
1707
+ y,
1708
+ v
1709
+ ]), x = c(() => {
1710
+ let e = u?.result && a.get(u.key);
1711
+ if (!u?.result || !e) return a;
1712
+ let [t] = I(i, u.result.date, u.result.info);
1713
+ return new Map(a).set(u.key, {
1610
1714
  ...e,
1611
1715
  date: t,
1612
- duration: l.result.info.duration
1716
+ duration: u.result.info.duration
1613
1717
  });
1614
1718
  }, [
1615
- r,
1616
1719
  i,
1617
- l
1720
+ a,
1721
+ u
1618
1722
  ]);
1619
1723
  return {
1620
- resizingKey: l?.key,
1621
- actions: v,
1622
- eventMap: y
1724
+ resizingKey: u?.key,
1725
+ actions: b,
1726
+ eventMap: x
1623
1727
  };
1624
1728
  }
1625
1729
  // src/components/month-view/MonthView.tsx
1626
- var hn = [];
1627
- function gn(e) {
1730
+ var Sn = [];
1731
+ function Cn(e) {
1628
1732
  let { className: t, style: n, ...r } = e, { viewValue: i, eventMap: a, startWeek: o, disabled: s, getIsDayDisabled: l, onEventChange: d } = J(), f = K();
1629
- gt();
1630
- let p = u(null), m = c(() => L(f, i, o), [
1733
+ wt();
1734
+ let p = u(null), m = _t(), h = c(() => R(f, i, o), [
1631
1735
  f,
1632
1736
  o,
1633
1737
  i
1634
- ]), h = c(() => Ut(m), [m]), g = c(() => de(f, o), [f, o]), _ = mn({
1635
- days: m,
1738
+ ]), g = c(() => Zt(h), [h]), _ = c(() => fe(f, o), [f, o]), v = xn({
1739
+ days: h,
1636
1740
  viewportRef: p,
1741
+ cellsRef: m.elements,
1637
1742
  dateUtils: f,
1638
1743
  eventMap: a,
1639
1744
  disabled: s,
1640
1745
  getIsDayDisabled: l,
1641
1746
  onEventChange: d
1642
- }), v = pn(p, 3), y = c(() => h.map((e) => x(a, f, e, v)), [
1747
+ }), y = bn(p, 3), b = c(() => g.map((e) => S(a, f, e, y)), [
1643
1748
  f,
1644
1749
  a,
1645
- v,
1646
- h
1647
- ]), b = c(() => _.eventMap === a ? y : h.map((e) => x(_.eventMap, f, e, v)), [
1750
+ y,
1751
+ g
1752
+ ]), x = c(() => v.eventMap === a ? b : g.map((e) => S(v.eventMap, f, e, y)), [
1648
1753
  f,
1649
1754
  a,
1650
- v,
1651
1755
  y,
1652
- _.eventMap,
1653
- h
1654
- ]), S = c(() => ({ viewportRef: p }), []);
1655
- return /* @__PURE__ */ G(Ft.Provider, {
1656
- value: S,
1756
+ b,
1757
+ v.eventMap,
1758
+ g
1759
+ ]), C = c(() => ({ viewportRef: p }), []);
1760
+ return /* @__PURE__ */ G(Ut.Provider, {
1761
+ value: C,
1657
1762
  children: [/* @__PURE__ */ G("div", {
1658
1763
  ...r,
1659
- className: D(t, Z.root, { [Z.root_isResizing]: _.resizingKey !== void 0 }),
1660
- style: Ht({ "--ww-month-lanes": v }, n),
1764
+ className: O(t, Z.root, { [Z.root_isResizing]: v.resizingKey !== void 0 }),
1765
+ style: Xt({ "--ww-month-lanes": y }, n),
1661
1766
  children: [/* @__PURE__ */ W("div", {
1662
1767
  className: Z.root__head,
1663
- children: g.map((e) => /* @__PURE__ */ W("div", {
1768
+ children: _.map((e) => /* @__PURE__ */ W("div", {
1664
1769
  className: Z.root__weekday,
1665
1770
  children: e
1666
1771
  }, e))
@@ -1669,72 +1774,71 @@ function gn(e) {
1669
1774
  children: /* @__PURE__ */ W("div", {
1670
1775
  ref: p,
1671
1776
  className: Z.root__viewport,
1672
- children: h.map((e, t) => /* @__PURE__ */ W(fn, {
1777
+ children: g.map((e, t) => /* @__PURE__ */ W(yn, {
1673
1778
  days: e,
1674
1779
  firstDayIndex: t * 7,
1675
- layout: b[t],
1676
- sourceBars: _.resizingKey === void 0 ? hn : y[t].bars.filter((e) => e.key === _.resizingKey),
1677
- lanes: v,
1678
- resizingKey: _.resizingKey,
1679
- resize: _.actions
1780
+ cellRef: m.refAt,
1781
+ layout: x[t],
1782
+ sourceBars: v.resizingKey === void 0 ? Sn : b[t].bars.filter((e) => e.key === v.resizingKey),
1783
+ lanes: y,
1784
+ resizingKey: v.resizingKey,
1785
+ resize: v.actions
1680
1786
  }, f.toMillis(e[0])))
1681
1787
  })
1682
1788
  })]
1683
- }), /* @__PURE__ */ W(Vt, {
1789
+ }), /* @__PURE__ */ W(Yt, {
1684
1790
  className: Z.root__dragOverlay,
1685
1791
  showPreview: !1
1686
1792
  })]
1687
1793
  });
1688
1794
  }
1689
1795
  // src/hooks/useEventResize.ts
1690
- var _n = 1440;
1691
- function vn(e) {
1692
- let { days: t, viewportRef: r, dateUtils: a, bounds: o, timeStep: s, preventOutBoundsChanges: l } = e, [f, p] = d(null), m = u(null), h = u(e);
1693
- h.current = e;
1694
- let g = o.hideMinMaxTime ? o.hourMin * 60 : 0, _ = o.hideMinMaxTime ? (o.hourMax - o.hourMin) * 60 : _n, v = n((e, n) => {
1695
- let i = m.current, c = r.current;
1696
- if (!i || !c) return;
1697
- i.x = e, i.y = n;
1698
- let { disabled: u, getIsDayDisabled: d } = h.current, f = [...c.querySelectorAll("[data-day-index]")], g = c.getBoundingClientRect(), v = ((e) => Math.round(e / s) * s)(Math.min(Math.max((n - g.top) / g.height * _, 0), _)), y = 0, b = 1e400;
1699
- f.forEach((t) => {
1700
- let n = t.getBoundingClientRect(), r = e < n.left ? n.left - e : e > n.right ? e - n.right : 0;
1701
- r < b && (b = r, y = Number(t.dataset.dayIndex));
1702
- });
1703
- let x = Se({
1704
- start: i.original[0],
1705
- end: i.original[1]
1706
- }, i.edge, y, v, {
1796
+ var wn = 1440;
1797
+ function Tn(e) {
1798
+ let { days: t, viewportRef: r, columnsRef: i, dateUtils: a, bounds: o, timeStep: s, preventOutBoundsChanges: l } = e, [f, p] = d(null), m = u(null), { addGlobalListener: h, removeGlobalListener: g } = ot(), _ = st(r, i), v = u(e);
1799
+ v.current = e;
1800
+ let y = o.hideMinMaxTime ? o.hourMin * 60 : 0, b = o.hideMinMaxTime ? (o.hourMax - o.hourMin) * 60 : wn, x = n((e, n) => {
1801
+ let r = m.current, i = _.container();
1802
+ if (!r || !i) return;
1803
+ r.x = e, r.y = n;
1804
+ let { disabled: c, getIsDayDisabled: u } = v.current, d = ((e) => Math.round(e / s) * s)(Math.min(Math.max((n - i.top) / i.height * b, 0), b)), f = Math.max(_.nearestIndex(e, n, "x"), 0), h = Ce({
1805
+ start: r.original[0],
1806
+ end: r.original[1]
1807
+ }, r.edge, f, d, {
1707
1808
  dayCount: t.length,
1708
1809
  bounds: o,
1709
1810
  timeStep: s,
1710
1811
  crossDays: !l || o.hourMin <= 0 && o.hourMax >= 24,
1711
1812
  getFrame: (e) => {
1712
- if (!l) return [0, _];
1713
- let [n, r] = ae(a, t[e], o);
1714
- return [Math.ceil(n / s) * s, Math.min(Math.ceil(r / s) * s, _)];
1813
+ if (!l) return [0, b];
1814
+ let [n, r] = oe(a, t[e], o);
1815
+ return [Math.ceil(n / s) * s, Math.min(Math.ceil(r / s) * s, b)];
1715
1816
  },
1716
- canEditDay: (e) => !u && !d?.(t[e]) && !(l && ge(a, t[e]))
1817
+ canEditDay: (e) => !c && !u?.(t[e]) && !(l && _e(a, t[e]))
1717
1818
  });
1718
- x && (i.range = x), p({
1719
- key: i.key,
1720
- range: i.range,
1819
+ h && (r.range = h), p({
1820
+ key: r.key,
1821
+ range: r.range,
1721
1822
  x: e,
1722
1823
  y: n,
1723
- blocked: !x
1824
+ blocked: !h
1724
1825
  });
1725
1826
  }, [
1726
1827
  o,
1727
1828
  a,
1728
1829
  t,
1830
+ _,
1729
1831
  l,
1730
1832
  s,
1731
- _,
1732
- r
1733
- ]), y = c(() => ({
1833
+ b
1834
+ ]), S = q(() => {
1835
+ let e = m.current;
1836
+ e && x(e.x, e.y);
1837
+ }), C = c(() => ({
1734
1838
  start(e, n, r, i) {
1735
- let o = h.current.eventMap.get(e);
1736
- if (!o || !t[0]) return;
1737
- let s = ke(a, t[0], o.date), c = [s, s + o.duration];
1839
+ let o = v.current.eventMap.get(e);
1840
+ if (!o || !t[0] || !_.measure()) return;
1841
+ let s = Ae(a, t[0], o.date), c = [s, s + o.duration];
1738
1842
  m.current = {
1739
1843
  key: e,
1740
1844
  edge: n,
@@ -1742,7 +1846,7 @@ function vn(e) {
1742
1846
  range: c,
1743
1847
  x: r,
1744
1848
  y: i
1745
- }, p({
1849
+ }, h(document, "scroll", S, !0), p({
1746
1850
  key: e,
1747
1851
  range: c,
1748
1852
  x: r,
@@ -1750,52 +1854,60 @@ function vn(e) {
1750
1854
  blocked: !1
1751
1855
  });
1752
1856
  },
1753
- move: v,
1857
+ move: x,
1754
1858
  end() {
1755
1859
  let e = m.current;
1756
- if (m.current = null, p(null), !e) return;
1860
+ if (e && x(e.x, e.y), m.current = null, g(document, "scroll", S, !0), _.release(), p(null), !e) return;
1757
1861
  let [n, r] = e.range;
1758
1862
  if (n === e.original[0] && r === e.original[1]) return;
1759
- let i = Math.floor(n / _n);
1760
- h.current.onEventChange(e.key, M(a, t[0], i * _n), {
1761
- from: n - i * _n,
1863
+ let i = Math.floor(n / wn);
1864
+ v.current.onEventChange(e.key, ee(a, t[0], i * wn), {
1865
+ from: n - i * wn,
1762
1866
  duration: r - n
1763
1867
  });
1764
1868
  }
1765
1869
  }), [
1870
+ h,
1766
1871
  a,
1767
1872
  t,
1768
- v
1769
- ]), b = f !== null;
1770
- return i(() => {
1771
- if (!b) return;
1772
- let e = () => m.current && v(m.current.x, m.current.y);
1773
- return document.addEventListener("scroll", e, !0), () => document.removeEventListener("scroll", e, !0);
1774
- }, [b, v]), et(f?.blocked ? "not-allowed" : null), {
1873
+ S,
1874
+ _,
1875
+ g,
1876
+ x
1877
+ ]);
1878
+ return tt(f?.blocked ? "not-allowed" : null), {
1775
1879
  state: f,
1776
- actions: y,
1880
+ actions: C,
1777
1881
  previewOf: (e) => {
1778
- let n = Math.floor(e[0] / _n);
1882
+ let n = Math.floor(e[0] / wn);
1779
1883
  return {
1780
- date: M(a, t[0], n * _n),
1781
- top: e[0] - n * _n - g,
1884
+ date: ee(a, t[0], n * wn),
1885
+ top: e[0] - n * wn - y,
1782
1886
  duration: e[1] - e[0]
1783
1887
  };
1784
1888
  }
1785
1889
  };
1786
1890
  }
1787
1891
  // src/contexts/DayWeekViewContext.ts
1788
- var yn = e(void 0);
1789
- U && (yn.displayName = "DayWeekViewContext");
1790
- function bn() {
1791
- let e = r(yn);
1892
+ var En = e(void 0);
1893
+ U && (En.displayName = "DayWeekViewContext");
1894
+ function Dn() {
1895
+ let e = r(En);
1792
1896
  if (!e) throw Error("DayWeekViewContext is required");
1793
1897
  return e;
1794
1898
  }
1899
+ // src/contexts/DayWeekDrawerContext.ts
1900
+ var On = e(void 0);
1901
+ U && (On.displayName = "DayWeekDrawerContext");
1902
+ function kn() {
1903
+ let e = r(On);
1904
+ if (!e) throw Error("DayWeekDrawerContext is required: render the event inside a DayWeekDrawer");
1905
+ return e;
1906
+ }
1795
1907
  // src/hooks/useTimeOffset.ts
1796
- function xn(e = !0, t = 6e4) {
1908
+ function An(e = !0, t = 6e4) {
1797
1909
  let { hideMinMaxTime: n, hourMin: r, hourMax: i } = J(), a = K(), [o, s] = d(null);
1798
- return mt(() => s(Date.now()), t, e), c(() => o === null ? [0, !0] : B(a, {
1910
+ return St(() => s(Date.now()), t, e), c(() => o === null ? [0, !0] : V(a, {
1799
1911
  hourMin: r,
1800
1912
  hourMax: i,
1801
1913
  hideMinMaxTime: n
@@ -1807,233 +1919,247 @@ function xn(e = !0, t = 6e4) {
1807
1919
  n
1808
1920
  ]);
1809
1921
  }
1810
- var Sn = {
1811
- root: "_root_1l2ji_1",
1812
- root_timeLimit: "_root_timeLimit_1l2ji_8",
1813
- root_isToday: "_root_isToday_1l2ji_8",
1814
- root_isPast: "_root_isPast_1l2ji_18",
1815
- root__container: "_root__container_1l2ji_36",
1816
- root__spotlight: "_root__spotlight_1l2ji_57",
1817
- root__timeLine: "_root__timeLine_1l2ji_67",
1818
- root_offLimits: "_root_offLimits_1l2ji_121"
1922
+ var jn = {
1923
+ root: "_root_1d4hh_1",
1924
+ root_timeLimit: "_root_timeLimit_1d4hh_12",
1925
+ root_isToday: "_root_isToday_1d4hh_12",
1926
+ root_isPast: "_root_isPast_1d4hh_22",
1927
+ root__container: "_root__container_1d4hh_40",
1928
+ root__spotlight: "_root__spotlight_1d4hh_61",
1929
+ root__timeLine: "_root__timeLine_1d4hh_71",
1930
+ root_offLimits: "_root_offLimits_1d4hh_125"
1819
1931
  };
1820
1932
  // src/components/day-week-drawer/DayWeekDrawer.tsx
1821
- function Cn(e) {
1822
- let { ref: t, targetDate: n, children: r, ...a } = e, { onEventChange: o, onEventCreate: s, getIsDayDisabled: l, pointerPreviewRenderer: d, eventMap: f, ...p } = J(), { viewportRef: m, getTimeFrame: h, pxPerMinute: g } = bn(), { hideMinMaxTime: _, preventOutBoundsChanges: v, timeStep: y, hourMin: b, hourMax: x, disabled: S } = p, w = K(), { isBefore: T, isToday: E } = w, O = y * g, k = (e) => wn(e, g, y), ee = (e) => h(e).map((e) => e * g), j = u(null), M = u(null), { register: N, getTransform: P } = Ne(({ registerDropTarget: e, getTransform: t }) => ({
1933
+ function Mn(e) {
1934
+ let { ref: t, targetDate: n, children: r, ...a } = e, { onEventChange: o, onEventCreate: s, getIsDayDisabled: l, pointerPreviewRenderer: d, eventMap: f, ...p } = J(), { viewportRef: m, getTimeFrame: h, pxPerMinute: g } = Dn(), { hideMinMaxTime: v, preventOutBoundsChanges: y, timeStep: b, hourMin: x, hourMax: S, disabled: C } = p, T = K(), { isBefore: E, isToday: D } = T, k = b * g, A = (e) => Nn(e, g, b), j = (e) => h(e).map((e) => e * g), N = u(null), ee = u(null), { register: P, getTransform: F } = Pe(({ registerDropTarget: e, getTransform: t }) => ({
1823
1935
  register: e,
1824
1936
  getTransform: t
1825
- })), F = gt(), I = c(() => {
1826
- let e = E(n);
1937
+ })), I = wt(), L = c(() => {
1938
+ let e = D(n);
1827
1939
  return {
1828
1940
  isToday: e,
1829
- isPast: T(n) && !e
1941
+ isPast: E(n) && !e
1830
1942
  };
1831
1943
  }, [
1832
- T,
1833
1944
  E,
1945
+ D,
1834
1946
  n,
1835
- F
1836
- ]), [{ isActive: L, transform: R }, z, { scrollAdjustmentActiveNodeRect: B }] = sn({
1837
- activeNode: j.current,
1838
- containerNode: j.current?.parentElement,
1947
+ I
1948
+ ]), [{ isActive: R, transform: z }, B, { scrollAdjustmentActiveNodeRect: V }] = mn({
1949
+ activeNode: N.current,
1950
+ containerNode: N.current,
1839
1951
  modifiers: [
1840
1952
  function({ activeNodeRect: e, initialTranslate: t, translate: n, transform: r }) {
1841
1953
  if (!e) return r;
1842
1954
  let i = t.y - e.top;
1843
- r.x = r.left + t.x, r.y = r.top + t.y, r.top = Math.floor(i / O) * O, r.height = O, r.left = 0, r.width = e.width;
1955
+ r.x = r.left + t.x, r.y = r.top + t.y, r.top = Math.floor(i / k) * k, r.height = k, r.left = 0, r.width = e.width;
1844
1956
  let a;
1845
- return n.y > 0 ? (a = O - i % O, r.height = Math.ceil((r.height + n.y - a) / O) * O) : (a = i % O, r.height = Math.ceil((r.height - n.y - a) / O) * O, r.top -= r.height - O), r.height = Math.max(r.height, O), r;
1957
+ return n.y > 0 ? (a = k - i % k, r.height = Math.ceil((r.height + n.y - a) / k) * k) : (a = i % k, r.height = Math.ceil((r.height - n.y - a) / k) * k, r.top -= r.height - k), r.height = Math.max(r.height, k), r;
1846
1958
  },
1847
1959
  function({ transform: e }) {
1848
- if (!v) return e;
1849
- let [t, r] = h(n).map((e) => Math.ceil(e / y) * O);
1850
- return e.top < t && (e.height = Math.max(e.height - (t - e.top), O), e.top = t), e.height + e.top >= r && (e.height = Math.max(r - e.top, O)), e;
1960
+ if (!y) return e;
1961
+ let [t, r] = h(n).map((e) => Math.ceil(e / b) * k);
1962
+ return e.top < t && (e.height = Math.max(e.height - (t - e.top), k), e.top = t), e.height + e.top >= r && (e.height = Math.max(r - e.top, k)), e;
1851
1963
  },
1852
- C,
1853
- oe(O)
1964
+ w,
1965
+ se(k)
1854
1966
  ]
1855
- }), [te, V] = xn(I.isToday);
1967
+ }), [te, H] = An(L.isToday);
1856
1968
  i(() => {
1857
- let e = j.current;
1858
- if (e) return N(e, {
1969
+ let e = N.current;
1970
+ if (e) return P(e, {
1859
1971
  data: { date: n },
1860
1972
  onDrop: async (e) => {
1861
1973
  let [t] = await Promise.all(e.items.filter((e) => e.kind === "text" && e.types.has("event") && "getText" in e).map(async (e) => {
1862
1974
  let t = await e.getText("event");
1863
1975
  return JSON.parse(t);
1864
- })), r = P(), i = wn(r.top, g, y), a = wn(r.height, g, y), s = _ ? b * 60 : 0, c = f.get(t.key), l = c ? ke(w, c.date, c.date) : 0;
1976
+ })), r = F(), i = Nn(r.top, g, b), a = Nn(r.height, g, b), s = v ? x * 60 : 0, c = f.get(t.key), l = c ? Ae(T, c.date, c.date) : 0;
1865
1977
  if (c && l + c.duration > 1440) {
1866
- if (v && (b > 0 || x < 24)) {
1867
- z.stop({
1978
+ if (y && (x > 0 || S < 24)) {
1979
+ B.stop({
1868
1980
  x: e.x,
1869
1981
  y: e.y
1870
1982
  });
1871
1983
  return;
1872
1984
  }
1873
- let r = w.getStartOfDay(w.fromMillis(t.date)), a = ke(w, c.date, r) + s + t.start - l, u = s + i - a, d = Math.floor(u / 1440);
1874
- o(t.key, w.addDays(n, d), {
1985
+ let r = T.getStartOfDay(T.fromMillis(t.date)), a = Ae(T, c.date, r) + s + t.start - l, u = s + i - a, d = Math.floor(u / 1440);
1986
+ o(t.key, T.addDays(n, d), {
1875
1987
  from: u - d * 24 * 60,
1876
1988
  duration: c.duration
1877
1989
  });
1878
- } else _ ? o(t.key, n, {
1879
- from: i + b * 60,
1990
+ } else v ? o(t.key, n, {
1991
+ from: i + x * 60,
1880
1992
  duration: a
1881
1993
  }) : o(t.key, n, {
1882
1994
  from: i,
1883
1995
  duration: a
1884
1996
  });
1885
- z.stop({
1997
+ B.stop({
1886
1998
  x: e.x,
1887
1999
  y: e.y
1888
2000
  });
1889
2001
  },
1890
2002
  getDropOperationForPoint: (e, t) => {
1891
- if (S || !e.has("event") || l && l(n)) return "cancel";
1892
- let { isPast: r, isToday: i } = I;
1893
- if (v) {
2003
+ if (C || !e.has("event") || l && l(n)) return "cancel";
2004
+ let { isPast: r, isToday: i } = L;
2005
+ if (y) {
1894
2006
  if (!i && r) return "cancel";
1895
- let [e, t] = h(n).map((e) => e * g), a = P();
2007
+ let [e, t] = h(n).map((e) => e * g), a = F();
1896
2008
  if (a.y < e || a.y > t || i && a.height > t - e) return "cancel";
1897
2009
  }
1898
2010
  return t[0];
1899
2011
  }
1900
2012
  });
1901
2013
  }, [
1902
- z,
1903
- w,
1904
- S,
2014
+ B,
2015
+ T,
2016
+ C,
1905
2017
  f,
1906
2018
  l,
1907
2019
  h,
1908
- P,
1909
- _,
2020
+ F,
2021
+ v,
2022
+ S,
1910
2023
  x,
1911
- b,
1912
2024
  o,
1913
- v,
2025
+ y,
1914
2026
  g,
1915
- N,
2027
+ P,
1916
2028
  n,
1917
- y,
1918
- I
2029
+ b,
2030
+ L
1919
2031
  ]);
1920
- let { listeners: ne } = lt({
1921
- distance: Math.max(Math.min(5, y), 1),
2032
+ let { listeners: ne, ref: re } = ft({
2033
+ distance: Math.max(Math.min(5, b), 1),
2034
+ touchDelay: _,
1922
2035
  onMoveStart: (e) => {
1923
- if (!S) {
1924
- if (v) {
1925
- let { isToday: e, isPast: t } = I;
2036
+ if (!C) {
2037
+ if (y) {
2038
+ let { isToday: e, isPast: t } = L;
1926
2039
  if (t && !e) return !1;
1927
2040
  }
1928
- z.start({
2041
+ B.start({
2042
+ x: e.clientX,
2043
+ y: e.clientY
2044
+ }), e.pointerType === "touch" && B.move({
1929
2045
  x: e.clientX,
1930
2046
  y: e.clientY
1931
2047
  });
1932
2048
  }
1933
2049
  },
1934
2050
  onMove: (e) => {
1935
- if (L) z.move({
2051
+ if (R) B.move({
1936
2052
  x: e.clientX,
1937
2053
  y: e.clientY
1938
2054
  });
1939
- else if (B) {
1940
- if (v) {
1941
- let [t, r] = ee(n), i = e.clientY - B.top;
2055
+ else if (V) {
2056
+ if (y) {
2057
+ let [t, r] = j(n), i = e.clientY - V.top;
1942
2058
  if (i < t || i > r) {
1943
- z.stop({
2059
+ B.stop({
1944
2060
  x: e.clientX,
1945
2061
  y: e.clientY
1946
2062
  });
1947
2063
  return;
1948
2064
  }
1949
2065
  }
1950
- L || z.move({
2066
+ R || B.move({
1951
2067
  x: e.clientX,
1952
2068
  y: e.clientY
1953
2069
  });
1954
2070
  }
1955
2071
  },
1956
2072
  onMoveEnd: (e) => {
1957
- z.stop({
2073
+ B.stop({
1958
2074
  x: e.clientX,
1959
2075
  y: e.clientY
1960
- }), L && (_ ? s(n, {
1961
- from: k(R.top) + b * 60,
1962
- duration: k(R.height)
2076
+ }), R && (v ? s(n, {
2077
+ from: A(z.top) + x * 60,
2078
+ duration: A(z.height)
1963
2079
  }) : s(n, {
1964
- from: k(R.top),
1965
- duration: k(R.height)
2080
+ from: A(z.top),
2081
+ duration: A(z.height)
1966
2082
  }));
1967
2083
  }
1968
- }), H = ct(j, t), re = A(w, te, {
1969
- hourMin: b,
1970
- hideMinMaxTime: _
1971
- }), ie = () => d.current?.(n, k(R.top), k(R.height));
2084
+ }), ie = c(() => ({
2085
+ drawerRef: N,
2086
+ containerRef: ee
2087
+ }), []), ae = dt(N, re, t), oe = M(T, te, {
2088
+ hourMin: x,
2089
+ hideMinMaxTime: v
2090
+ }), ce = () => d.current?.(n, A(z.top), A(z.height));
1972
2091
  return /* @__PURE__ */ G("div", {
1973
2092
  ...a,
1974
2093
  ...ne,
1975
- ref: H,
1976
- className: D(a.className, Sn.root, {
1977
- [Sn.root_timeLimit]: v,
1978
- [Sn.root_isToday]: I.isToday,
1979
- [Sn.root_isPast]: I.isPast,
1980
- [Sn.root_offLimits]: V
2094
+ ref: ae,
2095
+ className: O(a.className, jn.root, {
2096
+ [jn.root_timeLimit]: y,
2097
+ [jn.root_isToday]: L.isToday,
2098
+ [jn.root_isPast]: L.isPast,
2099
+ [jn.root_offLimits]: H
1981
2100
  }),
1982
2101
  style: {
1983
2102
  ...a.style,
1984
2103
  "--offset": te * g
1985
2104
  },
1986
2105
  children: [
1987
- I.isToday && !V && /* @__PURE__ */ W(Dt, {
2106
+ L.isToday && !H && /* @__PURE__ */ W(Ft, {
1988
2107
  container: m.current,
1989
2108
  children: /* @__PURE__ */ W("span", {
1990
2109
  tabIndex: -1,
1991
- className: Sn.root__timeLine,
1992
- "data-now": re,
2110
+ className: jn.root__timeLine,
2111
+ "data-now": oe,
1993
2112
  style: { "--offset": te * g }
1994
2113
  })
1995
2114
  }),
1996
2115
  /* @__PURE__ */ W("div", {
1997
- ref: M,
1998
- className: Sn.root__container,
1999
- children: r
2116
+ ref: ee,
2117
+ className: jn.root__container,
2118
+ children: /* @__PURE__ */ W(On.Provider, {
2119
+ value: ie,
2120
+ children: r
2121
+ })
2000
2122
  }),
2001
- L && /* @__PURE__ */ G(ze, { children: [/* @__PURE__ */ W("div", {
2002
- className: Sn.root__spotlight,
2003
- style: R ? { ...R } : void 0
2004
- }), /* @__PURE__ */ W(Rt, {
2123
+ R && /* @__PURE__ */ G(Be, { children: [/* @__PURE__ */ W("div", {
2124
+ className: jn.root__spotlight,
2125
+ style: z ? { ...z } : void 0
2126
+ }), /* @__PURE__ */ W(Kt, {
2005
2127
  coordinates: {
2006
- x: R.x,
2007
- y: R.y
2128
+ x: z.x,
2129
+ y: z.y
2008
2130
  },
2009
- children: ie()
2131
+ children: ce()
2010
2132
  })] })
2011
2133
  ]
2012
2134
  });
2013
2135
  }
2014
- function wn(e, t, n) {
2136
+ function Nn(e, t, n) {
2015
2137
  return Math.round(e / t / n) * n;
2016
2138
  }
2017
2139
  // src/hooks/useAbsEventRect.ts
2018
- function Tn(e, t) {
2019
- let [n, r] = d(null);
2020
- return Ke(() => {
2021
- let n = e.current, i = e.current?.parentElement;
2022
- if (n && i) {
2023
- let { height: e, width: a, ...o } = P(n), { left: s, top: c } = Oe(o, P(i));
2024
- r(Te(t, {
2140
+ function Pn(e, t, n) {
2141
+ let [r, i] = d(null);
2142
+ return qe(() => {
2143
+ let r = e.current, a = t.current;
2144
+ if (r && a) {
2145
+ let { height: e, width: t, ...o } = F(r), { left: s, top: c } = ke(o, F(a));
2146
+ i(Ee(n, {
2025
2147
  height: e,
2026
- width: a,
2148
+ width: t,
2027
2149
  x: s,
2028
2150
  y: c
2029
2151
  }));
2030
2152
  }
2031
- }, [e, ...Object.values(t)]), n;
2153
+ }, [
2154
+ e,
2155
+ t,
2156
+ ...Object.values(n)
2157
+ ]), r;
2032
2158
  }
2033
2159
  // src/hooks/useCanResizeEvent.ts
2034
- function En(e, t) {
2035
- let [n, r] = d(!0), { preventOutBoundsChanges: i } = J(), { isBefore: a, isToday: o } = K(), { getTimeFrame: s } = bn();
2036
- return Ke(() => {
2160
+ function Fn(e, t) {
2161
+ let [n, r] = d(!0), { preventOutBoundsChanges: i } = J(), { isBefore: a, isToday: o } = K(), { getTimeFrame: s } = Dn();
2162
+ return qe(() => {
2037
2163
  if (t && i) {
2038
2164
  if (a(e) && !o(e)) r(!1);
2039
2165
  else if (o(e)) {
@@ -2051,20 +2177,20 @@ function En(e, t) {
2051
2177
  ]), n;
2052
2178
  }
2053
2179
  var Q = {
2054
- root: "_root_d2kfg_1",
2055
- root_isDragging: "_root_isDragging_d2kfg_10",
2056
- root__resizeTop: "_root__resizeTop_d2kfg_10",
2057
- root__resizeBottom: "_root__resizeBottom_d2kfg_12",
2058
- root_isResizing: "_root_isResizing_d2kfg_14",
2059
- root_isDisabled: "_root_isDisabled_d2kfg_41",
2060
- root__container: "_root__container_d2kfg_57",
2061
- root__dragPreview: "_root__dragPreview_d2kfg_104",
2062
- root_isPreview: "_root_isPreview_d2kfg_110",
2063
- root_isResizeSource: "_root_isResizeSource_d2kfg_115"
2180
+ root: "_root_1g6ad_1",
2181
+ root_isDragging: "_root_isDragging_1g6ad_12",
2182
+ root__resizeTop: "_root__resizeTop_1g6ad_12",
2183
+ root__resizeBottom: "_root__resizeBottom_1g6ad_14",
2184
+ root_isResizing: "_root_isResizing_1g6ad_16",
2185
+ root_isDisabled: "_root_isDisabled_1g6ad_43",
2186
+ root__container: "_root__container_1g6ad_59",
2187
+ root__dragPreview: "_root__dragPreview_1g6ad_108",
2188
+ root_isPreview: "_root_isPreview_1g6ad_114",
2189
+ root_isResizeSource: "_root_isResizeSource_1g6ad_119"
2064
2190
  };
2065
2191
  // src/components/day-week-event/DayWeekEvent.tsx
2066
- function Dn(e) {
2067
- let { ref: t, eventData: n, children: r, ...a } = e, { eventMap: o, ...s } = J(), c = K(), { timeStep: l, preventOutBoundsChanges: d, disabled: f } = s, p = u(null), m = u(null), h = u(null), { viewportRef: g, getTimeFrame: _, pxPerMinute: v, resize: y, resizing: b } = bn(), x = l * v, S = Tn(p, n.rect), C = En(o.get(n.key)?.date ?? n.date, S), { attributes: w, isDragging: T, overElement: E, overData: O, register: k, setOverlayTransform: ee } = Ne(({ registerDragSource: e, draggable: t, droppable: n, setTransform: r, isActive: i }) => {
2192
+ function In(e) {
2193
+ let { ref: t, eventData: n, children: r, ...a } = e, { eventMap: o, ...s } = J(), c = K(), { timeStep: l, preventOutBoundsChanges: d, disabled: f } = s, p = u(null), m = u(null), h = u(null), { viewportRef: g, getTimeFrame: _, pxPerMinute: v, resize: y, resizing: b } = Dn(), x = l * v, { drawerRef: S, containerRef: C } = kn(), w = Pn(p, C, n.rect), T = Fn(o.get(n.key)?.date ?? n.date, w), { attributes: E, isDragging: D, overElement: k, overData: A, register: j, setOverlayTransform: M } = Pe(({ registerDragSource: e, draggable: t, droppable: n, setTransform: r, isActive: i }) => {
2068
2194
  let a = i(p.current), [o, s] = a ? [...n.dropTargets].pop() ?? [null, null] : [null, null];
2069
2195
  return {
2070
2196
  attributes: t.attributes,
@@ -2074,69 +2200,69 @@ function Dn(e) {
2074
2200
  register: e,
2075
2201
  setOverlayTransform: r
2076
2202
  };
2077
- }), A = Zt(T ? E : null), [{ isActive: j, transform: M, context: N }, P] = sn({
2203
+ }), N = an(D ? k : null), [{ isActive: ee, transform: P, context: F }, I] = mn({
2078
2204
  activeNode: (e) => e === "overlay" ? p.current : e === "top" ? m.current : h.current,
2079
- containerNode: (e) => e === "overlay" ? g.current : p.current?.parentElement?.parentElement ?? null,
2205
+ containerNode: (e) => e === "overlay" ? g.current : S.current,
2080
2206
  modifiers: [
2081
2207
  function({ activeNodeRect: e, containerNodeRect: t, context: n, transform: r, translate: i, initialTranslate: a }) {
2082
- if (n !== "overlay" || !t || !e || !A) return r;
2083
- r.x = i.x + a.x - t.left, r.y = i.y + a.y - t.top, r.left = A.left - t.left, r.width = A.width, r.top = e.top - t.top, r.height = e.height;
2208
+ if (n !== "overlay" || !t || !e || !N) return r;
2209
+ r.x = i.x + a.x - t.left, r.y = i.y + a.y - t.top, r.left = N.left - t.left, r.width = N.width, r.top = e.top - t.top, r.height = e.height;
2084
2210
  let o;
2085
2211
  return i.y > 0 ? (o = x - (a.y - e.top) % x, r.top += Math.ceil((i.y - o) / x) * x) : (o = (a.y - e.top) % x, r.top += Math.floor((i.y + o) / x) * x), r;
2086
2212
  },
2087
2213
  function({ transform: e, context: t }) {
2088
- if (!d || t !== "overlay" || !O) return e;
2089
- let [n, r] = _(O.date).map((e) => Math.ceil(e / l) * x);
2214
+ if (!d || t !== "overlay" || !A) return e;
2215
+ let [n, r] = _(A.date).map((e) => Math.ceil(e / l) * x);
2090
2216
  return e.top < n && (e.top = n), e.top + e.height > r && (e.top = r - e.height), e;
2091
2217
  },
2092
- On(x)
2218
+ Ln(x)
2093
2219
  ]
2094
- }), F = ve(() => y.end(), (e) => {
2095
- P.stop({
2220
+ }), L = ye(() => y.end(), (e) => {
2221
+ I.stop({
2096
2222
  x: e.clientX,
2097
2223
  y: e.clientY
2098
2224
  });
2099
- }), I = (e) => ({
2100
- onMoveStart: (t) => (P.start({
2225
+ }), R = (e) => ({
2226
+ onMoveStart: (t) => (I.start({
2101
2227
  x: t.clientX,
2102
2228
  y: t.clientY
2103
2229
  }, e), y.start(n.key, e, t.clientX, t.clientY), !0),
2104
2230
  onMove: (e) => {
2105
- P.move({
2231
+ I.move({
2106
2232
  x: e.clientX,
2107
2233
  y: e.clientY
2108
2234
  }), y.move(e.clientX, e.clientY);
2109
2235
  },
2110
- onMoveEnd: F
2111
- }), { listeners: L } = lt(I("bottom")), { listeners: R } = lt(I("top")), z = ct(p, t), B = j && T && N === "overlay", te = b?.key === n.key, V = q((e) => {
2112
- N === "overlay" && E && ee(e);
2236
+ onMoveEnd: L
2237
+ }), { listeners: z } = ft(R("bottom")), { listeners: B } = ft(R("top")), V = dt(p, t), te = ee && D && F === "overlay", H = b?.key === n.key, ne = q((e) => {
2238
+ F === "overlay" && k && M(e);
2113
2239
  });
2114
2240
  i(() => {
2115
- V(M);
2116
- }, [V, ...Object.values(M)]), i(() => {
2241
+ ne(P);
2242
+ }, [ne, ...Object.values(P)]), i(() => {
2117
2243
  if (!p.current) return;
2118
2244
  let e = {
2119
- ...be(n, "rect"),
2245
+ ...xe(n, "rect"),
2120
2246
  date: c.toMillis(n.date)
2121
2247
  }, t = [{ event: JSON.stringify(e) }];
2122
- return k(p.current, {
2248
+ return j(p.current, {
2123
2249
  getItems() {
2124
2250
  return t;
2125
2251
  },
2126
2252
  onDragStart(e) {
2127
- P.start({
2253
+ I.start({
2128
2254
  x: e.x,
2129
2255
  y: e.y
2130
2256
  }, "overlay");
2131
2257
  },
2132
2258
  onDragMove(e) {
2133
- P.move({
2259
+ I.move({
2134
2260
  x: e.x,
2135
2261
  y: e.y
2136
2262
  });
2137
2263
  },
2138
2264
  onDragEnd(e) {
2139
- P.stop({
2265
+ I.stop({
2140
2266
  x: e.x,
2141
2267
  y: e.y
2142
2268
  });
@@ -2146,33 +2272,33 @@ function Dn(e) {
2146
2272
  }
2147
2273
  });
2148
2274
  }, [
2149
- P,
2275
+ I,
2150
2276
  n,
2151
- k
2277
+ j
2152
2278
  ]);
2153
- let ne = D(a.className, Q.root, {
2154
- [Q.root_isDragging]: B,
2155
- [Q.root_isResizeSource]: te,
2279
+ let re = O(a.className, Q.root, {
2280
+ [Q.root_isDragging]: te,
2281
+ [Q.root_isResizeSource]: H,
2156
2282
  [Q.root_isDisabled]: f
2157
- }), H = {
2283
+ }), ie = {
2158
2284
  ...a.style,
2159
2285
  top: `${n.rect.y}%`,
2160
2286
  left: `${n.rect.x}%`,
2161
2287
  width: `${n.rect.width}%`,
2162
2288
  height: `${n.rect.height}%`
2163
- }, re = q(ve(a.onPointerDown, (e) => e.stopPropagation()));
2164
- return /* @__PURE__ */ W(ze, { children: /* @__PURE__ */ G("div", {
2289
+ }, ae = q(ye(a.onPointerDown, (e) => e.stopPropagation()));
2290
+ return /* @__PURE__ */ W(Be, { children: /* @__PURE__ */ G("div", {
2165
2291
  ...a,
2166
- ...w,
2167
- ref: z,
2168
- className: ne,
2169
- style: H,
2170
- onPointerDown: re,
2292
+ ...E,
2293
+ ref: V,
2294
+ className: re,
2295
+ style: ie,
2296
+ onPointerDown: ae,
2171
2297
  "data-continues-before": n.isStart ? void 0 : "",
2172
2298
  "data-continues-after": n.isEnd ? void 0 : "",
2173
2299
  children: [
2174
- C && n.isStart && /* @__PURE__ */ W("div", {
2175
- ...R,
2300
+ T && n.isStart && /* @__PURE__ */ W("div", {
2301
+ ...B,
2176
2302
  ref: m,
2177
2303
  className: Q.root__resizeTop
2178
2304
  }),
@@ -2182,22 +2308,22 @@ function Dn(e) {
2182
2308
  className: Q.root__container,
2183
2309
  children: r
2184
2310
  }),
2185
- C && n.isEnd && /* @__PURE__ */ W("div", {
2186
- ...L,
2311
+ T && n.isEnd && /* @__PURE__ */ W("div", {
2312
+ ...z,
2187
2313
  ref: h,
2188
2314
  className: Q.root__resizeBottom
2189
2315
  })
2190
2316
  ]
2191
2317
  }) });
2192
2318
  }
2193
- function On(e) {
2319
+ function Ln(e) {
2194
2320
  return (t) => {
2195
- let n = [oe(e)];
2196
- return t.context === "overlay" && n.push(S), y(n, t);
2321
+ let n = [se(e)];
2322
+ return t.context === "overlay" && n.push(C), b(n, t);
2197
2323
  };
2198
2324
  }
2199
2325
  // src/components/day-week-event/DayWeekEventPreview.tsx
2200
- function kn({ part: e, timelineMinutes: t, children: n }) {
2326
+ function Rn({ part: e, timelineMinutes: t, children: n }) {
2201
2327
  let r = (e) => `${e / t * 100}%`;
2202
2328
  return /* @__PURE__ */ W("div", {
2203
2329
  "aria-hidden": "true",
@@ -2217,30 +2343,30 @@ function kn({ part: e, timelineMinutes: t, children: n }) {
2217
2343
  });
2218
2344
  }
2219
2345
  var $ = {
2220
- root: "_root_19kk1_1",
2221
- root_scrollable: "_root_scrollable_19kk1_11",
2222
- root__body: "_root__body_19kk1_11",
2223
- root__head: "_root__head_19kk1_15",
2224
- root__main: "_root__main_19kk1_30",
2225
- root__viewport: "_root__viewport_19kk1_44",
2226
- root__column: "_root__column_19kk1_52",
2227
- root__headerCell: "_root__headerCell_19kk1_77",
2228
- root__headerCellDay: "_root__headerCellDay_19kk1_104",
2229
- root__headerCellLabel: "_root__headerCellLabel_19kk1_111",
2230
- root__headerCellName: "_root__headerCellName_19kk1_118",
2231
- root__headerCellToday: "_root__headerCellToday_19kk1_125",
2232
- root__row: "_root__row_19kk1_140",
2233
- root__timeStep: "_root__timeStep_19kk1_162",
2234
- root__timeStep_overTime: "_root__timeStep_overTime_19kk1_174",
2235
- root__rowHeadTime: "_root__rowHeadTime_19kk1_178",
2236
- root__hiddenEventsLayer: "_root__hiddenEventsLayer_19kk1_194",
2237
- root__hiddenEventsColumn: "_root__hiddenEventsColumn_19kk1_207",
2238
- root__hiddenEvents: "_root__hiddenEvents_19kk1_194",
2239
- root__hiddenEventsIcon: "_root__hiddenEventsIcon_19kk1_254"
2346
+ root: "_root_143fq_1",
2347
+ root_scrollable: "_root_scrollable_143fq_11",
2348
+ root__body: "_root__body_143fq_11",
2349
+ root__head: "_root__head_143fq_15",
2350
+ root__main: "_root__main_143fq_33",
2351
+ root__viewport: "_root__viewport_143fq_47",
2352
+ root__column: "_root__column_143fq_58",
2353
+ root__headerCell: "_root__headerCell_143fq_83",
2354
+ root__headerCellDay: "_root__headerCellDay_143fq_110",
2355
+ root__headerCellLabel: "_root__headerCellLabel_143fq_117",
2356
+ root__headerCellName: "_root__headerCellName_143fq_124",
2357
+ root__headerCellToday: "_root__headerCellToday_143fq_131",
2358
+ root__row: "_root__row_143fq_146",
2359
+ root__timeStep: "_root__timeStep_143fq_168",
2360
+ root__timeStep_overTime: "_root__timeStep_overTime_143fq_180",
2361
+ root__rowHeadTime: "_root__rowHeadTime_143fq_184",
2362
+ root__hiddenEventsLayer: "_root__hiddenEventsLayer_143fq_200",
2363
+ root__hiddenEventsColumn: "_root__hiddenEventsColumn_143fq_216",
2364
+ root__hiddenEvents: "_root__hiddenEvents_143fq_200",
2365
+ root__hiddenEventsIcon: "_root__hiddenEventsIcon_143fq_265"
2240
2366
  };
2241
2367
  // src/components/day-week-view/HiddenEvents.tsx
2242
- function An({ scrollerRef: e, columns: t, rowHeight: n }) {
2243
- let { hourMin: r, hideMinMaxTime: a, size: o } = J(), s = K(), l = Ge(), { addGlobalListener: u, removeGlobalListener: f } = at(), [p, m] = d(null), h = n / 60, g = q(() => {
2368
+ function zn({ scrollerRef: e, columns: t, rowHeight: n }) {
2369
+ let { hourMin: r, hideMinMaxTime: a, size: o } = J(), s = K(), l = Ke(), { addGlobalListener: u, removeGlobalListener: f } = ot(), [p, m] = d(null), h = n / 60, g = q(() => {
2244
2370
  let t = e.current;
2245
2371
  if (!t) return;
2246
2372
  let n = {
@@ -2248,7 +2374,7 @@ function An({ scrollerRef: e, columns: t, rowHeight: n }) {
2248
2374
  height: t.clientHeight
2249
2375
  };
2250
2376
  m((e) => e?.top === n.top && e.height === n.height ? e : n);
2251
- }), _ = qe(g);
2377
+ }), _ = Je(g);
2252
2378
  i(() => {
2253
2379
  let t = e.current;
2254
2380
  if (t) return g(), u(t, "scroll", g, { passive: !0 }), _?.observe(t), () => {
@@ -2265,7 +2391,7 @@ function An({ scrollerRef: e, columns: t, rowHeight: n }) {
2265
2391
  n,
2266
2392
  t
2267
2393
  ]);
2268
- let v = c(() => p && p.height > 0 ? t.map((e) => I(e, h, p.top, p.height)) : null, [
2394
+ let v = c(() => p && p.height > 0 ? t.map((e) => L(e, h, p.top, p.height)) : null, [
2269
2395
  t,
2270
2396
  h,
2271
2397
  p
@@ -2277,7 +2403,7 @@ function An({ scrollerRef: e, columns: t, rowHeight: n }) {
2277
2403
  }), b = (e, t) => {
2278
2404
  let [n] = e;
2279
2405
  if (!n) return null;
2280
- let i = e.length === 1 && o !== "narrow" ? A(s, n.start, {
2406
+ let i = e.length === 1 && o !== "narrow" ? M(s, n.start, {
2281
2407
  hourMin: r,
2282
2408
  hideMinMaxTime: a
2283
2409
  }) : e.length;
@@ -2287,7 +2413,7 @@ function An({ scrollerRef: e, columns: t, rowHeight: n }) {
2287
2413
  "data-direction": t,
2288
2414
  "aria-label": t === "above" ? l.earlier(e.length) : l.later(e.length),
2289
2415
  onClick: () => y(n),
2290
- children: [/* @__PURE__ */ W(xt, {
2416
+ children: [/* @__PURE__ */ W(kt, {
2291
2417
  "aria-hidden": "true",
2292
2418
  className: $.root__hiddenEventsIcon
2293
2419
  }), i]
@@ -2302,39 +2428,41 @@ function An({ scrollerRef: e, columns: t, rowHeight: n }) {
2302
2428
  });
2303
2429
  }
2304
2430
  // src/components/day-week-view/useTimeColumnWidth.ts
2305
- function jn(e, t, n) {
2306
- let [r, i] = d();
2307
- return Ke(() => {
2308
- let t = !1, r = () => {
2309
- let r = e.current;
2310
- if (t || !r) return;
2311
- let a = 0, o = document.createRange();
2312
- if (typeof o.getBoundingClientRect != "function") return;
2313
- for (let e of r.querySelectorAll("time")) {
2314
- o.selectNodeContents(e);
2315
- let t = getComputedStyle(e), n = o.getBoundingClientRect().width;
2316
- a = Math.max(a, n + parseFloat(t.paddingLeft) + parseFloat(t.paddingRight));
2431
+ function Bn(e, t, n, r) {
2432
+ let [i, a] = d();
2433
+ return qe(() => {
2434
+ let n = !1, i = () => {
2435
+ let i = e.current;
2436
+ if (n || !i) return;
2437
+ let o = 0, s = document.createRange();
2438
+ if (typeof s.getBoundingClientRect != "function") return;
2439
+ for (let e of t.current) {
2440
+ if (!e) continue;
2441
+ s.selectNodeContents(e);
2442
+ let t = getComputedStyle(e), n = s.getBoundingClientRect().width;
2443
+ o = Math.max(o, n + parseFloat(t.paddingLeft) + parseFloat(t.paddingRight));
2317
2444
  }
2318
- let s = r.closest(`.${$.root}`)?.parentElement ?? document.body, c = parseFloat(getComputedStyle(s).getPropertyValue("--ww-time-column"));
2319
- i(a > (Number.isNaN(c) ? n : c) ? Math.ceil(a) : void 0);
2445
+ let c = i.parentElement ?? document.body, l = parseFloat(getComputedStyle(c).getPropertyValue("--ww-time-column"));
2446
+ a(o > (Number.isNaN(l) ? r : l) ? Math.ceil(o) : void 0);
2320
2447
  };
2321
- return r(), document.fonts?.ready.then(r), () => {
2322
- t = !0;
2448
+ return i(), document.fonts?.ready.then(i), () => {
2449
+ n = !0;
2323
2450
  };
2324
2451
  }, [
2325
- n,
2326
- t.join("|"),
2452
+ r,
2453
+ n.join("|"),
2454
+ t,
2327
2455
  e
2328
- ]), r;
2456
+ ]), i;
2329
2457
  }
2330
2458
  // src/components/day-week-view/DayWeekView.tsx
2331
- var Mn = {
2459
+ var Vn = {
2332
2460
  regular: 64,
2333
2461
  compact: 44,
2334
2462
  narrow: 40
2335
2463
  };
2336
- function Nn({ rowHeight: e, ...t }) {
2337
- let { viewValue: r, hourMin: i, hourMax: a, view: o, eventMap: s, preventOutBoundsChanges: l, eventRenderer: d, timeStep: f, scrollable: p, size: h, hideMinMaxTime: g, disabled: _, getIsDayDisabled: v, onEventChange: y, pointerPreviewRenderer: x } = J(), S = K(), C = Ge(), { getMonthDay: w, getWeekDay: E, isToday: O, weekDayShortName: k } = S, ee = gt(), A = e ?? m[h], j = u(null), M = u(null), N = c(() => T(S, f, {
2464
+ function Hn({ rowHeight: e, ...t }) {
2465
+ let { viewValue: r, hourMin: i, hourMax: a, view: o, eventMap: s, preventOutBoundsChanges: l, eventRenderer: d, timeStep: f, scrollable: p, size: h, hideMinMaxTime: g, disabled: _, getIsDayDisabled: v, onEventChange: y, pointerPreviewRenderer: b } = J(), S = K(), C = Ke(), { getMonthDay: w, getWeekDay: T, isToday: D, weekDayShortName: k } = S, A = wt(), j = e ?? m[h], M = u(null), N = u(null), ee = u(null), P = _t(), F = c(() => E(S, f, {
2338
2466
  hourMin: i,
2339
2467
  hourMax: a,
2340
2468
  hideMinMaxTime: g
@@ -2345,11 +2473,11 @@ function Nn({ rowHeight: e, ...t }) {
2345
2473
  a,
2346
2474
  g,
2347
2475
  l
2348
- ]), P = jn(j, c(() => N.map(({ time: e }) => e), [N]), Mn[h]), F = c(() => ue(S, o, r), [
2476
+ ]), I = c(() => F.map(({ time: e }) => e), [F]), L = _t(), R = Bn(M, L.elements, I, Vn[h]), z = c(() => de(S, o, r), [
2349
2477
  S,
2350
2478
  o,
2351
2479
  r
2352
- ]), I = c(() => ({
2480
+ ]), B = c(() => ({
2353
2481
  hourMin: i,
2354
2482
  hourMax: a,
2355
2483
  hideMinMaxTime: g
@@ -2357,28 +2485,29 @@ function Nn({ rowHeight: e, ...t }) {
2357
2485
  i,
2358
2486
  a,
2359
2487
  g
2360
- ]), L = c(() => b(s, S, N.length * 60, F, I), [
2488
+ ]), V = c(() => x(s, S, F.length * 60, z, B), [
2361
2489
  s,
2362
2490
  S,
2363
- N.length,
2364
- F,
2365
- I
2366
- ]), R = c(() => L.map(({ events: e }) => e), [L]), { state: z, actions: B, previewOf: te } = vn({
2367
- days: F,
2368
- viewportRef: j,
2491
+ F.length,
2492
+ z,
2493
+ B
2494
+ ]), te = c(() => V.map(({ events: e }) => e), [V]), { state: H, actions: ne, previewOf: re } = Tn({
2495
+ days: z,
2496
+ viewportRef: N,
2497
+ columnsRef: P.elements,
2369
2498
  dateUtils: S,
2370
- bounds: I,
2499
+ bounds: B,
2371
2500
  timeStep: f,
2372
2501
  preventOutBoundsChanges: l,
2373
2502
  disabled: _,
2374
2503
  getIsDayDisabled: v,
2375
2504
  eventMap: s,
2376
2505
  onEventChange: y
2377
- }), V = c(() => z ? De(z.range[0], z.range[1], F.length, I) : [], [
2378
- z,
2379
- F.length,
2380
- I
2381
- ]), ne = z ? s.get(z.key)?.value : void 0, H = n((e) => ae(S, e, {
2506
+ }), ie = c(() => H ? Oe(H.range[0], H.range[1], z.length, B) : [], [
2507
+ H,
2508
+ z.length,
2509
+ B
2510
+ ]), ae = H ? s.get(H.key)?.value : void 0, se = n((e) => oe(S, e, {
2382
2511
  hourMin: i,
2383
2512
  hourMax: a,
2384
2513
  hideMinMaxTime: g
@@ -2387,8 +2516,8 @@ function Nn({ rowHeight: e, ...t }) {
2387
2516
  g,
2388
2517
  a,
2389
2518
  i
2390
- ]), re = c(() => F.map((e, t) => {
2391
- let n = E(e), r = O(e), i = L[t]?.events ?? [];
2519
+ ]), ce = c(() => z.map((e, t) => {
2520
+ let n = T(e), r = D(e), i = V[t]?.events ?? [];
2392
2521
  return {
2393
2522
  attributes: r ? { "data-is-today": !0 } : void 0,
2394
2523
  events: i,
@@ -2399,27 +2528,27 @@ function Nn({ rowHeight: e, ...t }) {
2399
2528
  weekDayNumber: n
2400
2529
  };
2401
2530
  }), [
2402
- ee,
2531
+ A,
2403
2532
  S,
2404
- F,
2405
- L,
2533
+ z,
2534
+ V,
2406
2535
  w,
2407
- E,
2408
- O,
2536
+ T,
2537
+ D,
2409
2538
  k
2410
- ]), ie = ft(), oe = t, se = $.root__head, ce = $.root__body, le = $.root__viewport, de = $.root__column, fe = $.root__headerCell, U = $.root__headerCellDay, pe = $.root__row, me = $.root__rowHeadTime, he = $.root__timeStep, ge = ct(j), _e = c(() => ({
2411
- viewportRef: j,
2412
- getTimeFrame: H,
2413
- pxPerMinute: A / 60,
2414
- resize: B,
2415
- resizing: z
2539
+ ]), le = bt(), ue = t, fe = $.root__head, pe = $.root__body, U = $.root__viewport, me = $.root__column, he = $.root__headerCell, ge = $.root__headerCellDay, _e = $.root__row, ve = $.root__rowHeadTime, ye = $.root__timeStep, be = dt(N), xe = c(() => ({
2540
+ viewportRef: N,
2541
+ getTimeFrame: se,
2542
+ pxPerMinute: j / 60,
2543
+ resize: ne,
2544
+ resizing: H
2416
2545
  }), [
2546
+ N,
2547
+ se,
2417
2548
  j,
2418
- H,
2419
- A,
2420
- B,
2421
- z
2422
- ]), ve = c(() => ({ viewportRef: j }), [j]), ye = (e, t) => /* @__PURE__ */ W(Dn, {
2549
+ ne,
2550
+ H
2551
+ ]), Se = c(() => ({ viewportRef: N }), [N]), Ce = (e, t) => /* @__PURE__ */ W(In, {
2423
2552
  "data-idx": t,
2424
2553
  eventData: e,
2425
2554
  children: d.current?.(e.value, o, {
@@ -2427,28 +2556,29 @@ function Nn({ rowHeight: e, ...t }) {
2427
2556
  isEnd: e.isEnd
2428
2557
  })
2429
2558
  }, e.key);
2430
- return /* @__PURE__ */ W(yn.Provider, {
2431
- value: _e,
2432
- children: /* @__PURE__ */ W(Ft.Provider, {
2433
- value: ve,
2434
- children: /* @__PURE__ */ G(ze, { children: [
2559
+ return /* @__PURE__ */ W(En.Provider, {
2560
+ value: xe,
2561
+ children: /* @__PURE__ */ W(Ut.Provider, {
2562
+ value: Se,
2563
+ children: /* @__PURE__ */ G(Be, { children: [
2435
2564
  /* @__PURE__ */ G("div", {
2436
- ...oe,
2437
- className: D(oe.className, $.root, { [$.root_scrollable]: p }),
2565
+ ...ue,
2566
+ ref: M,
2567
+ className: O(ue.className, $.root, { [$.root_scrollable]: p }),
2438
2568
  style: {
2439
- ...oe.style,
2440
- "--calendar-column-count": re.length,
2441
- "--scrollbar-width": ie.width,
2442
- "--scrollbar-height": ie.height,
2443
- ...P !== void 0 && { "--ww-time-column": `${P}px` }
2569
+ ...ue.style,
2570
+ "--calendar-column-count": ce.length,
2571
+ "--scrollbar-width": le.width,
2572
+ "--scrollbar-height": le.height,
2573
+ ...R !== void 0 && { "--ww-time-column": `${R}px` }
2444
2574
  },
2445
2575
  children: [/* @__PURE__ */ G("div", {
2446
- className: se,
2447
- children: [/* @__PURE__ */ W("div", { className: fe }), re.map((e) => /* @__PURE__ */ G("div", {
2448
- className: fe,
2576
+ className: fe,
2577
+ children: [/* @__PURE__ */ W("div", { className: he }), ce.map((e) => /* @__PURE__ */ G("div", {
2578
+ className: he,
2449
2579
  ...e.attributes,
2450
2580
  children: [/* @__PURE__ */ W("span", {
2451
- className: U,
2581
+ className: ge,
2452
2582
  children: e.day
2453
2583
  }), /* @__PURE__ */ G("span", {
2454
2584
  className: $.root__headerCellLabel,
@@ -2464,37 +2594,39 @@ function Nn({ rowHeight: e, ...t }) {
2464
2594
  }), /* @__PURE__ */ G("div", {
2465
2595
  className: $.root__main,
2466
2596
  children: [/* @__PURE__ */ W("div", {
2467
- ref: M,
2468
- className: ce,
2597
+ ref: ee,
2598
+ className: pe,
2469
2599
  children: /* @__PURE__ */ G("div", {
2470
- ref: ge,
2471
- className: le,
2472
- style: { height: N.length * A },
2600
+ ref: be,
2601
+ className: U,
2602
+ style: { height: F.length * j },
2473
2603
  children: [/* @__PURE__ */ W("div", {
2474
- className: de,
2475
- children: N.map(({ time: e, value: t, steps: n }, r) => /* @__PURE__ */ G("div", {
2476
- className: pe,
2604
+ className: me,
2605
+ children: F.map(({ time: e, value: t, steps: n }, r) => /* @__PURE__ */ G("div", {
2606
+ className: _e,
2477
2607
  style: {
2478
- height: A,
2479
- "--translateY": r * A,
2608
+ height: j,
2609
+ "--translateY": r * j,
2480
2610
  "--calendar-rows-count": n.length
2481
2611
  },
2482
2612
  children: [/* @__PURE__ */ W("time", {
2483
- className: me,
2613
+ ref: L.refAt(r),
2614
+ className: ve,
2484
2615
  children: e
2485
- }), n.map(([e, , t]) => /* @__PURE__ */ W("div", { className: D(he, { [$.root__timeStep_overTime]: t }) }, e))]
2616
+ }), n.map(([e, , t]) => /* @__PURE__ */ W("div", { className: O(ye, { [$.root__timeStep_overTime]: t }) }, e))]
2486
2617
  }, t))
2487
- }), re.map((e, t) => /* @__PURE__ */ W("div", {
2488
- className: de,
2618
+ }), ce.map((e, t) => /* @__PURE__ */ W("div", {
2619
+ ref: P.refAt(t),
2620
+ className: me,
2489
2621
  "data-day-index": t,
2490
2622
  ...e.attributes,
2491
- children: /* @__PURE__ */ G(Cn, {
2623
+ children: /* @__PURE__ */ G(Mn, {
2492
2624
  id: `${e.weekDayNumber}`,
2493
2625
  targetDate: e.targetDate,
2494
- children: [e.events.map((e, t) => ye(e, t)), V.filter((e) => e.dayIndex === t).map((e) => /* @__PURE__ */ W(kn, {
2626
+ children: [e.events.map((e, t) => Ce(e, t)), ie.filter((e) => e.dayIndex === t).map((e) => /* @__PURE__ */ W(Rn, {
2495
2627
  part: e,
2496
- timelineMinutes: N.length * 60,
2497
- children: ne === void 0 ? null : d.current?.(ne, o, {
2628
+ timelineMinutes: F.length * 60,
2629
+ children: ae === void 0 ? null : d.current?.(ae, o, {
2498
2630
  isStart: e.isStart,
2499
2631
  isEnd: e.isEnd
2500
2632
  })
@@ -2502,163 +2634,166 @@ function Nn({ rowHeight: e, ...t }) {
2502
2634
  })
2503
2635
  }, e.weekDayNumber))]
2504
2636
  })
2505
- }), p && /* @__PURE__ */ W(An, {
2506
- scrollerRef: M,
2507
- columns: R,
2508
- rowHeight: A
2637
+ }), p && /* @__PURE__ */ W(zn, {
2638
+ scrollerRef: ee,
2639
+ columns: te,
2640
+ rowHeight: j
2509
2641
  })]
2510
2642
  })]
2511
2643
  }),
2512
- /* @__PURE__ */ W(Vt, { pxPerMinute: A / 60 }),
2513
- z && !z.blocked && /* @__PURE__ */ W(Rt, {
2644
+ /* @__PURE__ */ W(Yt, { pxPerMinute: j / 60 }),
2645
+ H && !H.blocked && /* @__PURE__ */ W(Kt, {
2514
2646
  coordinates: {
2515
- x: z.x,
2516
- y: z.y
2647
+ x: H.x,
2648
+ y: H.y
2517
2649
  },
2518
2650
  children: (() => {
2519
- let { date: e, top: t, duration: n } = te(z.range);
2520
- return x.current?.(e, t, n);
2651
+ let { date: e, top: t, duration: n } = re(H.range);
2652
+ return b.current?.(e, t, n);
2521
2653
  })()
2522
2654
  })
2523
2655
  ] })
2524
2656
  })
2525
2657
  });
2526
2658
  }
2527
- var Pn = {
2528
- root: "_root_uggip_2",
2529
- root__head: "_root__head_uggip_22",
2530
- root__body: "_root__body_uggip_26",
2531
- root__body_readonly: "_root__body_readonly_uggip_35"
2659
+ var Un = {
2660
+ root: "_root_szob5_2",
2661
+ root__head: "_root__head_szob5_22",
2662
+ root__body: "_root__body_szob5_26",
2663
+ root__body_readonly: "_root__body_readonly_szob5_37"
2532
2664
  };
2533
2665
  // src/Calendar.tsx
2534
- function Fn(e) {
2535
- let { ref: t, disabled: n = !1, children: r, hideMinMaxTime: a = !1, timeFrame: o, startWeek: s, timeStep: l = 15, items: d, onEventCreate: f, onEventChange: p, onEventDelete: m, onEventEdit: h, eventTimeFrameResolver: g, eventKeyResolver: _, getIsDayDisabled: v, pointerPreviewFormat: y, scrollable: b = !1, view: x, defaultView: S, viewValue: C, defaultViewValue: T, onChangeView: E, onChangeViewValue: O, ...k } = e, { hourMax: ee, hourMin: A } = {
2666
+ function Wn(e) {
2667
+ let { ref: t, disabled: n = !1, children: r, hideMinMaxTime: a = !1, timeFrame: o, startWeek: s, timeStep: l = 15, items: d, onEventCreate: f, onEventChange: p, onEventDelete: m, onEventEdit: h, eventTimeFrameResolver: g, eventKeyResolver: v, getIsDayDisabled: y, pointerPreviewFormat: b, scrollable: x = !1, view: S, defaultView: C, viewValue: w, defaultViewValue: E, onChangeView: D, onChangeViewValue: k, ...A } = e, { hourMax: j, hourMin: M } = {
2536
2668
  hourMin: 0,
2537
2669
  hourMax: 24,
2538
2670
  ...o
2539
- }, M = Ye({
2671
+ }, ee = Xe({
2540
2672
  eventTimeFrameResolver: g,
2541
- eventKeyResolver: _
2542
- }), N = K(), P = s ?? N.weekStartsOn, I = u(null), L = ct(I, t), { viewValue: R, changeViewValue: z, view: B, changeView: te } = yt({
2543
- view: x,
2544
- defaultView: S,
2545
- viewValue: C,
2546
- defaultViewValue: T,
2547
- onChangeView: E,
2548
- onChangeViewValue: O,
2549
- dateUtils: N,
2550
- startWeek: P
2551
- }), V = Je(I), ne = nt(() => je({ input: "pointer" })).current, H = c(() => w(d, M.current, N, {
2552
- hourMin: A,
2673
+ eventKeyResolver: v
2674
+ }), P = K(), F = s ?? P.weekStartsOn, L = u(null), R = dt(L, t), { viewValue: z, changeViewValue: B, view: V, changeView: te } = Dt({
2675
+ view: S,
2676
+ defaultView: C,
2677
+ viewValue: w,
2678
+ defaultViewValue: E,
2679
+ onChangeView: D,
2680
+ onChangeViewValue: k,
2681
+ dateUtils: P,
2682
+ startWeek: F
2683
+ }), H = Ye(L), ne = rt(() => Me({
2684
+ input: "pointer",
2685
+ touchDelay: _
2686
+ })).current, re = c(() => T(d, ee.current, P, {
2687
+ hourMin: M,
2553
2688
  hideMinMaxTime: a
2554
2689
  }), [
2555
- N,
2690
+ P,
2556
2691
  a,
2557
- A,
2692
+ M,
2558
2693
  d,
2559
- M
2560
- ]), { goBackward: re, goForward: ie, goToday: ae } = bt({
2561
- changeViewValue: z,
2562
- dateUtils: N,
2563
- startWeek: P,
2564
- view: B,
2565
- viewValue: R
2566
- }), oe = q((e, t, n) => {
2567
- let r = H.get(e);
2568
- r && p?.(r.value, ...F(N, t, n));
2569
- }), ce = q((e, t) => {
2570
- f?.(...F(N, e, t));
2571
- }), le = q((e) => {
2572
- let t = H.get(e);
2573
- t && h?.(t.value);
2694
+ ee
2695
+ ]), { goBackward: ie, goForward: ae, goToday: oe } = Ot({
2696
+ changeViewValue: B,
2697
+ dateUtils: P,
2698
+ startWeek: F,
2699
+ view: V,
2700
+ viewValue: z
2701
+ }), se = q((e, t, n) => {
2702
+ let r = re.get(e);
2703
+ r && p?.(r.value, ...I(P, t, n));
2704
+ }), le = q((e, t) => {
2705
+ f?.(...I(P, e, t));
2574
2706
  }), ue = q((e) => {
2575
- let t = H.get(e);
2707
+ let t = re.get(e);
2708
+ t && h?.(t.value);
2709
+ }), de = q((e) => {
2710
+ let t = re.get(e);
2576
2711
  t && m?.(t.value);
2577
- }), de = Ye((e, t, n) => {
2578
- let [r, i] = se(N, e, t, n, {
2579
- hourMin: A,
2712
+ }), fe = Xe((e, t, n) => {
2713
+ let [r, i] = ce(P, e, t, n, {
2714
+ hourMin: M,
2580
2715
  hideMinMaxTime: a
2581
2716
  });
2582
- return y ? y(r, i) : j(N, r, i);
2583
- }), fe = Ye(r);
2717
+ return b ? b(r, i) : N(P, r, i);
2718
+ }), pe = Xe(r);
2584
2719
  i(() => {
2585
- if (I.current) return ne.getState().registerRootElement(I.current);
2720
+ if (L.current) return ne.getState().registerRootElement(L.current);
2586
2721
  }, [ne]);
2587
2722
  let U = {
2588
- ...k,
2589
- ref: L
2590
- }, pe = c(() => ({
2723
+ ...A,
2724
+ ref: R
2725
+ }, me = c(() => ({
2591
2726
  disabled: n,
2592
- getIsDayDisabled: v,
2727
+ getIsDayDisabled: y,
2593
2728
  preventOutBoundsChanges: !!o,
2594
2729
  changeView: te,
2595
- changeViewValue: z,
2596
- eventMap: H,
2597
- goBackward: re,
2598
- goForward: ie,
2599
- goToday: ae,
2730
+ changeViewValue: B,
2731
+ eventMap: re,
2732
+ goBackward: ie,
2733
+ goForward: ae,
2734
+ goToday: oe,
2600
2735
  hideMinMaxTime: a,
2601
- hourMax: ee,
2602
- hourMin: A,
2736
+ hourMax: j,
2737
+ hourMin: M,
2603
2738
  timeStep: l,
2604
- scrollable: b,
2605
- size: V,
2606
- startWeek: P,
2607
- view: B,
2608
- viewValue: R,
2609
- onEventCreate: ce,
2610
- onEventChange: oe,
2611
- onEventDelete: ue,
2612
- onEventEdit: le,
2613
- eventRenderer: fe,
2614
- pointerPreviewRenderer: de
2739
+ scrollable: x,
2740
+ size: H,
2741
+ startWeek: F,
2742
+ view: V,
2743
+ viewValue: z,
2744
+ onEventCreate: le,
2745
+ onEventChange: se,
2746
+ onEventDelete: de,
2747
+ onEventEdit: ue,
2748
+ eventRenderer: pe,
2749
+ pointerPreviewRenderer: fe
2615
2750
  }), [
2616
2751
  n,
2617
- de,
2618
- v,
2752
+ fe,
2753
+ y,
2619
2754
  te,
2620
- z,
2621
- H,
2755
+ B,
2622
2756
  re,
2623
2757
  ie,
2624
2758
  ae,
2759
+ oe,
2625
2760
  a,
2626
- ee,
2627
- A,
2628
- b,
2629
- V,
2630
- P,
2761
+ j,
2762
+ M,
2763
+ x,
2764
+ H,
2765
+ F,
2631
2766
  l,
2632
- B,
2633
- R,
2634
- ce,
2635
- oe,
2636
- ue,
2767
+ V,
2768
+ z,
2637
2769
  le,
2638
- fe
2770
+ se,
2771
+ de,
2772
+ ue,
2773
+ pe
2639
2774
  ]);
2640
2775
  return /* @__PURE__ */ W("div", {
2641
2776
  ...U,
2642
- className: D(U.className, Pn.root),
2643
- "data-ww-size": V === "regular" ? void 0 : V,
2644
- children: /* @__PURE__ */ W(_t.Provider, {
2645
- value: pe,
2646
- children: /* @__PURE__ */ W(Me.Provider, {
2777
+ className: O(U.className, Un.root),
2778
+ "data-ww-size": H === "regular" ? void 0 : H,
2779
+ children: /* @__PURE__ */ W(Tt.Provider, {
2780
+ value: me,
2781
+ children: /* @__PURE__ */ W(Ne.Provider, {
2647
2782
  value: ne,
2648
- children: /* @__PURE__ */ G(vt.Provider, {
2649
- value: I,
2783
+ children: /* @__PURE__ */ G(Et.Provider, {
2784
+ value: L,
2650
2785
  children: [/* @__PURE__ */ W("div", {
2651
- className: Pn.root__head,
2652
- children: /* @__PURE__ */ W(Pt, {})
2786
+ className: Un.root__head,
2787
+ children: /* @__PURE__ */ W(Ht, {})
2653
2788
  }), /* @__PURE__ */ W("div", {
2654
- className: Pn.root__body,
2655
- children: W(B === "month" ? gn : Nn, {})
2789
+ className: Un.root__body,
2790
+ children: W(V === "month" ? Cn : Hn, {})
2656
2791
  })]
2657
2792
  })
2658
2793
  })
2659
2794
  })
2660
2795
  });
2661
2796
  }
2662
- export { Fn as Calendar, Fn as default, Ve as DateLocalizationContext, We as DateLocalizationProvider, Ue as MessagesContext, E as builtInMessages, Ce as resolveMessages, He as useDateUtils, Ge as useMessages };
2797
+ export { Wn as Calendar, Wn as default, He as DateLocalizationContext, Ge as DateLocalizationProvider, We as MessagesContext, D as builtInMessages, we as resolveMessages, Ue as useDateUtils, Ke as useMessages };
2663
2798
 
2664
2799
  //# sourceMappingURL=index.js.map