@ilamy/calendar 1.8.1 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +58 -11
- package/dist/index.d.ts +391 -131
- package/dist/index.js +3 -7
- package/dist/plugins/agenda.d.ts +349 -0
- package/dist/plugins/agenda.js +1 -0
- package/dist/plugins/drag-to-create.d.ts +364 -0
- package/dist/plugins/drag-to-create.js +1 -0
- package/dist/plugins/recurrence.d.ts +383 -0
- package/dist/plugins/recurrence.js +2 -0
- package/dist/shared/chunk-6vnwf8sr.js +2 -0
- package/dist/shared/chunk-a9j9sahk.js +2 -0
- package/dist/shared/chunk-jfadfww5.js +2 -0
- package/dist/testing/index.d.ts +578 -0
- package/dist/testing/index.js +1 -0
- package/package.json +28 -43
- package/LICENSE +0 -21
|
@@ -0,0 +1,383 @@
|
|
|
1
|
+
import { ComponentType, ReactNode as ReactNode2 } from "react";
|
|
2
|
+
import { Dayjs as Dayjs2, ManipulateType as ManipulateType2 } from "dayjs";
|
|
3
|
+
/**
|
|
4
|
+
* Core calendar event interface representing a single calendar event.
|
|
5
|
+
* This is the primary data structure for calendar events.
|
|
6
|
+
*/
|
|
7
|
+
interface CalendarEvent2 {
|
|
8
|
+
/** Unique identifier for the event */
|
|
9
|
+
id: string | number;
|
|
10
|
+
/** Display title of the event */
|
|
11
|
+
title: string;
|
|
12
|
+
/** Start date and time of the event */
|
|
13
|
+
start: Dayjs2;
|
|
14
|
+
/** End date and time of the event */
|
|
15
|
+
end: Dayjs2;
|
|
16
|
+
/**
|
|
17
|
+
* Color for the event (supports CSS color values, hex, rgb, hsl, or CSS class names)
|
|
18
|
+
* @example "#3b82f6", "blue-500", "rgb(59, 130, 246)"
|
|
19
|
+
*/
|
|
20
|
+
color?: string;
|
|
21
|
+
/**
|
|
22
|
+
* Background color for the event (supports CSS color values, hex, rgb, hsl, or CSS class names)
|
|
23
|
+
* @example "#dbeafe", "blue-100", "rgba(59, 130, 246, 0.1)"
|
|
24
|
+
*/
|
|
25
|
+
backgroundColor?: string;
|
|
26
|
+
/** Optional description or notes for the event */
|
|
27
|
+
description?: string;
|
|
28
|
+
/** Optional location where the event takes place */
|
|
29
|
+
location?: string;
|
|
30
|
+
/**
|
|
31
|
+
* Whether this is an all-day event
|
|
32
|
+
* @default false
|
|
33
|
+
*/
|
|
34
|
+
allDay?: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* UID for iCalendar compatibility
|
|
37
|
+
* Unique identifier across calendar systems
|
|
38
|
+
*/
|
|
39
|
+
uid?: string;
|
|
40
|
+
/** Single resource assignment */
|
|
41
|
+
resourceId?: string | number;
|
|
42
|
+
/** Multiple resource assignment (cross-resource events) */
|
|
43
|
+
resourceIds?: (string | number)[];
|
|
44
|
+
/**
|
|
45
|
+
* Custom data associated with the event
|
|
46
|
+
* Use this to store additional metadata specific to your application
|
|
47
|
+
* @example { meetingType: 'standup', attendees: ['john', 'jane'] }
|
|
48
|
+
*/
|
|
49
|
+
data?: Record<string, unknown>;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Supported days of the week for calendar configuration.
|
|
53
|
+
* Used for setting the first day of the week and other week-related settings.
|
|
54
|
+
*/
|
|
55
|
+
type WeekDays = "sunday" | "monday" | "tuesday" | "wednesday" | "thursday" | "friday" | "saturday";
|
|
56
|
+
/**
|
|
57
|
+
* Configuration for business hours.
|
|
58
|
+
* Defines the working hours to be highlighted on the calendar.
|
|
59
|
+
*/
|
|
60
|
+
interface BusinessHours {
|
|
61
|
+
/**
|
|
62
|
+
* Days of the week to apply business hours to.
|
|
63
|
+
* @default ['monday', 'tuesday', 'wednesday', 'thursday', 'friday']
|
|
64
|
+
*/
|
|
65
|
+
daysOfWeek?: WeekDays[];
|
|
66
|
+
/**
|
|
67
|
+
* Start time for business hours in 24-hour format (0-24).
|
|
68
|
+
* @default 9
|
|
69
|
+
*/
|
|
70
|
+
startTime?: number;
|
|
71
|
+
/**
|
|
72
|
+
* End time for business hours in 24-hour format (0-24).
|
|
73
|
+
* @default 17
|
|
74
|
+
*/
|
|
75
|
+
endTime?: number;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Resource interface representing a calendar resource (person, room, equipment, etc.)
|
|
79
|
+
*/
|
|
80
|
+
interface Resource {
|
|
81
|
+
/** Unique identifier for the resource */
|
|
82
|
+
id: string | number;
|
|
83
|
+
/** Display title of the resource */
|
|
84
|
+
title: string;
|
|
85
|
+
/**
|
|
86
|
+
* Color for the resource (supports CSS color values, hex, rgb, hsl, or CSS class names)
|
|
87
|
+
* @example "#3b82f6", "blue-500", "rgb(59, 130, 246)"
|
|
88
|
+
*/
|
|
89
|
+
color?: string;
|
|
90
|
+
/**
|
|
91
|
+
* Background color for the resource (supports CSS color values, hex, rgb, hsl, or CSS class names)
|
|
92
|
+
* @example "#dbeafe", "blue-100", "rgba(59, 130, 246, 0.1)"
|
|
93
|
+
*/
|
|
94
|
+
backgroundColor?: string;
|
|
95
|
+
/**
|
|
96
|
+
* Configuration for resource-specific business hours.
|
|
97
|
+
* If provided, these will be used instead of the global business hours for this resource.
|
|
98
|
+
*/
|
|
99
|
+
businessHours?: BusinessHours | BusinessHours[];
|
|
100
|
+
/**
|
|
101
|
+
* Custom data associated with the resource
|
|
102
|
+
* Use this to store additional metadata specific to your application
|
|
103
|
+
* @example { avatar: 'https://example.com/avatar.png', role: 'admin' }
|
|
104
|
+
*/
|
|
105
|
+
data?: Record<string, unknown>;
|
|
106
|
+
}
|
|
107
|
+
interface PluginDateRange {
|
|
108
|
+
start: Dayjs2;
|
|
109
|
+
end: Dayjs2;
|
|
110
|
+
}
|
|
111
|
+
interface PluginMutationArgs {
|
|
112
|
+
event: CalendarEvent2;
|
|
113
|
+
updates?: Partial<CalendarEvent2>;
|
|
114
|
+
currentEvents: CalendarEvent2[];
|
|
115
|
+
scope: unknown;
|
|
116
|
+
}
|
|
117
|
+
/** Structured result from `applyEdit` when a mutation updates multiple stored rows. */
|
|
118
|
+
interface PluginMutationResult {
|
|
119
|
+
events: CalendarEvent2[];
|
|
120
|
+
/** Existing rows to persist via `onEventUpdate`. */
|
|
121
|
+
updated: CalendarEvent2[];
|
|
122
|
+
/** New rows to persist via `onEventAdd`. */
|
|
123
|
+
added: CalendarEvent2[];
|
|
124
|
+
/** Existing rows to persist via `onEventDelete`. */
|
|
125
|
+
deleted: CalendarEvent2[];
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Calendar configuration handed to a view's `columns()`/`renderHeader()`.
|
|
129
|
+
* Carries the resource axis (`resources`, `orientation`) so a resource-capable
|
|
130
|
+
* view can compose both arrangements. `range()` receives only the
|
|
131
|
+
* `firstDayOfWeek` slice (see its own signature).
|
|
132
|
+
*/
|
|
133
|
+
interface ViewConfig {
|
|
134
|
+
firstDayOfWeek: number;
|
|
135
|
+
hiddenDays?: Set<number>;
|
|
136
|
+
businessHours?: BusinessHours | BusinessHours[];
|
|
137
|
+
hideNonBusinessHours?: boolean;
|
|
138
|
+
/** The resource axis. Set only when the calendar renders resources. */
|
|
139
|
+
resources?: Resource[];
|
|
140
|
+
/**
|
|
141
|
+
* The calendar-level resource arrangement (the user's choice): where the
|
|
142
|
+
* resource axis goes. Only meaningful when `resources` is set.
|
|
143
|
+
*/
|
|
144
|
+
orientation?: "vertical" | "horizontal";
|
|
145
|
+
/**
|
|
146
|
+
* Week-view granularity when `resources` is set: 'hourly' (default) nests
|
|
147
|
+
* hour slots under each day; 'daily' shows one cell per day.
|
|
148
|
+
*/
|
|
149
|
+
weekViewGranularity?: "hourly" | "daily";
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* One column of a 'vertical' view (time flows down the column).
|
|
153
|
+
* Formalizes the calendar's existing VerticalGrid column input.
|
|
154
|
+
*/
|
|
155
|
+
interface VerticalColumnSpec {
|
|
156
|
+
/** Stable column id; drives testids and React keys. */
|
|
157
|
+
id: string;
|
|
158
|
+
/** The date this column represents; gutter/label columns leave it unset. */
|
|
159
|
+
day?: Dayjs2;
|
|
160
|
+
/** The cells of the column: hour slots (gridType 'hour') or dates ('day'). */
|
|
161
|
+
days: Dayjs2[];
|
|
162
|
+
gridType?: "day" | "hour";
|
|
163
|
+
className?: string;
|
|
164
|
+
/** Label-only column (e.g. the time gutter): renders no events. */
|
|
165
|
+
noEvents?: boolean;
|
|
166
|
+
renderCell?: (date: Dayjs2) => ReactNode2;
|
|
167
|
+
/**
|
|
168
|
+
* Resource-axis identity when the column belongs to one resource. The
|
|
169
|
+
* single carrier: consumers derive the id from `resource.id`.
|
|
170
|
+
*/
|
|
171
|
+
resource?: Resource;
|
|
172
|
+
}
|
|
173
|
+
/** One cell of a 'horizontal' row. */
|
|
174
|
+
interface HorizontalCellSpec {
|
|
175
|
+
id: string;
|
|
176
|
+
day?: Dayjs2;
|
|
177
|
+
/** A grouped cell spanning several dates (nested-axis arrangements). */
|
|
178
|
+
days?: Dayjs2[];
|
|
179
|
+
gridType: "day" | "hour";
|
|
180
|
+
className?: string;
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* One row of a 'horizontal' view (date cells flow across the row).
|
|
184
|
+
* Formalizes the calendar's existing HorizontalGrid row input.
|
|
185
|
+
*/
|
|
186
|
+
interface HorizontalRowSpec {
|
|
187
|
+
/** Stable row id; drives testids and React keys (matches VerticalColumnSpec.id). */
|
|
188
|
+
id: string;
|
|
189
|
+
columns?: HorizontalCellSpec[];
|
|
190
|
+
className?: string;
|
|
191
|
+
showDayNumber?: boolean;
|
|
192
|
+
/** Resource-axis identity when the row belongs to one resource. */
|
|
193
|
+
resource?: Resource;
|
|
194
|
+
}
|
|
195
|
+
/** Context passed to a view's `renderHeader`. */
|
|
196
|
+
interface ViewHeaderContext {
|
|
197
|
+
date: Dayjs2;
|
|
198
|
+
config: ViewConfig;
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Describes a view type — contributed by a plugin or built into the calendar
|
|
202
|
+
* core (the four built-ins are themselves `PluginView` entries). A view either
|
|
203
|
+
* declares `columns` + `layout` and renders through the shared grid engines,
|
|
204
|
+
* or renders entirely through `component` (the escape hatch).
|
|
205
|
+
*/
|
|
206
|
+
interface PluginView {
|
|
207
|
+
/** Unique view id, e.g. 'resource-week'. */
|
|
208
|
+
name: string;
|
|
209
|
+
/** View-switcher label (or a translation key; unknown keys render as-is). */
|
|
210
|
+
label?: string;
|
|
211
|
+
/**
|
|
212
|
+
* View-switcher icon (a component taking `className`, e.g. a lucide icon).
|
|
213
|
+
* Always shown in the switcher; the label appears beside it only when the
|
|
214
|
+
* view is selected, and as a hover tooltip otherwise.
|
|
215
|
+
*/
|
|
216
|
+
icon: ComponentType<{
|
|
217
|
+
className?: string;
|
|
218
|
+
}>;
|
|
219
|
+
/**
|
|
220
|
+
* The escape hatch: renders the whole view when `columns`/`layout` are
|
|
221
|
+
* absent. Spec-driven views omit it. A view with neither renders nothing
|
|
222
|
+
* (dev builds log a warning).
|
|
223
|
+
*/
|
|
224
|
+
component?: ComponentType;
|
|
225
|
+
/** How far prev/next steps when `navigationStep` is absent ('week', 'month', …). */
|
|
226
|
+
navigationUnit?: ManipulateType2;
|
|
227
|
+
/**
|
|
228
|
+
* How far prev/next jumps; defaults to one `navigationUnit`. Custom-duration
|
|
229
|
+
* views (a 40-day grid, a 4-day vertical view) set `{ amount: 40, unit: 'day' }`
|
|
230
|
+
* so navigation moves a full window.
|
|
231
|
+
*
|
|
232
|
+
* This also selects the header title/date-picker form (the core derives it
|
|
233
|
+
* generically, never by view name): a single `day`/`week`/`month`/`year` step
|
|
234
|
+
* borrows that grid's picker and title; any other step (amount > 1, or a custom
|
|
235
|
+
* unit) shows the day picker over the view's `range`. A third-party view gets
|
|
236
|
+
* the right picker for free just by declaring how it navigates.
|
|
237
|
+
*/
|
|
238
|
+
navigationStep?: {
|
|
239
|
+
amount: number;
|
|
240
|
+
unit: ManipulateType2;
|
|
241
|
+
};
|
|
242
|
+
/**
|
|
243
|
+
* Visible range for navigation callbacks and the event pipeline. Views
|
|
244
|
+
* without `range` fall back to the month 6x7 grid range. Receives only the
|
|
245
|
+
* `firstDayOfWeek` slice of the config; the full axis config reaches
|
|
246
|
+
* `columns()`/`renderHeader()`.
|
|
247
|
+
*/
|
|
248
|
+
range?: (date: Dayjs2, config: Pick<ViewConfig, "firstDayOfWeek">) => {
|
|
249
|
+
start: Dayjs2;
|
|
250
|
+
end: Dayjs2;
|
|
251
|
+
};
|
|
252
|
+
/**
|
|
253
|
+
* Column/row specs for the shared renderer. Return `VerticalColumnSpec[]`
|
|
254
|
+
* when `layout` is 'vertical', `HorizontalRowSpec[]` when 'horizontal'.
|
|
255
|
+
* Omit (together with `layout`) to render `component` instead.
|
|
256
|
+
*/
|
|
257
|
+
columns?: (date: Dayjs2, config: ViewConfig) => VerticalColumnSpec[] | HorizontalRowSpec[];
|
|
258
|
+
/**
|
|
259
|
+
* The view's intrinsic shape (the author's choice): which engine renders it
|
|
260
|
+
* when the calendar has NO resources. 'vertical' = time flows down;
|
|
261
|
+
* 'horizontal' = date cells flow across in stacked rows. With resources on
|
|
262
|
+
* a resource-capable view, the calendar-level `orientation` wins instead:
|
|
263
|
+
* `engine = resources && supportsResources ? orientation : layout`.
|
|
264
|
+
*/
|
|
265
|
+
layout?: "vertical" | "horizontal";
|
|
266
|
+
/** Header row content rendered above the grid by the shared renderer. */
|
|
267
|
+
renderHeader?: (ctx: ViewHeaderContext) => ReactNode2;
|
|
268
|
+
/**
|
|
269
|
+
* Whether `columns()` composes the resource axis when `config.resources`
|
|
270
|
+
* is set. Defaults to false; the view switcher hides resource-incapable
|
|
271
|
+
* views on a resource calendar.
|
|
272
|
+
*/
|
|
273
|
+
supportsResources?: boolean;
|
|
274
|
+
}
|
|
275
|
+
/**
|
|
276
|
+
* A calendar plugin contributes optional behavior and UI through generic hooks
|
|
277
|
+
* named after pipeline moments and mount points, never after a feature. The
|
|
278
|
+
* core stays agnostic of any specific plugin (e.g. recurrence).
|
|
279
|
+
*
|
|
280
|
+
* Hooks follow the Rollup/Vite execution kinds:
|
|
281
|
+
* - `transformEvents` is sequential: each plugin receives the previous
|
|
282
|
+
* plugin's output, forming a transform chain.
|
|
283
|
+
* - `managesEvent` is first-match: the first plugin whose managesEvent returns
|
|
284
|
+
* true owns its scoped mutations.
|
|
285
|
+
* - `renderSlot` is additive: every plugin may contribute to a mount point.
|
|
286
|
+
*
|
|
287
|
+
* `slotName` is an opaque string identifier and `context` is opaque to the
|
|
288
|
+
* core. The built-in slot names and their context shapes live in the calendar
|
|
289
|
+
* core, which this contract does NOT depend on, so adding a slot never changes
|
|
290
|
+
* this interface. A plugin narrows `context` by `slotName` at its boundary.
|
|
291
|
+
*
|
|
292
|
+
* `scope` is opaque to the core: the owner produces it (via the mutation-scope
|
|
293
|
+
* slot) and consumes it in `applyEdit` / `applyDelete`. A plugin that provides
|
|
294
|
+
* `applyEdit` / `applyDelete` should also render the mutation-scope slot so the
|
|
295
|
+
* core can gather that scope before mutating.
|
|
296
|
+
*/
|
|
297
|
+
interface IlamyPlugin {
|
|
298
|
+
name: string;
|
|
299
|
+
transformEvents?: (events: CalendarEvent2[], range: PluginDateRange) => CalendarEvent2[];
|
|
300
|
+
managesEvent?: (event: CalendarEvent2) => boolean;
|
|
301
|
+
applyEdit?: (args: PluginMutationArgs) => CalendarEvent2[] | PluginMutationResult;
|
|
302
|
+
applyDelete?: (args: PluginMutationArgs) => CalendarEvent2[] | PluginMutationResult;
|
|
303
|
+
renderSlot?: (slotName: string, context: unknown) => ReactNode2;
|
|
304
|
+
/**
|
|
305
|
+
* Contributes arbitrary data to a named point. Additive: all plugins may
|
|
306
|
+
* contribute to the same point; the runtime aggregates all results via
|
|
307
|
+
* `collect`. Parallel to `renderSlot` but for data rather than UI nodes.
|
|
308
|
+
*/
|
|
309
|
+
contribute?: (point: string, context: unknown) => unknown[];
|
|
310
|
+
/**
|
|
311
|
+
* Registers new view types that the calendar can switch to. Each entry in
|
|
312
|
+
* the array describes one view (id, component, navigation unit, …).
|
|
313
|
+
*/
|
|
314
|
+
views?: PluginView[];
|
|
315
|
+
/**
|
|
316
|
+
* Wraps the calendar subtree so the plugin's own React context is available
|
|
317
|
+
* to its views, slots, and components. Rendered as the outermost wrapper
|
|
318
|
+
* among all plugin providers.
|
|
319
|
+
*/
|
|
320
|
+
provider?: ComponentType<{
|
|
321
|
+
children: ReactNode2;
|
|
322
|
+
}>;
|
|
323
|
+
}
|
|
324
|
+
import dayjs from "dayjs";
|
|
325
|
+
type Dayjs3 = dayjs.Dayjs3;
|
|
326
|
+
import { RRule, Weekday } from "rrule";
|
|
327
|
+
import { Options } from "rrule";
|
|
328
|
+
/**
|
|
329
|
+
* Re-rrule.js Options with practical TypeScript interface.
|
|
330
|
+
* Makes all properties optional except freq and dtstart (which are required by RFC 5545).
|
|
331
|
+
* This allows clean object creation without needing explicit null values.
|
|
332
|
+
*
|
|
333
|
+
* @see https://tools.ietf.org/html/rfc5545 - RFC 5545 iCalendar specification
|
|
334
|
+
* @see https://github.com/jakubroztocil/rrule - rrule.js library documentation
|
|
335
|
+
*/
|
|
336
|
+
type RRuleOptions = {
|
|
337
|
+
/**
|
|
338
|
+
* The frequency of the event. Must be one of the following: DAILY, WEEKLY, MONTHLY, etc.
|
|
339
|
+
*/
|
|
340
|
+
freq: Options["freq"];
|
|
341
|
+
/**
|
|
342
|
+
* The start date of the recurrence rule. This defines when the recurrence pattern begins.
|
|
343
|
+
* Required for proper RRULE functionality according to RFC 5545.
|
|
344
|
+
* @important Same as the event start date.
|
|
345
|
+
*/
|
|
346
|
+
dtstart: Date;
|
|
347
|
+
} & Partial<Omit<Options, "freq" | "dtstart">>;
|
|
348
|
+
declare module "@ilamy/calendar" {
|
|
349
|
+
interface CalendarEvent {
|
|
350
|
+
rrule?: RRuleOptions;
|
|
351
|
+
recurrenceId?: string;
|
|
352
|
+
exdates?: string[];
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
/**
|
|
356
|
+
* Marker re-exported by the recurrence entry so the declaration bundler keeps
|
|
357
|
+
* this module — and therefore the `declare module '@ilamy/calendar'`
|
|
358
|
+
* augmentation above — in the emitted `index.d.ts`. A side-effect-only
|
|
359
|
+
* `import './augment'` is otherwise tree-shaken from the type bundle, which
|
|
360
|
+
* would strip `rrule`/`recurrenceId`/`exdates` from the public `CalendarEvent`.
|
|
361
|
+
*/
|
|
362
|
+
type RecurrenceAugmentation = RRuleOptions;
|
|
363
|
+
/**
|
|
364
|
+
* Returns the recurrence-specific VEVENT property lines for an event: an
|
|
365
|
+
* `RRULE:` line when the event has an rrule, an `EXDATE:` line when it has
|
|
366
|
+
* exdates, and a `RECURRENCE-ID:` line when it is a modified instance.
|
|
367
|
+
*/
|
|
368
|
+
declare const recurrenceICalProperties: (event: CalendarEvent2) => string[];
|
|
369
|
+
/**
|
|
370
|
+
* Built-in recurrence plugin. Implements the generic IlamyPlugin contract by
|
|
371
|
+
* delegating to the existing recurrence handler functions and editor
|
|
372
|
+
* components.
|
|
373
|
+
*/
|
|
374
|
+
declare const recurrencePlugin: () => IlamyPlugin;
|
|
375
|
+
interface GenerateRecurringEventsProps {
|
|
376
|
+
event: CalendarEvent2;
|
|
377
|
+
currentEvents: CalendarEvent2[];
|
|
378
|
+
startDate: Dayjs3;
|
|
379
|
+
endDate: Dayjs3;
|
|
380
|
+
}
|
|
381
|
+
declare const generateRecurringEvents: ({ event, currentEvents, startDate, endDate }: GenerateRecurringEventsProps) => CalendarEvent2[];
|
|
382
|
+
declare const isRecurringEvent: (event: CalendarEvent2) => boolean;
|
|
383
|
+
export { recurrencePlugin, recurrenceICalProperties, isRecurringEvent, generateRecurringEvents, Weekday, RecurrenceAugmentation, RRuleOptions, RRule };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{I as G,J as mi,K as mo}from"../shared/chunk-a9j9sahk.js";import{L as J}from"../shared/chunk-jfadfww5.js";import{RRule as Of,Weekday as Sf}from"rrule";import{RRule as ki}from"rrule";var Yo=(o,i=!1)=>{if(i)return o.format("YYYYMMDD");return o.utc().format("YYYYMMDD[T]HHmmss[Z]")},_i=(o)=>{try{return new ki(o).toString().split(`
|
|
2
|
+
`).find((l)=>l.startsWith("RRULE:"))||""}catch{return""}},ko=(o)=>{let i=[],l=o.rrule?_i(o.rrule):"";if(l)i.push(l);if(o.exdates?.length){let m=o.exdates.map((f)=>Yo(J(f),o.allDay)).join(",");i.push(`EXDATE:${m}`)}if(o.recurrenceId){let m=Yo(J(o.recurrenceId),o.allDay);i.push(`RECURRENCE-ID:${m}`)}return i};import"@ilamy/calendar";import{SLOT_EVENT_FORM as Jl,SLOT_EVENT_MUTATION_SCOPE as Zl}from"@ilamy/calendar";import{useIlamyCalendarContext as Xi}from"@ilamy/calendar";import{Slot as Gi}from"@radix-ui/react-slot";import{cva as Hi}from"class-variance-authority";import{jsx as wi}from"react/jsx-runtime";var Ji=Hi("inline-flex cursor-pointer items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9","icon-sm":"size-8","icon-lg":"size-10"}},defaultVariants:{variant:"default",size:"default"}});function _o({className:o,variant:i,size:l,asChild:m=!1,...f}){return wi(m?Gi:"button",{className:G(Ji({variant:i,size:l,className:o})),"data-slot":"button",...f})}import*as q from"@radix-ui/react-dialog";import{XIcon as Zi}from"lucide-react";import{jsx as b,jsxs as Go}from"react/jsx-runtime";function qo({...o}){return b(q.Root,{"data-slot":"dialog",...o})}function $i({...o}){return b(q.Portal,{"data-slot":"dialog-portal",...o})}function Vi({className:o,...i}){return b(q.Overlay,{className:G("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",o),"data-slot":"dialog-overlay",...i})}function ao({className:o,children:i,...l}){return Go($i,{"data-slot":"dialog-portal",children:[b(Vi,{}),Go(q.Content,{className:G("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg max-h-[90%]",o),"data-slot":"dialog-content",...l,children:[i,Go(q.Close,{className:"ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",children:[b(Zi,{}),b("span",{className:"sr-only",children:"Close"})]})]})]})}function bo({className:o,...i}){return b("div",{className:G("flex flex-col gap-2 text-center sm:text-left",o),"data-slot":"dialog-header",...i})}function Ko({className:o,...i}){return b("div",{className:G("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",o),"data-slot":"dialog-footer",...i})}function Bo({className:o,...i}){return b(q.Title,{className:G("text-lg leading-none font-semibold",o),"data-slot":"dialog-title",...i})}function Wo({className:o,...i}){return b(q.Description,{className:G("text-muted-foreground text-sm",o),"data-slot":"dialog-description",...i})}import{jsx as M,jsxs as v}from"react/jsx-runtime";var hi=[{scope:"this",title:"thisEvent",editKey:"onlyChangeThis",deleteKey:"onlyDeleteThis"},{scope:"following",title:"thisAndFollowingEvents",editKey:"changeThisAndFuture",deleteKey:"deleteThisAndFuture"},{scope:"all",title:"allEvents",editKey:"changeEntireSeries",deleteKey:"deleteEntireSeries"}];function Mo({isOpen:o,onClose:i,onConfirm:l,operationType:m,eventTitle:f}){let{t:N}=Xi(),c=(k)=>{l(k),i()},z=m==="edit",g=N("deleteRecurringEvent"),_=N("deleteRecurringEventQuestion");if(z)g=N("editRecurringEvent"),_=N("editRecurringEventQuestion");return M(qo,{onOpenChange:(k)=>{if(!k)i()},open:o,children:v(ao,{className:"max-w-md",children:[v(bo,{children:[M(Bo,{children:g}),v(Wo,{children:['"',f,'" ',_]})]}),M("div",{className:"space-y-3",children:hi.map(({scope:k,title:$,editKey:V,deleteKey:Y})=>M(_o,{className:"w-full justify-start h-auto p-4",onClick:()=>c(k),variant:"outline",children:v("div",{className:"text-left",children:[M("div",{className:"font-medium",children:N($)}),M("div",{className:"text-sm text-muted-foreground",children:N(z?V:Y)})]})},k))}),M(Ko,{children:M(_o,{onClick:i,variant:"outline",children:N("cancel")})})]})})}import{useIlamyCalendarContext as vi}from"@ilamy/calendar";import{useState as ti}from"react";import{useIlamyCalendarContext as di}from"@ilamy/calendar";import{jsx as t}from"react/jsx-runtime";function Fo({className:o,...i}){return t("div",{className:G("text-card-foreground flex flex-col gap-1 rounded-xl border shadow-sm",o),"data-slot":"card",...i})}function Lo({className:o,...i}){return t("div",{className:G("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 p-4 pb-0 has-data-[slot=card-action]:grid-cols-[1fr_auto]",o),"data-slot":"card-header",...i})}function Ao({className:o,...i}){return t("div",{className:G("leading-none font-semibold",o),"data-slot":"card-title",...i})}function Co({className:o,...i}){return t("div",{className:G("p-4 pt-0",o),"data-slot":"card-content",...i})}import*as e from"@radix-ui/react-checkbox";import{CheckIcon as Qi}from"lucide-react";import{jsx as Ho}from"react/jsx-runtime";function p({className:o,...i}){return Ho(e.Root,{className:G("peer border-input dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",o),"data-slot":"checkbox",...i,children:Ho(e.Indicator,{className:"flex items-center justify-center text-current transition-none","data-slot":"checkbox-indicator",children:Ho(Qi,{className:"size-3.5"})})})}import{useEffect as ni,useState as Vo}from"react";import{RRule as vo}from"rrule";import{createContext as Yi,useContext as qi}from"react";var Po=Yi(null),To=Po.Provider,K=()=>{let o=qi(Po);if(!o)throw Error("useRecurrenceEditor must be used within a RecurrenceEditor");return o};import{RRule as X}from"rrule";var ai=[X.SU,X.MO,X.TU,X.WE,X.TH,X.FR,X.SA],bi=[X.MO,X.TU,X.WE,X.TH,X.FR],Ki=["first","second","third","fourth"],Uo=(o)=>ai.at(J(o).day())??X.SU,Do=(o)=>{let i=J(o);return i.add(7,"day").month()!==i.month()?-1:Math.ceil(i.date()/7)},Bi={daily:()=>({freq:X.DAILY}),weekdays:()=>({freq:X.WEEKLY,byweekday:bi}),weeklyOnDay:(o)=>({freq:X.WEEKLY,byweekday:[Uo(o)]}),monthlyOnDay:(o)=>({freq:X.MONTHLY,bymonthday:J(o).date()}),monthlyOnWeekday:(o)=>({freq:X.MONTHLY,byweekday:[Uo(o).nth(Do(o))]})},S=(o,i)=>{let l=Bi[o];if(!l)return null;return{interval:1,dtstart:i,...l(i)}},po=(o)=>{if(o==null)return"";return(Array.isArray(o)?o:[o]).map((l)=>typeof l==="object"?`${l.weekday}:${l.n??""}`:`${l}:`).sort().join(",")},Wi=(o,i)=>{if(!i)return!1;let l=o.freq===i.freq,m=po(o.byweekday)===po(i.byweekday),f=(o.bymonthday??null)===(i.bymonthday??null);return l&&m&&f},Mi=["daily","weekdays","weeklyOnDay","monthlyOnDay","monthlyOnWeekday"],s=(o,i)=>{if(!o)return"once";if(Boolean(o.interval)&&o.interval!==1)return"customize";return Mi.find((f)=>Wi(o,S(f,i)))??"customize"},j=(o,i,l)=>{let m=J(i).format("dddd"),f=Do(i),N=f===-1?"last":Ki.at(f-1)??"last",c=l(N);return{daily:l("daily"),weekdays:l("everyWeekday"),weeklyOnDay:`${l("weeklyOn")} ${m}`,monthlyOnDay:`${l("monthlyOnDay")} ${J(i).date()}`,monthlyOnWeekday:`${l("monthlyOnThe")} ${c} ${m}`}[o]??l("customRecurrence")},D=(o)=>{if(Array.isArray(o))return o;return o?[o]:[]};import{useIlamyCalendarContext as Ci}from"@ilamy/calendar";import{jsx as Fi}from"react/jsx-runtime";function oo({className:o,type:i,...l}){return Fi("input",{className:G("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",o),"data-slot":"input",type:i,...l})}import*as yo from"@radix-ui/react-label";import{jsx as Li}from"react/jsx-runtime";function a({className:o,...i}){return Li(yo.Root,{className:G("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",o),"data-slot":"label",...i})}import{jsx as Ai}from"react/jsx-runtime";var Io="YYYY-MM-DD",xo=({date:o,onChange:i,className:l})=>{let m=o?J(o).format(Io):"",f=(N)=>{let c=N.target.value;if(!c){i?.(void 0);return}let z=J(c,Io);i?.(z.isValid()?z.toDate():void 0)};return Ai("input",{className:G("flex h-9 rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-xs outline-none transition-shadow focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50",l),onChange:f,type:"date",value:m})};import{jsx as A,jsxs as wo,Fragment as Ui}from"react/jsx-runtime";var Pi=[{type:"never",id:"never",labelKey:"never"},{type:"count",id:"after",labelKey:"after"},{type:"until",id:"on",labelKey:"on"}],Ti=(o)=>Math.max(1,Number.parseInt(o,10)||1),Oo=()=>{let{t:o}=Ci(),{opts:i,update:l,setEndType:m,setUntil:f}=K(),N="never";if(i?.until)N="until";else if(i?.count)N="count";let c=i?.count||1,z=i?.until??void 0;return wo("div",{children:[A(a,{className:"text-xs",children:o("ends")}),A("div",{className:"space-y-2 mt-1",children:Pi.map(({type:g,id:_,labelKey:k})=>{let $=g==="count"&&N==="count",V=g==="until"&&N==="until";return wo("div",{className:"flex items-center space-x-2",children:[A(p,{checked:N===g,id:_,onCheckedChange:()=>m(g)}),A(a,{className:"text-xs",htmlFor:_,children:o(k)}),$&&wo(Ui,{children:[A(oo,{className:"h-6 w-16 text-xs","data-testid":"count-input",min:"1",onChange:(Y)=>l({count:Ti(Y.target.value)}),type:"number",value:c}),A("span",{className:"text-xs",children:o("occurrences")})]}),V&&A(xo,{className:"h-6",date:z,onChange:f})]},g)})})]})};import{useIlamyCalendarContext as xi}from"@ilamy/calendar";import*as H from"@radix-ui/react-select";import{CheckIcon as pi,ChevronDownIcon as So,ChevronUpIcon as Di}from"lucide-react";import{jsx as Q,jsxs as Jo}from"react/jsx-runtime";function y({...o}){return Q(H.Root,{"data-slot":"select",...o})}function I({...o}){return Q(H.Value,{"data-slot":"select-value",...o})}function x({className:o,size:i="default",children:l,...m}){return Jo(H.Trigger,{className:G("cursor-pointer border-input data-placeholder:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",o),"data-size":i,"data-slot":"select-trigger",...m,children:[l,Q(H.Icon,{asChild:!0,children:Q(So,{className:"size-4 opacity-50"})})]})}function O({className:o,children:i,position:l="popper",align:m="center",...f}){return Q(H.Portal,{children:Jo(H.Content,{align:m,className:G("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-32 origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md",l==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",o),"data-slot":"select-content",position:l,...f,children:[Q(yi,{}),Q(H.Viewport,{className:G("p-1",l==="popper"&&"h-(--radix-select-trigger-height) w-full min-w-(--radix-select-trigger-width) scroll-my-1"),children:i}),Q(Ii,{})]})})}function C({className:o,children:i,...l}){return Jo(H.Item,{className:G("focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",o),"data-slot":"select-item",...l,children:[Q("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:Q(H.ItemIndicator,{children:Q(pi,{className:"size-4"})})}),Q(H.ItemText,{children:i})]})}function yi({className:o,...i}){return Q(H.ScrollUpButton,{className:G("flex cursor-default items-center justify-center py-1",o),"data-slot":"select-scroll-up-button",...i,children:Q(Di,{className:"size-4"})})}function Ii({className:o,...i}){return Q(H.ScrollDownButton,{className:G("flex cursor-default items-center justify-center py-1",o),"data-slot":"select-scroll-down-button",...i,children:Q(So,{className:"size-4"})})}import{RRule as r}from"rrule";import{jsx as P,jsxs as io}from"react/jsx-runtime";var Zo={DAILY:r.DAILY,WEEKLY:r.WEEKLY,MONTHLY:r.MONTHLY,YEARLY:r.YEARLY},Oi=Object.fromEntries(Object.entries(Zo).map(([o,i])=>[i,o])),Si=(o)=>Math.max(1,Number.parseInt(o,10)||1),so=()=>{let{t:o}=xi(),{opts:i,custom:l,update:m}=K();if(!l)return null;let f=Oi[i?.freq??r.DAILY]||"DAILY",N=i?.interval||1;return io("div",{className:"grid grid-cols-2 gap-4",children:[io("div",{children:[P(a,{className:"text-xs",htmlFor:"frequency",children:o("frequency")}),io(y,{onValueChange:(c)=>m({freq:Zo[c]}),value:f,children:[P(x,{className:"h-8 w-full","data-testid":"frequency-select",id:"frequency",children:P(I,{})}),P(O,{children:Object.keys(Zo).map((c)=>P(C,{value:c,children:o(c.toLowerCase())},c))})]})]}),io("div",{children:[P(a,{className:"text-xs",htmlFor:"interval",children:o("every")}),P(oo,{className:"h-8",id:"interval",min:"1",onChange:(c)=>m({interval:Si(c.target.value)}),type:"number",value:N})]})]})};import{useIlamyCalendarContext as si}from"@ilamy/calendar";import{RRule as ji}from"rrule";import{jsx as u,jsxs as $o}from"react/jsx-runtime";var jo=()=>{let{t:o}=si(),{opts:i,custom:l,reference:m,setMonthlyMode:f}=K();if(!l||i?.freq!==ji.MONTHLY)return null;let c=D(i?.byweekday).some((z)=>typeof z==="object"&&z.n!=null)?"weekday":"day";return $o("div",{children:[u(a,{className:"text-xs",htmlFor:"monthly-mode",children:o("repeatOn")}),$o(y,{onValueChange:(z)=>f(z),value:c,children:[u(x,{className:"h-8 w-full","data-testid":"monthly-mode-select",id:"monthly-mode",children:u(I,{})}),$o(O,{children:[u(C,{value:"day",children:j("monthlyOnDay",m,o)}),u(C,{value:"weekday",children:j("monthlyOnWeekday",m,o)})]})]})]})};import{useIlamyCalendarContext as ri}from"@ilamy/calendar";import{jsx as R,jsxs as ro}from"react/jsx-runtime";var ui=["daily","weekdays","weeklyOnDay","monthlyOnDay","monthlyOnWeekday","customize"],uo=()=>{let{t:o}=ri(),{opts:i,custom:l,reference:m,selectPreset:f}=K(),N=l?"customize":s(i,m);return ro("div",{children:[R(a,{className:"text-xs",htmlFor:"recurrence-preset",children:o("repeats")}),ro(y,{onValueChange:(c)=>f(c),value:N,children:[R(x,{className:"h-8 w-full","data-testid":"preset-select",id:"recurrence-preset",children:R(I,{})}),R(O,{children:ui.map((c)=>R(C,{value:c,children:j(c,m,o)},c))})]})]})};import{useIlamyCalendarContext as Ri}from"@ilamy/calendar";import{RRule as F}from"rrule";import{jsx as lo,jsxs as no}from"react/jsx-runtime";var Ro=[F.SU,F.MO,F.TU,F.WE,F.TH,F.FR,F.SA],Eo=()=>{let{t:o,firstDayOfWeek:i}=Ri(),{opts:l,custom:m,toggleDay:f}=K();if(!m||l?.freq!==F.WEEKLY)return null;let N=D(l?.byweekday),c=Ro.map((g,_)=>({value:g,label:J().day(_).format("ddd")})),z=Ro.map((g,_)=>c[(_+i)%7]);return no("div",{children:[lo(a,{className:"text-xs",children:o("repeatOn")}),lo("div",{className:"flex flex-wrap gap-1 mt-1",children:z.map((g,_)=>no("div",{className:"flex items-center space-x-1",children:[lo(p,{checked:N.includes(g.value),id:mo("day",_),onCheckedChange:()=>f(g.value)}),lo(a,{className:"text-xs cursor-pointer",htmlFor:mo("day",_),children:g.label})]},mo("weekday",_)))})]})};import{jsx as B,jsxs as fo}from"react/jsx-runtime";var Ei=(o,i)=>{if(!o)return i("customRecurrence");try{let l=new vo(o).toText();if(!(Boolean(l)&&!l.toLowerCase().includes("error")))return i("customRecurrence");return l.charAt(0).toUpperCase()+l.slice(1)}catch{return i("customRecurrence")}},to=({value:o,onChange:i,referenceDate:l})=>{let{t:m}=di(),f=(w)=>w?.dtstart??l??J().toDate(),[N,c]=Vo(Boolean(o)),[z,g]=Vo(()=>o||null),[_,k]=Vo(()=>s(o??null,f(o??null))==="customize");ni(()=>{if(c(Boolean(o)),o){g(o);let w=o.dtstart??l??J().toDate();k(s(o,w)==="customize")}},[o,l]);let $=f(z),V=(w)=>{if(!z)return;let Z={...z,...w};g(Z),i(N?Z:null)},Y=(w)=>{if(c(w),!w){i(null);return}if(z){i(z);return}let Z={freq:vo.DAILY,interval:1};g(Z),k(!1),i(Z)},zo={opts:z,custom:_,reference:$,update:V,selectPreset:(w)=>{if(w==="customize"){k(!0);return}k(!1);let Z=S(w,$);if(!Z)return;let U={...Z,count:z?.count,until:z?.until};g(U),i(U)},toggleDay:(w)=>{let Z=D(z?.byweekday),E=Z.includes(w)?Z.filter((gi)=>gi!==w):[...Z,w];V({byweekday:E.length?E:void 0})},setMonthlyMode:(w)=>{if(w==="weekday"){let U=S("monthlyOnWeekday",$);V({byweekday:U?.byweekday,bymonthday:void 0});return}let Z=S("monthlyOnDay",$);V({bymonthday:Z?.bymonthday,byweekday:void 0})},setEndType:(w)=>{let Z={count:void 0,until:void 0};if(w==="count")Z.count=z?.count||1;if(w==="until")Z.until=z?.until||J().add(1,"month").endOf("day").toDate();V(Z)},setUntil:(w)=>{let Z=w?J(w).endOf("day").toDate():void 0;V({until:Z})}},go=Boolean(N&&o);return B(To,{value:zo,children:fo(Fo,{"data-testid":"recurrence-editor",children:[fo(Lo,{className:"pb-3",children:[fo("div",{className:"flex items-center space-x-2",children:[B(p,{checked:N,"data-testid":"toggle-recurrence",id:"recurring",onCheckedChange:Y}),B(Ao,{className:"text-sm",children:m("repeat")})]}),go&&B("p",{className:"text-xs text-muted-foreground",children:Ei(o??null,m)})]}),N&&B(Co,{className:"pt-0",children:fo("div",{className:"space-y-4",children:[B(uo,{}),B(so,{}),B(Eo,{}),B(jo,{}),B(Oo,{})]})})]})})};import{jsx as ei}from"react/jsx-runtime";var eo=({event:o,onChange:i})=>{let{rawEvents:l}=vi(),m=o.uid,f;if(m)f=l.find((g)=>{return(g.uid||`${g.id}@ilamy.calendar`)===m&&Boolean(g.rrule)});let[N,c]=ti(o.rrule??f?.rrule??null);return ei(to,{onChange:(g)=>{if(!g){c(null),i({rrule:void 0});return}let _=g.dtstart??o.start?.toDate(),k=_?{...g,dtstart:_}:g;c(k),i({rrule:k})},referenceDate:o.start?.toDate(),value:N})};var Xo=(o)=>{return Boolean(o.rrule||o.recurrenceId||o.uid)},h=(o)=>{return o.uid||`${o.id}@ilamy.calendar`},No=(o,i)=>{let l=h(i),m=o.findIndex((f)=>{let N=h(f)===l,c=Boolean(f.rrule)&&!f.recurrenceId;return N&&c});if(m===-1)throw Error("Base recurring event not found");return m},co=(o)=>o.start.subtract(1,"day").endOf("day").toDate(),ho=(o)=>o.recurrenceId??o.start.toISOString(),oi=(o,i)=>{let l=ho(i),m=o.exdates||[],f=m.includes(l)?m:[...m,l];return{baseEvent:{...o,exdates:f},targetEventStartISO:l}};var ol=({targetEvent:o,updatedEvents:i,baseEventIndex:l,baseEvent:m})=>{let f=ho(o),N=h(m),{baseEvent:c}=oi(m,o);i[l]=c;let z=(k)=>{let $=Boolean(k.recurrenceId),V=h(k)===N,Y=k.recurrenceId===f;return $&&V&&Y},g=i.find(z);return{events:i.filter((k)=>!z(k)),updated:g?[]:[c],added:[],deleted:g?[g]:[]}},il=({targetEvent:o,updatedEvents:i,baseEventIndex:l,baseEvent:m})=>{let f={...m,rrule:{...m.rrule,until:co(o)}};return i[l]=f,{events:i,updated:[f],added:[],deleted:[]}},ll=({targetEvent:o,updatedEvents:i})=>{let l=h(o),m=i.filter((N)=>h(N)===l);return{events:i.filter((N)=>h(N)!==l),updated:[],added:[],deleted:m}},ml={this:ol,following:il,all:ll},ii=({targetEvent:o,currentEvents:i,scope:l})=>{let m=[...i],f=No(m,o),N=m[f],c=ml[l];if(!c)throw Error(`Invalid scope: ${l}. Must be 'this', 'following', or 'all'`);return c({targetEvent:o,updatedEvents:m,baseEventIndex:f,baseEvent:N})};import{RRule as fl}from"rrule";var d=(o)=>{return new Date(Date.UTC(o.year(),o.month(),o.date(),o.hour(),o.minute(),o.second(),o.millisecond()))},li=(o,i)=>{return i.year(o.getUTCFullYear()).month(o.getUTCMonth()).date(o.getUTCDate()).hour(o.getUTCHours()).minute(o.getUTCMinutes()).second(o.getUTCSeconds()).millisecond(o.getUTCMilliseconds())};var Qo=({event:o,currentEvents:i,startDate:l,endDate:m})=>{if(!o.rrule)return[];try{let f=d(o.start),N;if(o.rrule.until)N=d(J(o.rrule.until));let c={...o.rrule,dtstart:f,until:N},z=new fl(c),g=h(o),_=i.filter((W)=>{let T=Boolean(W.recurrenceId),L=h(W)===g;return T&&L}),k=o.end.diff(o.start),$=d(l.subtract(k,"millisecond")),V=d(m);return z.between($,V,!0).map((W,T)=>{let L=li(W,o.start),n=_.find((E)=>mi(E.recurrenceId)?.isSame(L));if(n)return{...o,...n};let zo=o.end.diff(o.start),go=L.add(zo,"millisecond"),w=`${o.id}_${T}`,Z=h(o);return{...o,id:w,start:L,end:go,uid:Z,rrule:void 0}}).filter((W)=>{let T=W.start.toISOString();if(o.exdates?.includes(T)??!1)return!1;return W.start.isSameOrBefore(m)&&W.end.isSameOrAfter(l)})}catch(f){throw Error(`Invalid RRULE options: ${JSON.stringify(o.rrule)}. Error: ${f instanceof Error?f.message:"Unknown error"}`)}};var fi=(o,i)=>{let l=i.diff(i.startOf("day"),"millisecond");return o.startOf("day").add(l,"millisecond")},Nl=(o,i,l)=>{let m=o.end.diff(o.start),f=l.start||i.start,N=l.end||f.add(m),c=`${o.id}_following`,z=`${c}@ilamy.calendar`;return{...o,...l,rrule:{...o.rrule,...l.rrule,dtstart:f.toDate()},id:c,uid:z,start:f,end:N,recurrenceId:void 0}},cl=(o,i)=>{return(l)=>{let m=Boolean(l.recurrenceId)&&!l.rrule,f=h(l)===o,N=Boolean(l.recurrenceId)&&J(l.recurrenceId).isAfter(i);return m&&f&&N}},zl=(o,i)=>{let l=o.start;if(i.start)l=fi(o.start,i.start);let m=o.end;if(i.start&&i.end)m=l.add(i.end.diff(i.start),"millisecond");else if(i.start)m=l.add(o.end.diff(o.start),"millisecond");else if(i.end)m=fi(o.end,i.end);let f=i.rrule??o.rrule,N;if(f)N={...f,dtstart:l.toDate()};return{start:l,end:m,rrule:N}},gl=(o,i)=>{if(i&&o.recurrenceId)return o.recurrenceId;return o.start.toISOString()},kl=({updatedEvents:o,targetEvent:i,detachedOverride:l,updatedBaseEvent:m,baseChanged:f})=>{let N=o.findIndex((c)=>c.id===i.id);if(N===-1)throw Error("Detached override not found");return o[N]=l,{events:o,updated:f?[m,l]:[l],added:[],deleted:[]}},_l=({targetEvent:o,updates:i,updatedEvents:l,baseEventIndex:m,baseEvent:f})=>{let N=h(f),c=Boolean(o.recurrenceId&&!o.rrule),z=gl(o,c),g=f.exdates||[],_=g.includes(z)?g:[...g,z],k=_!==g||f.uid!==N,$={...f,exdates:_,uid:N};l[m]=$;let V={...o,...i,recurrenceId:z,rrule:void 0,uid:N};if(c)return kl({updatedEvents:l,targetEvent:o,detachedOverride:V,updatedBaseEvent:$,baseChanged:k});let Y={...V,id:`${f.id}_modified_${Date.now()}`};return l.push(Y),{events:l,updated:[$],added:[Y],deleted:[]}},Gl=({targetEvent:o,updates:i,updatedEvents:l,baseEventIndex:m,baseEvent:f})=>{let N=co(o),c=h(f),z=cl(c,N),g=(f.exdates??[]).filter((Y)=>!J(Y).isAfter(N)),_={...f,exdates:g,rrule:{...f.rrule,until:N}};l[m]=_;let k=Nl(f,o,i);l.push(k);let $=l.filter(z);return{events:l.filter((Y)=>!z(Y)),updated:[_],added:[k],deleted:$}},Hl=({updates:o,updatedEvents:i,baseEventIndex:l,baseEvent:m})=>{let f=h(m),N=zl(m,o),c={...m,...o,start:N.start,end:N.end,rrule:N.rrule,exdates:void 0,uid:f};i[l]=c;let z=(k)=>{let $=Boolean(k.recurrenceId)&&!k.rrule,V=h(k)===f;return $&&V},g=i.filter((k)=>!z(k)),_=i.filter(z);return{events:g,updated:[c],added:[],deleted:_}},wl={this:_l,following:Gl,all:Hl},Ni=({targetEvent:o,updates:i,currentEvents:l,scope:m})=>{let f=[...l],N=No(f,o),c=f[N],z=wl[m];if(!z)throw Error(`Invalid scope: ${m}. Must be 'this', 'following', or 'all'`);return z({targetEvent:o,updates:i,updatedEvents:f,baseEventIndex:N,baseEvent:c})};import{jsx as ci}from"react/jsx-runtime";var $l=()=>({name:"recurrence",transformEvents:(o,i)=>o.flatMap((l)=>{if(!l.rrule)return[l];return Qo({event:l,currentEvents:o,startDate:i.start,endDate:i.end})}),managesEvent:(o)=>Xo(o),applyEdit:({event:o,updates:i,currentEvents:l,scope:m})=>Ni({targetEvent:o,updates:i??{},currentEvents:l,scope:m}),applyDelete:({event:o,currentEvents:i,scope:l})=>ii({targetEvent:o,currentEvents:i,scope:l}),contribute:(o,i)=>{if(o!=="ical:vevent-properties")return[];return ko(i)},renderSlot:(o,i)=>{if(o===Jl){let{event:l,onChange:m}=i;return ci(eo,{event:l,onChange:m})}if(o===Zl){let{event:l,operation:m,resolve:f,cancel:N}=i;return ci(Mo,{eventTitle:l.title||"",isOpen:!0,onClose:N,onConfirm:(c)=>f(c),operationType:m})}return null}});export{$l as recurrencePlugin,ko as recurrenceICalProperties,Xo as isRecurringEvent,Qo as generateRecurringEvents,Sf as Weekday,Of as RRule};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{L as t5}from"./chunk-jfadfww5.js";import g from"dayjs";import C1 from"dayjs/plugin/isBetween.js";import m1 from"dayjs/plugin/isSameOrAfter.js";import x1 from"dayjs/plugin/isSameOrBefore.js";import p1 from"dayjs/plugin/localeData.js";import E1 from"dayjs/plugin/localizedFormat.js";import D1 from"dayjs/plugin/minMax.js";import v1 from"dayjs/plugin/timezone.js";import g1 from"dayjs/plugin/utc.js";import y1 from"dayjs/plugin/weekday.js";import c1 from"dayjs/plugin/weekOfYear.js";var L5,l1=(Q,q,J)=>{let Z=q.prototype,$=J.tz.setDefault;J.tz.setDefault=(K)=>{return L5=K,$(K)};let{startOf:P,endOf:X}=Z;function Y(K,B){let N=K.$x?.$timezone||L5;if(!N)return B;let V=J.tz(B.format("YYYY-MM-DDTHH:mm:ss"),N).utcOffset();if(B.utcOffset()!==V)return B.tz(N,!0);return B}Z.startOf=function(K,B){let N=P.call(this,K,B);return Y(this,N)},Z.endOf=X};g.extend(y1);g.extend(c1);g.extend(m1);g.extend(x1);g.extend(C1);g.extend(D1);g.extend(v1);g.extend(g1);g.extend(p1);g.extend(E1);g.extend(l1);var G5=(...Q)=>{return g.tz(...Q)};Object.assign(G5,g);var j=G5;import{useContext as u1}from"react";import{createContext as i1}from"react";var T0=i1(void 0);var d1=[];function R(Q){let q=u1(T0);if(!q)throw Error("useSmartCalendarContext must be used within a CalendarProvider");return Q?Q(q):q}function vQ(){let Q=R();return{currentDate:Q.currentDate,currentRange:Q.currentRange,view:Q.view,events:Q.events,rawEvents:Q.rawEvents,isEventFormOpen:Q.isEventFormOpen,selectedEvent:Q.selectedEvent,selectedDate:Q.selectedDate,firstDayOfWeek:Q.firstDayOfWeek,resources:Q.resources??d1,orientation:Q.orientation,setCurrentDate:Q.setCurrentDate,selectDate:Q.selectDate,setView:Q.setView,nextPeriod:Q.nextPeriod,prevPeriod:Q.prevPeriod,today:Q.today,addEvent:Q.addEvent,updateEvent:Q.updateEvent,deleteEvent:Q.deleteEvent,openEventForm:Q.openEventForm,closeEventForm:Q.closeEventForm,onEventClick:Q.onEventClick,renderCurrentTimeIndicator:Q.renderCurrentTimeIndicator,getEventsForResource:Q.getEventsForResource,businessHours:Q.businessHours,t:Q.t,timeFormat:Q.timeFormat,timezone:Q.timezone,currentLocale:Q.currentLocale,getEventsForDateRange:Q.getEventsForDateRange,applyScopedEdit:Q.applyScopedEdit,applyScopedDelete:Q.applyScopedDelete,getEventManager:Q.getEventManager,renderSlot:Q.renderSlot,collect:Q.collect,getViews:Q.getViews}}var F5={today:"Today",create:"Create",new:"New",update:"Update",delete:"Delete",cancel:"Cancel",export:"Export",previous:"Previous",next:"Next",event:"Event",events:"Events",newEvent:"New Event",title:"Title",description:"Description",location:"Location",allDay:"All day",startDate:"Start Date",endDate:"End Date",startTime:"Start Time",searchTime:"Search time...",endTime:"End Time",color:"Color",createEvent:"Create Event",editEvent:"Edit Event",addNewEvent:"Add a new event to your calendar",editEventDetails:"Edit your event details",eventTitlePlaceholder:"Event title",eventDescriptionPlaceholder:"Event description (optional)",eventLocationPlaceholder:"Event location (optional)",repeat:"Repeat",repeats:"Repeats",customRecurrence:"Custom recurrence",frequency:"Frequency",everyWeekday:"Every weekday",weeklyOn:"Weekly on",monthlyOnDay:"Monthly on day",monthlyOnThe:"Monthly on the",first:"first",second:"second",third:"third",fourth:"fourth",last:"last",daily:"Daily",weekly:"Weekly",monthly:"Monthly",yearly:"Yearly",interval:"Interval",repeatOn:"Repeat on",never:"Never",count:"Count",every:"Every",ends:"Ends",after:"After",occurrences:"occurrences",on:"On",editRecurringEvent:"Edit recurring event",deleteRecurringEvent:"Delete recurring event",editRecurringEventQuestion:"is a recurring event. How would you like to edit it?",deleteRecurringEventQuestion:"is a recurring event. How would you like to delete it?",thisEvent:"This event",thisEventDescription:"Only change this specific occurrence",thisAndFollowingEvents:"This and following events",thisAndFollowingEventsDescription:"Edit this and all future occurrences",allEvents:"All events",allEventsDescription:"Edit the entire recurring series",onlyChangeThis:"Only change this specific occurrence",changeThisAndFuture:"Change this and all future occurrences",changeEntireSeries:"Change the entire recurring series",onlyDeleteThis:"Only delete this specific occurrence",deleteThisAndFuture:"Delete this and all future occurrences",deleteEntireSeries:"Delete the entire recurring series",month:"Month",week:"Week",day:"Day",year:"Year",agenda:"Agenda",agendaNoEvents:"No upcoming events",more:"more",resources:"Resources",resource:"Resource",selectResource:"Select a resource",time:"Time",date:"Date",noResourcesVisible:"No resources visible",addResourcesOrShowExisting:"Add resources or show existing ones"};import{useMemo as MQ}from"react";import{useEffect as S1,useMemo as R1,useRef as H1}from"react";import{useMemo as W5,useState as o1}from"react";var U5=1,N5=24,A5=24,V5=4,_5="bg-[color-mix(in_oklch,var(--background),var(--foreground)_3%)] text-muted-foreground pointer-events-none",M5={sunday:0,monday:1,tuesday:2,wednesday:3,thursday:4,friday:5,saturday:6},p=0.05,O5=0.005,b0="h-12",cQ="h-24";var S5=({firstDayOfWeek:Q,dayMaxEvents:q=V5,businessHours:J,locale:Z,translations:$,translator:P,resources:X,orientation:Y="horizontal",weekViewGranularity:K="hourly"})=>{let[B,N]=o1(Z||"en"),V=W5(()=>{if(P)return P;let _=$||F5;return(F)=>_[F]||F},[$,P]);return W5(()=>({firstDayOfWeek:Q,dayMaxEvents:q,businessHours:J,currentLocale:B,setCurrentLocale:N,t:V,resources:X,orientation:Y,weekViewGranularity:K}),[Q,q,J,B,V,X,Y,K])};import{useCallback as u,useEffect as r1,useMemo as R5,useRef as n1,useState as a1}from"react";var N0=(Q)=>{if(Q.resourceIds)return Q.resourceIds;if(Q.resourceId!==void 0)return[Q.resourceId];return[]};function K0(Q,q){return Q.filter((J)=>N0(J).includes(q))}function w0(Q,q,J){let Z=Q.start.isSameOrAfter(q)&&Q.start.isSameOrBefore(J),$=Q.end.isSameOrAfter(q)&&Q.end.isSameOrBefore(J),P=Q.start.isBefore(q)&&Q.end.isAfter(J);return Z||$||P}var H5=(Q)=>!Array.isArray(Q),I5=(Q,{onEventUpdate:q,onEventAdd:J,onEventDelete:Z,setCurrentEvents:$})=>{for(let P of Q.updated)q?.(P);for(let P of Q.added)J?.(P);for(let P of Q.deleted)Z?.(P);$(Q.events)},T5=({events:Q,pluginRuntime:q,getCurrentViewRange:J,resources:Z,onEventAdd:$,onEventUpdate:P,onEventDelete:X})=>{let[Y,K]=a1(Q),B=n1(Q),N=u((U,H)=>q.transformEvents(Y,{start:U,end:H}),[Y,q]),V=R5(()=>{let{start:U,end:H}=J();return N(U,H)},[N,J]);r1(()=>{if(Q!==B.current)K(Q),B.current=Q},[Q]);let _=u((U)=>{K((H)=>[...H,U]),$?.(U)},[$]),F=u((U,H)=>{let T=Y.find((w)=>w.id===U);if(!T)return;let b={...T,...H};K((w)=>w.map((C)=>C.id===U?b:C)),P?.(b)},[Y,P]),W=u((U,H,T)=>{let b=q.getEventManager(U);if(!b?.applyEdit)return;let w=b.applyEdit({event:U,updates:H,currentEvents:Y,scope:T});if(H5(w)){I5(w,{onEventUpdate:P,onEventAdd:$,onEventDelete:X,setCurrentEvents:K});return}P?.({...U,...H}),K(w)},[Y,$,P,X,q]),A=u((U,H)=>{let T=q.getEventManager(U);if(!T?.applyDelete)return;let b=T.applyDelete({event:U,currentEvents:Y,scope:H});if(H5(b)){I5(b,{onEventUpdate:P,onEventAdd:$,onEventDelete:X,setCurrentEvents:K});return}X?.(U),K(b)},[Y,$,P,X,q]),z=u((U)=>{let H=Y.find((T)=>T.id===U);if(!H)return;K((T)=>T.filter((b)=>b.id!==U)),X?.(H)},[Y,X]),O=u((U)=>K0(V,U),[V]),S=u((U)=>V.filter((H)=>N0(H).some((T)=>U.includes(T))),[V]),I=u((U)=>{if(U===void 0)return;return Z.find((H)=>H.id===U)},[Z]),M=u((U)=>{return Boolean(U.resourceIds&&U.resourceIds.length>1)},[]);return R5(()=>({events:V,rawEvents:Y,setCurrentEvents:K,getEventsForDateRange:N,addEvent:_,updateEvent:F,deleteEvent:z,applyScopedEdit:W,applyScopedDelete:A,getEventsForResource:O,getEventsForResources:S,getResourceById:I,isEventCrossResource:M}),[V,Y,N,_,F,z,W,A,O,S,I,M])};import{useCallback as A0,useMemo as t1,useState as r0}from"react";var s1=(Q)=>Q,b5=({currentDate:Q,t:q,disableEventClick:J,disableCellClick:Z,onEventClick:$,onCellClick:P})=>{let[X,Y]=r0(!1),[K,B]=r0(null),[N,V]=r0(null),_=A0((O={})=>{let{start:S,end:I,resourceId:M,resource:U,allDay:H}=O;if(S)V(S);let T=S??Q;B(s1({title:q("newEvent"),start:T,end:I??T.add(1,"hour"),resourceId:M??U?.id,description:"",allDay:H??!1})),Y(!0)},[Q,q]),F=A0(()=>{V(null),B(null),Y(!1)},[]),W=A0((O)=>{B(O),Y(!0)},[]),A=A0((O)=>{if(J)return;if($)$(O);else W(O)},[J,$,W]),z=A0((O)=>{if(Z)return;if(P)P(O);else _(O)},[P,Z,_]);return t1(()=>({isEventFormOpen:X,selectedEvent:K,selectedDate:N,setIsEventFormOpen:Y,setSelectedEvent:B,setSelectedDate:V,openEventForm:_,closeEventForm:F,handleEventClick:A,handleDateClick:z}),[X,K,N,_,F,A,z])};import{useCallback as t,useMemo as FQ,useState as M1}from"react";import{clsx as e1}from"clsx";import{twMerge as Q2}from"tailwind-merge";function L(...Q){return Q2(e1(Q))}import{Square as l2}from"lucide-react";import{AnimatePresence as q2,motion as J2}from"motion/react";import{jsx as w5}from"react/jsx-runtime";var Z2={hidden:({direction:Q})=>({opacity:0,x:Q==="horizontal"?10:0,y:Q==="vertical"?-10:0}),visible:({delay:Q})=>({opacity:1,x:0,y:0,transition:{duration:0.2,ease:[0.4,0,0.2,1],delay:Q}}),exit:({direction:Q})=>({opacity:0,x:Q==="horizontal"?-10:0,y:Q==="vertical"?-10:0,transition:{duration:0.15}})},h=({children:Q,transitionKey:q,delay:J=0,className:Z,direction:$="vertical",layout:P,layoutId:X,"data-testid":Y,ref:K,...B})=>w5(q2,{mode:"wait",children:w5(J2.div,{animate:"visible",className:L("inline-block w-full",Z),custom:{delay:J,direction:$},"data-testid":Y,exit:"exit",initial:"hidden",layout:P,layoutId:X,ref:K,variants:Z2,...B,children:Q},q)});h.displayName="AnimatedSection";import{jsx as j5,Fragment as f5}from"react/jsx-runtime";var f0=({date:Q})=>{let{renderHour:q,timeFormat:J}=R();if(q)return j5(f5,{children:q(Q)});return j5(f5,{children:Q.format(J==="12-hour"?"h A":"H")})};function k(Q){return Q.isSame(j(),"day")}function m(Q){return Q.format("YYYY-MM-DD")}function E(Q,q){let J=Q.startOf("week").day(q),Z=Q.isBefore(J)?J.subtract(1,"week"):J;return Array.from({length:7},($,P)=>Z.add(P,"day"))}function n0(Q,q){let J=Q.startOf("month"),$=E(J,q).at(0)??J;return Array.from({length:6},(P,X)=>{let Y=$.add(X,"week");return E(Y,q)})}function j0(Q){let q=Q.daysInMonth(),J=Q.startOf("month");return Array.from({length:q},(Z,$)=>J.add($,"day"))}function h5({referenceDate:Q=j(),length:q=24}={}){let J=Q.startOf("day");return Array.from({length:q},(Z,$)=>J.hour($).minute(0).second(0).millisecond(0))}var h0=(Q,q)=>{let J=n0(Q,q),Z=J.at(0)?.at(0)??Q,$=J.at(-1)?.at(-1)??Q;return{start:Z.startOf("day"),end:$.endOf("day")}};var z0=(Q)=>String(Q).padStart(2,"0"),$2=(Q)=>typeof Q==="number"?z0(Q):Q,G={col:{time:"time-col",date:"date-col",day:(Q,q)=>{let J=`day-col-${m(Q)}`;return q!=null?`${J}-resource-${q}`:J},resource:(Q,q)=>`${Q}-col-resource-${q}`,allDay:(Q,q)=>`all-day-col-${m(Q)}-${q}`},cell:{day:(Q,q,J=0)=>{let Z=m(Q);return q!=null?`day-cell-${Z}-${z0(q)}-${z0(J)}`:`day-cell-${Z}`},verticalTime:(Q)=>`vertical-time-${z0(Q)}`,vertical:(Q,q,J,Z)=>{let $=`vertical-cell-${m(Q)}-${z0(q)}-${z0(J)}`;return Z!=null?`${$}-resource-${Z}`:$}},container:{vertical:{col:(Q)=>`vertical-col-${Q}`},horizontal:{row:(Q)=>`horizontal-row-${Q}`,rowLabel:(Q)=>`horizontal-row-label-${Q}`,event:(Q)=>`horizontal-event-${Q}`},eventsLayer:(Q,q)=>`${Q}-events-${q}`},header:{resource:{weekDay:"resource-week-day-header",columnsHeader:"resource-columns-header",monthDay:(Q)=>`resource-month-header-${Q.toISOString()}`,timeLabel:(Q,q)=>`resource-${Q}-time-label-${$2(q)}`},weekday:(Q,q)=>`${Q}-header-weekday-${q.toLowerCase()}`,week:{day:(Q)=>`week-header-day-${Q.toISOString()}`,hour:(Q,q)=>`week-header-hour-${Q.toISOString()}-${q}`,resource:(Q)=>`week-header-resource-${Q}`},year:{month:(Q,q)=>q?`year-month-${q}-${Q}`:`year-month-${Q}`,day:(Q,q)=>`year-day-${Q}-${q}`}},allDayRow:(Q)=>`allday-row-${Q??"main"}`,listKey:(...Q)=>Q.join("-"),dayNumber:(Q)=>k(Q)?"day-number-today":`day-number-${Q.format("D")}`,timePicker:(Q)=>`time-picker-${Q??""}`,droppable:{dayCell:(Q,q)=>{let J=Q.toISOString(),Z=q?.allDay?"-allday":"",$=q?.resourceId!=null?`-resource-${q.resourceId}`:"";return`drop-day-cell-${J}${Z}${$}`}}};import{jsx as k5}from"react/jsx-runtime";var P0="w-16 min-w-16 max-w-16",C5="w-[calc(100%-4rem)]",a0="w-10 sm:w-16 min-w-10 sm:min-w-16 max-w-10 sm:max-w-16",l="shadow-[1px_0_0_0_color-mix(in_oklch,var(--background),var(--foreground)_10%)]",a=({days:Q,gridType:q,renderLabel:J,widthClassName:Z=P0})=>({id:q==="hour"?G.col.time:G.col.date,day:void 0,days:Q,className:L("shrink-0",Z,"sticky left-0 bg-background z-20",l),gridType:q,noEvents:!0,renderCell:($)=>k5("div",{className:"text-muted-foreground p-2 text-right text-[10px] sm:text-xs flex flex-col items-center",children:J?J($):k5(f0,{date:$})})});var P2=(Q,q)=>{if(!q)return!0;let J=!1;return k0(q,{date:Q,onMatch:()=>{J=!0}}),J},m5=({date:Q,hour:q,minute:J=0,businessHours:Z})=>{if(!Z)return!0;if(q===void 0)return P2(Q,Z);let $=!1,P=q*60+J;return k0(Z,{date:Q,onMatch:(X)=>{let Y=X.startTime??9,K=X.endTime??17,B=Y*60,N=K*60;if(P>=B&&P<N)$=!0}}),$},k0=(Q,q)=>{let{date:J,onMatch:Z}=q;if(!Q)return;let $=Array.isArray(Q)?Q:[Q];for(let P of $)if(J&&P.daysOfWeek){let X=J.day();if(P.daysOfWeek.some((Y)=>M5[Y]===X))Z(P)}else Z(P)},x5=(Q)=>{let{allDates:q,businessHours:J,resourceBusinessHours:Z=[],hideNonBusinessHours:$}=Q,P=24,X=0,Y=!1,K=(N)=>{Y=!0,P=Math.min(P,N.startTime??9),X=Math.max(X,N.endTime??17)},B=(N)=>{k0(J,{date:N,onMatch:K});for(let V of Z)k0(V,{date:N,onMatch:K})};for(let N of q)B(N);if(!Y&&$){if(B(),!Y)P=9,X=17,Y=!0}return{minStart:P,maxEnd:X,hasBusinessHours:Y}};function C0(Q){return Q.flatMap((q)=>q.businessHours?[q.businessHours]:[])}function m0({referenceDate:Q,businessHours:q,hideNonBusinessHours:J,allDates:Z=[Q],resourceBusinessHours:$=[]}){let P=h5({referenceDate:Q}),X=Boolean(q)||$.length>0;if(!(J&&X))return P;let{minStart:K,maxEnd:B,hasBusinessHours:N}=x5({allDates:Z,businessHours:q,resourceBusinessHours:$,hideNonBusinessHours:J});if(!N)return P;if(K>=B)return[];return P.filter((V)=>{let _=V.hour();return _>=K&&_<B})}import{memo as X2}from"react";import{jsx as p5}from"react/jsx-runtime";var Y2=({className:Q})=>{let{t:q}=R();return p5("div",{className:L("w-16 shrink-0 sticky left-0 bg-background z-20 flex items-center justify-center px-1 text-xs text-muted-foreground",l,Q),children:p5("span",{className:"truncate",children:q("allDay")})})},x0=X2(Y2);import{memo as g2}from"react";import{memo as Q1,useMemo as E2}from"react";import{useMemo as s0}from"react";var K2=(Q,q)=>{let J=Q.filter((X)=>X.end.diff(X.start,q)>0),Z=Q.filter((X)=>X.end.diff(X.start,q)===0),$=[...J].sort((X,Y)=>{let K=X.start.diff(Y.start);if(K!==0)return K;return Y.end.diff(Y.start)-X.end.diff(X.start)}),P=[...Z].sort((X,Y)=>X.start.diff(Y.start));return{sortedMultiUnit:$,sortedSingleUnit:P}},E5=(Q,{firstUnit:q,lastUnit:J,unitCount:Z,gridType:$})=>{let P=j.max(Q.start.startOf($),q),X=$==="hour"?Q.end.subtract(1,"minute"):Q.end,Y=j.min(X.startOf($),J);return{startCol:Math.max(0,P.diff(q,$)),endCol:Math.min(Z-1,Y.diff(q,$)),isTruncatedStart:Q.start.startOf($).isBefore(q),isTruncatedEnd:Q.end.startOf($).isAfter(J)}},t0=(Q,q,J)=>{for(let Z=0;Z<Q.length;Z++){let $=!0;for(let P=q;P<=J;P++)if(Q[Z][P]){$=!1;break}if($)return Z}return-1},D5=({days:Q,events:q,dayMaxEvents:J,gridType:Z="day"})=>{let $=Q.at(0),P=Q.at(-1);if(!$||!P)return[];let X={firstUnit:Z==="hour"?$.startOf("hour"):$.startOf("day"),lastUnit:Z==="hour"?P.endOf("hour"):P.endOf("day"),unitCount:Q.length,gridType:Z},{sortedMultiUnit:Y,sortedSingleUnit:K}=K2(q,Z),B=Array.from({length:J},()=>Array.from({length:X.unitCount},()=>!1)),N=[],V=({row:_,startCol:F,endCol:W,event:A,isTruncatedStart:z,isTruncatedEnd:O})=>{for(let I=F;I<=W;I++)B[_][I]=!0;let S=W-F+1;N.push({kind:"horizontal",event:A,left:F/X.unitCount*100,width:S/X.unitCount*100,row:_,isTruncatedStart:z,isTruncatedEnd:O})};for(let _ of Y){let F=E5(_,X),W=t0(B,F.startCol,F.endCol);if(W!==-1){V({row:W,event:_,...F});continue}for(let A=F.startCol+1;A<=F.endCol;A++){let z=t0(B,A,F.endCol);if(z!==-1){V({row:z,startCol:A,endCol:F.endCol,event:_,isTruncatedStart:!0,isTruncatedEnd:F.isTruncatedEnd});break}}}for(let _ of K){let W=E5(_,X).startCol,A=t0(B,W,W);if(A!==-1)V({row:A,startCol:W,endCol:W,event:_,isTruncatedStart:!1,isTruncatedEnd:!1})}return N};var e0=({days:Q,allDay:q,resourceId:J,gridType:Z})=>{let{getEventsForDateRange:$,dayMaxEvents:P}=R(),X=Q.at(0),Y=Q.at(-1),K=X?.startOf("day"),B=Y?.endOf("day"),N=s0(()=>{if(!K||!B)return[];let F=$(K,B);if(J)F=K0(F,J);if(q)F=F.filter((W)=>Boolean(W.allDay));return F},[$,K,B,J,q]),V=s0(()=>{let F=new Map;for(let W of Q){let A=m(W),z=W.startOf("day"),O=W.endOf("day"),S=N.filter((I)=>w0(I,z,O));F.set(A,S)}return F},[Q,N]);return{positionedEvents:s0(()=>{return D5({days:Q,events:N,dayMaxEvents:P,gridType:Z})},[Q,P,N,Z]),dayEventsMap:V}};import{jsx as v5,jsxs as z2}from"react/jsx-runtime";var c=({today:Q,dayNumber:q,weekday:J,className:Z,"data-testid":$})=>{return z2("div",{className:L("flex flex-col items-center",Z),"data-testid":$,"data-today":Q?"true":void 0,children:[J!=null&&v5("div",{className:L("w-full truncate text-center text-xs text-muted-foreground",Q&&"text-primary"),children:J}),v5("div",{className:L("flex h-5 w-5 shrink-0 items-center justify-center rounded-full text-xs font-medium",Q&&"bg-primary text-primary-foreground"),children:q})]})};import H2,{memo as I2,useMemo as T2}from"react";import{useMemo as B2}from"react";var g5=(Q)=>{let{businessHours:q,getResourceById:J}=R((Z)=>({businessHours:Z.businessHours,getResourceById:Z.getResourceById}));return B2(()=>{if(Q!=null){let Z=J(Q);if(Z?.businessHours)return Z.businessHours}return q},[Q,J,q])};import*as x from"@radix-ui/react-dialog";import{XIcon as L2}from"lucide-react";import{jsx as d,jsxs as Q5}from"react/jsx-runtime";function y5({...Q}){return d(x.Root,{"data-slot":"dialog",...Q})}function G2({...Q}){return d(x.Portal,{"data-slot":"dialog-portal",...Q})}function F2({className:Q,...q}){return d(x.Overlay,{className:L("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",Q),"data-slot":"dialog-overlay",...q})}function c5({className:Q,children:q,...J}){return Q5(G2,{"data-slot":"dialog-portal",children:[d(F2,{}),Q5(x.Content,{className:L("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg max-h-[90%]",Q),"data-slot":"dialog-content",...J,children:[q,Q5(x.Close,{className:"ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",children:[d(L2,{}),d("span",{className:"sr-only",children:"Close"})]})]})]})}function l5({className:Q,...q}){return d("div",{className:L("flex flex-col gap-2 text-center sm:text-left",Q),"data-slot":"dialog-header",...q})}function d9({className:Q,...q}){return d("div",{className:L("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",Q),"data-slot":"dialog-footer",...q})}function i5({className:Q,...q}){return d(x.Title,{className:L("text-lg leading-none font-semibold",Q),"data-slot":"dialog-title",...q})}function o9({className:Q,...q}){return d(x.Description,{className:L("text-muted-foreground text-sm",Q),"data-slot":"dialog-description",...q})}import{useImperativeHandle as M2,useState as u5}from"react";import{useDraggable as U2}from"@dnd-kit/core";import{memo as N2}from"react";import{jsx as V0,jsxs as _2}from"react/jsx-runtime";var A2=(Q,q)=>{if(Q&&q)return"rounded-none";if(Q)return"rounded-r-md rounded-l-none";if(q)return"rounded-l-md rounded-r-none";return"rounded-md"};function V2({elementId:Q,event:q,className:J,style:Z,disableDrag:$=!1,isTruncatedStart:P=!1,isTruncatedEnd:X=!1}){let{onEventClick:Y,renderEvent:K,disableEventClick:B,disableDragAndDrop:N}=R(),{attributes:V,listeners:_,setNodeRef:F,isDragging:W}=U2({id:Q,data:{event:q,type:"calendar-event"},disabled:$||N}),A=()=>{return _2("div",{className:L(q.backgroundColor||"bg-blue-500",q.color||"text-white","h-full w-full px-1 border-[1.5px] border-card text-left overflow-clip relative",A2(P,X)),style:{backgroundColor:q.backgroundColor,color:q.color},children:[P&&V0("div",{className:"absolute left-0 top-0 bottom-0 w-0.5 bg-foreground/25"}),V0("p",{className:L("text-[10px] font-semibold sm:text-xs mt-0.5",P&&"pl-1",X&&"pr-1"),children:q.title}),X&&V0("div",{className:"absolute right-0 top-0 bottom-0 w-0.5 bg-foreground/25"})]})},z=$||N;return V0(h,{className:L("truncate h-full w-full",z?B?"cursor-default":"cursor-pointer":"cursor-grab",W&&!z&&"cursor-grabbing shadow-lg",J),layout:!0,layoutId:Q,onClick:(M)=>{M.stopPropagation(),Y(q)},ref:F,style:Z,transitionKey:Q,...V,..._,children:K?K(q):V0(A,{})})}var p0=N2(V2,(Q,q)=>{return Q.elementId===q.elementId&&Q.disableDrag===q.disableDrag&&Q.className===q.className&&Q.event===q.event&&Q.isTruncatedStart===q.isTruncatedStart&&Q.isTruncatedEnd===q.isTruncatedEnd});import{jsx as _0,jsxs as O2}from"react/jsx-runtime";var d5=({ref:Q})=>{let[q,J]=u5(!1),[Z,$]=u5(null),{eventHeight:P}=R();return M2(Q,()=>({open:()=>J(!0),close:()=>J(!1),setSelectedDayEvents:(X)=>$(X)})),_0(y5,{onOpenChange:J,open:q,children:O2(c5,{className:"max-h-[80vh] max-w-md overflow-y-auto",children:[_0(l5,{children:_0(i5,{children:Z?.day.format("MMMM D, YYYY")})}),_0("div",{className:"mt-4 space-y-3",children:Z?.events.map((X)=>{return _0(p0,{className:"relative my-1",elementId:`all-events-dialog-event-${X.id}`,event:X,style:{height:`${P}px`}},X.id)})})]})})};import{useDroppable as W2}from"@dnd-kit/core";import{jsx as R2}from"react/jsx-runtime";function S2(Q,q,J){let Z=Q.hour(q??0).minute(J??0);if(q!==void 0&&J!==void 0)return{start:Z,end:Z.minute(J+15)};if(q!==void 0)return{start:Z,end:Z.hour(q+1).minute(0)};return{start:Z,end:Z.hour(23).minute(59)}}function o5({id:Q,type:q,date:J,hour:Z,minute:$,resourceId:P,allDay:X,children:Y,className:K,style:B,"data-testid":N,disabled:V=!1}){let{onCellClick:_,isCellDisabled:F,getCellClassName:W,getResourceById:A,disableDragAndDrop:z,disableCellClick:O,classesOverride:S,view:I}=R(),{start:M,end:U}=S2(J,Z,$),H=A?.(P),T={start:M,end:U,resource:H,allDay:X},b=V||Boolean(F?.(T)),w=O||b,{isOver:C,setNodeRef:r}=W2({id:Q,data:{type:q,date:J,hour:Z,minute:$,resourceId:P,allDay:X},disabled:z||b}),f=($0)=>{if($0.stopPropagation(),w)return;_(T)},y=C&&!z&&!b,s=S?.disabledCell||_5,Z0=W?.(T);return R2("div",{className:L("droppable-cell",K,Z0,y&&"bg-accent",w?"cursor-default":"cursor-pointer",b&&s),"data-all-day":X?"true":void 0,"data-disabled":b.toString(),"data-end":U.toISOString(),"data-resource-id":P,"data-start":M.toISOString(),"data-testid":N,"data-view":I,onClick:f,ref:r,style:B,children:Y})}import{jsx as E0,jsxs as D0,Fragment as r5}from"react/jsx-runtime";var b2=({day:Q,hour:q,minute:J,className:Z="",resourceId:$,gridType:P="day",shouldRenderEvents:X=!0,allDay:Y=!1,precomputedEvents:K,"data-testid":B,showDayNumber:N=!1,children:V})=>{let _=H2.useRef(null),{dayMaxEvents:F=0,getEventsForDateRange:W,currentDate:A,t:z,eventSpacing:O,eventHeight:S}=R(),I=g5($),M=T2(()=>{if(!X)return[];if(K)return K;let f=W(Q.startOf(P),Q.endOf(P));if(Y)f=f.filter((y)=>y.allDay);if($)return K0(f,$);return f},[K,Q,$,W,P,X,Y]),U=(f,y)=>{_.current?.setSelectedDayEvents({day:f,events:y}),_.current?.open()},H=Q.month()===A.month(),T=M.length-F,b=T>0,w=m5({date:Q,hour:P==="hour"?Q.hour():void 0,businessHours:I}),C=P==="hour"?G.cell.day(Q,Q.format("HH"),Q.format("mm")):G.cell.day(Q),r=G.droppable.dayCell(Q,{allDay:Y,resourceId:$});return D0(r5,{children:[E0(o5,{allDay:Y,className:L("cursor-pointer overflow-clip p-1 bg-background hover:bg-accent min-h-[60px] relative min-w-0",Z),"data-testid":B||C,date:Q,disabled:!w||!H,hour:q,id:r,minute:J,resourceId:$,type:"day-cell",children:D0("div",{className:"flex flex-col h-full w-full","data-testid":"grid-cell-content",style:{gap:`${O}px`},children:[N&&E0(c,{className:"items-start","data-testid":G.dayNumber(Q),dayNumber:Q.format("D"),today:k(Q)}),X&&D0(r5,{children:[M.slice(0,F).map((f,y)=>E0("div",{className:"w-full shrink-0","data-testid":f?.title,style:{height:`${S}px`}},G.listKey("empty",y,f.id))),b&&D0("div",{className:"text-muted-foreground hover:text-foreground cursor-pointer text-[10px] whitespace-nowrap sm:text-xs shrink-0 mt-1",onClick:(f)=>{f.stopPropagation(),U(Q,M)},onKeyDown:(f)=>{if(f.key==="Enter"||f.key===" ")f.preventDefault(),f.stopPropagation(),U(Q,M)},role:"button",tabIndex:0,children:["+",T," ",z("more")]})]}),V]})}),E0(d5,{ref:_})]})},q5=I2(b2);import{jsx as n5}from"react/jsx-runtime";var B0=({resource:Q,className:q,children:J,"data-testid":Z})=>{let{renderResource:$}=R();return n5("div",{className:L("flex items-center justify-center p-2",q),"data-testid":Z,style:{color:Q.color,backgroundColor:Q.backgroundColor},children:$?$(Q):J??n5("div",{className:"text-sm font-medium truncate",children:Q.title})})};import{memo as m2}from"react";import{memo as w2}from"react";import{jsx as M0,jsxs as a5,Fragment as j2}from"react/jsx-runtime";var f2=({rangeStart:Q,rangeEnd:q,now:J,axis:Z="vertical",render:$,withDot:P=!0})=>{let X=J??t5(),Y=X.valueOf();if(!(Y>=Q.valueOf()&&Y<q.valueOf()))return null;let B=q.diff(Q,"minute"),V=X.diff(Q,"minute")/B*100;if($)return M0(j2,{children:$({currentTime:X,rangeStart:Q,rangeEnd:q,progress:V,axis:Z})});if(Z==="horizontal")return a5("div",{className:"absolute top-0 bottom-0 z-50 flex -translate-x-1/2 flex-col items-center pointer-events-none","data-testid":"current-time-indicator",style:{left:`${V}%`},children:[P&&M0("div",{className:"size-2 shrink-0 rounded-full bg-red-500"}),M0("div",{className:"w-0.5 flex-1 bg-red-500"})]});return a5("div",{className:"absolute right-0 left-0 z-50 flex -translate-y-1/2 items-center pointer-events-none","data-testid":"current-time-indicator",style:{top:`${V}%`},children:[P&&M0("div",{className:"size-2 shrink-0 rounded-full bg-red-500"}),M0("div",{className:"h-0.5 flex-1 bg-red-500"})]})},s5=w2(f2);import{memo as h2}from"react";import{jsx as C2}from"react/jsx-runtime";var k2=({rangeStart:Q,rangeEnd:q,now:J,resource:Z,axis:$="vertical",withDot:P})=>{let{renderCurrentTimeIndicator:X,view:Y}=R((B)=>({renderCurrentTimeIndicator:B.renderCurrentTimeIndicator,view:B.view})),K;if(X)K=(B)=>X({...B,resource:Z,view:Y});return C2(s5,{axis:$,now:J,rangeEnd:q,rangeStart:Q,render:K,withDot:P})},e5=h2(k2);import{jsx as J5,jsxs as p2}from"react/jsx-runtime";var x2=({gridType:Q="day",days:q,resourceId:J,resource:Z,"data-testid":$,positionedEvents:P,dayNumberHeight:X=N5})=>{let{eventHeight:Y,eventSpacing:K,resources:B}=R(),N=q.at(0)?.startOf("day"),V=!J||B?.at(0)?.id===J,_=q.at(0),F=q.at(-1)?.add(1,Q),W=Q==="hour"&&Boolean(_&&F);return p2("div",{className:"absolute inset-0 pointer-events-none z-10 overflow-clip","data-testid":$,children:[W&&_&&F&&J5(e5,{axis:"horizontal",rangeEnd:F,rangeStart:_,resource:Z,withDot:V}),P.map((A)=>{let{event:z,row:O}=A,S=X+K+O*(Y+K),I=`${z.id}-${O}-${N?.toISOString()}-${J??"no-resource"}`;return J5("div",{className:"absolute z-10 pointer-events-auto overflow-clip","data-left":A.left,"data-testid":G.container.horizontal.event(z.id),"data-top":S,"data-width":A.width,style:{left:`calc(${A.left}% + var(--spacing) * 0.25)`,width:`calc(${A.width}% - var(--spacing) * 1)`,top:`${S}px`,height:`${Y}px`},children:J5(p0,{className:"h-full w-full shadow",elementId:I,event:z,isTruncatedEnd:A.isTruncatedEnd,isTruncatedStart:A.isTruncatedStart})},G.listKey(I,"wrapper"))})]})},Z5=m2(x2);import{jsx as i,jsxs as $5}from"react/jsx-runtime";var D2=({id:Q,resource:q,gridType:J="day",variant:Z="resource",dayNumberHeight:$,className:P,columns:X=[],allDay:Y,showDayNumber:K=!1})=>{let{renderResource:B}=R(),N=Z==="resource",V=X.some((A)=>A.days),_=E2(()=>{if(V)return[];return X.map((A)=>A.day).filter((A)=>Boolean(A))},[X,V]),{positionedEvents:F,dayEventsMap:W}=e0({days:_,gridType:J,resourceId:q?.id,allDay:Y});return $5("div",{className:L("flex flex-1 relative min-w-0",P),"data-testid":G.container.horizontal.row(Q),children:[N&&q&&i(B0,{className:"w-20 sm:w-40 border-r sticky left-0 bg-background z-20 h-full","data-testid":G.container.horizontal.rowLabel(q.id),resource:q,children:B?B(q):i("div",{className:"wrap-break-word text-sm",children:q.title})}),$5("div",{className:"relative flex-1 flex min-w-0",children:[i("div",{className:"flex w-full min-w-0 gap-px bg-border",children:X.map((A)=>{if(A.days)return i(v2,{allDay:Y,col:A,dayNumberHeight:$,gridType:J,id:Q,resource:q,resourceId:q?.id,showDayNumber:K},A.id);return A.day?i(q5,{allDay:Y,className:L("flex-1 w-20",A.className),day:A.day,gridType:J,hour:J==="hour"?A.day.hour():void 0,precomputedEvents:W.get(m(A.day)),resourceId:q?.id,showDayNumber:K},A.day.toISOString()):null})}),!V&&i("div",{className:"absolute inset-0 z-10 pointer-events-none",children:i(Z5,{"data-testid":G.container.eventsLayer("horizontal",Q),dayNumberHeight:$,days:_,gridType:J,positionedEvents:F,resource:q,resourceId:q?.id})})]})]})},v2=Q1(({col:Q,gridType:q="day",allDay:J,resource:Z,resourceId:$,dayNumberHeight:P,showDayNumber:X,id:Y})=>{let K=Q.days??[],{positionedEvents:B}=e0({days:K,gridType:q,resourceId:$,allDay:J});return $5("div",{className:"flex relative w-full",children:[i("div",{className:"flex w-full gap-px bg-border",children:K.map((N)=>i(q5,{allDay:J,className:L("flex-1 w-20",Q.className),day:N,gridType:q,hour:q==="hour"?N.hour():void 0,resourceId:$,showDayNumber:X},N.toISOString()))}),i("div",{className:"absolute inset-0 z-10 pointer-events-none",children:i(Z5,{"data-testid":G.container.eventsLayer("horizontal",Y),dayNumberHeight:P,days:K,gridType:q,positionedEvents:B,resource:Z,resourceId:$})})]})}),q1=Q1(D2);import{jsx as J1,jsxs as c2}from"react/jsx-runtime";var y2=({days:Q,classes:q,resource:J,showSpacer:Z=!0})=>{let $=Q.map((P,X)=>({id:G.col.allDay(P,X),day:P,gridType:"day",className:L("h-full min-h-12 bg-background",q?.cell)}));return c2("div",{className:L("flex w-full gap-px bg-border",q?.row),"data-testid":"all-day-row",children:[Z&&J1(x0,{className:q?.spacer}),J1(q1,{allDay:!0,className:"flex-1 min-h-fit",columns:$,dayNumberHeight:0,gridType:"day",id:G.allDayRow(J?.id),resource:J,variant:"regular"})]})},Z1=g2(y2);import{jsx as L0,jsxs as $1}from"react/jsx-runtime";var D="min-w-20 flex-1",X0=({resources:Q,days:q,gridType:J,cellClassName:Z})=>{let $=q.map((P)=>{let X=Array.isArray(P),Y=X?P.at(0):P;return{id:Y?G.col.day(Y):"day-col-unknown",day:X?void 0:P,days:X?P:void 0,className:Z,gridType:J}});return Q.map((P)=>({id:String(P.id),resource:P,columns:$}))},Y0=({resources:Q,gutter:q,columnsFor:J})=>[q,...Q.flatMap((Z)=>{let $=J(Z);return(Array.isArray($)?$:[$]).map((X)=>({...X,resource:Z}))})],v0=({resources:Q})=>$1("div",{className:"flex gap-px bg-border h-12 flex-1","data-testid":G.header.resource.columnsHeader,children:[L0("div",{className:L("shrink-0 sticky top-0 left-0 bg-background z-20",P0,l)}),Q.map((q)=>L0(B0,{className:L(D,"bg-background"),resource:q},G.listKey("resource-cell",q.id)))]}),G0=()=>{let{t:Q}=R((q)=>({t:q.t}));return L0("div",{className:"w-20 sm:w-40 border-b border-r shrink-0 flex justify-center items-center sticky top-0 left-0 bg-background z-20",children:L0("div",{className:"text-sm truncate px-1 min-w-0",children:Q("resources")})})},W4=({columns:Q})=>{let q=[],J=new Map;for(let Z of Q){if(!Z.resource||Z.noEvents||!Z.day)continue;let $=J.get(Z.resource.id);if(!$)$={resource:Z.resource,days:[],seenDayKeys:new Set},J.set(Z.resource.id,$),q.push($);let P=m(Z.day);if(!$.seenDayKeys.has(P))$.seenDayKeys.add(P),$.days.push(Z.day)}return $1("div",{className:"flex w-full gap-px bg-border",children:[L0(x0,{}),q.map(({resource:Z,days:$})=>L0(Z1,{classes:{cell:L("min-w-20",$.length>1&&"flex-1")},days:$,resource:Z,showSpacer:!1},G.allDayRow(Z.id)))]})};import{jsx as P5}from"react/jsx-runtime";var g0=({hours:Q,view:q,delayStep:J})=>P5("div",{className:L("flex gap-px bg-border border-b",b0),children:Q.map((Z,$)=>{let P=Z.isSame(j(),"hour"),X=Z.format("HH"),Y=G.header.week.hour(Z,$);return P5(h,{className:L(D,"bg-background flex items-center justify-center text-xs shrink-0",P&&"bg-blue-50 text-blue-600 font-medium"),"data-hour":X,"data-testid":G.header.resource.timeLabel(q,X),delay:$*J,transitionKey:G.listKey(Y,"motion"),children:P5(f0,{date:Z})},G.listKey(Y,"animated"))})});import{jsx as Q0,jsxs as Y1,Fragment as o2}from"react/jsx-runtime";var i2=({date:Q})=>{let{t:q}=R((Z)=>({t:Z.t})),J=k(Q);return Q0("div",{className:"flex flex-1 justify-center items-center min-h-12","data-testid":"day-view-header",children:Y1(h,{className:L("flex justify-center items-center text-center text-sm font-semibold sm:text-xl",J&&"text-primary"),transitionKey:m(Q),children:[Q.format("dddd, LL"),J&&Q0("span",{className:"bg-primary text-primary-foreground ml-2 rounded-full px-1 py-0.5 text-xs sm:px-2 sm:text-sm",children:q("today")})]})})},P1=(Q,q)=>m0({referenceDate:Q,businessHours:q.businessHours,hideNonBusinessHours:q.hideNonBusinessHours,allDates:[Q],resourceBusinessHours:C0(q.resources??[])}),u2=({date:Q,config:q})=>{let J=P1(Q,q);return Y1(o2,{children:[Q0(G0,{}),Q0("div",{className:"flex-1 flex flex-col",children:Q0(g0,{delayStep:p,hours:J,view:"day"})})]})},d2=(Q,q)=>{let J=q.resources??[],Z=P1(Q,q);if(!J.length)return[a({days:Z,gridType:"hour"}),{id:G.col.day(Q),day:Q,days:Z,className:L(C5,"flex-1"),gridType:"hour"}];if(q.orientation==="vertical")return Y0({resources:J,gutter:a({days:Z,gridType:"hour"}),columnsFor:($)=>({id:G.col.day(Q,$.id),days:Z,day:Q,gridType:"hour"})});return X0({resources:J,days:Z,gridType:"hour",cellClassName:D})},X1={name:"day",label:"day",icon:l2,navigationUnit:"day",layout:"vertical",supportsResources:!0,range:(Q)=>({start:Q.startOf("day"),end:Q.endOf("day")}),columns:d2,renderHeader:({date:Q,config:q})=>{let J=q.resources??[];if(!J.length)return Q0(i2,{date:Q});if(q.orientation==="vertical")return Q0(v0,{resources:J});return Q0(u2,{config:q,date:Q})}};import{Grid3x3 as r2}from"lucide-react";import{jsx as X5}from"react/jsx-runtime";var K1=({className:Q})=>{let{firstDayOfWeek:q,stickyViewHeader:J,viewHeaderClassName:Z,currentDate:$}=R(),P=E($,q);return X5("div",{className:L("flex w-full gap-px bg-border border-b",J&&"sticky top-0 z-20",Z,Q),"data-testid":"month-header",children:P.map((X,Y)=>X5(h,{className:"py-2 text-center font-medium bg-background flex-1 min-w-0","data-testid":G.header.weekday("month",X.format("ddd")),delay:Y*p,transitionKey:X.toISOString(),children:X5("span",{className:"text-sm capitalize truncate w-full block",children:X.format("ddd")})},X.toISOString()))})};import{jsx as q0,jsxs as e2,Fragment as s2}from"react/jsx-runtime";var n2=(Q,q)=>{let J=j0(Q);return Y0({resources:q,gutter:a({days:J,gridType:"day",renderLabel:(Z)=>q0(c,{className:"flex-col-reverse",dayNumber:Z.format("D"),today:k(Z),weekday:Z.format("ddd")})}),columnsFor:(Z)=>({id:G.col.resource("month",Z.id),day:void 0,days:J,gridType:"day"})})},a2=({date:Q})=>{let q=j0(Q);return e2(s2,{children:[q0(G0,{}),q0("div",{className:"flex flex-1 gap-px bg-border border-b",children:q.map((J,Z)=>{let $=G.header.resource.monthDay(J),P=k(J);return q0(h,{className:"flex-1 w-20 bg-background shrink-0 flex items-center justify-center flex-col",delay:Z*p,transitionKey:G.listKey($,"motion"),children:q0(c,{className:"flex-col-reverse",dayNumber:J.format("D"),today:P,weekday:J.format("ddd")})},G.listKey($,"animated"))})})]})},t2=(Q,q)=>{let J=q.resources??[];if(J.length){if(q.orientation==="vertical")return n2(Q,J);return X0({resources:J,days:j0(Q),gridType:"day"})}return n0(Q,q.firstDayOfWeek).map((Z,$)=>({id:G.listKey("week",$),columns:Z.map((P)=>({id:G.col.day(P),day:P,className:"w-auto",gridType:"day"})),className:"flex-1",showDayNumber:!0}))},z1={name:"month",label:"month",icon:r2,navigationUnit:"month",layout:"horizontal",supportsResources:!0,range:(Q,q)=>h0(Q,q.firstDayOfWeek),columns:t2,renderHeader:({date:Q,config:q})=>{let J=q.resources??[];if(!J.length)return q0(K1,{className:"h-12"});if(q.orientation==="vertical")return q0(v0,{resources:J});return q0(a2,{date:Q})}};import{Columns3 as qQ}from"lucide-react";import{jsx as y0}from"react/jsx-runtime";var B1=({days:Q})=>{let{weekViewGranularity:q}=R(),J=q==="hourly";return y0("div",{className:L("flex gap-px bg-border border-b",b0),children:Q.map((Z,$)=>{let P=k(Z),X=G.header.week.day(Z);return y0(h,{className:L("shrink-0 bg-background flex-1 flex items-center text-center font-medium min-w-20"),"data-testid":G.header.resource.weekDay,delay:$*p,transitionKey:G.listKey(X,"motion"),children:y0("div",{className:L(J?"sticky left-1/2":"w-full text-center"),children:y0(c,{dayNumber:Z.format("D"),today:P,weekday:Z.format("ddd")})})},G.listKey(X,"animated"))})})};import{jsx as c0,jsxs as QQ}from"react/jsx-runtime";var L1=({columns:Q})=>{let{currentDate:q}=R();return QQ("div",{className:"flex h-12 gap-px bg-border",children:[c0("div",{className:L("shrink-0 z-20 bg-background sticky left-0",P0,l),children:c0("span",{className:"px-2 h-full w-full flex justify-center items-start font-medium",children:q.week()})}),Q.map((J,Z)=>{let $=J.day;if(!$)return null;let P=k($),X=G.header.week.hour($,J.resourceId??"");return c0(h,{className:L(D,"flex flex-col items-center justify-center text-xs shrink-0 bg-background"),"data-testid":G.header.resource.timeLabel("week",$.format("HH")),delay:Z*p,transitionKey:G.listKey(X,"motion"),children:c0(c,{dayNumber:$.format("D"),today:P,weekday:$.format("ddd")})},G.listKey(X,"animated"))})]})};import{jsx as O0,jsxs as G1}from"react/jsx-runtime";var F1=({resources:Q})=>{let{weekViewGranularity:q,t:J,currentDate:Z}=R(),$=q==="hourly";return G1("div",{className:"flex h-12 gap-px bg-border",children:[O0("div",{className:L("shrink-0 z-20 bg-background sticky left-0",P0,l),children:G1("span",{className:L("px-2 h-full w-full flex flex-col justify-center text-xs text-muted-foreground text-center min-w-0",$?"justify-end":"justify-center"),children:[O0("span",{className:"truncate w-full",children:J("week")}),!$&&O0("span",{className:"font-medium text-foreground truncate w-full",children:Z.week()})]})}),Q.map((P)=>{return O0(B0,{className:L(D,"bg-background border-b"),resource:P,children:O0("div",{className:L("sticky text-sm font-medium truncate",$?"left-1/4":"left-1"),children:P.title})},G.listKey("resource-cell",P.id))})]})};import{jsx as v,jsxs as W0,Fragment as KQ}from"react/jsx-runtime";var l0=(Q,q)=>{let J=E(Q,q.firstDayOfWeek),{hiddenDays:Z}=q;if(!Z)return J;return J.filter(($)=>!Z.has($.day()))},i0=(Q)=>(Q.weekViewGranularity??"hourly")==="hourly",JQ=({date:Q,config:q})=>{let{t:J,selectDate:Z,openEventForm:$}=R((X)=>({t:X.t,selectDate:X.selectDate,openEventForm:X.openEventForm})),P=l0(Q,q);return W0("div",{className:"flex h-18 flex-1 gap-px bg-border","data-testid":"week-view-header",children:[v("div",{className:L(a0,"h-full shrink-0 items-center justify-center bg-background p-2 flex",l),children:W0("div",{className:"flex flex-col items-center justify-center min-w-0 w-full",children:[v("span",{className:"text-muted-foreground text-xs truncate w-full text-center",children:J("week")}),v("span",{className:"font-medium truncate w-full text-center",children:Q.week()})]})}),P.map((X,Y)=>{let K=k(X),B=G.header.week.day(X);return v(h,{className:L("hover:bg-accent bg-background flex-1 min-w-0 flex flex-col justify-center cursor-pointer p-1 text-center sm:p-2 w-20 h-full"),"data-testid":G.header.weekday("week",X.format("dddd")),delay:Y*p,onClick:()=>{Z(X),$({start:X})},transitionKey:B,children:v(c,{dayNumber:X.format("D"),today:K,weekday:X.format("ddd")})},B)})]})},F0=(Q,q,J)=>m0({referenceDate:Q,businessHours:q.businessHours,hideNonBusinessHours:q.hideNonBusinessHours,allDates:J,resourceBusinessHours:C0(q.resources??[])}),ZQ=(Q,q,J)=>{let Z=E(Q,q.firstDayOfWeek);if(i0(q)){let $=l0(Q,q);return Y0({resources:J,gutter:a({days:F0(Q,q,Z),gridType:"hour"}),columnsFor:(P)=>$.map((X)=>({id:G.col.day(X,P.id),className:D,day:X,days:F0(X,q,Z),gridType:"hour"}))})}return Y0({resources:J,gutter:a({days:Z,gridType:"day",renderLabel:($)=>v(c,{dayNumber:$.format("D"),today:k($),weekday:$.format("ddd")})}),columnsFor:($)=>({id:G.col.resource("week",$.id),className:D,day:void 0,days:Z,gridType:"day"})})},$Q=(Q,q,J)=>{let Z=E(Q,q.firstDayOfWeek);if(i0(q)){let $=Z.map((P)=>F0(P,q));return X0({resources:J,days:$,gridType:"hour",cellClassName:D})}return X0({resources:J,days:Z,gridType:"day",cellClassName:D})},PQ=({date:Q,config:q,resources:J})=>{let Z=l0(Q,q),$=i0(q),P=$?J.flatMap((X)=>Z.map((Y)=>({day:Y,resourceId:X.id}))):[];return W0("div",{className:"flex-1 flex flex-col",children:[v(F1,{resources:J}),$&&v(L1,{columns:P})]})},XQ=({date:Q,config:q})=>{let J=E(Q,q.firstDayOfWeek),Z=i0(q),$=Z?J.flatMap((P)=>F0(P,q)):[];return W0(KQ,{children:[v(G0,{}),W0("div",{className:"flex-1 flex flex-col",children:[v(B1,{days:J}),Z&&v(g0,{delayStep:O5,hours:$,view:"week"})]})]})},YQ=(Q,q)=>{let J=q.resources??[];if(J.length){if(q.orientation==="vertical")return ZQ(Q,q,J);return $Q(Q,q,J)}let Z=E(Q,q.firstDayOfWeek),$=l0(Q,q);return[a({days:F0(Q,q,Z),gridType:"hour",widthClassName:a0}),...$.map((P)=>({id:G.col.day(P),day:P,days:F0(P,q,Z),className:"flex-1 min-w-0",gridType:"hour"}))]},U1={name:"week",label:"week",icon:qQ,navigationUnit:"week",layout:"vertical",supportsResources:!0,range:(Q,q)=>{let J=E(Q,q.firstDayOfWeek),Z=J.at(0)??Q,$=J.at(-1)??Q;return{start:Z.startOf("day"),end:$.endOf("day")}},columns:YQ,renderHeader:({date:Q,config:q})=>{let J=q.resources??[];if(!J.length)return v(JQ,{config:q,date:Q});if(q.orientation==="vertical")return v(PQ,{config:q,date:Q,resources:J});return v(XQ,{config:q,date:Q,resources:J})}};import{Grid2x2 as GQ}from"lucide-react";import*as o from"@radix-ui/react-scroll-area";import{jsx as S0,jsxs as zQ}from"react/jsx-runtime";function N1({className:Q,children:q,viewPortProps:J,...Z}){return zQ(o.Root,{className:L("relative",Q),"data-slot":"scroll-area",...Z,children:[S0(o.Viewport,{...J,className:L("focus-visible:ring-ring/50 size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:outline-1",J?.className),"data-slot":"scroll-area-viewport",children:q}),S0(Y5,{}),S0(o.Corner,{})]})}function Y5({className:Q,orientation:q="vertical",...J}){return S0(o.ScrollAreaScrollbar,{className:L("flex touch-none p-px transition-colors select-none",q==="vertical"&&"h-full w-2.5 border-l border-l-transparent",q==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent",Q),"data-slot":"scroll-area-scrollbar",orientation:q,...J,children:S0(o.ScrollAreaThumb,{className:"bg-border relative flex-1 rounded-full","data-slot":"scroll-area-thumb"})})}import{jsx as J0,jsxs as R0}from"react/jsx-runtime";var BQ=["bg-primary","bg-blue-500","bg-green-500"],LQ=42,A1=()=>{let{currentDate:Q,selectDate:q,setView:J,getEventsForDateRange:Z,t:$,firstDayOfWeek:P}=R(),X=Q.year(),Y=E(j(),P).map((z)=>({id:z.day().toString(),label:z.format("dd")})),K=()=>{return Array.from({length:12},(z,O)=>{let S=j().year(X).month(O).startOf("month"),I=Z(S,S.endOf("month"));return{date:S,name:S.format("MMMM"),eventCount:I.length,monthKey:S.format("MM")}})},B=(z)=>{let O=z.startOf("month"),S=E(O,P).at(0)??O;return Array.from({length:LQ},(I,M)=>{let U=S.add(M,"day"),H=U.startOf("day"),T=U.endOf("day"),b=Z(H,T);return{date:U,dayKey:m(U),isInCurrentMonth:U.month()===z.month(),isToday:k(U),isSelected:U.isSame(Q,"day"),eventCount:b.length}})},N=(z,O,S)=>{S?.stopPropagation(),q(z),J(O)},V=(z)=>{let O=z===1?$("event"):$("events");return`${z} ${O}`},_=(z)=>{let S=z.isInCurrentMonth?"":"text-muted-foreground opacity-50",I=z.isToday?"bg-primary text-primary-foreground rounded-full":"",M=z.isSelected&&!z.isToday?"bg-muted rounded-full font-bold":"",U=z.eventCount>0&&!z.isToday&&!z.isSelected?"font-medium":"";return L("relative flex aspect-square w-full cursor-pointer flex-col items-center justify-center hover:bg-accent rounded-sm transition-colors duration-200",S,I,M,U)},F=(z,O)=>{return L("h-[3px] w-[3px] rounded-full",O?"bg-primary-foreground":z)},W=K(),A=(z)=>{if(z===0)return"";return V(z)};return R0(N1,{className:"h-full","data-testid":"year-view",children:[J0("div",{className:"grid auto-rows-fr grid-cols-1 gap-4 p-4 sm:grid-cols-2 lg:grid-cols-3","data-testid":"year-grid",children:W.map((z,O)=>{let S=B(z.date),I=O*p;return R0("div",{className:"hover:border-primary flex flex-col rounded-lg border p-3 text-left transition-all duration-200 hover:shadow-md","data-testid":G.header.year.month(z.monthKey),children:[R0(h,{className:"mb-2 flex items-center justify-between",delay:I,transitionKey:G.listKey("month",z.monthKey),children:[J0("button",{className:"text-lg font-medium hover:underline cursor-pointer","data-testid":G.header.year.month(z.monthKey,"title"),onClick:()=>N(z.date,"month"),type:"button",children:z.name}),z.eventCount>0&&J0("span",{className:"bg-primary text-primary-foreground rounded-full px-2 py-1 text-xs","data-testid":G.header.year.month(z.monthKey,"count"),children:V(z.eventCount)})]},G.listKey("month",z.monthKey)),R0("div",{className:"grid grid-cols-7 gap-px text-[0.6rem]","data-testid":G.header.year.month(z.monthKey,"mini"),children:[Y.map((M)=>J0("div",{className:"text-muted-foreground h-3 text-center",children:M.label},G.listKey("header",z.monthKey,M.id))),S.map((M)=>{let U=G.header.year.day(z.date.format("YYYY-MM"),M.dayKey),H=M.eventCount>0,T=Math.min(M.eventCount,3),b=BQ.slice(0,T);return R0("button",{className:_(M),"data-testid":U,onClick:(w)=>N(M.date,"day",w),title:A(M.eventCount),type:"button",children:[J0("span",{className:"text-center leading-none",children:M.date.date()}),H&&J0("div",{className:L("absolute bottom-0 flex w-full justify-center space-x-px",M.isToday&&"bottom-px"),children:b.map((w)=>J0("span",{className:F(w,M.isToday)},w))})]},M.dayKey)})]})]},z.monthKey)})}),J0(Y5,{className:"z-30"})]})};var V1={name:"year",label:"year",icon:GQ,navigationUnit:"year",supportsResources:!1,range:(Q)=>({start:Q.startOf("year"),end:Q.endOf("year")}),component:A1};var _1=[X1,U1,z1,V1];var K5=(Q,q,J)=>q?.range?.(Q,{firstDayOfWeek:J})??h0(Q,J),O1=({initialDate:Q,initialView:q,firstDayOfWeek:J,onDateChange:Z,onViewChange:$,pluginRuntime:P})=>{let[X,Y]=M1(j.isDayjs(Q)?Q:j(Q)),[K,B]=M1(q),N=t(()=>[..._1,...P.getViews()],[P]),V=t((M)=>N().find((U)=>U.name===M),[N]),_=t(()=>{return K5(X,V(K),J)},[X,K,J,V]),F=t((M)=>{Y(M);let U=K5(M,V(K),J);Z?.(M,U)},[Z,K,J,V]),W=F,A=t((M)=>{let U=V(K),H=U?.navigationStep??{amount:1,unit:U?.navigationUnit??"day"};F(X.add(M*H.amount,H.unit))},[X,K,F,V]),z=t(()=>A(1),[A]),O=t(()=>A(-1),[A]),S=t(()=>F(j()),[F]),I=t((M)=>{B(M),$?.(M);let U=K5(X,V(M),J);Z?.(X,U)},[$,Z,X,J,V]);return FQ(()=>({currentDate:X,setCurrentDate:Y,view:K,setView:I,selectDate:W,nextPeriod:z,prevPeriod:O,today:S,getCurrentViewRange:_,getAllViews:N}),[X,K,I,W,z,O,S,_,N])};import{createElement as UQ,Fragment as NQ}from"react";var W1=(Q)=>({transformEvents:(q,J)=>{return Q.reduce(($,P)=>P.transformEvents?P.transformEvents($,J):$,q).filter(($)=>w0($,J.start,J.end))},getEventManager:(q)=>Q.find((J)=>J.managesEvent?.(q)),collect:(q,J)=>Q.flatMap((Z)=>Z.contribute?.(q,J)??[]),renderSlot:(q,J)=>{let Z=[];for(let $ of Q){let P=$.renderSlot?.(q,J);if(P!==null&&P!==void 0)Z.push(UQ(NQ,{key:$.name},P))}return Z},getViews:()=>Q.flatMap((q)=>q.views??[]),getProviders:()=>Q.map((q)=>q.provider).filter((q)=>Boolean(q))});var AQ=[],VQ=[],I1=(Q)=>{let{events:q,firstDayOfWeek:J=0,initialView:Z="month",initialDate:$=j(),dayMaxEvents:P,businessHours:X,onEventAdd:Y,onEventUpdate:K,onEventDelete:B,onDateChange:N,onViewChange:V,locale:_,timezone:F,translations:W,translator:A,onEventClick:z,onCellClick:O,disableEventClick:S,disableCellClick:I,resources:M,orientation:U,weekViewGranularity:H}=Q,{plugins:T=VQ}=Q,b=S5({firstDayOfWeek:J,dayMaxEvents:P,businessHours:X,locale:_,translations:W,translator:A,resources:M,orientation:U,weekViewGranularity:H}),w=R1(()=>W1(T),[T]),C=O1({initialDate:$,initialView:Z,firstDayOfWeek:J,onDateChange:N,onViewChange:V,pluginRuntime:w}),r=T5({events:q,pluginRuntime:w,getCurrentViewRange:C.getCurrentViewRange,resources:b.resources??AQ,onEventAdd:Y,onEventUpdate:K,onEventDelete:B}),f=b5({currentDate:C.currentDate,t:b.t,disableEventClick:S,disableCellClick:I,onEventClick:z,onCellClick:O}),{setCurrentLocale:y}=b,{setCurrentDate:s}=C,{setCurrentEvents:Z0}=r,$0=H1(void 0);S1(()=>{if(_&&_!==$0.current)y(_),j.locale(_),s((n)=>n.locale(_)),$0.current=_},[_,y,s]);let U0=H1(F);return S1(()=>{if(F&&F!==U0.current)j.tz.setDefault(F),s((n)=>n.tz(F)),Z0((n)=>n.map((e)=>({...e,start:e.start.tz(F),end:e.end.tz(F)}))),U0.current=F},[F,s,Z0]),R1(()=>{let{setCurrentLocale:n,...e}=b,{getCurrentViewRange:u0,getAllViews:H0,...I0}=C,{setCurrentEvents:d0,...o0}=r;return{...e,...I0,...o0,...f,getViews:H0,getEventManager:w.getEventManager,renderSlot:w.renderSlot,collect:w.collect,getProviders:w.getProviders,getEventResourceIds:N0,currentRange:C.getCurrentViewRange()}},[b,C,r,f,w])};import{jsx as _Q}from"react/jsx-runtime";var T1=(Q,q)=>Q.reduceRight((J,Z,$)=>_Q(Z,{children:J},$),q);import{jsx as SQ}from"react/jsx-runtime";var OQ=[],WQ=(Q)=>{let{events:q=OQ,firstDayOfWeek:J=0,initialView:Z="month",initialDate:$,renderEvent:P,onEventClick:X,onCellClick:Y,isCellDisabled:K,getCellClassName:B,onViewChange:N,onEventAdd:V,onEventUpdate:_,onEventDelete:F,onDateChange:W,locale:A,timezone:z,disableCellClick:O,disableEventClick:S,disableDragAndDrop:I,dayMaxEvents:M,eventSpacing:U=U5,eventHeight:H=A5,stickyViewHeader:T=!0,viewHeaderClassName:b="",headerComponent:w,headerClassName:C,businessHours:r,renderEventForm:f,translations:y,translator:s,timeFormat:Z0="12-hour",classesOverride:$0,renderCurrentTimeIndicator:U0,renderHour:n,hideNonBusinessHours:e=!1,hideExportButton:u0=!1,hiddenDays:H0,slotDuration:I0=60,scrollTime:d0,plugins:o0,resources:b1,renderResource:z5,orientation:w1,weekViewGranularity:f1}=Q,B5=I1({events:q,firstDayOfWeek:J,initialView:Z,initialDate:$,dayMaxEvents:M,businessHours:r,onEventAdd:V,onEventUpdate:_,onEventDelete:F,onDateChange:W,onViewChange:N,locale:A,timezone:z,translations:y,translator:s,plugins:o0,onEventClick:X,onCellClick:Y,disableEventClick:S,disableCellClick:O,resources:b1,orientation:w1,weekViewGranularity:f1});return MQ(()=>{let{handleEventClick:j1,handleDateClick:h1,...k1}=B5;return{...k1,renderEvent:P,onEventClick:j1,onCellClick:h1,isCellDisabled:K,getCellClassName:B,locale:A,timezone:z,disableCellClick:O,disableEventClick:S,disableDragAndDrop:I,eventSpacing:U,eventHeight:H,stickyViewHeader:T,viewHeaderClassName:b,headerComponent:w,headerClassName:C,renderEventForm:f,timeFormat:Z0,classesOverride:$0,renderCurrentTimeIndicator:U0,renderHour:n,hideNonBusinessHours:e,hideExportButton:u0,hiddenDays:H0,slotDuration:I0,scrollTime:d0,renderResource:z5}},[B5,P,z5,K,B,A,z,O,S,I,U,H,T,b,w,C,f,Z0,$0,U0,n,e,u0,H0,I0,d0])},oZ=({children:Q,...q})=>{let J=WQ(q),Z=T1(J.getProviders(),Q);return SQ(T0.Provider,{value:J,children:Z})};
|
|
2
|
+
export{j as a,R as b,vQ as c,L as d,h as e,y5 as f,c5 as g,l5 as h,d9 as i,i5 as j,o9 as k,N1 as l,Y5 as m,k as n,E as o,n0 as p,G as q,g5 as r,U5 as s,A5 as t,M5 as u,cQ as v,P2 as w,x5 as x,K0 as y,p0 as z,q5 as A,e5 as B,q1 as C,a0 as D,Z1 as E,W4 as F,F5 as G,oZ as H};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{L as r}from"./chunk-jfadfww5.js";function n(e){if(e===void 0)return;if(r.isDayjs(e))return e;let t=r(e);return t.isValid()?t:void 0}var f=(...e)=>e.join("-");import{clsx as a}from"clsx";import{twMerge as s}from"tailwind-merge";function i(...e){return s(a(e))}
|
|
2
|
+
export{i as I,n as J,f as K};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import t from"dayjs";import z from"dayjs/plugin/isBetween.js";import O from"dayjs/plugin/isSameOrAfter.js";import c from"dayjs/plugin/isSameOrBefore.js";import Y from"dayjs/plugin/localeData.js";import D from"dayjs/plugin/localizedFormat.js";import h from"dayjs/plugin/minMax.js";import H from"dayjs/plugin/timezone.js";import M from"dayjs/plugin/utc.js";import $ from"dayjs/plugin/weekday.js";import b from"dayjs/plugin/weekOfYear.js";var i,v=(n,a,f)=>{let m=a.prototype,d=f.tz.setDefault;f.tz.setDefault=(r)=>{return i=r,d(r)};let{startOf:s,endOf:x}=m;function u(r,e){let o=r.$x?.$timezone||i;if(!o)return e;let l=f.tz(e.format("YYYY-MM-DDTHH:mm:ss"),o).utcOffset();if(e.utcOffset()!==l)return e.tz(o,!0);return e}m.startOf=function(r,e){let o=s.call(this,r,e);return u(this,o)},m.endOf=x};t.extend($);t.extend(b);t.extend(O);t.extend(c);t.extend(z);t.extend(h);t.extend(H);t.extend(M);t.extend(Y);t.extend(D);t.extend(v);var p=(...n)=>{return t.tz(...n)};Object.assign(p,t);var G=p;
|
|
2
|
+
export{G as L};
|